Tool/software: TI-RTOS
Hi, this is my first venture into firmware so please be patient.
1. In the file SensorTagApp, bsp_i2c.c there seem to be two different initializations of i2cParams. First, in bspI2cInit we have i2cParams.bitRate = I2C_400kHz. Second, in bspI2cSelect we have i2cParams.bitRate set to the default I2C_100kHz. Why are there two different bit rates, and what are these two different bit rates used for? As far as I can tell, the only one that matters is the second because all of the calls to read actual data use SENSOR_SELECT. What is the purpose of setting the bitrates differently?
2. How do I set up a non blocking read from the mpu9250 FIFO? Should the following modification to bspI2cSelect work? I believe that JXS post to Tosa may have suggested a better callback using a semaphore but i didn't understand that suggestion in enough detail.
Thanks in advance!
Allan
volatile bool lastI2cResult = false;
void myI2C_Callback (I2C_Handle foo, I2CTransaction* bar, bool status)
{
lastI2cResult = status;
}
bool getI2cResult()
{
bool ret = lastI2cResult;
lastI2cResult = false;
return lastI2cResult;
}
bool bspI2cSelectNonBlocking(uint8_t newInterface, uint8_t address)
{
--------------------------- code not pasted --------------------------
if (newInterface != interface)
{
--------------------------- code not pasted --------------------------
// Sets custom to NULL, selects I2C interface 0
I2C_Params_init(&i2cParams);
// Modifications for bitrate and non blocking
i2cParams.bitRate = I2C_400kHz;
i2cParams.transferMode = I2C_MODE_CALLBACK;
i2cParams.transferCallbackFxn = myI2C_Callback;
--------------------------- code not pasted --------------------------
} return i2cHandle != NULL; }