chore(examples): add submodule and remove LVGL examples
This commit is contained in:
@@ -1,29 +1,42 @@
|
||||
#pragma once
|
||||
|
||||
#include <IDisplayDriver.h>
|
||||
#include <Arduino_GFX_Library.h>
|
||||
#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;
|
||||
int dashboardTouch(int x, int y) override;
|
||||
HoldState updateHold(unsigned long holdMs) override;
|
||||
void updateHint() override;
|
||||
int width() override;
|
||||
int height() override;
|
||||
|
||||
int width() override;
|
||||
int height() override;
|
||||
|
||||
// ── Internal ──
|
||||
static DisplayDriverGFX& instance();
|
||||
|
||||
private:
|
||||
void expanderInit();
|
||||
void touchInit();
|
||||
void drawBoot();
|
||||
void drawDashboard(const ScreenState& state);
|
||||
void drawAlert(const ScreenState& state);
|
||||
void drawOff();
|
||||
Arduino_RGB_Display* _gfx = nullptr;
|
||||
bool _lastTouched = false;
|
||||
unsigned long _holdStart = 0;
|
||||
// Touch handling
|
||||
TouchEvent _lastTouch = {false, 0, 0};
|
||||
unsigned long _pressStartMs = 0;
|
||||
bool _isHolding = false;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user