Serial Wombat 4A and 4B Firmware
|
Classes | |
struct | watchdog_n |
Macros | |
#define | watchdog ((watchdog_t*) CurrentPinRegister) |
Typedefs | |
typedef struct watchdog_n | watchdog_t |
Functions | |
void | initWatchdog () |
Initialization routine for Watchdog pin mode. More... | |
void | updateWatchdog () |
Periodic call to service the Analog Input State Machine for a pin. More... | |
#define watchdog ((watchdog_t*) CurrentPinRegister) |
typedef struct watchdog_n watchdog_t |
void initWatchdog | ( | ) |
Initialization routine for Watchdog pin mode.
Configure the Watchdog pin mode using the CONFIGURE_CHANNEL_MODE_0 command before reading values.
The Watchdog time remaining value is stored in the Pin's 16-bit Public data area. Use the Read Pin Buffer command to retreive it. Units are mS.
Either reconfigure the Watchdog using CONFIGURE_CHANNEL_MODE_0 and CONFIGURE_CHANNEL_MODE_1 before it times out, or write a new value to its public data representing mS until timeout.
Initialize Watchdog. This command needs to be followed by CONFIGURE_CHANNEL_MODE_1 for reliable operation.
BYTE 0 | BYTE 1 | BYTE 2 | BYTE 3 | BYTE 4 | BYTE 5 | BYTE 6 | BYTE 7 |
---|---|---|---|---|---|---|---|
0xC0 | Pin To Set | 0x07 (Watchdog) | Non-Timeout Pin State (0 = Low, 1 = High, 2 = Input) | Timeout Pin State (0 = Low, 1 = High, 2 = Input) | mS Until Timeout low byte) | mS Until Timeout high byte | 0: No Self-Reset on Timeout 1: Serial Wombat Self-Resets on Timeout |
Response:
Command is echoed back.
Examples:
Set pins 1 to be an input as Non-Timeout state, and Low on timeout, and reset the Serial Wombat as well, timeout 30 seconds (30000 mS = 0x7530).
(This is a typical configuration when using the Serial Wombat for as a watchdog for its host).
0xC0 0x01 0x07 0x02 0x00 0x30 0x75 0x01
Determine if Watchdog sets all pins to default states, or just the pin assigned the Watchdog State Machine.
Set time in mS that the Wombat stays in timeout state before self-resetting, if enabled. This pin will be returned to the non-timeout state at the end of this period. Set this time to 0xFFFF to stay in timeout state forever after a timeout until commanded differently by the host.
The Other pin timeout state settings exist as a bitfield, and override the Timeout Pin State from CONFIGURE_CHANNEL_MODE_0.
BYTE 0 | BYTE 1 | BYTE 2 | BYTE 3 | BYTE 4 | BYTE 5 | BYTE 6 | BYTE 7 |
---|---|---|---|---|---|---|---|
0xC1 | Pin To Set | 0x07 (Watchdog) | 0: Use Timeout Pin State on timeout for this pin 1: Set all 4 pins based on bitfield | Other Pins Bitfield (see below) | mS to wait before Self Reset low byte | mS to wait before Self Reset high byte | 0x55* |
*0x55 is recommended, but any byte is acceptable
Other pin bitfield is calculated as follows:
(Pin 0 Setting (0,1 2)) + (Pin 1 Setting (0,1 or 2) * 4 + (Pin 2 Setting (0,1 or 2) * 16 + ( Pin 3 Setting (0,1 or 2) * 64)
Response:
Command is echoed back.
Examples:
Set pin 1 to use the all-pins bitfield, Pin 0 = Input, Pin 1 = Low, Pin 2 = Input, Pin 3 = Input, Self-Reset delay of 100 mS = 0x0064
Bitfield = 2 + 0 * 4 + 2 * 16 + 2 * 64 = 162 = 0xA2
0xC1 0x01 0x07 0x01 0xA2 0x64 0x00 0x55
void updateWatchdog | ( | ) |
Periodic call to service the Analog Input State Machine for a pin.
This function expects to get called every mS.