2021-08-03 19:05:01 -07:00
|
|
|
#include "pch.h"
|
2021-03-04 19:39:20 -08:00
|
|
|
#include "Lps25Sensor.h"
|
|
|
|
|
|
|
|
static Lps25 device;
|
|
|
|
static Lps25Sensor sensor(device);
|
|
|
|
|
2021-11-16 01:15:29 -08:00
|
|
|
void initBaro() {
|
2021-03-04 19:39:20 -08:00
|
|
|
// If there's already an external (analog) baro sensor configured,
|
|
|
|
// don't configure the internal one.
|
|
|
|
if (Sensor::hasSensor(SensorType::BarometricPressure)) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2021-11-17 00:54:21 -08:00
|
|
|
if (device.init(engineConfiguration->lps25BaroSensorScl, engineConfiguration->lps25BaroSensorSda)) {
|
2021-03-04 19:39:20 -08:00
|
|
|
sensor.Register();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-05-14 07:54:40 -07:00
|
|
|
void baroLps25Update() {
|
2021-03-04 19:39:20 -08:00
|
|
|
#if EFI_PROD_CODE
|
2021-05-14 11:56:45 -07:00
|
|
|
if (device.hasInit()) {
|
2021-05-14 07:54:40 -07:00
|
|
|
sensor.update();
|
|
|
|
}
|
|
|
|
#endif // EFI_PROD_CODE
|
2021-03-04 19:39:20 -08:00
|
|
|
}
|