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
@@ -2,56 +2,36 @@
|
||||
|
||||
#include "Tactility/TactilityConfig.h"
|
||||
#include <tactility/hal/Device.h>
|
||||
#include "Tactility/hal/sdcard/SdCardDevice.h"
|
||||
|
||||
#include <Tactility/file/File.h>
|
||||
|
||||
#include <cstring>
|
||||
#include <vector>
|
||||
#include <dirent.h>
|
||||
#include <tactility/filesystem/file_system.h>
|
||||
#include <vector>
|
||||
|
||||
namespace tt::file {
|
||||
|
||||
std::vector<dirent> getMountPoints() {
|
||||
std::vector<dirent> getFileSystemDirents() {
|
||||
std::vector<dirent> dir_entries;
|
||||
dir_entries.clear();
|
||||
|
||||
// Data partition
|
||||
auto data_dirent = dirent{
|
||||
.d_ino = 1,
|
||||
.d_type = TT_DT_DIR,
|
||||
.d_name = { 0 }
|
||||
};
|
||||
strcpy(data_dirent.d_name, DATA_PARTITION_NAME);
|
||||
dir_entries.push_back(data_dirent);
|
||||
|
||||
// SD card partitions
|
||||
auto sdcards = tt::hal::findDevices<hal::sdcard::SdCardDevice>(hal::Device::Type::SdCard);
|
||||
for (auto& sdcard : sdcards) {
|
||||
auto state = sdcard->getState();
|
||||
if (state == hal::sdcard::SdCardDevice::State::Mounted) {
|
||||
auto mount_name = sdcard->getMountPath().substr(1);
|
||||
auto dir_entry = dirent {
|
||||
.d_ino = 2,
|
||||
.d_type = TT_DT_DIR,
|
||||
.d_name = { 0 }
|
||||
};
|
||||
assert(mount_name.length() < sizeof(dirent::d_name));
|
||||
strcpy(dir_entry.d_name, mount_name.c_str());
|
||||
dir_entries.push_back(dir_entry);
|
||||
}
|
||||
}
|
||||
|
||||
if (config::SHOW_SYSTEM_PARTITION) {
|
||||
// System partition
|
||||
auto system_dirent = dirent{
|
||||
.d_ino = 0,
|
||||
file_system_for_each(&dir_entries, [](auto* fs, void* context) {
|
||||
if (!file_system_is_mounted(fs)) return true;
|
||||
char path[128];
|
||||
if (file_system_get_path(fs, path, sizeof(path)) != ERROR_NONE) return true;
|
||||
auto mount_name = std::string(path).substr(1);
|
||||
if (!config::SHOW_SYSTEM_PARTITION && mount_name.starts_with(SYSTEM_PARTITION_NAME)) return true;
|
||||
auto dir_entry = dirent {
|
||||
.d_ino = 2,
|
||||
.d_type = TT_DT_DIR,
|
||||
.d_name = { 0 }
|
||||
};
|
||||
strcpy(system_dirent.d_name, SYSTEM_PARTITION_NAME);
|
||||
dir_entries.push_back(system_dirent);
|
||||
}
|
||||
auto& dir_entries = *static_cast<std::vector<dirent>*>(context);
|
||||
strcpy(dir_entry.d_name, mount_name.c_str());
|
||||
dir_entries.push_back(dir_entry);
|
||||
|
||||
return true;
|
||||
});
|
||||
|
||||
return dir_entries;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user