31 lines
798 B
C
31 lines
798 B
C
#ifndef DRV_I2C_H_
|
|
#define DRV_I2C_H_
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
#include "kit_macro.h"
|
|
|
|
typedef enum
|
|
{
|
|
kI2cDev_1 = 0,
|
|
kI2cDev_2,
|
|
kI2cDev_3,
|
|
kI2cDev_4,
|
|
kI2cDev_End,
|
|
}I2cDev;
|
|
|
|
|
|
|
|
KitResult drv_i2c_init(I2cDev dev, uint32_t freq, uint8_t scl_idx, uint8_t sda_idx);
|
|
KitResult drv_i2c_sync_write(I2cDev dev, uint8_t dev_addr, uint8_t reg_addr, uint8_t * buf, uint16_t len);
|
|
KitResult drv_i2c_sync_read(I2cDev dev, uint8_t dev_addr, uint8_t reg_addr, uint8_t *buf, uint16_t len);
|
|
KitResult drv_i2c_sync_write_then_read(I2cDev dev, uint8_t dev_addr, uint8_t *tx_buf, uint16_t tx_len, uint8_t *rx_buf, uint16_t rx_len);
|
|
KitResult drv_i2c_sync_direct_read(I2cDev dev, uint8_t dev_addr, uint8_t reg_addr, uint8_t *buf, uint16_t len);
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif
|