MetaWear C++ API  0.18.0
C++ implementation of the MetaWear protocol
Classes | Functions
i2c.h File Reference

Communicates with sensors on the I2C bus. More...

#include "sensor_common.h"

Go to the source code of this file.

Classes

struct  MblMwI2cReadParameters
 Parameters required for an i2c read. More...
 

Functions

METAWEAR_API MblMwDataSignalmbl_mw_i2c_get_data_signal (MblMwMetaWearBoard *board, uint8_t length, uint8_t id)
 Retrieves the data signal representing i2c data. More...
 
METAWEAR_API void mbl_mw_i2c_write (const MblMwMetaWearBoard *board, uint8_t device_addr, uint8_t register_addr, const uint8_t *value, uint8_t length)
 Writes data via the i2c bus. More...
 

Detailed Description

Communicates with sensors on the I2C bus.

Function Documentation

◆ mbl_mw_i2c_get_data_signal()

METAWEAR_API MblMwDataSignal* mbl_mw_i2c_get_data_signal ( MblMwMetaWearBoard board,
uint8_t  length,
uint8_t  id 
)

Retrieves the data signal representing i2c data.

The data signal is identified by the id value and if the id is not present, a new data signal will be created using the length parameter.

Parameters
boardBoard the i2c bus resides on
lengthNumber of bytes to read
idNumerical value identifying the data
Returns
Pointer to the i2c data signal

◆ mbl_mw_i2c_write()

METAWEAR_API void mbl_mw_i2c_write ( const MblMwMetaWearBoard board,
uint8_t  device_addr,
uint8_t  register_addr,
const uint8_t *  value,
uint8_t  length 
)

Writes data via the i2c bus.

Parameters
boardBoard the i2c bus resides on
device_addrDevice to write to
register_addrAddress of the register to write
valuePayload, as a byte array
lengthNumber of bytes