68 #define HTSEN_I2C_INTERFACE (i2cREG1)
70 #define HTSEN_I2C_ADDRESS (0x44u)
73 #define HTSEN_READ_TRIES (5u)
76 #define HTSEN_TEMP_SCALING (175.0f)
77 #define HTSEN_TEMP_OFFSET (-45.0f)
78 #define HTSEN_TEMP_DEG_TO_DDEG (10.0f)
82 #define HTSEN_HUMIDITY_SCALING (100.0f)
83 #define HTSEN_FULL_SCALE (65535.0f)
87 #define HTSEN_TEMPERATURE_LSB (1u)
88 #define HTSEN_TEMPERATURE_MSB (0u)
89 #define HTSEN_TEMPERATURE_BYTE_CRC (2u)
90 #define HTSEN_HUMIDITY_LSB (4u)
91 #define HTSEN_HUMIDITY_MSB (3u)
92 #define HTSEN_HUMIDITY_BYTE_CRC (5u)
93 #define HTSEN_BYTE_SHIFT (8u)
94 #define HTSEN_MEASUREMENT_LENGTH_IN_BYTES (2u)
95 #define HTSEN_TOTAL_DATA_LENGTH_IN_BYTES (6u)
99 #define HTSEN_CRC_POLYNOMIAL (0x31u)
100 #define HTSEN_CRC_SEED (0xFF)
101 #define HTSEN_CRC_BYTE_SHIFT (0x8u)
102 #define HTSEN_CRC_MSB_MASK (0x80u)
103 #define HTSEN_CRC_8BIT_MASK (0xFFu)
135 #define HTSEN_CLOCK_STRETCHING (false)
136 #if (HTSEN_CLOCK_STRETCHING == false)
137 #define HTSEN_SINGLE_MEAS_MSB (0x24u)
138 #define HTSEN_HIGH_REPEATABILITY (0x00u)
139 #define HTSEN_MEDIUM_REPEATABILITY (0x0Bu)
140 #define HTSEN_LOW_REPEATABILITY (0x16u)
142 #define HTSEN_SINGLE_MEAS_MSB (0x2Cu)
143 #define HTSEN_HIGH_REPEATABILITY (0x06u)
144 #define HTSEN_MEDIUM_REPEATABILITY (0x0Du)
145 #define HTSEN_LOW_REPEATABILITY (0x10u)
148 #define HTSEN_SINGLE_MEAS_LSB (HTSEN_HIGH_REPEATABILITY)
152 #pragma SET_DATA_SECTION(".sharedRAM")
155 #pragma SET_DATA_SECTION()
196 for (uint8_t i = 0u; i < length; i++) {
213 return (int16_t)temperature_ddeg;
218 return (uint8_t)humidity_perc;
228 switch (htsenState) {
233 if (htsenReturnValue ==
STD_OK) {
243 if (htsenReturnValue ==
STD_OK) {
281 #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.
#define HTSEN_TEMPERATURE_BYTE_CRC
#define HTSEN_CRC_MSB_MASK
#define HTSEN_SINGLE_MEAS_LSB
static int16_t HTSEN_ConvertRawTemperature(uint16_t data)
computes temperature measurement from raw value.
static uint8_t htsen_readTries
static uint8_t HTSEN_ConvertRawHumidity(uint16_t data)
computes humidity measurement from raw value.
#define HTSEN_HUMIDITY_SCALING
#define HTSEN_I2C_ADDRESS
uint8_t i2cWriteBuffer[2u]
static uint8_t HTSEN_CalculateCrc8(const uint8_t *data, uint32_t length)
computes CRC8.
#define HTSEN_HUMIDITY_LSB
#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
uint8_t i2cReadBuffer[HTSEN_TOTAL_DATA_LENGTH_IN_BYTES]
#define HTSEN_HUMIDITY_BYTE_CRC
#define HTSEN_TEMP_DEG_TO_DDEG
#define HTSEN_HUMIDITY_MSB
#define HTSEN_MEASUREMENT_LENGTH_IN_BYTES
#define HTSEN_I2C_INTERFACE
static DATA_BLOCK_HTSEN_s htsen_data
uint8_t TEST_HTSEN_TestCalculateCrc8(uint8_t *data, uint32_t length)
#define HTSEN_CRC_BYTE_SHIFT
#define HTSEN_CRC_POLYNOMIAL
#define HTSEN_CRC_8BIT_MASK
void HTSEN_Trigger(void)
triggers a measurement of the I2C humidity/temperature sensor.
Header for the driver for the Sensirion SHT35-DIS I2C humidity/temperature sensor.
STD_RETURN_TYPE_e I2C_ReadDma(i2cBASE_t *pI2cInterface, uint32_t slaveAddress, uint32_t nrBytes, uint8_t *readData)
reads from an I2C slave, no register address written first, using DMA.
STD_RETURN_TYPE_e I2C_WriteDma(i2cBASE_t *pI2cInterface, uint32_t slaveAddress, uint32_t nrBytes, uint8_t *writeData)
writes to an I2C slave, no register address written first, using DMA.
Header for the driver for the I2C module.
void OS_DelayTaskUntil(uint32_t *pPreviousWakeTime, uint32_t milliseconds)
Delay a task until a specified time.
uint32_t OS_GetTickCount(void)
Returns OS based system tick value.
int16_t temperature_ddegC
DATA_BLOCK_HEADER_s header