2021-08-12 12:16:51 -07:00
|
|
|
#include "pch.h"
|
|
|
|
|
|
|
|
#include "init.h"
|
2021-08-23 21:55:41 -07:00
|
|
|
#include "frequency_sensor.h"
|
|
|
|
#include "vehicle_speed_converter.h"
|
2021-08-12 12:16:51 -07:00
|
|
|
|
2021-08-23 21:55:41 -07:00
|
|
|
static FrequencySensor vehicleSpeedSensor(SensorType::VehicleSpeed, MS2NT(500));
|
|
|
|
static VehicleSpeedConverter vehicleSpeedConverter;
|
2021-08-12 12:16:51 -07:00
|
|
|
|
2021-11-16 01:15:29 -08:00
|
|
|
void initVehicleSpeedSensor() {
|
2021-08-12 12:16:51 -07:00
|
|
|
|
2021-11-17 00:54:21 -08:00
|
|
|
auto pin = engineConfiguration->vehicleSpeedSensorInputPin;
|
2021-08-12 12:16:51 -07:00
|
|
|
|
2021-08-23 21:55:41 -07:00
|
|
|
// Nothing to do if no sensor configured
|
|
|
|
if (!isBrainPinValid(pin)) {
|
|
|
|
return;
|
|
|
|
}
|
2021-08-12 12:16:51 -07:00
|
|
|
|
2021-08-23 21:55:41 -07:00
|
|
|
vehicleSpeedSensor.setFunction(vehicleSpeedConverter);
|
2021-09-20 12:39:41 -07:00
|
|
|
vehicleSpeedSensor.init(pin);
|
2021-08-12 12:16:51 -07:00
|
|
|
vehicleSpeedSensor.Register();
|
2021-08-23 21:55:41 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
void deInitVehicleSpeedSensor() {
|
|
|
|
vehicleSpeedSensor.deInit();
|
2021-08-12 12:16:51 -07:00
|
|
|
}
|