TEMP driver

group nrfx_temp

Temperature sensor (TEMP) driver.



TEMP default configuration.


typedef void (*nrfx_temp_data_handler_t)(int32_t raw_temperature)

TEMP driver data ready handler type.

  • 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.


nrfx_err_t nrfx_temp_init(nrfx_temp_config_t const *p_config, nrfx_temp_data_handler_t handler)

Function for initializing the TEMP driver.

  • p_config[in] Pointer to the structure with initial configuration.

  • handler[in] Data handler provided by the user. If not provided, the driver is initialized in blocking mode.


  • NRFX_SUCCESS – Driver was successfully initialized.

  • NRFX_ERROR_ALREADY_INITIALIZED – Driver was already initialized.

void nrfx_temp_uninit(void)

Function for uninitializing the TEMP driver.

NRFX_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.


Temperature measurement result in a 2’s complement signed value representation.

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].

  • raw_measurement[in] Temperature value in a 2’s complement signed value representation.


Temperature measurement result.

nrfx_err_t nrfx_temp_measure(void)

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.



    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.


    In non-blocking mode: Not applicable.

    In blocking mode: Measurement data ready event did not occur.

struct nrfx_temp_config_t
#include <nrfx_temp.h>

Structure for TEMP configuration.

Public Members

uint8_t interrupt_priority

Interrupt priority.