mirror of https://github.com/ARMmbed/mbed-os.git
[STM32] HAL I2C (V2) sequential transmit / receive
In case of sequential transmit / receive, there is a need to: - not use the reload option - generate a new START on each new transaction This applies to all HAL supporting the IP version V2.pull/3324/head
parent
a0722b1086
commit
23926a2418
|
@ -2585,7 +2585,7 @@ HAL_StatusTypeDef HAL_I2C_Master_Sequential_Transmit_IT(I2C_HandleTypeDef *hi2c,
|
|||
/* Prepare transfer parameters */
|
||||
hi2c->pBuffPtr = pData;
|
||||
hi2c->XferCount = Size;
|
||||
hi2c->XferOptions = XferOptions;
|
||||
hi2c->XferOptions = (XferOptions & (~I2C_RELOAD_MODE));
|
||||
hi2c->XferISR = I2C_Master_ISR_IT;
|
||||
|
||||
/* If size > MAX_NBYTE_SIZE, use reload mode */
|
||||
|
@ -2598,15 +2598,7 @@ HAL_StatusTypeDef HAL_I2C_Master_Sequential_Transmit_IT(I2C_HandleTypeDef *hi2c,
|
|||
{
|
||||
hi2c->XferSize = hi2c->XferCount;
|
||||
xfermode = hi2c->XferOptions;
|
||||
|
||||
/* If transfer direction not change, do not generate Restart Condition */
|
||||
/* Mean Previous state is same as current state */
|
||||
if(hi2c->PreviousState == I2C_STATE_SLAVE_BUSY_TX)
|
||||
{
|
||||
xferrequest = I2C_NO_STARTSTOP;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Send Slave Address and set NBYTES to write */
|
||||
I2C_TransferConfig(hi2c, DevAddress, hi2c->XferSize, xfermode, xferrequest);
|
||||
|
@ -2659,7 +2651,7 @@ HAL_StatusTypeDef HAL_I2C_Master_Sequential_Receive_IT(I2C_HandleTypeDef *hi2c,
|
|||
/* Prepare transfer parameters */
|
||||
hi2c->pBuffPtr = pData;
|
||||
hi2c->XferCount = Size;
|
||||
hi2c->XferOptions = XferOptions;
|
||||
hi2c->XferOptions = (XferOptions & (~I2C_RELOAD_MODE));
|
||||
hi2c->XferISR = I2C_Master_ISR_IT;
|
||||
|
||||
/* If hi2c->XferCount > MAX_NBYTE_SIZE, use reload mode */
|
||||
|
@ -2672,13 +2664,6 @@ HAL_StatusTypeDef HAL_I2C_Master_Sequential_Receive_IT(I2C_HandleTypeDef *hi2c,
|
|||
{
|
||||
hi2c->XferSize = hi2c->XferCount;
|
||||
xfermode = hi2c->XferOptions;
|
||||
|
||||
/* If transfer direction not change, do not generate Restart Condition */
|
||||
/* Mean Previous state is same as current state */
|
||||
if(hi2c->PreviousState == I2C_STATE_MASTER_BUSY_RX)
|
||||
{
|
||||
xferrequest = I2C_NO_STARTSTOP;
|
||||
}
|
||||
}
|
||||
|
||||
/* Send Slave Address and set NBYTES to read */
|
||||
|
|
|
@ -2583,7 +2583,7 @@ HAL_StatusTypeDef HAL_I2C_Master_Sequential_Transmit_IT(I2C_HandleTypeDef *hi2c,
|
|||
/* Prepare transfer parameters */
|
||||
hi2c->pBuffPtr = pData;
|
||||
hi2c->XferCount = Size;
|
||||
hi2c->XferOptions = XferOptions;
|
||||
hi2c->XferOptions = (XferOptions & (~I2C_RELOAD_MODE));
|
||||
hi2c->XferISR = I2C_Master_ISR_IT;
|
||||
|
||||
/* If size > MAX_NBYTE_SIZE, use reload mode */
|
||||
|
@ -2596,13 +2596,6 @@ HAL_StatusTypeDef HAL_I2C_Master_Sequential_Transmit_IT(I2C_HandleTypeDef *hi2c,
|
|||
{
|
||||
hi2c->XferSize = hi2c->XferCount;
|
||||
xfermode = hi2c->XferOptions;
|
||||
|
||||
/* If transfer direction not change, do not generate Restart Condition */
|
||||
/* Mean Previous state is same as current state */
|
||||
if(hi2c->PreviousState == I2C_STATE_SLAVE_BUSY_TX)
|
||||
{
|
||||
xferrequest = I2C_NO_STARTSTOP;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -2657,7 +2650,7 @@ HAL_StatusTypeDef HAL_I2C_Master_Sequential_Receive_IT(I2C_HandleTypeDef *hi2c,
|
|||
/* Prepare transfer parameters */
|
||||
hi2c->pBuffPtr = pData;
|
||||
hi2c->XferCount = Size;
|
||||
hi2c->XferOptions = XferOptions;
|
||||
hi2c->XferOptions = (XferOptions & (~I2C_RELOAD_MODE));
|
||||
hi2c->XferISR = I2C_Master_ISR_IT;
|
||||
|
||||
/* If hi2c->XferCount > MAX_NBYTE_SIZE, use reload mode */
|
||||
|
@ -2670,13 +2663,6 @@ HAL_StatusTypeDef HAL_I2C_Master_Sequential_Receive_IT(I2C_HandleTypeDef *hi2c,
|
|||
{
|
||||
hi2c->XferSize = hi2c->XferCount;
|
||||
xfermode = hi2c->XferOptions;
|
||||
|
||||
/* If transfer direction not change, do not generate Restart Condition */
|
||||
/* Mean Previous state is same as current state */
|
||||
if(hi2c->PreviousState == I2C_STATE_MASTER_BUSY_RX)
|
||||
{
|
||||
xferrequest = I2C_NO_STARTSTOP;
|
||||
}
|
||||
}
|
||||
|
||||
/* Send Slave Address and set NBYTES to read */
|
||||
|
|
|
@ -2536,7 +2536,7 @@ HAL_StatusTypeDef HAL_I2C_Master_Sequential_Transmit_IT(I2C_HandleTypeDef *hi2c,
|
|||
/* Prepare transfer parameters */
|
||||
hi2c->pBuffPtr = pData;
|
||||
hi2c->XferCount = Size;
|
||||
hi2c->XferOptions = XferOptions;
|
||||
hi2c->XferOptions = (XferOptions & (~I2C_RELOAD_MODE));
|
||||
hi2c->XferISR = I2C_Master_ISR_IT;
|
||||
|
||||
/* If size > MAX_NBYTE_SIZE, use reload mode */
|
||||
|
@ -2549,13 +2549,6 @@ HAL_StatusTypeDef HAL_I2C_Master_Sequential_Transmit_IT(I2C_HandleTypeDef *hi2c,
|
|||
{
|
||||
hi2c->XferSize = hi2c->XferCount;
|
||||
xfermode = hi2c->XferOptions;
|
||||
|
||||
/* If transfer direction not change, do not generate Restart Condition */
|
||||
/* Mean Previous state is same as current state */
|
||||
if(hi2c->PreviousState == I2C_STATE_SLAVE_BUSY_TX)
|
||||
{
|
||||
xferrequest = I2C_NO_STARTSTOP;
|
||||
}
|
||||
}
|
||||
|
||||
/* Send Slave Address and set NBYTES to write */
|
||||
|
@ -2608,7 +2601,7 @@ HAL_StatusTypeDef HAL_I2C_Master_Sequential_Receive_IT(I2C_HandleTypeDef *hi2c,
|
|||
/* Prepare transfer parameters */
|
||||
hi2c->pBuffPtr = pData;
|
||||
hi2c->XferCount = Size;
|
||||
hi2c->XferOptions = XferOptions;
|
||||
hi2c->XferOptions = (XferOptions & (~I2C_RELOAD_MODE));
|
||||
hi2c->XferISR = I2C_Master_ISR_IT;
|
||||
|
||||
/* If hi2c->XferCount > MAX_NBYTE_SIZE, use reload mode */
|
||||
|
@ -2621,13 +2614,6 @@ HAL_StatusTypeDef HAL_I2C_Master_Sequential_Receive_IT(I2C_HandleTypeDef *hi2c,
|
|||
{
|
||||
hi2c->XferSize = hi2c->XferCount;
|
||||
xfermode = hi2c->XferOptions;
|
||||
|
||||
/* If transfer direction not change, do not generate Restart Condition */
|
||||
/* Mean Previous state is same as current state */
|
||||
if(hi2c->PreviousState == I2C_STATE_MASTER_BUSY_RX)
|
||||
{
|
||||
xferrequest = I2C_NO_STARTSTOP;
|
||||
}
|
||||
}
|
||||
|
||||
/* Send Slave Address and set NBYTES to read */
|
||||
|
|
|
@ -2591,7 +2591,7 @@ HAL_StatusTypeDef HAL_I2C_Master_Sequential_Transmit_IT(I2C_HandleTypeDef *hi2c,
|
|||
/* Prepare transfer parameters */
|
||||
hi2c->pBuffPtr = pData;
|
||||
hi2c->XferCount = Size;
|
||||
hi2c->XferOptions = XferOptions;
|
||||
hi2c->XferOptions = (XferOptions & (~I2C_RELOAD_MODE));
|
||||
hi2c->XferISR = I2C_Master_ISR_IT;
|
||||
|
||||
/* If size > MAX_NBYTE_SIZE, use reload mode */
|
||||
|
@ -2606,13 +2606,6 @@ HAL_StatusTypeDef HAL_I2C_Master_Sequential_Transmit_IT(I2C_HandleTypeDef *hi2c,
|
|||
xfermode = hi2c->XferOptions;
|
||||
}
|
||||
|
||||
/* If transfer direction not change, do not generate Restart Condition */
|
||||
/* Mean Previous state is same as current state */
|
||||
if(hi2c->PreviousState == I2C_STATE_MASTER_BUSY_TX)
|
||||
{
|
||||
xferrequest = I2C_NO_STARTSTOP;
|
||||
}
|
||||
|
||||
/* Send Slave Address and set NBYTES to write */
|
||||
I2C_TransferConfig(hi2c, DevAddress, hi2c->XferSize, xfermode, xferrequest);
|
||||
|
||||
|
@ -2664,7 +2657,7 @@ HAL_StatusTypeDef HAL_I2C_Master_Sequential_Receive_IT(I2C_HandleTypeDef *hi2c,
|
|||
/* Prepare transfer parameters */
|
||||
hi2c->pBuffPtr = pData;
|
||||
hi2c->XferCount = Size;
|
||||
hi2c->XferOptions = XferOptions;
|
||||
hi2c->XferOptions = (XferOptions & (~I2C_RELOAD_MODE));
|
||||
hi2c->XferISR = I2C_Master_ISR_IT;
|
||||
|
||||
/* If hi2c->XferCount > MAX_NBYTE_SIZE, use reload mode */
|
||||
|
@ -2679,13 +2672,6 @@ HAL_StatusTypeDef HAL_I2C_Master_Sequential_Receive_IT(I2C_HandleTypeDef *hi2c,
|
|||
xfermode = hi2c->XferOptions;
|
||||
}
|
||||
|
||||
/* If transfer direction not change, do not generate Restart Condition */
|
||||
/* Mean Previous state is same as current state */
|
||||
if(hi2c->PreviousState == I2C_STATE_MASTER_BUSY_RX)
|
||||
{
|
||||
xferrequest = I2C_NO_STARTSTOP;
|
||||
}
|
||||
|
||||
/* Send Slave Address and set NBYTES to read */
|
||||
I2C_TransferConfig(hi2c,DevAddress, hi2c->XferSize, xfermode, xferrequest);
|
||||
|
||||
|
|
|
@ -2571,7 +2571,7 @@ HAL_StatusTypeDef HAL_I2C_Master_Sequential_Transmit_IT(I2C_HandleTypeDef *hi2c,
|
|||
/* Prepare transfer parameters */
|
||||
hi2c->pBuffPtr = pData;
|
||||
hi2c->XferCount = Size;
|
||||
hi2c->XferOptions = XferOptions;
|
||||
hi2c->XferOptions = (XferOptions & (~I2C_RELOAD_MODE));
|
||||
hi2c->XferISR = I2C_Master_ISR_IT;
|
||||
|
||||
/* If size > MAX_NBYTE_SIZE, use reload mode */
|
||||
|
@ -2584,15 +2584,7 @@ HAL_StatusTypeDef HAL_I2C_Master_Sequential_Transmit_IT(I2C_HandleTypeDef *hi2c,
|
|||
{
|
||||
hi2c->XferSize = hi2c->XferCount;
|
||||
xfermode = hi2c->XferOptions;
|
||||
|
||||
/* If transfer direction not change, do not generate Restart Condition */
|
||||
/* Mean Previous state is same as current state */
|
||||
if(hi2c->PreviousState == I2C_STATE_SLAVE_BUSY_TX)
|
||||
{
|
||||
xferrequest = I2C_NO_STARTSTOP;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Send Slave Address and set NBYTES to write */
|
||||
I2C_TransferConfig(hi2c, DevAddress, hi2c->XferSize, xfermode, xferrequest);
|
||||
|
@ -2644,7 +2636,7 @@ HAL_StatusTypeDef HAL_I2C_Master_Sequential_Receive_IT(I2C_HandleTypeDef *hi2c,
|
|||
/* Prepare transfer parameters */
|
||||
hi2c->pBuffPtr = pData;
|
||||
hi2c->XferCount = Size;
|
||||
hi2c->XferOptions = XferOptions;
|
||||
hi2c->XferOptions = (XferOptions & (~I2C_RELOAD_MODE));
|
||||
hi2c->XferISR = I2C_Master_ISR_IT;
|
||||
|
||||
/* If hi2c->XferCount > MAX_NBYTE_SIZE, use reload mode */
|
||||
|
@ -2657,13 +2649,6 @@ HAL_StatusTypeDef HAL_I2C_Master_Sequential_Receive_IT(I2C_HandleTypeDef *hi2c,
|
|||
{
|
||||
hi2c->XferSize = hi2c->XferCount;
|
||||
xfermode = hi2c->XferOptions;
|
||||
|
||||
/* If transfer direction not change, do not generate Restart Condition */
|
||||
/* Mean Previous state is same as current state */
|
||||
if(hi2c->PreviousState == I2C_STATE_MASTER_BUSY_RX)
|
||||
{
|
||||
xferrequest = I2C_NO_STARTSTOP;
|
||||
}
|
||||
}
|
||||
|
||||
/* Send Slave Address and set NBYTES to read */
|
||||
|
|
Loading…
Reference in New Issue