Go to the documentation of this file.
35 #include "drv_digital_out.h"
36 #include "drv_digital_in.h"
37 #include "drv_i2c_master.h"
65 #define TEMPHUM14_I2C_SLAVE_ADDR_GND 0x40
66 #define TEMPHUM14_I2C_SLAVE_ADDR_VCC 0x41
72 #define TEMPHUM14_CMD_RESET 0x1E
73 #define TEMPHUM14_CMD_HEATER_ON 0x04
74 #define TEMPHUM14_CMD_HEATER_OFF 0x02
75 #define TEMPHUM14_CMD_READ_T_AND_RH 0x00
76 #define TEMPHUM14_CMD_READ_RH 0x10
77 #define TEMPHUM14_CMD_CONVERSION 0x40
78 #define TEMPHUM14_CMD_READ_DIAGNOSTIC 0x08
79 #define TEMPHUM14_CMD_READ_SERIAL_NUMBER 0x0A
85 #define TEMPHUM14_CONVERSION_HUM_OSR_0_007 0x18
86 #define TEMPHUM14_CONVERSION_HUM_OSR_0_010 0x10
87 #define TEMPHUM14_CONVERSION_HUM_OSR_0_014 0x08
88 #define TEMPHUM14_CONVERSION_HUM_OSR_0_020 0x00
89 #define TEMPHUM14_CONVERSION_TEMP_0_012 0x06
90 #define TEMPHUM14_CONVERSION_TEMP_0_016 0x04
91 #define TEMPHUM14_CONVERSION_TEMP_0_025 0x02
92 #define TEMPHUM14_CONVERSION_TEMP_0_040 0x00
98 #define TEMPHUM14_BIT_MASK_HUM_OSR 0x18
99 #define TEMPHUM14_BIT_MASK_TEMP_OSR 0x06
105 #define TEMPHUM14_HEATER_DISABLE 0x00
106 #define TEMPHUM14_HEATER_ENABLE 0x01
112 #define TEMPHUM14_STATUS_OFF 0x00
113 #define TEMPHUM14_STATUS_ON 0x01
120 #define TEMPHUM14_CALC_16_BIT_DIVIDER 65535.0
121 #define TEMPHUM14_CALC_TEMP_MULTI_FACT 165.000
122 #define TEMPHUM14_CALC_TEMP_SUB_FACT 40.0000
123 #define TEMPHUM14_CALC_HUM_MULTI_FACT 100.000
142 #define TEMPHUM14_MAP_MIKROBUS( cfg, mikrobus ) \
143 cfg.scl = MIKROBUS( mikrobus, MIKROBUS_SCL ); \
144 cfg.sda = MIKROBUS( mikrobus, MIKROBUS_SDA ); \
145 cfg.rst = MIKROBUS( mikrobus, MIKROBUS_RST )
409 #endif // TEMPHUM14_H
uint8_t hum_h_err
Definition: temphum14.h:198
void temphum14_set_heater(temphum14_t *ctx, uint8_t en_heater)
Enable heater function.
void temphum14_get_diagnostic(temphum14_t *ctx, temphum14_diagn_t *diag_data)
Get diagnostic status function.
Temp Hum 14 Click configuration object.
Definition: temphum14.h:172
uint8_t nvm_error
Definition: temphum14.h:196
err_t temphum14_generic_read(temphum14_t *ctx, uint8_t reg, uint8_t *rx_buf, uint8_t rx_len)
Temp Hum 14 I2C reading function.
float temphum14_get_hum(temphum14_t *ctx)
Get humidity data function.
uint8_t slave_address
Definition: temphum14.h:163
uint8_t hum_un_over
Definition: temphum14.h:197
uint32_t i2c_speed
Definition: temphum14.h:178
void temphum14_set_cmd(temphum14_t *ctx, uint8_t cmd)
Send command function.
uint8_t temp_h_err
Definition: temphum14.h:201
@ TEMPHUM14_ERROR
Definition: temphum14.h:190
void temphum14_hw_reset(temphum14_t *ctx)
HW reset function.
uint8_t heater_on
Definition: temphum14.h:203
void temphum14_get_temp_and_hum(temphum14_t *ctx, float *temp, float *hum)
Get temperature and humidity data function.
uint8_t temp_l_err
Definition: temphum14.h:202
uint8_t hum_l_err
Definition: temphum14.h:199
void temphum14_read_t_and_rh(temphum14_t *ctx, uint8_t *p_rx_data)
Read temperature and humidity data function.
pin_name_t rst
Definition: temphum14.h:176
void temphum14_cfg_setup(temphum14_cfg_t *cfg)
Temp Hum 14 configuration object setup function.
err_t temphum14_init(temphum14_t *ctx, temphum14_cfg_t *cfg)
Temp Hum 14 initialization function.
@ TEMPHUM14_OK
Definition: temphum14.h:189
pin_name_t scl
Definition: temphum14.h:173
Definition: temphum14.h:195
void temphum14_set_conversion(temphum14_t *ctx, uint8_t hum_osr, uint8_t temp_osr)
Set conversion function.
uint32_t temphum14_get_serial_number(temphum14_t *ctx)
Get serial number function.
uint8_t temp_un_over
Definition: temphum14.h:200
void temphum14_read_rh(temphum14_t *ctx, uint8_t *p_rx_data)
Read humidity data function.
err_t temphum14_generic_write(temphum14_t *ctx, uint8_t reg, uint8_t *tx_buf, uint8_t tx_len)
Temp Hum 14 I2C writing function.
Temp Hum 14 Click context object.
Definition: temphum14.h:155
uint8_t i2c_address
Definition: temphum14.h:179
temphum14_return_value_t
Temp Hum 14 Click return value data.
Definition: temphum14.h:188
i2c_master_t i2c
Definition: temphum14.h:160
digital_out_t rst
Definition: temphum14.h:157
pin_name_t sda
Definition: temphum14.h:174
void temphum14_soft_reset(temphum14_t *ctx)
Soft reset function.