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
+4 -4
View File
@@ -1,13 +1,13 @@
#pragma once
#include "SdlTouch.h"
#include <Tactility/hal/Display.h>
#include "Tactility/hal/display/DisplayDevice.h"
#include <memory>
/** Hack: variable comes from LvglTask.cpp */
extern lv_disp_t* displayHandle;
class SdlDisplay final : public tt::hal::Display {
class SdlDisplay final : public tt::hal::display::DisplayDevice {
public:
@@ -20,12 +20,12 @@ public:
bool stop() override { tt_crash("Not supported"); }
std::shared_ptr<tt::hal::Touch> _Nullable createTouch() override { return std::make_shared<SdlTouch>(); }
std::shared_ptr<tt::hal::touch::TouchDevice> _Nullable createTouch() override { return std::make_shared<SdlTouch>(); }
lv_display_t* _Nullable getLvglDisplay() const override { return displayHandle; }
};
std::shared_ptr<tt::hal::Display> createDisplay() {
std::shared_ptr<tt::hal::display::DisplayDevice> createDisplay() {
return std::make_shared<SdlDisplay>();
}
+3 -3
View File
@@ -1,9 +1,9 @@
#pragma once
#include <Tactility/hal/Keyboard.h>
#include <Tactility/hal/keyboard/KeyboardDevice.h>
#include <Tactility/TactilityCore.h>
class SdlKeyboard final : public tt::hal::Keyboard {
class SdlKeyboard final : public tt::hal::keyboard::KeyboardDevice {
private:
lv_indev_t* _Nullable handle = nullptr;
@@ -24,6 +24,6 @@ public:
lv_indev_t* _Nullable getLvglIndev() override { return handle; }
};
std::shared_ptr<tt::hal::Keyboard> createKeyboard() {
std::shared_ptr<tt::hal::keyboard::KeyboardDevice> createKeyboard() {
return std::make_shared<SdlKeyboard>();
}
+2 -2
View File
@@ -1,9 +1,9 @@
#pragma once
#include <Tactility/hal/Touch.h>
#include "Tactility/hal/touch/TouchDevice.h"
#include <Tactility/TactilityCore.h>
class SdlTouch final : public tt::hal::Touch {
class SdlTouch final : public tt::hal::touch::TouchDevice {
private:
lv_indev_t* _Nullable handle = nullptr;
@@ -15,7 +15,7 @@ bool SimulatorPower::supportsMetric(MetricType type) const {
return false; // Safety guard for when new enum values are introduced
}
bool SimulatorPower::getMetric(Power::MetricType type, Power::MetricData& data) {
bool SimulatorPower::getMetric(MetricType type, MetricData& data) {
switch (type) {
using enum MetricType;
case IsCharging:
@@ -35,9 +35,9 @@ bool SimulatorPower::getMetric(Power::MetricType type, Power::MetricData& data)
return false; // Safety guard for when new enum values are introduced
}
static std::shared_ptr<Power> power;
static std::shared_ptr<PowerDevice> power;
std::shared_ptr<Power> simulatorPower() {
std::shared_ptr<PowerDevice> simulatorPower() {
if (power == nullptr) {
power = std::make_shared<SimulatorPower>();
}
+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 SimulatorPower final : public Power {
class SimulatorPower final : public PowerDevice {
bool allowedToCharge = false;
@@ -18,11 +18,11 @@ public:
std::string getDescription() const final { return ""; }
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 { return allowedToCharge; }
void setAllowedToCharge(bool canCharge) override { allowedToCharge = canCharge; }
};
std::shared_ptr<Power> simulatorPower();
std::shared_ptr<PowerDevice> simulatorPower();
@@ -1,12 +1,12 @@
#pragma once
#include <Tactility/hal/SdCard.h>
#include "Tactility/hal/sdcard/SdCardDevice.h"
#include <Tactility/Mutex.h>
#include <memory>
using namespace tt::hal;
using tt::hal::sdcard::SdCardDevice;
class SimulatorSdCard final : public SdCard {
class SimulatorSdCard final : public SdCardDevice {
private:
@@ -16,7 +16,7 @@ private:
public:
SimulatorSdCard() : SdCard(MountBehaviour::AtBoot),
SimulatorSdCard() : SdCardDevice(MountBehaviour::AtBoot),
state(State::Unmounted),
lockable(std::make_shared<tt::Mutex>())
{}