ClearCore Library
|
ClearCore digital input connector class.
This manages a digital input connector on the ClearCore board.
The following connector instances support digital input functionality:
For more detailed information on the ClearCore Connector interface, check out the ClearCore Connector System informational page.
ClearCore digital input connector class. More...
#include <DigitalIn.h>
Public Types | |
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... | |
Public Member Functions | |
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. | |
virtual ConnectorModes | Mode () override |
Get the connector's operational mode. | |
virtual bool | Mode (ConnectorModes newMode) override |
Set the 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 the connector's last majority-filtered sampled value. | |
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. | |
|
inline |
Get the connector's digital filter length in samples. The default is 3 samples.
This will get the length, in samples, of the connector's filter.
|
inline |
Set the connector's digital transition filter length. The default digital filter length for digital input connectors is 3 samples.
This will set the length, in samples (default) or milliseconds, of the connector's transition filter and restarts any filtering in progress.
[in] | length | The length of the filter. |
[in] | units | The units of the specified filter length: samples (default) or milliseconds. |
bool ClearCore::DigitalIn::InputFallen | ( | ) |
Clear on read accessor for this connector's falling input state.
bool ClearCore::DigitalIn::InputRisen | ( | ) |
Clear on read accessor for this connector's rising input state.
void ClearCore::DigitalIn::InterruptEnable | ( | bool | enable | ) |
Enable or disable the interrupt on this connector.
[in] | enable | If true, enable the interrupt. If false, disable the interrupt. |
bool ClearCore::DigitalIn::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.
[in] | callback | The ISR to be called when the interrupt is triggered |
[in] | trigger | The input state condition on which to trigger the interrupt. |
[in] | enable | Whether this interrupt should be immediately enabled. |
|
inlineoverridevirtual |
Get R/W status of the connector.
Implements ClearCore::Connector.
Reimplemented in ClearCore::DigitalInAnalogIn, ClearCore::DigitalInOut, ClearCore::DigitalInOutAnalogOut, ClearCore::DigitalInOutHBridge, and ClearCore::MotorDriver.
|
inlineoverridevirtual |
Get the connector's operational mode.
Reimplemented from ClearCore::Connector.
Reimplemented in ClearCore::DigitalInAnalogIn, ClearCore::DigitalInOut, ClearCore::DigitalInOutAnalogOut, ClearCore::DigitalInOutHBridge, and ClearCore::MotorDriver.
|
inlineoverridevirtual |
Set the connector's operational mode.
[in] | newMode | The new mode to be set. The only valid mode for this connector type is: INPUT_DIGITAL. |
Implements ClearCore::Connector.
Reimplemented in ClearCore::DigitalInAnalogIn, ClearCore::DigitalInOut, ClearCore::DigitalInOutAnalogOut, and ClearCore::DigitalInOutHBridge.
|
overridevirtual |
Get the connector's last majority-filtered sampled value.
Implements ClearCore::Connector.
Reimplemented in ClearCore::DigitalInAnalogIn, ClearCore::DigitalInOut, ClearCore::DigitalInOutAnalogOut, and ClearCore::DigitalInOutHBridge.
|
inlineoverridevirtual |
Get connector type.
Implements ClearCore::Connector.
Reimplemented in ClearCore::DigitalInAnalogIn, ClearCore::DigitalInOut, ClearCore::DigitalInOutAnalogOut, ClearCore::DigitalInOutHBridge, and ClearCore::MotorDriver.