The functions in the Temperature Sensor (TSENS) synchronous driver will block (i.e. not return) until the operation is done.
The temperature result can be get by temp_sync_read, if the return is ERR_NONE then it's the result of the operating temperature of the device.
Initialize and deinitialize the driver and associated hardware
Enable or disable the TSENS hardware
Temperature Measurement (Celsius)
The main TSENS parameters can be configured in START. Many of these parameters are used by the temp_sync_init function when initializing the driver and underlying hardware.
After the TSENS hardware initialization, the operating temperature of the device can be get by temp_sync_read.
The temperature unit used in this driver is Celsius.
The following shows a simple example of using the TSENS driver to get device temperature. The TSENS must have been initialized by tsens_sync_init().
/**
* Example of using TEMPERATURE_SENSOR_0 to generate waveform.
*/
void TEMPERATURE_SENSOR_0_example(void)
{
int32_t temp;
temp_sync_enable(&TEMPERATURE_SENSOR_0);
temp_sync_read(&TEMPERATURE_SENSOR_0, &temp);
}
The Temperature Sensor peripheral and its related I/O lines and clocks