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.
tinyQ.c
00001 #include "string.h" 00002 #include "tinyQ.h" 00003 00004 00005 00006 /** 00007 * \brief Push an Accessibility Event onto our queue for sending to the iphone 00008 * \param q pointer to our tinyQ_t 00009 * \param c the Event to send to the iphone 00010 * \return null if Q full, 1 on success 00011 * \sa Qpop(), Qjump() 00012 * \ingroup tinyQ 00013 */ 00014 int Qpush( tinyQ_t* q, char c ) 00015 { 00016 if ( q->fill == Q_SIZE ) 00017 return 0; 00018 00019 __disable_irq(); 00020 q->fill++; 00021 q->data[q->head++] = c; 00022 __enable_irq(); 00023 00024 return 1; 00025 } 00026 00027 00028 /** 00029 * \brief Pop an Accessibility Event off our queue for sending to the iphone 00030 * \param q pointer to our tinyQ_t 00031 * \param c pointer to receive the Event 00032 * \return null if Q empty, 1 on success 00033 * \sa Qpop(), Qjump() 00034 * \ingroup tinyQ 00035 */ 00036 int Qpop( tinyQ_t* q, char * c) 00037 { 00038 if (! q->fill ) 00039 return 0; 00040 00041 __disable_irq(); 00042 q->fill--; 00043 *c = q->data[q->tail++]; 00044 __enable_irq(); 00045 00046 return 1; 00047 } 00048 00049 int Qfree( tinyQ_t* q ) 00050 { 00051 return (Q_SIZE - q->fill); 00052 } 00053 00054 void Qinit( tinyQ_t * q ) 00055 { 00056 memset( q, 0, sizeof(q) ); 00057 }
Generated on Tue Jul 12 2022 23:42:02 by
