Serial UART snooper. Connect RX and TX of the UUT to 2 x RX pins on mbed to inspect the traffic in both directions

Dependencies:   MODSERIAL Terminal mbed

Committer:
cbayley
Date:
Thu Sep 20 21:57:21 2012 +0000
Revision:
5:76d46f565551
Parent:
3:b8bad606d4f2
using my fork of Simon Ford Terminal

Who changed what in which revision?

UserRevisionLine numberNew contents of line
cbayley 3:b8bad606d4f2 1 #include "TinyQueue.h"
cbayley 3:b8bad606d4f2 2
cbayley 3:b8bad606d4f2 3
cbayley 3:b8bad606d4f2 4
cbayley 3:b8bad606d4f2 5
cbayley 3:b8bad606d4f2 6 /**
cbayley 3:b8bad606d4f2 7 * \brief Push an Accessibility Event onto our queue for sending to the iphone
cbayley 3:b8bad606d4f2 8 * \param q pointer to our tinyQ_t
cbayley 3:b8bad606d4f2 9 * \param c the Event to send to the iphone
cbayley 3:b8bad606d4f2 10 * \return null if Q full, 1 on success
cbayley 3:b8bad606d4f2 11 * \sa Qpop(), Qjump()
cbayley 3:b8bad606d4f2 12 * \ingroup tinyQ
cbayley 3:b8bad606d4f2 13 */
cbayley 3:b8bad606d4f2 14 int Qpush( tinyQ_t* q, void* p )
cbayley 3:b8bad606d4f2 15 {
cbayley 3:b8bad606d4f2 16 if (q->fill >= Q_SIZE)
cbayley 3:b8bad606d4f2 17 return 0;
cbayley 3:b8bad606d4f2 18
cbayley 3:b8bad606d4f2 19 q->fill++;
cbayley 3:b8bad606d4f2 20 q->data[q->head++] = p;
cbayley 3:b8bad606d4f2 21
cbayley 3:b8bad606d4f2 22 return 1;
cbayley 3:b8bad606d4f2 23 }
cbayley 3:b8bad606d4f2 24
cbayley 3:b8bad606d4f2 25 /**
cbayley 3:b8bad606d4f2 26 * \brief Push an Accessibility Event onto front of our queue for sending to the iphone
cbayley 3:b8bad606d4f2 27 * \param q pointer to our tinyQ_t
cbayley 3:b8bad606d4f2 28 * \param c the Event to send to the iphone
cbayley 3:b8bad606d4f2 29 * \return null if Q full, 1 on success
cbayley 3:b8bad606d4f2 30 * \sa Qpush(), Qpop()
cbayley 3:b8bad606d4f2 31 * \ingroup tinyQ
cbayley 3:b8bad606d4f2 32 */
cbayley 3:b8bad606d4f2 33 int Qjump( tinyQ_t* q, void* p)
cbayley 3:b8bad606d4f2 34 {
cbayley 3:b8bad606d4f2 35 if (q->fill >= Q_SIZE)
cbayley 3:b8bad606d4f2 36 return 0;
cbayley 3:b8bad606d4f2 37
cbayley 3:b8bad606d4f2 38 q->fill++;
cbayley 3:b8bad606d4f2 39 q->data[--q->tail] = p;
cbayley 3:b8bad606d4f2 40
cbayley 3:b8bad606d4f2 41 return 1;
cbayley 3:b8bad606d4f2 42 }
cbayley 3:b8bad606d4f2 43
cbayley 3:b8bad606d4f2 44 /**
cbayley 3:b8bad606d4f2 45 * \brief Pop an Accessibility Event off our queue for sending to the iphone
cbayley 3:b8bad606d4f2 46 * \param q pointer to our tinyQ_t
cbayley 3:b8bad606d4f2 47 * \param c pointer to receive the Event
cbayley 3:b8bad606d4f2 48 * \return null if Q empty, 1 on success
cbayley 3:b8bad606d4f2 49 * \sa Qpop(), Qjump()
cbayley 3:b8bad606d4f2 50 * \ingroup tinyQ
cbayley 3:b8bad606d4f2 51 */
cbayley 3:b8bad606d4f2 52 int Qpop( tinyQ_t* q, void **p)
cbayley 3:b8bad606d4f2 53 {
cbayley 3:b8bad606d4f2 54 if (! q->fill )
cbayley 3:b8bad606d4f2 55 return 0;
cbayley 3:b8bad606d4f2 56
cbayley 3:b8bad606d4f2 57 q->fill--;
cbayley 3:b8bad606d4f2 58 *p = q->data[q->tail++];
cbayley 3:b8bad606d4f2 59
cbayley 3:b8bad606d4f2 60 return 1;
cbayley 3:b8bad606d4f2 61 }
cbayley 3:b8bad606d4f2 62
cbayley 3:b8bad606d4f2 63 /* @} */