Virtual Barometric Pressure/Altimeter Sensor Interface.
More...
#include <barometric_sensor.h>
Virtual Barometric Pressure/Altimeter Sensor Interface.
A standard interface for a device which can measure barometric pressure.
This is a simple interface, which only provides the ability to read the current sample.
Fundamental Assumptions
- The device produces barometric pressure readings
- This device reports barometric pressure in hectopascal (hPa)
- The reported barometric pressure reading will be compensated for ambient temperature by the implementation if it is required.
- Pressure will be formatted as a 32-bit fixed-point integer with format UQ22.10, giving a resolution of 0.001 hPa.
- This device produces barometric altitude readings
- This device will report barometric altitude in meters
- Altitude will be formatted as a 32-bit fixed-point integer with format Q21.10, giving a resolution of 0.001 m.
- Altitude will be corrected for Sea Level Pressure. If no value for SLP has been supplied, calculations will assume 1013.25 hPa.
- The device will indicate whether the current sample is valid or invalid
- This interface, at its core, appears to be blocking. However, you can still implement this interface in a non-blocking way. For example, you could always return the most recent altitude measurement, while there is another thread (or a timer) that handles updates to that measurement asynchronously.
Definition at line 68 of file barometric_sensor.h.
◆ readAltitude
bool(* BarometricSensor::readAltitude) (int32_t *const altitude) |
Get the current altitude, corrected for Sea Level Pressure.
If no value for SLP has been supplied, calculations will assume 1013.25 hPa.
- Precondition
- The pressure sensor has been properly initialized by the system.
-
The altitude parameter is not NULL.
- Postcondition
- If the measurement is valid, the data pointed to by the altitude parameter will be updated with the latest reading.
-
If the measurement is invalid, the data pointed to by the altitude parameter will remain unchanged.
- Returns
- Current altitude in meters (m), corrected for sea level pressure. Altitude is specified as a signed 32-bit fixed-point number in format Q21.10.
Definition at line 104 of file barometric_sensor.h.
◆ readPressure
bool(* BarometricSensor::readPressure) (uint32_t *const pressure) |
Read the current pressure from the device.
- Precondition
- The pressure sensor has been properly initialized by the system.
-
The pressure parameter is not NULL.
- Postcondition
- If the measurement is valid, the data pointed to by the pressure parameter will be updated with the latest reading.
-
If the measurement is invalid, the data pointed to by the pressure parameter will remain unchanged.
- Parameters
-
[in,out] | pressure | Pointer which will be used for storing the latest pressure reading. This pointer must not be null. |
Pressure will be formatted as a 32-bit fixed-point integer with format UQ22.10, giving a resolution of 0.001 hPa.
- Returns
- True if the sample is valid, false if invalid (e.g., an error occured)
Definition at line 88 of file barometric_sensor.h.
◆ setSeaLevelPressure
void(* BarometricSensor::setSeaLevelPressure) (uint32_t slp) |
Set the sea level pressure.
- Parameters
-
[in] | slp | The current sea level pressure in hPa. slp should be specified as an unsigned 32-bit fixed-point number in format UQ22.10. |
Definition at line 111 of file barometric_sensor.h.
The documentation for this struct was generated from the following file: