42#ifdef PREINIT_SUPPORTED
46#ifdef MikroCCoreVersion
47 #if MikroCCoreVersion >= 1
52#include "drv_digital_in.h"
53#include "drv_i2c_master.h"
66#define THERMO17_MAP_MIKROBUS( cfg, mikrobus ) \
67 cfg.scl = MIKROBUS( mikrobus, MIKROBUS_SCL ); \
68 cfg.sda = MIKROBUS( mikrobus, MIKROBUS_SDA ); \
69 cfg.an = MIKROBUS( mikrobus, MIKROBUS_AN ); \
70 cfg.int_pin = MIKROBUS( mikrobus, MIKROBUS_INT )
77#define THERMO17_SLAVE_ADDRESS 0x4C
84#define THERMO17_REG_R_LOCAL_TEMP_HB 0x00
85#define THERMO17_REG_R_REMOTE_TEMP_HB 0x01
86#define THERMO17_REG_R_STATUS 0x02
87#define THERMO17_REG_R_CFG 0x03
88#define THERMO17_REG_R_CONVERSION_RATE 0x04
89#define THERMO17_REG_R_LOCAL_TEMP_LIMIT_H 0x05
90#define THERMO17_REG_R_LOCAL_TEMP_LIMIT_L 0x06
91#define THERMO17_REG_R_REMOTE_TEMP_LIMIT_H_HB 0x07
92#define THERMO17_REG_R_REMOTE_TEMP_LIMIT_L_HB 0x08
93#define THERMO17_REG_R_REMOTE_TEMP_LB 0x10
94#define THERMO17_REG_RW_REMOTE_TEMP_OFFSET_HB 0x11
95#define THERMO17_REG_RW_REMOTE_TEMP_OFFSET_LB 0x12
96#define THERMO17_REG_RW_REMOTE_TEMP_LIMIT_H_LB 0x13
97#define THERMO17_REG_RW_REMOTE_TEMP_LIMIT_L_LB 0x14
98#define THERMO17_REG_R_LOCAL_TEMP_LB 0x15
99#define THERMO17_REG_RW_REMOTE_TEMP_THERM_LIMIT 0x19
100#define THERMO17_REG_RW_LOCAL_TEMP_THERM_LIMIT 0x20
101#define THERMO17_REG_RW_THERMO_HYSTERESIS 0x21
102#define THERMO17_REG_RW_CONSECUTIVE_ALERT 0x22
103#define THERMO17_REG_RW_M_FACTOR_CORRECTION 0x23
104#define THERMO17_REG_RW_DIGITAL_FILTER_CTRL 0x24
105#define THERMO17_REG_R_ID 0xFE
106#define THERMO17_REG_W_CFG 0x09
107#define THERMO17_REG_W_CONVERSION_RATE 0x0A
108#define THERMO17_REG_W_LOCAL_TEMP_LIMIT_H 0x0B
109#define THERMO17_REG_W_LOCAL_TEMP_LIMIT_L 0x0C
110#define THERMO17_REG_W_REMOTE_TEMP_LIMIT_H_HB 0x0D
111#define THERMO17_REG_W_REMOTE_TEMP_LIMIT_L_HB 0x0E
112#define THERMO17_REG_W_ONE_SHOT 0x0F
119#define THERMO17_TEMPERATURE_LOCAL 0xAA
120#define THERMO17_TEMPERATURE_REMOTE 0xBB
121#define THERMO17_ERROR 0x00
128#define THERMO17_DEV_ID 0x55
135#define THERMO17_STATUS_BUSY 0x80
136#define THERMO17_STATUS_LOCAL_HIGH_TEMP 0x40
137#define THERMO17_STATUS_LOCAL_LOW_TEMP 0x20
138#define THERMO17_STATUS_REMOTE_HIGH_TEMP 0x10
139#define THERMO17_STATUS_REMOTE_LOW_TEMP 0x08
140#define THERMO17_STATUS_REMOTE_SENS_OPEN_CIRCUIT 0x04
141#define THERMO17_STATUS_REMOTE_THERM_TIPPED 0x02
142#define THERMO17_STATUS_LOCAL_THERM_TIPPED 0x01
149#define THERMO17_RETVAL uint8_t
151#define THERMO17_OK 0x00
152#define THERMO17_INIT_ERROR 0xFF
#define THERMO17_RETVAL
Definition thermo17.h:149
uint8_t thermo17_generic_read(thermo17_t *ctx, uint8_t reg_adr)
Generic read function.
uint8_t thermo17_get_an_status(thermo17_t *ctx)
Checks status of an pin.
float thermo17_read_temp(thermo17_t *ctx, uint8_t temp_macro)
Function for reading temperature.
THERMO17_RETVAL thermo17_init(thermo17_t *ctx, thermo17_cfg_t *cfg)
Initialization function.
uint8_t thermo17_get_int_status(thermo17_t *ctx)
Checks status of int pin.
void thermo17_generic_write(thermo17_t *ctx, uint8_t reg_adr, uint8_t write_data)
Generic write function.
void thermo17_cfg_setup(thermo17_cfg_t *cfg)
Config Object Initialization function.
Click configuration structure definition.
Definition thermo17.h:188
uint32_t i2c_speed
Definition thermo17.h:201
pin_name_t scl
Definition thermo17.h:191
pin_name_t int_pin
Definition thermo17.h:197
pin_name_t sda
Definition thermo17.h:192
pin_name_t an
Definition thermo17.h:196
uint8_t i2c_address
Definition thermo17.h:202
Click ctx object definition.
Definition thermo17.h:168
digital_in_t int_pin
Definition thermo17.h:172
i2c_master_t i2c
Definition thermo17.h:176
digital_in_t an
Definition thermo17.h:171
uint8_t slave_address
Definition thermo17.h:180