Class As5013
Represents an AS5013 Hall navigation sensor for analog joysticks
Assembly: As5013.dll
View Source
public class As5013 : SamplingSensorBase<AnalogJoystickPosition>, IObservable<IChangeResult<AnalogJoystickPosition>>, ISamplingSensor<AnalogJoystickPosition>, ISensor<AnalogJoystickPosition>, ISensor, ISamplingSensor, IAnalogJoystick, II2cPeripheral
Inheritance: System.Object
-> Meadow.Foundation.ObservableBase<UNIT> -> Meadow.Foundation.SamplingSensorBase<UNIT>
Implements:
System.IObservable<Meadow.IChangeResult<Meadow.Peripherals.Sensors.Hid.AnalogJoystickPosition>>
, Meadow.Peripherals.Sensors.ISamplingSensor<Meadow.Peripherals.Sensors.Hid.AnalogJoystickPosition>
, Meadow.Peripherals.Sensors.ISensor<Meadow.Peripherals.Sensors.Hid.AnalogJoystickPosition>
, Meadow.Peripherals.Sensors.ISensor
, Meadow.Peripherals.Sensors.ISamplingSensor
, Meadow.Peripherals.Sensors.Hid.IAnalogJoystick
, Meadow.Hardware.II2cPeripheral
Properties
DefaultSpeed
Default I2C bus speed
View Source
public I2cBusSpeed DefaultSpeed { get; }
IsHorizontalInverted
Is the horizontal analog value inverted
View Source
public bool IsHorizontalInverted { get; set; }
IsVerticalInverted
Is the vertical analog value inverted
View Source
public bool IsVerticalInverted { get; set; }
IsVerticalHorizonalSwapped
Swap horizontal and vertical
View Source
public bool IsVerticalHorizonalSwapped { get; set; }
Position
The joystick position
View Source
public AnalogJoystickPosition? Position { get; }
DigitalPosition
The digital joystick position
View Source
public DigitalJoystickPosition? DigitalPosition { get; }
DefaultI2cAddress
The default I2C address for the peripheral
View Source
public byte DefaultI2cAddress { get; }
Fields
i2cComms
I2C Communication bus used to communicate with the peripheral
View Source
protected readonly II2cCommunications i2cComms
Methods
ReadSensor()
Convenience method to get the current position
View Source
protected override Task<AnalogJoystickPosition> ReadSensor()
Returns
System.Threading.Tasks.Task<Meadow.Peripherals.Sensors.Hid.AnalogJoystickPosition>
StartUpdating(TimeSpan?)
Starts continuously sampling the sensor
This method also starts raising Changed
events and IObservable
subscribers getting notified. Use the readIntervalDuration
parameter
to specify how often events and notifications are raised/sent.
View Source
public override void StartUpdating(TimeSpan? updateInterval)
Parameters
Type | Name | Description |
---|---|---|
System.Nullable<System.TimeSpan> | updateInterval | A TimeSpan that specifies how long to |
wait between readings. This value influences how often `*Updated`
events are raised and `IObservable` consumers are notified. |
StopUpdating()
Stops sampling the joystick position
View Source
public override void StopUpdating()
SetLowPowerMode(byte)
Set the device into low power mode
View Source
public void SetLowPowerMode(byte timing)
Parameters
Type | Name | Description |
---|---|---|
System.Byte | timing | timing between reads |
SetScalingFactor(byte)
Set the data scaling factor from the hall sensor (see datasheet)
View Source
public void SetScalingFactor(byte scalingFactor)
Parameters
Type | Name |
---|---|
System.Byte | scalingFactor |
InvertSpinning()
Invert the channel voltage function
View Source
public void InvertSpinning()
SoftReset()
Soft reset the IC
View Source
public void SoftReset()
DisableInterrupt()
Disable the interrupt pin
View Source
public void DisableInterrupt()
EnableInterrupt()
enable the interrupt pin
View Source
public void EnableInterrupt()
SetDefaultConfiguration()
Set the default configuration
View Source
public void SetDefaultConfiguration()
Events
Interrupt
Event if interrupt port is provided for interrupt pin
View Source
public event EventHandler Interrupt
Event Type
System.EventHandler
Implements
System.IObservable<Meadow.IChangeResult<Meadow.Peripherals.Sensors.Hid.AnalogJoystickPosition>>
Meadow.Peripherals.Sensors.ISamplingSensor<Meadow.Peripherals.Sensors.Hid.AnalogJoystickPosition>
Meadow.Peripherals.Sensors.ISensor<Meadow.Peripherals.Sensors.Hid.AnalogJoystickPosition>
Meadow.Peripherals.Sensors.ISensor
Meadow.Peripherals.Sensors.ISamplingSensor
Meadow.Peripherals.Sensors.Hid.IAnalogJoystick
Meadow.Hardware.II2cPeripheral