Strawberry Linux LCD module interface

Dependents:   uGen4x

Fork of LCD by Hiroshi Yamaguchi

Files at this revision

API Documentation at this revision

Comitter:
p_igmon
Date:
Fri Sep 02 13:13:33 2016 +0000
Parent:
0:b3def1d4f466
Commit message:
?

Changed in this revision

LCD.cpp Show annotated file Show diff for this revision Revisions of this file
LCD.h Show annotated file Show diff for this revision Revisions of this file
diff -r b3def1d4f466 -r 105c1b8f0c0e LCD.cpp
--- 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
+}
diff -r b3def1d4f466 -r 105c1b8f0c0e LCD.h
--- a/LCD.h	Thu Dec 22 06:12:07 2011 +0000
+++ b/LCD.h	Fri Sep 02 13:13:33 2016 +0000
@@ -28,6 +28,7 @@
     void reset();
     void cls();
     void locate(int column, int row);
+    void setCGRAM(uint8_t addr ,char data[]);
     void showIcon(Icon icon);
     void hideIcon(Icon icon);
     void setBacklight(bool on);