Files
klubhaus-doorbell/boards/esp32-s3-lcd-43/DisplayDriverGFX.h
2026-02-16 19:08:47 -08:00

47 lines
1.2 KiB
C++

#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;
};