Tactility/Boards/Simulator/Source/hal/SimulatorSdCard.h
Ken Van Hoeylandt 84049658db
Merge develop into main (#327)
## New features
- Implemented support for app packaging in firmware and `tactility.py`: load `.app` files instead of `.elf` files. Install apps remotely or via `FileBrowser`.
- Ensure headless mode works: all services that require LVGL can deal with the absence of a display
- Service `onStart()` is now allowed to fail (return `bool` result)
- Added and improved various file-related helper functions

## Improvements
- Completely revamped the SystemInfo app UI
- Improved Calculator UI of internal and external variant
- Fix Chat UI and removed the emoji buttons for now
- Fix for toolbar bottom padding issue in all apps

## Fixes
- Fix for allowing recursive locking for certain SPI SD cards
& more
2025-09-12 16:24:22 +02:00

43 lines
1.1 KiB
C++

#pragma once
#include "Tactility/hal/sdcard/SdCardDevice.h"
#include <Tactility/Mutex.h>
#include <memory>
using tt::hal::sdcard::SdCardDevice;
class SimulatorSdCard final : public SdCardDevice {
State state;
std::shared_ptr<tt::Lock> lock;
std::string mountPath;
public:
SimulatorSdCard() : SdCardDevice(MountBehaviour::AtBoot),
state(State::Unmounted),
lock(std::make_shared<tt::Mutex>(tt::Mutex::Type::Recursive))
{}
std::string getName() const override { return "Mock SD Card"; }
std::string getDescription() const override { return ""; }
bool mount(const std::string& newMountPath) override {
state = State::Mounted;
mountPath = newMountPath;
return true;
}
bool unmount() override {
state = State::Unmounted;
mountPath = "";
return true;
}
std::string getMountPath() const override { return mountPath; }
std::shared_ptr<tt::Lock> getLock() const override { return lock; }
State getState(TickType_t timeout) const override { return state; }
};