summaryrefslogtreecommitdiff
path: root/src/systemtask/SystemTask.cpp
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/systemtask/SystemTask.cpp
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/systemtask/SystemTask.cpp')
-rw-r--r--src/systemtask/SystemTask.cpp20
1 files changed, 11 insertions, 9 deletions
diff --git a/src/systemtask/SystemTask.cpp b/src/systemtask/SystemTask.cpp
index 690a453d..d64a3d96 100644
--- a/src/systemtask/SystemTask.cpp
+++ b/src/systemtask/SystemTask.cpp
@@ -21,8 +21,10 @@
#include "drivers/SpiNorFlash.h"
#include "drivers/TwiMaster.h"
#include "drivers/Hrs3300.h"
+#include "drivers/PinMap.h"
#include "main.h"
+
#include <memory>
using namespace Pinetime::System;
@@ -154,7 +156,7 @@ void SystemTask::Work() {
heartRateSensor.Disable();
heartRateApp.Start();
- nrf_gpio_cfg_sense_input(pinButton, (nrf_gpio_pin_pull_t) GPIO_PIN_CNF_PULL_Pulldown, (nrf_gpio_pin_sense_t) GPIO_PIN_CNF_SENSE_High);
+ nrf_gpio_cfg_sense_input(PinMap::Button, (nrf_gpio_pin_pull_t) GPIO_PIN_CNF_PULL_Pulldown, (nrf_gpio_pin_sense_t) GPIO_PIN_CNF_SENSE_High);
nrf_gpio_cfg_output(15);
nrf_gpio_pin_set(15);
@@ -165,9 +167,9 @@ void SystemTask::Work() {
pinConfig.sense = (nrf_gpiote_polarity_t) NRF_GPIOTE_POLARITY_HITOLO;
pinConfig.pull = (nrf_gpio_pin_pull_t) GPIO_PIN_CNF_PULL_Pulldown;
- nrfx_gpiote_in_init(pinButton, &pinConfig, nrfx_gpiote_evt_handler);
+ nrfx_gpiote_in_init(PinMap::Button, &pinConfig, nrfx_gpiote_evt_handler);
- nrf_gpio_cfg_sense_input(pinTouchIrq, (nrf_gpio_pin_pull_t) GPIO_PIN_CNF_PULL_Pullup, (nrf_gpio_pin_sense_t) GPIO_PIN_CNF_SENSE_Low);
+ nrf_gpio_cfg_sense_input(PinMap::Cst816sIrq, (nrf_gpio_pin_pull_t) GPIO_PIN_CNF_PULL_Pullup, (nrf_gpio_pin_sense_t) GPIO_PIN_CNF_SENSE_Low);
pinConfig.skip_gpio_setup = true;
pinConfig.hi_accuracy = false;
@@ -175,19 +177,19 @@ void SystemTask::Work() {
pinConfig.sense = (nrf_gpiote_polarity_t) NRF_GPIOTE_POLARITY_HITOLO;
pinConfig.pull = (nrf_gpio_pin_pull_t) GPIO_PIN_CNF_PULL_Pullup;
- nrfx_gpiote_in_init(pinTouchIrq, &pinConfig, nrfx_gpiote_evt_handler);
+ nrfx_gpiote_in_init(PinMap::Cst816sIrq, &pinConfig, nrfx_gpiote_evt_handler);
pinConfig.sense = NRF_GPIOTE_POLARITY_TOGGLE;
pinConfig.pull = NRF_GPIO_PIN_NOPULL;
pinConfig.is_watcher = false;
pinConfig.hi_accuracy = false;
pinConfig.skip_gpio_setup = true;
- nrfx_gpiote_in_init(pinPowerPresentIrq, &pinConfig, nrfx_gpiote_evt_handler);
+ nrfx_gpiote_in_init(PinMap::PowerPresent, &pinConfig, nrfx_gpiote_evt_handler);
- if (nrf_gpio_pin_read(pinPowerPresentIrq)) {
- nrf_gpio_cfg_sense_input(pinPowerPresentIrq, NRF_GPIO_PIN_NOPULL, NRF_GPIO_PIN_SENSE_LOW);
+ if (nrf_gpio_pin_read(PinMap::PowerPresent)) {
+ nrf_gpio_cfg_sense_input(PinMap::PowerPresent, NRF_GPIO_PIN_NOPULL, NRF_GPIO_PIN_SENSE_LOW);
} else {
- nrf_gpio_cfg_sense_input(pinPowerPresentIrq, NRF_GPIO_PIN_NOPULL, NRF_GPIO_PIN_SENSE_HIGH);
+ nrf_gpio_cfg_sense_input(PinMap::PowerPresent, NRF_GPIO_PIN_NOPULL, NRF_GPIO_PIN_SENSE_HIGH);
}
idleTimer = xTimerCreate("idleTimer", pdMS_TO_TICKS(2000), pdFALSE, this, IdleTimerCallback);
@@ -360,7 +362,7 @@ void SystemTask::Work() {
monitor.Process();
uint32_t systick_counter = nrf_rtc_counter_get(portNRF_RTC_REG);
dateTimeController.UpdateTime(systick_counter);
- if (!nrf_gpio_pin_read(pinButton))
+ if (!nrf_gpio_pin_read(PinMap::Button))
watchdog.Kick();
}
// Clear diagnostic suppression