summaryrefslogtreecommitdiff
path: root/src/system_fsm/include
diff options
context:
space:
mode:
Diffstat (limited to 'src/system_fsm/include')
-rw-r--r--src/system_fsm/include/service_locator.hpp10
-rw-r--r--src/system_fsm/include/system_events.hpp5
-rw-r--r--src/system_fsm/include/system_fsm.hpp2
3 files changed, 17 insertions, 0 deletions
diff --git a/src/system_fsm/include/service_locator.hpp b/src/system_fsm/include/service_locator.hpp
index 327d0c50..4aa57df0 100644
--- a/src/system_fsm/include/service_locator.hpp
+++ b/src/system_fsm/include/service_locator.hpp
@@ -13,6 +13,7 @@
#include "collation.hpp"
#include "database.hpp"
#include "gpios.hpp"
+#include "haptics.hpp"
#include "nvs.hpp"
#include "samd.hpp"
#include "storage.hpp"
@@ -79,6 +80,14 @@ class ServiceLocator {
touchwheel_ = std::move(i);
}
+ auto haptics() -> drivers::Haptics& {
+ return *haptics_;
+ }
+
+ auto haptics(std::unique_ptr<drivers::Haptics> i) {
+ haptics_ = std::move(i);
+ }
+
auto database() -> std::weak_ptr<database::Database> { return database_; }
auto database(std::unique_ptr<database::Database> i) {
@@ -130,6 +139,7 @@ class ServiceLocator {
std::unique_ptr<drivers::Samd> samd_;
std::unique_ptr<drivers::NvsStorage> nvs_;
std::unique_ptr<drivers::TouchWheel> touchwheel_;
+ std::unique_ptr<drivers::Haptics> haptics_;
std::unique_ptr<drivers::Bluetooth> bluetooth_;
std::unique_ptr<audio::TrackQueue> queue_;
diff --git a/src/system_fsm/include/system_events.hpp b/src/system_fsm/include/system_events.hpp
index 4db9beb0..2722fa80 100644
--- a/src/system_fsm/include/system_events.hpp
+++ b/src/system_fsm/include/system_events.hpp
@@ -10,6 +10,7 @@
#include "battery.hpp"
#include "database.hpp"
+#include "haptics.hpp"
#include "service_locator.hpp"
#include "tinyfsm.hpp"
@@ -55,6 +56,10 @@ struct BatteryStateChanged : tinyfsm::Event {
struct BluetoothDevicesChanged : tinyfsm::Event {};
+struct HapticTrigger : tinyfsm::Event {
+ drivers::Haptics::Effect effect;
+};
+
namespace internal {
struct GpioInterrupt : tinyfsm::Event {};
diff --git a/src/system_fsm/include/system_fsm.hpp b/src/system_fsm/include/system_fsm.hpp
index 28448e5a..c9803bef 100644
--- a/src/system_fsm/include/system_fsm.hpp
+++ b/src/system_fsm/include/system_fsm.hpp
@@ -50,6 +50,8 @@ class SystemState : public tinyfsm::Fsm<SystemState> {
void react(const internal::GpioInterrupt&);
void react(const internal::SamdInterrupt&);
+ void react(const HapticTrigger&);
+
virtual void react(const DisplayReady&) {}
virtual void react(const BootComplete&) {}
virtual void react(const StorageMounted&) {}