Temperature sensor class.
More...
|
| | nRF5 |
| | Nordic nRF5 die temperature sensor (TEMP).
|
| |
| | SF32LB |
| | SiFli SF32LB die temperature sensor (TSEN).
|
| |
| | Simulator |
| | Simulated temperature sensor, reading what pbl_temp_sim_set() sets, 25 degrees Celsius by default.
|
| |
Temperature sensor class.
A temperature sensor is a struct pbl_temp device. Every call into the driver runs with the device lock held, a recursive mutex.
int32_t temp;
}
const struct pbl_temp *const DIE_TEMP
The board's die temperature sensor.
int pbl_temp_read(const struct pbl_temp *temp, int32_t *millicelsius)
Read the temperature.
◆ pbl_temp_state
Temperature sensor runtime state.
| Data Fields |
|
struct pbl_mutex |
lock |
Device lock. |
◆ pbl_temp
◆ PBL_TEMP_INIT
| #define PBL_TEMP_INIT |
( |
|
sym, |
|
|
|
_name, |
|
|
|
_parent, |
|
|
|
_deps, |
|
|
|
_ops |
|
) |
| |
Value: { \
.ops = (_ops), \
.state = &sym##_temp_state, \
}
#define PBL_DEVICE_INIT_CLASS(sym, _name, _init, _parent, _deps, _cls)
Initializer for the struct pbl_device of device instance sym, in class _cls.
Definition device.h:145
Initialize a struct pbl_temp.
- Parameters
-
◆ PBL_TEMP_STATE_DEFINE
| #define PBL_TEMP_STATE_DEFINE |
( |
|
sym | ) |
|
Value:
#define PBL_DEVICE_STATE_DEFINE(sym)
Define the runtime state of device instance sym.
Definition device.h:131
struct pbl_mutex lock
Device lock.
Definition temp.h:42
Temperature sensor runtime state.
Definition temp.h:40
#define PBL_MUTEX_INITIALIZER
Static initializer for an unlocked mutex.
Definition mutex.h:50
Define the class state of a temperature sensor.
- Parameters
-
| sym | Symbol of the instance. |
◆ pbl_temp_read()
| int pbl_temp_read |
( |
const struct pbl_temp * |
temp, |
|
|
int32_t * |
millicelsius |
|
) |
| |
Read the temperature.
- Warning
- The sensor may not be calibrated: do not rely on the reading as an accurate absolute temperature.
- Parameters
-
| temp | Temperature sensor. |
| [out] | millicelsius | Temperature in millidegrees Celsius. |
- Returns
- 0, -ENODEV if the sensor is not ready, -ETIMEDOUT if the conversion timed out, or a negative errno.
◆ DIE_TEMP
The board's die temperature sensor.