Contiki-NG
|
Files | |
file | board-i2c.c |
Board-specific I2C driver for the Sensortags. | |
file | board-i2c.h |
Header file for the Sensortag I2C Driver. | |
Macros | |
#define | board_i2c_deselect() board_i2c_select(BOARD_I2C_INTERFACE_0, 0) |
Put the I2C controller in a known state. | |
Functions | |
void | board_i2c_wakeup (void) |
Enables the I2C peripheral with defaults. | |
void | board_i2c_shutdown (void) |
Stops the I2C peripheral and restores pins to s/w control. | |
bool | board_i2c_write (uint8_t *buf, uint8_t len) |
Burst write to an I2C device. | |
bool | board_i2c_write_single (uint8_t data) |
Single write to an I2C device. | |
bool | board_i2c_read (uint8_t *buf, uint8_t len) |
Burst read from an I2C device. | |
bool | board_i2c_write_read (uint8_t *wdata, uint8_t wlen, uint8_t *rdata, uint8_t rlen) |
Write and read in one operation. | |
void | board_i2c_select (uint8_t interface, uint8_t slave_addr) |
Select an I2C slave. | |
#define board_i2c_deselect | ( | ) | board_i2c_select(BOARD_I2C_INTERFACE_0, 0) |
Put the I2C controller in a known state.
In this state, pins SDA and SCL will be under i2c control and pins SDA HP and SCL HP will be configured as gpio inputs. This is equal to selecting BOARD_I2C_INTERFACE_0, but without selecting a slave device address
Definition at line 58 of file board-i2c.h.
bool board_i2c_read | ( | uint8_t * | buf, |
uint8_t | len ) |
Burst read from an I2C device.
buf | Pointer to a buffer where the read data will be stored |
len | Number of bytes to read |
Definition at line 207 of file board-i2c.c.
Referenced by read_data().
void board_i2c_select | ( | uint8_t | interface, |
uint8_t | slave_addr ) |
Select an I2C slave.
interface | The I2C interface to be used (BOARD_I2C_INTERFACE_0 or _1) |
slave_addr | The slave's address |
The various sensors on the sensortag are connected either on interface 0 or
Definition at line 310 of file board-i2c.c.
References board_i2c_wakeup(), BOARD_IOID_SCL, BOARD_IOID_SCL_HP, and BOARD_IOID_SDA_HP.
Referenced by select_on_bus().
void board_i2c_shutdown | ( | void | ) |
Stops the I2C peripheral and restores pins to s/w control.
This function is called automatically by the board's LPM logic, but it can also be called explicitly.
Definition at line 114 of file board-i2c.c.
References BOARD_IOID_SCL, BOARD_IOID_SCL_HP, and BOARD_IOID_SDA_HP.
void board_i2c_wakeup | ( | void | ) |
Enables the I2C peripheral with defaults.
This function is called to wakeup and initialise the I2C.
This function can be called explicitly, but it will also be called automatically by board_i2c_select() when required. One of those two functions MUST be called before any other I2C operation after a chip sleep / wakeup cycle or after a call to board_i2c_shutdown(). Failing to do so will lead to a bus fault.
Definition at line 83 of file board-i2c.c.
Referenced by board_i2c_select(), and board_init().
bool board_i2c_write | ( | uint8_t * | buf, |
uint8_t | len ) |
Burst write to an I2C device.
buf | Pointer to the buffer to be written |
len | Number of bytes to write |
Definition at line 145 of file board-i2c.c.
Referenced by sensor_common_write_reg().
bool board_i2c_write_read | ( | uint8_t * | wdata, |
uint8_t | wlen, | ||
uint8_t * | rdata, | ||
uint8_t | rlen ) |
Write and read in one operation.
wdata | Pointer to the buffer to be written |
wlen | Number of bytes to write |
rdata | Pointer to a buffer where the read data will be stored |
rlen | Number of bytes to read |
Definition at line 247 of file board-i2c.c.
Referenced by sensor_common_read_reg().
bool board_i2c_write_single | ( | uint8_t | data | ) |
Single write to an I2C device.
data | The byte to write |
Definition at line 188 of file board-i2c.c.
Referenced by start().