diff options
| author | hubmartin <hub.martin@gmail.com> | 2021-08-03 18:32:23 (GMT) |
|---|---|---|
| committer | hubmartin <hub.martin@gmail.com> | 2021-08-03 18:32:23 (GMT) |
| commit | b7aa04e1f55096d754a7cc291f02f3430f5a3cd9 (patch) | |
| tree | 6462cbd332cf813f9a173b0783521ef9714c45bb /src/components/motor | |
| parent | 28abeae21bb370c45d26912bba4737a1cc6ddca7 (diff) | |
PinMap with namespace and constexpr
Diffstat (limited to 'src/components/motor')
| -rw-r--r-- | src/components/motor/MotorController.cpp | 9 | ||||
| -rw-r--r-- | src/components/motor/MotorController.h | 1 |
2 files changed, 5 insertions, 5 deletions
diff --git a/src/components/motor/MotorController.cpp b/src/components/motor/MotorController.cpp index 3afa0ce..1f20936 100644 --- a/src/components/motor/MotorController.cpp +++ b/src/components/motor/MotorController.cpp @@ -2,6 +2,7 @@ #include <hal/nrf_gpio.h> #include "systemtask/SystemTask.h" #include "app_timer.h" +#include "drivers/PinMap.h" APP_TIMER_DEF(vibTimer); @@ -11,8 +12,8 @@ MotorController::MotorController(Controllers::Settings& settingsController) : se } 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_create(&vibTimer, APP_TIMER_MODE_SINGLE_SHOT, vibrate); } @@ -21,11 +22,11 @@ void MotorController::SetDuration(uint8_t motorDuration) { if (settingsController.GetVibrationStatus() == Controllers::Settings::Vibration::OFF) return; - nrf_gpio_pin_clear(pinMotor); + nrf_gpio_pin_clear(PinMap::Motor); /* Start timer for motorDuration miliseconds and timer triggers vibrate() when it finishes*/ app_timer_start(vibTimer, APP_TIMER_TICKS(motorDuration), NULL); } void MotorController::vibrate(void* p_context) { - nrf_gpio_pin_set(pinMotor); + nrf_gpio_pin_set(PinMap::Motor); }
\ No newline at end of file diff --git a/src/components/motor/MotorController.h b/src/components/motor/MotorController.h index df61af7..00cd193 100644 --- a/src/components/motor/MotorController.h +++ b/src/components/motor/MotorController.h @@ -6,7 +6,6 @@ namespace Pinetime { namespace Controllers { - static constexpr uint8_t pinMotor = 16; class MotorController { public: |
