Embedded Artistry C Interfaces
A reference collection of abstract interfaces in C.
|
Virtual Barometric Pressure/Altimeter Interface (with callback support) More...
#include <barometric_sensor.h>
Public Attributes | |
bool(* | readPressure )(uint32_t *const pressure) |
Request an pressure sample from the device. More... | |
bool(* | readAltitude )(int32_t *const altitude) |
Request an altitude sample from the device. More... | |
void(* | setSeaLevelPressure )(uint32_t slp) |
Set the sea level pressure. More... | |
void(* | registerNewSampleCb )(const NewBarometricSampleCb callback) |
Register a NewBarometricSampleCb function. More... | |
void(* | unregisterNewSampleCb )(const NewBarometricSampleCb callback) |
Remove a registered NewBarometricSampleCb function. More... | |
void(* | registerErrorCb )(const BarometricErrorCb callback) |
Register a BarometricErrorCb function. More... | |
void(* | unregisterErrorCb )(const BarometricErrorCb callback) |
Remove a registered BarometricErrorCb function. More... | |
Virtual Barometric Pressure/Altimeter Interface (with callback support)
A standard interface for a device which can measure barometric pressure. In this variant, the readPressure() and readAltitude() functions can be used in the following ways:
Definition at line 193 of file barometric_sensor.h.
bool(* BarometricSensor_withCb::readAltitude) (int32_t *const altitude) |
Request an altitude sample from the device.
Altitude will be corrected for Sea Level Pressure. If no value for SLP has been supplied, calculations will assume 1013.25 hPa.
[in,out] | altitude | Pointer which will be used for storing the latest altitude reading. |
If altitude is NULL, the function will only supply the altitude sample to registered callback functions.
Altitude is specified as a signed 32-bit fixed-point number in format Q21.10
Altitude will be corrected for Sea Level Pressure.
Definition at line 247 of file barometric_sensor.h.
bool(* BarometricSensor_withCb::readPressure) (uint32_t *const pressure) |
Request an pressure sample from the device.
[in,out] | pressure | Pointer which will be used for storing the latest pressure reading. |
If pressure is NULL, the function will only supply the pressure sample to registered callback functions. I
Pressure will be formatted as a 32-bit fixed-point integer with format UQ22.10, giving a resolution of 0.001 hPa.
Definition at line 218 of file barometric_sensor.h.
void(* BarometricSensor_withCb::registerErrorCb) (const BarometricErrorCb callback) |
Register a BarometricErrorCb function.
This function will add the callback input to a list of functions to execute when a pressure sensor error occurs.
[in] | callback | The callback function pointer to register on the "error" callback list. |
Definition at line 293 of file barometric_sensor.h.
void(* BarometricSensor_withCb::registerNewSampleCb) (const NewBarometricSampleCb callback) |
Register a NewBarometricSampleCb function.
This function will add the callback input to a list of functions to execute when a new and valid sample is available.
[in] | callback | The callback function pointer to register on the "new sample" callback list. |
Definition at line 267 of file barometric_sensor.h.
void(* BarometricSensor_withCb::setSeaLevelPressure) (uint32_t slp) |
Set the sea level pressure.
[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 254 of file barometric_sensor.h.
void(* BarometricSensor_withCb::unregisterErrorCb) (const BarometricErrorCb callback) |
Remove a registered BarometricErrorCb function.
This function will remove a callback function from the registered list of "error" callbacks. If the function has not been previously registered, the parameter will be ignored and the list will be unchanged.
[in] | callback | The callback function pointer to remove from the "error" callback list. |
Definition at line 306 of file barometric_sensor.h.
void(* BarometricSensor_withCb::unregisterNewSampleCb) (const NewBarometricSampleCb callback) |
Remove a registered NewBarometricSampleCb function.
This function will remove a callback function from the registered list of "new sample" callbacks. If the function has not been previously registered, the parameter will be ignored and the list will be unchanged.
[in] | callback | The callback function pointer to remove from the "new sample" callback list. |
Definition at line 280 of file barometric_sensor.h.