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
@@ -1,9 +1,9 @@
|
||||
#include "Tactility/hal/Configuration.h"
|
||||
#include "Tactility/hal/Device.h"
|
||||
#include "Tactility/hal/i2c/I2c.h"
|
||||
#include "Tactility/hal/power/PowerDevice.h"
|
||||
#include "Tactility/hal/spi/Spi.h"
|
||||
#include "Tactility/hal/uart/Uart.h"
|
||||
#include "Tactility/hal/Power.h"
|
||||
|
||||
#include <Tactility/kernel/SystemEvents.h>
|
||||
|
||||
@@ -42,7 +42,7 @@ void init(const Configuration& configuration) {
|
||||
}
|
||||
|
||||
if (configuration.power != nullptr) {
|
||||
std::shared_ptr<tt::hal::Power> power = configuration.power();
|
||||
std::shared_ptr<tt::hal::power::PowerDevice> power = configuration.power();
|
||||
hal::registerDevice(power);
|
||||
}
|
||||
|
||||
|
||||
+4
-4
@@ -1,10 +1,10 @@
|
||||
#include "Tactility/hal/SdCard.h"
|
||||
#include "Tactility/hal/Device.h"
|
||||
#include "Tactility/hal/sdcard/SdCardDevice.h"
|
||||
|
||||
namespace tt::hal {
|
||||
namespace tt::hal::sdcard {
|
||||
|
||||
std::shared_ptr<SdCard> _Nullable findSdCard(const std::string& path) {
|
||||
auto sdcards = findDevices<SdCard>(Device::Type::SdCard);
|
||||
std::shared_ptr<SdCardDevice> _Nullable find(const std::string& path) {
|
||||
auto sdcards = findDevices<SdCardDevice>(Device::Type::SdCard);
|
||||
for (auto& sdcard : sdcards) {
|
||||
if (sdcard->isMounted() && path.starts_with(sdcard->getMountPath())) {
|
||||
return sdcard;
|
||||
+7
-7
@@ -1,6 +1,6 @@
|
||||
#ifdef ESP_PLATFORM
|
||||
|
||||
#include "Tactility/hal/SpiSdCard.h"
|
||||
#include "Tactility/hal/sdcard/SpiSdCardDevice.h"
|
||||
|
||||
#include <Tactility/Log.h>
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
|
||||
#define TAG "spi_sdcard"
|
||||
|
||||
namespace tt::hal {
|
||||
namespace tt::hal::sdcard {
|
||||
|
||||
/**
|
||||
* Before we can initialize the sdcard's SPI communications, we have to set all
|
||||
@@ -19,7 +19,7 @@ namespace tt::hal {
|
||||
* See https://github.com/Xinyuan-LilyGO/T-Deck/blob/master/examples/UnitTest/UnitTest.ino
|
||||
* @return success result
|
||||
*/
|
||||
bool SpiSdCard::applyGpioWorkAround() {
|
||||
bool SpiSdCardDevice::applyGpioWorkAround() {
|
||||
TT_LOG_D(TAG, "init");
|
||||
|
||||
uint64_t pin_bit_mask = BIT64(config->spiPinCs);
|
||||
@@ -50,7 +50,7 @@ bool SpiSdCard::applyGpioWorkAround() {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool SpiSdCard::mountInternal(const std::string& newMountPath) {
|
||||
bool SpiSdCardDevice::mountInternal(const std::string& newMountPath) {
|
||||
TT_LOG_I(TAG, "Mounting %s", newMountPath.c_str());
|
||||
|
||||
esp_vfs_fat_sdmmc_mount_config_t mount_config = {
|
||||
@@ -92,7 +92,7 @@ bool SpiSdCard::mountInternal(const std::string& newMountPath) {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool SpiSdCard::mount(const std::string& newMountPath) {
|
||||
bool SpiSdCardDevice::mount(const std::string& newMountPath) {
|
||||
if (!applyGpioWorkAround()) {
|
||||
TT_LOG_E(TAG, "Failed to set SPI CS pins high. This is a pre-requisite for mounting.");
|
||||
return false;
|
||||
@@ -107,7 +107,7 @@ bool SpiSdCard::mount(const std::string& newMountPath) {
|
||||
}
|
||||
}
|
||||
|
||||
bool SpiSdCard::unmount() {
|
||||
bool SpiSdCardDevice::unmount() {
|
||||
if (card == nullptr) {
|
||||
TT_LOG_E(TAG, "Can't unmount: not mounted");
|
||||
return false;
|
||||
@@ -124,7 +124,7 @@ bool SpiSdCard::unmount() {
|
||||
}
|
||||
|
||||
// TODO: Refactor to "bool getStatus(Status* status)" method so that it can fail when the lvgl lock fails
|
||||
tt::hal::SdCard::State SpiSdCard::getState() const {
|
||||
SdCardDevice::State SpiSdCardDevice::getState() const {
|
||||
if (card == nullptr) {
|
||||
return State::Unmounted;
|
||||
}
|
||||
@@ -1,9 +1,9 @@
|
||||
#ifdef ESP_PLATFORM
|
||||
|
||||
#include "Tactility/hal/usb/Usb.h"
|
||||
#include "Tactility/hal/usb/UsbTusb.h"
|
||||
#include "Tactility/hal/SpiSdCard.h"
|
||||
#include "Tactility/TactilityHeadless.h"
|
||||
#include "Tactility/hal/sdcard/SpiSdCardDevice.h"
|
||||
#include "Tactility/hal/usb/UsbTusb.h"
|
||||
|
||||
#include <Tactility/Log.h>
|
||||
|
||||
@@ -32,7 +32,7 @@ sdmmc_card_t* _Nullable getCard() {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
auto spi_sdcard = std::static_pointer_cast<SpiSdCard>(sdcard);
|
||||
auto spi_sdcard = std::static_pointer_cast<sdcard::SpiSdCardDevice>(sdcard);
|
||||
if (spi_sdcard == nullptr) {
|
||||
TT_LOG_W(TAG, "SD card interface is not supported (must be SpiSdCard)");
|
||||
return nullptr;
|
||||
|
||||
Reference in New Issue
Block a user