1 #ifndef I2C_API_H_INCLUDED
2 #define I2C_API_H_INCLUDED
18 #define I2C_SAFETY_TIMEOUT 2000000UL
23 #define NULL ((void *)0)
26 typedef enum { I2C_ERROR_NONE,I2C_ERROR_START_FAIL,I2C_ERROR_ADDR_FAIL,I2C_ERROR_READ_FAIL,I2C_ERROR_WRITE_FAIL } i2c_error_t;
40 void init_i2c(I2C_TypeDef* i2c_inst,uint32_t sys_clk);
59 i2c_error_t
i2c_read_with_pointer(I2C_TypeDef* i2c_inst,uint8_t i2c_addr,uint8_t pointer_byte,uint8_t read_length,uint8_t* read_buffer);
76 i2c_error_t
i2c_write_with_pointer(I2C_TypeDef* i2c_inst,uint8_t i2c_addr,uint8_t pointer_byte,uint16_t write_length,uint8_t* write_buffer);