Treehopper C# API
AdcPeripheralPin Class Reference

Base class for ADC peripherals More...

Inheritance diagram for AdcPeripheralPin:
AdcPin Ads1115.AdsPin Nau7802

Public Member Functions

 AdcPeripheralPin (IAdcPeripheral parent, int bitDepth, double refVoltage)
 Construct a new ADC pin that's part of the specified peripheral More...
 
Task MakeAnalogInAsync ()
 Make the pin an analog input. More...
 

Public Attributes

double AnalogValue => analogValueFromAdc(AdcValue)
 The analog value (from 0-1) of the ADC pin More...
 
double AnalogVoltage => analogVoltageFromAdc(AdcValue)
 The analog voltage of the pin More...
 

Protected Attributes

IAdcPeripheral parent
 

Properties

double ReferenceVoltage [get, set]
 The reference voltage used for calculating analog voltage More...
 
int AdcValueChangedThreshold [get, set]
 The amount the ADC value should change before triggering an event More...
 
int AdcValue [get, set]
 The raw ADC value More...
 
double AnalogValueChangedThreshold [get, set]
 The amount that the analog value (0-1) should change before triggering an event More...
 
double AnalogVoltageChangedThreshold [get, set]
 The change in voltage required to trigger an event More...
 

Events

OnAdcValueChanged AdcValueChanged
 Fires whenever the ADC value changes by the specified threshold More...
 
OnAnalogValueChanged AnalogValueChanged
 Fires whenever the analog value changes by the specified threshold More...
 
OnAnalogVoltageChanged AnalogVoltageChanged
 Fires whenever the analog voltage changes by the specified threshold More...
 
PropertyChangedEventHandler PropertyChanged
 

Detailed Description

Base class for ADC peripherals

Constructor & Destructor Documentation

◆ AdcPeripheralPin()

AdcPeripheralPin ( IAdcPeripheral  parent,
int  bitDepth,
double  refVoltage 
)

Construct a new ADC pin that's part of the specified peripheral

Parameters
parentThe peripheral
bitDepthThe ADC bitdepth
refVoltageThe reference voltage used to compare

Member Function Documentation

◆ MakeAnalogInAsync()

Task MakeAnalogInAsync ( )

Make the pin an analog input.

This is unused in most implementations

Implements AdcPin.

Member Data Documentation

◆ parent

IAdcPeripheral parent
protected

◆ AnalogValue

double AnalogValue => analogValueFromAdc(AdcValue)

The analog value (from 0-1) of the ADC pin

◆ AnalogVoltage

double AnalogVoltage => analogVoltageFromAdc(AdcValue)

The analog voltage of the pin

Property Documentation

◆ ReferenceVoltage

double ReferenceVoltage
getset

The reference voltage used for calculating analog voltage

◆ AdcValueChangedThreshold

int AdcValueChangedThreshold
getset

The amount the ADC value should change before triggering an event

◆ AdcValue

int AdcValue
getset

The raw ADC value

◆ AnalogValueChangedThreshold

double AnalogValueChangedThreshold
getset

The amount that the analog value (0-1) should change before triggering an event

◆ AnalogVoltageChangedThreshold

double AnalogVoltageChangedThreshold
getset

The change in voltage required to trigger an event

Event Documentation

◆ AdcValueChanged

OnAdcValueChanged AdcValueChanged

Fires whenever the ADC value changes by the specified threshold

◆ AnalogValueChanged

OnAnalogValueChanged AnalogValueChanged

Fires whenever the analog value changes by the specified threshold

◆ AnalogVoltageChanged

OnAnalogVoltageChanged AnalogVoltageChanged

Fires whenever the analog voltage changes by the specified threshold

◆ PropertyChanged

PropertyChangedEventHandler PropertyChanged

The documentation for this class was generated from the following file: