# You may distribute under the terms of either the GNU General Public License # or the Artistic License (the same terms as Perl itself) # # (C) Paul Evans, 2015-2021 -- leonerd@leonerd.org.uk use v5.26; use Object::Pad 0.57; package Device::Chip::MCP23S17 0.05; class Device::Chip::MCP23S17 :isa(Device::Chip::MCP23x17); use Future::AsyncAwait; =head1 NAME C - chip driver for a F =head1 DESCRIPTION This subclass of L provides the required methods to allow it to communicate with the SPI-attached F F version of the F family. =cut use constant PROTOCOL => "SPI"; method SPI_options { return ( mode => 0, max_bitrate => 1E6, ); } async method write_reg ( $reg, $data ) { await $self->protocol->write( pack "C C a*", ( 0x20 << 1 ), $reg, $data ); } async method read_reg ( $reg, $len ) { my $buf = await $self->protocol->readwrite( pack "C C a*", ( 0x20 << 1 ) | 1, $reg, "\x00" x $len ); return substr $buf, 2; } =head1 AUTHOR Paul Evans =cut 0x55AA;