diff options
author | JF002 <JF002@users.noreply.github.com> | 2021-06-12 11:02:06 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-06-12 11:02:06 +0200 |
commit | 0ce98c7ac7ba66acaf504be9bb042796e12f2733 (patch) | |
tree | 3f9c7f96f0fab64f581035c72480596a4cc4db43 /src/drivers/TwiMaster.cpp | |
parent | 79f0fcb07aa80eb70385223272e29f2ba5657bc8 (diff) | |
parent | 6d524ebea2c97e309633d5e01c3a1e37c182f27d (diff) |
Merge pull request #415 from JF002/move-heap-to-static
Move dynamically allocated variables to static variables.
Diffstat (limited to 'src/drivers/TwiMaster.cpp')
-rw-r--r-- | src/drivers/TwiMaster.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/drivers/TwiMaster.cpp b/src/drivers/TwiMaster.cpp index 7b6582dd..fc9edf81 100644 --- a/src/drivers/TwiMaster.cpp +++ b/src/drivers/TwiMaster.cpp @@ -9,10 +9,12 @@ using namespace Pinetime::Drivers; // TODO use DMA/IRQ TwiMaster::TwiMaster(const Modules module, const Parameters& params) : module {module}, params {params} { - mutex = xSemaphoreCreateBinary(); } void TwiMaster::Init() { + 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) | |