impl i2c mutex and some work on global star code handler
This commit is contained in:
@@ -32,6 +32,7 @@ Arduino Uno (any 'duino should do)
|
||||
******************************************************************************/
|
||||
|
||||
#include "SparkFunBQ27441.h"
|
||||
#include "../i2c.h"
|
||||
|
||||
/*****************************************************************************
|
||||
************************** Initialization Functions *************************
|
||||
@@ -710,7 +711,9 @@ bool BQ27441::writeExtendedData(uint8_t classID, uint8_t offset, uint8_t * data,
|
||||
int16_t BQ27441::i2cReadBytes(uint8_t subAddress, uint8_t * dest, uint8_t count)
|
||||
{
|
||||
int16_t timeout = BQ72441_I2C_TIMEOUT;
|
||||
xSemaphoreTake(i2c0_mutex, portMAX_DELAY);
|
||||
i2c_master_write_read_device(BQ72441_I2C_NUM, _deviceAddress, &subAddress, 1, dest, count, timeout);
|
||||
xSemaphoreGive(i2c0_mutex);
|
||||
return timeout;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user