EFM32 Gecko Software Documentation
efm32g-doc-5.1.2
|
Data Structures | |
struct | TEMPSENS_Temp_TypeDef |
Macros | |
#define | TEMPSENS_DK_ADDR 0x90 |
Enumerations | |
enum | TEMPSENS_Register_TypeDef { tempsensRegTemp = 0, tempsensRegConfig = 1, tempsensRegHysteresis = 2, tempsensRegShutdown = 3 } |
Functions | |
void | TEMPSENS_Celsius2Fahrenheit (TEMPSENS_Temp_TypeDef *temp) |
Convert temperature from Celsius to Fahrenheit. More... | |
int | TEMPSENS_RegisterGet (I2C_TypeDef *i2c, uint8_t addr, TEMPSENS_Register_TypeDef reg, uint16_t *val) |
Read sensor register content. More... | |
int | TEMPSENS_RegisterSet (I2C_TypeDef *i2c, uint8_t addr, TEMPSENS_Register_TypeDef reg, uint16_t val) |
Write to sensor register. More... | |
int | TEMPSENS_TemperatureGet (I2C_TypeDef *i2c, uint8_t addr, TEMPSENS_Temp_TypeDef *temp) |
Fetch current temperature from temperature sensor (in Celsius). More... | |
#define TEMPSENS_DK_ADDR 0x90 |
I2C device address for temperature sensor on DK
Definition at line 42 of file tempsens.h.
Available registers in DS75 sensor device
Enumerator | |
---|---|
tempsensRegTemp |
Temperature register (read-only) |
tempsensRegConfig |
Configuration register |
tempsensRegHysteresis |
Hysteresis register |
tempsensRegShutdown |
Overtemperature shutdown register |
Definition at line 50 of file tempsens.h.
void TEMPSENS_Celsius2Fahrenheit | ( | TEMPSENS_Temp_TypeDef * | temp | ) |
Convert temperature from Celsius to Fahrenheit.
[in,out] | temp | Reference to structure to holding temperature in Celsius to convert. Upon return, it has been changed to Fahrenheit. |
Definition at line 32 of file tempsens.c.
References TEMPSENS_Temp_TypeDef::f, and TEMPSENS_Temp_TypeDef::i.
int TEMPSENS_RegisterGet | ( | I2C_TypeDef * | i2c, |
uint8_t | addr, | ||
TEMPSENS_Register_TypeDef | reg, | ||
uint16_t * | val | ||
) |
Read sensor register content.
If reading the temperature register, when a measurement is completed inside the sensor device, the new measurement may not be stored. For this reason, the temperature should not be polled with a higher frequency than the measurement conversion time for a given resolution configuration. Please refer to sensor device datasheet.
[in] | i2c | Pointer to I2C peripheral register block. |
[in] | addr | I2C address for temperature sensor, in 8 bit format, where LSB is reserved for R/W bit. |
[in] | reg | Register to read. |
[out] | val | Reference to place register read. |
Definition at line 74 of file tempsens.c.
References I2C_TransferSeq_TypeDef::addr, I2C_TransferSeq_TypeDef::buf, I2C_TransferSeq_TypeDef::data, I2C_TransferSeq_TypeDef::flags, I2C_FLAG_WRITE_READ, I2CSPM_Transfer(), i2cTransferDone, I2C_TransferSeq_TypeDef::len, and tempsensRegConfig.
Referenced by TEMPSENS_TemperatureGet().
int TEMPSENS_RegisterSet | ( | I2C_TypeDef * | i2c, |
uint8_t | addr, | ||
TEMPSENS_Register_TypeDef | reg, | ||
uint16_t | val | ||
) |
Write to sensor register.
[in] | i2c | Pointer to I2C peripheral register block. |
[in] | addr | I2C address for temperature sensor, in 8 bit format, where LSB is reserved for R/W bit. |
[in] | reg | Register to write (temperature register cannot be written). |
[in] | val | Value used when writing to register. |
Definition at line 136 of file tempsens.c.
References I2C_TransferSeq_TypeDef::addr, I2C_TransferSeq_TypeDef::buf, I2C_TransferSeq_TypeDef::data, I2C_TransferSeq_TypeDef::flags, I2C_FLAG_WRITE, I2CSPM_Transfer(), i2cTransferDone, I2C_TransferSeq_TypeDef::len, tempsensRegConfig, and tempsensRegTemp.
int TEMPSENS_TemperatureGet | ( | I2C_TypeDef * | i2c, |
uint8_t | addr, | ||
TEMPSENS_Temp_TypeDef * | temp | ||
) |
Fetch current temperature from temperature sensor (in Celsius).
If reading the temperature, when a measurement is completed inside the sensor device, the new measurement may not be stored. For this reason, the temperature should not be polled with a higher frequency than the measurement conversion time for a given resolution configuration. Please refer to sensor device datasheet.
[in] | i2c | Pointer to I2C peripheral register block. |
[in] | addr | I2C address for temperature sensor, in 8 bit format, where LSB is reserved for R/W bit. |
[out] | temp | Reference to structure to place temperature (in Celsius). |
Definition at line 209 of file tempsens.c.
References TEMPSENS_Temp_TypeDef::f, TEMPSENS_Temp_TypeDef::i, TEMPSENS_RegisterGet(), and tempsensRegTemp.