hello,
lpi2c_master_state_t *master; Is it defined as a global variable?
but it is failure.
Have you tested your method?
Please specify the specific operation steps, or you know to help modify the code!
The way you said above is too abstract for me to understand.
lpi2c_master_state_t *master;
status_t LPI2C_DRV_MasterSendDataBlocking(uint32_t instance,const uint8_t * txBuff,uint32_t txSize,bool sendStop,uint32_t timeout)
{
DEV_ASSERT(instance < LPI2C_INSTANCE_COUNT);
DEV_ASSERT(txBuff != NULL);
DEV_ASSERT(txSize > 0U);
master = g_lpi2cMasterStatePtr[instance];
DEV_ASSERT(master != NULL);
/* Check if driver is busy */
if(!master->i2cIdle)
{
return STATUS_BUSY;
}
/* mark transfer as blocking */
master->blocking = true;
/* Dummy wait to ensure the semaphore is 0, no need to check result */
(void)OSIF_SemaWait(&(master->idleSemaphore), 0);
(void)LPI2C_DRV_MasterSendData(instance, txBuff, txSize, sendStop);
/* Wait for transfer to end */
return LPI2C_DRV_MasterWaitTransferEnd(instance, timeout);
}
thanks