Skip to main content

Class Ads1263

Driver Class for the Ads1263 analog-to-digital (ADC) converter

Assembly: Ads1263.dll
View Source
Declaration
public class Ads1263 : IObservableAnalogInputController, IAnalogInputArrayController, IAnalogInputController, IDigitalInputOutputController, IDigitalInputController, IDigitalOutputController, IPinController, ISpiPeripheral, IDisposable

Implements:

Expand

Meadow.Hardware.IObservableAnalogInputController, Meadow.Hardware.IAnalogInputArrayController, Meadow.Hardware.IAnalogInputController, Meadow.Hardware.IDigitalInputOutputController, Meadow.Hardware.IDigitalInputController, Meadow.Hardware.IDigitalOutputController, Meadow.Hardware.IPinController, Meadow.Hardware.ISpiPeripheral, System.IDisposable

Properties

Pins

Ads1263 pin definitions

View Source
Declaration
public Ads1263.PinDefinitions Pins { get; }

SpiComms

Gets the underlying ISpiCommunications instance

View Source
Declaration
protected ISpiCommunications SpiComms { get; }

DefaultSpiBusMode

Default SPI bus mode

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

SpiBusMode

Current SPI bus mode

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

DefaultSpiBusSpeed

Default SPI bus speed for the peripheral

View Source
Declaration
public Frequency DefaultSpiBusSpeed { get; }

SpiBusSpeed

Current SPI bus speed

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

IsDisposed

Is the object disposed

View Source
Declaration
public bool IsDisposed { get; }

Fields

_lock

object for using lock() while modifying GPIO outputs

View Source
Declaration
protected object _lock

Methods

ConfigureADC1(AdcSource, AdcSource, Adc1Gain, Adc1DataRate, Adc1Filter, double, Adc1ReferenceP, Adc1ReferenceN)

Configures the ADC1 hardware (32-bit ADC).

View Source
Declaration
public void ConfigureADC1(Ads1263.AdcSource positiveSource = AdcSource.AIN0, Ads1263.AdcSource negativeSource = AdcSource.AIN1, Ads1263.Adc1Gain gain = Adc1Gain.Gain_1, Ads1263.Adc1DataRate rate = Adc1DataRate.SPS_20, Ads1263.Adc1Filter filter = Adc1Filter.FIR, double referenceVoltage = 5, Ads1263.Adc1ReferenceP positiveReference = Adc1ReferenceP.Internal, Ads1263.Adc1ReferenceN negativeReference = Adc1ReferenceN.Internal)
Parameters
TypeNameDescription
Meadow.Foundation.ICs.IOExpanders.Ads1263.AdcSourcepositiveSourceEnumeration specifying the positive ADC input
Meadow.Foundation.ICs.IOExpanders.Ads1263.AdcSourcenegativeSourceEnumeration specifying the negative ADC input
Meadow.Foundation.ICs.IOExpanders.Ads1263.Adc1GaingainEnumeration specifying channel gain.
Meadow.Foundation.ICs.IOExpanders.Ads1263.Adc1DataRaterateEnumeration specifying the sampling rate internal to the ADC
Meadow.Foundation.ICs.IOExpanders.Ads1263.Adc1FilterfilterEnumeration specifying the filtering configuration.
System.DoublereferenceVoltageReference voltage which needs to be specified if using external references.
Meadow.Foundation.ICs.IOExpanders.Ads1263.Adc1ReferencePpositiveReferenceEnumeration specifying the positive reference source
Meadow.Foundation.ICs.IOExpanders.Ads1263.Adc1ReferenceNnegativeReferenceEnumeration specifying the negative reference source

ConfigureADC2(AdcSource, AdcSource, Adc2Gain, Adc2DataRate, double, Adc2Reference)

Configures the ADC2 hardware (24-bit ADC).

View Source
Declaration
public void ConfigureADC2(Ads1263.AdcSource positiveSource = AdcSource.AIN0, Ads1263.AdcSource negativeSource = AdcSource.AIN1, Ads1263.Adc2Gain gain = Adc2Gain.Gain_1, Ads1263.Adc2DataRate rate = Adc2DataRate.SPS_10, double referenceVoltage = 5, Ads1263.Adc2Reference reference = Adc2Reference.Internal)
Parameters
TypeNameDescription
Meadow.Foundation.ICs.IOExpanders.Ads1263.AdcSourcepositiveSourceEnumeration specifying the positive ADC input
Meadow.Foundation.ICs.IOExpanders.Ads1263.AdcSourcenegativeSourceEnumeration specifying the negative ADC input
Meadow.Foundation.ICs.IOExpanders.Ads1263.Adc2GaingainEnumeration specifying channel gain.
Meadow.Foundation.ICs.IOExpanders.Ads1263.Adc2DataRaterateEnumeration specifying the sampling rate internal to the ADC
System.DoublereferenceVoltageReference voltage which needs to be specified if using external references
Meadow.Foundation.ICs.IOExpanders.Ads1263.Adc2ReferencereferenceEnumeration specifying the positive and negative reference source

ReadRegister(Register)

Read a single byte register from the Ads1263

View Source
Declaration
public byte ReadRegister(Ads1263.Register register)
Returns

System.Byte: byte value of register

Parameters
TypeNameDescription
Meadow.Foundation.ICs.IOExpanders.Ads1263.Register to be read

WriteRegister(Register, int)

Write a single byte register to the Ads1263

View Source
Declaration
public void WriteRegister(Ads1263.Register register, int data)
Parameters
TypeNameDescription
Meadow.Foundation.ICs.IOExpanders.Ads1263.Register to be written
System.Int32databyte (in int variable) to write

CreateAnalogInputPort(IPin, int, TimeSpan, Voltage)

Initializes the specified pin to be an AnalogInput and returns the port used to sample the port value.

View Source
Declaration
public IObservableAnalogInputPort CreateAnalogInputPort(IPin pin, int sampleCount, TimeSpan sampleInterval, Voltage referenceVoltage)
Returns

Meadow.Hardware.IObservableAnalogInputPort

Parameters
TypeNameDescription
Meadow.Hardware.IPinpinThe pin to create the port on.
System.Int32sampleCountThe number of samples to use for input averaging
System.TimeSpansampleIntervalThe interval between readings
Meadow.Units.VoltagereferenceVoltage

CreateAnalogInputPort(IPin, Voltage?)

Create an analog input port for a pin

View Source
Declaration
public IAnalogInputPort CreateAnalogInputPort(IPin pin, Voltage? voltageReference)
Returns

Meadow.Hardware.IAnalogInputPort

Parameters
TypeName
Meadow.Hardware.IPinpin
System.Nullable<Meadow.Units.Voltage>voltageReference

CreateAnalogInputArray(params IPin[])

Creates an array of analog inputs from the specified pins.

View Source
Declaration
public IAnalogInputArray CreateAnalogInputArray(params IPin[] pins)
Returns

Meadow.Hardware.IAnalogInputArray: An instance of Meadow.Hardware.IAnalogInputArray configured with the specified pins.

Parameters
TypeNameDescription
Meadow.Hardware.IPin[]pinsThe collection of pins to use for the analog input array.

ConvertTempSensor(Voltage)

Helper function to convert the internal temperature sensor reading

View Source
Declaration
public static Temperature ConvertTempSensor(Voltage tempSensorVoltage)
Returns

Meadow.Units.Temperature: Temperature of IC

Parameters
TypeNameDescription
Meadow.Units.VoltagetempSensorVoltageVoltage read from temp sensor channel

CreateDigitalInputPort(IPin, ResistorMode)

Creates a new DigitalInputPort using the specified GPIO pin

View Source
Declaration
public IDigitalInputPort CreateDigitalInputPort(IPin pin, ResistorMode resistorMode = ResistorMode.Disabled)
Returns

Meadow.Hardware.IDigitalInputPort: IDigitalInputPort

Parameters
TypeNameDescription
Meadow.Hardware.IPinpinThe pin representing the port
Meadow.Hardware.ResistorModeresistorModeThe port resistor mode (Not available on Ads1263)

CreateDigitalOutputPort(IPin, bool, OutputType)

Creates a new DigitalOutputPort using the specified pin and initial state

View Source
Declaration
public IDigitalOutputPort CreateDigitalOutputPort(IPin pin, bool initialState = false, OutputType outputType = OutputType.PushPull)
Returns

Meadow.Hardware.IDigitalOutputPort: IDigitalOutputPort

Parameters
TypeNameDescription
Meadow.Hardware.IPinpinThe pin representing the port
System.BooleaninitialStateWhether the pin is initially high or low
Meadow.Hardware.OutputTypeoutputTypeThe output type (always Meadow.Hardware.OutputType.PushPull for Ads1263)

Dispose()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

View Source
Declaration
public void Dispose()

Dispose(bool)

Dispose of the object

View Source
Declaration
protected virtual void Dispose(bool disposing)
Parameters
TypeNameDescription
System.BooleandisposingIs disposing

Implements

  • Meadow.Hardware.IObservableAnalogInputController
  • Meadow.Hardware.IAnalogInputArrayController
  • Meadow.Hardware.IAnalogInputController
  • Meadow.Hardware.IDigitalInputOutputController
  • Meadow.Hardware.IDigitalInputController
  • Meadow.Hardware.IDigitalOutputController
  • Meadow.Hardware.IPinController
  • Meadow.Hardware.ISpiPeripheral
  • System.IDisposable