Speeduino
Loading...
Searching...
No Matches
Macros | Functions | Variables
sensors.h File Reference
#include "globals.h"
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define ADCFILTER_TPS_DEFAULT   50U
 
#define ADCFILTER_CLT_DEFAULT   180U
 
#define ADCFILTER_IAT_DEFAULT   180U
 
#define ADCFILTER_O2_DEFAULT   128U
 
#define ADCFILTER_BAT_DEFAULT   128U
 
#define ADCFILTER_MAP_DEFAULT   20U
 
#define ADCFILTER_BARO_DEFAULT   64U
 
#define ADCFILTER_PSI_DEFAULT   150U
 
#define FILTER_FLEX_DEFAULT   75U
 
#define VSS_GEAR_HYSTERESIS   10U
 
#define VSS_SAMPLES   4U
 
#define READ_FLEX()   digitalRead(pinFlex)
 
#define BIT_SENSORS_AUX_ENBL   0
 
#define BIT_SENSORS_BARO_SAVED   1
 
#define BIT_SENSORS_UNUSED2   2
 
#define BIT_SENSORS_UNUSED3   3
 
#define BIT_SENSORS_UNUSED4   4
 
#define BIT_SENSORS_UNUSED5   5
 
#define BIT_SENSORS_UNUSED6   6
 
#define BIT_SENSORS_UNUSED7   7
 
#define TPS_READ_FREQUENCY   30
 
#define CLT_READ_TIMER_BIT   BIT_TIMER_4HZ
 Define the TPS sensor read frequency.
 
#define IAT_READ_TIMER_BIT   BIT_TIMER_4HZ
 Define the IAT sensor read frequency.
 
#define O2_READ_TIMER_BIT   BIT_TIMER_30HZ
 Define the O2 sensor read frequency.
 
#define BAT_READ_TIMER_BIT   BIT_TIMER_4HZ
 Define the battery sensor read frequency.
 
#define BARO_READ_TIMER_BIT   BIT_TIMER_1HZ
 Define the baro sensor read frequency.
 
#define MAP_READ_TIMER_BIT   BIT_TIMER_1KHZ
 Define the MAP sensor read frequency.
 

Functions

void initialiseADC (void)
 
void flexPulse (void)
 
void knockPulse (void)
 
uint32_t vssGetPulseGap (byte toothHistoryIndex)
 Returns the VSS pulse gap for a given history point.
 
void vssPulse (void)
 The ISR function for VSS pulses.
 
uint16_t readAuxanalog (uint8_t analogPin)
 
uint16_t readAuxdigital (uint8_t digitalPin)
 
void initialiseTPS (void)
 Initial reading of the TPS sensor, primarily to detect flood clear state.
 
void initialiseCLT (void)
 Initial reading of the coolant sensor, primarily to make sure the priming pulsewidth is correct.
 
void readPolledSensors (byte loopTimer)
 Read the sensors that are polled at every loop. This includes the TPS, MAP, CLT, IAT and O2 sensors.
 
void initialiseMAPBaro (void)
 Initialize the MAP calculation & Baro values.
 
void resetMAPcycleAndEvent (void)
 
uint8_t getAnalogKnock (void)
 
int16_t getMAPDelta (void)
 Get the MAP change between the last 2 readings.
 
uint32_t getMAPDeltaTime (void)
 Get the time in µS between the last 2 MAP readings.
 

Variables

volatile byte flexCounter
 
volatile uint32_t flexPulseWidth
 
uint8_t statusSensors
 
table2D_u16_u16_32 cltCalibrationTable
 
table2D_u16_u16_32 iatCalibrationTable
 
table2D_u16_u8_32 o2CalibrationTable
 

Macro Definition Documentation

◆ ADCFILTER_BARO_DEFAULT

#define ADCFILTER_BARO_DEFAULT   64U

◆ ADCFILTER_BAT_DEFAULT

#define ADCFILTER_BAT_DEFAULT   128U

◆ ADCFILTER_CLT_DEFAULT

#define ADCFILTER_CLT_DEFAULT   180U

◆ ADCFILTER_IAT_DEFAULT

#define ADCFILTER_IAT_DEFAULT   180U

◆ ADCFILTER_MAP_DEFAULT

#define ADCFILTER_MAP_DEFAULT   20U

◆ ADCFILTER_O2_DEFAULT

#define ADCFILTER_O2_DEFAULT   128U

◆ ADCFILTER_PSI_DEFAULT

#define ADCFILTER_PSI_DEFAULT   150U

◆ ADCFILTER_TPS_DEFAULT

#define ADCFILTER_TPS_DEFAULT   50U

◆ BARO_READ_TIMER_BIT

#define BARO_READ_TIMER_BIT   BIT_TIMER_1HZ

Define the baro sensor read frequency.

◆ BAT_READ_TIMER_BIT

#define BAT_READ_TIMER_BIT   BIT_TIMER_4HZ

Define the battery sensor read frequency.

◆ BIT_SENSORS_AUX_ENBL

#define BIT_SENSORS_AUX_ENBL   0

◆ BIT_SENSORS_BARO_SAVED

#define BIT_SENSORS_BARO_SAVED   1

◆ BIT_SENSORS_UNUSED2

#define BIT_SENSORS_UNUSED2   2

◆ BIT_SENSORS_UNUSED3

#define BIT_SENSORS_UNUSED3   3

◆ BIT_SENSORS_UNUSED4

#define BIT_SENSORS_UNUSED4   4

◆ BIT_SENSORS_UNUSED5

#define BIT_SENSORS_UNUSED5   5

◆ BIT_SENSORS_UNUSED6

#define BIT_SENSORS_UNUSED6   6

◆ BIT_SENSORS_UNUSED7

#define BIT_SENSORS_UNUSED7   7

◆ CLT_READ_TIMER_BIT

#define CLT_READ_TIMER_BIT   BIT_TIMER_4HZ

Define the TPS sensor read frequency.

Define the coolant sensor read frequency.

◆ FILTER_FLEX_DEFAULT

#define FILTER_FLEX_DEFAULT   75U

◆ IAT_READ_TIMER_BIT

#define IAT_READ_TIMER_BIT   BIT_TIMER_4HZ

Define the IAT sensor read frequency.

◆ MAP_READ_TIMER_BIT

#define MAP_READ_TIMER_BIT   BIT_TIMER_1KHZ

Define the MAP sensor read frequency.

◆ O2_READ_TIMER_BIT

#define O2_READ_TIMER_BIT   BIT_TIMER_30HZ

Define the O2 sensor read frequency.

◆ READ_FLEX

#define READ_FLEX ( )    digitalRead(pinFlex)

◆ TPS_READ_FREQUENCY

#define TPS_READ_FREQUENCY   30

◆ VSS_GEAR_HYSTERESIS

#define VSS_GEAR_HYSTERESIS   10U

◆ VSS_SAMPLES

#define VSS_SAMPLES   4U

Function Documentation

◆ flexPulse()

void flexPulse ( void  )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getAnalogKnock()

uint8_t getAnalogKnock ( void  )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getMAPDelta()

int16_t getMAPDelta ( void  )

Get the MAP change between the last 2 readings.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getMAPDeltaTime()

uint32_t getMAPDeltaTime ( void  )

Get the time in µS between the last 2 MAP readings.

Here is the caller graph for this function:

◆ initialiseADC()

void initialiseADC ( void  )

Init all ADC conversions by setting resolutions, etc.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ initialiseCLT()

void initialiseCLT ( void  )

Initial reading of the coolant sensor, primarily to make sure the priming pulsewidth is correct.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ initialiseMAPBaro()

void initialiseMAPBaro ( void  )

Initialize the MAP calculation & Baro values.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ initialiseTPS()

void initialiseTPS ( void  )

Initial reading of the TPS sensor, primarily to detect flood clear state.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ knockPulse()

void knockPulse ( void  )
Here is the caller graph for this function:

◆ readAuxanalog()

uint16_t readAuxanalog ( uint8_t  analogPin)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ readAuxdigital()

uint16_t readAuxdigital ( uint8_t  digitalPin)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ readPolledSensors()

void readPolledSensors ( byte  loopTimer)

Read the sensors that are polled at every loop. This includes the TPS, MAP, CLT, IAT and O2 sensors.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ resetMAPcycleAndEvent()

void resetMAPcycleAndEvent ( void  )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ vssGetPulseGap()

uint32_t vssGetPulseGap ( uint8_t  historyIndex)

Returns the VSS pulse gap for a given history point.

Parameters
historyIndexThe gap number that is wanted. EG: historyIndex = 0 = Latest entry historyIndex = 1 = 2nd entry entry
Here is the call graph for this function:
Here is the caller graph for this function:

◆ vssPulse()

void vssPulse ( void  )

The ISR function for VSS pulses.

Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ cltCalibrationTable

table2D_u16_u16_32 cltCalibrationTable
extern

◆ flexCounter

volatile byte flexCounter
extern

◆ flexPulseWidth

volatile uint32_t flexPulseWidth
extern

◆ iatCalibrationTable

table2D_u16_u16_32 iatCalibrationTable
extern

◆ o2CalibrationTable

table2D_u16_u8_32 o2CalibrationTable
extern

◆ statusSensors

uint8_t statusSensors
extern