Characteristic Locus
Inheritance object ObservableBase<UNIT> SamplingSensorBase<UNIT> PollingSensorBase<UNIT> > ByteCommsSensorBase<UNIT> > AdafruitMPRLS > Bh1900Nux > Bmp085 > Bmp180 > Ccs811 > DhtBase > Hih6130 > Htux1dBase > Mpl3115a2 > Ms5611 > Sgp40 > Sht31d > Sht4x > Si70xx > Th02 > MaxBotix > Vl53l0x > Ags01Db > Ens160 > Pmsa003i > Scd4xBase > Bh1745 > Bh1750 > Max44009 > Si1145 > Tsl2591 > Veml7700 > Nau7802 > Adxl345 > Adxl362 > Apds9960 > Bno055 > Hmc5883 > Mag3110 > Mma7660fc > Mmc5603 > Mpu6050 > Ina260 > Lm75 > Mcp960x > Mcp9808 > Tmp102
Implements IObservable<IChangeResult<UNIT>> ISamplingSensor<UNIT> ISensor<UNIT> IDisposable
Inherited Members PollingSensorBase<UNIT>.StartUpdating(TimeSpan?) PollingSensorBase<UNIT>.StopUpdating() SamplingSensorBase<UNIT>.samplingLock SamplingSensorBase<UNIT>.Updated SamplingSensorBase<UNIT>.SamplingTokenSource SamplingSensorBase<UNIT>.Conditions SamplingSensorBase<UNIT>.IsSampling SamplingSensorBase<UNIT>.UpdateInterval SamplingSensorBase<UNIT>.ReadSensor() SamplingSensorBase<UNIT>.RaiseEventsAndNotify(IChangeResult<UNIT>) SamplingSensorBase<UNIT>.Read() ObservableBase<UNIT>.observers ObservableBase<UNIT>.NotifyObservers(IChangeResult<UNIT>) ObservableBase<UNIT>.Subscribe(IObserver<IChangeResult<UNIT>>) ObservableBase<UNIT>.CreateObserver(Action<IChangeResult<UNIT>>, Predicate<IChangeResult<UNIT>>) object.Equals(object) object.Equals(object, object) object.GetHashCode() object.GetType() object.MemberwiseClone() object.ReferenceEquals(object, object) object.ToString()
Namespace Meadow.Foundation
Assembly Meadow.Foundation.dll

Syntax

public abstract class ByteCommsSensorBase<UNIT> : PollingSensorBase<UNIT>, IObservable<IChangeResult<UNIT>>, ISamplingSensor<UNIT>, ISensor<UNIT>, IDisposable where UNIT : struct

Type Parameters

Name Description
UNIT

The unit type

Constructors

ByteCommsSensorBase(II2cBus, byte, int, int)

Creates a new ByteCommsSensorBase object

Declaration
protected ByteCommsSensorBase(II2cBus i2cBus, byte address, int readBufferSize = 8, int writeBufferSize = 8)

Parameters

Type Name Description
II2cBus i2cBus

The I2C bus

byte address

The I2C address

int readBufferSize

Read buffer size in bytes

int writeBufferSize

ByteCommsSensorBase(ISpiBus, IDigitalOutputPort?, Frequency, Mode, int, int, ChipSelectMode)

ByteCommsSensorBase abstract ctor for SPI

Declaration
protected ByteCommsSensorBase(ISpiBus spiBus, IDigitalOutputPort? chipSelect, Frequency busSpeed, SpiClockConfiguration.Mode busMode = Mode.Mode0, int readBufferSize = 8, int writeBufferSize = 8, ChipSelectMode chipSelectMode = ChipSelectMode.ActiveLow)

Parameters

Type Name Description
ISpiBus spiBus

SPI bus object

IDigitalOutputPort chipSelect

Chip select port

Frequency busSpeed

The SPI bus speed

SpiClockConfiguration.Mode busMode

The SPI bus mode (0-3)

int readBufferSize

Read buffer size

int writeBufferSize

Write buffer size

ChipSelectMode chipSelectMode

Chip select mode

ByteCommsSensorBase(int, int)

ByteCommsSensorBase abstract ctor with no bus

Declaration
protected ByteCommsSensorBase(int readBufferSize = 8, int writeBufferSize = 8)

Parameters

Type Name Description
int readBufferSize

Read buffer size

int writeBufferSize

Write buffer size

Properties

BusComms

Bus communications object, i.e. an I2cCommunications or SpiCommunications

Declaration
protected IByteCommunications? BusComms { get; set; }

Property Value

Type Description
IByteCommunications

ReadBuffer

The read buffer

Declaration
protected Memory<byte> ReadBuffer { get; }

Property Value

Type Description
Memory<byte>

WriteBuffer

The write buffer

Declaration
protected Memory<byte> WriteBuffer { get; }

Property Value

Type Description
Memory<byte>

Methods

Dispose()

Dispose managed resources

Declaration
public virtual void Dispose()

Dispose(bool)

Dispose object

Declaration
protected virtual void Dispose(bool disposing)

Parameters

Type Name Description
bool disposing

is disposing

Init(int, int)

Simple constructor for peripherals that don't use a bus and don't need an IByteCommunications

Declaration
protected virtual void Init(int readBufferSize = 8, int writeBufferSize = 8)

Parameters

Type Name Description
int readBufferSize
int writeBufferSize