Class Ads1263
Driver Class for the Ads1263 analog-to-digital (ADC) converter
Assembly: Ads1263.dll
View Source
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
public Ads1263.PinDefinitions Pins { get; }
SpiComms
Gets the underlying ISpiCommunications instance
View Source
protected ISpiCommunications SpiComms { get; }
DefaultSpiBusMode
Default SPI bus mode
View Source
public SpiClockConfiguration.Mode DefaultSpiBusMode { get; }
SpiBusMode
Current SPI bus mode
View Source
public SpiClockConfiguration.Mode SpiBusMode { get; set; }
DefaultSpiBusSpeed
Default SPI bus speed for the peripheral
View Source
public Frequency DefaultSpiBusSpeed { get; }
SpiBusSpeed
Current SPI bus speed
View Source
public Frequency SpiBusSpeed { get; set; }
IsDisposed
Is the object disposed
View Source
public bool IsDisposed { get; }
Fields
_lock
object for using lock() while modifying GPIO outputs
View Source
protected object _lock
Methods
ConfigureADC1(AdcSource, AdcSource, Adc1Gain, Adc1DataRate, Adc1Filter, double, Adc1ReferenceP, Adc1ReferenceN)
Configures the ADC1 hardware (32-bit ADC).
View Source
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
Type | Name | Description |
---|---|---|
Meadow.Foundation.ICs.IOExpanders.Ads1263.AdcSource | positiveSource | Enumeration specifying the positive ADC input |
Meadow.Foundation.ICs.IOExpanders.Ads1263.AdcSource | negativeSource | Enumeration specifying the negative ADC input |
Meadow.Foundation.ICs.IOExpanders.Ads1263.Adc1Gain | gain | Enumeration specifying channel gain. |
Meadow.Foundation.ICs.IOExpanders.Ads1263.Adc1DataRate | rate | Enumeration specifying the sampling rate internal to the ADC |
Meadow.Foundation.ICs.IOExpanders.Ads1263.Adc1Filter | filter | Enumeration specifying the filtering configuration. |
System.Double | referenceVoltage | Reference voltage which needs to be specified if using external references. |
Meadow.Foundation.ICs.IOExpanders.Ads1263.Adc1ReferenceP | positiveReference | Enumeration specifying the positive reference source |
Meadow.Foundation.ICs.IOExpanders.Ads1263.Adc1ReferenceN | negativeReference | Enumeration specifying the negative reference source |
ConfigureADC2(AdcSource, AdcSource, Adc2Gain, Adc2DataRate, double, Adc2Reference)
Configures the ADC2 hardware (24-bit ADC).
View Source
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
Type | Name | Description |
---|---|---|
Meadow.Foundation.ICs.IOExpanders.Ads1263.AdcSource | positiveSource | Enumeration specifying the positive ADC input |
Meadow.Foundation.ICs.IOExpanders.Ads1263.AdcSource | negativeSource | Enumeration specifying the negative ADC input |
Meadow.Foundation.ICs.IOExpanders.Ads1263.Adc2Gain | gain | Enumeration specifying channel gain. |
Meadow.Foundation.ICs.IOExpanders.Ads1263.Adc2DataRate | rate | Enumeration specifying the sampling rate internal to the ADC |
System.Double | referenceVoltage | Reference voltage which needs to be specified if using external references |
Meadow.Foundation.ICs.IOExpanders.Ads1263.Adc2Reference | reference | Enumeration specifying the positive and negative reference source |
ReadRegister(Register)
Read a single byte register from the Ads1263
View Source
public byte ReadRegister(Ads1263.Register register)
Returns
System.Byte
: byte value of register
Parameters
Type | Name | Description |
---|---|---|
Meadow.Foundation.ICs.IOExpanders.Ads1263.Register to be read |
WriteRegister(Register, int)
Write a single byte register to the Ads1263
View Source
public void WriteRegister(Ads1263.Register register, int data)
Parameters
Type | Name | Description |
---|---|---|
Meadow.Foundation.ICs.IOExpanders.Ads1263.Register to be written | ||
System.Int32 | data | byte (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
public IObservableAnalogInputPort CreateAnalogInputPort(IPin pin, int sampleCount, TimeSpan sampleInterval, Voltage referenceVoltage)
Returns
Meadow.Hardware.IObservableAnalogInputPort
Parameters
Type | Name | Description |
---|---|---|
Meadow.Hardware.IPin | pin | The pin to create the port on. |
System.Int32 | sampleCount | The number of samples to use for input averaging |
System.TimeSpan | sampleInterval | The interval between readings |
Meadow.Units.Voltage | referenceVoltage |
CreateAnalogInputPort(IPin, Voltage?)
Create an analog input port for a pin
View Source
public IAnalogInputPort CreateAnalogInputPort(IPin pin, Voltage? voltageReference)
Returns
Meadow.Hardware.IAnalogInputPort
Parameters
Type | Name |
---|---|
Meadow.Hardware.IPin | pin |
System.Nullable<Meadow.Units.Voltage> | voltageReference |
CreateAnalogInputArray(params IPin[])
Creates an array of analog inputs from the specified pins.
View Source
public IAnalogInputArray CreateAnalogInputArray(params IPin[] pins)
Returns
Meadow.Hardware.IAnalogInputArray
: An instance of Meadow.Hardware.IAnalogInputArray
configured with the specified pins.
Parameters
Type | Name | Description |
---|---|---|
Meadow.Hardware.IPin[] | pins | The collection of pins to use for the analog input array. |
ConvertTempSensor(Voltage)
Helper function to convert the internal temperature sensor reading
View Source
public static Temperature ConvertTempSensor(Voltage tempSensorVoltage)
Returns
Meadow.Units.Temperature
: Temperature of IC
Parameters
Type | Name | Description |
---|---|---|
Meadow.Units.Voltage | tempSensorVoltage | Voltage read from temp sensor channel |
CreateDigitalInputPort(IPin, ResistorMode)
Creates a new DigitalInputPort using the specified GPIO pin
View Source
public IDigitalInputPort CreateDigitalInputPort(IPin pin, ResistorMode resistorMode = ResistorMode.Disabled)
Returns
Meadow.Hardware.IDigitalInputPort
: IDigitalInputPort
Parameters
Type | Name | Description |
---|---|---|
Meadow.Hardware.IPin | pin | The pin representing the port |
Meadow.Hardware.ResistorMode | resistorMode | The port resistor mode (Not available on Ads1263) |
CreateDigitalOutputPort(IPin, bool, OutputType)
Creates a new DigitalOutputPort using the specified pin and initial state
View Source
public IDigitalOutputPort CreateDigitalOutputPort(IPin pin, bool initialState = false, OutputType outputType = OutputType.PushPull)
Returns
Meadow.Hardware.IDigitalOutputPort
: IDigitalOutputPort
Parameters
Type | Name | Description |
---|---|---|
Meadow.Hardware.IPin | pin | The pin representing the port |
System.Boolean | initialState | Whether the pin is initially high or low |
Meadow.Hardware.OutputType | outputType | The output type (always Meadow.Hardware.OutputType.PushPull for Ads1263) |
Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
View Source
public void Dispose()
Dispose(bool)
Dispose of the object
View Source
protected virtual void Dispose(bool disposing)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | disposing | Is 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