Skip to content

Commit

Permalink
swap calls to set_pin_mode and report_digital/analog to trigger a mes…
Browse files Browse the repository at this point in the history
…sage with latest ConfigurableFirmata
  • Loading branch information
ntruchsess committed Nov 22, 2013
1 parent 72181ae commit 3b9073a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/Device/Firmata/Platform.pm
Original file line number Diff line number Diff line change
Expand Up @@ -398,15 +398,15 @@ sub pin_mode {

( $mode == PIN_INPUT or $mode == PIN_OUTPUT ) and do {
my $port_number = $pin >> 3;
$self->{io}->data_write($self->{protocol}->message_prepare( REPORT_DIGITAL => $port_number, 1 ));
$self->{io}->data_write($self->{protocol}->message_prepare( SET_PIN_MODE => 0, $pin, $mode ));
$self->{io}->data_write($self->{protocol}->message_prepare( REPORT_DIGITAL => $port_number, 1 ));
last;
};

$mode == PIN_ANALOG and do {
my $port_number = $pin >> 3;
$self->{io}->data_write($self->{protocol}->message_prepare( REPORT_ANALOG => $port_number, 1 ));
$self->{io}->data_write($self->{protocol}->message_prepare( SET_PIN_MODE => 0, $pin, $mode ));
$self->{io}->data_write($self->{protocol}->message_prepare( REPORT_ANALOG => $port_number, 1 ));
last;
};

Expand Down

0 comments on commit 3b9073a

Please sign in to comment.