diff options
| author | JF <jf@codingfield.com> | 2021-09-26 09:16:55 (GMT) |
|---|---|---|
| committer | Gitea <gitea@fake.local> | 2021-09-26 09:16:55 (GMT) |
| commit | 6652ec6f71967f4a8eea1f159aa500a1a21a5902 (patch) | |
| tree | cdbbf9afede8ea74258867ba41905a3fe0d784f4 /src/components/motor/MotorController.cpp | |
| parent | 6c3d6fb2575888e582e7ef3004a0bc3bf6c588b6 (diff) | |
| parent | d03db14129b4f8cc2e691dd6f9e8d8d1ed52b7a1 (diff) | |
Merge branch 'develop' of JF/PineTime into master
Diffstat (limited to 'src/components/motor/MotorController.cpp')
| -rw-r--r-- | src/components/motor/MotorController.cpp | 21 |
1 files changed, 6 insertions, 15 deletions
diff --git a/src/components/motor/MotorController.cpp b/src/components/motor/MotorController.cpp index b25e6bc..f596c71 100644 --- a/src/components/motor/MotorController.cpp +++ b/src/components/motor/MotorController.cpp @@ -2,18 +2,16 @@ #include <hal/nrf_gpio.h> #include "systemtask/SystemTask.h" #include "app_timer.h" +#include "drivers/PinMap.h" APP_TIMER_DEF(shortVibTimer); APP_TIMER_DEF(longVibTimer); using namespace Pinetime::Controllers; -MotorController::MotorController(Controllers::Settings& settingsController) : settingsController {settingsController} { -} - void MotorController::Init() { - nrf_gpio_cfg_output(pinMotor); - nrf_gpio_pin_set(pinMotor); + nrf_gpio_cfg_output(PinMap::Motor); + nrf_gpio_pin_set(PinMap::Motor); app_timer_init(); app_timer_create(&shortVibTimer, APP_TIMER_MODE_SINGLE_SHOT, StopMotor); @@ -26,27 +24,20 @@ void MotorController::Ring(void* p_context) { } void MotorController::RunForDuration(uint8_t motorDuration) { - if (settingsController.GetVibrationStatus() == Controllers::Settings::Vibration::OFF) { - return; - } - - nrf_gpio_pin_clear(pinMotor); + nrf_gpio_pin_clear(PinMap::Motor); app_timer_start(shortVibTimer, APP_TIMER_TICKS(motorDuration), nullptr); } void MotorController::StartRinging() { - if (settingsController.GetVibrationStatus() == Controllers::Settings::Vibration::OFF) { - return; - } Ring(this); app_timer_start(longVibTimer, APP_TIMER_TICKS(1000), this); } void MotorController::StopRinging() { app_timer_stop(longVibTimer); - nrf_gpio_pin_set(pinMotor); + nrf_gpio_pin_set(PinMap::Motor); } void MotorController::StopMotor(void* p_context) { - nrf_gpio_pin_set(pinMotor); + nrf_gpio_pin_set(PinMap::Motor); } |
