39 #define I2C_NON_BLOCKING 1
53 uint8_t i2c_busy(
void);
56 uint8_t i2c_transferred(
void);
68 void i2c_receiveinit( uint8_t slave_address, uint8_t byte_ctr, uint8_t *rx_buf);
78 void i2c_transmitinit(uint8_t slave_address, uint8_t byte_ctr, uint8_t *tx_buf);
81 #ifndef I2C_NON_BLOCKING
82 #define I2C_NON_BLOCKING 1
86 uint8_t i2c_receive(
void);
87 void i2c_transmit(
void);
91 #define I2C_SDA 13 //SDA == P5.1 // GPIO 13
92 #define I2C_SCL 12 //SCL == P5.2 // GPIO 12
96 #define I2C_BASE (0x80006000)
98 #define I2CADR ((volatile uint8_t *) ( I2C_BASE + 0x00 ))
99 #define I2CFDR ((volatile uint8_t *) ( I2C_BASE + 0x04 ))
100 #define I2CCR ((volatile uint8_t *) ( I2C_BASE + 0x08 ))
101 #define I2CSR ((volatile uint8_t *) ( I2C_BASE + 0x0C ))
102 #define I2CDR ((volatile uint8_t *) ( I2C_BASE + 0x10 ))
103 #define I2CDFSRR ((volatile uint8_t *) ( I2C_BASE + 0x14 ))
104 #define I2CCKER ((volatile uint8_t *) ( I2C_BASE + 0x18 ))
110 #define I2C_MIEN 0x40
111 #define I2C_MSTA 0x20
113 #define I2C_TXAK 0x08
114 #define I2C_RSTA 0x04
115 #define I2C_BCST 0x01
119 #define I2C_MAAS 0x40
122 #define I2C_BCSTM 0x08
125 #define I2C_RXAK 0x01
128 #define I2C_DFSR 0x3f // default = 0x10
131 #define I2C_CKEN 0x01
void i2c_enable(void)
Configure serial controller in I2C mode and set I2C speed.
void i2c_disable(void)
Configure serial controller in disabled mode.