Control up to 4 DC Motors from a serial port

Dependencies:   mbed

Committer:
jm
Date:
Sat Feb 12 16:39:20 2011 +0000
Revision:
0:dedab08b24ea
jmMotor Command Line Interface Module

Who changed what in which revision?

UserRevisionLine numberNew contents of line
jm 0:dedab08b24ea 1 /*************************************************************************
jm 0:dedab08b24ea 2 * @file jmRingBuffer.h
jm 0:dedab08b24ea 3 * @brief Command Line Rx Ring Buffer
jm 0:dedab08b24ea 4 *
jm 0:dedab08b24ea 5 * @date Feb12, 2011
jm 0:dedab08b24ea 6 */
jm 0:dedab08b24ea 7
jm 0:dedab08b24ea 8 #ifndef jmRingBufferDef
jm 0:dedab08b24ea 9 #define jmRingBufferDef 1
jm 0:dedab08b24ea 10
jm 0:dedab08b24ea 11 #define nl 10 // new line
jm 0:dedab08b24ea 12 #define WordMaxSize 21
jm 0:dedab08b24ea 13 #define DimRingBuffer 41
jm 0:dedab08b24ea 14
jm 0:dedab08b24ea 15
jm 0:dedab08b24ea 16 // Ring Buffer data structure
jm 0:dedab08b24ea 17 extern struct RingBuffer
jm 0:dedab08b24ea 18 { unsigned char Buffer[DimRingBuffer];
jm 0:dedab08b24ea 19 unsigned char head;
jm 0:dedab08b24ea 20 unsigned char tail;
jm 0:dedab08b24ea 21 unsigned char qty;
jm 0:dedab08b24ea 22 }Line, *pLine;
jm 0:dedab08b24ea 23 #endif
jm 0:dedab08b24ea 24
jm 0:dedab08b24ea 25 // Prototypes
jm 0:dedab08b24ea 26 bool Full(struct RingBuffer *p);
jm 0:dedab08b24ea 27 void Insert(unsigned char c, struct RingBuffer *p);
jm 0:dedab08b24ea 28 bool NotEmpty(struct RingBuffer *p);
jm 0:dedab08b24ea 29 unsigned char Extract(struct RingBuffer *p);
jm 0:dedab08b24ea 30 void FlushRingBuffer(struct RingBuffer *p);
jm 0:dedab08b24ea 31 void DelChar(struct RingBuffer *p);
jm 0:dedab08b24ea 32 void InitCommandLineRingBuffer(void);
jm 0:dedab08b24ea 33 void NextCommand(unsigned char c, struct RingBuffer *p);
jm 0:dedab08b24ea 34 void ViewRingBuffer(struct RingBuffer *p);
jm 0:dedab08b24ea 35 bool ExtractWord(struct RingBuffer *p, char *param);
jm 0:dedab08b24ea 36 bool ExtractUInteger(struct RingBuffer *p, unsigned int *result, unsigned int min, unsigned int max);