Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Diff: commands.h
- Revision:
- 0:90ca7dd67eb8
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/commands.h Wed Aug 09 01:08:06 2017 +0000
@@ -0,0 +1,53 @@
+#ifndef __COMMANDS__
+#define __COMMANDS__
+
+#include "mbed.h"
+
+enum argumentType {
+ BLANK = -1,
+ DECIMAL,
+ INTEGER,
+ CHARACTERS
+};
+
+
+/*
+DRIVE: INTEGER lSpeed, INTEGER rSPeed
+LED: INTEGER on
+*/
+enum command {
+ VOID = -1,
+ DRIVE = 0,
+ LED,
+ TOTAL_COMMANDS
+};
+
+struct argument {
+ union {
+ float decimal;
+ int integer;
+ char characters[8];
+ };
+ argumentType type;
+};
+
+const char commandStrings[2][8] = {"DRIVE", "LED"};
+
+const argumentType commandArgTypes[2][4] = {
+ {INTEGER, INTEGER, BLANK, BLANK},
+ {INTEGER, BLANK, BLANK, BLANK}
+};
+
+class Message {
+private:
+ command cmd;
+ argument arguments[4];
+public:
+ Message();
+ Message(char[44]);
+ bool parse(const char[44]);
+ command getCommand();
+ argument getArg(int ind, argumentType expectedType);
+};
+
+#endif
\ No newline at end of file