Basic library for SHARP LCD LS027B4DH01/LS027B7DH01

Dependents:   AkiSpiLcd_demo AkiSpiLcd_demo2 LCDRAM AkiSpiLcd_example

Files at this revision

API Documentation at this revision

Comitter:
k4zuki
Date:
Thu Aug 28 17:23:43 2014 +0000
Parent:
6:e3ed7599692c
Child:
8:c99c1c99b34c
Commit message:
.

Changed in this revision

AkiSpiLcd.cpp Show annotated file Show diff for this revision Revisions of this file
AkiSpiLcd.h Show annotated file Show diff for this revision Revisions of this file
Ser23K256.lib Show annotated file Show diff for this revision Revisions of this file
--- a/AkiSpiLcd.cpp	Thu Aug 28 16:02:01 2014 +0000
+++ b/AkiSpiLcd.cpp	Thu Aug 28 17:23:43 2014 +0000
@@ -159,7 +159,11 @@
     */
 void AkiSpiLcd::ramReadSingle(int line, uint8_t* buffer, int screen){
     screen &=1;
-    screen<<=7;
+    if(screen==0){
+        screen=SCREEN0_BASE;
+    }else{
+        screen=SCREEN1_BASE;
+    }
 //    uint8_t buffer[50];
     line*=50;
     int address=screen+line;
@@ -181,7 +185,11 @@
     */
 void AkiSpiLcd::ramReadMulti(int line, int length, uint8_t* buffer, int screen){
     screen &=1;
-    screen<<=7;
+    if(screen==0){
+        screen=SCREEN0_BASE;
+    }else{
+        screen=SCREEN1_BASE;
+    }
     line*=50;
     int address=screen+line;
 //    for(int j=0;j<length;j++){
@@ -206,7 +214,11 @@
     */
 void AkiSpiLcd::ramWriteSingle(int line, uint8_t* data, int screen){
     screen &=1;
-    screen<<=7;
+    if(screen==0){
+        screen=SCREEN0_BASE;
+    }else{
+        screen=SCREEN1_BASE;
+    }
     line*=50;
     int address=screen+line;
     _ram->write(address,data,50);
@@ -225,7 +237,11 @@
     */
 void AkiSpiLcd::ramWriteMulti(int line, int length, uint8_t* data, int screen){
     screen &=1;
-    screen<<=7;
+    if(screen==0){
+        screen=SCREEN0_BASE;
+    }else{
+        screen=SCREEN1_BASE;
+    }
     line*=50;
     
     int address=screen+line;
@@ -246,12 +262,17 @@
 
     /** copies whole data in screen into LCD
     */
-void AkiSpiLcd::ram2lcd(int screen){
+void AkiSpiLcd::ram2lcd(int startline, int length, int screen){
     screen &=1;
-    screen<<=7;
+    if(screen==0){
+        screen=SCREEN0_BASE;
+    }else{
+        screen=SCREEN1_BASE;
+    }
+//    screen<<=7;
 
-    int address=screen;
-    uint8_t* dummy;
+    int address=screen+length*50;
+    uint8_t dummy[50];
     /*
     _csr=0; //select VRAM
     _spi.write(0x03);
@@ -261,10 +282,9 @@
     for(int j=0;j<240;j++){
         _ram->write(RAMMODE_BASE,(modeflag << 7) | (comflag << 6) | (clearflag << 5));
         _csl=1;
-        _ram->read(RAMMODE_BASE,dummy,2);
-        for(int i=0;i<50;i++){
-            _ram->read(address,dummy,50);
-        }
+        _ram->read(RAMMODE_BASE);
+        _ram->read(RAMLINE_BASE+startline);
+        _ram->read(address+50*j,dummy,50);
         _ram->read(RAMMODE_BASE+2,dummy,2);
         wait_us(5);
         _csl=0;
--- a/AkiSpiLcd.h	Thu Aug 28 16:02:01 2014 +0000
+++ b/AkiSpiLcd.h	Thu Aug 28 17:23:43 2014 +0000
@@ -90,7 +90,7 @@
     
     /** copies whole data in screen into LCD
     */
-    void ram2lcd(int screen);
+    void ram2lcd(int startline, int length, int screen);
 
 //    /** Enables/disables display. internal memory will not flushed
 //    * @param disp true = display is on / false = display is off
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Ser23K256.lib	Thu Aug 28 17:23:43 2014 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/marcelvandekamp/code/Ser23K256/#d8180cb9d9ab