SG12864A

Dependents:   SG12864A_TestProgram

Committer:
shintamainjp
Date:
Tue Jul 20 03:59:17 2010 +0000
Revision:
1:aacd73a4e7ee
Parent:
0:238f2d048222
Child:
2:91c03e41c927

        

Who changed what in which revision?

UserRevisionLine numberNew contents of line
shintamainjp 0:238f2d048222 1 /**
shintamainjp 0:238f2d048222 2 * SG12864A Graphics LCD module driver class (Version 0.0.1)
shintamainjp 0:238f2d048222 3 *
shintamainjp 0:238f2d048222 4 * Copyright (C) 2010 Shinichiro Nakamura (CuBeatSystems)
shintamainjp 0:238f2d048222 5 * http://shinta.main.jp/
shintamainjp 0:238f2d048222 6 */
shintamainjp 0:238f2d048222 7
shintamainjp 0:238f2d048222 8 #include "mbed.h"
shintamainjp 0:238f2d048222 9 #include "SG12864A.h"
shintamainjp 0:238f2d048222 10
shintamainjp 0:238f2d048222 11 int main() {
shintamainjp 0:238f2d048222 12
shintamainjp 0:238f2d048222 13 SG12864A lcd(p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15, p16, p17, p18);
shintamainjp 1:aacd73a4e7ee 14 #if 0
shintamainjp 1:aacd73a4e7ee 15 lcd.clear();
shintamainjp 0:238f2d048222 16 lcd.reset();
shintamainjp 0:238f2d048222 17
shintamainjp 0:238f2d048222 18 {
shintamainjp 0:238f2d048222 19 static const int pages = 8;
shintamainjp 0:238f2d048222 20 static const int columns = 64;
shintamainjp 0:238f2d048222 21 for (int i = 0; i < pages; i++) {
shintamainjp 0:238f2d048222 22 lcd.setPageAddress(SG12864A::CS1, i);
shintamainjp 0:238f2d048222 23 lcd.setPageAddress(SG12864A::CS2, i);
shintamainjp 0:238f2d048222 24 for (int j = 0; j < columns; j++) {
shintamainjp 0:238f2d048222 25 uint8_t n = 1 << (j % 8);
shintamainjp 0:238f2d048222 26 lcd.setColumnAddress(SG12864A::CS1, j);
shintamainjp 0:238f2d048222 27 lcd.setColumnAddress(SG12864A::CS2, j);
shintamainjp 0:238f2d048222 28 lcd.writeData(SG12864A::CS1, n);
shintamainjp 0:238f2d048222 29 lcd.writeData(SG12864A::CS2, n);
shintamainjp 0:238f2d048222 30 }
shintamainjp 0:238f2d048222 31 }
shintamainjp 0:238f2d048222 32 }
shintamainjp 0:238f2d048222 33
shintamainjp 0:238f2d048222 34 uint8_t n = 0;
shintamainjp 0:238f2d048222 35 while (1) {
shintamainjp 0:238f2d048222 36 lcd.setDisplayStartLine(SG12864A::CS1, n);
shintamainjp 0:238f2d048222 37 lcd.setDisplayStartLine(SG12864A::CS2, n);
shintamainjp 0:238f2d048222 38 n++;
shintamainjp 0:238f2d048222 39 wait_ms(100);
shintamainjp 0:238f2d048222 40 }
shintamainjp 1:aacd73a4e7ee 41 #else
shintamainjp 1:aacd73a4e7ee 42 lcd.clear();
shintamainjp 1:aacd73a4e7ee 43 lcd.reset();
shintamainjp 1:aacd73a4e7ee 44 while (1) {
shintamainjp 1:aacd73a4e7ee 45 //
shintamainjp 1:aacd73a4e7ee 46 lcd.bufferClear();
shintamainjp 1:aacd73a4e7ee 47 lcd.bufferDrawLine(0, 0, SG12864A::PIXEL_X - 1, SG12864A::PIXEL_Y - 1);
shintamainjp 1:aacd73a4e7ee 48 lcd.bufferDrawLine(0, SG12864A::PIXEL_Y - 1, SG12864A::PIXEL_X - 1, 0);
shintamainjp 1:aacd73a4e7ee 49 lcd.bufferPush();
shintamainjp 1:aacd73a4e7ee 50 wait_ms(1000);
shintamainjp 1:aacd73a4e7ee 51 //
shintamainjp 1:aacd73a4e7ee 52 lcd.bufferClear();
shintamainjp 1:aacd73a4e7ee 53 lcd.bufferDrawBox(0, 0, SG12864A::PIXEL_X - 1, SG12864A::PIXEL_Y - 1);
shintamainjp 1:aacd73a4e7ee 54 lcd.bufferPush();
shintamainjp 1:aacd73a4e7ee 55 wait_ms(1000);
shintamainjp 1:aacd73a4e7ee 56 //
shintamainjp 1:aacd73a4e7ee 57 lcd.bufferClear();
shintamainjp 1:aacd73a4e7ee 58 lcd.bufferFillBox(0, 0, SG12864A::PIXEL_X - 1, SG12864A::PIXEL_Y - 1);
shintamainjp 1:aacd73a4e7ee 59 lcd.bufferPush();
shintamainjp 1:aacd73a4e7ee 60 wait_ms(1000);
shintamainjp 1:aacd73a4e7ee 61 }
shintamainjp 1:aacd73a4e7ee 62 #endif
shintamainjp 0:238f2d048222 63 }