EasyVR by Chad and Alty
This is code for the EasyVR module that is used with Lab 4.
Diff: easyvr.h
- Revision:
- 0:5d93573903ed
- Child:
- 1:80db49d7e068
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/easyvr.h Mon Oct 19 14:40:25 2015 +0000 @@ -0,0 +1,84 @@ +#ifndef EASYVR_H_DEFINED +#define EASYVR_H_DEFINED + +#include <mbed.h> + +#define ARG_MIN '@' +#define ARG_MAX '`' +#define ARG_ZERO 'A' +#define ARG_ACK ' ' + +#define CMD_BREAK 'b' +#define CMD_SLEEP 's' +#define CMD_KNOB 'k' +#define CMD_LEVEL 'v' +#define CMD_LANGUAGE 'l' +#define CMD_TIMEOUT 'o' +#define CMD_RECOG_SI 'i' +#define CMD_TRAIN_SD 't' +#define CMD_GROUP_SD 'g' +#define CMD_UNGROUP_SD 'u' +#define CMD_RECOG_SD 'd' +#define CMD_ERASE_SD 'e' +#define CMD_NAME_SD 'n' +#define CMD_COUNT_SD 'c' +#define CMD_DUMP_SD 'p' +#define CMD_MASK_SD 'm' +#define CMD_RESETALL 'r' +#define CMD_ID 'x' +#define CMD_DELAY 'y' +#define CMD_BAUDRATE 'a' +#define CMD_QUERY_IO 'q' +#define CMD_PLAY_SX 'w' +#define CMD_DUMP_SX 'h' + +#define STS_MASK 'k' +#define STS_COUNT 'c' +#define STS_AWAKEN 'w' +#define STS_DATA 'd' +#define STS_ERROR 'e' +#define STS_INVALID 'v' +#define STS_TIMEOUT 't' +#define STS_INTERR 'i' +#define STS_SUCCESS 'o' +#define STS_RESULT 'r' +#define STS_SIMILAR 's' +#define STS_OUT_OF_MEM 'm' +#define STS_ID 'x' +#define STS_PIN 'p' +#define STS_TABLE_SX 'd' + +#define ERR_DATACOL_TOO_NOISY 0x3 +#define ERR_DATACOL_TOO_SOFT 0x4 +#define ERR_DATACOL_TOO_LOUD 0x5 +#define ERR_DATACOL_TOO_SOON 0x6 +#define ERR_DATACOL_TOO_CHOPPY 0x7 +#define ERR_RECOG_FAIL 0x11 +#define ERR_RECOG_LOW_CONF 0x12 +#define ERR_RECOG_MID_CONF 0x13 +#define ERR_RECOG_BAD_TEMPLATE 0x14 +#define ERR_RECOG_DURATION 0x17 +#define ERR_SYNTH_BAD_VERSION 0x4A +#define ERR_SYNTH_BAD_MSG 0x4E +#define ERR_NOT_A_WORD 0x80 + +#define i2a(i) ((char)((i)+ARG_ZERO)) +#define a2i(a) ((int)((a)-ARG_ZERO)) + +extern Serial term; + +class EasyVR +{ + public: + EasyVR( PinName tx, PinName rx ); + void wakeup(); + void setup( int lang, int timeout ); + void send( char byte ); + char receive(); + void baud( int rate ); + + private: + Serial dev; +}; + +#endif // EASYVR_H_DEFINED \ No newline at end of file