Characteristic Locus
Inheritance object > WiiExtensionControllerBase > WiiClassicControllerBase > WiiNunchuck
Implements II2cPeripheral
Inherited Members object.Equals(object) object.Equals(object, object) object.GetHashCode() object.GetType() object.MemberwiseClone() object.ReferenceEquals(object, object) object.ToString()
Namespace Meadow.Foundation.Sensors.Hid
Assembly WiiExtensionControllers.dll

Syntax

public abstract class WiiExtensionControllerBase : II2cPeripheral

Constructors

WiiExtensionControllerBase(II2cBus, byte)

Base constructor

Declaration
public WiiExtensionControllerBase(II2cBus i2cBus, byte address)

Parameters

Type Name Description
II2cBus i2cBus

the I2C bus connected to the extension controller

byte address

The extension controller address

Fields

i2cComms

I2C Communication bus used to communicate with the peripheral

Declaration
protected readonly II2cCommunications i2cComms

Field Value

Type Description
II2cCommunications

samplingLock

Lock for sampling

Declaration
protected object samplingLock

Field Value

Type Description
object

Properties

DefaultI2cAddress

The default I2C address for the peripheral

Declaration
public byte DefaultI2cAddress { get; }

Property Value

Type Description
byte

DefaultI2cSpeed

Default I2C bus speed (400kHz)

Declaration
public static I2cBusSpeed DefaultI2cSpeed { get; }

Property Value

Type Description
I2cBusSpeed

IsSampling

Are we actively reading data from the extension controller

Declaration
public bool IsSampling { get; protected set; }

Property Value

Type Description
bool

SamplingTokenSource

Sampling cancellation token source

Declaration
protected CancellationTokenSource SamplingTokenSource { get; set; }

Property Value

Type Description
CancellationTokenSource

readBuffer

Data buffer returned by the controller

Declaration
protected Span<byte> readBuffer { get; }

Property Value

Type Description
Span<byte>

Methods

GetIdentification()

Gets the device ID

Declaration
public byte[] GetIdentification()

Returns

Type Description
byte[]

The ID as a byte

Initialize()

Initialize the extension controller

Declaration
protected virtual void Initialize()

StartUpdating(TimeSpan?)

Starts continuously sampling the sensor

Declaration
public void StartUpdating(TimeSpan? updateInterval)

Parameters

Type Name Description
TimeSpan? updateInterval

interval between samples

StopUpdating()

Stops sampling the extension controller

Declaration
public void StopUpdating()

Update()

Get the latest sensor data from the device

Declaration
public virtual void Update()