Jean Mercier
/
jmGPIO
Get accesss to GPIO Registers from serial port
jmRingBuffer.h@0:35df659aaddf, 2011-02-12 (annotated)
- Committer:
- jm
- Date:
- Sat Feb 12 16:36:31 2011 +0000
- Revision:
- 0:35df659aaddf
General IO Command Line Interface
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
jm | 0:35df659aaddf | 1 | /************************************************************************* |
jm | 0:35df659aaddf | 2 | * @file jmRingBuffer.h |
jm | 0:35df659aaddf | 3 | * @brief Command Line Rx Ring Buffer |
jm | 0:35df659aaddf | 4 | * |
jm | 0:35df659aaddf | 5 | * @date Feb12, 2011 |
jm | 0:35df659aaddf | 6 | */ |
jm | 0:35df659aaddf | 7 | |
jm | 0:35df659aaddf | 8 | #ifndef jmRingBufferDef |
jm | 0:35df659aaddf | 9 | #define jmRingBufferDef 1 |
jm | 0:35df659aaddf | 10 | |
jm | 0:35df659aaddf | 11 | #define nl 10 // new line |
jm | 0:35df659aaddf | 12 | #define WordMaxSize 21 |
jm | 0:35df659aaddf | 13 | #define DimRingBuffer 41 |
jm | 0:35df659aaddf | 14 | |
jm | 0:35df659aaddf | 15 | |
jm | 0:35df659aaddf | 16 | // Ring Buffer data structure |
jm | 0:35df659aaddf | 17 | extern struct RingBuffer |
jm | 0:35df659aaddf | 18 | { unsigned char Buffer[DimRingBuffer]; |
jm | 0:35df659aaddf | 19 | unsigned char head; |
jm | 0:35df659aaddf | 20 | unsigned char tail; |
jm | 0:35df659aaddf | 21 | unsigned char qty; |
jm | 0:35df659aaddf | 22 | }Line, *pLine; |
jm | 0:35df659aaddf | 23 | #endif |
jm | 0:35df659aaddf | 24 | |
jm | 0:35df659aaddf | 25 | // Prototypes |
jm | 0:35df659aaddf | 26 | bool Full(struct RingBuffer *p); |
jm | 0:35df659aaddf | 27 | void Insert(unsigned char c, struct RingBuffer *p); |
jm | 0:35df659aaddf | 28 | bool NotEmpty(struct RingBuffer *p); |
jm | 0:35df659aaddf | 29 | unsigned char Extract(struct RingBuffer *p); |
jm | 0:35df659aaddf | 30 | void FlushRingBuffer(struct RingBuffer *p); |
jm | 0:35df659aaddf | 31 | void DelChar(struct RingBuffer *p); |
jm | 0:35df659aaddf | 32 | void InitCommandLineRingBuffer(void); |
jm | 0:35df659aaddf | 33 | void NextCommand(unsigned char c, struct RingBuffer *p); |
jm | 0:35df659aaddf | 34 | void ViewRingBuffer(struct RingBuffer *p); |
jm | 0:35df659aaddf | 35 | bool ExtractWord(struct RingBuffer *p, char *param); |
jm | 0:35df659aaddf | 36 | bool ExtractUInteger(struct RingBuffer *p, unsigned int *result, unsigned int min, unsigned int max); |