Basic library for SHARP LCD LS027B4DH01/LS027B7DH01

Dependents:   AkiSpiLcd_demo AkiSpiLcd_demo2 LCDRAM AkiSpiLcd_example

Revision:
10:eed99ef09e63
Parent:
9:33d5888d1fb9
Child:
11:16647ecd67ce
--- a/AkiSpiLcd.h	Sun Sep 07 14:42:13 2014 +0000
+++ b/AkiSpiLcd.h	Mon Sep 15 14:12:33 2014 +0000
@@ -19,7 +19,7 @@
  * extern const uint8_t hogepic[];
  * int main()
  * {
- * 
+ *
  *   wait_ms(1);
  *   LCD.cls();
  *   LCD.updateSingle(10,(uint8_t*)(hogepic+2000));
@@ -34,16 +34,39 @@
  * }
  * @endcode
  */
-#define RAMLINE_BASE 0x6000
-#define RAMMODE_BASE 0x6100
-#define SCREEN0_BASE 0x0000
-#define SCREEN1_BASE 0x3000
+
+//#define RAMLINE_BASE 0x6000
+//#define RAMMODE_BASE 0x6100
+//#define SCREEN0_BASE 0x0000
+//#define SCREEN1_BASE 0x3000
 #define SCREEN0 0
 #define SCREEN1 1
- 
+
 class AkiSpiLcd
 {
 public:
+    //! base address list for 23K256
+    enum BASE_ADDR {
+        RAMLINE_BASE = 0x6000,
+        RAMMODE_BASE = 0x6100,
+        SCREEN0_BASE = 0x0000,
+        SCREEN1_BASE = 0x3000
+    };
+
+    //! mode codes for 23K256
+    enum MODE {
+        BYTE_MODE = 0x00,
+        SEQUENTIAL_MODE = 0x40
+    };
+
+    //! command codes for 23K256
+    enum COMMAND {
+        READ = 0x03,
+        WRITE = 0x02,
+        READ_STATUS = 0x05, // called RDSR in datasheet
+        WRITE_STATUS = 0x01 // called WRSR in datasheet
+    };
+
     /** Constructor
     * @param mosi SPI data input
     * @param mosi SPI data output
@@ -73,7 +96,7 @@
     /** Inverting internal COM signal
     */
     void cominvert();
-    
+
     /** Reads single line (400 bits = 50 bytes) from a screen
     */
     void ramReadSingle(int line, uint8_t* buffer, int screen);
@@ -81,7 +104,7 @@
     /** Reads multi lines(400 x N bits = 50 x N bytes) from a screen
     */
     void ramReadMulti(int startline, int length, uint8_t* buffer, int screen);
-    
+
     /** Writes single line (400 bits = 50 bytes) into a screen
     */
     void ramWriteSingle(int line, uint8_t* data, int screen);
@@ -89,7 +112,7 @@
     /** Writes multi lines(400 x N bits = 50 x N bytes) into a screen
     */
     void ramWriteMulti(int startline, int length, uint8_t* data, int screen);
-    
+
     /** copies whole data in screen into LCD
     */
     void ram2lcd(int startline, int length, int screen);
@@ -99,27 +122,27 @@
 //    */
 //    void dispOn(bool disp);
 
-/** read a byte from SRAM
-* @param address    The address to read from
-* @return the uint8_tacter at that address
-*/
+    /** read a byte from SRAM
+    * @param address    The address to read from
+    * @return the uint8_tacter at that address
+    */
     uint8_t ram_read(int address);
-/** read multiple bytes from SRAM into a buffer
-* @param address    The SRAM address to read from
-* @param buffer     The buffer to read into (must be big enough!)
-* @param count      The number of bytes to read
-*/
+    /** read multiple bytes from SRAM into a buffer
+    * @param address    The SRAM address to read from
+    * @param buffer     The buffer to read into (must be big enough!)
+    * @param count      The number of bytes to read
+    */
     void ram_read(int address, uint8_t * buffer, int count);
-/** write a byte to SRAM
-* @param address    The address SRAM to write to
-* @param byte       The byte to write there
-*/
+    /** write a byte to SRAM
+    * @param address    The address SRAM to write to
+    * @param byte       The byte to write there
+    */
     void ram_write(int address, uint8_t byte);
     /** write multiple bytes to SRAM from a buffer
-* @param address    The SRAM address write to
-* @param buffer     The buffer to write from
-* @param count      The number of bytes to write
-*/
+    * @param address    The SRAM address write to
+    * @param buffer     The buffer to write from
+    * @param count      The number of bytes to write
+    */
     void ram_write(int address, uint8_t * buffer, int count);
 
 private: