![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
When debugging code it can be handy to examine/alter variables and to check the state of input lines. So your main program can run and you have access to alter variables and run functions from a terminal. In this sample the main program is just a loop that flashes an LED. In that loop a periodic call is made to ShellTC which handles any commands from the serial terminal. The code is a bit quirky(it was originally written for a very resource limited device) but it works well enough to be useful, hence its published. More details in the main.cpp
.
mon.h@0:87e65dabdb95, 2012-10-25 (annotated)
- Committer:
- jont
- Date:
- Thu Oct 25 21:57:40 2012 +0000
- Revision:
- 0:87e65dabdb95
First release
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
jont | 0:87e65dabdb95 | 1 | /* Copyright (c) <year> <copyright holders>, MIT License |
jont | 0:87e65dabdb95 | 2 | * |
jont | 0:87e65dabdb95 | 3 | * Permission is hereby granted, free of charge, to any person obtaining a copy of this software |
jont | 0:87e65dabdb95 | 4 | * and associated documentation files (the "Software"), to deal in the Software without restriction, |
jont | 0:87e65dabdb95 | 5 | * including without limitation the rights to use, copy, modify, merge, publish, distribute, |
jont | 0:87e65dabdb95 | 6 | * sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is |
jont | 0:87e65dabdb95 | 7 | * furnished to do so, subject to the following conditions: |
jont | 0:87e65dabdb95 | 8 | * |
jont | 0:87e65dabdb95 | 9 | * The above copyright notice and this permission notice shall be included in all copies or |
jont | 0:87e65dabdb95 | 10 | * substantial portions of the Software. |
jont | 0:87e65dabdb95 | 11 | * |
jont | 0:87e65dabdb95 | 12 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING |
jont | 0:87e65dabdb95 | 13 | * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
jont | 0:87e65dabdb95 | 14 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, |
jont | 0:87e65dabdb95 | 15 | * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
jont | 0:87e65dabdb95 | 16 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
jont | 0:87e65dabdb95 | 17 | */ |
jont | 0:87e65dabdb95 | 18 | /*+++++++MON.H++++++++*/ |
jont | 0:87e65dabdb95 | 19 | #ifndef MON_H |
jont | 0:87e65dabdb95 | 20 | #define MON_H |
jont | 0:87e65dabdb95 | 21 | typedef struct |
jont | 0:87e65dabdb95 | 22 | { |
jont | 0:87e65dabdb95 | 23 | const char *commandp; |
jont | 0:87e65dabdb95 | 24 | void (*func_p)(void); |
jont | 0:87e65dabdb95 | 25 | } cmd_entry; |
jont | 0:87e65dabdb95 | 26 | |
jont | 0:87e65dabdb95 | 27 | extern const cmd_entry command_table[]; |
jont | 0:87e65dabdb95 | 28 | extern char comBuff[]; |
jont | 0:87e65dabdb95 | 29 | extern char valueChange; |
jont | 0:87e65dabdb95 | 30 | |
jont | 0:87e65dabdb95 | 31 | |
jont | 0:87e65dabdb95 | 32 | #endif |