consolidate sketches
This commit is contained in:
46
boards/esp32-s3-lcd-43/DisplayDriverGFX.h
Normal file
46
boards/esp32-s3-lcd-43/DisplayDriverGFX.h
Normal file
@@ -0,0 +1,46 @@
|
||||
#pragma once
|
||||
|
||||
#include <KlubhausCore.h>
|
||||
#include <Arduino_GFX_Library.h>
|
||||
#include <Wire.h>
|
||||
#include "board_config.h"
|
||||
|
||||
class DisplayDriverGFX : public IDisplayDriver {
|
||||
public:
|
||||
void begin() override;
|
||||
void setBacklight(bool on) override;
|
||||
void render(const ScreenState& state) override;
|
||||
TouchEvent readTouch() override;
|
||||
int dashboardTouch(int x, int y) override;
|
||||
HoldState updateHold(unsigned long holdMs) override;
|
||||
void updateHint() override;
|
||||
int width() override { return DISPLAY_WIDTH; }
|
||||
int height() override { return DISPLAY_HEIGHT; }
|
||||
|
||||
private:
|
||||
// CH422G helpers
|
||||
void ch422gInit();
|
||||
void ch422gWrite(uint8_t val);
|
||||
uint8_t _exioBits = 0;
|
||||
void exioSet(uint8_t bit, bool on);
|
||||
|
||||
// GT911 helpers
|
||||
void gt911Init();
|
||||
bool gt911Read(int& x, int& y);
|
||||
|
||||
// Rendering
|
||||
void drawBoot();
|
||||
void drawAlert(const ScreenState& st);
|
||||
void drawDashboard(const ScreenState& st);
|
||||
|
||||
Arduino_GFX* _gfx = nullptr;
|
||||
|
||||
// Hold-to-silence tracking
|
||||
bool _holdActive = false;
|
||||
uint32_t _holdStartMs = 0;
|
||||
bool _lastTouched = false;
|
||||
|
||||
// Render-change tracking
|
||||
ScreenID _lastScreen = ScreenID::BOOT;
|
||||
bool _needsRedraw = true;
|
||||
};
|
||||
Reference in New Issue
Block a user