Simple embedded shell with runtime pluggable commands.
Implements a simple unix-like shell for embedded systems with a pluggable command architecture.
Diff: SimpleShell.h
- Revision:
- 2:4f0affdb7db9
- Parent:
- 1:998a7ed04f10
- Child:
- 3:ebb4893f033d
diff -r 998a7ed04f10 -r 4f0affdb7db9 SimpleShell.h --- a/SimpleShell.h Sun Dec 02 16:50:40 2018 +0000 +++ b/SimpleShell.h Sun Dec 02 17:09:08 2018 +0000 @@ -1,5 +1,11 @@ #include "mbed.h" +typedef struct { + char *command; + Callback<void()> cb; +} command_entry_t; + + class SimpleShell { public: SimpleShell(); @@ -11,8 +17,11 @@ private: static const int MAXBUF=128; + static const int MAXLOOKUP=32; void printPrompt(void); void readCommand(); + command_entry_t lookup[MAXLOOKUP]; + int lookupEnd; char cmd[MAXBUF]; char _cwd[MAXBUF]; }; // class \ No newline at end of file