2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-03-10 03:06:37 +00:00

FRM: update Device::Firmata to 0.56 (adds new method 'sysex_send')

git-svn-id: https://svn.fhem.de/fhem/trunk@6061 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
ntruchsess 2014-06-04 20:06:44 +00:00
parent 16b90be0b8
commit 9c49740b21
3 changed files with 28 additions and 2 deletions

View File

@ -15,11 +15,11 @@ Device::Firmata - Perl interface to Firmata for the arduino platform.
=head1 VERSION
Version 0.50
Version 0.56
=cut
our $VERSION = '0.55';
our $VERSION = '0.56';
our $DEBUG = 0;

View File

@ -570,6 +570,12 @@ sub sampling_interval {
return $self->{io}->data_write($sampling_interval_packet);
}
sub sysex_send {
my ( $self, @sysex_data ) = @_;
my $sysex_packet = $self->{protocol}->packet_sysex(@sysex_data);
return $self->{io}->data_write($sysex_packet);
}
sub i2c_write {
my ($self,$address,@data) = @_;
return $self->{io}->data_write($self->{protocol}->packet_i2c_request($address,0x0,@data));

View File

@ -365,6 +365,26 @@ sub message_prepare {
return $packet;
}
=head2 packet_sysex
create a binary packet containing a sysex-message
=cut
sub packet_sysex {
my ( $self, @sysex_data ) = @_;
my $protocol_version = $self->{protocol_version};
my $protocol_commands = $COMMANDS->{$protocol_version};
my $bytes = @sysex_data + 2;
my $packet = pack "C" x $bytes, $protocol_commands->{START_SYSEX},
@sysex_data,
$protocol_commands->{END_SYSEX};
return $packet;
}
=head2 packet_sysex_command
create a binary packet containing a sysex-command