Strawberry Linux LCD module interface

Dependents:   uGen4x

Fork of LCD by Hiroshi Yamaguchi

Revision:
1:105c1b8f0c0e
Parent:
0:b3def1d4f466
--- a/LCD.cpp	Thu Dec 22 06:12:07 2011 +0000
+++ b/LCD.cpp	Fri Sep 02 13:13:33 2016 +0000
@@ -52,7 +52,8 @@
 // Set DDRAM Address
 #define SET_DDRAM_ADDRESS 0x80
 
-Serial pc(USBTX, USBRX);
+#define SET_CGRAM_ADDRESS 0x40
+//Serial pc(USBTX, USBRX);
 LCD::LCD(PinName sdaPin, PinName sclPin, PinName resetPin, PinName backlightPin, int contrast, bool cursor, bool blink)
         : _reset(resetPin), backlight(backlightPin), i2c(sdaPin, sclPin), contrast(contrast), cursor(cursor), blink(blink) {
     resetEnabled = resetPin != NC;
@@ -130,6 +131,13 @@
     return -1;
 }
 
+void LCD::setCGRAM(uint8_t addr ,char *data) {
+    writeCommand(FUNCTION_SET | DL | N | (IS & 0));
+    writeCommand(SET_CGRAM_ADDRESS | addr);
+    writeData(data, 8);
+    writeCommand(FUNCTION_SET | DL | N | (IS & 1));
+}
+
 void LCD::scrollDown() {
     writeCommand(SET_DDRAM_ADDRESS | 0x00);
     writeData(row2, sizeof(row2));
@@ -190,4 +198,4 @@
 void LCD::setBacklight(bool on) {
     if (backlightEnabled)
         backlight = on;
-}
\ No newline at end of file
+}