![]() |
Serial Wombat Arduino Library
|
Combine and input and output pin for a protected output. More...
#include <serialWombatProtectedOutput.h>
Public Member Functions | |
SerialWombatProtectedOutput (SerialWombat &serialWombat) | |
Constructor for SerialWombatProtectedOutput. More... | |
void | begin (uint8_t pin, uint8_t monitoredPin) |
void | configure (PO_COMPARE_t compareMode, uint16_t compareValue, uint8_t debounceTime, SerialWombatPinState_t activeState, SerialWombatPinState_t safeState) |
bool | isInSafeState () |
Queries the Serial Wombat to see if the protected output has entered safe mode due to a fault. More... | |
void | makeInput () |
Turn off protection features and make the protected pin an input. More... | |
void | digitalWrite (uint8_t state) |
Turn off the protection features and make the protected pin an unprotected output. More... | |
Combine and input and output pin for a protected output.
The SerialWombtProtectedOutput class is assigned to a Serial Wombat output. It monitors another previously configured pin's public data, such as a digital I/O value or an Analog input. If the monitored value does not meet expectations, then the protected pin changes values to a configured state. This allows the Serial Wombat to constantly verify a condition without the need for constant polling from the host device.
The period of time that a mismatch must occur before going to the safeState is configurable.
Video Tutorial
SerialWombatProtectedOutput::SerialWombatProtectedOutput | ( | SerialWombat & | serialWombat | ) |
Constructor for SerialWombatProtectedOutput.
serialWombat | The serial Wombat on which the Protected Output runs |
void SerialWombatProtectedOutput::begin | ( | uint8_t | pin, |
uint8_t | monitoredPin | ||
) |
Initialize the Protected Output. No pin state changes happen with this function
pin | The output pin of the Protected output Valid values for SW4A: 0-3 SW4B: 1-3 |
monitoredPin | The input pin for the Protected Output. Must be initialized before this call |
void SerialWombatProtectedOutput::configure | ( | PO_COMPARE_t | compareMode, |
uint16_t | compareValue, | ||
uint8_t | debounceTime, | ||
SerialWombatPinState_t | activeState, | ||
SerialWombatPinState_t | safeState | ||
) |
Configure a protected output. This function will change the pin output to activeState unless fault conditions are met
compareMode | Enumerated type of PO_COMPARE_t . |
compareValue | A 16 bit unsigned value that will be compared with the public data from the monitored pin and compared based on compareMode |
debounceTime | How long, in mS the compareMode fault condition must exist before transitioning to safeState |
activeState | The initial, pre-fault state for the output (SW_LOW, SW_HIGH, SW_INPUT). Do not use Arduino HIGH or LOW or INPUT constants. |
safeState | The safe, post-fault state for the output (SW_LOW, SW_HIGH, SW_INPUT). Do not use Arduino HIGH or LOW or INPUT constants. |
void SerialWombatProtectedOutput::digitalWrite | ( | uint8_t | state | ) |
Turn off the protection features and make the protected pin an unprotected output.
This function is compatible with the Arduino digital write, and therefore uses HIGH and LOW as parameters rather than SW_HIGH or SW_LOW /param state HIGH or LOW
bool SerialWombatProtectedOutput::isInSafeState | ( | ) |
Queries the Serial Wombat to see if the protected output has entered safe mode due to a fault.
void SerialWombatProtectedOutput::makeInput | ( | ) |
Turn off protection features and make the protected pin an input.