Serial Wombat Arduino Library
|
Combine and input and output pin for a protected output. More...
#include <SerialWombatProtectedOutput.h>
Public Member Functions | |
SerialWombatProtectedOutput (SerialWombatChip &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... | |
Public Member Functions inherited from SerialWombatPin | |
SerialWombatPin (SerialWombatChip &serialWombatChip) | |
Instantiates a Serial Wombat Pin. More... | |
SerialWombatPin (SerialWombatChip &serialWombatChip, uint8_t pin) | |
Instantiates a Serial Wombat Pin. More... | |
uint16_t | readPublicData () |
Read the 16 Bit public data associated with this pin. More... | |
void | pinMode (uint8_t mode, bool pullDown=false, bool openDrain=false) |
Set pin to INPUT or OUTPUT, with options for pull Ups and open Drain settings. More... | |
void | digitalWrite (uint8_t val) |
Set output pin High or Low. More... | |
int | digitalRead () |
Reads the state of the Pin. More... | |
uint16_t | writePublicData (uint16_t value) |
Write a 16 bit value to this pin. More... | |
uint8_t | pin () |
Returns the current SW pin number. Used primarily for virtual calls by derived classes. More... | |
uint8_t | swPinModeNumber () |
Returns the Mode number. Used primarily by derived classes to populate packet data. More... | |
Additional Inherited Members | |
Protected Attributes inherited from SerialWombatPin | |
uint8_t | _pin = 255 |
SerialWombatChip & | _sw |
uint8_t | _pinMode = 0 |
Combine and input and output pin for a protected output.
The SerialWombtProtectedOutput class is assigned to a Serial Wombat output pin. 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 chip 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
|
inline |
Constructor for SerialWombatProtectedOutput.
serialWombat | The serial Wombat Chip on which the Protected Output runs |
|
inline |
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 |
|
inline |
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. |
|
inline |
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
|
inline |
Queries the Serial Wombat to see if the protected output has entered safe mode due to a fault.
|
inline |
Turn off protection features and make the protected pin an input.