driver demo for univision oled dispaly

Dependencies:   4spi_oled_ssd1305 mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 #include "mbed.h"
00002 #include "4spi_oled_ssd1305.h"
00003 
00004 /* re writtten to cope with teh ssd1306 driven oled UG-2864HSWEG01 from univision
00005 wiring for test circuit
00006 OLED pins -FUNCTION-------MBED PINns
00007 1 ----3.3V--- Vout (p40)
00008 2 ----0.0V--- GND (p1)
00009 3 ----------- GND (p1)
00010 4 ----------- GND (p1)
00011 5 ----------- GND (p1)
00012 6 ----------- GND (p1)
00013 7 ----------- GND (p1)
00014 8 ----------- N/C
00015 9 ----D1---- mosi (p5)
00016 10 ---D0------sck(p7)
00017 11 ----------- GND (p1)
00018 12 ----------- GND (p1)
00019 13 ---DC------ p10
00020 14 ---RES----- p9
00021 15 ---CS------ p8
00022 */
00023 
00024 
00025 
00026 DigitalOut myled(LED1);
00027 
00028 // Create object and load font
00029 //SPKDisplay( mosiPin, clkPin,  csPin,  dcPin, resPin, Serial *debugSerial)
00030 SPKDisplay screen(p5, p7, p8, p10, p9);
00031 int main()
00032 {
00033     char msg[22];
00034     sprintf(msg,"                      ");
00035 //           01234567890abcdefghij
00036 
00037     int i=0;
00038     while(1==1) {
00039         myled=1;
00040         // nice logo output
00041         screen.welcome();
00042         wait(3);
00043 
00044         wait(2);
00045         for(i=0; i<5; i++) {
00046             myled=0;
00047             screen.inverse();
00048             wait(1);
00049             screen.normal();
00050             myled=1;
00051             wait(1);
00052         }
00053 
00054         screen.fontdemo();
00055         myled=0;
00056         wait(5);
00057         screen.clearBuffer();
00058         screen.sendBuffer();
00059         myled=1;
00060         wait(0.5);
00061         myled=0;
00062         wait(0.5);
00063 
00064         for(i=0; i<8; i++) {
00065             sprintf(msg,"HELLO WORLD %d",i);
00066             screen.textToBuffer(msg, i);
00067             screen.sendBuffer();
00068             screen.clearBuffer();
00069             myled=1;
00070             wait(1);
00071         }
00072     }
00073 
00074 
00075 }