Test code for the touch display, should output the number 12.
Dependencies: SPI_TFT_ILI9341 TFT_fonts mbed
Fork of TFT_Mikroelectronika_IL9341_sketchpad by
main.cpp@10:0352f75f87c1, 2017-05-24 (annotated)
- Committer:
- JHutchinson
- Date:
- Wed May 24 13:53:20 2017 +0000
- Revision:
- 10:0352f75f87c1
- Parent:
- 9:6b60556b4cdf
Code slimmed down so we have the necessary components
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
dreschpe | 0:7c3b9bfd6ead | 1 | |
dreschpe | 0:7c3b9bfd6ead | 2 | #include "stdio.h" |
dreschpe | 0:7c3b9bfd6ead | 3 | #include "mbed.h" |
dreschpe | 0:7c3b9bfd6ead | 4 | #include "SPI_TFT_ILI9341.h" |
dreschpe | 0:7c3b9bfd6ead | 5 | #include "string" |
dreschpe | 0:7c3b9bfd6ead | 6 | #include "Arial12x12.h" |
dreschpe | 0:7c3b9bfd6ead | 7 | #include "Arial24x23.h" |
dreschpe | 0:7c3b9bfd6ead | 8 | #include "Arial28x28.h" |
dreschpe | 0:7c3b9bfd6ead | 9 | #include "font_big.h" |
cstevens | 4:14043cafbec7 | 10 | |
cstevens | 6:18c7288b5e00 | 11 | Serial pc (USBTX,USBRX); |
cstevens | 4:14043cafbec7 | 12 | |
cstevens | 6:18c7288b5e00 | 13 | // the display has a backlight switch on board |
JHutchinson | 10:0352f75f87c1 | 14 | DigitalOut LCD_LED(PTA13); |
JHutchinson | 10:0352f75f87c1 | 15 | DigitalOut pwr(PTD7); |
dreschpe | 0:7c3b9bfd6ead | 16 | |
dreschpe | 0:7c3b9bfd6ead | 17 | // the TFT is connected to SPI pin 5-7 |
pegcjs | 1:e0479f60cd48 | 18 | //SPI_TFT_ILI9341 TFT(p5, p6, p7, p8, p9, p10,"TFT"); // mosi, miso, sclk, cs, reset, dc for lpc1768 |
cstevens | 5:424af4fa03ab | 19 | SPI_TFT_ILI9341 TFT(PTD2, PTD3, PTD1, PTD5, PTD0, PTA13,"TFT"); // mosi, miso, sclk, cs, reset, dc for frdmkl25z |
cstevens | 4:14043cafbec7 | 20 | |
dreschpe | 0:7c3b9bfd6ead | 21 | int main() |
dreschpe | 0:7c3b9bfd6ead | 22 | { |
pegcjs | 3:676adf84c914 | 23 | pwr=1; |
JHutchinson | 8:3ae0674601ec | 24 | |
pegcjs | 2:25bfb21253a6 | 25 | LCD_LED = 1; // backlight on |
cstevens | 6:18c7288b5e00 | 26 | |
dreschpe | 0:7c3b9bfd6ead | 27 | TFT.claim(stdout); // send stdout to the TFT display |
dreschpe | 0:7c3b9bfd6ead | 28 | TFT.set_orientation(1); |
dreschpe | 0:7c3b9bfd6ead | 29 | TFT.background(Black); // set background to black |
dreschpe | 0:7c3b9bfd6ead | 30 | TFT.foreground(White); // set chars to white |
dreschpe | 0:7c3b9bfd6ead | 31 | TFT.cls(); // clear the screen |
JHutchinson | 10:0352f75f87c1 | 32 | |
dreschpe | 0:7c3b9bfd6ead | 33 | TFT.set_orientation(0); |
dreschpe | 0:7c3b9bfd6ead | 34 | TFT.background(Black); |
dreschpe | 0:7c3b9bfd6ead | 35 | TFT.cls(); |
dreschpe | 0:7c3b9bfd6ead | 36 | |
JHutchinson | 10:0352f75f87c1 | 37 | TFT.set_font((unsigned char*) Arial28x28); |
JHutchinson | 10:0352f75f87c1 | 38 | TFT.locate(1,1); |
JHutchinson | 10:0352f75f87c1 | 39 | printf("12"); |
JHutchinson | 8:3ae0674601ec | 40 | |
JHutchinson | 8:3ae0674601ec | 41 | } |