summaryrefslogtreecommitdiff
path: root/src/drivers/TwiMaster.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/drivers/TwiMaster.cpp')
-rw-r--r--src/drivers/TwiMaster.cpp12
1 files changed, 4 insertions, 8 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