[RTduino] support TFT_eSPI demo
This commit is contained in:
parent
36f8f266e9
commit
bc74bea545
|
@ -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'])
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue