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"
62 #define THERMO17_MAP_MIKROBUS( cfg, mikrobus ) \
63 cfg.scl = MIKROBUS( mikrobus, MIKROBUS_SCL ); \
64 cfg.sda = MIKROBUS( mikrobus, MIKROBUS_SDA ); \
65 cfg.an = MIKROBUS( mikrobus, MIKROBUS_AN ); \
66 cfg.int_pin = MIKROBUS( mikrobus, MIKROBUS_INT )
73 #define THERMO17_SLAVE_ADDRESS 0x4C
80 #define THERMO17_REG_R_LOCAL_TEMP_HB 0x00
81 #define THERMO17_REG_R_REMOTE_TEMP_HB 0x01
82 #define THERMO17_REG_R_STATUS 0x02
83 #define THERMO17_REG_R_CFG 0x03
84 #define THERMO17_REG_R_CONVERSION_RATE 0x04
85 #define THERMO17_REG_R_LOCAL_TEMP_LIMIT_H 0x05
86 #define THERMO17_REG_R_LOCAL_TEMP_LIMIT_L 0x06
87 #define THERMO17_REG_R_REMOTE_TEMP_LIMIT_H_HB 0x07
88 #define THERMO17_REG_R_REMOTE_TEMP_LIMIT_L_HB 0x08
89 #define THERMO17_REG_R_REMOTE_TEMP_LB 0x10
90 #define THERMO17_REG_RW_REMOTE_TEMP_OFFSET_HB 0x11
91 #define THERMO17_REG_RW_REMOTE_TEMP_OFFSET_LB 0x12
92 #define THERMO17_REG_RW_REMOTE_TEMP_LIMIT_H_LB 0x13
93 #define THERMO17_REG_RW_REMOTE_TEMP_LIMIT_L_LB 0x14
94 #define THERMO17_REG_R_LOCAL_TEMP_LB 0x15
95 #define THERMO17_REG_RW_REMOTE_TEMP_THERM_LIMIT 0x19
96 #define THERMO17_REG_RW_LOCAL_TEMP_THERM_LIMIT 0x20
97 #define THERMO17_REG_RW_THERMO_HYSTERESIS 0x21
98 #define THERMO17_REG_RW_CONSECUTIVE_ALERT 0x22
99 #define THERMO17_REG_RW_M_FACTOR_CORRECTION 0x23
100 #define THERMO17_REG_RW_DIGITAL_FILTER_CTRL 0x24
101 #define THERMO17_REG_R_ID 0xFE
102 #define THERMO17_REG_W_CFG 0x09
103 #define THERMO17_REG_W_CONVERSION_RATE 0x0A
104 #define THERMO17_REG_W_LOCAL_TEMP_LIMIT_H 0x0B
105 #define THERMO17_REG_W_LOCAL_TEMP_LIMIT_L 0x0C
106 #define THERMO17_REG_W_REMOTE_TEMP_LIMIT_H_HB 0x0D
107 #define THERMO17_REG_W_REMOTE_TEMP_LIMIT_L_HB 0x0E
108 #define THERMO17_REG_W_ONE_SHOT 0x0F
115 #define THERMO17_TEMPERATURE_LOCAL 0xAA
116 #define THERMO17_TEMPERATURE_REMOTE 0xBB
117 #define THERMO17_ERROR 0x00
124 #define THERMO17_DEV_ID 0x55
131 #define THERMO17_STATUS_BUSY 0x80
132 #define THERMO17_STATUS_LOCAL_HIGH_TEMP 0x40
133 #define THERMO17_STATUS_LOCAL_LOW_TEMP 0x20
134 #define THERMO17_STATUS_REMOTE_HIGH_TEMP 0x10
135 #define THERMO17_STATUS_REMOTE_LOW_TEMP 0x08
136 #define THERMO17_STATUS_REMOTE_SENS_OPEN_CIRCUIT 0x04
137 #define THERMO17_STATUS_REMOTE_THERM_TIPPED 0x02
138 #define THERMO17_STATUS_LOCAL_THERM_TIPPED 0x01
145 #define THERMO17_RETVAL uint8_t
147 #define THERMO17_OK 0x00
148 #define THERMO17_INIT_ERROR 0xFF
295 #endif // _THERMO17_H_
digital_in_t int_pin
Definition: thermo17.h:168
pin_name_t sda
Definition: thermo17.h:188
uint8_t slave_address
Definition: thermo17.h:176
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.
pin_name_t scl
Definition: thermo17.h:187
Click ctx object definition.
Definition: thermo17.h:164
digital_in_t an
Definition: thermo17.h:167
#define THERMO17_RETVAL
Definition: thermo17.h:145
pin_name_t int_pin
Definition: thermo17.h:193
THERMO17_RETVAL thermo17_init(thermo17_t *ctx, thermo17_cfg_t *cfg)
Initialization function.
uint32_t i2c_speed
Definition: thermo17.h:197
pin_name_t an
Definition: thermo17.h:192
Click configuration structure definition.
Definition: thermo17.h:184
i2c_master_t i2c
Definition: thermo17.h:172
uint8_t thermo17_generic_read(thermo17_t *ctx, uint8_t reg_adr)
Generic read function.
uint8_t i2c_address
Definition: thermo17.h:198
void thermo17_cfg_setup(thermo17_cfg_t *cfg)
Config Object Initialization function.
void thermo17_generic_write(thermo17_t *ctx, uint8_t reg_adr, uint8_t write_data)
Generic write function.
uint8_t thermo17_get_int_status(thermo17_t *ctx)
Checks status of int pin.