feat(i2c): Add new API and implementation for I2C driver
This commit is contained in:
@@ -33,6 +33,22 @@ typedef struct {
|
||||
i2c_dev_t *dev;
|
||||
} i2c_hal_context_t;
|
||||
|
||||
/**
|
||||
* @brief Timing configuration structure. Used for I2C reset internally.
|
||||
*/
|
||||
typedef struct {
|
||||
int high_period; /*!< high_period time */
|
||||
int low_period; /*!< low_period time */
|
||||
int wait_high_period; /*!< wait_high_period time */
|
||||
int rstart_setup; /*!< restart setup */
|
||||
int start_hold; /*!< start hold time */
|
||||
int stop_setup; /*!< stop setup */
|
||||
int stop_hold; /*!< stop hold time */
|
||||
int sda_sample; /*!< high_period time */
|
||||
int sda_hold; /*!< sda hold time */
|
||||
int timeout; /*!< timeout value */
|
||||
} i2c_hal_timing_config_t;
|
||||
|
||||
#if SOC_I2C_SUPPORT_SLAVE
|
||||
|
||||
/**
|
||||
|
||||
@@ -29,6 +29,16 @@ typedef enum {
|
||||
I2C_NUM_MAX, /*!< I2C port max */
|
||||
} i2c_port_t;
|
||||
|
||||
/**
|
||||
* @brief Enumeration for I2C device address bit length
|
||||
*/
|
||||
typedef enum {
|
||||
I2C_ADDR_BIT_LEN_7 = 0, /*!< i2c address bit length 7 */
|
||||
#if SOC_I2C_SUPPORT_10BIT_ADDR
|
||||
I2C_ADDR_BIT_LEN_10 = 1, /*!< i2c address bit length 10 */
|
||||
#endif
|
||||
} i2c_addr_bit_len_t;
|
||||
|
||||
/**
|
||||
* @brief Data structure for calculating I2C bus timing.
|
||||
*/
|
||||
@@ -63,6 +73,7 @@ typedef enum {
|
||||
I2C_DATA_MODE_MAX
|
||||
} i2c_trans_mode_t;
|
||||
|
||||
__attribute__((deprecated("please use 'i2c_addr_bit_len_t' instead")))
|
||||
typedef enum {
|
||||
I2C_ADDR_BIT_7 = 0, /*!< I2C 7bit address for slave mode */
|
||||
I2C_ADDR_BIT_10, /*!< I2C 10bit address for slave mode */
|
||||
@@ -76,22 +87,6 @@ typedef enum {
|
||||
I2C_MASTER_ACK_MAX,
|
||||
} i2c_ack_type_t;
|
||||
|
||||
/**
|
||||
* @brief Timing configuration structure. Used for I2C reset internally.
|
||||
*/
|
||||
typedef struct {
|
||||
int high_period; /*!< high_period time */
|
||||
int low_period; /*!< low_period time */
|
||||
int wait_high_period; /*!< wait_high_period time */
|
||||
int rstart_setup; /*!< restart setup */
|
||||
int start_hold; /*!< start hold time */
|
||||
int stop_setup; /*!< stop setup */
|
||||
int stop_hold; /*!< stop hold time */
|
||||
int sda_sample; /*!< high_period time */
|
||||
int sda_hold; /*!< sda hold time */
|
||||
int timeout; /*!< timeout value */
|
||||
} i2c_hal_timing_config_t;
|
||||
|
||||
#if SOC_I2C_SUPPORTED
|
||||
/**
|
||||
* @brief I2C group clock source
|
||||
|
||||
Reference in New Issue
Block a user