Landtiger (LPC1768) graphics LCD demo.

Dependencies:   Tiger_LCD mbed

Dependents:   Tiger_LCD

See here for more info.

Revision:
4:cdeea87f25d8
Parent:
3:2dccfa0121de
--- a/GLCD_LPC1700.cpp	Fri Oct 30 01:26:40 2015 +0000
+++ b/GLCD_LPC1700.cpp	Tue Nov 24 22:33:20 2015 +0000
@@ -50,6 +50,9 @@
 #define BPP         16                  /* Bits per pixel                     */
 #define BYPP        ((BPP+7)/8)         /* Bytes per pixel                    */
 
+#define ROWS        (HEIGHT / CHAR_H)   /* Lines per screen                   */
+#define COLS        (WIDTH / CHAR_W)    /* Characters per line                */
+
 /*--------------- Graphic LCD interface hardware definitions -----------------*/
 
 /* Pin EN setting to 0 or 1                                                   */
@@ -1162,12 +1165,22 @@
 
 int GLCD::getDisplayXSize()
 {
-  return HEIGHT;
+  return WIDTH;  
 }
 
 int GLCD::getDisplayYSize()
 {
-  return WIDTH;
+  return HEIGHT;
+}
+
+int GLCD::getRows()
+{
+  return ROWS;
+}
+
+int GLCD::getCols()
+{
+  return COLS;
 }
 
 
@@ -1358,7 +1371,7 @@
 *   Return:                                                                    *
 *******************************************************************************/
 
-void GLCD::clearScreen (uint16_t color) {
+void GLCD::cls (uint16_t color) {
   unsigned int   i;
 
   setWindowMax();
@@ -1380,11 +1393,14 @@
   for(i = 0; i < (WIDTH*HEIGHT); i++)
     _wr_dat_only(color);
   _wr_dat_stop();
+  
+  _ln = 0;
+  _col = 0;
 }
 
 
 /*******************************************************************************
-* Draw character on given position                                             *
+* Draw character on given screen position                                      *
 *   Parameter:      x:        horizontal position                              *
 *                   y:        vertical position                                *
 *                   c:        pointer to character bitmap                      *
@@ -1444,7 +1460,7 @@
 
 void GLCD::DisplayChar (uint16_t ln, uint16_t col, uint8_t c) {
 
-  c -= 32;
+  c -= 32;  // 32 is ASCII Space
   // x = column, y = line
   DrawChar(col * CHAR_W, ln * CHAR_H, (uint16_t *)&Font_24x16[c * CHAR_H]);
 
@@ -1489,23 +1505,48 @@
 
 
 
-/** @brief Write single character to the display using the 8x8 fontable
+/** @brief Write single character to the display using the fontable
  *  @brief Start at current cursor location
- *  @param char chr character to write
+ *  @param int value character to write
 */
-void GLCD::writeChar(uint8_t chr) {
-  const uint8_t char_index = chr - 0x20;
+int GLCD::_putc(int value){
 
-//  for (uint8_t i = 0; i < 8; i++) {
-//    _sendData( font_8x8[char_index][i] );
-//  }
+  if (value == '\n') {
+    //No Character to write
+      
+    //Update Cursor      
+    _col = 0;
+    _ln++;
+    if (_ln >= ROWS) {
+      _ln = 0;
+    }      
+  }
+  else {
+    // Character to write
+    value -= 32;  // 32 is ASCII Space
+    // x = column, y = line
+    DrawChar(_col * CHAR_W, _ln * CHAR_H, (uint16_t *)&Font_24x16[value * CHAR_H]); 
 
-  // x = column, y = line
-  DrawChar(_col * CHAR_W, _ln * CHAR_H, (uint16_t *)&Font_24x16[chr * CHAR_H]);
-  _col++;
-  
+    //Update Cursor
+    _col++;
+    if (_col >= COLS) {
+      _col = 0;
+      _ln++;
+      if (_ln >= ROWS) {
+        _ln = 0;
+      }
+    }
+  } //if char to write  
+
+  return value;      
 }
 
+
+int GLCD::_getc() {
+  return -1;    
+}    
+
+
 void GLCD::drawHLine(int x, int y, int l)
 {
 //    char ch, cl;