ClearCore Library
|
ClearCore analog input connector class.
This manages an analog input connector on the ClearCore board. This connector can also be configured as a digital input.
The following connector instances support analog input functionality:
For more detailed information on the ClearCore Connector interface, check out the ClearCore Connector System informational page.
ClearCore analog input connector class. More...
#include <DigitalInAnalogIn.h>
Public Member Functions | |
virtual ConnectorModes | Mode () override |
Get the connector's operational mode. | |
bool | Mode (ConnectorModes newMode) override |
Set the connector's operational mode. | |
Connector::ConnectorTypes | Type () override |
Get connector type. | |
bool | IsWritable () override |
Is this connector able to be written to? | |
bool | FilterTc (uint16_t tc, AdcManager::FilterUnits theUnits) |
Set the time constant for the analog input filter. | |
int16_t | State () override |
Get the connector's last majority-filtered sampled value. | |
float | AnalogVoltage () |
Returns the analog voltage of the connector in volts. | |
Public Member Functions inherited from ClearCore::DigitalIn | |
void | FilterLength (uint16_t length, FilterUnits units=FILTER_UNIT_SAMPLES) |
Set the connector's digital transition filter length. The default digital filter length for digital input connectors is 3 samples. | |
uint16_t | FilterLength () |
Get the connector's digital filter length in samples. The default is 3 samples. | |
bool | InputRisen () |
Clear on read accessor for this connector's rising input state. | |
bool | InputFallen () |
Clear on read accessor for this connector's falling input state. | |
bool | InterruptHandlerSet (voidFuncPtr callback=nullptr, InputManager::InterruptTrigger trigger=InputManager::InterruptTrigger::RISING, bool enable=true) |
Register the interrupt service routine to be triggered when the given input state condition is met on this connector. | |
void | InterruptEnable (bool enable) |
Enable or disable the interrupt on this connector. | |
Public Member Functions inherited from ClearCore::Connector | |
void | Reinitialize () |
Reinitialize this connector to the power-up state. | |
int32_t | ConnectorIndex () |
Accessor for the bit index of this connector in the input register. | |
virtual bool | State (int16_t newState)=0 |
Set the state of a R/W connector. | |
virtual bool | IsInHwFault ()=0 |
Get whether the connector is in a hardware fault state. | |
uint32_t | InputRegMask () |
Get a bit mask representing this connector. | |
Static Public Attributes | |
static const uint16_t | ANALOG_INPUT_FILTER_TC_MS_DEFAULT = 2 |
Additional Inherited Members | |
Public Types inherited from ClearCore::DigitalIn | |
enum | FilterUnits { FILTER_UNIT_MS , FILTER_UNIT_SAMPLES } |
Units for the digital filter length. More... | |
Public Types inherited from ClearCore::Connector | |
enum | ConnectorModes { INVALID_NONE , INPUT_ANALOG , INPUT_DIGITAL , OUTPUT_ANALOG , OUTPUT_DIGITAL , OUTPUT_H_BRIDGE , OUTPUT_PWM , OUTPUT_TONE , OUTPUT_WAVE , CPM_MODE_A_DIRECT_B_DIRECT , CPM_MODE_STEP_AND_DIR , CPM_MODE_A_DIRECT_B_PWM , CPM_MODE_A_PWM_B_PWM , TTL , RS232 , SPI , CCIO , USB_CDC } |
All possible operational modes for a connector. More... | |
enum | ConnectorTypes { DIGITAL_IN_TYPE , DIGITAL_IN_OUT_TYPE , SHIFT_REG_TYPE , ANALOG_IN_DIGITAL_IN_TYPE , ANALOG_OUT_DIGITAL_IN_OUT_TYPE , H_BRIDGE_TYPE , CPM_TYPE , SERIAL_TYPE , SERIAL_USB_TYPE , CCIO_DIGITAL_IN_OUT_TYPE } |
The different types of ClearCore connectors. More... | |
|
inline |
Returns the analog voltage of the connector in volts.
bool ClearCore::DigitalInAnalogIn::FilterTc | ( | uint16_t | tc, |
AdcManager::FilterUnits | theUnits | ||
) |
Set the time constant for the analog input filter.
Set the time constant of the analog filter to the given value.
[in] | tc | The time constant to use for the analog filter. |
[in] | theUnits | The units of the time constant tc. See AdcManager::FilterUnits. |
|
inlineoverridevirtual |
Is this connector able to be written to?
Reimplemented from ClearCore::DigitalIn.
|
inlineoverridevirtual |
Get the connector's operational mode.
Reimplemented from ClearCore::DigitalIn.
|
overridevirtual |
Set the connector's operational mode.
Set the connector up in the given mode by setting the control bits appropriately; also reset the analog filter to the current value if setting up for analog mode.
[in] | newMode | The new mode to be set. The valid modes for this connector type are: |
Reimplemented from ClearCore::DigitalIn.
|
overridevirtual |
Get the connector's last majority-filtered sampled value.
In digital input mode, return the last filtered digital input state. When in analog input mode, return the last filtered input value.
Reimplemented from ClearCore::DigitalIn.
|
inlineoverridevirtual |
Get connector type.
Reimplemented from ClearCore::DigitalIn.
|
static |
Default value for the analog input filter time constant: 2 milliseconds.