C.Dupaty 03-2018 test on NUCLEO STM32-F411RE LCD 2x16, I2C interface Chinese model, adress I2C=0x4E (search on AliExpress for IIC/I2C 1602 Module) Important ! configure in TextLCD_Config.h : Valid only one of the lines : #define DFROBOT 0 // chinese OK #define YWROBOT 0 // chinese 0K #define SYDZ 1 // chinese OK Font is the same as http://www.farnell.com/datasheets/2362518.pdf
Fork of TextLCD by
/* Hello World! for the TextLCD Enhanced Library C.Dupaty 03-2018 test on NUCLEO STM32-F411RE LCD 2x16, I2C interface Chinese model, adress I2C=0x4E (search on AliExpress for IIC/I2C 1602 Module) Important ! configure in TextLCD_Config.h : Valid only one of the lines :
- define DFROBOT 0 chinese OK
- define YWROBOT 0 chinese 0K
- define SYDZ 1 chinese OK Font is the same as http://www.farnell.com/datasheets/2362518.pdf
- /
Diff: TextLCD.cpp
- Revision:
- 11:9ec02df863a1
- Parent:
- 10:dd9b3a696acd
- Child:
- 12:6bf9d9957d31
--- a/TextLCD.cpp Mon Feb 04 21:48:24 2013 +0000 +++ b/TextLCD.cpp Tue Feb 05 21:03:43 2013 +0000 @@ -84,15 +84,15 @@ break; } - writeCommand(0x0C); // Display Ctrl 0000 1 D C B - // Display On, Cursor Off, Blink Off - _cursor = CurOff; - writeCommand(0x06); // Entry Mode 0000 01 CD S // Cursor Direction and Display Shift // CD=1 (Cur incr) // S=0 (No display shift) +// writeCommand(0x0C); // Display Ctrl 0000 1 D C B +// // Display On, Cursor Off, Blink Off + cursor(TextLCD::CurOff_BlkOff); + cls(); } @@ -326,25 +326,43 @@ } -TextLCD::LCDCursor TextLCD::cursor(TextLCD::LCDCursor show) { - LCDCursor cur = _cursor; +void TextLCD::cursor(TextLCD::LCDCursor show) { switch (show) { - case CurOn : writeCommand(0x0F); // Cursor on and Blink char - wait_us(40); - _cursor = show; - break; - case CurOff : writeCommand(0x0C); - wait_us(40); - _cursor = show; - break; + case CurOff_BlkOff : writeCommand(0x0C); // Cursor off and Blink Off + wait_us(40); + _cursor = show; + break; + + case CurOn_BlkOff : writeCommand(0x0E); // Cursor on and Blink Off + wait_us(40); + _cursor = show; + break; + + case CurOff_BlkOn : writeCommand(0x0D); // Cursor off and Blink On + wait_us(40); + _cursor = show; + break; + + case CurOn_BlkOn : writeCommand(0x0F); // Cursor on and Blink char + wait_us(40); + _cursor = show; + break; + default : - break; + break; } - return cur; + } +void TextLCD::setUDC(unsigned char c, char *udc_data) { + writeCommand(0x40 + ((c & 0x07) << 3)); //Set CG-RAM address + + for (int i=0; i<8; i++) { + writeData(*udc_data++); + } +}