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):

main.cpp

Committer:
k4zuki
Date:
2014-05-01
Revision:
0:3569e2cfb60b
Child:
1:be675380f70b

File content as of revision 0:3569e2cfb60b:

#define MBEDSHIELD_050

#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
*/
/*
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;
extern volatile const uint8_t hogepic[];
/*
void dispinvert(void)
{
}
*/
int main()
{

    wait_ms(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);
    }
    wait_us(2);
    CS=0;
*/
    while(1) {
        myled = 1;
        wait(0.2);
        myled = 0;
        wait(0.2);
    }
}