Virtual Temperature Sensor Interface.
More...
#include <temperature_sensor.h>
Virtual Temperature Sensor Interface.
A standard interface for a device which can measure temperature.
This device measures temperature in °C.
Fundamental Assumptions
- The device produces temperature readings
- The device reports temperature readings in °C
- Temperature readings will be provided as a signed 16-bit fixed point integer in format Q7.8
- The device will indicate whether the current reading is valid or invalid
Implementation Notes
- 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 measurement, while there is another thread (or a timer) that handles updates to that measurement asynchronously.
Definition at line 62 of file temperature_sensor.h.
◆ readTemperature
bool(* TemperatureSensor::readTemperature) (int16_t *const temperature) |
Get the current temperature in °C.
- Precondition
- The sensor has been properly initialized by the system.
-
The temperature parameter is not NULL.
- Postcondition
- If the measurement is valid, the data pointed to by the temperature parameter will be updated with the latest reading.
-
If the measurement is invalid, the data pointed to by the temperature parameter will remain unchanged.
- Parameters
-
[in,out] | Current | temperature in °C. Temperature readings will be provided as a signed 16-bit fixed point integer in format Q7.8 |
- Returns
- True if the sample is valid, false if invalid (e.g., an error occured)
Definition at line 78 of file temperature_sensor.h.
The documentation for this struct was generated from the following file: