ERC1602-4 i2c Text LCD library for East Rising COG display in i2c mode using the ST7032i controller IC.
Embed:
(wiki syntax)
Show/hide line numbers
I2cBusDevice.h
00001 #include "mbed.h" 00002 00003 class I2cBusDevice { 00004 public: 00005 00006 I2cBusDevice( I2C *LCD, char dev_address ) { 00007 bus = LCD; 00008 device = dev_address; 00009 } 00010 00011 ~I2cBusDevice() { 00012 } 00013 00014 int write( char *data, int length ) { 00015 return ( bus->write( device, data, length) ); 00016 } 00017 00018 int read( char *data, int length ) { 00019 return ( bus->read( device, data, length) ); 00020 } 00021 00022 int read( char reg_ptr, char *data, int length ) { 00023 if ( bus->write( device, ®_ptr, 1 ) ) 00024 return ( 1 ); 00025 if ( bus->read( device, data, length ) ) 00026 return ( 1 ); 00027 return ( 0 ); 00028 } 00029 00030 protected: 00031 I2C *bus; 00032 char device; 00033 } 00034 ; 00035 00036
Generated on Wed Jul 20 2022 16:54:43 by
1.7.2