speeduino/utils.h

25 lines
662 B
C
Raw Normal View History

2015-02-06 18:50:36 -08:00
/*
These are some utility functions and variables used through the main code
*/
2015-02-14 05:11:43 -08:00
#ifndef UTILS_H
#define UTILS_H
2015-02-06 18:50:36 -08:00
#include <Arduino.h>
#define MS_IN_MINUTE 60000
#define US_IN_MINUTE 60000000
/*
* Simple low pass IIR filter macro for the analog inputs
* This is effectively implementing the smooth filter from http://playground.arduino.cc/Main/Smooth
* But removes the use of floats and uses 8 bits of fixed precision.
*/
#define ADC_FILTER(input, alpha, prior) (((long)input * (256 - alpha) + ((long)prior * alpha))) >> 8
2015-02-06 18:50:36 -08:00
int freeRam ();
void setPinMapping(byte boardID);
2015-02-06 18:50:36 -08:00
unsigned int PW();
unsigned int PW_SD();
unsigned int PW_AN();
2015-02-14 05:11:43 -08:00
#endif // UTILS_H