Code for autonomous ground vehicle, Data Bus, 3rd place winner in 2012 Sparkfun AVC.

Dependencies:   Watchdog mbed Schedule SimpleFilter LSM303DLM PinDetect DebounceIn Servo

Committer:
shimniok
Date:
Wed Jun 20 14:57:48 2012 +0000
Revision:
0:826c6171fc1b
Updated documentation

Who changed what in which revision?

UserRevisionLine numberNew contents of line
shimniok 0:826c6171fc1b 1 #ifndef __UTIL_H
shimniok 0:826c6171fc1b 2 #define __UTIL_H
shimniok 0:826c6171fc1b 3
shimniok 0:826c6171fc1b 4 /** Utility routines */
shimniok 0:826c6171fc1b 5
shimniok 0:826c6171fc1b 6 #define clamp360(x) \
shimniok 0:826c6171fc1b 7 while ((x) >= 360.0) (x) -= 360.0; \
shimniok 0:826c6171fc1b 8 while ((x) < 0) (x) += 360.0;
shimniok 0:826c6171fc1b 9 #define clamp180(x) ((x) - floor((x)/360.0) * 360.0 - 180.0);
shimniok 0:826c6171fc1b 10
shimniok 0:826c6171fc1b 11 #ifndef M_PI
shimniok 0:826c6171fc1b 12 #define M_PI 3.14159265358979323846
shimniok 0:826c6171fc1b 13 #endif
shimniok 0:826c6171fc1b 14
shimniok 0:826c6171fc1b 15 /** Convert char to integer */
shimniok 0:826c6171fc1b 16 int ctoi(char c);
shimniok 0:826c6171fc1b 17 /** Convert string to floating point */
shimniok 0:826c6171fc1b 18 double cvstof(char *s);
shimniok 0:826c6171fc1b 19 /** Tokenize a string
shimniok 0:826c6171fc1b 20 * @param s is the string to tokenize
shimniok 0:826c6171fc1b 21 * @param max is the maximum number of characters
shimniok 0:826c6171fc1b 22 * @param delim is the character delimiter on which to tokenize
shimniok 0:826c6171fc1b 23 * @returns t is the pointer to the next token
shimniok 0:826c6171fc1b 24 */
shimniok 0:826c6171fc1b 25 char *split(char *s, char *t, int max, char delim);
shimniok 0:826c6171fc1b 26
shimniok 0:826c6171fc1b 27 #endif