diff options
| author | Michele Bini <michele.bini@gmail.com> | 2022-04-13 18:53:16 (GMT) |
|---|---|---|
| committer | Michele Bini <michele.bini@gmail.com> | 2022-04-13 18:53:16 (GMT) |
| commit | 531c1172a2357d53b214aaf7b29efee47d9b32e5 (patch) | |
| tree | e9c008f13900e1d3c63332a3bbc305754f8ae35c /src/components/motor/MotorController.cpp | |
| parent | 27fa6bba08766831fe143fe5ca13767bedcd9072 (diff) | |
Revert "Sans notification (notification manager retained as it seems to be used by the dfu manager)"ultraredux2
This reverts commit 569e6fea41c13f33ad1374bb80ca489aaf4a7037.
Diffstat (limited to 'src/components/motor/MotorController.cpp')
| -rw-r--r-- | src/components/motor/MotorController.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/components/motor/MotorController.cpp b/src/components/motor/MotorController.cpp index 24aeeb0..bee07fb 100644 --- a/src/components/motor/MotorController.cpp +++ b/src/components/motor/MotorController.cpp @@ -5,6 +5,7 @@ #include "drivers/PinMap.h" APP_TIMER_DEF(shortVibTimer); +APP_TIMER_DEF(longVibTimer); using namespace Pinetime::Controllers; @@ -13,6 +14,7 @@ void MotorController::Init() { nrf_gpio_pin_set(PinMap::Motor); app_timer_create(&shortVibTimer, APP_TIMER_MODE_SINGLE_SHOT, StopMotor); + app_timer_create(&longVibTimer, APP_TIMER_MODE_REPEATED, Ring); } void MotorController::Ring(void* p_context) { @@ -25,6 +27,16 @@ void MotorController::RunForDuration(uint8_t motorDuration) { app_timer_start(shortVibTimer, APP_TIMER_TICKS(motorDuration), nullptr); } +void MotorController::StartRinging() { + Ring(this); + app_timer_start(longVibTimer, APP_TIMER_TICKS(1000), this); +} + +void MotorController::StopRinging() { + app_timer_stop(longVibTimer); + nrf_gpio_pin_set(PinMap::Motor); +} + void MotorController::StopMotor(void* p_context) { nrf_gpio_pin_set(PinMap::Motor); } |
