Nikita Ivanykov
/
LAB_DISPLAY
7
main.cpp@1:cdeae0693b01, 2017-10-29 (annotated)
- Committer:
- codebreaker7
- Date:
- Sun Oct 29 09:34:33 2017 +0000
- Revision:
- 1:cdeae0693b01
- Parent:
- 0:02841331478b
- Child:
- 2:82f5f57eac91
Corrected some init signals
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
codebreaker7 | 0:02841331478b | 1 | #include "mbed.h" |
codebreaker7 | 0:02841331478b | 2 | #include "ILI9341_Defines.h" |
codebreaker7 | 0:02841331478b | 3 | |
codebreaker7 | 0:02841331478b | 4 | SPI spi_dev(PB_15, PB_14, PB_13); |
codebreaker7 | 0:02841331478b | 5 | DigitalOut cs(PC_4); |
codebreaker7 | 0:02841331478b | 6 | DigitalOut ao(PB_3); |
codebreaker7 | 0:02841331478b | 7 | |
codebreaker7 | 0:02841331478b | 8 | void writecommand(uint8_t command) { |
codebreaker7 | 0:02841331478b | 9 | cs = 0; |
codebreaker7 | 0:02841331478b | 10 | ao = 0; |
codebreaker7 | 0:02841331478b | 11 | spi_dev.write(command); |
codebreaker7 | 0:02841331478b | 12 | cs = 1; |
codebreaker7 | 0:02841331478b | 13 | } |
codebreaker7 | 0:02841331478b | 14 | |
codebreaker7 | 0:02841331478b | 15 | void writedata(uint8_t data) { |
codebreaker7 | 0:02841331478b | 16 | cs = 0; |
codebreaker7 | 0:02841331478b | 17 | ao = 1; |
codebreaker7 | 0:02841331478b | 18 | spi_dev.write(data); |
codebreaker7 | 0:02841331478b | 19 | cs = 1; |
codebreaker7 | 0:02841331478b | 20 | } |
codebreaker7 | 0:02841331478b | 21 | |
codebreaker7 | 0:02841331478b | 22 | int main() { |
codebreaker7 | 1:cdeae0693b01 | 23 | HAL_Init(); |
codebreaker7 | 0:02841331478b | 24 | #include "ILI9341_Init.h" |
codebreaker7 | 1:cdeae0693b01 | 25 | //cs = 0; |
codebreaker7 | 1:cdeae0693b01 | 26 | //cs = 1; |
codebreaker7 | 1:cdeae0693b01 | 27 | //cs = 0; |
codebreaker7 | 0:02841331478b | 28 | while(1) { |
codebreaker7 | 0:02841331478b | 29 | } |
codebreaker7 | 0:02841331478b | 30 | } |