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:
Ken Van Hoeylandt
2025-02-09 16:48:23 +01:00
committed by GitHub
parent a7a3b17ff6
commit 2345ba6d13
62 changed files with 263 additions and 250 deletions
@@ -3,7 +3,7 @@
#include <Ili934xDisplay.h>
std::shared_ptr<tt::hal::Display> createDisplay() {
std::shared_ptr<tt::hal::display::DisplayDevice> createDisplay() {
auto touch = std::make_shared<Core2Touch>();
auto configuration = std::make_unique<Ili934xDisplay::Configuration>(
@@ -1,6 +1,6 @@
#pragma once
#include <Tactility/hal/Display.h>
#include "Tactility/hal/display/DisplayDevice.h"
#include <memory>
#define CORE2_LCD_SPI_HOST SPI2_HOST
@@ -11,4 +11,4 @@
#define CORE2_LCD_DRAW_BUFFER_HEIGHT (CORE2_LCD_VERTICAL_RESOLUTION / 10)
#define CORE2_LCD_DRAW_BUFFER_SIZE (CORE2_LCD_HORIZONTAL_RESOLUTION * CORE2_LCD_DRAW_BUFFER_HEIGHT)
std::shared_ptr<tt::hal::Display> createDisplay();
std::shared_ptr<tt::hal::display::DisplayDevice> createDisplay();
@@ -20,7 +20,7 @@ bool Core2Power::supportsMetric(MetricType type) const {
return false; // Safety guard for when new enum values are introduced
}
bool Core2Power::getMetric(Power::MetricType type, Power::MetricData& data) {
bool Core2Power::getMetric(MetricType type, MetricData& data) {
switch (type) {
using enum MetricType;
case BatteryVoltage: {
@@ -100,9 +100,9 @@ void Core2Power::setAllowedToCharge(bool canCharge) {
}
}
static std::shared_ptr<Power> power;
static std::shared_ptr<PowerDevice> power;
std::shared_ptr<Power> createPower() {
std::shared_ptr<PowerDevice> createPower() {
if (power == nullptr) {
power = std::make_shared<Core2Power>();
}
+5 -5
View File
@@ -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 Core2Power : public Power {
class Core2Power : public PowerDevice {
public:
@@ -16,11 +16,11 @@ public:
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;
bool getMetric(MetricType type, MetricData& data) override;
bool supportsChargeControl() const override { return true; }
bool isAllowedToCharge() const override;
void setAllowedToCharge(bool canCharge) override;
};
std::shared_ptr<Power> createPower();
std::shared_ptr<PowerDevice> createPower();
@@ -1,29 +1,31 @@
#include "Core2SdCard.h"
#include <Tactility/hal/sdcard/SpiSdCardDevice.h>
#include <Tactility/lvgl/LvglSync.h>
#include <Tactility/hal/SpiSdCard.h>
#include <esp_vfs_fat.h>
#define CORE2_SDCARD_PIN_CS GPIO_NUM_4
#define CORE2_LCD_PIN_CS GPIO_NUM_5
std::shared_ptr<SdCard> createSdCard() {
auto* configuration = new tt::hal::SpiSdCard::Config(
using tt::hal::sdcard::SpiSdCardDevice;
std::shared_ptr<SdCardDevice> createSdCard() {
auto* configuration = new SpiSdCardDevice::Config(
CORE2_SDCARD_PIN_CS,
GPIO_NUM_NC,
GPIO_NUM_NC,
GPIO_NUM_NC,
SdCard::MountBehaviour::AtBoot,
SdCardDevice::MountBehaviour::AtBoot,
tt::lvgl::getLvglSyncLockable(),
{
CORE2_LCD_PIN_CS
}
);
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);
}
+3 -3
View File
@@ -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> createSdCard();
std::shared_ptr<SdCardDevice> createSdCard();
+3 -3
View File
@@ -1,10 +1,10 @@
#pragma once
#include <Tactility/hal/Touch.h>
#include <Tactility/TactilityCore.h>
#include "Tactility/hal/touch/TouchDevice.h"
#include "ft6x36/FT6X36.h"
#include <Tactility/TactilityCore.h>
class Core2Touch : public tt::hal::Touch {
class Core2Touch : public tt::hal::touch::TouchDevice {
private: