Embedded Artistry C Interfaces
A reference collection of abstract interfaces in C.
Public Attributes | List of all members
BarometricSensor Struct Reference

Virtual Barometric Pressure/Altimeter Sensor Interface. More...

#include <barometric_sensor.h>

Public Attributes

bool(* readPressure )(uint32_t *const pressure)
 Read the current pressure from the device. More...
 
bool(* readAltitude )(int32_t *const altitude)
 Get the current altitude, corrected for Sea Level Pressure. More...
 
void(* setSeaLevelPressure )(uint32_t slp)
 Set the sea level pressure. More...
 

Detailed Description

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

Definition at line 68 of file barometric_sensor.h.

Member Data Documentation

◆ 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]pressurePointer 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]slpThe 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: