public interface SerialPassthrough extends MetaWearBoard.Module
Modifier and Type | Interface and Description |
---|---|
static interface |
SerialPassthrough.I2C
Data received from the I2C bus
|
static interface |
SerialPassthrough.SPI
Data received from the SPI bus
|
static class |
SerialPassthrough.SpiFrequency
Supported SPI frequencies
|
static interface |
SerialPassthrough.SpiParameterBuilder<T>
Builder to construct common parameters for an SPI read/write operation.
|
Modifier and Type | Method and Description |
---|---|
SerialPassthrough.I2C |
i2c(byte length,
byte id)
Get an object representing the I2C data corresponding to the id.
|
bolts.Task<byte[]> |
readI2cAsync(byte deviceAddr,
byte registerAddr,
byte length)
Read data from a sensor via the I2C bus.
|
SerialPassthrough.SpiParameterBuilder<bolts.Task<byte[]>> |
readSpiAsync(byte length)
Read data from a sensor via the SPI bus.
|
SerialPassthrough.SPI |
spi(byte length,
byte id)
Get an object representing the SPI data corresponding to the id.
|
void |
writeI2c(byte deviceAddr,
byte registerAddr,
byte[] data)
Write data to a sensor via the I2C bus.
|
SerialPassthrough.SpiParameterBuilder<java.lang.Void> |
writeSpi()
Write data to a sensor via the SPI bus.
|
SerialPassthrough.I2C i2c(byte length, byte id)
length
parameter otherwise
the existing object will be returnedlength
- Expected length of the dataid
- Value between [0, 254]void writeI2c(byte deviceAddr, byte registerAddr, byte[] data)
deviceAddr
- Device to write toregisterAddr
- Device's register to write todata
- DataToken to write, up to 10 bytesbolts.Task<byte[]> readI2cAsync(byte deviceAddr, byte registerAddr, byte length)
SerialPassthrough.I2C.read(byte, byte)
, this function provides
a direct way to access I2C data as opposed to creating a data route.deviceAddr
- Address of the slave deviceregisterAddr
- Register on the slave device to accesslength
- How many bytes to readSerialPassthrough.SPI spi(byte length, byte id)
length
parameter otherwise
the existing object will be returnedlength
- Expected length of the dataid
- Value between [0, 14]SerialPassthrough.SpiParameterBuilder<java.lang.Void> writeSpi()
SerialPassthrough.SpiParameterBuilder.data(byte[])
methodSerialPassthrough.SpiParameterBuilder<bolts.Task<byte[]>> readSpiAsync(byte length)
SerialPassthrough.SPI.read()
, this function provides a direct
way to access SPI data as opposed to creating a data route. If the SPI bus is not accessible with
the current firmware, the operation will fail with an UnsupportedOperationException
.length
- How many bytes to read