HAL renaming & relocation (#215)
Implemented more consistent naming: - Moved all HAL devices into their own namespace (and related folder) - Post-fixed all HAL device names with "Device"
This commit is contained in:
committed by
GitHub
parent
a7a3b17ff6
commit
2345ba6d13
@@ -63,10 +63,10 @@ bool UnPhoneDisplay::stop() {
|
||||
return true;
|
||||
}
|
||||
|
||||
std::shared_ptr<tt::hal::Touch> _Nullable UnPhoneDisplay::createTouch() {
|
||||
std::shared_ptr<tt::hal::touch::TouchDevice> _Nullable UnPhoneDisplay::createTouch() {
|
||||
return std::make_shared<UnPhoneTouch>();
|
||||
}
|
||||
|
||||
std::shared_ptr<tt::hal::Display> createDisplay() {
|
||||
std::shared_ptr<tt::hal::display::DisplayDevice> createDisplay() {
|
||||
return std::make_shared<UnPhoneDisplay>();
|
||||
}
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
#pragma once
|
||||
|
||||
#include "Tactility/hal/display/DisplayDevice.h"
|
||||
#include <esp_lcd_types.h>
|
||||
#include <lvgl.h>
|
||||
#include <Tactility/hal/Display.h>
|
||||
|
||||
class UnPhoneDisplay : public tt::hal::Display {
|
||||
class UnPhoneDisplay : public tt::hal::display::DisplayDevice {
|
||||
|
||||
private:
|
||||
|
||||
@@ -20,9 +20,9 @@ public:
|
||||
|
||||
bool stop() override;
|
||||
|
||||
std::shared_ptr<tt::hal::Touch> _Nullable createTouch() override;
|
||||
std::shared_ptr<tt::hal::touch::TouchDevice> _Nullable createTouch() override;
|
||||
|
||||
lv_display_t* _Nullable getLvglDisplay() const override { return displayHandle; }
|
||||
};
|
||||
|
||||
std::shared_ptr<tt::hal::Display> createDisplay();
|
||||
std::shared_ptr<tt::hal::display::DisplayDevice> createDisplay();
|
||||
|
||||
@@ -27,7 +27,7 @@ bool UnPhonePower::supportsMetric(MetricType type) const {
|
||||
}
|
||||
}
|
||||
|
||||
bool UnPhonePower::getMetric(Power::MetricType type, Power::MetricData& data) {
|
||||
bool UnPhonePower::getMetric(MetricType type, MetricData& data) {
|
||||
switch (type) {
|
||||
using enum MetricType;
|
||||
case BatteryVoltage:
|
||||
@@ -83,9 +83,9 @@ bool UnPhonePower::readBatteryVoltageSampled(uint32_t& output) const {
|
||||
}
|
||||
}
|
||||
|
||||
static std::shared_ptr<Power> power;
|
||||
static std::shared_ptr<PowerDevice> power;
|
||||
|
||||
std::shared_ptr<Power> unPhoneGetPower() {
|
||||
std::shared_ptr<PowerDevice> unPhoneGetPower() {
|
||||
if (power == nullptr) {
|
||||
power = std::make_shared<UnPhonePower>();
|
||||
}
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
#pragma once
|
||||
|
||||
#include <Tactility/hal/Power.h>
|
||||
#include "Tactility/hal/power/PowerDevice.h"
|
||||
#include <memory>
|
||||
|
||||
using namespace tt::hal;
|
||||
using tt::hal::power::PowerDevice;
|
||||
|
||||
class UnPhonePower : public Power {
|
||||
class UnPhonePower : public PowerDevice {
|
||||
|
||||
public:
|
||||
|
||||
@@ -16,7 +16,7 @@ public:
|
||||
std::string getDescription() const final { return "Power interface via XPT2046 voltage measurement"; }
|
||||
|
||||
bool supportsMetric(MetricType type) const override;
|
||||
bool getMetric(Power::MetricType type, Power::MetricData& data) override;
|
||||
bool getMetric(MetricType type, MetricData& data) override;
|
||||
|
||||
private:
|
||||
|
||||
@@ -24,4 +24,4 @@ private:
|
||||
bool readBatteryVoltageSampled(uint32_t& output) const;
|
||||
};
|
||||
|
||||
std::shared_ptr<Power> unPhoneGetPower();
|
||||
std::shared_ptr<PowerDevice> unPhoneGetPower();
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#include "UnPhoneSdCard.h"
|
||||
|
||||
#include <Tactility/lvgl/LvglSync.h>
|
||||
#include <Tactility/hal/SpiSdCard.h>
|
||||
#include <Tactility/hal/sdcard/SpiSdCardDevice.h>
|
||||
|
||||
#include <esp_vfs_fat.h>
|
||||
|
||||
@@ -10,13 +10,15 @@
|
||||
#define UNPHONE_LORA_PIN_CS GPIO_NUM_44
|
||||
#define UNPHONE_TOUCH_PIN_CS GPIO_NUM_38
|
||||
|
||||
std::shared_ptr<SdCard> createUnPhoneSdCard() {
|
||||
auto* configuration = new tt::hal::SpiSdCard::Config(
|
||||
using tt::hal::sdcard::SpiSdCardDevice;
|
||||
|
||||
std::shared_ptr<SdCardDevice> createUnPhoneSdCard() {
|
||||
auto* configuration = new SpiSdCardDevice::Config(
|
||||
UNPHONE_SDCARD_PIN_CS,
|
||||
GPIO_NUM_NC,
|
||||
GPIO_NUM_NC,
|
||||
GPIO_NUM_NC,
|
||||
SdCard::MountBehaviour::AtBoot,
|
||||
SdCardDevice::MountBehaviour::AtBoot,
|
||||
tt::lvgl::getLvglSyncLockable(),
|
||||
{
|
||||
UNPHONE_LORA_PIN_CS,
|
||||
@@ -25,9 +27,9 @@ std::shared_ptr<SdCard> createUnPhoneSdCard() {
|
||||
}
|
||||
);
|
||||
|
||||
auto* sdcard = (SdCard*) new SpiSdCard(
|
||||
std::unique_ptr<SpiSdCard::Config>(configuration)
|
||||
auto* sdcard = (SdCardDevice*) new SpiSdCardDevice(
|
||||
std::unique_ptr<SpiSdCardDevice::Config>(configuration)
|
||||
);
|
||||
|
||||
return std::shared_ptr<SdCard>(sdcard);
|
||||
return std::shared_ptr<SdCardDevice>(sdcard);
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <Tactility/hal/SdCard.h>
|
||||
#include "Tactility/hal/sdcard/SdCardDevice.h"
|
||||
|
||||
using namespace tt::hal;
|
||||
using tt::hal::sdcard::SdCardDevice;
|
||||
|
||||
std::shared_ptr<SdCard> createUnPhoneSdCard();
|
||||
std::shared_ptr<SdCardDevice> createUnPhoneSdCard();
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
#pragma once
|
||||
|
||||
#include <Tactility/hal/Touch.h>
|
||||
#include "Tactility/hal/touch/TouchDevice.h"
|
||||
#include <Tactility/TactilityCore.h>
|
||||
#include <esp_lcd_panel_io_interface.h>
|
||||
#include <esp_lcd_touch.h>
|
||||
|
||||
class UnPhoneTouch : public tt::hal::Touch {
|
||||
class UnPhoneTouch : public tt::hal::touch::TouchDevice {
|
||||
|
||||
private:
|
||||
|
||||
|
||||
Reference in New Issue
Block a user