Files
klubhaus-doorbell/boards/esp32-s3-lcd-43/DisplayDriverGFX.h

43 lines
954 B
C++
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#pragma once
#include <Arduino.h>
#include "ScreenState.h"
#include "IDisplayDriver.h"
struct TouchEvent {
bool pressed = false;
int x = 0;
int y = 0;
};
struct HoldState {
bool active = false;
bool completed = false;
float progress = 0.0f; // 0.0 1.0
};
class DisplayDriverGFX : public IDisplayDriver {
public:
// ── IDisplayDriver ──
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;
int height() override;
// ── Internal ──
static DisplayDriverGFX& instance();
private:
// Touch handling
TouchEvent _lastTouch = {false, 0, 0};
unsigned long _pressStartMs = 0;
bool _isHolding = false;
};