double tap wakeup error fix
battery nonblocking read
This commit is contained in:
parent
1d3742e14f
commit
bb7531e208
7 changed files with 89 additions and 68 deletions
|
|
@ -10,6 +10,7 @@ using namespace Pinetime::Drivers;
|
|||
|
||||
TwiMaster::TwiMaster(const Modules module, const Parameters& params) : module{module}, params{params} {
|
||||
mutex = xSemaphoreCreateBinary();
|
||||
ASSERT(mutex != NULL);
|
||||
}
|
||||
|
||||
void TwiMaster::Init() {
|
||||
|
|
@ -61,9 +62,11 @@ void TwiMaster::Init() {
|
|||
}
|
||||
|
||||
TwiMaster::ErrorCodes TwiMaster::Read(uint8_t deviceAddress, uint8_t registerAddress, uint8_t *data, size_t size) {
|
||||
xSemaphoreTake(mutex, portMAX_DELAY);
|
||||
// this is causing an error when came from sleep
|
||||
//xSemaphoreTake(mutex, portMAX_DELAY);
|
||||
|
||||
auto ret = ReadWithRetry(deviceAddress, registerAddress, data, size);
|
||||
xSemaphoreGive(mutex);
|
||||
//xSemaphoreGive(mutex);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue