nRF5 SDK v17.1.0
Data Structures | Macros | Typedefs | Functions
TEMP driver

Temperature sensor (TEMP) driver. More...

Data Structures

struct  nrfx_temp_config_t
 Structure for TEMP configuration. More...
 

Macros

#define NRFX_TEMP_DEFAULT_CONFIG
 TEMP default configuration. More...
 

Typedefs

typedef void(* nrfx_temp_data_handler_t )(int32_t raw_temperature)
 TEMP driver data ready handler type. More...
 

Functions

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. More...
 
void nrfx_temp_uninit (void)
 Function for uninitializing the TEMP driver.
 
__STATIC_INLINE int32_t nrfx_temp_result_get (void)
 Function for getting the temperature measurement in a 2's complement signed value representation. More...
 
int32_t nrfx_temp_calculate (int32_t raw_measurement)
 Function for calculating the temperature value in Celsius scale from raw data. More...
 
nrfx_err_t nrfx_temp_measure (void)
 Function for starting the temperature measurement. More...
 

Detailed Description

Temperature sensor (TEMP) driver.

Macro Definition Documentation

#define NRFX_TEMP_DEFAULT_CONFIG
Value:
{ \
.interrupt_priority = NRFX_TEMP_DEFAULT_CONFIG_IRQ_PRIORITY, \
}

TEMP default configuration.

Typedef Documentation

typedef void(* nrfx_temp_data_handler_t)(int32_t raw_temperature)

TEMP driver data ready handler type.

Parameters
temperatureRaw temperature in a 2's complement signed value representation. This value can be converted to Celsius scale using the nrfx_temp_calculate() function.

Function Documentation

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_measurementTemperature value in a 2's complement signed value representation.
Returns
Temperature measurement result.
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.

Parameters
[in]p_configPointer to the structure with initial configuration.
[in]handlerData handler provided by the user. If not provided, the driver is initialized in blocking mode.
Return values
NRFX_SUCCESSDriver was successfully initialized.
NRFX_ERROR_ALREADY_INITIALIZEDDriver was already initialized.
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.

Return values
NRFX_SUCCESSIn 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_INTERNALIn 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.

Documentation feedback | Developer Zone | Subscribe | Updated