Characteristic Locus
Inheritance System.Object ObservableBase<UNIT> SensorBase<UNIT> SamplingSensorBase<UNIT> > ByteCommsSensorBase<UNIT> > Bmi270 > AdafruitMPRLS > Bh1900Nux > Bmp085 > Bmp180 > Ccs811 > DhtBase > Hih6130 > Htux1dBase > Mpl3115a2 > Ms5611 > Sgp40 > Sht31d > Sht4x > Si70xx > Th02 > MaxBotix > Vl53l0x > Ags01Db > Scd4x > Bh1745 > Bh1750 > Max44009 > Si1145 > Tsl2591 > Veml7700 > Nau7802 > Adxl345 > Adxl362 > Apds9960 > Bno055 > Hmc5883 > Mag3110 > Mma7660fc > Mpu6050 > Ina260 > Lm75 > Mcp9808 > Tmp102
Implements ISamplingSensor<UNIT> IDisposable
Inherited Members SamplingSensorBase<UNIT>.StartUpdating(Nullable<TimeSpan>) SamplingSensorBase<UNIT>.StopUpdating() SensorBase<UNIT>.Updated SensorBase<UNIT>.samplingLock SensorBase<UNIT>.SamplingTokenSource SensorBase<UNIT>.Conditions SensorBase<UNIT>.IsSampling SensorBase<UNIT>.UpdateInterval SensorBase<UNIT>.ReadSensor() SensorBase<UNIT>.RaiseEventsAndNotify(IChangeResult<UNIT>) SensorBase<UNIT>.Read() ObservableBase<UNIT>.observers ObservableBase<UNIT>.NotifyObservers(IChangeResult<UNIT>) ObservableBase<UNIT>.Subscribe(IObserver<IChangeResult<UNIT>>) ObservableBase<UNIT>.CreateObserver(Action<IChangeResult<UNIT>>, Nullable<Predicate<IChangeResult<UNIT>>>)
Namespace Meadow.Foundation
Assembly Meadow.Foundation.dll

Syntax

public abstract class ByteCommsSensorBase<UNIT> : SamplingSensorBase<UNIT>, ISamplingSensor<UNIT>, IDisposable where UNIT : struct

Type Parameters

Name Description
UNIT

The unit type

Constructors

ByteCommsSensorBase(II2cBus, Byte, Int32, Int32)

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

System.Byte address

The I2C address

System.Int32 readBufferSize

Read buffer size in bytes

System.Int32 writeBufferSize

ByteCommsSensorBase(ISpiBus, Nullable<IDigitalOutputPort>, Int32, Int32, ChipSelectMode)

ByteCommsSensorBase abstract ctor for SPI

Declaration
protected ByteCommsSensorBase(ISpiBus spiBus, IDigitalOutputPort? chipSelect, int readBufferSize = 8, int writeBufferSize = 8, ChipSelectMode chipSelectMode = null)

Parameters

Type Name Description
ISpiBus spiBus

SPI bus object

System.Nullable<IDigitalOutputPort> chipSelect

Chip select port

System.Int32 readBufferSize

Read buffer size

System.Int32 writeBufferSize

Write buffer size

ChipSelectMode chipSelectMode

Chip select mode

ByteCommsSensorBase(Int32, Int32)

ByteCommsSensorBase abstract ctor with no bus

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

Parameters

Type Name Description
System.Int32 readBufferSize

Read buffer size

System.Int32 writeBufferSize

Write buffer size

Properties

Peripheral

Peripheral object, i.e. an I2CPeripheral or SpiPeripheral

Declaration
protected IByteCommunications? Peripheral { get; set; }

Property Value

Type Description
System.Nullable<IByteCommunications>

ReadBuffer

The read buffer

Declaration
protected Memory<byte> ReadBuffer { get; }

Property Value

Type Description
Memory<System.Byte>

WriteBuffer

The write buffer

Declaration
protected Memory<byte> WriteBuffer { get; }

Property Value

Type Description
Memory<System.Byte>

Methods

Dispose()

Dispose managed resources

Declaration
public virtual void Dispose()

Dispose(Boolean)

Dispose object

Declaration
protected virtual void Dispose(bool disposing)

Parameters

Type Name Description
System.Boolean disposing

is disposing

Init(Int32, Int32)

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
System.Int32 readBufferSize
System.Int32 writeBufferSize