Implement device management (#199)
- 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.
This commit is contained in:
committed by
GitHub
parent
c87200a80d
commit
cff0605b0a
@@ -205,10 +205,10 @@ void YellowDisplay::setGammaCurve(uint8_t index) {
|
||||
}
|
||||
}
|
||||
|
||||
tt::hal::Touch* _Nullable YellowDisplay::createTouch() {
|
||||
return static_cast<tt::hal::Touch*>(new YellowTouch());
|
||||
std::shared_ptr<tt::hal::Touch> _Nullable YellowDisplay::createTouch() {
|
||||
return std::make_shared<YellowTouch>();
|
||||
}
|
||||
|
||||
tt::hal::Display* createDisplay() {
|
||||
return static_cast<tt::hal::Display*>(new YellowDisplay());
|
||||
std::shared_ptr<tt::hal::Display> createDisplay() {
|
||||
return std::make_shared<YellowDisplay>();
|
||||
}
|
||||
|
||||
@@ -16,11 +16,14 @@ private:
|
||||
|
||||
public:
|
||||
|
||||
std::string getName() const final { return "ILI9341"; }
|
||||
std::string getDescription() const final { return "SPI display"; }
|
||||
|
||||
bool start() override;
|
||||
|
||||
bool stop() override;
|
||||
|
||||
tt::hal::Touch* _Nullable createTouch() override;
|
||||
std::shared_ptr<tt::hal::Touch> _Nullable createTouch() override;
|
||||
|
||||
void setBacklightDuty(uint8_t backlightDuty) override;
|
||||
bool supportsBacklightDuty() const override { return true; }
|
||||
@@ -31,4 +34,4 @@ public:
|
||||
lv_display_t* _Nullable getLvglDisplay() const override { return displayHandle; }
|
||||
};
|
||||
|
||||
tt::hal::Display* createDisplay();
|
||||
std::shared_ptr<tt::hal::Display> createDisplay();
|
||||
|
||||
@@ -5,12 +5,20 @@
|
||||
#include <esp_lcd_touch.h>
|
||||
|
||||
class YellowTouch : public tt::hal::Touch {
|
||||
|
||||
private:
|
||||
|
||||
esp_lcd_panel_io_handle_t ioHandle = nullptr;
|
||||
esp_lcd_touch_handle_t touchHandle = nullptr;
|
||||
lv_indev_t* _Nullable deviceHandle = nullptr;
|
||||
|
||||
void cleanup();
|
||||
|
||||
public:
|
||||
|
||||
std::string getName() const final { return "CST816S"; }
|
||||
std::string getDescription() const final { return "I2C touch driver"; }
|
||||
|
||||
bool start(lv_display_t* display) override;
|
||||
bool stop() override;
|
||||
lv_indev_t* _Nullable getLvglIndev() override { return deviceHandle; }
|
||||
|
||||
Reference in New Issue
Block a user