Driver improvements (#226)

- Created driver subprojects: `FT5x06`, `FT6x36`, `CST816S`.
- Refactored existing projects to use new drivers.
- Improve `PwmBacklight` driver: expose frequency, channel id and timer id
- Update `build-and-release-all.sh` for recent board addition
This commit is contained in:
Ken Van Hoeylandt
2025-02-20 22:41:56 +01:00
committed by GitHub
parent 6e8fbae62b
commit 933bc5fb97
49 changed files with 429 additions and 413 deletions
+55
View File
@@ -0,0 +1,55 @@
#pragma once
#include <Tactility/hal/touch/TouchDevice.h>
#include <Tactility/TactilityCore.h>
#include <driver/i2c.h>
#include "ft6x36/FT6X36.h"
class Ft6x36Touch final : public tt::hal::touch::TouchDevice {
public:
class Configuration {
public:
Configuration(
i2c_port_t port,
gpio_num_t pinInterrupt
) : port(port),
pinInterrupt(pinInterrupt)
{}
i2c_port_t port;
gpio_num_t pinInterrupt;
};
private:
std::unique_ptr<Configuration> configuration;
lv_indev_t* _Nullable deviceHandle = nullptr;
FT6X36 driver = FT6X36(configuration->port, configuration->pinInterrupt);
tt::Thread driverThread;
bool interruptDriverThread = false;
tt::Mutex mutex;
lv_point_t lastPoint = { .x = 0, .y = 0 };
lv_indev_state_t lastState = LV_INDEV_STATE_RELEASED;
bool shouldInterruptDriverThread();
public:
explicit Ft6x36Touch(std::unique_ptr<Configuration> inConfiguration);
~Ft6x36Touch() final;
std::string getName() const final { return "FT6x36"; }
std::string getDescription() const final { return "I2C touch driver"; }
bool start(lv_display_t* display) override;
bool stop() override;
void readLast(lv_indev_data_t* data);
lv_indev_t* _Nullable getLvglIndev() override { return deviceHandle; }
void driverThreadMain();
};