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

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

#include "sensor_common.h"

Go to the source code of this file.

Classes

struct  MblMwSpiParameters
 Parameters required for an SPI operation. More...
 

Enumerations

enum  MblMwSpiFrequency {
  MBL_MW_SPI_FREQUENCY_125KHz = 0, MBL_MW_SPI_FREQUENCY_250KHz, MBL_MW_SPI_FREQUENCY_500KHz, MBL_MW_SPI_FREQUENCY_1MHz,
  MBL_MW_SPI_FREQUENCY_2MHz, MBL_MW_SPI_FREQUENCY_4MHz, MBL_MW_SPI_FREQUENCY_8MHz
}
 Available SPI clock frequencies.
 
enum  MblMwSpiMode { MBL_MW_SPI_MODE_0 = 0, MBL_MW_SPI_MODE_1, MBL_MW_SPI_MODE_2, MBL_MW_SPI_MODE_3 }
 Available SPI modes, see SPI Wiki page for further details. More...
 

Functions

METAWEAR_API MblMwDataSignalmbl_mw_spi_get_data_signal (MblMwMetaWearBoard *board, uint8_t length, uint8_t id)
 Retrieves the data signal representing spi data. More...
 
METAWEAR_API void mbl_mw_spi_write (const MblMwMetaWearBoard *board, const MblMwSpiParameters *parameters)
 Writes data via the spi bus. More...
 

Detailed Description

Communicates with sensors on the SPI bus.

Enumeration Type Documentation

◆ MblMwSpiMode

Available SPI modes, see SPI Wiki page for further details.

Enumerator
MBL_MW_SPI_MODE_0 

clock polarity 0, clock phase 0

MBL_MW_SPI_MODE_1 

clock polarity 0, clock phase 1

MBL_MW_SPI_MODE_2 

clock polarity 1, clock phase 0

MBL_MW_SPI_MODE_3 

clock polarity 1, clock phase 1

Function Documentation

◆ mbl_mw_spi_get_data_signal()

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

Retrieves the data signal representing spi 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 to communicate with
lengthNumber of bytes to read
idNumerical id identifying the data
Returns
Pointer to the spi data signal

◆ mbl_mw_spi_write()

METAWEAR_API void mbl_mw_spi_write ( const MblMwMetaWearBoard board,
const MblMwSpiParameters parameters 
)

Writes data via the spi bus.

Parameters
boardBoard to communicate with
parametersParameters configuring the read