utils.h 952 Bytes
Newer Older
1 2 3 4 5 6
/*-----------------------------------------------------------------------------
 *  Author: Nelso G. Jost (nelsojost@gmail.com)
 *  License: GPLv2
 *  Purpose: Missing stuff from Arduino framework.
 *---------------------------------------------------------------------------*/

7 8 9 10 11 12 13 14 15 16
#ifndef UTILS_H
#define UTILS_H
#if ARDUINO >= 100
 #include "Arduino.h"
#else
 #include "WProgram.h"
#endif

#define     FLOAT_STR_DECIMAL_PLACES      6

17
#define     NAN_STRING                    "<NaN>"
18 19 20

#define     CSV_SEP     ','

Nelso Jost's avatar
Nelso Jost committed
21

22 23
/*  Converts a given float value to a String object (from WString.h) with
 *  a given number of decimal places.
24
 *
25 26
 *  This is necessary because unfortunately as of now the String(value)
 *  type casting operation does not handle floats and doubles.
27
 *
28 29
 *  Hacked from:
 *  https://www.timewasters-place.com/arduino-string-and-float/
30
 */
31 32
String FloatToString(float value, int decimal_places);
String FloatToString(float value);
33

34

35
#endif