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.
Dependencies: mbed ESC SR04 TSI
Diff: com/com.h
- Revision:
- 16:5f736b955d53
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/com/com.h Thu Jun 06 00:18:29 2013 +0000 @@ -0,0 +1,30 @@ +/******************************* com.h ***********************************/ +/* Version: 1.0 */ +/* Last Updated: June 1, 2013 */ +/*************************************************************************/ + +#ifndef COM_H +#define COM_H + +#include "mbed.h" +#include "queue.h" + +class com +{ + public: + com( PinName, PinName ); // Setup the com serial port. (tx, rx) + bool isData(); // Is there data to be read? + void write( char ); // Write to the port. + char * read(); // Read from the queue. + + private: + void callback(); // Handle the interrupts. + void packetBuilder(); // Called by callback to place commandes into the queue. + + char buffer[50]; // Buffer for holding serial data. + int bLength; // Location in the buffer to place next data. + Serial xbee; // tx - DIN, rx - DOUT + queue *readBuffer; // queue of commands ready to be read. +}; + +#endif \ No newline at end of file