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
@@ -153,10 +153,10 @@ void Core2Display::setGammaCurve(uint8_t index) {
|
||||
}
|
||||
}
|
||||
|
||||
tt::hal::Touch* _Nullable Core2Display::createTouch() {
|
||||
return static_cast<tt::hal::Touch*>(new Core2Touch());
|
||||
std::shared_ptr<tt::hal::Touch> _Nullable Core2Display::createTouch() {
|
||||
return std::make_shared<Core2Touch>();
|
||||
}
|
||||
|
||||
tt::hal::Display* createDisplay() {
|
||||
return static_cast<tt::hal::Display*>(new Core2Display());
|
||||
std::shared_ptr<tt::hal::Display> createDisplay() {
|
||||
return std::make_shared<Core2Display>();
|
||||
}
|
||||
|
||||
@@ -17,11 +17,14 @@ private:
|
||||
|
||||
public:
|
||||
|
||||
std::string getName() const final { return "ILI9342C"; }
|
||||
std::string getDescription() const final { return "Display (ILI9342C with an ILI9341 driver)"; }
|
||||
|
||||
bool start() override;
|
||||
|
||||
bool stop() override;
|
||||
|
||||
tt::hal::Touch* _Nullable createTouch() override;
|
||||
std::shared_ptr<tt::hal::Touch> _Nullable createTouch() override;
|
||||
|
||||
bool supportsBacklightDuty() const override { return false; }
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -12,6 +12,9 @@ public:
|
||||
Core2Power() = default;
|
||||
~Core2Power() override = default;
|
||||
|
||||
std::string getName() const final { return "AXP192 Power"; }
|
||||
std::string getDescription() const final { return "Power management via I2C"; }
|
||||
|
||||
bool supportsMetric(MetricType type) const override;
|
||||
bool getMetric(Power::MetricType type, Power::MetricData& data) override;
|
||||
|
||||
|
||||
@@ -23,6 +23,9 @@ 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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user