summaryrefslogtreecommitdiff
path: root/src/drivers/driver_cache.cpp
diff options
context:
space:
mode:
authorjacqueline <me@jacqueline.id.au>2023-05-19 21:21:27 +1000
committerjacqueline <me@jacqueline.id.au>2023-05-19 21:21:27 +1000
commita6ab1504058304012791281f9eb42c262745888f (patch)
treef82379cd1e66a8ae2f1afbae5cf083a8ab7acc53 /src/drivers/driver_cache.cpp
parentb320a6a863cf1c10dc79254af41f573730935564 (diff)
downloadtangara-fw-a6ab1504058304012791281f9eb42c262745888f.tar.gz
Add tinyfsm, start converting core functions to an FSM-based event loop
Diffstat (limited to 'src/drivers/driver_cache.cpp')
-rw-r--r--src/drivers/driver_cache.cpp43
1 files changed, 0 insertions, 43 deletions
diff --git a/src/drivers/driver_cache.cpp b/src/drivers/driver_cache.cpp
deleted file mode 100644
index 650e6f16..00000000
--- a/src/drivers/driver_cache.cpp
+++ /dev/null
@@ -1,43 +0,0 @@
-#include "driver_cache.hpp"
-
-#include <memory>
-#include <mutex>
-
-#include "display.hpp"
-#include "display_init.hpp"
-#include "storage.hpp"
-#include "touchwheel.hpp"
-
-namespace drivers {
-
-DriverCache::DriverCache() : gpios_(std::make_unique<GpioExpander>()) {}
-DriverCache::~DriverCache() {}
-
-auto DriverCache::AcquireGpios() -> GpioExpander* {
- return gpios_.get();
-}
-
-auto DriverCache::AcquireDac() -> std::shared_ptr<AudioDac> {
- return Acquire(dac_, [&]() -> AudioDac* {
- return AudioDac::create(AcquireGpios()).value_or(nullptr);
- });
-}
-
-auto DriverCache::AcquireDisplay() -> std::shared_ptr<Display> {
- return Acquire(display_, [&]() -> Display* {
- return Display::create(AcquireGpios(), displays::kST7735R);
- });
-}
-
-auto DriverCache::AcquireStorage() -> std::shared_ptr<SdStorage> {
- return Acquire(storage_, [&]() -> SdStorage* {
- return SdStorage::create(AcquireGpios()).value_or(nullptr);
- });
-}
-
-auto DriverCache::AcquireTouchWheel() -> std::shared_ptr<TouchWheel> {
- return Acquire(touchwheel_,
- [&]() -> TouchWheel* { return new TouchWheel(); });
-}
-
-} // namespace drivers