Skip to main content

Class Adxl362

Driver for the ADXL362 triple axis accelerometer

Assembly: Adxl3xx.dll
View Source
Declaration
public class Adxl362 : ByteCommsSensorBase<(Acceleration3D? Acceleration3D, Temperature? Temperature)>, IObservable<IChangeResult<(Acceleration3D? Acceleration3D, Temperature? Temperature)>>, ISamplingSensor<(Acceleration3D? Acceleration3D, Temperature? Temperature)>, ISensor<(Acceleration3D? Acceleration3D, Temperature? Temperature)>, IDisposable, IAccelerometer, ISamplingSensor<Acceleration3D>, ISensor<Acceleration3D>, ITemperatureSensor, ISamplingSensor<Temperature>, ISensor<Temperature>, ISensor, ISamplingSensor, ISpiPeripheral

Inheritance: System.Object -> Meadow.Foundation.ObservableBase<UNIT>

Implements:

Expand

System.IObservable<Meadow.IChangeResult<System.ValueTuple<System.Nullable<Meadow.Units.Acceleration3D>,System.Nullable<Meadow.Units.Temperature>>>>, Meadow.Peripherals.Sensors.ISamplingSensor<System.ValueTuple<System.Nullable<Meadow.Units.Acceleration3D>,System.Nullable<Meadow.Units.Temperature>>>, Meadow.Peripherals.Sensors.ISensor<System.ValueTuple<System.Nullable<Meadow.Units.Acceleration3D>,System.Nullable<Meadow.Units.Temperature>>>, System.IDisposable, Meadow.Peripherals.Sensors.Motion.IAccelerometer, Meadow.Peripherals.Sensors.ISamplingSensor<Meadow.Units.Acceleration3D>, Meadow.Peripherals.Sensors.ISensor<Meadow.Units.Acceleration3D>, Meadow.Peripherals.Sensors.ITemperatureSensor, Meadow.Peripherals.Sensors.ISamplingSensor<Meadow.Units.Temperature>, Meadow.Peripherals.Sensors.ISensor<Meadow.Units.Temperature>, Meadow.Peripherals.Sensors.ISensor, Meadow.Peripherals.Sensors.ISamplingSensor, Meadow.Hardware.ISpiPeripheral

Properties

Acceleration3D

The current acceleration value

View Source
Declaration
public Acceleration3D? Acceleration3D { get; }

Temperature

The current temperature value

View Source
Declaration
public Temperature? Temperature { get; }

DefaultSpiBusSpeed

The default SPI bus speed for the device

View Source
Declaration
public Frequency DefaultSpiBusSpeed { get; }

SpiBusSpeed

The SPI bus speed for the device

View Source
Declaration
public Frequency SpiBusSpeed { get; set; }

DefaultSpiBusMode

The default SPI bus mode for the device

View Source
Declaration
public SpiClockConfiguration.Mode DefaultSpiBusMode { get; }

SpiBusMode

The SPI bus mode for the device

View Source
Declaration
public SpiClockConfiguration.Mode SpiBusMode { get; set; }

DataReady

Indicate of data is ready to be read

View Source
Declaration
public bool DataReady { get; }

FIFOReady

Indicate if there is any data in the FIFO buffer

View Source
Declaration
public bool FIFOReady { get; }

FIFOWatermark

Indicate if there are at least the desired number of samples in the FIFO buffer

View Source
Declaration
public bool FIFOWatermark { get; }

FIFOOverrun

Indicate if the FIFO buffer has overrun (newly generated data is overwriting data already stored in the FIFO buffer

View Source
Declaration
public bool FIFOOverrun { get; }

ActivityDetected

Indicate if any activity has been detected over the specified threshold

View Source
Declaration
public bool ActivityDetected { get; }

InactivityDetected

Indicate if the sensor has detected inactivity or a free fall condition

View Source
Declaration
public bool InactivityDetected { get; }

IsAwake

Indicate if the sensor is awake or inactive

View Source
Declaration
public bool IsAwake { get; }

DeviceID

Read the device ID, MEMS ID, Part ID and silicon revision ID and encode the value in a 32-bit integer

View Source
Declaration
public int DeviceID { get; }

Status

Read the status register

View Source
Declaration
public byte Status { get; }

ActivityInactivityControl

Activity / Inactivity control register (see page 29 of the data sheet)

View Source
Declaration
public byte ActivityInactivityControl { get; set; }

SelfTest

Set the value of the self test register - setting this to true will put the device into self test mode, setting this to false will turn off the self test

View Source
Declaration
public bool SelfTest { set; }

FilterControl

Get / set the filter control register (see page 33 of the data sheet)

View Source
Declaration
public byte FilterControl { get; set; }

Methods

RaiseEventsAndNotify(IChangeResult<(Acceleration3D? Acceleration3D, Temperature? Temperature)>)

Raise events for subscribers and notify of value changes

View Source
Declaration
protected override void RaiseEventsAndNotify(IChangeResult<(Acceleration3D? Acceleration3D, Temperature? Temperature)> changeResult)
Parameters
TypeNameDescription
Meadow.IChangeResult<System.ValueTuple<System.Nullable<Meadow.Units.Acceleration3D>,System.Nullable<Meadow.Units.Temperature>>>changeResultThe updated sensor data

Reset()

Reset the sensor

View Source
Declaration
public void Reset()

Start()

Start making sensor readings

View Source
Declaration
public void Start()

Stop()

Stop sensor readings

View Source
Declaration
public void Stop()

Read()

Read data from the sensor

View Source
Declaration
public override Task<(Acceleration3D? Acceleration3D, Temperature? Temperature)> Read()
Returns

System.Threading.Tasks.Task<System.ValueTuple<System.Nullable<Meadow.Units.Acceleration3D>,System.Nullable<Meadow.Units.Temperature>>>: The sensor data### StartUpdating(TimeSpan?) Start updates

View Source
Declaration
public override void StartUpdating(TimeSpan? updateInterval = null)
Parameters
TypeNameDescription
System.Nullable<System.TimeSpan>updateIntervalThe update interval

StopUpdating()

Stop updating

View Source
Declaration
public override void StopUpdating()

ReadSensor()

Reads data from the sensor

View Source
Declaration
protected override Task<(Acceleration3D? Acceleration3D, Temperature? Temperature)> ReadSensor()
Returns

System.Threading.Tasks.Task<System.ValueTuple<System.Nullable<Meadow.Units.Acceleration3D>,System.Nullable<Meadow.Units.Temperature>>>: The latest sensor reading### ConfigureActivityThreshold(ushort, byte) Configure the activity threshold and activity time. Once configured it will be necessary to set the activity/inactivity control and interrupts if required.

View Source
Declaration
public void ConfigureActivityThreshold(ushort threshold, byte numberOfSamples)
Parameters
TypeNameDescription
System.UInt16threshold11-bit unsigned value for the activity threshold.
System.BytenumberOfSamplesNumber of consecutive samples that must exceed the threshold

ConfigureInactivityThreshold(ushort, ushort)

Configure the inactivity threshold and activity time. Once configured it will be necessary to set the activity/inactivity control and interrupts if required.

View Source
Declaration
public void ConfigureInactivityThreshold(ushort threshold, ushort numberOfSamples)
Parameters
TypeNameDescription
System.UInt16threshold11-bit unsigned value for the activity threshold.
System.UInt16numberOfSamplesNumber of consecutive samples that must exceed the threshold

Implements

  • System.IObservable<Meadow.IChangeResult<System.ValueTuple<System.Nullable<Meadow.Units.Acceleration3D>,System.Nullable<Meadow.Units.Temperature>>>>
  • Meadow.Peripherals.Sensors.ISamplingSensor<System.ValueTuple<System.Nullable<Meadow.Units.Acceleration3D>,System.Nullable<Meadow.Units.Temperature>>>
  • Meadow.Peripherals.Sensors.ISensor<System.ValueTuple<System.Nullable<Meadow.Units.Acceleration3D>,System.Nullable<Meadow.Units.Temperature>>>
  • System.IDisposable
  • Meadow.Peripherals.Sensors.Motion.IAccelerometer
  • Meadow.Peripherals.Sensors.ISamplingSensor<Meadow.Units.Acceleration3D>
  • Meadow.Peripherals.Sensors.ISensor<Meadow.Units.Acceleration3D>
  • Meadow.Peripherals.Sensors.ITemperatureSensor
  • Meadow.Peripherals.Sensors.ISamplingSensor<Meadow.Units.Temperature>
  • Meadow.Peripherals.Sensors.ISensor<Meadow.Units.Temperature>
  • Meadow.Peripherals.Sensors.ISensor
  • Meadow.Peripherals.Sensors.ISamplingSensor
  • Meadow.Hardware.ISpiPeripheral