fix i2c reset bus function

This commit is contained in:
2025-08-14 23:59:15 +08:00
parent 88f79f7eb0
commit 90486c6609
3 changed files with 112 additions and 42 deletions

View File

@@ -39,7 +39,10 @@ typedef enum {
I2C_RESULT_NACK, /* No acknowledge received */
I2C_RESULT_BUS_BUSY, /* Bus is busy */
I2C_RESULT_ERROR, /* General error */
I2C_RESULT_INVALID_PARAM /* Invalid parameter */
I2C_RESULT_INVALID_PARAM, /* Invalid parameter */
I2C_RECOVERY_OK,
I2C_RECOVERY_SDA_STUCK_LOW,
I2C_RECOVERY_SCL_STUCK_LOW
} i2c_result_t;
/* I2C state machine enumeration */
@@ -69,24 +72,21 @@ typedef enum {
/* Function declarations */
// TODO I2C Result
/*!
\brief configure the I2C interface
\param[in] none
\param[out] none
\retval i2c_result_t
*/
void i2c_config(void);
i2c_result_t i2c_config(void);
// TODO I2C Result
/*!
\brief reset I2C bus with proper recovery
\param[in] none
\param[out] none
\retval i2c_result_t
*/
void i2c_bus_reset(void);
i2c_result_t i2c_bus_reset(void);
/*!
\brief scan I2C bus for devices