MetaWear C# SDK  1.2.0
C# API for MbientLab's sensor platform
Public Member Functions | List of all members
MbientLab.MetaWear.Peripheral.ISerialPassthrough Interface Reference

Bridge for serial communication to connected sensors More...

Inheritance diagram for MbientLab.MetaWear.Peripheral.ISerialPassthrough:
MbientLab.MetaWear.IModule

Public Member Functions

II2CDataProducer I2C (byte id, byte length)
 Get an object representing the I2C data corresponding to the id. If the id value cannot be matched with an existing object, the API will create a new object using the More...
 
void WriteI2C (byte deviceAddr, byte registerAddr, byte[] data)
 Write data to a connected device via the I2C bus. More...
 
Task< byte[]> ReadI2CAsync (byte deviceAddr, byte registerAddr, byte length)
 Read data from a sensor via the I2C bus. Unlike II2CDataProducer.Read(byte, byte), this function provides a direct way to access I2C data as opposed to creating a data route. More...
 
ISPIDataProducer SPI (byte id, byte length)
 Get an object representing the SPI data corresponding to the id. If the id value cannot be matched with an existing object, the API will create a new object using the More...
 
void WriteSPI (byte slaveSelectPin, byte clockPin, byte mosiPin, byte misoPin, byte mode, SpiFrequency frequency, byte[] data, bool lsbFirst=true, bool useNativePins=true)
 Write data to a connected device via the SPI bus More...
 
Task< byte[]> ReadSPIAsync (byte length, byte slaveSelectPin, byte clockPin, byte mosiPin, byte misoPin, byte mode, SpiFrequency frequency, byte[] data=null, bool lsbFirst=true, bool useNativePins=true)
 Read data from a sensor via the SPI bus. Unlike ISPIDataProducer.Read(byte, byte, byte, byte, byte, SpiFrequency, bool, bool, byte[]), this function provides a direct way to access SPI data as opposed to creating a data route. More...
 

Detailed Description

Bridge for serial communication to connected sensors

Member Function Documentation

◆ I2C()

II2CDataProducer MbientLab.MetaWear.Peripheral.ISerialPassthrough.I2C ( byte  id,
byte  length 
)

Get an object representing the I2C data corresponding to the id. If the id value cannot be matched with an existing object, the API will create a new object using the

length parameter otherwise the existing object will be returned

Parameters
idValue representing the i2c data, between [0, 254]
lengthExpected length of the data
Returns
Object representing I2C data

◆ ReadI2CAsync()

Task<byte[]> MbientLab.MetaWear.Peripheral.ISerialPassthrough.ReadI2CAsync ( byte  deviceAddr,
byte  registerAddr,
byte  length 
)

Read data from a sensor via the I2C bus. Unlike II2CDataProducer.Read(byte, byte), this function provides a direct way to access I2C data as opposed to creating a data route.

Parameters
deviceAddrAddress of the slave device
registerAddrRegister on the slave device to access
lengthHow many bytes to read
Returns
Data read via the I2C bus

◆ ReadSPIAsync()

Task<byte[]> MbientLab.MetaWear.Peripheral.ISerialPassthrough.ReadSPIAsync ( byte  length,
byte  slaveSelectPin,
byte  clockPin,
byte  mosiPin,
byte  misoPin,
byte  mode,
SpiFrequency  frequency,
byte []  data = null,
bool  lsbFirst = true,
bool  useNativePins = true 
)

Read data from a sensor via the SPI bus. Unlike ISPIDataProducer.Read(byte, byte, byte, byte, byte, SpiFrequency, bool, bool, byte[]), this function provides a direct way to access SPI data as opposed to creating a data route.

Parameters
lengthNumber of bytes to read
slaveSelectPinPin for slave select
clockPinPin for serial clock
mosiPinPin for master output, slave input
misoPinPin for master input, slave output
modeSPI operating mode, see SPI Wiki Page
frequencySPI operating frequency
dataData to write to the device before the read, defaults to null
lsbFirstTrue to have LSB sent first, defaults to true
useNativePinsTrue to use the nRF pin mappings rather than the GPIO pin mappings, defaults to true
Returns
Data received from the read command

◆ SPI()

ISPIDataProducer MbientLab.MetaWear.Peripheral.ISerialPassthrough.SPI ( byte  id,
byte  length 
)

Get an object representing the SPI data corresponding to the id. If the id value cannot be matched with an existing object, the API will create a new object using the

length parameter otherwise the existing object will be returned

Parameters
idValue representing the i2c data, between [0, 14]
lengthExpected length of the data
Returns
Object representing SPI data

◆ WriteI2C()

void MbientLab.MetaWear.Peripheral.ISerialPassthrough.WriteI2C ( byte  deviceAddr,
byte  registerAddr,
byte []  data 
)

Write data to a connected device via the I2C bus.

Parameters
deviceAddrDevice to write to
registerAddrDevice's register to write to
dataData to write, up to 10 bytes

◆ WriteSPI()

void MbientLab.MetaWear.Peripheral.ISerialPassthrough.WriteSPI ( byte  slaveSelectPin,
byte  clockPin,
byte  mosiPin,
byte  misoPin,
byte  mode,
SpiFrequency  frequency,
byte []  data,
bool  lsbFirst = true,
bool  useNativePins = true 
)

Write data to a connected device via the SPI bus

Parameters
slaveSelectPinPin for slave select
clockPinPin for serial clock
mosiPinPin for master output, slave input
misoPinPin for master input, slave output
modeSPI operating mode, see SPI Wiki Page
frequencySPI operating frequency
dataData to write to the device
lsbFirstTrue to have LSB sent first, defaults to true
useNativePinsTrue to use the nRF pin mappings rather than the GPIO pin mappings, defaults to true

The documentation for this interface was generated from the following file: