diff options
author | Riku Isokoski <riksu9000@gmail.com> | 2021-08-10 22:03:34 +0300 |
---|---|---|
committer | Riku Isokoski <riksu9000@gmail.com> | 2021-08-10 22:03:34 +0300 |
commit | 8a694adb0979339664da0af6d51c480d26c5527b (patch) | |
tree | 89c0deb381b34d3060edfcee249a9e5177244e67 /src/drivers | |
parent | 7e92577c14895f57f5adda27ad54adbbc4b7ffe9 (diff) |
Rework TouchHandler into not a task
Diffstat (limited to 'src/drivers')
-rw-r--r-- | src/drivers/TwiMaster.cpp | 12 | ||||
-rw-r--r-- | src/drivers/TwiMaster.h | 3 |
2 files changed, 5 insertions, 10 deletions
diff --git a/src/drivers/TwiMaster.cpp b/src/drivers/TwiMaster.cpp index 456c3e64..fc9edf81 100644 --- a/src/drivers/TwiMaster.cpp +++ b/src/drivers/TwiMaster.cpp @@ -12,10 +12,9 @@ TwiMaster::TwiMaster(const Modules module, const Parameters& params) : module {m } void TwiMaster::Init() { - sleeping = false; if(mutex == nullptr) mutex = xSemaphoreCreateBinary(); - + NRF_GPIO->PIN_CNF[params.pinScl] = ((uint32_t) GPIO_PIN_CNF_DIR_Input << GPIO_PIN_CNF_DIR_Pos) | ((uint32_t) GPIO_PIN_CNF_INPUT_Connect << GPIO_PIN_CNF_INPUT_Pos) | ((uint32_t) GPIO_PIN_CNF_PULL_Pullup << GPIO_PIN_CNF_PULL_Pos) | ((uint32_t) GPIO_PIN_CNF_DRIVE_S0D1 << GPIO_PIN_CNF_DRIVE_Pos) | @@ -177,14 +176,11 @@ void TwiMaster::Sleep() { nrf_gpio_cfg_default(6); nrf_gpio_cfg_default(7); NRF_LOG_INFO("[TWIMASTER] Sleep"); - sleeping = true; } void TwiMaster::Wakeup() { - if (sleeping) { - Init(); - NRF_LOG_INFO("[TWIMASTER] Wakeup"); - } + Init(); + NRF_LOG_INFO("[TWIMASTER] Wakeup"); } /* Sometimes, the TWIM device just freeze and never set the event EVENTS_LASTTX. @@ -210,4 +206,4 @@ void TwiMaster::FixHwFreezed() { // Re-enable I²C twiBaseAddress->ENABLE = twi_state; -} +}
\ No newline at end of file diff --git a/src/drivers/TwiMaster.h b/src/drivers/TwiMaster.h index 5748ec65..6175b99b 100644 --- a/src/drivers/TwiMaster.h +++ b/src/drivers/TwiMaster.h @@ -39,7 +39,6 @@ namespace Pinetime { uint8_t internalBuffer[maxDataSize + registerSize]; uint32_t txStartedCycleCount = 0; static constexpr uint32_t HwFreezedDelay {161000}; - bool sleeping; }; } -} +}
\ No newline at end of file |