MetaWear C++ API  0.20.0
C++ implementation of the MetaWear protocol
spi.h
Go to the documentation of this file.
1 
6 #pragma once
7 
8 #include "sensor_common.h"
9 
10 #ifdef __cplusplus
11 extern "C" {
12 #endif
13 
17 typedef enum {
18  MBL_MW_SPI_FREQUENCY_125KHz = 0,
19  MBL_MW_SPI_FREQUENCY_250KHz,
20  MBL_MW_SPI_FREQUENCY_500KHz,
21  MBL_MW_SPI_FREQUENCY_1MHz,
22  MBL_MW_SPI_FREQUENCY_2MHz,
23  MBL_MW_SPI_FREQUENCY_4MHz,
24  MBL_MW_SPI_FREQUENCY_8MHz
26 
31 typedef enum {
37 
41 typedef struct {
44  uint8_t *data;
45  uint8_t data_length;
46  uint8_t slave_select_pin;
47  uint8_t clock_pin;
48  uint8_t mosi_pin;
49  uint8_t miso_pin;
50  uint8_t lsb_first;
51  uint8_t use_nrf_pins;
53 
69 
70 #ifdef __cplusplus
71 }
72 #endif
struct MblMwDataSignal MblMwDataSignal
A event fired from the MetaWear board that also contains data.
Definition: datasignal_fwd.h:15
#define METAWEAR_API
Indicates the function should be exported to the symbol table
Definition: dllmarker.h:27
struct MblMwMetaWearBoard MblMwMetaWearBoard
Software representation of a physical MetaWear board.
Definition: metawearboard_fwd.h:17
MblMwSpiMode
Available SPI modes, see SPI Wiki page for further details.
Definition: spi.h:31
@ MBL_MW_SPI_MODE_2
clock polarity 1, clock phase 0
Definition: spi.h:34
@ MBL_MW_SPI_MODE_1
clock polarity 0, clock phase 1
Definition: spi.h:33
@ MBL_MW_SPI_MODE_3
clock polarity 1, clock phase 1
Definition: spi.h:35
@ MBL_MW_SPI_MODE_0
clock polarity 0, clock phase 0
Definition: spi.h:32
METAWEAR_API MblMwDataSignal * mbl_mw_spi_get_data_signal(MblMwMetaWearBoard *board, uint8_t length, uint8_t id)
Retrieves the data signal representing spi data.
METAWEAR_API void mbl_mw_spi_write(const MblMwMetaWearBoard *board, const MblMwSpiParameters *parameters)
Writes data via the spi bus.
MblMwSpiFrequency
Available SPI clock frequencies.
Definition: spi.h:17
Parameters required for an SPI operation.
Definition: spi.h:41
uint8_t slave_select_pin
pin for slave select
Definition: spi.h:46
uint8_t use_nrf_pins
Set to 0 to use MetaWear GPIO pin mapping, non-zero to use nRF pin mapping.
Definition: spi.h:51
MblMwSpiFrequency frequency
spi frequency
Definition: spi.h:43
uint8_t mosi_pin
pin for master out, slave in data
Definition: spi.h:48
uint8_t * data
Data to write through the bus, if set with a read, will write the data before performing the read.
Definition: spi.h:44
uint8_t clock_pin
pin for spi clock
Definition: spi.h:47
uint8_t lsb_first
Set to 0 if MSB should be sent first, non-zero to send LSB first.
Definition: spi.h:50
uint8_t miso_pin
pin for master in, slave out data
Definition: spi.h:49
uint8_t data_length
Length of the data array.
Definition: spi.h:45
MblMwSpiMode mode
spi mode
Definition: spi.h:42