Device::Chip::BV4243 - chip driver for a BV4243
Device::Chip::BV4243
use Device::Chip::BV4243; use Future::AsyncAwait; my $chip = Device::Chip::BV4243->new; await $chip->mount( Device::Chip::Adapter::...->new ); await $chip->lcd_reset; await $chip->lcd_string( "Hello, world!" );
This Device::Chip subclass provides specific communication to a ByVac BV4243 LCD/touchpad display module attached to a computer via an I²C adapter.
The reader is presumed to be familiar with the general operation of this module; the documention here will not attempt to explain or define module-specific concpets or features, only the use of this module to access them.
The following methods documented in an await expression return Future instances.
await
await $chip->clear_keys;
Clears the keypad buffer.
$count = await $chip->get_keycount;
Returns the number of keys waiting in the keypad buffer.
$key = await $chip->get_key;
Returns the next key from the keypad buffer, or 0 if there are none.
$pos = await $chip->find_key( $key );
Returns the position in the key buffer of the given key, or 0 if is not there.
$code = await $chip->get_scancode;
Returns the scan value from the keypad scanning matrix. This will be 0 if no key is being touched, or an integer value with at least two bits set if a key is being held.
await $chip->beep( $msec );
Turns on the BELL output line for the specified number of miliseconds.
BELL
@channels = await $chip->read_chan;
Returns the raw touchpad sensor values as 8 16bit integers.
@deltas = await $chip->read_delta;
Returns the touchpad sensor values minus the trigger value.
await $chip->sleep;
Puts the device into sleep mode. It stops scanning the keypad, but will still respond to another command which will wake it up again.
await $chip->lcd_reset;
Resets the LCD.
await $chip->lcd_command( $cmd );
Sends a numeric command to the LCD controller.
await $chip->lcd_data( $data );
Sends a byte of numerical data to the LCD controller.
await $chip->lcd_string( $str );
Sends a string of data to the LCD controller. This is a more efficient version of sending each byte of the string individually using "lcd_data".
await $chip->lcd_signon;
Displays the signon string stored the in EEPROM.
await $chip->lcd_backlight( $red, $green, $blue );
Sets the level of each of the three backlight channels. Each must be a numeric value between 0 and 10 (inclusive). For single-backlight displays, use the $red channel.
$red
$chip->reset
Resets the device.
$id = await $chip->device_id;
Returns the device ID value as a 16 bit integer
$id = await $chip->version;
Returns the device firmware version as a 16 bit integer
await $chip->eeprom_reset;
Resets the configuration EEPROM back to default values.
$val = await $chip->eeprom_read( $addr );
Reads a byte from the configuration EEPROM.
await $chip->eeprom_write( $addr, $val );
Writes a byte to the configuration EEPROM.
http://www.pichips.co.uk/index.php/BV4243
Paul Evans <leonerd@leonerd.org.uk>
To install Device::Chip::BV4243, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Device::Chip::BV4243
CPAN shell
perl -MCPAN -e shell install Device::Chip::BV4243
For more information on module installation, please visit the detailed CPAN module installation guide.