ClearCore Library
|
ClearCore digital input/output with analog current output Connector class.
This manages an analog output connector on the ClearCore board. This connector can also be configured as a digital output or digital input.
The following connector instances support analog output functionality:
For more detailed information on the ClearCore Connector interface, check out the ClearCore Connector System informational page.
ClearCore digital input/output with analog current output Connector class. More...
#include <DigitalInOutAnalogOut.h>
Public Member Functions | |
virtual ConnectorModes | Mode () override |
Get the connector's operational mode. | |
bool | Mode (ConnectorModes newMode) override |
Set connector's operational mode. | |
Connector::ConnectorTypes | Type () override |
Get connector type. | |
bool | IsWritable () override |
Get R/W status of the connector. | |
int16_t | State () override |
Get connector's last sampled digital value. | |
bool | State (int16_t newState) override |
Set the output value of the connector. | |
void | AnalogWrite (uint16_t value) |
Command the DAC to output a (calibrated) value. | |
void | OutputCurrent (uint16_t currentuA) |
Command the DAC to output the given number of microamps (uA). | |
Public Member Functions inherited from ClearCore::DigitalInOut | |
bool | IsInHwFault () override |
Get whether the connector is in a hardware fault state. | |
void | OutputPulsesStart (uint32_t onTime, uint32_t offTime, uint16_t pulseCount=0, bool blockUntilDone=false) |
Start an output pulse. | |
void | OutputPulsesStop (bool stopImmediately=true) |
Stop an output pulse. | |
volatile const bool & | OutputPulsesActive () |
Check the output pulse state. | |
bool | PwmDuty (uint8_t newDuty) |
Set the PWM duty on the I/O pin. | |
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. | |
uint32_t | InputRegMask () |
Get a bit mask representing this connector. | |
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... | |
void ClearCore::DigitalInOutAnalogOut::AnalogWrite | ( | uint16_t | value | ) |
Command the DAC to output a (calibrated) value.
A value of 2047 corresponds to maximum (20 mA) current output, and a value of 0 corresponds to minimum (0 mA) current output.
[in] | value | The raw 11-bit DAC value to command analog current. |
|
overridevirtual |
Get R/W status of the connector.
Reimplemented from ClearCore::DigitalInOut.
|
inlineoverridevirtual |
Get the connector's operational mode.
Reimplemented from ClearCore::DigitalInOut.
|
overridevirtual |
Set connector's operational mode.
[in] | newMode | The new operational mode to be set. The valid modes for this connector type are: |
Reimplemented from ClearCore::DigitalInOut.
void ClearCore::DigitalInOutAnalogOut::OutputCurrent | ( | uint16_t | currentuA | ) |
Command the DAC to output the given number of microamps (uA).
[in] | currentuA | Output current command in microamps (uA). |
|
overridevirtual |
Get connector's last sampled digital value.
In digital modes, return the current digital state; in analog output mode, returns 0.
Reimplemented from ClearCore::DigitalInOut.
|
overridevirtual |
Set the output value of the connector.
When in digital modes, set the digital output value via DigitalInOut class. When in analog output mode, write the analog value out. Valid analog values are unsigned 11-bit integers, where 0 corresponds to 0 mA (minimum current output) and 2047 corresponds to 20 mA (maximum current output).
[in] | newState | The value to be output |
Reimplemented from ClearCore::DigitalInOut.
|
inlineoverridevirtual |
Get connector type.
Reimplemented from ClearCore::DigitalInOut.