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
+23
-11
@@ -2,25 +2,37 @@
|
||||
|
||||
#include <Tactility/app/AppManifestParsing.h>
|
||||
#include <Tactility/MountPoints.h>
|
||||
#include <Tactility/hal/sdcard/SdCardDevice.h>
|
||||
|
||||
#include <format>
|
||||
#include <tactility/filesystem/file_system.h>
|
||||
|
||||
namespace tt {
|
||||
|
||||
bool findFirstMountedSdCardPath(std::string& path) {
|
||||
// const auto sdcards = hal::findDevices<hal::sdcard::SdCardDevice>(hal::Device::Type::SdCard);
|
||||
bool is_set = false;
|
||||
hal::findDevices<hal::sdcard::SdCardDevice>(hal::Device::Type::SdCard, [&is_set, &path](const auto& device) {
|
||||
if (device->isMounted()) {
|
||||
path = device->getMountPath();
|
||||
is_set = true;
|
||||
return false; // stop iterating
|
||||
} else {
|
||||
return true;
|
||||
auto* fs = findSdcardFileSystem(true);
|
||||
if (fs == nullptr) return false;
|
||||
char found_path[128];
|
||||
if (file_system_get_path(fs, found_path, sizeof(found_path)) != ERROR_NONE) return false;
|
||||
path = found_path;
|
||||
return true;
|
||||
}
|
||||
|
||||
FileSystem* findSdcardFileSystem(bool mustBeMounted) {
|
||||
FileSystem* found = nullptr;
|
||||
file_system_for_each(&found, [](auto* fs, void* context) {
|
||||
char path[128];
|
||||
if (file_system_get_path(fs, path, sizeof(path)) != ERROR_NONE) return true;
|
||||
// TODO: Find a better way to identify SD card paths
|
||||
if (std::string(path).starts_with("/sdcard")) {
|
||||
*static_cast<FileSystem**>(context) = fs;
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
});
|
||||
return is_set;
|
||||
if (found && mustBeMounted && !file_system_is_mounted(found)) {
|
||||
return nullptr;
|
||||
}
|
||||
return found;
|
||||
}
|
||||
|
||||
std::string getSystemRootPath() {
|
||||
|
||||
Reference in New Issue
Block a user