![]() |
Serial Wombat Arduino Library
|
A class to wrap around a Serial Wombat Watchdog Pin. More...
#include <SerialWombatWatchdog.h>
Public Member Functions | |
SerialWombatWatchdog (SerialWombat &serialWombat) | |
Constructor for SerialWombatWatchdog. More... | |
void | begin (uint8_t pin, SerialWombatPinState_t normalState, SerialWombatPinState_t resetState, uint16_t timeout_mS, bool resetWombatAfterTimeout) |
Initialize a SerialWombatWatchdog. More... | |
void | updateResetCountdown (uint16_t time_mS) |
Reset the countdown timer to a specified number of mS. More... | |
A class to wrap around a Serial Wombat Watchdog Pin.
The Serial Wombat Watchdog is designed to improve system reliability in case of communications loss with the host device. This may be because the communications lines are no longer functional (e.g. I2C bus locked up) or the host ceases to communicate (Such as when an Arduino malfunctions due to issues allocating string memory).
Once enabled, the Serial Wombat Watchdog will change its output and optionally other Serial Wombat outputs to predefined states and optionally reset the Serial Wombat itself if a new Watchdog feeding message isn't received within a period of time specified in the initialization.
The output can be used to reset the host, for instance when connected to an Arduino reset pin, or used to shut off an output. For instance, a motor controlled by a SerialWombatWatchdog pin could be configured to turn off if the host doesn't periodically feed the watchdog.
A video tutorial is available:
SerialWombatWatchdog::SerialWombatWatchdog | ( | SerialWombat & | serialWombat | ) |
Constructor for SerialWombatWatchdog.
serialWombat | SerialWombat on which the SerialWombatWatchdog will run |
void SerialWombatWatchdog::begin | ( | uint8_t | pin, |
SerialWombatPinState_t | normalState, | ||
SerialWombatPinState_t | resetState, | ||
uint16_t | timeout_mS, | ||
bool | resetWombatAfterTimeout | ||
) |
Initialize a SerialWombatWatchdog.
pin | Pin on which the SerialWombat Watchdog will run. Valid values for SW4A: 0-3 SW4B: 1-3. |
normalState | The pin state while the countdown has not expired. Valid values are SW_LOW, SW_HIGH or SW_INPUT |
resetState | The pin state after the countdown has expired. Valid values are SW_LOW, SW_HIGH or SW_INPUT |
timeout_mS | The number of milliseconds before the countdown will expire if not reset. Maximum value of 65535. |
resetWombatAfterTimeout | TRUE: The Serial Wombat will set outputs to resetState, wait 10mS, then reset the Serial Wombat itself. FALSE: Pins stay in resetState, Wombat continues operating |
void SerialWombatWatchdog::updateResetCountdown | ( | uint16_t | time_mS | ) |
Reset the countdown timer to a specified number of mS.
time_mS | number of mS until countdown timer expires. |