This commit is contained in:
Ken Van Hoeylandt 2026-03-07 01:47:17 +01:00
parent dbefa0a7d4
commit f12a52ebb9
7 changed files with 20 additions and 1 deletions

View File

@ -1,5 +1,6 @@
// SPDX-License-Identifier: Apache-2.0
#pragma once
#if SOC_SDMMC_HOST_SUPPORTED
#include <sd_protocol_types.h>
#include <stdbool.h>
@ -33,3 +34,5 @@ sdmmc_card_t* esp32_sdmmc_get_card(struct Device* device);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -1,5 +1,6 @@
// SPDX-License-Identifier: Apache-2.0
#pragma once
#if SOC_SDMMC_HOST_SUPPORTED
#include <tactility/filesystem/file_system.h>
#ifdef __cplusplus
@ -20,3 +21,5 @@ extern const FileSystemApi esp32_sdmmc_fs_api;
#ifdef __cplusplus
}
#endif
#endif

View File

@ -1,4 +1,5 @@
// SPDX-License-Identifier: Apache-2.0
#if SOC_SDMMC_HOST_SUPPORTED
#include <tactility/device.h>
#include <tactility/drivers/esp32_sdmmc.h>
#include <tactility/drivers/esp32_sdmmc_fs.h>
@ -159,3 +160,4 @@ Driver esp32_sdmmc_driver = {
};
} // extern "C"
#endif

View File

@ -1,4 +1,5 @@
// SPDX-License-Identifier: Apache-2.0
#if SOC_SDMMC_HOST_SUPPORTED
#include <tactility/device.h>
#include <tactility/drivers/esp32_sdmmc.h>
#include <tactility/drivers/esp32_sdmmc_fs.h>
@ -175,3 +176,4 @@ const FileSystemApi esp32_sdmmc_fs_api = {
};
} // extern "C"
#endif

View File

@ -7,8 +7,9 @@ extern "C" {
extern Driver esp32_gpio_driver;
extern Driver esp32_i2c_driver;
extern Driver esp32_i2s_driver;
#if SOC_SDMMC_HOST_SUPPORTED
extern Driver esp32_sdmmc_driver;
extern Driver esp32_sdmmc_fs_driver;
#endif
extern Driver esp32_spi_driver;
extern Driver esp32_uart_driver;
@ -18,7 +19,9 @@ static error_t start() {
check(driver_construct_add(&esp32_gpio_driver) == ERROR_NONE);
check(driver_construct_add(&esp32_i2c_driver) == ERROR_NONE);
check(driver_construct_add(&esp32_i2s_driver) == ERROR_NONE);
#if SOC_SDMMC_HOST_SUPPORTED
check(driver_construct_add(&esp32_sdmmc_driver) == ERROR_NONE);
#endif
check(driver_construct_add(&esp32_spi_driver) == ERROR_NONE);
check(driver_construct_add(&esp32_uart_driver) == ERROR_NONE);
return ERROR_NONE;
@ -30,7 +33,9 @@ static error_t stop() {
check(driver_remove_destruct(&esp32_gpio_driver) == ERROR_NONE);
check(driver_remove_destruct(&esp32_i2c_driver) == ERROR_NONE);
check(driver_remove_destruct(&esp32_i2s_driver) == ERROR_NONE);
#if SOC_SDMMC_HOST_SUPPORTED
check(driver_remove_destruct(&esp32_sdmmc_driver) == ERROR_NONE);
#endif
check(driver_remove_destruct(&esp32_spi_driver) == ERROR_NONE);
check(driver_remove_destruct(&esp32_uart_driver) == ERROR_NONE);
return ERROR_NONE;

View File

@ -2,6 +2,8 @@
#include <tactility/filesystem/file_system.h>
#include <cstring>
namespace tt::hal::sdcard {
static error_t mount(void* data) {

View File

@ -34,6 +34,7 @@ sdmmc_card_t* getCard() {
}
}
#if SOC_SDMMC_HOST_SUPPORTED
// Find ESP32 SDMMC device:
if (sdcard == nullptr) {
device_for_each(&sdcard, [](auto* device, void* context) {
@ -45,6 +46,7 @@ sdmmc_card_t* getCard() {
return true;
});
}
#endif
if (sdcard == nullptr) {
LOGGER.warn("Couldn't find a mounted SD card");