Henrique Rosa
/
ILI9341_01_PAR8_Teste_V3
Testanto funções Display
Diff: main.cpp
- Revision:
- 2:f603020cd6ec
- Parent:
- 1:a5ccd53612ea
- Child:
- 3:34ff58aca6db
- Child:
- 4:2d8f54d22dbd
diff -r a5ccd53612ea -r f603020cd6ec main.cpp --- a/main.cpp Wed Apr 21 14:54:37 2021 +0000 +++ b/main.cpp Thu Apr 22 16:06:53 2021 +0000 @@ -1,20 +1,18 @@ -// link: -// https://os.mbed.com/users/davidprentice/code/Nucleo_dir_L152//file/d88d2ad55fac/main.cpp/ -// Committer: davidprentice -// Date: 19 months ago -// 2021-04-21 -// Testado com sucesso na NUCLEO-F103RB + ILI9341 Arduino Shield -// interface paralela >>> ver "dataBus" -// usando mbed 2.0 +// ****** Henrique ****** 22/04/21 +// Testanto funções Display +// ************** Display TFT- ILI9341 Versão V 2 ************** \\ + + + #include "Arduino.h" - #include <MCUFRIEND_kbv.h> + MCUFRIEND_kbv tft; - + Serial pc(SERIAL_TX, SERIAL_RX); - -// Assign human-readable names to some common 16-bit color values: + +// #define BLACK 0x0000 #define BLUE 0x001F #define RED 0xF800 @@ -24,73 +22,32 @@ #define YELLOW 0xFFE0 #define WHITE 0xFFFF #define GRAY 0x8410 - -uint16_t version = MCUFRIEND_KBV_H_; - + + + void setup() { uint16_t ID = tft.readID(); // - pc.printf("\nI have run this on a NUCLEO-F072\n"); - pc.printf("Please run it on your NUCLEO-L152\n"); - pc.printf("Found ID = 0x%04X\n", ID); tft.begin(ID); } - + void loop() { - static uint8_t aspect = 0; - const char *aspectname[] = { - "PORTRAIT", "LANDSCAPE", "PORTRAIT_REV", "LANDSCAPE_REV" - }; - const char *colorname[] = { "BLUE", "GREEN", "RED", "GRAY" }; - uint16_t colormask[] = { BLUE, GREEN, RED, GRAY }; - uint16_t ID = tft.readID(); // - tft.setRotation(aspect); - int width = tft.width(); - int height = tft.height(); - tft.fillScreen(colormask[aspect]); - tft.drawRect(0, 0, width, height, WHITE); - tft.drawRect(32, 32, width - 64, height - 64, WHITE); - tft.setTextSize(2); - tft.setTextColor(BLACK); - tft.setCursor(40, 40); - tft.print("ID=0x"); - tft.println(ID, HEX); - if (ID == 0xD3D3) tft.print(" w/o"); - tft.setCursor(40, 70); - tft.print(aspectname[aspect]); - tft.setCursor(40, 100); - tft.print(width); - tft.print(" x "); - tft.print(height); - tft.setTextColor(WHITE); - tft.setCursor(40, 130); - tft.print(colorname[aspect]); - tft.setCursor(40, 160); - tft.setTextSize(1); - tft.print("MCUFRIEND_KBV_H_ = "); - tft.print(version); - if (++aspect > 3) aspect = 0; + + + tft.fillScreen(BLACK); + tft.setTextColor(RED);; + tft.setCursor(30, 160); + tft.setTextSize(3); + tft.print("INSPER-LSM "); delay(5000); } - -uint32_t millis(void) -{ - static Timer t; - static int first = 1; - if (first) first = 0, t.start(); - return t.read_ms(); -} - -uint32_t micros(void) -{ - static Timer t; - static int first = 1; - if (first) first = 0, t.start(); - return t.read_us(); -} - -void main(void) + + + + + +int main() { setup(); while (1) {