library to modify and read program variable in runtime from a serial console. You can reset as well the mbed from the console without pushing buttons. Handy for debugging from the online compiler as you can change the behavior of the program without need to recompile each time.
VarItems.h@9:d081aa4e4418, 2014-08-25 (annotated)
- Committer:
- julmbed
- Date:
- Mon Aug 25 20:44:39 2014 +0000
- Revision:
- 9:d081aa4e4418
- Parent:
- 8:934ec53fe2c0
workin with rawserial and without malloc. dump string limited to 132 chars
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
julmbed | 0:85afbf3c9fad | 1 | #ifndef VARITEMS_H |
julmbed | 0:85afbf3c9fad | 2 | #define VARITEMS_H |
julmbed | 0:85afbf3c9fad | 3 | #define NULL 0 |
julmbed | 0:85afbf3c9fad | 4 | #define ERR -1 |
julmbed | 0:85afbf3c9fad | 5 | |
julmbed | 0:85afbf3c9fad | 6 | // #define VARITEMS_DEBUG 1 |
julmbed | 0:85afbf3c9fad | 7 | |
julmbed | 0:85afbf3c9fad | 8 | #define VAR_NAME_LEN 20 |
julmbed | 0:85afbf3c9fad | 9 | |
julmbed | 0:85afbf3c9fad | 10 | enum VarTypes {T_int,T_float}; |
julmbed | 0:85afbf3c9fad | 11 | |
julmbed | 0:85afbf3c9fad | 12 | |
julmbed | 0:85afbf3c9fad | 13 | class VarItem |
julmbed | 0:85afbf3c9fad | 14 | { |
julmbed | 0:85afbf3c9fad | 15 | public: |
julmbed | 0:85afbf3c9fad | 16 | VarItem(); |
julmbed | 0:85afbf3c9fad | 17 | virtual ~VarItem(); |
julmbed | 0:85afbf3c9fad | 18 | |
julmbed | 0:85afbf3c9fad | 19 | void SetVar(VarTypes VT,void* VarPtr); |
julmbed | 0:85afbf3c9fad | 20 | int SetVal(char *Val); |
julmbed | 2:a59207652720 | 21 | // void SetVarType(VarTypes VarType); |
julmbed | 0:85afbf3c9fad | 22 | void SetVarArraySize(int Size); |
julmbed | 0:85afbf3c9fad | 23 | void SetVarName(char *Name); |
julmbed | 0:85afbf3c9fad | 24 | char *Dump(); |
julmbed | 0:85afbf3c9fad | 25 | char *GetVarName(); |
julmbed | 0:85afbf3c9fad | 26 | |
julmbed | 9:d081aa4e4418 | 27 | protected: |
julmbed | 9:d081aa4e4418 | 28 | private: |
julmbed | 0:85afbf3c9fad | 29 | |
julmbed | 0:85afbf3c9fad | 30 | char VarName[VAR_NAME_LEN]; |
julmbed | 0:85afbf3c9fad | 31 | |
julmbed | 0:85afbf3c9fad | 32 | int *ValInt; |
julmbed | 0:85afbf3c9fad | 33 | float *ValFloat; |
julmbed | 0:85afbf3c9fad | 34 | VarTypes VarType; |
julmbed | 0:85afbf3c9fad | 35 | unsigned int ArraySize; |
julmbed | 8:934ec53fe2c0 | 36 | |
julmbed | 0:85afbf3c9fad | 37 | }; |
julmbed | 0:85afbf3c9fad | 38 | |
julmbed | 0:85afbf3c9fad | 39 | #endif // VARITEMS_H |