summaryrefslogtreecommitdiff
path: root/src/components/motor
diff options
context:
space:
mode:
authorJF002 <JF002@users.noreply.github.com>2021-09-13 20:05:43 +0200
committerGitHub <noreply@github.com>2021-09-13 20:05:43 +0200
commitb0bdd2be1c30d349a1efef96b93a5771f5edbd06 (patch)
treef87b3c1b7b2fb664bc26da96f4cafd0206aa53dc /src/components/motor
parent84a93b54410681ce1aaae80ba7a7e6d3300dcfa1 (diff)
parente614af1c4a53e943256b3b2acee4bfe7d7204bbf (diff)
Merge pull request #549 from hubmartin/pinmap
Put all duplicated GPIO pin definitions to a single file
Diffstat (limited to 'src/components/motor')
-rw-r--r--src/components/motor/MotorController.cpp11
-rw-r--r--src/components/motor/MotorController.h1
2 files changed, 6 insertions, 6 deletions
diff --git a/src/components/motor/MotorController.cpp b/src/components/motor/MotorController.cpp
index b25e6bc8..42057a86 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(shortVibTimer);
APP_TIMER_DEF(longVibTimer);
@@ -12,8 +13,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_init();
app_timer_create(&shortVibTimer, APP_TIMER_MODE_SINGLE_SHOT, StopMotor);
@@ -30,7 +31,7 @@ void MotorController::RunForDuration(uint8_t motorDuration) {
return;
}
- nrf_gpio_pin_clear(pinMotor);
+ nrf_gpio_pin_clear(PinMap::Motor);
app_timer_start(shortVibTimer, APP_TIMER_TICKS(motorDuration), nullptr);
}
@@ -44,9 +45,9 @@ void MotorController::StartRinging() {
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);
}
diff --git a/src/components/motor/MotorController.h b/src/components/motor/MotorController.h
index d2c9fe5f..1d8fcc95 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: