![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
3rd year group project. Electronic and Electrical Engineering. Heriot-Watt University. This is the code for the mbed for the Automatic Little Object Organiser (ALOO).
Dependencies: MCP23017 TCS3472_I2C WattBob_TextLCD mbed
commander.h@3:843b830ee8bd, 2015-11-11 (annotated)
- Committer:
- dreamselec
- Date:
- Wed Nov 11 03:45:30 2015 +0000
- Revision:
- 3:843b830ee8bd
- Parent:
- 2:7a55cb10259f
- Child:
- 6:98fe30430194
The MBED program is supposed to work both when connected to PC, and on it's own. So making use of Serial (UART) interrupts, to listen for incoming commands when PC is connected. Currently only mbed control works, no commands are sent to PC, or FPGA
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
dreamselec | 2:7a55cb10259f | 1 | #include "mbed.h" |
dreamselec | 2:7a55cb10259f | 2 | #include "globals.h" |
dreamselec | 2:7a55cb10259f | 3 | |
dreamselec | 2:7a55cb10259f | 4 | #ifndef COMMANDER_INCLUDED |
dreamselec | 2:7a55cb10259f | 5 | #define COMMANDER_INCLUDED |
dreamselec | 2:7a55cb10259f | 6 | |
dreamselec | 2:7a55cb10259f | 7 | enum Type { INVALID = -1, QUERY = 0, SET, REPLY }; |
dreamselec | 3:843b830ee8bd | 8 | enum CObject { MBED = 0, COLOUR_SENSOR, SERVOS, BEAM_SENSOR }; |
dreamselec | 2:7a55cb10259f | 9 | |
dreamselec | 2:7a55cb10259f | 10 | typedef struct { |
dreamselec | 3:843b830ee8bd | 11 | char inputString[80]; |
dreamselec | 3:843b830ee8bd | 12 | char outputString[80]; |
dreamselec | 2:7a55cb10259f | 13 | |
dreamselec | 2:7a55cb10259f | 14 | char commandType[1]; |
dreamselec | 2:7a55cb10259f | 15 | char commandObject[20]; |
dreamselec | 3:843b830ee8bd | 16 | char commandString[59]; |
dreamselec | 2:7a55cb10259f | 17 | |
dreamselec | 2:7a55cb10259f | 18 | Type typeEnum; |
dreamselec | 2:7a55cb10259f | 19 | CObject objectEnum; |
dreamselec | 2:7a55cb10259f | 20 | } Command; |
dreamselec | 2:7a55cb10259f | 21 | |
dreamselec | 2:7a55cb10259f | 22 | |
dreamselec | 2:7a55cb10259f | 23 | Type listenForCommand(); |
dreamselec | 2:7a55cb10259f | 24 | void recieveCommand(Command *cmd, Type type); |
dreamselec | 2:7a55cb10259f | 25 | void decodeCommand(Command *cmd); |
dreamselec | 2:7a55cb10259f | 26 | |
dreamselec | 2:7a55cb10259f | 27 | #endif |