summaryrefslogtreecommitdiff
path: root/src/ui/ui_fsm.cpp
diff options
context:
space:
mode:
authorjacqueline <me@jacqueline.id.au>2024-03-21 11:51:48 +1100
committerjacqueline <me@jacqueline.id.au>2024-03-21 11:51:48 +1100
commitdadac304dd930ddf4c5aebcc069c5d9f881b2b60 (patch)
tree70613be70cffae36b005d89c28b86e2bd3301f2f /src/ui/ui_fsm.cpp
parent7305820aa9657e71153ada579ad67cf8bcbba6be (diff)
downloadtangara-fw-dadac304dd930ddf4c5aebcc069c5d9f881b2b60.tar.gz
Add very basic usb msc ui
Diffstat (limited to 'src/ui/ui_fsm.cpp')
-rw-r--r--src/ui/ui_fsm.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/ui/ui_fsm.cpp b/src/ui/ui_fsm.cpp
index c11f66a7..a913a339 100644
--- a/src/ui/ui_fsm.cpp
+++ b/src/ui/ui_fsm.cpp
@@ -285,6 +285,17 @@ lua::Property UiState::sLockSwitch{false};
lua::Property UiState::sDatabaseUpdating{false};
+lua::Property UiState::sUsbMassStorageEnabled{
+ false, [](const lua::LuaValue& val) {
+ if (!std::holds_alternative<bool>(val)) {
+ return false;
+ }
+ bool enable = std::get<bool>(val);
+ // FIXME: Check for system busy.
+ events::System().Dispatch(system_fsm::SamdUsbMscChanged{.en = enable});
+ return true;
+ }};
+
auto UiState::InitBootSplash(drivers::IGpios& gpios, drivers::NvsStorage& nvs)
-> bool {
// Init LVGL first, since the display driver registers itself with LVGL.
@@ -553,6 +564,10 @@ void Lua::entry() {
registry.AddPropertyModule("database", {
{"updating", &sDatabaseUpdating},
});
+ registry.AddPropertyModule("usb",
+ {
+ {"msc_enabled", &sUsbMassStorageEnabled},
+ });
auto bt = sServices->bluetooth();
sBluetoothEnabled.Update(bt.IsEnabled());