Code for autonomous rover for Sparkfun AVC. DataBus won 3rd in 2012 and the same code was used on Troubled Child, a 1986 Jeep Grand Wagoneer to win 1st in 2014.

Dependencies:   mbed Watchdog SDFileSystem DigoleSerialDisp

util.h

Committer:
shimniok
Date:
2013-05-27
Revision:
0:a6a169de725f
Child:
2:fbc6e3cf3ed8

File content as of revision 0:a6a169de725f:

#ifndef __UTIL_H
#define __UTIL_H

/** Utility routines */

#define clamp360(x) \
                while ((x) >= 360.0) (x) -= 360.0; \
                while ((x) < 0) (x) += 360.0;
#define clamp180(x) ((x) - floor((x)/360.0) * 360.0 - 180.0);

#ifndef M_PI
#define M_PI 3.14159265358979323846
#endif

/** Convert char to integer */
int ctoi(char c);
/** Convert string to floating point */
double cvstof(char *s);
/** Tokenize a string 
 * @param s is the string to tokenize
 * @param max is the maximum number of characters
 * @param delim is the character delimiter on which to tokenize
 * @returns t is the pointer to the next token
 */
char *split(char *s, char *t, int max, char delim);

#endif