rusEFI
The most advanced open source ECU
Loading...
Searching...
No Matches
init_range.cpp
Go to the documentation of this file.
1#include "pch.h"
2
3#include "init.h"
4#include "adc_subscription.h"
5#include "functional_sensor.h"
6#include "resistance_func.h"
7
8#if EFI_TCU
9
10// These aux sensors just read voltage - so the converter function has nothing to do
11
13 { SensorType::RangeInput1, MS2NT(50) },
14 { SensorType::RangeInput2, MS2NT(50) },
15 { SensorType::RangeInput3, MS2NT(50) },
16 { SensorType::RangeInput4, MS2NT(50) },
17 { SensorType::RangeInput5, MS2NT(50) },
18 { SensorType::RangeInput6, MS2NT(50) },
19};
20
21static ResistanceFunc rangeFuncs[RANGE_INPUT_COUNT];
22
23static_assert(efi::size(rangeSensors) == RANGE_INPUT_COUNT);
24
26 for (size_t i = 0; i < efi::size(engineConfiguration->tcu_rangeAnalogInput); i++) {
28
29 // Skip unconfigured channels
31 continue;
32 }
33
35
36 auto& sensor = rangeSensors[i];
37 sensor.setFunction(rangeFuncs[i]);
39
41 }
42}
43
44#endif
bool isAdcChannelValid(adc_channel_e hwChannel)
Definition adc_inputs.h:23
uint16_t channel
Definition adc_inputs.h:104
static AdcSubscriptionEntry * SubscribeSensor(FunctionalSensorBase &sensor, adc_channel_e channel, float lowpassCutoffHZ, float voltsPerAdcVolt=0.0f)
Class for sensors that convert from some raw floating point value (ex: voltage, frequency,...
void configure(float supplyVoltage, float pullupResistor, bool isPulldown)
bool Register()
Definition sensor.cpp:131
static constexpr engine_configuration_s * engineConfiguration
static Lps25Sensor sensor(device)
static ResistanceFunc rangeFuncs[RANGE_INPUT_COUNT]
void initRangeSensors()
static FunctionalSensor rangeSensors[]