scrolling example code for SHARP LCD LS027B4DH01/LS027B7DH01, using AkiSpiLcd library

Dependencies:   AkiSpiLcd mbed

This is very basic library example to access a graphic LCD LS027B4DH01 or LS027B7DH01

Import libraryAkiSpiLcd

Basic library for SHARP LCD LS027B4DH01/LS027B7DH01

  • schematic example1: /media/uploads/k4zuki/akispilcd_v2.1m.sch.png
  • schematic example2: /media/uploads/k4zuki/2.7inchshield.sch.png
  • example1 photo: /media/uploads/k4zuki/2014-09-17_20.22.26.jpg /media/uploads/k4zuki/2014-09-17_20.22.48.jpg
  • example2 photo: /media/uploads/k4zuki/2014-04-29_13.17.57.jpg
  • example2 movie (mpeg4 movie):
Revision:
1:be675380f70b
Parent:
0:3569e2cfb60b
Child:
3:8dbf3336dc66
--- a/main.cpp	Thu May 01 00:01:02 2014 +0000
+++ b/main.cpp	Sun May 04 03:34:28 2014 +0000
@@ -3,78 +3,42 @@
 #include "mbed.h"
 #include "hogepic.h"
 #include "AkiSpiLcd.h"
+
 /*
-1 SCLK d3=p13
-2 MOSI d5=p11
-3 CS d2=p14
-4 DISP enable d7=p24
+1 SCLK D3=p13
+2 MOSI D5=p11
+3 CS D2=p14
+4 DISP enable D5=p22
 */
-/*
-SPI LCD(MOSI_,NC,SCK_);
-DigitalOut CS(D2);
-DigitalOut DISP(D5);
-DigitalOut COMCLK(D4);
-*/
+
 AkiSpiLcd LCD(MOSI_, SCK_, D2, D5);
 DigitalOut myled(LED1);
-//Ticker disp;
+Ticker disp;
 extern volatile const uint8_t hogepic[];
-/*
+
 void dispinvert(void)
 {
+    LCD.cominvert();
 }
-*/
+
 int main()
 {
 
     wait_ms(1);
+//    disp.attach(&dispinvert,0.1);
     LCD.cls();
     LCD.updateSingle(10,(uint8_t*)(hogepic+2000));
     LCD.updateMulti(100,(240-100),(uint8_t*)(hogepic));
-/*
-//    disp.attach(&dispinvert,0.1);
-    CS=0;
-
-    LCD.format(8,0);
-    LCD.frequency(1000000);
-
-    CS=1;
-    LCD.write(0x20);
-    LCD.write(0x00);
-    wait_us(5);
-    CS=0;
-
-    DISP=1;
-
-    CS=1;
-    LCD.write(0x80);
-    for(int j=0; j<240; j++) {
-        LCD.write(
-            ( ( (j+1) & 0x01 ) << 7 )|
-            ( ( (j+1) & 0x02 ) << 5 )|
-            ( ( (j+1) & 0x04 ) << 3 )|
-            ( ( (j+1) & 0x08 ) << 1 )|
-            ( ( (j+1) & 0x10 ) >> 1 )|
-            ( ( (j+1) & 0x20 ) >> 3 )|
-            ( ( (j+1) & 0x40 ) >> 5 )|
-            ( ( (j+1) & 0x80 ) >> 7 )
-        );
-
-        for(int i=0; i<50; i++) {
-//            LCD.write(0xf0);
-            LCD.write(hogepic[50*j+i]);
-        }
-        LCD.write(0x00);
-        LCD.write(0x00);
+    
+    while(1) {
+    for(int i=0;i<240;i++){
+        LCD.updateMulti(i,(240-i),(uint8_t*)(hogepic));
+        LCD.updateMulti(0,(i),(uint8_t*)(hogepic+50*(240-i)));
     }
-    wait_us(2);
-    CS=0;
-*/
-    while(1) {
-        myled = 1;
+/*        myled = 1;
         wait(0.2);
         myled = 0;
-        wait(0.2);
+        wait(0.2);*/
     }
 }