Characteristic | Locus |
---|---|
Inheritance | System.Object > WiiExtensionControllerBase > WiiClassicControllerBase > WiiNunchuck |
Namespace | Meadow.Foundation.Sensors.Hid |
Assembly | WiiExtensionControllers.dll |
Syntax
public abstract class WiiExtensionControllerBase : object
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 |
System.Byte | address | The extension controller address |
Fields
i2cPeripheral
The I2C peripheral object for the extension
Declaration
protected readonly II2cPeripheral i2cPeripheral
Field Value
Type | Description |
---|---|
II2cPeripheral |
samplingLock
Lock for sampling
Declaration
protected object samplingLock
Field Value
Type | Description |
---|---|
System.Object |
Properties
DefaultSpeed
Default I2C bus speed (400kHz)
Declaration
public static I2cBusSpeed DefaultSpeed { 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 |
---|---|
System.Boolean |
readBuffer
Data buffer returned by the controller
Declaration
protected Span<byte> readBuffer { get; }
Property Value
Type | Description |
---|---|
Span<System.Byte> |
SamplingTokenSource
Sampling cancellation token source
Declaration
protected CancellationTokenSource SamplingTokenSource { get; set; }
Property Value
Type | Description |
---|---|
CancellationTokenSource |
Methods
GetIdentification()
Gets the device ID
Declaration
public byte[] GetIdentification()
Returns
Type | Description |
---|---|
System.Byte[] | The ID as a byte |
Initialize()
Initialize the extension controller
Declaration
protected virtual void Initialize()
StartUpdating(Nullable<TimeSpan>)
Starts continuously sampling the sensor
Declaration
public void StartUpdating(TimeSpan? updateInterval)
Parameters
Type | Name | Description |
---|---|---|
System.Nullable<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()