Serial Wombat Arduino Library
|
A class to wrap around a Serial Wombat Watchdog Pin. More...
#include <SerialWombatWatchdog.h>
Public Member Functions | |
SerialWombatWatchdog (SerialWombatChip &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... | |
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... | |
int16_t | initPacketNoResponse (uint8_t packetNumber, uint8_t param0=0x55, uint8_t param1=0x55, uint8_t param2=0x55, uint8_t param3=0x55, uint8_t param4=0x55) |
int16_t | initPacketNoResponse (uint8_t packetNumber, uint16_t param0=0x55, uint8_t param1=0x55, uint8_t param2=0x55, uint8_t param3=0x55) |
int16_t | initPacketNoResponse (uint8_t packetNumber, uint16_t param0, uint16_t param1, uint8_t param2=0x55) |
int16_t | disable () |
Disables the pin mode (if applicable) More... | |
Additional Inherited Members | |
Protected Attributes inherited from SerialWombatPin | |
uint8_t | _pin = 255 |
SerialWombatChip & | _sw |
uint8_t | _pinMode = 0 |
A class to wrap around a Serial Wombat Watchdog Pin.
The Serial Wombat Watchdog Pin Mode 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 | ( | SerialWombatChip & | serialWombat | ) |
Constructor for SerialWombatWatchdog.
serialWombat | SerialWombat chip 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. |