From 012c246e401c0745d4b6765217ce7137680070da Mon Sep 17 00:00:00 2001 From: Joaquim Date: Sat, 10 Apr 2021 19:09:33 +0100 Subject: 0.16.0 TWI problems fix More memory for freertos heap and timer stack Fix warning in watchface Fix number of bytes read by cst816 Debug app to show freertos tasks Increased the number of bytes of the twi write buffer --- src/drivers/TwiMaster.h | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'src/drivers/TwiMaster.h') diff --git a/src/drivers/TwiMaster.h b/src/drivers/TwiMaster.h index 6e3ff721..f3c87b0a 100644 --- a/src/drivers/TwiMaster.h +++ b/src/drivers/TwiMaster.h @@ -3,13 +3,13 @@ #include #include // NRF_TWIM_Type #include -#include namespace Pinetime { namespace Drivers { class TwiMaster { public: enum class Modules { TWIM1 }; + enum class Frequencies {Khz100, Khz250, Khz400}; enum class ErrorCodes {NoError, TransactionFailed}; struct Parameters { uint32_t frequency; @@ -27,13 +27,19 @@ namespace Pinetime { void Wakeup(); private: - nrfx_twim_t twim; + + ErrorCodes Read(uint8_t deviceAddress, uint8_t* buffer, size_t size, bool stop); + ErrorCodes Write(uint8_t deviceAddress, const uint8_t* data, size_t size, bool stop); + void FixHwFreezed(); + NRF_TWIM_Type* twiBaseAddress; + SemaphoreHandle_t mutex; const Modules module; const Parameters params; - SemaphoreHandle_t mutex; - static constexpr uint8_t maxDataSize{8}; + static constexpr uint8_t maxDataSize{16}; static constexpr uint8_t registerSize{1}; uint8_t internalBuffer[maxDataSize + registerSize]; + uint32_t txStartedCycleCount = 0; + static constexpr uint32_t HwFreezedDelay{161000}; }; } } \ No newline at end of file -- cgit v1.2.3-70-g09d2