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 THERMO11_MAP_MIKROBUS( cfg, mikrobus ) \
68 cfg.scl = MIKROBUS( mikrobus, MIKROBUS_SCL ); \
69 cfg.sda = MIKROBUS( mikrobus, MIKROBUS_SDA ); \
70 cfg.int_pin = MIKROBUS( mikrobus, MIKROBUS_INT );
77#define THERMO11_RETVAL uint8_t
79#define THERMO11_OK 0x00
80#define THERMO11_INIT_ERROR 0xFF
87#define THERMO11_DEV_ADDR 0x48
94#define THERMO11_TEMPERATURE_REG 0x00
95#define THERMO11_CONFIG_REG 0x01
96#define THERMO11_HIGH_LIMIT_REG 0x02
97#define THERMO11_LOW_LIMIT_REG 0x03
98#define THERMO11_EEPROM_UNLOCK_REG 0x04
99#define THERMO11_EEPROM1_REG 0x05
100#define THERMO11_EEPROM2_REG 0x06
101#define THERMO11_TEMP_OFFSET_REG 0x07
102#define THERMO11_EEPROM3_REG 0x08
103#define THERMO11_DEV_ID_REG 0x0F
110#define THERMO11_CONTINUOUS_CONV_MODE 0x0000
111#define THERMO11_SHUTDOWN_MODE 0x0400
112#define THERMO11_ONESHOT_CONV_MODE 0x0C00
113#define THERMO11_CONV_TIME_0 0x0000
114#define THERMO11_CONV_TIME_1 0x0080
115#define THERMO11_CONV_TIME_2 0x0100
116#define THERMO11_CONV_TIME_3 0x0180
117#define THERMO11_CONV_TIME_4 0x0200
118#define THERMO11_CONV_TIME_5 0x0280
119#define THERMO11_CONV_TIME_6 0x0300
120#define THERMO11_CONV_TIME_7 0x0380
121#define THERMO11_NO_AVRG 0x0000
122#define THERMO11_8_AVRG_CONV 0x0020
123#define THERMO11_32_AVRG_CONV 0x0040
124#define THERMO11_64_AVRG_CONV 0x0060
125#define THERMO11_THERM_MODE 0x0010
126#define THERMO11_ALERT_MODE 0x0000
127#define THERMO11_INT_PIN_ACT_HIGH 0x0008
128#define THERMO11_INT_PIN_ACT_LOW 0x0000
129#define THERMO11_INT_PIN_DRDY_FLAG 0x0004
130#define THERMO11_INT_PIN_ALERT_FLAGS 0x0000
131#define THERMO11_SW_RESET_CMD 0x0002
138#define THERMO11_EEPROM_LOCK 0x0000
139#define THERMO11_EEPROM_UNLOCK 0x8000
140#define THERMO11_EEPROM_BUSY_FLAG 0x4000
147#define THERMO11_DEV_ID_MASK 0x0FFF
148#define THERMO11_REVISION_MASK 0xF000
155#define THERMO11_DRDY_FLAG 0x01
156#define THERMO11_LOW_ALERT_FLAG 0x02
157#define THERMO11_HIGH_ALERT_FLAG 0x04
158#define THERMO11_FLAG_IS_CLEARED 0x00
165#define THERMO11_INVALID_TEMP_RANGE 0x02
166#define THERMO11_INVALID_ADDR 0x01
167#define THERMO11_OK 0x00
#define THERMO11_RETVAL
Definition thermo11.h:77
uint8_t thermo11_sm_bus_alert_cmd(thermo11_t *ctx)
SMBus Alert Command.
THERMO11_RETVAL thermo11_program_eeprom(thermo11_t *ctx, uint8_t eeprom_addr, uint16_t eeprom_data)
EEPROM Program function.
THERMO11_RETVAL thermo11_write_reg(thermo11_t *ctx, uint8_t reg_addr, uint16_t data_in)
Repeated Write function.
void thermo11_general_call_reset_cmd(thermo11_t *ctx)
General Call Reset Command.
void thermo11_generic_write(thermo11_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len)
Generic write function.
THERMO11_RETVAL thermo11_get_int(thermo11_t *ctx)
INT Pin Check function.
void thermo11_cfg_setup(thermo11_cfg_t *cfg)
Config Object Initialization function.
void thermo11_sw_reset(thermo11_t *ctx)
Software Reset Command.
void thermo11_generic_read(thermo11_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len)
Generic read function.
void thermo11_default_cfg(thermo11_t *ctx)
Click Default Configuration function.
float thermo11_get_temp(thermo11_t *ctx, uint8_t temp_addr)
Temperature Get function.
THERMO11_RETVAL thermo11_read_reg(thermo11_t *ctx, uint8_t reg_addr, uint16_t *data_out)
Repeated Read function.
THERMO11_RETVAL thermo11_set_temp(thermo11_t *ctx, uint8_t temp_addr, float temp_value)
Temperature Set function.
THERMO11_RETVAL thermo11_check_status(thermo11_t *ctx)
Status Check function.
THERMO11_RETVAL thermo11_init(thermo11_t *ctx, thermo11_cfg_t *cfg)
Initialization function.
Click configuration structure definition.
Definition thermo11.h:200
uint32_t i2c_speed
Definition thermo11.h:212
pin_name_t scl
Definition thermo11.h:203
pin_name_t int_pin
Definition thermo11.h:208
pin_name_t sda
Definition thermo11.h:204
uint8_t i2c_address
Definition thermo11.h:213
Click ctx object definition.
Definition thermo11.h:181
digital_in_t int_pin
Definition thermo11.h:184
i2c_master_t i2c
Definition thermo11.h:188
uint8_t slave_address
Definition thermo11.h:192