Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions bootloader/ota-dfu-python/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
__pycache__
2 changes: 2 additions & 0 deletions src/drivers/PinMap.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,10 @@ namespace Pinetime {
static constexpr uint8_t Button = 13;
#endif

static constexpr uint8_t ButtonEnable = 15;
static constexpr uint8_t Cst816sIrq = 28;
static constexpr uint8_t PowerPresent = 19;
static constexpr uint8_t Bma421Irq = 8;

static constexpr uint8_t Motor = 16;

Expand Down
39 changes: 15 additions & 24 deletions src/systemtask/SystemTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -172,39 +172,29 @@ void SystemTask::Work() {

buttonHandler.Init(this);

// Button
nrf_gpio_cfg_output(15);
nrf_gpio_pin_set(15);

// Setup Interrupts
nrfx_gpiote_in_config_t pinConfig;
pinConfig.skip_gpio_setup = false;
pinConfig.hi_accuracy = false;
pinConfig.is_watcher = false;
pinConfig.sense = static_cast<nrf_gpiote_polarity_t>(NRF_GPIOTE_POLARITY_TOGGLE);
pinConfig.pull = static_cast<nrf_gpio_pin_pull_t>(GPIO_PIN_CNF_PULL_Pulldown);

// Button
nrf_gpio_cfg_output(PinMap::ButtonEnable);
nrf_gpio_pin_set(PinMap::ButtonEnable);
pinConfig.sense = NRF_GPIOTE_POLARITY_TOGGLE;
pinConfig.pull = NRF_GPIO_PIN_PULLDOWN;
nrfx_gpiote_in_init(PinMap::Button, &pinConfig, nrfx_gpiote_evt_handler);
nrfx_gpiote_in_event_enable(PinMap::Button, true);

// Touchscreen
nrf_gpio_cfg_sense_input(PinMap::Cst816sIrq,
static_cast<nrf_gpio_pin_pull_t>(GPIO_PIN_CNF_PULL_Pullup),
static_cast<nrf_gpio_pin_sense_t>(GPIO_PIN_CNF_SENSE_Low));

pinConfig.skip_gpio_setup = true;
pinConfig.hi_accuracy = false;
pinConfig.is_watcher = false;
pinConfig.sense = static_cast<nrf_gpiote_polarity_t>(NRF_GPIOTE_POLARITY_HITOLO);
pinConfig.pull = static_cast<nrf_gpio_pin_pull_t>(GPIO_PIN_CNF_PULL_Pullup);

pinConfig.sense = NRF_GPIOTE_POLARITY_HITOLO;
pinConfig.pull = NRF_GPIO_PIN_PULLUP;
nrfx_gpiote_in_init(PinMap::Cst816sIrq, &pinConfig, nrfx_gpiote_evt_handler);
nrfx_gpiote_in_event_enable(PinMap::Cst816sIrq, true);

// Power present
pinConfig.sense = NRF_GPIOTE_POLARITY_TOGGLE;
pinConfig.pull = NRF_GPIO_PIN_NOPULL;
pinConfig.is_watcher = false;
pinConfig.hi_accuracy = false;
pinConfig.skip_gpio_setup = false;
nrfx_gpiote_in_init(PinMap::PowerPresent, &pinConfig, nrfx_gpiote_evt_handler);
nrfx_gpiote_in_event_enable(PinMap::PowerPresent, true);

Expand Down Expand Up @@ -264,15 +254,16 @@ void SystemTask::Work() {
case Messages::TouchWakeUp: {
if (touchHandler.GetNewTouchInfo()) {
auto gesture = touchHandler.GestureGet();
if (gesture != Pinetime::Applications::TouchEvents::None and
((gesture == Pinetime::Applications::TouchEvents::DoubleTap and
settingsController.isWakeUpModeOn(Pinetime::Controllers::Settings::WakeUpMode::DoubleTap)) or
(gesture == Pinetime::Applications::TouchEvents::Tap and
if (gesture != Pinetime::Applications::TouchEvents::None &&
((gesture == Pinetime::Applications::TouchEvents::DoubleTap &&
settingsController.isWakeUpModeOn(Pinetime::Controllers::Settings::WakeUpMode::DoubleTap)) ||
(gesture == Pinetime::Applications::TouchEvents::Tap &&
settingsController.isWakeUpModeOn(Pinetime::Controllers::Settings::WakeUpMode::SingleTap)))) {
GoToRunning();
}
}
} break;
break;
}
case Messages::GoToSleep:
if (doNotGoToSleep) {
break;
Expand Down