Characteristic Locus
Inheritance System.Object ObservableBase<UNIT> SamplingSensorBase<UNIT> PollingSensorBase<UNIT> > ByteCommsSensorBase<UNIT>
Implements ISamplingSensor<UNIT> IDisposable
Inherited Members PollingSensorBase<UNIT>.StartUpdating(Nullable<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>>, Nullable<Predicate<IChangeResult<UNIT>>>)
Namespace Meadow.Foundation
Assembly Meadow.Foundation.dll

Syntax

public abstract class ByteCommsSensorBase<UNIT> : PollingSensorBase<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