Temperature sensor (TEMP) driver.
More...
Temperature sensor (TEMP) driver.
#define NRFX_TEMP_DEFAULT_CONFIG |
Value:{ \
.interrupt_priority = NRFX_TEMP_DEFAULT_CONFIG_IRQ_PRIORITY, \
}
TEMP default configuration.
typedef void(* nrfx_temp_data_handler_t)(int32_t raw_temperature) |
TEMP driver data ready handler type.
- Parameters
-
temperature | Raw temperature in a 2's complement signed value representation. This value can be converted to Celsius scale using the nrfx_temp_calculate() function. |
int32_t nrfx_temp_calculate |
( |
int32_t |
raw_measurement | ) |
|
Function for calculating the temperature value in Celsius scale from raw data.
The returned temperature value is in Celsius scale, multiplied by 100 For example, the actual temperature of 25.75[C] will be returned as a 2575 signed integer. Measurement accuracy is 0.25[C].
- Parameters
-
[in] | raw_measurement | Temperature value in a 2's complement signed value representation. |
- Returns
- Temperature measurement result.
Function for initializing the TEMP driver.
- Parameters
-
[in] | p_config | Pointer to the structure with initial configuration. |
[in] | handler | Data handler provided by the user. If not provided, the driver is initialized in blocking mode. |
- Return values
-
NRFX_SUCCESS | Driver was successfully initialized. |
NRFX_ERROR_ALREADY_INITIALIZED | Driver was already initialized. |
Function for starting the temperature measurement.
Non-blocking mode: This function returns immediately. After a measurement, the handler specified during initialization is called, with measurement result as the parameter.
Blocking mode: This function waits until the measurement is finished. The value should be read using the nrfx_temp_result_get() function.
- Return values
-
NRFX_SUCCESS | In non-blocking mode: Measurement was started. An interrupt will be generated soon.
In blocking mode: Measurement was started and finished. Data can be read using the nrfx_temp_result_get() function. |
NRFX_ERROR_INTERNAL | In non-blocking mode: Not applicable.
In blocking mode: Measurement data ready event did not occur. |
__STATIC_INLINE int32_t nrfx_temp_result_get |
( |
void |
| ) |
|
Function for getting the temperature measurement in a 2's complement signed value representation.
This function returns the last value prepared by the TEMP peripheral. In blocking mode, it should be used after calling the nrfx_temp_measure() function. In non-blocking mode, it is called internally by the driver, and the value it returns is passed to the data handler.
- Returns
- Temperature measurement result in a 2's complement signed value representation.