38 convert = (int32_t)(temp->
i) * 10000;
39 convert += (int32_t)(temp->
f);
40 convert = ((convert * 9) / 5) + (32 * 10000);
42 temp->
i = (int16_t)(convert / 10000);
43 temp->
f = (int16_t)(convert % 10000);
87 regid[0] = ((uint8_t) reg) & 0x3;
110 *val = (((uint16_t)(data[0])) << 8) | data[1];
153 data[0] = ((uint8_t) reg) & 0x3;
158 data[1] = (uint8_t) val;
163 data[1] = (uint8_t)(val >> 8);
164 data[2] = (uint8_t) val;
224 tmp = (uint32_t)(val >> 4);
229 tmp = (~tmp + 1) & 0xfff;
230 temp->
i = -(int16_t)(tmp >> 4);
231 temp->
f = -(int16_t)((tmp & 0xf) * 625);
235 temp->
i = (int16_t)(tmp >> 4);
236 temp->
f = (int16_t)((tmp & 0xf) * 625);
I2C_TransferReturn_TypeDef I2CSPM_Transfer(I2C_TypeDef *i2c, I2C_TransferSeq_TypeDef *seq)
Perform I2C transfer.
#define I2C_FLAG_WRITE
Indicate plain write sequence: S+ADDR(W)+DATA0+P.
I2C_TransferReturn_TypeDef
int TEMPSENS_RegisterGet(I2C_TypeDef *i2c, uint8_t addr, TEMPSENS_Register_TypeDef reg, uint16_t *val)
Read sensor register content.
void TEMPSENS_Celsius2Fahrenheit(TEMPSENS_Temp_TypeDef *temp)
Convert temperature from Celsius to Fahrenheit.
int TEMPSENS_RegisterSet(I2C_TypeDef *i2c, uint8_t addr, TEMPSENS_Register_TypeDef reg, uint16_t val)
Write to sensor register.
I2C simple poll-based master mode driver for the DK/STK.
struct I2C_TransferSeq_TypeDef::@0 buf[2]
Temperature sensor driver for DS75 temperature sensor compatible device on the DK.
Master mode transfer message structure used to define a complete I2C transfer sequence (from start to...
TEMPSENS_Register_TypeDef
#define I2C_FLAG_WRITE_READ
Indicate combined write/read sequence: S+ADDR(W)+DATA0+Sr+ADDR(R)+DATA1+P.
uint16_t addr
Address to use after (repeated) start.
int TEMPSENS_TemperatureGet(I2C_TypeDef *i2c, uint8_t addr, TEMPSENS_Temp_TypeDef *temp)
Fetch current temperature from temperature sensor (in Celsius).