/***************************************************************************** source::worx libPiGPio Copyright © 2022 c.holzheuer chris@sourceworx.org This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. Uses: pigpiod_if2 by joan2937, pigpio @ abyz.me.uk https://abyz.me.uk/rpi/pigpio sigslot by 2017 Pierre-Antoine Lacaze https://github.com/palacaze/sigslot ***************************************************************************/ #include pigLCD::pigLCD( i2c_addr_t addr, i2c_bus_t bus ) { init( addr, bus ); } pigLCD::~pigLCD() { reset(); } void pigLCD::init( i2c_addr_t addr, i2c_bus_t bus, int width, bool bl, uint8_t RS, uint8_t , uint8_t E, uint8_t BL, uint8_t B4 ) { _i2c.init( addr, bus ); _width = width; _backlight = bl; _RS = (1<>4) & 0x0F; uint8_t LSN = bits & 0x0F; uint8_t MSb = MSN << _B4; uint8_t LSb = LSN << _B4; put_byte( MSb, LSb ); } void pigLCD::put_data( uint8_t bits ) { uint8_t MSN = (bits>>4) & 0x0F; uint8_t LSN = bits & 0x0F; uint8_t MSb = (MSN << _B4) | _RS; uint8_t LSb = (LSN << _B4) | _RS; put_byte( MSb, LSb ); }