Dan East / TextLCD

Dependents:   HD44780-LCD_with_Bluetooth

Fork of TextLCD by Simon Ford

Files at this revision

API Documentation at this revision

Comitter:
daneast
Date:
Tue Nov 04 03:06:01 2014 +0000
Parent:
8:308d188a2d3a
Commit message:
Add routine to define custom character bitmaps.

Changed in this revision

TextLCD.cpp Show annotated file Show diff for this revision Revisions of this file
TextLCD.h Show annotated file Show diff for this revision Revisions of this file
--- a/TextLCD.cpp	Thu Jan 02 21:07:01 2014 +0000
+++ b/TextLCD.cpp	Tue Nov 04 03:06:01 2014 +0000
@@ -64,6 +64,14 @@
     _row = row;
 }
 
+void TextLCD::defineChar(int index, char *data) {
+    if (index<0||index>7)
+        return;
+    writeCommand(0x40+index*8);
+    for (int i=0; i<8; i++)
+        writeData(*data++);
+}
+
 int TextLCD::_putc(int value) {
     if (value == '\n') {
         _column = 0;
--- a/TextLCD.h	Thu Jan 02 21:07:01 2014 +0000
+++ b/TextLCD.h	Tue Nov 04 03:06:01 2014 +0000
@@ -80,10 +80,17 @@
      * @param column  The horizontal position from the left, indexed from 0
      * @param row     The vertical position from the top, indexed from 0
      */
-    void locate(int column, int row);
+    void locate(int column, int row);    
 
     /** Clear the screen and locate to 0,0 */
     void cls();
+    
+    /** Defines a custom character bitmap
+     *
+     * @param index The index of the custom character slot (0-7)
+     * @param data  Array of 8 bytes defining the custom character.
+     */
+    void defineChar(int index, char *data);
 
     int rows();
     int columns();