![]() |
ClearCore Library
|
ClearCore H-Bridge digital output connector class.
This manages a connector on the ClearCore board that supports H-Bridge digital output functionality, including sine tone generation. This connector can also be configured as a digital input or digital output.
The following connector instances support H-Bridge digital output functionality:
For more detailed information on the ClearCore Connector interface, check out the ClearCore Connector System informational page.
ClearCore H-Bridge digital output connector class. More...
#include <DigitalInOutHBridge.h>
Inheritance diagram for ClearCore::DigitalInOutHBridge:
Collaboration diagram for ClearCore::DigitalInOutHBridge:Public Types | |
| enum | ToneState { TONE_OFF = 0 , TONE_CONTINUOUS , TONE_TIMED , TONE_PERIODIC_ON , TONE_PERIODIC_OFF } |
| Possible states of the tone generator. More... | |
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... | |
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. | |
| void | ToneAmplitude (int16_t amplitude) |
| Set the amplitude of a PWM output for tone generation. | |
| void | ToneContinuous (uint16_t frequency) |
| Output a continuous tone from the H-Bridge. | |
| void | ToneTimed (uint16_t frequency, uint32_t duration, bool blocking=false, bool forceDuration=false) |
| Output a tone from the H-Bridge for the specified duration. | |
| void | TonePeriodic (uint16_t frequency, uint32_t timeOn, uint32_t timeOff) |
| Output a periodic tone from the H-Bridge. | |
| void | ToneStop () |
| volatile const ToneState & | ToneActiveState () |
| Accessor for the state of the tone currently active on the H-Bridge. | |
| int16_t | State () override |
| Get connector's last sampled value. | |
| bool | State (int16_t newState) override |
| Set the state of the Connector. | |
| bool | IsWritable () override |
| Get R/W status of the connector. | |
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. | |
Possible states of the tone generator.
|
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 the connector's operational mode.
| [in] | newMode | The new mode to be set. The valid modes for this connector type are: |
Reimplemented from ClearCore::DigitalInOut.
|
overridevirtual |
Get connector's last sampled value.
Reimplemented from ClearCore::DigitalInOut.
|
overridevirtual |
Set the state of the Connector.
| [in] | newState | New state to set for the connector. |
Reimplemented from ClearCore::DigitalInOut.
|
inline |
Accessor for the state of the tone currently active on the H-Bridge.
| void ClearCore::DigitalInOutHBridge::ToneAmplitude | ( | int16_t | amplitude | ) |
Set the amplitude of a PWM output for tone generation.
| [in] | amplitude | The amplitude of the tone (0 to INT16_MAX) |
| void ClearCore::DigitalInOutHBridge::ToneContinuous | ( | uint16_t | frequency | ) |
Output a continuous tone from the H-Bridge.
| [in] | frequency | The frequency of the tone (Hz) |
| void ClearCore::DigitalInOutHBridge::TonePeriodic | ( | uint16_t | frequency, |
| uint32_t | timeOn, | ||
| uint32_t | timeOff | ||
| ) |
Output a periodic tone from the H-Bridge.
| [in] | frequency | The frequency of the tone (Hz) |
| [in] | timeOn | Periodic on time (ms) |
| [in] | timeOff | Periodic off time (ms) |
| void ClearCore::DigitalInOutHBridge::ToneStop | ( | ) |
Stop the tone output.
| void ClearCore::DigitalInOutHBridge::ToneTimed | ( | uint16_t | frequency, |
| uint32_t | duration, | ||
| bool | blocking = false, |
||
| bool | forceDuration = false |
||
| ) |
Output a tone from the H-Bridge for the specified duration.
| [in] | frequency | The frequency of the tone (Hz) |
| [in] | duration | How long to play the tone (ms). Specifying a duration of 0 will result in a continuous tone (equivalent to calling ToneContinuous(uint16_t frequency) with the supplied frequency). |
| [in] | blocking | (optional) Sets whether the function will block all other operations until the tone has finished playing. Default: false. |
| [in] | forceDuration | (optional) If true, the tone will be made to sound for the full duration specified, regardless of any subsequent tone function calls made before the duration has elapsed. Default: false. |
|
inlineoverridevirtual |
Get connector type.
Reimplemented from ClearCore::DigitalInOut.