63 #define HTSEN_I2C_ADDRESS (0x44u)
66 #define HTSEN_READ_TIMEOUT_10ms (10u)
69 #define HTSEN_TIME_MEAS_WAIT_10ms (2u)
72 #define HTSEN_TEMP_SCALING (175.0f)
73 #define HTSEN_TEMP_OFFSET (-45.0f)
74 #define HTSEN_TEMP_DEG_TO_DDEG (10.0f)
78 #define HTSEN_HUMIDITY_SCALING (100.0f)
79 #define HTSEN_FULL_SCALE (65535.0f)
83 #define HTSEN_TEMPERATURE_LSB (1u)
84 #define HTSEN_TEMPERATURE_MSB (0u)
85 #define HTSEN_TEMPERATURE_BYTE_CRC (2u)
86 #define HTSEN_HUMIDITY_LSB (4u)
87 #define HTSEN_HUMIDITY_MSB (3u)
88 #define HTSEN_HUMIDITY_BYTE_CRC (5u)
89 #define HTSEN_BYTE_SHIFT (8u)
90 #define HTSEN_MEASUREMENT_LENGTH_IN_BYTES (2u)
91 #define HTSEN_TOTAL_DATA_LENGTH_IN_BYTES (6u)
95 #define HTSEN_CRC_POLYNOMIAL (0x31u)
96 #define HTSEN_CRC_SEED (0xFF)
97 #define HTSEN_CRC_BYTE_SHIFT (0x8u)
98 #define HTSEN_CRC_MSB_MASK (0x80u)
99 #define HTSEN_CRC_8BIT_MASK (0xFFu)
131 #define HTSEN_CLOCK_STRETCHING (false)
132 #if (HTSEN_CLOCK_STRETCHING == false)
133 #define HTSEN_SINGLE_MEAS_MSB (0x24u)
134 #define HTSEN_HIGH_REPEATABILITY (0x00u)
135 #define HTSEN_MEDIUM_REPEATABILITY (0x0Bu)
136 #define HTSEN_LOW_REPEATABILITY (0x16u)
138 #define HTSEN_SINGLE_MEAS_MSB (0x2Cu)
139 #define HTSEN_HIGH_REPEATABILITY (0x06u)
140 #define HTSEN_MEDIUM_REPEATABILITY (0x0Du)
141 #define HTSEN_LOW_REPEATABILITY (0x10u)
144 #define HTSEN_SINGLE_MEAS_LSB (HTSEN_HIGH_REPEATABILITY)
197 for (uint8_t i = 0u; i < length; i++) {
213 return (int16_t)temperature_ddeg;
218 return (uint8_t)humidity_perc;
250 if (i2cReadReturn !=
STD_OK) {
288 #ifdef UNITY_UNIT_TEST
#define DATA_WRITE_DATA(...)
#define FAS_ASSERT(x)
Assertion macro that asserts that x is true.
#define FAS_TRAP
Define that evaluates to essential boolean false thus tripping an assert.
#define NULL_PTR
Null pointer.
enum STD_RETURN_TYPE STD_RETURN_TYPE_e
#define HTSEN_TEMPERATURE_BYTE_CRC
#define HTSEN_CRC_MSB_MASK
#define HTSEN_SINGLE_MEAS_LSB
#define HTSEN_HUMIDITY_SCALING
#define HTSEN_I2C_ADDRESS
#define HTSEN_HUMIDITY_LSB
static uint8_t htsen_counter
#define HTSEN_READ_TIMEOUT_10ms
#define HTSEN_TEMP_OFFSET
#define HTSEN_TOTAL_DATA_LENGTH_IN_BYTES
#define HTSEN_TEMP_SCALING
#define HTSEN_TEMPERATURE_MSB
#define HTSEN_SINGLE_MEAS_MSB
#define HTSEN_TEMPERATURE_LSB
#define HTSEN_HUMIDITY_BYTE_CRC
#define HTSEN_TEMP_DEG_TO_DDEG
static int16_t HTSENS_ConvertRawTemperature(uint16_t data)
computes temperature measurement from raw value.
static uint8_t HTSENS_CalculateCrc8(const uint8_t *data, uint32_t length)
computes CRC8.
#define HTSEN_HUMIDITY_MSB
#define HTSEN_MEASUREMENT_LENGTH_IN_BYTES
static HTSEN_STATE_e htsen_state
describes the current state of the measurement
static DATA_BLOCK_HTSEN_s htsen_data
uint8_t TEST_HTSEN_TestCalculateCrc8(uint8_t *data, uint32_t length)
#define HTSEN_TIME_MEAS_WAIT_10ms
#define HTSEN_CRC_BYTE_SHIFT
static uint8_t htsen_timeout_10ms
#define HTSEN_CRC_POLYNOMIAL
#define HTSEN_CRC_8BIT_MASK
void HTSEN_Trigger(void)
triggers a measurement of the I2C humidity/temperature sensor.
static uint8_t HTSENS_ConvertRawHumidity(uint16_t data)
computes humidity measurement from raw value.
Header for the driver for the Sensirion SHT35-DIS I2C humidity/temperature sensor.
STD_RETURN_TYPE_e I2C_WriteDirect(uint32_t slaveAddress, uint32_t nrBytes, uint8_t *writeData)
writes to an I2C slave, no register address written first, blocking.
STD_RETURN_TYPE_e I2C_ReadDirect(uint32_t slaveAddress, uint32_t nrBytes, uint8_t *readData)
reads from an I2C slave, no register address written first, blocking.
Header for the driver for the I2C module.
int16_t temperature_ddegC
DATA_BLOCK_HEADER_s header