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:
Sun Nov 02 19:18:11 2014 +0000
Revision:
22:0e8e22f161ff
Parent:
15:3f742edaa359
Clean up

Who changed what in which revision?

UserRevisionLine numberNew contents of line
oprospero 0:26a151d2c6db 1 /**************************** queue.h ****************************************/
oprospero 0:26a151d2c6db 2 /* */
oprospero 0:26a151d2c6db 3 /* Authers: Greg Abdo. */
oprospero 0:26a151d2c6db 4 /* Date: February 23, 2013 */
oprospero 0:26a151d2c6db 5 /* Version: 1.0 */
oprospero 0:26a151d2c6db 6 /* */
oprospero 0:26a151d2c6db 7 /* The queue is used to stack StructureItem in order with a FILO arrangement.*/
oprospero 0:26a151d2c6db 8 /*****************************************************************************/
oprospero 0:26a151d2c6db 9
oprospero 0:26a151d2c6db 10 #ifndef QUEUE_H
oprospero 0:26a151d2c6db 11 #define QUEUE_H
oprospero 0:26a151d2c6db 12
oprospero 0:26a151d2c6db 13 #include "mbed.h"
oprospero 0:26a151d2c6db 14
oprospero 0:26a151d2c6db 15 using namespace std;
oprospero 0:26a151d2c6db 16
oprospero 15:3f742edaa359 17 const int MAXQUEUELENGTH = 12;
oprospero 0:26a151d2c6db 18
oprospero 0:26a151d2c6db 19 class queue
oprospero 0:26a151d2c6db 20 {
oprospero 0:26a151d2c6db 21 public:
oprospero 0:26a151d2c6db 22 queue(); // Queue constructor
oprospero 0:26a151d2c6db 23 ~queue(); // Queue destructor
oprospero 0:26a151d2c6db 24
oprospero 0:26a151d2c6db 25 bool isEmpty(); // Check for an empty queue.
oprospero 0:26a151d2c6db 26 void clear(); // Clears the entire queue.
oprospero 0:26a151d2c6db 27 void add( short* ); // Push commandData into the queue.
oprospero 0:26a151d2c6db 28 short* peek(); // Look at the last item in the queue.
oprospero 0:26a151d2c6db 29 short* pop(); // Pop the top item off the queue.
oprospero 0:26a151d2c6db 30 short queueLength(); // Return how many objects are in the queue.
oprospero 0:26a151d2c6db 31
oprospero 0:26a151d2c6db 32 private:
oprospero 0:26a151d2c6db 33 int length;
oprospero 0:26a151d2c6db 34
oprospero 0:26a151d2c6db 35 struct queueNode // Node object for the queue.
oprospero 0:26a151d2c6db 36 {
oprospero 0:26a151d2c6db 37 queueNode( short* array )
oprospero 0:26a151d2c6db 38 {
oprospero 0:26a151d2c6db 39 data = array;
oprospero 0:26a151d2c6db 40 next = NULL;
oprospero 0:26a151d2c6db 41 }
oprospero 0:26a151d2c6db 42
oprospero 0:26a151d2c6db 43 ~queueNode()
oprospero 0:26a151d2c6db 44 {}
oprospero 0:26a151d2c6db 45
oprospero 0:26a151d2c6db 46 short* data; // Pointer to the StructureItem object.
oprospero 0:26a151d2c6db 47 queueNode * next; // Next node in the queue.
oprospero 0:26a151d2c6db 48 };
oprospero 0:26a151d2c6db 49
oprospero 0:26a151d2c6db 50 queueNode * front; // Root of the queue.
oprospero 0:26a151d2c6db 51 };
oprospero 0:26a151d2c6db 52
oprospero 0:26a151d2c6db 53 #endif