59 #define I2C_MASTER_CMD_SINGLE_SEND 0x00000007 60 #define I2C_MASTER_CMD_SINGLE_RECEIVE 0x00000007 61 #define I2C_MASTER_CMD_BURST_SEND_START 0x00000003 62 #define I2C_MASTER_CMD_BURST_SEND_CONT 0x00000001 63 #define I2C_MASTER_CMD_BURST_SEND_FINISH 0x00000005 64 #define I2C_MASTER_CMD_BURST_SEND_ERROR_STOP 0x00000004 65 #define I2C_MASTER_CMD_BURST_RECEIVE_START 0x0000000b 66 #define I2C_MASTER_CMD_BURST_RECEIVE_CONT 0x00000009 67 #define I2C_MASTER_CMD_BURST_RECEIVE_FINISH 0x00000005 68 #define I2C_MASTER_CMD_BURST_RECEIVE_ERROR_STOP 0x00000004 74 #define I2C_MASTER_ERR_NONE 0 75 #define I2CM_STAT_BUSY 0x00000001 76 #define I2CM_STAT_ERROR 0x00000002 77 #define I2CM_STAT_ADRACK 0x00000004 78 #define I2CM_STAT_DATACK 0x00000008 79 #define I2CM_STAT_ARBLST 0x00000010 80 #define I2CM_STAT_IDLE 0x00000020 81 #define I2CM_STAT_BUSBSY 0x00000040 82 #define I2CM_STAT_INVALID 0x00000080 88 #define I2CM_CR 0x40020020 89 #define I2CM_TPR 0x4002000C 90 #define I2CM_SA 0x40020000 91 #define I2CM_DR 0x40020008 92 #define I2CM_CTRL 0x40020004 93 #define I2CM_STAT I2CM_CTRL 99 #define I2C_SCL_NORMAL_BUS_SPEED 100000 100 #define I2C_SCL_FAST_BUS_SPEED 400000 101 #define I2C_RECEIVE 0x01 102 #define I2C_SEND 0x00 123 void i2c_init(uint8_t port_sda, uint8_t pin_sda, uint8_t port_scl,
124 uint8_t pin_scl, uint32_t bus_speed);
223 uint8_t
i2c_burst_send(uint8_t slave_addr, uint8_t *data, uint8_t len);
uint8_t i2c_master_data_get(void)
Return received data from I2C.
uint8_t i2c_master_busy(void)
Return the busy state of I2C module.
Header file for the cc2538 System Control driver.
void i2c_set_frequency(uint32_t freq)
Initialize I2C peripheral clock with given frequency.
void i2c_master_data_put(uint8_t data)
Prepare data to be transmitted.
uint8_t i2c_burst_send(uint8_t slave_addr, uint8_t *data, uint8_t len)
Perform all operations to send multiple bytes to a slave.
Header file with register and macro declarations for the cc2538 GPIO module.
Header file with declarations for the I/O Control module.
Header file with register manipulation macro definitions.
uint8_t i2c_master_error(void)
Return the status register if error occurred during last communication.
void i2c_init(uint8_t port_sda, uint8_t pin_sda, uint8_t port_scl, uint8_t pin_scl, uint32_t bus_speed)
Initialize the I2C peripheral and pins.
void i2c_master_disable(void)
Disable master I2C module.
void i2c_master_command(uint8_t cmd)
Control the state of the master module for send and receive operations.
uint8_t i2c_burst_receive(uint8_t slave_addr, uint8_t *data, uint8_t len)
Perform all operations to receive multiple bytes from a slave.
void i2c_master_set_slave_address(uint8_t slave_addr, uint8_t access_mode)
Set the address of slave and access mode for the next I2C communication.
uint8_t i2c_single_receive(uint8_t slave_addr, uint8_t *data)
Perform all operations to receive a byte from a slave.
uint8_t i2c_single_send(uint8_t slave_addr, uint8_t data)
Perform all operations to send a byte to a slave.
void i2c_master_enable(void)
Enable master I2C module.