Dongbing Gu
/
ext_blinky
test
main.cpp@0:61c1b97ace71, 2017-01-11 (annotated)
- Committer:
- dgu
- Date:
- Wed Jan 11 13:59:59 2017 +0000
- Revision:
- 0:61c1b97ace71
Test
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
dgu | 0:61c1b97ace71 | 1 | #include "mbed.h" |
dgu | 0:61c1b97ace71 | 2 | #include "TextLCD.h" |
dgu | 0:61c1b97ace71 | 3 | SPI sw(p5, p6, p7); |
dgu | 0:61c1b97ace71 | 4 | DigitalOut cs(p8); |
dgu | 0:61c1b97ace71 | 5 | TextLCD lcd(p15, p16, p17, p18, p19, p20, TextLCD::LCD20x4); // rs, e, d4-d7 |
dgu | 0:61c1b97ace71 | 6 | |
dgu | 0:61c1b97ace71 | 7 | |
dgu | 0:61c1b97ace71 | 8 | int main() { |
dgu | 0:61c1b97ace71 | 9 | cs=0; |
dgu | 0:61c1b97ace71 | 10 | sw.format(16,0); |
dgu | 0:61c1b97ace71 | 11 | sw.frequency(1000000); |
dgu | 0:61c1b97ace71 | 12 | lcd.printf("Hello World!\n"); |
dgu | 0:61c1b97ace71 | 13 | while (1) { |
dgu | 0:61c1b97ace71 | 14 | sw.write(0x0000); |
dgu | 0:61c1b97ace71 | 15 | cs = 1; |
dgu | 0:61c1b97ace71 | 16 | cs=0; |
dgu | 0:61c1b97ace71 | 17 | wait(1); |
dgu | 0:61c1b97ace71 | 18 | sw.write(0x5555); |
dgu | 0:61c1b97ace71 | 19 | cs = 1; |
dgu | 0:61c1b97ace71 | 20 | cs=0; |
dgu | 0:61c1b97ace71 | 21 | wait(1); |
dgu | 0:61c1b97ace71 | 22 | sw.write(0xAAAA); |
dgu | 0:61c1b97ace71 | 23 | cs = 1; |
dgu | 0:61c1b97ace71 | 24 | cs=0; |
dgu | 0:61c1b97ace71 | 25 | wait(1); |
dgu | 0:61c1b97ace71 | 26 | sw.write(0xFFFF); |
dgu | 0:61c1b97ace71 | 27 | cs = 1; |
dgu | 0:61c1b97ace71 | 28 | cs=0; |
dgu | 0:61c1b97ace71 | 29 | wait(1); |
dgu | 0:61c1b97ace71 | 30 | } |
dgu | 0:61c1b97ace71 | 31 | } |
dgu | 0:61c1b97ace71 | 32 |