xbee communication for UWB quadcopter project Originally by Greg Abdo Forking to reduce impact of interrupt by moving packetbuilder out of the interrupt and letting be handled in the main loop

Fork of com by Prosper Van

Committer:
oprospero
Date:
Mon Oct 06 04:59:20 2014 +0000
Revision:
17:acef0fb07510
Child:
22:0e8e22f161ff
Working ; 255

Who changed what in which revision?

UserRevisionLine numberNew contents of line
oprospero 17:acef0fb07510 1 /**************************** queue.h ****************************************/
oprospero 17:acef0fb07510 2 /* */
oprospero 17:acef0fb07510 3 /* Authers: Greg Abdo. */
oprospero 17:acef0fb07510 4 /* Date: February 23, 2013 */
oprospero 17:acef0fb07510 5 /* Version: 1.0 */
oprospero 17:acef0fb07510 6 /* */
oprospero 17:acef0fb07510 7 /* The queue is used to stack StructureItem in order with a FILO arrangement.*/
oprospero 17:acef0fb07510 8 /*****************************************************************************/
oprospero 17:acef0fb07510 9
oprospero 17:acef0fb07510 10 #ifndef QUEUECHAR_H
oprospero 17:acef0fb07510 11 #define QUEUECHAR_H
oprospero 17:acef0fb07510 12
oprospero 17:acef0fb07510 13 #include "mbed.h"
oprospero 17:acef0fb07510 14
oprospero 17:acef0fb07510 15 using namespace std;
oprospero 17:acef0fb07510 16
oprospero 17:acef0fb07510 17 const int MAXQUEUECHARLENGTH = 12;
oprospero 17:acef0fb07510 18
oprospero 17:acef0fb07510 19 class queueChar
oprospero 17:acef0fb07510 20 {
oprospero 17:acef0fb07510 21 public:
oprospero 17:acef0fb07510 22 queueChar(); // Queue constructor
oprospero 17:acef0fb07510 23 ~queueChar(); // Queue destructor
oprospero 17:acef0fb07510 24
oprospero 17:acef0fb07510 25 bool isEmpty(); // Check for an empty queue.
oprospero 17:acef0fb07510 26 void clear(); // Clears the entire queue.
oprospero 17:acef0fb07510 27 void add( char ); // Push commandData into the queue.
oprospero 17:acef0fb07510 28 char peek(); // Look at the last item in the queue.
oprospero 17:acef0fb07510 29 char pop(); // Pop the top item off the queue.
oprospero 17:acef0fb07510 30 char length(); // Return how many objects are in the queue.
oprospero 17:acef0fb07510 31
oprospero 17:acef0fb07510 32 private:
oprospero 17:acef0fb07510 33 char buffer[MAXQUEUECHARLENGTH];
oprospero 17:acef0fb07510 34 char front;
oprospero 17:acef0fb07510 35 char end;
oprospero 17:acef0fb07510 36 char lengthVar;
oprospero 17:acef0fb07510 37 char nextIndex(char);
oprospero 17:acef0fb07510 38
oprospero 17:acef0fb07510 39
oprospero 17:acef0fb07510 40 };
oprospero 17:acef0fb07510 41
oprospero 17:acef0fb07510 42 #endif