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.
Revision 1:80db49d7e068, committed 2015-10-19
- Comitter:
- cmiller86
- Date:
- Mon Oct 19 15:15:55 2015 +0000
- Parent:
- 0:5d93573903ed
- Commit message:
- EasyVR library for use with ECE 4180 lab 4.
Changed in this revision
| easyvr.h | Show annotated file Show diff for this revision Revisions of this file |
--- a/easyvr.h Mon Oct 19 14:40:25 2015 +0000
+++ b/easyvr.h Mon Oct 19 15:15:55 2015 +0000
@@ -67,14 +67,72 @@
extern Serial term;
+/** EasyVR class for ECE 4180 lab 4.
+ * Used for interfacing with an EasyVR module.
+ *
+ * Example:
+ * @code
+ * #include "mbed.h"
+ * #include "easyvr.h"
+ *
+ * EasyVR easyVR( p27, p28 );
+ *
+ * int main()
+ * {
+ * easyVR.wakeup();
+ * easyVR.setup();
+ * }
+ * @endcode
+ */
class EasyVR
{
public:
+ /** EasyVR constructor.
+ * Initializes the serial interface for the EasyVR module.
+ *
+ * @param tx The TX pin on the mbed that should be used. This connects to the EasyVR's RX pin.
+ * @param rx The RX pin on the mbed that should be used. This connects to the EasyVR's TX pin.
+ */
EasyVR( PinName tx, PinName rx );
+
+ /** Wakes up the EasyVR by sending it a "break" signal until a reply
+ * of "success" has been received.
+ */
void wakeup();
+
+ /** Sets up the EasyVR. This includes ensuring the EasyVR module is a valid EasyVR device,
+ * setting its timeout value, and its language.
+ *
+ * @param lang The language to be used, as an encoded integer. i.e. 0 is 'A', 1 is 'B', and so forth.
+ * @param timeout The timeout to be used, in seconds, as an encoded integer.
+ */
void setup( int lang, int timeout );
+
+ /** Sends a single byte to the EasyVR. This is most commonly used to send commands
+ * and parameters for those commands. Note that this is just a wrapper for the EasyVR's
+ * serial interface's putc() function.
+ *
+ * @param byte The byte to be sent.
+ * @see Serial.putc()
+ */
void send( char byte );
+
+ /** Receives a single byte from the EasyVR. This is most commonly used to receive
+ * signals from the EasyVR. Note that this is just a wrapper for the EasyVR's serial
+ * interface's getc() function.
+ *
+ * Be aware that this is a blocking method - it will stall the program until a byte is received!
+ *
+ * @return A single byte from the EasyVR.
+ * @see Serial.putc()
+ */
char receive();
+
+ /** Sets the EasyVR's baud rate. For speech recognition, this must be exactly 9600.
+ *
+ * @param rate The baud rate the EasyVR should communicate with.
+ * @see Serial.baud()
+ */
void baud( int rate );
private: