I2C error handle in cosmic compiler.
Hi there.
I´m using a STM8S207 with cosmic compiler.
I am reading and writing a 24L64 eeprom thru i2C and everthis is working well.
But i want to put protection in the routines to avoid lock the program in case of fail of a write or read command.
i found a text with this information:
@note
For error management, it is advised to use the following functions:
- I2C_ITConfig() to configure and enable the error interrupts (I2C_IT_ERR).
- I2Cx_ER_IRQHandler() which is called when the error interrupt occurs.
Where x is the peripheral instance (I2C1, I2C2 ...)
- I2C_GetFlagStatus() or I2C_GetITStatus() to be called into the
I2Cx_ER_IRQHandler() function in order to determine which error occurred.
- I2C_ClearFlag() or I2C_ClearITPendingBit() and/or I2C_SoftwareResetCmd()
and/or I2C_GenerateStop() in order to clear the error flag and source
and return to correct communication status.
Questions:
Where is this I2C_ITConfig() function in stm8 library?
How i handle the error message? I am a little lost in this part..
Sincerelly
Marcelo
