Contiki-NG
Files | Functions

Files

file  sensor-common.c
 Utilities common among SensorTag sensors.
 
file  sensor-common.h
 Header file for the Sensortag Common sensor utilities.
 

Functions

bool sensor_common_read_reg (uint8_t addr, uint8_t *buf, uint8_t len)
 Reads a sensor's register over I2C. More...
 
bool sensor_common_write_reg (uint8_t addr, uint8_t *buf, uint8_t len)
 Write to a sensor's register over I2C. More...
 
void sensor_common_set_error_data (uint8_t *buf, uint8_t len)
 Fill a result buffer with dummy error data. More...
 

Detailed Description

Function Documentation

◆ sensor_common_read_reg()

bool sensor_common_read_reg ( uint8_t  addr,
uint8_t *  buf,
uint8_t  len 
)

Reads a sensor's register over I2C.

Parameters
addrThe address of the register to read
bufPointer to buffer to place data
lenNumber of bytes to read
Returns
TRUE if the required number of bytes are received

The sensor must be selected before this routine is called.

Definition at line 48 of file sensor-common.c.

◆ sensor_common_set_error_data()

void sensor_common_set_error_data ( uint8_t *  buf,
uint8_t  len 
)

Fill a result buffer with dummy error data.

Parameters
bufPointer to the buffer where to write the data
lenNumber of bytes to fill
Returns
bitmask of error flags

Definition at line 71 of file sensor-common.c.

◆ sensor_common_write_reg()

bool sensor_common_write_reg ( uint8_t  addr,
uint8_t *  buf,
uint8_t  len 
)

Write to a sensor's register over I2C.

Parameters
addrThe address of the register to read
bufPointer to buffer containing data to be written
lenNumber of bytes to write
Returns
TRUE if successful write

The sensor must be selected before this routine is called.

Definition at line 54 of file sensor-common.c.