New kernel drivers, filesystem API, and more (#513)
* **New Features** * BMI270 6-axis IMU driver added; new unified filesystem abstraction for mounted filesystems. * Public Wi‑Fi API surface (no implementation yet) * SDMMC driver added (kernel drive$) * expanded GPIO interrupt/callback support * **Improvements** * M5Stack Tab5: revamped GPIO/power initialization and IMU integration. * LVGL updates including device fontSize configuration. * Updated all code related to SD card device/fs handling * Rename LilyGO T-HMI S3 to LilyGO T-HMI * **Bug Fixes** * Simplified and consolidated SD card handling and mount discovery.
This commit is contained in:
committed by
GitHub
parent
2de35b2d2d
commit
aa7530e515
@@ -5,11 +5,47 @@
|
||||
|
||||
#include <esp_vfs_fat.h>
|
||||
#include <nvs_flash.h>
|
||||
#include <tactility/error.h>
|
||||
#include <tactility/filesystem/file_system.h>
|
||||
|
||||
namespace tt {
|
||||
|
||||
static const auto LOGGER = Logger("Partitions");
|
||||
|
||||
// region file_system stub
|
||||
|
||||
struct PartitionFsData {
|
||||
const char* path;
|
||||
};
|
||||
|
||||
static error_t mount(void* data) {
|
||||
return ERROR_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
static error_t unmount(void* data) {
|
||||
return ERROR_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
static bool is_mounted(void* data) {
|
||||
return true;
|
||||
}
|
||||
|
||||
static error_t get_path(void* data, char* out_path, size_t out_path_size) {
|
||||
auto* fs_data = static_cast<PartitionFsData*>(data);
|
||||
if (strlen(fs_data->path) >= out_path_size) return ERROR_BUFFER_OVERFLOW;
|
||||
strncpy(out_path, fs_data->path, out_path_size);
|
||||
return ERROR_NONE;
|
||||
}
|
||||
|
||||
FileSystemApi partition_fs_api = {
|
||||
.mount = mount,
|
||||
.unmount = unmount,
|
||||
.is_mounted = is_mounted,
|
||||
.get_path = get_path
|
||||
};
|
||||
|
||||
// endregion file_system stub
|
||||
|
||||
static esp_err_t initNvsFlashSafely() {
|
||||
esp_err_t result = nvs_flash_init();
|
||||
if (result == ESP_ERR_NVS_NO_FREE_PAGES || result == ESP_ERR_NVS_NEW_VERSION_FOUND) {
|
||||
@@ -56,6 +92,8 @@ esp_err_t initPartitionsEsp() {
|
||||
LOGGER.error("Failed to mount /system ({})", esp_err_to_name(system_result));
|
||||
} else {
|
||||
LOGGER.info("Mounted /system");
|
||||
static auto system_fs_data = PartitionFsData("/system");
|
||||
file_system_add(&partition_fs_api, &system_fs_data);
|
||||
}
|
||||
|
||||
auto data_result = esp_vfs_fat_spiflash_mount_rw_wl("/data", "data", &mount_config, &data_wl_handle);
|
||||
@@ -63,6 +101,8 @@ esp_err_t initPartitionsEsp() {
|
||||
LOGGER.error("Failed to mount /data ({})", esp_err_to_name(data_result));
|
||||
} else {
|
||||
LOGGER.info("Mounted /data");
|
||||
static auto data_fs_data = PartitionFsData("/data");
|
||||
file_system_add(&partition_fs_api, &data_fs_data);
|
||||
}
|
||||
|
||||
return system_result == ESP_OK && data_result == ESP_OK;
|
||||
|
||||
Reference in New Issue
Block a user