feat: TFT display init and splash screen
Landscape 160x80 (rotation 3, no invert) per this panel. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
#include <Adafruit_GFX.h>
|
||||
#include <Adafruit_ST7735.h>
|
||||
#include <SPI.h>
|
||||
#include "config.h"
|
||||
#include "display_ui.h"
|
||||
|
||||
static Adafruit_ST7735 tft = Adafruit_ST7735(TFT_CS, TFT_DC, TFT_RST);
|
||||
|
||||
void displayBegin() {
|
||||
pinMode(TFT_BLK, OUTPUT);
|
||||
digitalWrite(TFT_BLK, HIGH); // backlight on
|
||||
tft.initR(INITR_MINI160x80); // 0.96" 80x160 ST7735S
|
||||
tft.invertDisplay(false); // this panel needs inversion; flip if colours look wrong
|
||||
tft.setRotation(3); // portrait, 80 wide x 160 tall
|
||||
tft.fillScreen(ST77XX_BLACK);
|
||||
}
|
||||
|
||||
void displaySplash(const char* line1, const char* line2) {
|
||||
tft.fillScreen(ST77XX_BLACK);
|
||||
tft.setTextColor(ST77XX_WHITE);
|
||||
tft.setTextSize(2);
|
||||
tft.setCursor(4, 40);
|
||||
tft.print(line1);
|
||||
tft.setTextSize(1);
|
||||
tft.setCursor(4, 70);
|
||||
tft.print(line2);
|
||||
}
|
||||
Reference in New Issue
Block a user