Eli Hughes
/
InternetOfThing
2014 Freescale / Hack A Day Make It Challenge FRDM-K64 Internet of "Thing"
Embed:
(wiki syntax)
Show/hide line numbers
Queue.h
00001 /* 00002 00003 -------------------------------------------- 00004 | | 00005 | .... | 00006 | 7OO$?I78. | 00007 | .?8++++7+II?D. | 00008 | .?O++=I++II+?= | 00009 | .IO++?7==I??$. | 00010 | .8++=$===?+I$ | 00011 | ?+++===+===+ | 00012 | ???=+I++==+? | 00013 | .??++====+==++ | 00014 | ?+++==========~ | 00015 | $+++==========+= | 00016 | =?+===+==+I======== | 00017 | ..++======~~~~========? | 00018 | .$?I??+=~~===~~~===~===++. | 00019 | .+==.+=~~~=~==~~~~==~~=~==+? | 00020 | ?===I+====~~=~~~=~~=====~~~=?. | 00021 | .=~~~+==~==..~~~~~~= ~~~~=7= | 00022 | +=~~?+~~=. ==~~~~=. ~~~~=?. | 00023 | =~~~=~~~ ?===~~+. ~~~~+ | 00024 | +~~:+~~= =~~==. =~~+. | 00025 | ~:~ =~~= =~~~= ~=== | 00026 | I=~~ ,=~~= ,. | 00027 | ~~. ,==== | 00028 | ==== | 00029 | =~~. | 00030 | | 00031 |------------------------------------------| 00032 | Internet Of Thing | 00033 | Eli Hughes | 00034 | Freescale / Hack-a-day Make-It-Challenge | 00035 | FTF 2014 - Dallas, Tx | 00036 |------------------------------------------| 00037 00038 */ 00039 #include <stdio.h> 00040 #include <stdarg.h> 00041 #include <stdint.h> 00042 00043 #ifndef TFC_QUEUE_H_ 00044 #define TFC_QUEUE_H_ 00045 00046 00047 typedef struct { 00048 00049 uint16_t ReadPtr; 00050 uint16_t WritePtr; 00051 uint16_t QueueSize; 00052 uint8_t *QueueStorage; 00053 00054 } ByteQueue; 00055 00056 #define QUEUE_FULL -1 00057 #define QUEUE_EMPTY -2 00058 #define QUEUE_OK 0 00059 00060 00061 void InitByteQueue(ByteQueue *BQ,uint16_t Size,uint8_t * Storage); 00062 uint16_t BytesInQueue(ByteQueue *BQ); 00063 int16_t ByteEnqueue(ByteQueue *BQ,uint8_t Val); 00064 int16_t ByteArrayEnqueue(ByteQueue *BQ,uint8_t *Buf,uint16_t); 00065 int16_t ByteDequeue(ByteQueue *BQ,uint8_t *Val); 00066 uint8_t ForcedByteDequeue(ByteQueue *BQ); 00067 int16_t Qprintf(ByteQueue *BQ, const char *FormatString,...); 00068 00069 00070 00071 00072 #endif /* TFC_QUEUE_H_ */
Generated on Tue Jul 19 2022 00:46:05 by 1.7.2