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: MODSERIAL Terminal mbed
TinyQueue.h
00001 #ifndef TINYQ_H 00002 #define TINYQ_H 00003 00004 /** \defgroup tinyQ Tiny Queue 00005 * Tiny Queues implements a 4 byte queue for iPhone events with just 1 byte of management overhead. 00006 * Head and Tail pointers both inherently wrap at the end of the buffer and no bounds checking is 00007 * necesary IFF the buffer size is set as a power of 2 equal to the width of the pointers !! 00008 * i.e head is 2 bits wide so the buffer must be 2^2 = 4 bytes deep. 00009 * @{ 00010 */ 00011 /** NOTE: Q_SIZE MUST be == 2 ^ widthof( tinyQ_t.head ) */ 00012 #define Q_SIZE 256 00013 00014 /** a tinyQ tracks a 8 * queue with just 1 byte overhead */ 00015 typedef struct 00016 { 00017 unsigned char head:8; ///< the bit depth MUST be that power of 2 that is the Q_SIZE 00018 unsigned char tail:8; ///< the bit depth MUST be that power of 2 that is the Q_SIZE 00019 unsigned char fill:9; ///< Must be 1 bit bigger than the head and tail pointers 00020 void* data[Q_SIZE]; ///< NOTE: Q_SIZE MUST be == 2 ^ widthof( tinyQ_t.head ) 00021 }tinyQ_t; 00022 00023 00024 /** 00025 * \brief Push an Accessibility Event onto our queue for sending to the iphone 00026 * \param q pointer to our tinyQ_t 00027 * \param c the Event to send to the iphone 00028 * \return null if Q full, 1 on success 00029 * \sa Qpop(), Qjump() 00030 * \ingroup tinyQ 00031 */ 00032 int Qpush( tinyQ_t* q, void* p ); 00033 00034 /** 00035 * \brief Push an Accessibility Event onto front of our queue for sending to the iphone 00036 * \param q pointer to our tinyQ_t 00037 * \param c the Event to send to the iphone 00038 * \return null if Q full, 1 on success 00039 * \sa Qpush(), Qpop() 00040 * \ingroup tinyQ 00041 */ 00042 int Qjump( tinyQ_t* q, void* p ); 00043 00044 /** 00045 * \brief Pop an Accessibility Event off our queue for sending to the iphone 00046 * \param q pointer to our tinyQ_t 00047 * \param c pointer to receive the Event 00048 * \return null if Q empty, 1 on success 00049 * \sa Qpop(), Qjump() 00050 * \ingroup tinyQ 00051 */ 00052 int Qpop( tinyQ_t* q, void ** p); 00053 00054 #endif
Generated on Wed Jul 13 2022 07:44:32 by
1.7.2