2021-06-03 09:16 PM
In the example
while(HAL_I2C_Master_Transmit_DMA(&I2cHandle, (uint16_t)I2C_ADDRESS, (uint8_t*)aTxBuffer, TXBUFFERSIZE)!= HAL_OK)
{
/* Error_Handler() function is called when Timeout error occurs.
When Acknowledge failure occurs (Slave don't acknowledge its address)
Master restarts communication */
if (HAL_I2C_GetError(&I2cHandle) != HAL_I2C_ERROR_AF)
{
Error_Handler();
}
}
I want to know why if (HAL_I2C_GetError(&I2cHandle) != HAL_I2C_ERROR_AF) here rather than if (HAL_I2C_GetError(&I2cHandle) == HAL_I2C_ERROR_AF) if I want to judge Acknowledge failure
thanks
Solved! Go to Solution.
2021-06-05 02:42 AM
The explanation is written right there in a code comment!
2021-06-05 02:42 AM
The explanation is written right there in a code comment!