38template <
typename AnalogPressureData>
58 bool init()
override {
return true; }
94 AnalogPressureData pressure;
112 pressure.pressure -=
offset;
Common class for all analog pressure sensors.
bool init() override
Initialize the sensor.
void setOffset(float value)
Set the current analog pressure sensor offset. Ignores any previous offsets.
miosix::FastMutex offsetMutex
virtual float voltageToPressure(float voltage)=0
Function that returns the sensor voltage.
std::function< ADCData()> getVoltage
float getOffset()
Retrieve the current offset.
const float supplyVoltage
void updateOffset(float value)
Update the current analog pressure sensor offset. Adds the new value to the old offset.
AnalogPressureData sampleImpl() override
Conversion function from volts to pascals.
bool selfTest() override
Check if the sensor is working.
AnalogPressureSensor(std::function< ADCData()> getVoltage, const float supplyVoltage=5.0, const float maxPressure=0, const float minPressure=0)
AnalogPressureSensor(AnalogPressureSensor &&other)
Base sensor class with has to be extended by any sensor driver.
This file includes all the types the logdecoder script will decode.
Structure to handle ADC data.
uint64_t voltageTimestamp