Go to the documentation of this file.
38 #include "mikrosdk_version.h"
41 #if mikroSDK_GET_VERSION < 20800ul
42 #include "rcu_delays.h"
48 #include "drv_digital_in.h"
49 #include "drv_i2c_master.h"
61 #define TEMPHUM12_MAP_MIKROBUS( cfg, mikrobus ) \
62 cfg.scl = MIKROBUS( mikrobus, MIKROBUS_SCL ); \
63 cfg.sda = MIKROBUS( mikrobus, MIKROBUS_SDA ); \
64 cfg.int_pin = MIKROBUS( mikrobus, MIKROBUS_INT )
71 #define TEMPHUM12_RETVAL uint8_t
73 #define TEMPHUM12_OK 0x00
74 #define TEMPHUM12_INIT_ERROR 0xFF
81 #define TEMPHUM12_REG_TEMPERATURE_LSB 0x00
82 #define TEMPHUM12_REG_TEMPERATURE_MSB 0x01
83 #define TEMPHUM12_REG_HUMIDITY_LSB 0x02
84 #define TEMPHUM12_REG_HUMIDITY_MSB 0x03
85 #define TEMPHUM12_REG_DRDY_INTERRUPT 0x04
86 #define TEMPHUM12_REG_TEMP_MAX 0x05
87 #define TEMPHUM12_REG_HUM_MAX 0x06
88 #define TEMPHUM12_REG_INT_ENABLE 0x07
89 #define TEMPHUM12_REG_TEMP_OFFSET 0x08
90 #define TEMPHUM12_REG_HUM_OFFSET 0x09
91 #define TEMPHUM12_REG_TEMP_THR_LSB 0x0A
92 #define TEMPHUM12_REG_TEMP_THR_MSB 0x0B
93 #define TEMPHUM12_REG_HUM_THR_LSB 0x0C
94 #define TEMPHUM12_REG_HUM_THR_MSB 0x0D
95 #define TEMPHUM12_REG_DRDY_INT_CONFIG 0x0E
96 #define TEMPHUM12_REG_CONFIGURATION 0x0F
97 #define TEMPHUM12_REG_MANUFACTURER_ID_LSB 0xFC
98 #define TEMPHUM12_REG_MANUFACTURER_ID_MSB 0xFD
99 #define TEMPHUM12_REG_DEVICE_ID_LSB 0xFE
100 #define TEMPHUM12_REG_DEVICE_ID_MSB 0xFF
107 #define TEMPHUM12_REG_DATA_TEMPERATURE 0x00
108 #define TEMPHUM12_REG_DATA_HUMIDITY 0x02
109 #define TEMPHUM12_REG_DATA_TEMP_THR 0x0A
110 #define TEMPHUM12_REG_DATA_HUM_THR 0x0C
111 #define TEMPHUM12_REG_DATA_MANUFACTURER_ID 0xFC
112 #define TEMPHUM12_REG_DATA_DEVICE_ID 0xFE
119 #define TEMPHUM12_INT_STATUS_DRDY 0x80
120 #define TEMPHUM12_INT_STATUS_TEMP_THR_HIGH 0x40
121 #define TEMPHUM12_INT_STATUS_TEMP_THR_LOW 0x20
122 #define TEMPHUM12_INT_STATUS_HUM_THR_HIGH 0x10
123 #define TEMPHUM12_INT_STATUS_HUM_THR_LOW 0x08
130 #define TEMPHUM12_INTE_DRDY_ENABLE 0x80
131 #define TEMPHUM12_INTE_DRDY_DISABLE 0x00
132 #define TEMPHUM12_INTE_TEMP_TH_ENABLE 0x40
133 #define TEMPHUM12_INTE_TEMP_TH_DISABLE 0x00
134 #define TEMPHUM12_INTE_TEMP_TL_ENABLE 0x20
135 #define TEMPHUM12_INTE_TEMP_TL_DISABLE 0x00
136 #define TEMPHUM12_INTE_HUM_TH_ENABLE 0x10
137 #define TEMPHUM12_INTE_HUM_TH_DISABLE 0x00
138 #define TEMPHUM12_INTE_HUM_TL_ENABLE 0x08
139 #define TEMPHUM12_INTE_HUM_TL_DISABLE 0x00
146 #define TEMPHUM12_TO_PLUS_0_16C 0x01
147 #define TEMPHUM12_TO_PLUS_0_32C 0x02
148 #define TEMPHUM12_TO_PLUS_0_64C 0x04
149 #define TEMPHUM12_TO_PLUS_1_28C 0x08
150 #define TEMPHUM12_TO_PLUS_2_58C 0x10
151 #define TEMPHUM12_TO_PLUS_5_16C 0x20
152 #define TEMPHUM12_TO_PLUS_10_32C 0x40
153 #define TEMPHUM12_TO_MINUS_20_62C 0x80
160 #define TEMPHUM12_RHO_PLUS_0_2RH 0x01
161 #define TEMPHUM12_RHO_PLUS_0_4RH 0x02
162 #define TEMPHUM12_RHO_PLUS_0_8RH 0x04
163 #define TEMPHUM12_RHO_PLUS_1_6RH 0x08
164 #define TEMPHUM12_RHO_PLUS_3_1RH 0x10
165 #define TEMPHUM12_RHO_PLUS_6_3RH 0x20
166 #define TEMPHUM12_RHO_PLUS_12_5RH 0x40
167 #define TEMPHUM12_RHO_MINUS_25RH 0x80
174 #define TEMPHUM12_ICFG_NORAML_OPERATION 0x00
175 #define TEMPHUM12_ICFG_SOFTWARE_RESET 0x80
176 #define TEMPHUM12_ICFG_AMM_1_120Hz 0x10
177 #define TEMPHUM12_ICFG_AMM_1_60Hz 0x20
178 #define TEMPHUM12_ICFG_AMM_0p1Hz 0x30
179 #define TEMPHUM12_ICFG_AMM_0p2Hz 0x40
180 #define TEMPHUM12_ICFG_AMM_1Hz 0x50
181 #define TEMPHUM12_ICFG_AMM_2Hz 0x60
182 #define TEMPHUM12_ICFG_AMM_5Hz 0x70
183 #define TEMPHUM12_ICFG_HEATER_DISABLE 0x00
184 #define TEMPHUM12_ICFG_HEATER_ENABLE 0x08
185 #define TEMPHUM12_ICFG_DRDY_ENABLE 0x04
186 #define TEMPHUM12_ICFG_INT_ACTIVE_LOW 0x00
187 #define TEMPHUM12_ICFG_INT_ACTIVE_HIGH 0x02
188 #define TEMPHUM12_ICFG_LEVEL_SENSITIVE 0x00
189 #define TEMPHUM12_ICFG_COMPARATOR_MODE 0x01
196 #define TEMPHUM12_MCFG_TEMP_RES_14bit 0x00
197 #define TEMPHUM12_MCFG_TEMP_RES_11bit 0x40
198 #define TEMPHUM12_MCFG_TEMP_RES_8bit 0x80
199 #define TEMPHUM12_MCFG_HUM_RES_14bit 0x00
200 #define TEMPHUM12_MCFG_HUM_RES_11bit 0x10
201 #define TEMPHUM12_MCFG_HUM_RES_8bit 0x20
202 #define TEMPHUM12_MCFG_TEMP_HUM_READ 0x00
203 #define TEMPHUM12_MCFG_TEMP_ONLY 0x02
204 #define TEMPHUM12_MCFG_HUM_ONLY 0x04
205 #define TEMPHUM12_MCFG_TRIG_NO_ACTION 0x00
206 #define TEMPHUM12_MCFG_TRIG_START_MEASUREMENT 0x01
213 #define TEMPHUM12_MANUFACTURER_ID 0x4954
214 #define TEMPHUM12_DEVICE_ID 0x07D0
215 #define TEMPHUM12_DEVICE_SLAVE_ADDRESS 0x40
222 #define TEMPHUM12_TEMP_IN_CELSIUS 0x00
223 #define TEMPHUM12_TEMP_IN_KELVIN 0x01
224 #define TEMPHUM12_TEMP_IN_FAHRENHEIT 0x02
388 #endif // _TEMPHUM12_H_
digital_in_t int_pin
Definition: temphum12.h:241
TEMPHUM12_RETVAL temphum12_init(temphum12_t *ctx, temphum12_cfg_t *cfg)
Initialization function.
void temphum12_generic_read(temphum12_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len)
Generic read function.
pin_name_t sda
Definition: temphum12.h:261
uint8_t slave_address
Definition: temphum12.h:249
Click configuration structure definition.
Definition: temphum12.h:257
float temphum12_get_humidity(temphum12_t *ctx)
Relative Huminidy data.
float temphum12_get_temperature(temphum12_t *ctx, uint8_t temp_in)
Temperature data.
void temphum12_generic_write(temphum12_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len)
Generic write function.
void temphum12_cfg_setup(temphum12_cfg_t *cfg)
Config Object Initialization function.
Click ctx object definition.
Definition: temphum12.h:238
#define TEMPHUM12_RETVAL
Definition: temphum12.h:71
pin_name_t int_pin
Definition: temphum12.h:265
void temphum12_default_cfg(temphum12_t *ctx)
Click Default Configuration function.
i2c_master_t i2c
Definition: temphum12.h:245
pin_name_t scl
Definition: temphum12.h:260
uint8_t i2c_address
Definition: temphum12.h:270
uint8_t temphum12_get_intrrupt_state(temphum12_t *ctx)
Interrupt state.
uint32_t i2c_speed
Definition: temphum12.h:269