summaryrefslogtreecommitdiff
path: root/src/system_fsm/include/system_fsm.hpp
diff options
context:
space:
mode:
authorjacqueline <me@jacqueline.id.au>2023-08-30 16:48:10 +1000
committerjacqueline <me@jacqueline.id.au>2023-08-30 16:48:10 +1000
commit320fdeb9d8355d3c361d5c6d60de8afc64501af9 (patch)
treef0d5a2ab82199c78ad6768c6b18ba1239a0b7ee4 /src/system_fsm/include/system_fsm.hpp
parent4247c9fe7d25c921fbfc73fc50e849c8780e7ad6 (diff)
downloadtangara-fw-320fdeb9d8355d3c361d5c6d60de8afc64501af9.tar.gz
Use a service locator instead of passing around subsets of drivers between FSMs
Diffstat (limited to 'src/system_fsm/include/system_fsm.hpp')
-rw-r--r--src/system_fsm/include/system_fsm.hpp19
1 files changed, 3 insertions, 16 deletions
diff --git a/src/system_fsm/include/system_fsm.hpp b/src/system_fsm/include/system_fsm.hpp
index 371e5527..28448e5a 100644
--- a/src/system_fsm/include/system_fsm.hpp
+++ b/src/system_fsm/include/system_fsm.hpp
@@ -18,6 +18,7 @@
#include "nvs.hpp"
#include "relative_wheel.hpp"
#include "samd.hpp"
+#include "service_locator.hpp"
#include "storage.hpp"
#include "tag_parser.hpp"
#include "tinyfsm.hpp"
@@ -60,22 +61,8 @@ class SystemState : public tinyfsm::Fsm<SystemState> {
protected:
auto IdleCondition() -> bool;
- static std::shared_ptr<drivers::Gpios> sGpios;
- static std::shared_ptr<drivers::Samd> sSamd;
- static std::shared_ptr<drivers::NvsStorage> sNvs;
-
- static std::shared_ptr<drivers::TouchWheel> sTouch;
- static std::shared_ptr<drivers::RelativeWheel> sRelativeTouch;
- static std::shared_ptr<drivers::AdcBattery> sAdc;
- static std::shared_ptr<battery::Battery> sBattery;
- static std::shared_ptr<drivers::SdStorage> sStorage;
- static std::shared_ptr<drivers::Display> sDisplay;
- static std::shared_ptr<drivers::Bluetooth> sBluetooth;
-
- static std::shared_ptr<database::Database> sDatabase;
- static std::shared_ptr<database::TagParserImpl> sTagParser;
-
- static std::shared_ptr<audio::TrackQueue> sTrackQueue;
+ static std::shared_ptr<ServiceLocator> sServices;
+ static std::unique_ptr<drivers::SdStorage> sStorage;
static console::AppConsole* sAppConsole;
};