- Added `tt::hal::Device` and functions (de)register devices and search for them. - Refactored apps: `Power` and `Display` settings apps now use the device API to find devices. - Implemented the new API for all existing drivers for all devices, including the simulator. - Updated HAL Configuration to return `std::shared_ptr` instead of raw pointers. - Added test project for headless tests and implemented tests for the new code.
36 lines
895 B
C++
36 lines
895 B
C++
#pragma once
|
|
|
|
#include <Tactility/hal/Touch.h>
|
|
#include <Tactility/TactilityCore.h>
|
|
#include "ft6x36/FT6X36.h"
|
|
|
|
class Core2Touch : public tt::hal::Touch {
|
|
|
|
private:
|
|
|
|
lv_indev_t* _Nullable deviceHandle = nullptr;
|
|
FT6X36 driver = FT6X36(I2C_NUM_0, GPIO_NUM_39);
|
|
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:
|
|
|
|
Core2Touch();
|
|
|
|
std::string getName() const final { return "FT6336U"; }
|
|
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();
|
|
};
|