Derek McLean / Mbed 2 deprecated uwb-quadcopter

Dependencies:   mbed ESC SR04 TSI

com/com.h

Committer:
gabdo
Date:
2013-06-06
Revision:
16:5f736b955d53

File content as of revision 16:5f736b955d53:

/******************************* 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