Go to the documentation of this file.
42 #ifdef PREINIT_SUPPORTED
46 #ifdef MikroCCoreVersion
47 #if MikroCCoreVersion >= 1
52 #include "drv_digital_out.h"
53 #include "drv_digital_in.h"
54 #include "drv_i2c_master.h"
67 #define THERMOK_MAP_MIKROBUS( cfg, mikrobus ) \
68 cfg.scl = MIKROBUS( mikrobus, MIKROBUS_SCL ); \
69 cfg.sda = MIKROBUS( mikrobus, MIKROBUS_SDA ); \
70 cfg.al4 = MIKROBUS( mikrobus, MIKROBUS_AN ); \
71 cfg.al3 = MIKROBUS( mikrobus, MIKROBUS_RST ); \
72 cfg.al2 = MIKROBUS( mikrobus, MIKROBUS_PWM ); \
73 cfg.al1 = MIKROBUS( mikrobus, MIKROBUS_INT );
80 #define THERMOK_RETVAL uint8_t
82 #define THERMOK_OK 0x00
83 #define THERMOK_INIT_ERROR 0xFF
90 #define THERMOK_DEVICE_SLAVE_ADDR_0 0x60
91 #define THERMOK_DEVICE_SLAVE_ADDR_1 0x61
92 #define THERMOK_DEVICE_SLAVE_ADDR_2 0x62
93 #define THERMOK_DEVICE_SLAVE_ADDR_3 0x63
94 #define THERMOK_DEVICE_SLAVE_ADDR_4 0x64
95 #define THERMOK_DEVICE_SLAVE_ADDR_5 0x65
96 #define THERMOK_DEVICE_SLAVE_ADDR_6 0x66
97 #define THERMOK_DEVICE_SLAVE_ADDR_7 0x67
104 #define THERMOK_REG_HOT_JUNCTION_TEMP_THR 0x00
105 #define THERMOK_REG_JUNCTIONS_TEMP_DELTA_THR 0x01
106 #define THERMOK_REG_COLD_JUNCTION_TEMP_THR 0x02
107 #define THERMOK_REG_RAW_ADC_DATA 0x03
108 #define THERMOK_REG_STATUS 0x04
109 #define THERMOK_REG_SENSOR_CONFIG 0x05
110 #define THERMOK_REG_DEVICE_CONFIG 0x06
111 #define THERMOK_REG_ALERT1_CONFIG 0x08
112 #define THERMOK_REG_ALERT2_CONFIG 0x09
113 #define THERMOK_REG_ALERT3_CONFIG 0x0A
114 #define THERMOK_REG_ALERT4_CONFIG 0x0B
115 #define THERMOK_REG_ALERT1_HYSTERESIS 0x0C
116 #define THERMOK_REG_ALERT2_HYSTERESIS 0x0D
117 #define THERMOK_REG_ALERT3_HYSTERESIS 0x0E
118 #define THERMOK_REG_ALERT4_HYSTERESIS 0x0F
119 #define THERMOK_REG_ALERT1_LIMIT 0x10
120 #define THERMOK_REG_ALERT2_LIMIT 0x11
121 #define THERMOK_REG_ALERT3_LIMIT 0x12
122 #define THERMOK_REG_ALERT4_LIMIT 0x13
123 #define THERMOK_REG_DEVICE_ID 0x20
130 #define THERMOK_SCFG_TYPE_K 0x00
131 #define THERMOK_SCFG_TYPE_J 0x10
132 #define THERMOK_SCFG_TYPE_T 0x20
133 #define THERMOK_SCFG_TYPE_N 0x30
134 #define THERMOK_SCFG_TYPE_S 0x40
135 #define THERMOK_SCFG_TYPE_E 0x50
136 #define THERMOK_SCFG_TYPE_B 0x60
137 #define THERMOK_SCFG_TYPE_R 0x70
138 #define THERMOK_SCFG_FILTER_COEFFICIENT_0 0x00
139 #define THERMOK_SCFG_FILTER_COEFFICIENT_1 0x01
140 #define THERMOK_SCFG_FILTER_COEFFICIENT_2 0x02
141 #define THERMOK_SCFG_FILTER_COEFFICIENT_3 0x03
142 #define THERMOK_SCFG_FILTER_COEFFICIENT_4 0x04
143 #define THERMOK_SCFG_FILTER_COEFFICIENT_5 0x05
144 #define THERMOK_SCFG_FILTER_COEFFICIENT_6 0x06
145 #define THERMOK_SCFG_FILTER_COEFFICIENT_7 0x07
152 #define THERMOK_DCFG_COLD_JUNCTION_RES_0p0625 0x00
153 #define THERMOK_DCFG_COLD_JUNCTION_RES_0p25 0x80
154 #define THERMOK_DCFG_ADC_RES_18bit 0x00
155 #define THERMOK_DCFG_ADC_RES_16bit 0x20
156 #define THERMOK_DCFG_ADC_RES_14bit 0x40
157 #define THERMOK_DCFG_ADC_RES_12bit 0x60
158 #define THERMOK_DCFG_NUM_TEMP_SAMPLES_1 0x00
159 #define THERMOK_DCFG_NUM_TEMP_SAMPLES_2 0x04
160 #define THERMOK_DCFG_NUM_TEMP_SAMPLES_4 0x08
161 #define THERMOK_DCFG_NUM_TEMP_SAMPLES_8 0x0C
162 #define THERMOK_DCFG_NUM_TEMP_SAMPLES_16 0x10
163 #define THERMOK_DCFG_NUM_TEMP_SAMPLES_32 0x14
164 #define THERMOK_DCFG_NUM_TEMP_SAMPLES_64 0x18
165 #define THERMOK_DCFG_NUM_TEMP_SAMPLES_128 0x1C
166 #define THERMOK_DCFG_MODE_NORMAL_OPERATION 0x00
167 #define THERMOK_DCFG_MODE_SHUTDOWN 0x01
168 #define THERMOK_DCFG_MODE_BURST 0x02
175 #define THERMOK_ACFG_INTERRUPT_CLEAR_1 0x80
176 #define THERMOK_ACFG_INTERRUPT_CLEAR_0 0x00
177 #define THERMOK_ACFG_ALERT_MONITOR_TC 0x10
178 #define THERMOK_ACFG_ALERT_MONITOR_TH 0x00
179 #define THERMOK_ACFG_ALERT_LIMIT_RISING 0x08
180 #define THERMOK_ACFG_ALERT_LIMIT_FALLING 0x00
181 #define THERMOK_ACFG_ALERT_ACTIVE_HIGH 0x04
182 #define THERMOK_ACFG_ALERT_ACTIVE_LOW 0x00
183 #define THERMOK_ACFG_ALERT_MODE_INTERRUPT 0x02
184 #define THERMOK_ACFG_ALERT_MODE_COMPARATOR 0x00
185 #define THERMOK_ACFG_ALERT_OUT_ENABLED 0x01
186 #define THERMOK_ACFG_ALERT_OUT_DISABLED 0x00
193 #define THERMOK_AHYS_HYSTERESIS_128C 0x80
194 #define THERMOK_AHYS_HYSTERESIS_64C 0x40
195 #define THERMOK_AHYS_HYSTERESIS_32C 0x20
196 #define THERMOK_AHYS_HYSTERESIS_16C 0x10
197 #define THERMOK_AHYS_HYSTERESIS_8C 0x08
198 #define THERMOK_AHYS_HYSTERESIS_4C 0x04
199 #define THERMOK_AHYS_HYSTERESIS_2C 0x02
200 #define THERMOK_AHYS_HYSTERESIS_1C 0x01
207 #define THERMOK_ALIMIT_1024C 0x4000
208 #define THERMOK_ALIMIT_512C 0x2000
209 #define THERMOK_ALIMIT_255C 0x1000
210 #define THERMOK_ALIMIT_128C 0x0800
211 #define THERMOK_ALIMIT_64C 0x0400
212 #define THERMOK_ALIMIT_32C 0x0200
213 #define THERMOK_ALIMIT_16C 0x0100
214 #define THERMOK_ALIMIT_8C 0x0080
215 #define THERMOK_ALIMIT_4C 0x0040
216 #define THERMOK_ALIMIT_2C 0x0020
217 #define THERMOK_ALIMIT_1C 0x0010
218 #define THERMOK_ALIMIT_0p5C 0x0008
219 #define THERMOK_ALIMIT_0p25C 0x0004
220 #define THERMOK_ALIMIT_SIGN_1 0x8000
221 #define THERMOK_ALIMIT_SIGN_0 0x0000
228 #define THERMOK_DEVICE_ID 0x40
229 #define THERMOK_DEVICE_REV 0x10
230 #define THERMOK_DEVICE_INFO 0x4010
237 #define THERMOK_TEMP_IN_FAHRENHEIT 0x02
238 #define THERMOK_TEMP_IN_KELVIN 0x01
239 #define THERMOK_TEMP_IN_CELSIUS 0x00
437 #endif // _THERMOK_H_
digital_in_t al3
Definition: thermok.h:257
uint8_t over_volt
Definition: thermok.h:302
pin_name_t al4
Definition: thermok.h:283
uint8_t alert_3
Definition: thermok.h:304
THERMOK_RETVAL thermok_init(thermok_t *ctx, thermok_cfg_t *cfg)
Initialization function.
uint8_t alert_2
Definition: thermok.h:305
void thermok_set_register_cfg(thermok_t *ctx, uint8_t reg_cfg, uint8_t cfg_data)
Set register config.
#define THERMOK_RETVAL
Definition: thermok.h:80
uint8_t temp_h_update
Definition: thermok.h:301
Click ctx object definition.
Definition: thermok.h:253
pin_name_t sda
Definition: thermok.h:279
pin_name_t scl
Definition: thermok.h:278
void thermok_generic_write(thermok_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len)
Generic write function.
uint8_t alert_1
Definition: thermok.h:306
uint8_t alert_4
Definition: thermok.h:303
digital_in_t al1
Definition: thermok.h:259
Click configuration structure definition.
Definition: thermok.h:275
uint8_t thermok_get_alert_state_4(thermok_t *ctx)
Alert 4 pin state.
uint8_t i2c_address
Definition: thermok.h:291
digital_in_t al2
Definition: thermok.h:258
void thermok_cfg_setup(thermok_cfg_t *cfg)
Config Object Initialization function.
uint8_t thermok_get_alert_state_3(thermok_t *ctx)
Alert 3 pin state.
void thermok_generic_read(thermok_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len)
Generic read function.
uint32_t i2c_speed
Definition: thermok.h:290
pin_name_t al1
Definition: thermok.h:286
digital_in_t al4
Definition: thermok.h:256
i2c_master_t i2c
Definition: thermok.h:263
float thermok_get_temperature(thermok_t *ctx, uint8_t reg, uint8_t temp_format)
Temperature data.
pin_name_t al2
Definition: thermok.h:285
void thermok_get_status(thermok_t *ctx, thermok_alert_t *status)
Get status.
uint8_t thermok_get_alert_state_2(thermok_t *ctx)
Alert 2 pin state.
pin_name_t al3
Definition: thermok.h:284
uint8_t thermok_get_alert_state_1(thermok_t *ctx)
Alert 1 pin state.
uint16_t thermok_get_device_info(thermok_t *ctx)
Functions for read device info.
uint8_t slave_address
Definition: thermok.h:267
Alert structure definition.
Definition: thermok.h:299
uint8_t burst_cmp
Definition: thermok.h:300