ban4jp -
/
AkiSpiLcd_demo
Simple animation demo.
Fork of AkiSpiLcd_example by
main.cpp@1:be675380f70b, 2014-05-04 (annotated)
- Committer:
- k4zuki
- Date:
- Sun May 04 03:34:28 2014 +0000
- Revision:
- 1:be675380f70b
- Parent:
- 0:3569e2cfb60b
- Child:
- 3:8dbf3336dc66
library fix / scrolling hogepic
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
k4zuki | 0:3569e2cfb60b | 1 | #define MBEDSHIELD_050 |
k4zuki | 0:3569e2cfb60b | 2 | |
k4zuki | 0:3569e2cfb60b | 3 | #include "mbed.h" |
k4zuki | 0:3569e2cfb60b | 4 | #include "hogepic.h" |
k4zuki | 0:3569e2cfb60b | 5 | #include "AkiSpiLcd.h" |
k4zuki | 1:be675380f70b | 6 | |
k4zuki | 0:3569e2cfb60b | 7 | /* |
k4zuki | 1:be675380f70b | 8 | 1 SCLK D3=p13 |
k4zuki | 1:be675380f70b | 9 | 2 MOSI D5=p11 |
k4zuki | 1:be675380f70b | 10 | 3 CS D2=p14 |
k4zuki | 1:be675380f70b | 11 | 4 DISP enable D5=p22 |
k4zuki | 0:3569e2cfb60b | 12 | */ |
k4zuki | 1:be675380f70b | 13 | |
k4zuki | 0:3569e2cfb60b | 14 | AkiSpiLcd LCD(MOSI_, SCK_, D2, D5); |
k4zuki | 0:3569e2cfb60b | 15 | DigitalOut myled(LED1); |
k4zuki | 1:be675380f70b | 16 | Ticker disp; |
k4zuki | 0:3569e2cfb60b | 17 | extern volatile const uint8_t hogepic[]; |
k4zuki | 1:be675380f70b | 18 | |
k4zuki | 0:3569e2cfb60b | 19 | void dispinvert(void) |
k4zuki | 0:3569e2cfb60b | 20 | { |
k4zuki | 1:be675380f70b | 21 | LCD.cominvert(); |
k4zuki | 0:3569e2cfb60b | 22 | } |
k4zuki | 1:be675380f70b | 23 | |
k4zuki | 0:3569e2cfb60b | 24 | int main() |
k4zuki | 0:3569e2cfb60b | 25 | { |
k4zuki | 0:3569e2cfb60b | 26 | |
k4zuki | 0:3569e2cfb60b | 27 | wait_ms(1); |
k4zuki | 1:be675380f70b | 28 | // disp.attach(&dispinvert,0.1); |
k4zuki | 0:3569e2cfb60b | 29 | LCD.cls(); |
k4zuki | 0:3569e2cfb60b | 30 | LCD.updateSingle(10,(uint8_t*)(hogepic+2000)); |
k4zuki | 0:3569e2cfb60b | 31 | LCD.updateMulti(100,(240-100),(uint8_t*)(hogepic)); |
k4zuki | 1:be675380f70b | 32 | |
k4zuki | 1:be675380f70b | 33 | while(1) { |
k4zuki | 1:be675380f70b | 34 | for(int i=0;i<240;i++){ |
k4zuki | 1:be675380f70b | 35 | LCD.updateMulti(i,(240-i),(uint8_t*)(hogepic)); |
k4zuki | 1:be675380f70b | 36 | LCD.updateMulti(0,(i),(uint8_t*)(hogepic+50*(240-i))); |
k4zuki | 0:3569e2cfb60b | 37 | } |
k4zuki | 1:be675380f70b | 38 | /* myled = 1; |
k4zuki | 0:3569e2cfb60b | 39 | wait(0.2); |
k4zuki | 0:3569e2cfb60b | 40 | myled = 0; |
k4zuki | 1:be675380f70b | 41 | wait(0.2);*/ |
k4zuki | 0:3569e2cfb60b | 42 | } |
k4zuki | 0:3569e2cfb60b | 43 | } |
k4zuki | 0:3569e2cfb60b | 44 |