Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of SPI18TFT by
main.cpp@1:a7ccea14bb0d, 2013-12-06 (annotated)
- Committer:
- alex_asi_elec
- Date:
- Fri Dec 06 21:39:48 2013 +0000
- Revision:
- 1:a7ccea14bb0d
- Parent:
- 0:309c546f048d
fonctionne sur l'?cran
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| smultron1977 | 0:309c546f048d | 1 | #include "stdio.h" |
| smultron1977 | 0:309c546f048d | 2 | #include "stdlib.h" |
| smultron1977 | 0:309c546f048d | 3 | #include "math.h" |
| smultron1977 | 0:309c546f048d | 4 | #include "mbed.h" |
| smultron1977 | 0:309c546f048d | 5 | #include "ST7735_TFT.h" |
| smultron1977 | 0:309c546f048d | 6 | #include "string" |
| smultron1977 | 0:309c546f048d | 7 | #include "Arial12x12.h" |
| smultron1977 | 0:309c546f048d | 8 | #include "Arial24x23.h" |
| smultron1977 | 0:309c546f048d | 9 | #include "Arial28x28.h" |
| smultron1977 | 0:309c546f048d | 10 | |
| alex_asi_elec | 1:a7ccea14bb0d | 11 | #define SCREEN_WIDTH 160 |
| alex_asi_elec | 1:a7ccea14bb0d | 12 | #define SCREEN_HEIGHT 128 |
| smultron1977 | 0:309c546f048d | 13 | |
| smultron1977 | 0:309c546f048d | 14 | |
| smultron1977 | 0:309c546f048d | 15 | |
| smultron1977 | 0:309c546f048d | 16 | |
| smultron1977 | 0:309c546f048d | 17 | |
| smultron1977 | 0:309c546f048d | 18 | // the TFT is connected to SPI pin 5-7, CS is p8, RS is p11, reset is p15 |
| alex_asi_elec | 1:a7ccea14bb0d | 19 | ST7735_TFT TFT(p11, p12, p13, p14, p16, p17,"TFT"); // mosi, miso, sclk, cs, rs, reset |
| smultron1977 | 0:309c546f048d | 20 | |
| smultron1977 | 0:309c546f048d | 21 | Serial pc(USBTX, USBRX); // tx, rx |
| smultron1977 | 0:309c546f048d | 22 | Timer t; |
| smultron1977 | 0:309c546f048d | 23 | |
| smultron1977 | 0:309c546f048d | 24 | extern unsigned char p1[]; // the mbed logo |
| smultron1977 | 0:309c546f048d | 25 | |
| smultron1977 | 0:309c546f048d | 26 | int main() { |
| alex_asi_elec | 1:a7ccea14bb0d | 27 | TFT.set_orientation(3); |
| alex_asi_elec | 1:a7ccea14bb0d | 28 | |
| smultron1977 | 0:309c546f048d | 29 | TFT.claim(stdout); // send stdout to the TFT display |
| smultron1977 | 0:309c546f048d | 30 | //TFT.claim(stderr); // send stderr to the TFT display |
| smultron1977 | 0:309c546f048d | 31 | |
| smultron1977 | 0:309c546f048d | 32 | TFT.background(Black); // set background to black |
| smultron1977 | 0:309c546f048d | 33 | TFT.foreground(White); // set chars to white |
| smultron1977 | 0:309c546f048d | 34 | |
| smultron1977 | 0:309c546f048d | 35 | TFT.cls(); |
| smultron1977 | 0:309c546f048d | 36 | TFT.set_font((unsigned char*) Arial24x23); // select the font |
| alex_asi_elec | 1:a7ccea14bb0d | 37 | |
| smultron1977 | 0:309c546f048d | 38 | TFT.locate(0,10); |
| smultron1977 | 0:309c546f048d | 39 | TFT.set_font((unsigned char*) Arial12x12); // select the font |
| alex_asi_elec | 1:a7ccea14bb0d | 40 | printf(" Hello world!"); |
| alex_asi_elec | 1:a7ccea14bb0d | 41 | TFT.circle(70, 70, 30, Red); |
| alex_asi_elec | 1:a7ccea14bb0d | 42 | TFT.fillrect(20, 100, 100, 130, Blue); |
| smultron1977 | 0:309c546f048d | 43 | } |
