Ce programme a été adapté du programme Canary prévu pour 2 afficheur.
Dependencies: SPI_TFTx2_w9341 TFT_fonts mbed
main.cpp@0:3e86ee2d8c14, 2016-03-15 (annotated)
- Committer:
- schnf30
- Date:
- Tue Mar 15 14:56:05 2016 +0000
- Revision:
- 0:3e86ee2d8c14
Programme et Librairie for MIKROE-495
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
schnf30 | 0:3e86ee2d8c14 | 1 | #include "stdio.h" |
schnf30 | 0:3e86ee2d8c14 | 2 | #include "mbed.h" |
schnf30 | 0:3e86ee2d8c14 | 3 | #include "SPI_TFTx2_ILI9341.h" |
schnf30 | 0:3e86ee2d8c14 | 4 | #include "string" |
schnf30 | 0:3e86ee2d8c14 | 5 | #include "Arial12x12.h" |
schnf30 | 0:3e86ee2d8c14 | 6 | #include "Arial24x23.h" |
schnf30 | 0:3e86ee2d8c14 | 7 | |
schnf30 | 0:3e86ee2d8c14 | 8 | SPI_TFTx2_ILI9341 TFT(p5, p6, p7, p8, p9, p10,"TFT"); // mosi, miso, sclk, cs, reset, dc |
schnf30 | 0:3e86ee2d8c14 | 9 | |
schnf30 | 0:3e86ee2d8c14 | 10 | int main() { |
schnf30 | 0:3e86ee2d8c14 | 11 | TFT.claim(stdout); // send stdout to the TFT display |
schnf30 | 0:3e86ee2d8c14 | 12 | //TFT.claim(stderr); // send stderr to the TFT display |
schnf30 | 0:3e86ee2d8c14 | 13 | |
schnf30 | 0:3e86ee2d8c14 | 14 | TFT.background(Black); // set background to black |
schnf30 | 0:3e86ee2d8c14 | 15 | TFT.foreground(White); // set chars to white |
schnf30 | 0:3e86ee2d8c14 | 16 | TFT.cls(); // clear the screen |
schnf30 | 0:3e86ee2d8c14 | 17 | TFT.set_font((unsigned char*) Arial12x12); // select the font |
schnf30 | 0:3e86ee2d8c14 | 18 | |
schnf30 | 0:3e86ee2d8c14 | 19 | TFT.set_orientation(1); |
schnf30 | 0:3e86ee2d8c14 | 20 | printf(" Hello Mbed 0"); |
schnf30 | 0:3e86ee2d8c14 | 21 | TFT.set_font((unsigned char*) Arial24x23); // select font 2 |
schnf30 | 0:3e86ee2d8c14 | 22 | TFT.locate(48,115); |
schnf30 | 0:3e86ee2d8c14 | 23 | TFT.printf("I'm Corentin oups"); |
schnf30 | 0:3e86ee2d8c14 | 24 | TFT.fillrect(0,160,320,170,Blue); |
schnf30 | 0:3e86ee2d8c14 | 25 | TFT.fillrect(0,170,320,180,Red); |
schnf30 | 0:3e86ee2d8c14 | 26 | TFT.fillrect(0,180,320,190,White); |
schnf30 | 0:3e86ee2d8c14 | 27 | } |