Laelaps  2.3.5
RoadNarrows Robotics Small Outdoor Mobile Robot Project
laeWatchDog.h
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////////////
2 //
3 // Package: Laelaps
4 //
5 // File: laeWatchDog.h
6 //
7 /*! \file
8  *
9  * \brief Laelaps built-in Arduino sub-processor.
10  *
11  * The Arduino serves to monitor the system health and to control the system
12  * RBG Status LED, along with user exposed GPIO and analog pins.
13  *
14  * This file is included in both Laelaps software and the Arduino firmware.
15  * KEEP IT SIMPLE.
16  *
17  * \author Robin Knight (robin.knight@roadnarrows.com)
18  *
19  * \par Copyright
20  * \h_copy 2015-2017. RoadNarrows LLC.\n
21  * http://www.roadnarrows.com\n
22  * All Rights Reserved
23  */
24 /*
25  * @EulaBegin@
26  *
27  * Unless otherwise stated explicitly, all materials contained are copyrighted
28  * and may not be used without RoadNarrows LLC's written consent,
29  * except as provided in these terms and conditions or in the copyright
30  * notice (documents and software) or other proprietary notice provided with
31  * the relevant materials.
32  *
33  * IN NO EVENT SHALL THE AUTHOR, ROADNARROWS LLC, OR ANY
34  * MEMBERS/EMPLOYEES/CONTRACTORS OF ROADNARROWS OR DISTRIBUTORS OF THIS SOFTWARE
35  * BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR
36  * CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS
37  * DOCUMENTATION, EVEN IF THE AUTHORS OR ANY OF THE ABOVE PARTIES HAVE BEEN
38  * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
39  *
40  * THE AUTHORS AND ROADNARROWS LLC SPECIFICALLY DISCLAIM ANY WARRANTIES,
41  * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
42  * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS ON AN
43  * "AS IS" BASIS, AND THE AUTHORS AND DISTRIBUTORS HAVE NO OBLIGATION TO
44  * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
45  *
46  * @EulaEnd@
47  */
48 ////////////////////////////////////////////////////////////////////////////////
49 
50 #ifndef _LAE_WATCHDOG_H
51 #define _LAE_WATCHDOG_H
52 
53 //
54 // WatchDog Version
55 //
56 #ifdef LAE_WD_FW_VERSION
57 #define LAE_WD_VERSION LAE_WD_FW_VERSION ///< watchdog fw version.
58 #else
59 #define LAE_WD_VERSION 1 ///< watchdog sw/fw version.
60 #endif
61 
62 /*!
63  * \brief The \h_laelaps namespace encapsulates all \h_laelaps related
64  * constructs.
65  */
66 #ifndef SWIG
67 namespace laelaps
68 {
69 #endif // SWIG
70  //----------------------------------------------------------------------------
71  // Common Interface Values
72  //----------------------------------------------------------------------------
73 
74  //
75  // Pass/Fail
76  //
77  const byte_t LaeWdArgFail = 0; ///< command failure response
78  const byte_t LaeWdArgPass = 1; ///< command success response
79 
80  //
81  // Watchdog timeout (msec)
82  //
83  const unsigned long LaeWdTimeoutDft = 6000; ///< watchdog timeout default
84  const unsigned long LaeWdTimeoutMin = 10; ///< watchdog timeout minimum
85  const unsigned long LaeWdTimeoutMax = 60000; ///< watchdog timeout maximum
86 
87  //
88  // Batgtery State of Charge
89  //
90  const unsigned int LaeWdArgBattSoCMin = 0; ///< 0% charge
91  const unsigned int LaeWdArgBattSoCMax = 100; ///< 100% charge
92 
93  //
94  // Alarm bits
95  //
96  const unsigned int LaeWdArgAlarmNone = 0x0000; ///< no/clear alarms
97  const unsigned int LaeWdArgAlarmGen = 0x0001; ///< general alarm
98  const unsigned int LaeWdArgAlarmBatt = 0x0002; ///< battery low alarm
99  const unsigned int LaeWdArgAlarmTemp = 0x0004; ///< temperature alarm
100  const unsigned int LaeWdArgAlarmEStop = 0x0008; ///< emergency stop
101  const unsigned int LaeWdArgAlarmBattCrit = 0x1000; ///< batt crit modifier
102  const unsigned int LaeWdArgAlarmCrit = 0x2000; ///< crit alarm modifier
103  const unsigned int LaeWdArgAlarmTypeMask = 0x0fff; ///< alarm types mask
104  const unsigned int LaeWdArgAlarmMask = 0x3fff; ///< alarm valid bits mask
105 
106  //
107  // LED values
108  //
109  const byte_t LaeWdArgRgbLedMin = 0; ///< no channel color
110  const byte_t LaeWdArgRgbLedMax = 255; ///< full channel color
111 
112  //
113  // Common digital pin arguments.
114  //
115  const byte_t LaeWdArgDPinNumMin = 2; ///< min pin number
116  const byte_t LaeWdArgDPinNumWMin = 5; ///< min write/modify pin number
117  const byte_t LaeWdArgDPinNumWMax = 8; ///< max write/modify pin number
118  const byte_t LaeWdArgDPinNumMax = 8; ///< max pin number
119 
120  const byte_t LaeWdArgDPinDirIn = 0; ///< input
121  const byte_t LaeWdArgDPinDirOut = 1; ///< output
122 
123  const byte_t LaeWdArgDPinValLow = 0; ///< pin is low (0V)
124  const byte_t LaeWdArgDPinValHigh = 1; ///< pin is high (Vcc)
125 
126  //
127  // Common analog pin arguments.
128  //
129  const byte_t LaeWdArgAInPinNumMin = 14; ///< analog input min pin number
130  const byte_t LaeWdArgAInPinNumMax = 17; ///< analog input max pin number
131 
132  const int LaeWdArgAInPinValMin = 0; ///< analog input minimum value
133  const int LaeWdArgAInPinValMax = 1023; ///< analog input maximum value
134 
135  const byte_t LaeWdArgAOutPinNumMin = 2; ///< analog output min pin number
136  const byte_t LaeWdArgAOutPinNumMax = 8; ///< analog output max pin number
137 
138  const int LaeWdArgAOutPinValMin = 0; ///< analog output minimum value
139  const int LaeWdArgAOutPinValMax = 255; ///< analog output maximum value
140 
141 
142  //----------------------------------------------------------------------------
143  // I2C Slave Binary Interface
144  //
145  // The I2C inteface is a big-endian, byte oriented, binary interface. Any
146  // signed numbers are in 2-compliment format.
147  //
148  // The (Partial) BNF
149  //
150  // cmd ::= cmd_id, {byte}
151  // rsp ::= {byte}
152  // errrsp ::= fail, [cmd_id, [abc_pat_0...]]]
153  //
154  // cmd_id ::= u8
155  // fail ::= u8 [0]
156  // abc_pat_k ::= u8 [A, B, C, ...]
157  //----------------------------------------------------------------------------
158 
159  //. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
160  // I2C Addressing and Packet Format
161  //. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
162 
163  // badly named - once was only 1 arduino
164  const byte_t LaeI2CAddrArduino = 0x32; ///< arduino \h_i2c 7-bit address
165  const byte_t LaeI2CAddrWd = 0x32; ///< watchdog \h_i2c address synonym
166 
167  const int LaeWdMaxCmdLen = 8; ///< maximum command length
168  const int LaeWdMaxRspLen = 8; ///< maximum response length
169 
170  //. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
171  // I2C Commands and Responses
172  //. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
173 
174  //
175  // Pet watchdog command and response.
176  //
177  // Command format: cmd_id
178  // Response format(v1): N/A
179  // Response format(v2+): is_charging
180  //
181  // Argument data types and ranges:
182  // is_charging ::= u8 {0 | 1}
183  //
184  const byte_t LaeWdCmdIdPetDog = 0; ///< command id
185  const byte_t LaeWdCmdLenPetDog = 1; ///< command length (bytes)
186  const byte_t LaeWdRspLenPetDog = 0; ///< v1 response length (bytes)
187  const byte_t LaeWdRspLenPetDog_2 = 1; ///< v2 response length (bytes)
188 
189  // ---
190 
191  //
192  // Get firmware version command and response.
193  //
194  // Command format: cmd_id
195  // Response format: fw_version
196  //
197  // Argument data types and ranges:
198  // fw_version ::= u8 [1-255]
199  //
200  const byte_t LaeWdCmdIdGetVersion = 1; ///< command id
201  const byte_t LaeWdCmdLenGetVersion = 1; ///< command length (bytes)
202  const byte_t LaeWdRspLenGetVersion = 1; ///< response length (bytes)
203 
204  // ---
205 
206  //
207  // Set battery state of charge command and response.
208  //
209  // Command format: cmd_id batt_charge
210  // Response format: N/A
211  //
212  // Argument data types and ranges:
213  // batt_charge ::= u8 [0%-100%]
214  //
215  const byte_t LaeWdCmdIdSetBattCharge = 2; ///< command id
216  const byte_t LaeWdCmdLenSetBattCharge = 2; ///< command length (bytes)
217  const byte_t LaeWdRspLenSetBattCharge = 0; ///< response length (bytes)
218 
219  // ---
220 
221  //
222  // Set robot alarms command and response.
223  //
224  // Command format: cmd_id alarm_bits_high alarm_bits_low
225  // Response format: N/A
226  //
227  // Argument data types and ranges:
228  // alarm_bits_high ::= u8 [0x00 - 0xff]
229  // alarm_bits_low ::= u8 [0x00 - 0xff]
230  //
231  const byte_t LaeWdCmdIdSetAlarms = 3; ///< command id
232  const byte_t LaeWdCmdLenSetAlarms = 3; ///< command length (bytes)
233  const byte_t LaeWdRspLenSetAlarms = 0; ///< response length (bytes)
234 
235  // ---
236 
237  //
238  // Set LED RGB color command and response.
239  //
240  // Command format: cmd_id red green blue
241  // Response format: N/A
242  //
243  // Argument data types and ranges:
244  // red ::= u8 [0-255]
245  // green ::= u8 [0-255]
246  // blue ::= u8 [0-255]
247  //
248  const byte_t LaeWdCmdIdSetRgbLed = 4; ///< command id
249  const byte_t LaeWdCmdLenSetRgbLed = 4; ///< command length (bytes)
250  const byte_t LaeWdRspLenSetRgbLed = 0; ///< response length (bytes)
251 
252  // ---
253 
254  //
255  // Reset LED RGB color to state defaults.
256  //
257  // Command format: cmd_id
258  // Response format: N/A
259  //
260  const byte_t LaeWdCmdIdResetRgbLed = 5; ///< command id
261  const byte_t LaeWdCmdLenResetRgbLed = 1; ///< command length (bytes)
262  const byte_t LaeWdRspLenResetRgbLed = 0; ///< response length (bytes)
263 
264  // ---
265 
266  //
267  // Configure digital pin command and response.
268  //
269  // Deprecated in v3+.
270  //
271  // Command format: cmd_id pin_num pin_dir
272  // Response format: N/A
273  //
274  // Argument data types and ranges:
275  // pin_num ::= u8 [2-8]
276  // pin_dir ::= u8 {0 | 1}
277  //
278  const byte_t LaeWdCmdIdConfigDPin = 6; ///< command id
279  const byte_t LaeWdCmdLenConfigDPin = 3; ///< command length (bytes)
280  const byte_t LaeWdRspLenConfigDPin = 0; ///< response length (bytes)
281 
282  // ---
283 
284  //
285  // Read digital pin command and response.
286  //
287  // Deprecated in v3+.
288  //
289  // Command format: cmd_id pin_num
290  // Response format: pin_num pin_val
291  //
292  // Argument data types and ranges:
293  // pin_num ::= u8 [2-8]
294  // pin_val ::= u8 {0 | 1}
295  //
296  const byte_t LaeWdCmdIdReadDPin = 7; ///< command id
297  const byte_t LaeWdCmdLenReadDPin = 2; ///< command length (bytes)
298  const byte_t LaeWdRspLenReadDPin = 2; ///< response length (bytes)
299 
300  // ---
301 
302  //
303  // Write digital pin command and response.
304  //
305  // Deprecated in v3+.
306  //
307  // Command format: cmd_id pin_num pin_val
308  // Response format: N/A
309  //
310  // Argument data types and ranges:
311  // pin_num ::= u8 [2-8]
312  // pin_val ::= u8 {0 | 1}
313  //
314  const byte_t LaeWdCmdIdWriteDPin = 8; ///< command id
315  const byte_t LaeWdCmdLenWriteDPin = 3; ///< command length (bytes)
316  const byte_t LaeWdRspLenWriteDPin = 0; ///< response length (bytes)
317 
318  // ---
319 
320  //
321  // Read analog pin command and response.
322  //
323  // Deprecated in v3+.
324  //
325  // Command format: cmd_id pin_num
326  // Response format: pin_num pin_val_high pin_val_low
327  //
328  // Argument data types and ranges:
329  // pin_num ::= u8 [14-17]
330  // pin_val_high ::= u8 [0x00 - 0x03]
331  // pin_val_low ::= u8 [0x00 - 0xff]
332  //
333  const byte_t LaeWdCmdIdReadAPin = 9; ///< command id
334  const byte_t LaeWdCmdLenReadAPin = 2; ///< command length (bytes)
335  const byte_t LaeWdRspLenReadAPin = 3; ///< response length (bytes)
336 
337  //
338  // Write digital pin as analog PWM command and response.
339  //
340  // Deprecated in v3+.
341  //
342  // Command format: cmd_id pin_num pin_val
343  // Response format: N/A
344  //
345  // Argument data types and ranges:
346  // pin_num ::= u8 [2-8]
347  // pin_val ::= u8 [0x00-0xff]
348  //
349  const byte_t LaeWdCmdIdWriteAPin = 10; ///< command id
350  const byte_t LaeWdCmdLenWriteAPin = 3; ///< command length (bytes)
351  const byte_t LaeWdRspLenWriteAPin = 0; ///< response length (bytes)
352 
353  // ---
354 
355  //
356  // Enable/disable power to motor controllers.
357  //
358  // Command format: cmd_id pin_val
359  // Response format: pass_fail
360  //
361  // Argument data types and ranges:
362  // pin_val ::= u8 {0 | 1}
363  // pass_fail ::= u8 {0 | 1}
364  //
365  const byte_t LaeWdCmdIdEnableMotorCtlrs = 11; ///< command id
366  const byte_t LaeWdCmdLenEnableMotorCtlrs = 2; ///< command length (bytes)
367  const byte_t LaeWdRspLenEnableMotorCtlrs = 1; ///< response length (bytes)
368 
369  // ---
370 
371  //
372  // Enable/disable power to auxilliary ports.
373  //
374  // Command format: cmd_id aux_port pin_val
375  // Response format: N/A
376  //
377  // Argument data types and ranges:
378  // aux_port ::= u8 {1 | 2}
379  // pin_val ::= u8 {0 | 1}
380  //
381  const byte_t LaeWdCmdIdEnableAuxPort = 12; ///< command id
382  const byte_t LaeWdCmdLenEnableAuxPort = 3; ///< command length (bytes)
383  const byte_t LaeWdRspLenEnableAuxPort = 0; ///< response length (bytes)
384 
385  const byte_t LaeWdArgAuxPortBatt = 1; ///< battery auxlliary port
386  const byte_t LaeWdArgAuxPort5V = 2; ///< regulated 5 volt auxilliary port
387 
388  // ---
389 
390  //
391  // Read enable lines.
392  //
393  // Command format: cmd_id
394  // Response format: en_motor_ctlrs en_aux_port_batt en_aux_port_5v
395  //
396  // Argument data types and ranges:
397  // en_motor_ctlrs ::= u8 {0 | 1}
398  // en_aux_port_batt ::= u8 {0 | 1}
399  // en_aux_port_5v ::= u8 {0 | 1}
400  //
401  const byte_t LaeWdCmdIdReadEnables = 13; ///< command id
402  const byte_t LaeWdCmdLenReadEnables = 0; ///< command length (bytes)
403  const byte_t LaeWdRspLenReadEnables = 3; ///< response length (bytes)
404 
405  // ---
406 
407  //
408  // Read sensed volatages * 10.
409  //
410  // Command format: cmd_id
411  // Response format: jack_v batt_v
412  //
413  // Argument data types and ranges:
414  // jack_v ::= v_10
415  // batt_v ::= v_10
416  // v_10 ::= u8 [0-255]
417  //
418  // Conversions:
419  // volts = v_10 * 0.1
420  //
421  // Examples:
422  // if val = 5 then volts = v_10 * 0.1 = 0.5
423  // if val = 112 then volts = v_10 * 0.1 = 11.2
424  //
425  const byte_t LaeWdCmdIdReadVolts = 14; ///< command id
426  const byte_t LaeWdCmdLenReadVolts = 1; ///< command length (bytes)
427  const byte_t LaeWdRspLenReadVolts = 2; ///< response length (bytes)
428 
429  const float LaeWdArgVMult = 10.0; ///< voltage multiplier
430  const float LaeWdArgVScale = 0.1; ///< voltage scaler
431 
432  // ---
433 
434  //
435  // Test watchdog state command and response.
436  //
437  // Deprecated in v3+.
438  //
439  //
440  // Command format: cmd_id
441  // Response format: seq_num op_state alarm_bits_high alarm_bits_low led_index
442  //
443  // Argument data types and ranges:
444  // seq_num ::= u8 [0-255]
445  // op_state ::= u8
446  // alarm_bits_high ::= u8
447  // alarm_bits_low ::= u8
448  // led_index ::= u8
449  //
450  const byte_t LaeWdCmdIdTest = 15; ///< command id
451  const byte_t LaeWdCmdLenTest = 1; ///< command length (bytes)
452  const byte_t LaeWdRspLenTest = 5; ///< v1 response length (bytes)
453 
454  // ---
455 
456  //
457  // Configure firmware operation.
458  //
459  // V3+ command only.
460  //
461  // Command format: cmd_id timeout_high timeout_low
462  // Response format: N/A
463  //
464  // Argument data types and ranges:
465  // timeout_high ::= u8
466  // timeout_low ::= u8
467  //
468  // Conversions:
469  // timeout = timeout_high << 8 + timeout_low
470  //
471  const byte_t LaeWdCmdIdConfigFw = 16; ///< command id
472  const byte_t LaeWdCmdLenConfigFw = 3; ///< command length (bytes)
473  const byte_t LaeWdRspLenConfigFw = 0; ///< v1 response length (bytes)
474 
475 
476  //----------------------------------------------------------------------------
477  // Serial ASCII Interface
478  //
479  // The (Partial) BNF
480  //
481  // cmd ::= CMD_ID, {arg}, EOC
482  // rsp ::= CMD_ID, {arg}, EOR
483  // | ERROR_RSP_ID, CMD_ID, {arg}, EOR
484  //
485  // CMD_ID ::= 'a' | 'b' | 'h' | 'l' | 'm' | 'p' | 'r' | 'u' | 'v'
486  // ERROR_RSP_ID ::= 'E'
487  // EOC ::= '\n'
488  // EOR ::= '\n'
489  //
490  // OP_GET_SET ::= 'g' | 's'
491  // OP_RESET ::= 'r'
492  // OP_GET_SET_RESET ::= OP_GET_SET | OP_RESET
493  // OFF_ON ::= '0' | '1'
494  // STET ::= '-'
495  //
496  // INT ::= OCTAL | DECIMAL | HEX
497  //
498  // OCTAL ::= ['-'] '0', {oct_digit}
499  // oct_digit ::= '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7'
500  //
501  // DECIMAL ::= ['-'] nonzero_dec_digit, {dec_digit}
502  // nonzero_dec_digit ::= '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9'
503  // dec_digit ::= '0' | nonzero_dec_digit
504  //
505  // HEX ::= ['-'] hex_pre, hex_digit, {hex_digit}
506  // hex_pre ::= '0x' | '0X'
507  // hex_digit ::= dec_digit | hex_alpha_lower | hex_alpha_upper
508  // hex_alpha_lower ::= 'a' | 'b' | 'c' | 'd' | 'e' | 'f'
509  // hex_alpha_upper ::= 'A' | 'B' | 'C' | 'D' | 'E' | 'F'
510  //
511  // FLOAT ::= ['-'], dec_digit, {dec_digit}
512  // | ['-'], dec_digit, {dec_digit}, '.', {dec_digit}
513  // | ['-'], {dec_digit}, '.', dec_digit, {dec_digit}
514  //----------------------------------------------------------------------------
515 
516  // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
517  // Serial Message Format
518  // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
519 
520  // sizes
521  const byte_t LaeWdSerMaxCmdLen = 80; ///< max command length (bytes)
522  const byte_t LaeWdSerMaxCmdArgc = 8; ///< max cmd argument count
523  const byte_t LaeWdSerMaxCmdArgLen = 8; ///< max cmd arg length (bytes)
524  const byte_t LaeWdSerMaxRspLen = 80; ///< max rsp line length (bytes)
525  const byte_t LaeWdSerMaxRspArgc = 8; ///< max rsp argument count
526  const byte_t LaeWdSerMaxRspArgLen = 16; ///< max rsp arg length (bytes)
527 
528  // separators
529  const char LaeWdSerEoC = '\n'; ///< end of command
530  const char LaeWdSerEoR = '\n'; ///< end of response
531  const char LaeWdSerSep = ' '; ///< argument separator(s)
532 
533  // common string arguments
534  const char LaeWdSerArgOff[] = "0"; ///< off state argument string
535  const char LaeWdSerArgOn[] = "1"; ///< on state argument string
536  const char LaeWdSerArgGet[] = "g"; ///< get operator argument string
537  const char LaeWdSerArgSet[] = "s"; ///< set operator argument string
538  const char LaeWdSerArgReset[] = "r"; ///< reset operator argument string
539  const char LaeWdSerArgStet[] = "-"; ///< leave as is operator arg string
540  const char LaeWdSerArgErrRsp[] = "E"; ///< response error argument string
541 
542  // common values
543  const char LaeWdSerOpGet = 'g'; ///< get operator value
544  const char LaeWdSerOpSet = 's'; ///< set operator value
545  const char LaeWdSerOpReset = 'r'; ///< reset operator value
546  const char LaeWdSerOpBad = '?'; ///< unknown/bad operator
547 
548  // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
549  // Serial Commands and Responses
550  // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
551 
552  //
553  // Print help command and response.
554  //
555  // Command format: 'h' EOC
556  // Response format: synopsis_0 EOR
557  // synopsis_1 EOR
558  // ...
559  // synopsis_n EOR
560  // Arguments:
561  // synopsis_k ::= CMD_ID [args] '-' brief
562  //
563  // Note: This command's use is intended only in user interactive mode.
564  //
565  const char LaeWdSerCmdIdHelp = 'h'; ///< serial command id
566 
567  //
568  // Get firmware version command and response.
569  //
570  // Command format: 'v' EOC
571  // Response format: 'v' product subproc fw_version EOR
572  // Arguments:
573  // product ::= ROADNARROWS_PRODUCT_NAME
574  // subproc ::= SUBPROCESSOR_NAME
575  // fw_version ::= DECIMAL
576  //
577  const char LaeWdSerCmdIdGetVersion = 'v'; ///< serial command id
578  const byte_t LaeWdSerCmdArgcGetVersion = 1; ///< cmd argument count
579  const byte_t LaeWdSerRspArgcGetVersion = 4; ///< rsp argument count
580 
581  //
582  // Pet the watchdog command and response.
583  //
584  // Command format: 'p' EOC
585  // Response format: 'p' is_charging EOR
586  // Arguments:
587  // is_charging ::= OFF_ON
588  //
589  const char LaeWdSerCmdIdPetTheDog = 'p'; ///< serial command id
590  const byte_t LaeWdSerCmdArgcPetTheDog = 1; ///< cmd argument count
591  const byte_t LaeWdSerRspArgcPetTheDog = 2; ///< rsp argument count
592 
593  //
594  // Get/set firmware operation configuration.
595  //
596  // Command format: 'c' op [config] EOC
597  // Response format: 'c' config EOR
598  // Arguments:
599  // op ::= OP_GET_SET
600  // config ::= timeout
601  // timeout ::= INT [10-60000]
602  //
603  const char LaeWdSerCmdIdOpConfig = 'c'; ///< serial command id
604  const byte_t LaeWdSerCmdArgcGetConfig = 2; ///< get cmd argument count
605  const byte_t LaeWdSerCmdArgcSetConfig = 3; ///< set cmd argument count
606  const byte_t LaeWdSerRspArgcOpConfig = 2; ///< rsp argument count
607 
608  //
609  // Get/set battery state of charge command and response.
610  //
611  // Command format: 'b' op [batt_soc] EOC
612  // Response format: 'b' batt_soc EOR
613  // Arguments:
614  // op ::= OP_GET_SET
615  // batt_charge ::= INT [0-100]
616  //
617  const char LaeWdSerCmdIdOpBattSoC = 'b'; ///< serial command id
618  const byte_t LaeWdSerCmdArgcGetBattSoC = 2; ///< get cmd argument count
619  const byte_t LaeWdSerCmdArgcSetBattSoC = 3; ///< set cmd argument count
620  const byte_t LaeWdSerRspArgcOpBattSoC = 2; ///< rsp argument count
621 
622  //
623  // Get/set robot alarms command and response.
624  //
625  // Command format: 'a' op [alarm_bits] EOC
626  // Response format: 'a' alarm_bits EOR
627  // Arguments:
628  // op ::= OP_GET_SET
629  // alarm_bits ::= INT
630  //
631  const char LaeWdSerCmdIdOpAlarms = 'a'; ///< serial command id
632  const byte_t LaeWdSerCmdArgcGetAlarms = 2; ///< get cmd argument count
633  const byte_t LaeWdSerCmdArgcSetAlarms = 3; ///< set cmd argument count
634  const byte_t LaeWdSerRspArgcOpAlarms = 2; ///< rsp argument count
635 
636  //
637  // Get/set/reset LED RGB color command and response.
638  //
639  // Command format: 'l' op [red green blue] EOC
640  // Response format: 'l' red green blue EOR
641  // Arguments:
642  // op ::= OP_GET_SET_RESET
643  // red ::= color
644  // green ::= color
645  // blue ::= color
646  // color ::= INT [0-255]
647  //
648  const char LaeWdSerCmdIdOpLed = 'l'; ///< serial command id
649  const byte_t LaeWdSerCmdArgcGetLed = 2; ///< get cmd argument count
650  const byte_t LaeWdSerCmdArgcSetLed = 5; ///< set cmd argument count
651  const byte_t LaeWdSerCmdArgcResetLed = 2; ///< reset cmd argument count
652  const byte_t LaeWdSerRspArgcOpLed = 4; ///< rsp argument count
653 
654  //
655  // Get/set motor controlers power-in enable line.
656  //
657  // Command format: 'm' op [motor_ctlrs] EOC
658  // Response format: 'm' motor_ctlrs EOR
659  // Arguments:
660  // op ::= OP_GET_SET
661  // motor_ctlrs ::= OFF_ON
662  //
663  const char LaeWdSerCmdIdOpEnMotorCtlrs = 'm'; ///< serial command id
664  const byte_t LaeWdSerCmdArgcGetEnMotorCtlrs = 2; ///< get cmd argument count
665  const byte_t LaeWdSerCmdArgcSetEnMotorCtlrs = 3; ///< set cmd argument count
666  const byte_t LaeWdSerRspArgcOpEnMotorCtlrs = 2; ///< rsp argument count
667 
668  //
669  // Get/set auxilliary ports power-out enable line.
670  //
671  // Command format: 'x' op [aux_batt aux_5v] EOC
672  // Response format: 'x' aux_port_batt aux_port_5v EOR
673  // Arguments:
674  // op ::= OP_GET_SET
675  // aux_port_batt ::= OFF_ON
676  // aux_port_5v ::= OFF_ON
677  //
678  const char LaeWdSerCmdIdOpEnAuxPorts = 'x'; ///< serial command id
679  const byte_t LaeWdSerCmdArgcGetEnAuxPorts = 2; ///< get cmd argument count
680  const byte_t LaeWdSerCmdArgcSetEnAuxPorts = 4; ///< set cmd argument count
681  const byte_t LaeWdSerRspArgcOpEnAuxPorts = 3; ///< rsp argument count
682 
683  //
684  // Read sensed volatages.
685  //
686  // Command format: 'r' EOC
687  // Response format: 'r' jack_v batt_v EOR
688  // Arguments:
689  // jack_v ::= FLOAT
690  // batt_v ::= FLOAT
691  //
692  const byte_t LaeWdSerCmdIdReadVolts = 'r'; ///< serial command id
693  const byte_t LaeWdSerCmdArgcReadVolts = 1; ///< cmd argument count
694  const byte_t LaeWdSerRspArgcReadVolts = 3; ///< rsp argument count
695 
696 #ifndef SWIG
697 } // namespace laelaps
698 #endif // SWIG
699 
700 
701 #endif // _LAE_WATCHDOG_H
const int LaeWdArgAOutPinValMin
analog output minimum value
Definition: laeWatchDog.h:138
const unsigned long LaeWdTimeoutDft
watchdog timeout default
Definition: laeWatchDog.h:83
const byte_t LaeWdSerRspArgcOpBattSoC
rsp argument count
Definition: laeWatchDog.h:620
const byte_t LaeWdRspLenSetBattCharge
response length (bytes)
Definition: laeWatchDog.h:217
const byte_t LaeWdSerCmdArgcSetAlarms
set cmd argument count
Definition: laeWatchDog.h:633
const byte_t LaeWdSerCmdIdReadVolts
serial command id
Definition: laeWatchDog.h:692
const byte_t LaeWdCmdLenTest
command length (bytes)
Definition: laeWatchDog.h:451
const byte_t LaeWdCmdIdReadVolts
command id
Definition: laeWatchDog.h:425
const byte_t LaeWdSerCmdArgcSetBattSoC
set cmd argument count
Definition: laeWatchDog.h:619
const byte_t LaeWdRspLenResetRgbLed
response length (bytes)
Definition: laeWatchDog.h:262
const byte_t LaeWdCmdLenReadAPin
command length (bytes)
Definition: laeWatchDog.h:334
const byte_t LaeWdArgFail
command failure response
Definition: laeWatchDog.h:77
const byte_t LaeWdArgRgbLedMin
no channel color
Definition: laeWatchDog.h:109
const byte_t LaeWdCmdLenConfigDPin
command length (bytes)
Definition: laeWatchDog.h:279
const byte_t LaeWdCmdLenReadVolts
command length (bytes)
Definition: laeWatchDog.h:426
const byte_t LaeWdSerMaxRspLen
max rsp line length (bytes)
Definition: laeWatchDog.h:524
const byte_t LaeWdArgDPinNumMin
min pin number
Definition: laeWatchDog.h:115
const int LaeWdArgAOutPinValMax
analog output maximum value
Definition: laeWatchDog.h:139
const char LaeWdSerCmdIdOpEnMotorCtlrs
serial command id
Definition: laeWatchDog.h:663
const byte_t LaeWdArgDPinNumMax
max pin number
Definition: laeWatchDog.h:118
const byte_t LaeWdSerCmdArgcGetConfig
get cmd argument count
Definition: laeWatchDog.h:604
const byte_t LaeWdCmdIdEnableMotorCtlrs
command id
Definition: laeWatchDog.h:365
const float LaeWdArgVScale
voltage scaler
Definition: laeWatchDog.h:430
const byte_t LaeWdCmdIdSetRgbLed
command id
Definition: laeWatchDog.h:248
const unsigned int LaeWdArgAlarmCrit
crit alarm modifier
Definition: laeWatchDog.h:102
const byte_t LaeWdArgAOutPinNumMin
analog output min pin number
Definition: laeWatchDog.h:135
const byte_t LaeWdCmdIdTest
command id
Definition: laeWatchDog.h:450
const byte_t LaeWdCmdLenReadDPin
command length (bytes)
Definition: laeWatchDog.h:297
const unsigned int LaeWdArgAlarmEStop
emergency stop
Definition: laeWatchDog.h:100
const unsigned long LaeWdTimeoutMax
watchdog timeout maximum
Definition: laeWatchDog.h:85
const char LaeWdSerArgSet[]
set operator argument string
Definition: laeWatchDog.h:537
const byte_t LaeWdSerRspArgcOpEnAuxPorts
rsp argument count
Definition: laeWatchDog.h:681
const byte_t LaeWdCmdLenEnableAuxPort
command length (bytes)
Definition: laeWatchDog.h:382
const byte_t LaeWdCmdLenWriteAPin
command length (bytes)
Definition: laeWatchDog.h:350
const byte_t LaeWdRspLenPetDog
v1 response length (bytes)
Definition: laeWatchDog.h:186
const byte_t LaeWdRspLenEnableAuxPort
response length (bytes)
Definition: laeWatchDog.h:383
const unsigned int LaeWdArgBattSoCMax
100% charge
Definition: laeWatchDog.h:91
const byte_t LaeWdRspLenEnableMotorCtlrs
response length (bytes)
Definition: laeWatchDog.h:367
const byte_t LaeWdCmdLenSetRgbLed
command length (bytes)
Definition: laeWatchDog.h:249
const byte_t LaeWdSerRspArgcGetVersion
rsp argument count
Definition: laeWatchDog.h:579
const byte_t LaeWdRspLenWriteAPin
response length (bytes)
Definition: laeWatchDog.h:351
const byte_t LaeWdRspLenConfigDPin
response length (bytes)
Definition: laeWatchDog.h:280
const byte_t LaeWdArgAInPinNumMax
analog input max pin number
Definition: laeWatchDog.h:130
const byte_t LaeWdRspLenWriteDPin
response length (bytes)
Definition: laeWatchDog.h:316
const char LaeWdSerCmdIdGetVersion
serial command id
Definition: laeWatchDog.h:577
const float LaeWdArgVMult
voltage multiplier
Definition: laeWatchDog.h:429
const byte_t LaeWdSerCmdArgcResetLed
reset cmd argument count
Definition: laeWatchDog.h:651
const char LaeWdSerCmdIdOpEnAuxPorts
serial command id
Definition: laeWatchDog.h:678
const byte_t LaeWdArgDPinValHigh
pin is high (Vcc)
Definition: laeWatchDog.h:124
const byte_t LaeWdRspLenTest
v1 response length (bytes)
Definition: laeWatchDog.h:452
const byte_t LaeWdArgRgbLedMax
full channel color
Definition: laeWatchDog.h:110
const byte_t LaeWdCmdIdGetVersion
command id
Definition: laeWatchDog.h:200
const char LaeWdSerCmdIdOpLed
serial command id
Definition: laeWatchDog.h:648
const byte_t LaeWdArgDPinDirIn
input
Definition: laeWatchDog.h:120
const byte_t LaeWdSerMaxCmdArgc
max cmd argument count
Definition: laeWatchDog.h:522
const byte_t LaeWdCmdLenReadEnables
command length (bytes)
Definition: laeWatchDog.h:402
const byte_t LaeWdCmdLenGetVersion
command length (bytes)
Definition: laeWatchDog.h:201
const char LaeWdSerSep
argument separator(s)
Definition: laeWatchDog.h:531
const byte_t LaeWdCmdLenSetBattCharge
command length (bytes)
Definition: laeWatchDog.h:216
const byte_t LaeWdRspLenGetVersion
response length (bytes)
Definition: laeWatchDog.h:202
const byte_t LaeWdCmdLenPetDog
command length (bytes)
Definition: laeWatchDog.h:185
const byte_t LaeWdCmdIdSetBattCharge
command id
Definition: laeWatchDog.h:215
const byte_t LaeWdCmdLenResetRgbLed
command length (bytes)
Definition: laeWatchDog.h:261
const byte_t LaeWdSerCmdArgcGetVersion
cmd argument count
Definition: laeWatchDog.h:578
const byte_t LaeWdSerRspArgcPetTheDog
rsp argument count
Definition: laeWatchDog.h:591
const byte_t LaeWdSerMaxCmdLen
max command length (bytes)
Definition: laeWatchDog.h:521
const byte_t LaeWdSerRspArgcOpLed
rsp argument count
Definition: laeWatchDog.h:652
const byte_t LaeWdCmdIdConfigFw
command id
Definition: laeWatchDog.h:471
const unsigned int LaeWdArgAlarmBatt
battery low alarm
Definition: laeWatchDog.h:98
const byte_t LaeWdSerMaxRspArgLen
max rsp arg length (bytes)
Definition: laeWatchDog.h:526
const byte_t LaeWdSerCmdArgcSetConfig
set cmd argument count
Definition: laeWatchDog.h:605
const byte_t LaeWdSerCmdArgcGetAlarms
get cmd argument count
Definition: laeWatchDog.h:632
const char LaeWdSerCmdIdOpBattSoC
serial command id
Definition: laeWatchDog.h:617
const byte_t LaeI2CAddrWd
watchdog I2C address synonym
Definition: laeWatchDog.h:165
const char LaeWdSerCmdIdPetTheDog
serial command id
Definition: laeWatchDog.h:589
const byte_t LaeWdSerCmdArgcReadVolts
cmd argument count
Definition: laeWatchDog.h:693
const unsigned int LaeWdArgAlarmNone
no/clear alarms
Definition: laeWatchDog.h:96
const byte_t LaeWdRspLenReadDPin
response length (bytes)
Definition: laeWatchDog.h:298
The <b><i>Laelaps</i></b> namespace encapsulates all <b><i>Laelaps</i></b> related constructs...
Definition: laeAlarms.h:64
const byte_t LaeWdSerCmdArgcSetEnAuxPorts
set cmd argument count
Definition: laeWatchDog.h:680
const byte_t LaeWdCmdIdConfigDPin
command id
Definition: laeWatchDog.h:278
const unsigned int LaeWdArgAlarmBattCrit
batt crit modifier
Definition: laeWatchDog.h:101
const byte_t LaeWdSerCmdArgcGetLed
get cmd argument count
Definition: laeWatchDog.h:649
const char LaeWdSerCmdIdOpAlarms
serial command id
Definition: laeWatchDog.h:631
const byte_t LaeWdCmdLenWriteDPin
command length (bytes)
Definition: laeWatchDog.h:315
const byte_t LaeWdSerCmdArgcSetLed
set cmd argument count
Definition: laeWatchDog.h:650
const char LaeWdSerEoR
end of response
Definition: laeWatchDog.h:530
const char LaeWdSerArgGet[]
get operator argument string
Definition: laeWatchDog.h:536
const byte_t LaeWdSerRspArgcOpAlarms
rsp argument count
Definition: laeWatchDog.h:634
const char LaeWdSerArgErrRsp[]
response error argument string
Definition: laeWatchDog.h:540
const byte_t LaeWdArgAuxPort5V
regulated 5 volt auxilliary port
Definition: laeWatchDog.h:386
const char LaeWdSerArgOff[]
off state argument string
Definition: laeWatchDog.h:534
const char LaeWdSerArgStet[]
leave as is operator arg string
Definition: laeWatchDog.h:539
const byte_t LaeWdSerRspArgcOpConfig
rsp argument count
Definition: laeWatchDog.h:606
const byte_t LaeWdCmdIdPetDog
command id
Definition: laeWatchDog.h:184
const byte_t LaeWdSerCmdArgcPetTheDog
cmd argument count
Definition: laeWatchDog.h:590
const byte_t LaeWdCmdIdWriteDPin
command id
Definition: laeWatchDog.h:314
const byte_t LaeI2CAddrArduino
arduino I2C 7-bit address
Definition: laeWatchDog.h:164
const byte_t LaeWdArgDPinNumWMax
max write/modify pin number
Definition: laeWatchDog.h:117
const byte_t LaeWdSerCmdArgcGetEnAuxPorts
get cmd argument count
Definition: laeWatchDog.h:679
const byte_t LaeWdSerRspArgcOpEnMotorCtlrs
rsp argument count
Definition: laeWatchDog.h:666
const byte_t LaeWdRspLenSetRgbLed
response length (bytes)
Definition: laeWatchDog.h:250
const char LaeWdSerCmdIdOpConfig
serial command id
Definition: laeWatchDog.h:603
const byte_t LaeWdCmdLenConfigFw
command length (bytes)
Definition: laeWatchDog.h:472
const byte_t LaeWdArgAOutPinNumMax
analog output max pin number
Definition: laeWatchDog.h:136
const char LaeWdSerEoC
end of command
Definition: laeWatchDog.h:529
const byte_t LaeWdRspLenSetAlarms
response length (bytes)
Definition: laeWatchDog.h:233
const byte_t LaeWdCmdIdWriteAPin
command id
Definition: laeWatchDog.h:349
const byte_t LaeWdCmdIdSetAlarms
command id
Definition: laeWatchDog.h:231
const byte_t LaeWdSerCmdArgcSetEnMotorCtlrs
set cmd argument count
Definition: laeWatchDog.h:665
const byte_t LaeWdArgDPinNumWMin
min write/modify pin number
Definition: laeWatchDog.h:116
const char LaeWdSerArgOn[]
on state argument string
Definition: laeWatchDog.h:535
const char LaeWdSerOpBad
unknown/bad operator
Definition: laeWatchDog.h:546
const byte_t LaeWdArgAuxPortBatt
battery auxlliary port
Definition: laeWatchDog.h:385
const byte_t LaeWdSerMaxCmdArgLen
max cmd arg length (bytes)
Definition: laeWatchDog.h:523
const char LaeWdSerOpReset
reset operator value
Definition: laeWatchDog.h:545
const unsigned int LaeWdArgAlarmTemp
temperature alarm
Definition: laeWatchDog.h:99
const byte_t LaeWdCmdLenSetAlarms
command length (bytes)
Definition: laeWatchDog.h:232
const byte_t LaeWdRspLenPetDog_2
v2 response length (bytes)
Definition: laeWatchDog.h:187
const char LaeWdSerCmdIdHelp
serial command id
Definition: laeWatchDog.h:565
const byte_t LaeWdCmdIdReadAPin
command id
Definition: laeWatchDog.h:333
const byte_t LaeWdCmdIdEnableAuxPort
command id
Definition: laeWatchDog.h:381
const byte_t LaeWdArgPass
command success response
Definition: laeWatchDog.h:78
const byte_t LaeWdSerMaxRspArgc
max rsp argument count
Definition: laeWatchDog.h:525
const byte_t LaeWdCmdIdReadDPin
command id
Definition: laeWatchDog.h:296
const byte_t LaeWdSerCmdArgcGetBattSoC
get cmd argument count
Definition: laeWatchDog.h:618
const int LaeWdMaxRspLen
maximum response length
Definition: laeWatchDog.h:168
const byte_t LaeWdCmdIdReadEnables
command id
Definition: laeWatchDog.h:401
const byte_t LaeWdArgDPinDirOut
output
Definition: laeWatchDog.h:121
const byte_t LaeWdRspLenConfigFw
v1 response length (bytes)
Definition: laeWatchDog.h:473
const byte_t LaeWdSerRspArgcReadVolts
rsp argument count
Definition: laeWatchDog.h:694
const byte_t LaeWdCmdIdResetRgbLed
command id
Definition: laeWatchDog.h:260
const char LaeWdSerOpGet
get operator value
Definition: laeWatchDog.h:543
const unsigned int LaeWdArgAlarmGen
general alarm
Definition: laeWatchDog.h:97
const byte_t LaeWdRspLenReadEnables
response length (bytes)
Definition: laeWatchDog.h:403
const unsigned int LaeWdArgAlarmMask
alarm valid bits mask
Definition: laeWatchDog.h:104
const int LaeWdArgAInPinValMax
analog input maximum value
Definition: laeWatchDog.h:133
const byte_t LaeWdSerCmdArgcGetEnMotorCtlrs
get cmd argument count
Definition: laeWatchDog.h:664
const int LaeWdMaxCmdLen
maximum command length
Definition: laeWatchDog.h:167
const byte_t LaeWdArgAInPinNumMin
analog input min pin number
Definition: laeWatchDog.h:129
const unsigned int LaeWdArgBattSoCMin
0% charge
Definition: laeWatchDog.h:90
const int LaeWdArgAInPinValMin
analog input minimum value
Definition: laeWatchDog.h:132
const byte_t LaeWdCmdLenEnableMotorCtlrs
command length (bytes)
Definition: laeWatchDog.h:366
const char LaeWdSerArgReset[]
reset operator argument string
Definition: laeWatchDog.h:538
const byte_t LaeWdRspLenReadAPin
response length (bytes)
Definition: laeWatchDog.h:335
const byte_t LaeWdRspLenReadVolts
response length (bytes)
Definition: laeWatchDog.h:427
const char LaeWdSerOpSet
set operator value
Definition: laeWatchDog.h:544
const unsigned long LaeWdTimeoutMin
watchdog timeout minimum
Definition: laeWatchDog.h:84
const byte_t LaeWdArgDPinValLow
pin is low (0V)
Definition: laeWatchDog.h:123
const unsigned int LaeWdArgAlarmTypeMask
alarm types mask
Definition: laeWatchDog.h:103