rusefi-1/firmware/controllers/sensors/tps.h

48 lines
1.1 KiB
C
Raw Normal View History

2015-07-10 06:01:56 -07:00
/**
* @file tps.h
* @brief
*
*
* @date Nov 15, 2013
2015-12-31 13:02:30 -08:00
* @author Andrey Belomutskiy, (c) 2012-2016
2015-07-10 06:01:56 -07:00
*/
#ifndef TPS_H_
#define TPS_H_
#include "global.h"
#include "engine_configuration.h"
2016-01-31 18:02:03 -08:00
// we have 12 bit precision and TS uses 10 bit precision
#define TPS_TS_CONVERSION 4
2016-01-11 14:01:33 -08:00
bool hasPedalPositionSensor(DECLARE_ENGINE_PARAMETER_F);
2015-07-10 06:01:56 -07:00
percent_t getPedalPosition(DECLARE_ENGINE_PARAMETER_F);
/**
* Throttle Position Sensor
* In case of dual TPS this function would return logical TPS position
* @return Current TPS position, percent of WOT. 0 means idle and 100 means Wide Open Throttle
*/
percent_t getTPS(DECLARE_ENGINE_PARAMETER_F);
2016-12-17 08:01:40 -08:00
bool hasTpsSensor(DECLARE_ENGINE_PARAMETER_F);
2015-07-10 06:01:56 -07:00
int convertVoltageTo10bitADC(float voltage);
2016-01-31 18:02:03 -08:00
int getTPS12bitAdc(DECLARE_ENGINE_PARAMETER_F);
2015-07-10 06:01:56 -07:00
float getTPSVoltage(DECLARE_ENGINE_PARAMETER_F);
percent_t getTpsValue(int adc DECLARE_ENGINE_PARAMETER_S);
typedef struct {
2016-02-04 11:01:38 -08:00
efitimeus_t prevTime;
2015-07-10 06:01:56 -07:00
// value 0-100%
float prevValue;
2016-02-04 11:01:38 -08:00
efitimeus_t curTime;
2015-07-10 06:01:56 -07:00
// value 0-100%
float curValue;
// % per second
float rateOfChange;
} tps_roc_s;
2016-02-04 11:01:38 -08:00
//void saveTpsState(efitimeus_t now, float curValue);
2015-07-10 06:01:56 -07:00
float getTpsRateOfChange(void);
#endif