2021-09-19 17:50:11 -07:00
|
|
|
#include "pch.h"
|
|
|
|
|
|
|
|
#include "init.h"
|
|
|
|
#include "frequency_sensor.h"
|
|
|
|
#include "turbocharger_speed_converter.h"
|
|
|
|
|
2021-09-20 12:39:41 -07:00
|
|
|
static FrequencySensor turbochargerSpeedSensor(SensorType::TurbochargerSpeed, MS2NT(500));
|
2021-09-19 17:50:11 -07:00
|
|
|
static TurbochargerSpeedConverter turbochargerSpeedConverter;
|
|
|
|
|
|
|
|
|
2021-11-16 01:15:29 -08:00
|
|
|
void initTurbochargerSpeedSensor() {
|
2021-09-19 17:50:11 -07:00
|
|
|
|
2021-11-17 00:54:21 -08:00
|
|
|
auto pin = engineConfiguration->turboSpeedSensorInputPin;
|
2021-09-19 17:50:11 -07:00
|
|
|
|
|
|
|
// Nothing to do if no sensor configured
|
|
|
|
if (!isBrainPinValid(pin)) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
turbochargerSpeedSensor.setFunction(turbochargerSpeedConverter);
|
2021-09-20 12:39:41 -07:00
|
|
|
turbochargerSpeedSensor.init(pin);
|
2021-09-19 17:50:11 -07:00
|
|
|
turbochargerSpeedSensor.Register();
|
|
|
|
}
|
|
|
|
|
|
|
|
void deinitTurbochargerSpeedSensor() {
|
|
|
|
turbochargerSpeedSensor.deInit();
|
|
|
|
}
|