![]() |
NHS31xx SW API
|
The Temperature Sensor driver (TSen) provides the API to control all the functionalities of the Temperature Sensor HW block. This block reads the temperature, in Kelvin, using a configured resolution. The block does feature interrupt when measurement complete, but it does not feature continuous mode.
Data Structures | |
struct | NSS_TSEN_T |
Enumerations | |
enum | TSEN_RESOLUTION_T { TSEN_7BITS = 2, TSEN_8BITS = 3, TSEN_9BITS = 4, TSEN_10BITS = 5, TSEN_11BITS = 6, TSEN_12BITS = 7 } |
enum | TSEN_STATUS_T { TSEN_STATUS_COARSE_RANGE_LOW = (1 << 0), TSEN_STATUS_COARSE_RANGE_HIGH = (1 << 1), TSEN_STATUS_FINE_RANGE_LOW = (1 << 2), TSEN_STATUS_FINE_RANGE_HIGH = (1 << 3), TSEN_STATUS_MEASUREMENT_SUCCESS = (1 << 4), TSEN_STATUS_SENSOR_IN_OPERATION = (1 << 8), TSEN_STATUS_MEASUREMENT_DONE = (1 << 9) } |
enum | TSEN_INT_T { TSEN_INT_MEASUREMENT_RDY = (1 << 0), TSEN_INT_THRESHOLD_LOW = (1 << 1), TSEN_INT_THRESHOLD_HIGH = (1 << 2), TSEN_INT_NONE = 0, TSEN_INT_ALL = 0x0F } |
struct NSS_TSEN_T |
Temperature Sensor register block structure
Data Fields | ||
---|---|---|
__IO uint32_t | CR |
Control register. Controls the start of a Temperature Measurement. |
__I uint32_t | DR |
Data Register. Holds the current temperature data in either raw or calibrated format. |
__I uint32_t | SR |
Status Register. Holds the status of the temperature sensor. |
__IO uint32_t | SP0 |
Setup Register 0. Controls the resolution and mode settings for the zoom ADC of the temperature sensor |
__IO uint32_t | SP1 |
Setup Register 1. Contains the calibration parameter "A". |
__IO uint32_t | SP2 |
Setup Register 2. Contains the calibration parameter "B". |
__IO uint32_t | SP3 |
Setup Register 3. Contains the calibration parameter "ALPHA". |
__IO uint32_t | TLO |
Low temperature threshold register. Contains the low-temperature threshold value. |
__IO uint32_t | THI |
High temperature threshold register. Contains the high-temperature threshold value. |
__IO uint32_t | IMSC |
Interrupt Mask Set/Clear Register. Controls whether each of the three possible interrupt conditions in the temperature sensor are enabled. |
__I uint32_t | RIS |
Raw Interrupt Status Register. Contains a 1 for each interrupt condition that is asserted, regardless of whether or not the interrupt is enabled in the TSENIMSC register. |
__I uint32_t | MIS |
Masked Interrupt Status Register. Contains a 1 for each interrupt condition that is asserted and enabled in the TSENIMSC registers |
__O uint32_t | ICR |
Interrupt Clear Register. Software can write one or more one(s) to this write-only register to clear the corresponding interrupt condition(s) in the temperature sensor controller. |
enum TSEN_RESOLUTION_T |
Possible resolutions for the Temperature Sensor
enum TSEN_STATUS_T |
Possible status bits within the Temperature Sensor block
enum TSEN_INT_T |
Possible Temperature Sensor interrupt flags
void Chip_TSen_Init | ( | NSS_TSEN_T * | pTSen | ) |
Initializes the TSEN peripheral with default settings. This function also enables the TSEN peripheral power and clock.
pTSen | : The base address of the TSEN peripheral on the chip |
void Chip_TSen_DeInit | ( | NSS_TSEN_T * | pTSen | ) |
Disables the temperature sensor. This function disables the TSEN peripheral power, clock and interrupts (if enabled), which means that the result of any ongoing measurement will be lost.
pTSen | : The base address of the TSEN peripheral on the chip |
void Chip_TSen_SetResolution | ( | NSS_TSEN_T * | pTSen, |
TSEN_RESOLUTION_T | resolution | ||
) |
Sets the resolution for the Temperature Sensor.
pTSen | : The base address of the TSEN peripheral on the chip |
resolution | : Sensor resolution |
TSEN_RESOLUTION_T Chip_TSen_GetResolution | ( | NSS_TSEN_T * | pTSen | ) |
Gets the Temperature Sensor configured resolution.
pTSen | : The base address of the TSEN peripheral on the chip |
void Chip_TSen_Start | ( | NSS_TSEN_T * | pTSen | ) |
Starts a temperature measurement. After this function is called, the measurement will start.
pTSen | : The base address of the TSEN peripheral on the chip |
TSEN_STATUS_T Chip_TSen_ReadStatus | ( | NSS_TSEN_T * | pTSen, |
TSEN_RESOLUTION_T * | pResolution | ||
) |
Returns the status information from the Temperature Sensor In case no previous measurement exists, the output parameter value is undefined.
pTSen | : The base address of the TSEN peripheral on the chip |
pResolution | : pointer to write the sensor resolution used in the last completed measurement |
int Chip_TSen_GetValue | ( | NSS_TSEN_T * | pTSen | ) |
Gets the measured temperature value (bit density) present in the data register
pTSen | : The base address of the TSEN peripheral on the chip |
int Chip_TSen_NativeToKelvin | ( | int | native, |
int | multiplier | ||
) |
Converts a temperature value in the native format into a human readable format in Kelvin. The output value is a human readable signed temperature value in Kelvin multiplied by parameter "multiplier".
native | : The temperature value in the native format |
multiplier | : The multiplication factor of the converted temperature |
int Chip_TSen_KelvinToNative | ( | int | kelvin, |
int | multiplier | ||
) |
Converts a temperature value in the human readable format in Kelvin into the native format. The input value is a human readable signed temperature value in Kelvin multiplied by parameter "multiplier".
kelvin | : The input temperature value in the human readable format |
multiplier | : The multiplication factor of the input human readable format temperature |
int Chip_TSen_NativeToCelsius | ( | int | native, |
int | multiplier | ||
) |
Converts a temperature value in the native format into a human readable format in Celsius. The output value is a human readable signed temperature value in Celsius multiplied by parameter "multiplier".
native | : The temperature value in the native format |
multiplier | : The multiplication factor for the converted temperature |
int Chip_TSen_CelsiusToNative | ( | int | celsius, |
int | multiplier | ||
) |
Converts a temperature value in the human readable format in Celsius into the native format. The input value is a human readable signed temperature value in Celsius multiplied by parameter "multiplier".
celsius | : The input temperature value in the human readable format |
multiplier | : The multiplication factor of the input human readable format temperature |
int Chip_TSen_NativeToFahrenheit | ( | int | native, |
int | multiplier | ||
) |
Converts a temperature value in the native format to a human readable format in Fahrenheit The output value is a human readable signed temperature value in Fahrenheit multiplied by parameter "multiplier".
native | : The temperature value in the native format |
multiplier | : The multiplication factor for the converted temperature |
int Chip_TSen_FahrenheitToNative | ( | int | fahrenheit, |
int | multiplier | ||
) |
Converts a temperature value in the human readable format in Fanhrenheit into the native format. The input value is a human readable signed temperature value in Fanhrenheit multiplied by parameter "multiplier".
fahrenheit | : The input temperature value in the human readable format |
multiplier | : The multiplication factor of the input human readable format temperature |
void Chip_TSen_Int_SetThresholdLow | ( | NSS_TSEN_T * | pTSen, |
int | native | ||
) |
Sets the low-temperature threshold value.
pTSen | : The base address of the TSEN peripheral on the chip |
native | : The value to set for the temperature low-threshold |
int Chip_TSen_Int_GetThresholdLow | ( | NSS_TSEN_T * | pTSen | ) |
Retrieves the low-temperature threshold value.
pTSen | : The base address of the TSEN peripheral on the chip |
void Chip_TSen_Int_SetThresholdHigh | ( | NSS_TSEN_T * | pTSen, |
int | native | ||
) |
Sets the high-temperature threshold value.
pTSen | : The base address of the TSEN peripheral on the chip |
native | : The value to set for the high-threshold |
int Chip_TSen_Int_GetThresholdHigh | ( | NSS_TSEN_T * | pTSen | ) |
Retrieves the high-temperature threshold value.
pTSen | : The base address of the TSEN peripheral on the chip |
void Chip_TSen_Int_SetEnabledMask | ( | NSS_TSEN_T * | pTSen, |
TSEN_INT_T | mask | ||
) |
Enables/Disables Temperature Sensor interrupts.
pTSen | : The base address of the TSEN peripheral on the chip |
mask | : interrupt enabled mask to set |
TSEN_INT_T Chip_TSen_Int_GetEnabledMask | ( | NSS_TSEN_T * | pTSen | ) |
Retrieves the Temperature Sensor interrupt enabled mask.
pTSen | : The base address of the TSEN peripheral on the chip |
TSEN_INT_T Chip_TSen_Int_GetRawStatus | ( | NSS_TSEN_T * | pTSen | ) |
Retrieves a bitVector with the RAW Temperature Sensor interrupt flags
pTSen | : The base address of the TSEN peripheral on the chip |
void Chip_TSen_Int_ClearRawStatus | ( | NSS_TSEN_T * | pTSen, |
TSEN_INT_T | flags | ||
) |
Clears the required Temperature Sensor interrupt flags
pTSen | : The base address of the TSEN peripheral on the chip |
flags | : BitVector indicating which interrupt flags to clear |