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"
66#define THERMO5_MAP_MIKROBUS( cfg, mikrobus ) \
67 cfg.scl = MIKROBUS( mikrobus, MIKROBUS_SCL ); \
68 cfg.sda = MIKROBUS( mikrobus, MIKROBUS_SDA ); \
69 cfg.int_pin = MIKROBUS( mikrobus, MIKROBUS_INT )
76#define THERMO5_RETVAL uint8_t
78#define THERMO5_OK 0x00
79#define THERMO5_INIT_ERROR 0xFF
86#define THERMO5_I2C_ADDRESS 0x4C
93#define THERMO5_INTER_DIO_DATA_HI_BYTE 0x00
94#define THERMO5_INTER_DIO_DATA_LO_BYTE 0x29
95#define THERMO5_EXTER_DIO_1_DATA_HI_BYTE 0x01
96#define THERMO5_EXTER_DIO_1_DATA_LO_BYTE 0x10
97#define THERMO5_EXTER_DIO_2_DATA_HI_BYTE 0x23
98#define THERMO5_EXTER_DIO_2_DATA_LO_BYTE 0x24
99#define THERMO5_EXTER_DIO_3_HI_BYTE 0x2A
100#define THERMO5_EXTER_DIO_3_LO_BYTE 0x2B
102#define THERMO5_INTER_DIODE 0x0029
103#define THERMO5_EXTER_DIODE1 0x0110
104#define THERMO5_EXTER_DIODE2 0x2324
105#define THERMO5_EXTER_DIODE3 0x2A2B
112#define THERMO5_STAT 0x02
119#define THERMO5_CONFIG 0x03
126#define THERMO5_CONVERS_RATE 0x04
133#define THERMO5_INTER_DIO_HI_LIM 0x05
134#define THERMO5_INTER_DIO_LO_LIM 0x06
135#define THERMO5_EXTER_DIO_1_HI_LIM_HI_BYTE 0x07
136#define THERMO5_EXTER_DIO_1_HI_LIM_LO_BYTE 0x13
137#define THERMO5_EXTER_DIO_1_LO_LIM_HI_BYTE 0x08
138#define THERMO5_EXTER_DIO_1_LO_LIM_LO_BYTE 0x14
139#define THERMO5_EXTER_DIO_2_HI_LIM_HI_BYTE 0x15
140#define THERMO5_EXTER_DIO_2_LO_LIM_HI_BYTE 0x16
141#define THERMO5_EXTER_DIO_2_HI_LIM_LO_BYTE 0x17
142#define THERMO5_EXTER_DIO_2_LO_LIM_LO_BYTE 0x18
143#define THERMO5_EXTER_DIO_3_HI_LIM_HI_BYTE 0x2C
144#define THERMO5_EXTER_DIO_3_LO_LIM_HI_BYTE 0x2D
145#define THERMO5_EXTER_DIO_3_HI_LIM_LO_BYTE 0x2E
146#define THERMO5_EXTER_DIO_3_LO_LIM_LO_BYTE 0x2F
153#define THERMO5_SCRATCHPAD_1 0x11
154#define THERMO5_SCRATCHPAD_2 0x12
161#define THERMO5_ONE_SHOT 0x0F
168#define THERMO5_EXTER_DIO_1_THERM_LIM 0x19
169#define THERMO5_EXTER_DIO_2_THERM_LIM 0x1A
170#define THERMO5_INTER_DIO_THERM_LIM 0x20
171#define THERMO5_THERM_HYSTERESIS 0x21
172#define THERMO5_EXTER_DIO_3_THERM_LIM 0x30
179#define THERMO5_EXTER_DIO_FAULT 0x1B
186#define THERMO5_CHANNEL_MASK_REGISTER 0x1F
193#define THERMO5_CONSECUTIVE_ALERT 0x22
200#define THERMO5_EXTER_DIO_1_BETA_CONFIG 0x25
201#define THERMO5_EXTER_DIO_2_BETA_CONFIG 0x26
208#define THERMO5_EXTER_DIO_1_IDE_FAC 0x27
209#define THERMO5_EXTER_DIO_2_IDE_FAC 0x28
210#define THERMO5_EXTER_DIO_3_IDE_FAC 0x31
217#define THERMO5_HI_LIM_STAT 0x35
224#define THERMO5_LO_LIM_STAT 0x36
231#define THERMO5_THERM_LIM_STAT 0x37
238#define THERMO5_FILTER_CONTROL 0x40
245#define THERMO5_PRODUCT_ID 0xFD
252#define THERMO5_MANUFACTURER_ID 0xFE
259#define THERMO5_REVISION 0xFF
266#define THERMO5_CONVER_RATE_0_0625 0x00
267#define THERMO5_CONVER_RATE_0_125 0x01
268#define THERMO5_CONVER_RATE_0_25 0x02
269#define THERMO5_CONVER_RATE_0_5 0x03
270#define THERMO5_CONVER_RATE_1 0x04
271#define THERMO5_CONVER_RATE_2 0x05
272#define THERMO5_CONVER_RATE_4 0x06
273#define THERMO5_CONVER_RATE_8 0x07
274#define THERMO5_CONVER_RATE_16 0x08
275#define THERMO5_CONVER_RATE_32 0x09
276#define THERMO5_CONVER_RATE_64 0x0A
283#define THERMO5_FILTER_DECODE_DISABLE 0x00
284#define THERMO5_FILTER_DECODE_LEVEL_1 0x01
285#define THERMO5_FILTER_DECODE_AVERAGE 0x02
286#define THERMO5_FILTER_DECODE_LEVEL_2 0x03
#define THERMO5_RETVAL
Definition thermo5.h:76
float thermo5_read_extern_3_temp(thermo5_t *ctx)
Read external diode 3 temperature function.
uint8_t thermo5_read_product_id(thermo5_t *ctx)
Read product ID function.
void thermo5_write_config(thermo5_t *ctx, uint8_t wr_data)
Write configuration function.
uint8_t thermo5_read_revision_register(thermo5_t *ctx)
Read revision register function.
void thermo5_generic_write(thermo5_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len)
Generic write function.
uint8_t thermo5_read_byte(thermo5_t *ctx, uint8_t rd_addr)
Read byte function.
uint8_t thermo5_read_convers_rate(thermo5_t *ctx)
Read conversion rate function.
void thermo5_write_byte(thermo5_t *ctx, uint8_t wr_addr, uint8_t wr_data)
Write byte function.
float thermo5_read_extern_2_temp(thermo5_t *ctx)
Read external diode 2 temperature function.
uint8_t thermo5_read_high_limit_stat(thermo5_t *ctx)
Read high limit status function.
uint8_t thermo5_get_interrupt_state(thermo5_t *ctx)
Get interrupt state function.
void thermo5_set_diode_1_beta_config(thermo5_t *ctx, uint8_t enable)
Set External Diode 1 Beta Configuration function.
void thermo5_set_diode_2_beta_config(thermo5_t *ctx, uint8_t enable)
Set External Diode 2 Beta Configuration function.
uint16_t thermo5_read_data(thermo5_t *ctx, uint16_t reg_addr)
Read data function.
void thermo5_set_convers_rate(thermo5_t *ctx, uint8_t convers_rate)
Set conversion rate function.
uint8_t thermo5_read_therm_limit_stat(thermo5_t *ctx)
Read therm limit status function.
uint8_t thermo5_read_diode_2_beta_config(thermo5_t *ctx)
Read External Diode 2 Beta Configuration function.
THERMO5_RETVAL thermo5_init(thermo5_t *ctx, thermo5_cfg_t *cfg)
Initialization function.
uint8_t thermo5_read_filter_rate(thermo5_t *ctx)
Read filter configuration function.
void thermo5_cfg_setup(thermo5_cfg_t *cfg)
Config Object Initialization function.
void thermo5_generic_read(thermo5_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len)
Generic read function.
float thermo5_read_inter_temp(thermo5_t *ctx)
Read internal diode temperature function.
uint8_t thermo5_read_stat_reg(thermo5_t *ctx)
Read status register function.
uint8_t thermo5_read_low_limit_stat(thermo5_t *ctx)
Read low limit status function.
void thermo5_set_filter_rate(thermo5_t *ctx, uint8_t filter_decode_rate)
Filter configuration function.
uint8_t thermo5_read_diode_1_beta_config(thermo5_t *ctx)
Read External Diode 1 Beta Configuration function.
uint8_t thermo5_read_manufacturer_id(thermo5_t *ctx)
Read manufacturer ID function.
float thermo5_read_extern_1_temp(thermo5_t *ctx)
Read external diode 1 temperature function.
uint8_t thermo5_read_exter_diode_fault(thermo5_t *ctx)
Read external diode fault function.
uint8_t thermo5_read_config(thermo5_t *ctx)
Read configuration function.
Click configuration structure definition.
Definition thermo5.h:319
uint32_t i2c_speed
Definition thermo5.h:331
pin_name_t scl
Definition thermo5.h:322
pin_name_t int_pin
Definition thermo5.h:327
pin_name_t sda
Definition thermo5.h:323
uint8_t i2c_address
Definition thermo5.h:332
Click ctx object definition.
Definition thermo5.h:300
digital_in_t int_pin
Definition thermo5.h:303
i2c_master_t i2c
Definition thermo5.h:307
uint8_t slave_address
Definition thermo5.h:311