diff options
Diffstat (limited to 'src/drivers/include')
| -rw-r--r-- | src/drivers/include/drivers/haptics.hpp | 16 | ||||
| -rw-r--r-- | src/drivers/include/drivers/nvs.hpp | 13 |
2 files changed, 16 insertions, 13 deletions
diff --git a/src/drivers/include/drivers/haptics.hpp b/src/drivers/include/drivers/haptics.hpp index a9384fa4..e4666fad 100644 --- a/src/drivers/include/drivers/haptics.hpp +++ b/src/drivers/include/drivers/haptics.hpp @@ -14,23 +14,15 @@ #include <string> #include <variant> -namespace drivers { +#include "drivers/nvs.hpp" -typedef std::monostate ErmMotor; -struct LraMotor { - // TODO: fill out with calibration data from - // https://www.ti.com/lit/ds/symlink/drv2605l.pdf - bool hi; -}; +namespace drivers { class Haptics { public: - static auto Create(const std::variant<ErmMotor, LraMotor>& motor) - -> Haptics* { - return new Haptics(motor); - } + static auto Create(NvsStorage& nvs) -> Haptics* { return new Haptics(nvs); } - Haptics(const std::variant<ErmMotor, LraMotor>& motor); + Haptics(NvsStorage& nvs); ~Haptics(); // Not copyable or movable. diff --git a/src/drivers/include/drivers/nvs.hpp b/src/drivers/include/drivers/nvs.hpp index 83bb8097..88dd5ae0 100644 --- a/src/drivers/include/drivers/nvs.hpp +++ b/src/drivers/include/drivers/nvs.hpp @@ -78,7 +78,17 @@ class NvsStorage { auto HapticMotorIsErm() -> bool; auto HapticMotorIsErm(bool) -> void; - // /Hardware Compatibility + + struct LraData { + uint8_t compensation; + uint8_t back_emf; + uint8_t gain; + + bool operator==(const LraData&) const = default; + }; + + auto LraCalibration() -> std::optional<LraData>; + auto LraCalibration(const LraData&) -> void; auto PreferredBluetoothDevice() -> std::optional<bluetooth::MacAndName>; auto PreferredBluetoothDevice(std::optional<bluetooth::MacAndName>) -> void; @@ -135,6 +145,7 @@ class NvsStorage { Setting<uint16_t> display_cols_; Setting<uint16_t> display_rows_; Setting<uint8_t> haptic_motor_type_; + Setting<LraData> lra_calibration_; Setting<uint8_t> brightness_; Setting<uint8_t> sensitivity_; |
