speeduino/sensors.h

28 lines
793 B
C
Raw Normal View History

#ifndef SENSORS_H
#define SENSORS_H
// The following are alpha values for the ADC filters.
// Their values are from 0 to 255 with 0 being no filtering and 255 being maximum
#define ADCFILTER_TPS 128
#define ADCFILTER_CLT 180
#define ADCFILTER_IAT 180
#define ADCFILTER_O2 128
#define ADCFILTER_BAT 128
volatile byte flexCounter = 0;
/*
* 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
void instanteneousMAPReading();
void readMAP();
2016-10-25 07:04:37 -07:00
void flexPulse();
unsigned int tempReading;
#endif // SENSORS_H