ruuvi.drivers.c  ${PROJECT_VERSION}
Drivers for external sensors and peripherals on embedded systems.
ruuvi_interface_i2c_shtcx.c File Reference
#include "ruuvi_driver_enabled_modules.h"
#include "ruuvi_driver_error.h"
#include "ruuvi_interface_i2c.h"
#include "ruuvi_interface_yield.h"
#include "sensirion_arch_config.h"
#include "sensirion_common.h"
#include "sensirion_i2c.h"
#include "shtc1.h"
#include <string.h>

Go to the source code of this file.

Functions

int16_t sensirion_i2c_select_bus (uint8_t bus_idx)
 
void sensirion_i2c_init (void)
 
void sensirion_i2c_release (void)
 
int8_t sensirion_i2c_read (uint8_t address, uint8_t *data, uint16_t count)
 
int8_t sensirion_i2c_write (uint8_t address, const uint8_t *data, uint16_t count)
 

Function Documentation

◆ sensirion_i2c_init()

void sensirion_i2c_init ( void  )

Driver file does not know about the board configuration, use ri_i2c_init instead.

Definition at line 72 of file ruuvi_interface_i2c_shtcx.c.

◆ sensirion_i2c_read()

int8_t sensirion_i2c_read ( uint8_t  address,
uint8_t *  data,
uint16_t  count 
)

Execute one read transaction on the I2C bus, reading a given number of bytes. If the device does not acknowledge the read command, an error shall be returned.

Parameters
address7-bit I2C address to read from
datapointer to the buffer where the data is to be stored
countnumber of bytes to read from I2C and store in the buffer
Returns
0 on success, error code otherwise

Definition at line 96 of file ruuvi_interface_i2c_shtcx.c.

◆ sensirion_i2c_release()

void sensirion_i2c_release ( void  )

Release all resources initialized by sensirion_i2c_init().

Definition at line 80 of file ruuvi_interface_i2c_shtcx.c.

◆ sensirion_i2c_select_bus()

int16_t sensirion_i2c_select_bus ( uint8_t  bus_idx)

Select the current i2c bus by index. All following i2c operations will be directed at that bus.

THE IMPLEMENTATION IS OPTIONAL ON SINGLE-BUS SETUPS (all sensors on the same bus)

Parameters
bus_idxBus index to select
Returns
0 on success, an error code otherwise

Definition at line 62 of file ruuvi_interface_i2c_shtcx.c.

◆ sensirion_i2c_write()

int8_t sensirion_i2c_write ( uint8_t  address,
const uint8_t *  data,
uint16_t  count 
)

Execute one write transaction on the I2C bus, sending a given number of bytes. The bytes in the supplied buffer must be sent to the given address. If the slave device does not acknowledge any of the bytes, an error shall be returned.

Parameters
address7-bit I2C address to write to
datapointer to the buffer containing the data to write
countnumber of bytes to read from the buffer and send over I2C
Returns
0 on success, error code otherwise

Definition at line 114 of file ruuvi_interface_i2c_shtcx.c.