diff options
| author | Meco Man <[email protected]> | 2024-10-06 01:17:32 -0400 |
|---|---|---|
| committer | Meco Man <[email protected]> | 2024-10-06 21:04:15 -0400 |
| commit | bc74bea545652b55be90cb71562d5000dcab6553 (patch) | |
| tree | 984c3a1a2ac24d8d76cfb1a2a0cea02c3ad3a263 /bsp | |
| parent | 36f8f266e9d774b7c80c9408d297022956373399 (diff) | |
[RTduino] support TFT_eSPI demo
Diffstat (limited to 'bsp')
| -rw-r--r-- | bsp/stm32/stm32l475-atk-pandora/board/ports/arduino/SConscript | 2 | ||||
| -rw-r--r-- | bsp/stm32/stm32l475-atk-pandora/board/ports/arduino/ST7789_tft_espi_demo.cpp | 26 |
2 files changed, 27 insertions, 1 deletions
diff --git a/bsp/stm32/stm32l475-atk-pandora/board/ports/arduino/SConscript b/bsp/stm32/stm32l475-atk-pandora/board/ports/arduino/SConscript index 3d68349796..710108bd0e 100644 --- a/bsp/stm32/stm32l475-atk-pandora/board/ports/arduino/SConscript +++ b/bsp/stm32/stm32l475-atk-pandora/board/ports/arduino/SConscript @@ -5,7 +5,7 @@ src = [] if GetDepend(['BSP_USING_ARDUINO_ST7789_ADAFRUIT_GFX_DEMO']): src += ['ST7789_adafruit_gfx_demo.cpp'] -elif GetDepend(['BSP_USING_ARDUINO_ST7789_ADAFRUIT_GFX_DEMO']): +elif GetDepend(['BSP_USING_ARDUINO_ST7789_TFT_ESPI_DEMO']): src += ['ST7789_tft_espi_demo.cpp'] group = DefineGroup('RTduino-libraries', src, depend = ['BSP_USING_ARDUINO']) diff --git a/bsp/stm32/stm32l475-atk-pandora/board/ports/arduino/ST7789_tft_espi_demo.cpp b/bsp/stm32/stm32l475-atk-pandora/board/ports/arduino/ST7789_tft_espi_demo.cpp index ea069691e4..5a2a1c193b 100644 --- a/bsp/stm32/stm32l475-atk-pandora/board/ports/arduino/ST7789_tft_espi_demo.cpp +++ b/bsp/stm32/stm32l475-atk-pandora/board/ports/arduino/ST7789_tft_espi_demo.cpp @@ -9,9 +9,35 @@ */ #include <RTduino.h> +#include <TFT_eSPI.h> + +TFT_eSPI tft; static void st7789_setup(void) { + Serial.begin(); + + // lcd init + tft.init(); + tft.fillScreen(TFT_DARKCYAN); + Serial.println("screen init success."); + + // lcd test + tft.setTextColor(TFT_BLACK); + tft.setCursor (12, 5); + tft.print("Original ADAfruit font!"); + + // The new larger fonts do not use the .setCursor call, coords are embedded + tft.setTextColor(TFT_BLACK, TFT_BLACK); // Do not plot the background colour + + // Overlay the black text on top of the rainbow plot (the advantage of not drawing the backgorund colour!) + tft.drawCentreString("Font size 2", 120, 14, 2); // Draw text centre at position 80, 12 using font 2 + + tft.drawCentreString("Font size 4", 120, 30, 4); // Draw text centre at position 80, 24 using font 4 + + tft.drawCentreString("12.34", 120, 54, 6); // Draw text centre at position 80, 24 using font 6 + + tft.drawCentreString("12.34 is in font size 6", 120, 92, 2); // Draw text centre at position 80, 90 using font 2 } static void st7789_loop(void) |
