summaryrefslogtreecommitdiff
path: root/src/app_console/app_console.cpp
diff options
context:
space:
mode:
authorjacqueline <me@jacqueline.id.au>2023-12-22 16:48:24 +1100
committerjacqueline <me@jacqueline.id.au>2023-12-22 16:48:24 +1100
commit5f0e16e97a773480a3b09c5312c98742e7049f1d (patch)
treefacd2b44740516cfb317ccdde63ac3dc36151b06 /src/app_console/app_console.cpp
parentd4a0085753b9397ac4a1452520decbeb994bb30c (diff)
downloadtangara-fw-5f0e16e97a773480a3b09c5312c98742e7049f1d.tar.gz
Support changing the usb msc state
Diffstat (limited to 'src/app_console/app_console.cpp')
-rw-r--r--src/app_console/app_console.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/app_console/app_console.cpp b/src/app_console/app_console.cpp
index f99f7536..2d16b60b 100644
--- a/src/app_console/app_console.cpp
+++ b/src/app_console/app_console.cpp
@@ -39,6 +39,7 @@
#include "index.hpp"
#include "lua_thread.hpp"
#include "memory_resource.hpp"
+#include "samd.hpp"
#include "service_locator.hpp"
#include "system_events.hpp"
#include "track.hpp"
@@ -414,14 +415,15 @@ int CmdSamd(int argc, char** argv) {
std::cout << usage << std::endl;
return 1;
}
+ drivers::Samd& samd = AppConsole::sServices->samd();
std::pmr::string cmd{argv[1]};
if (cmd == "flash") {
std::cout << "resetting samd..." << std::endl;
vTaskDelay(pdMS_TO_TICKS(5));
- AppConsole::sServices->samd().ResetToFlashSamd();
+ samd.ResetToFlashSamd();
} else if (cmd == "charge") {
- auto res = AppConsole::sServices->samd().GetChargeStatus();
+ auto res = samd.GetChargeStatus();
if (res) {
switch (res.value()) {
case drivers::Samd::ChargeStatus::kNoBattery:
@@ -446,6 +448,10 @@ int CmdSamd(int argc, char** argv) {
} else {
std::cout << "unknown" << std::endl;
}
+ } else if (cmd == "msc") {
+ bool current = samd.UsbMassStorage();
+ std::cout << "toggling to: " << !current << std::endl;
+ samd.UsbMassStorage(!current);
} else if (cmd == "off") {
std::cout << "bye !!!" << std::endl;
vTaskDelay(pdMS_TO_TICKS(5));