Temperature Sensor Synchronous Driver

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.

Summary of the API's Functional Features

The API provides functions to:
  • Initialize and deinitialize the driver and associated hardware

  • Enable or disable the TSENS hardware

  • Temperature Measurement (Celsius)

Summary of Configuration Options

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.

Driver Implementation Description

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.

Example of Usage

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);
          }
        

Dependencies

  • The Temperature Sensor peripheral and its related I/O lines and clocks