a modified version of N5110 library to be used with freescale boards

Revision:
1:df68f34cd32d
Parent:
0:d563e74f0ae9
Child:
2:e93021cfb0a9
--- a/N5110.cpp	Sun Jan 26 18:55:16 2014 +0000
+++ b/N5110.cpp	Sun Jan 26 19:30:09 2014 +0000
@@ -1,7 +1,7 @@
 #include "mbed.h"
 #include "N5110.h"
 
-N5110::N5110(PinName pwrPin, PinName ledPin, PinName scePin, PinName rstPin, PinName dcPin, PinName mosiPin, PinName sclkPin)
+N5110::N5110(PinName pwrPin, PinName scePin, PinName rstPin, PinName dcPin, PinName mosiPin, PinName sclkPin, PinName ledPin)
 {
     
     spi = new SPI(mosiPin,NC,sclkPin); // create new SPI instance and initialise
@@ -18,24 +18,36 @@
 void N5110::init()
 {
     turnOn();    // power up
-    reset();     // reset LCD
+    reset();     // reset LCD - must be done within 100 ms
 
     // function set - extended
     sendCommand(0x20 | CMD_FS_ACTIVE_MODE | CMD_FS_HORIZONTAL_MODE | CMD_FS_EXTENDED_MODE);
 
-    sendCommand(CMD_VOP_7V38);    // operating voltage
+    sendCommand(CMD_VOP_7V38);    // operating voltage - these values are from Chris Yan's Library
     sendCommand(CMD_TC_TEMP_2);   // temperature control
     sendCommand(CMD_BI_MUX_48);   // bias
 
     // function set - basic
     sendCommand(0x20 | CMD_FS_ACTIVE_MODE | CMD_FS_HORIZONTAL_MODE | CMD_FS_BASIC_MODE);
+    normalMode();  // normal video mode by default
     sendCommand(CMD_DC_NORMAL_MODE);  // black on white
-    //sendLCDCommand(CMD_DC_INVERT_VIDEO);  // white on black
+    //sendCommand(CMD_DC_INVERT_VIDEO);  // white on black
 
     // RAM is undefined at power-up so clear
     clearRAM();
 
 }
+ 
+// sets normal video mode (black on white) 
+void N5110::normalMode() {
+     sendCommand(CMD_DC_NORMAL_MODE);  
+   
+}
+
+// sets normal video mode (white on black) 
+void N5110::inverseMode() {
+    sendCommand(CMD_DC_INVERT_VIDEO); 
+}
 
 // function to power up the LCD and backlight
 void N5110::turnOn()
@@ -183,6 +195,8 @@
         sendData(font5x7[(c - 32)*5 + j]);
         // array is offset by 32 relative to ASCII, each character is 5 pixels wide
     }
+    
+    sendData(0); // send an empty byte to introduce space between characters
 
 }