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 THERMO13_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 THERMO13_RETVAL uint8_t
79#define THERMO13_OK 0x00
80#define THERMO13_INIT_ERROR 0xFF
87#define THERMO13_DEVICE_SLAVE_ADDR_000 0x48
88#define THERMO13_DEVICE_SLAVE_ADDR_001 0x49
89#define THERMO13_DEVICE_SLAVE_ADDR_010 0x4A
90#define THERMO13_DEVICE_SLAVE_ADDR_011 0x4B
91#define THERMO13_DEVICE_SLAVE_ADDR_100 0x4C
92#define THERMO13_DEVICE_SLAVE_ADDR_101 0x4D
93#define THERMO13_DEVICE_SLAVE_ADDR_110 0x4E
94#define THERMO13_DEVICE_SLAVE_ADDR_111 0x4F
101#define THERMO13_REG_TEMPERATURE 0x00
102#define THERMO13_REG_CONFIGURATION 0x01
103#define THERMO13_REG_TEMPERATURE_LIMIT_LOW 0x02
104#define THERMO13_REG_TEMPERATURE_LIMIT_HIGH 0x03
105#define THERMO13_REG_SOFTWARE_RESET 0x04
112#define THERMO13_TEMP_IN_CELSIUS 0x00
113#define THERMO13_TEMP_IN_KELVIN 0x01
114#define THERMO13_TEMP_IN_FAHRENHEIT 0x02
121#define THERMO13_DEF_TEMP_LIMIT_LOW 75
122#define THERMO13_DEF_TEMP_LIMIT_HIGH 80
129#define THERMO13_CFG_CONTINUOUS_MEASUREMENT 0x0000
130#define THERMO13_CFG_SINGLE_MEASUREMENT 0x8000
131#define THERMO13_CFG_INTERRUPT_IS_NOT_ACTIVE 0x0000
132#define THERMO13_CFG_INTERRUPT_IS_ACTIVE 0x4000
133#define THERMO13_CFG_FAULT_QUEUE_1 0x0000
134#define THERMO13_CFG_FAULT_QUEUE_2 0x0800
135#define THERMO13_CFG_FAULT_QUEUE_4 0x1000
136#define THERMO13_CFG_FAULT_QUEUE_6 0x1800
137#define THERMO13_CFG_ALERT_ACTIVE_LOW 0x0000
138#define THERMO13_CFG_ALERT_ACTIVE_HIGH 0x0400
139#define THERMO13_CFG_NO_SHUTDOWN 0x0000
140#define THERMO13_CFG_SHUTDOWN_ACTIVE 0x0100
141#define THERMO13_CFG_WAIT_TIME_X16 0x0000
142#define THERMO13_CFG_WAIT_TIME_X4 0x0001
143#define THERMO13_CFG_WAIT_TIME_X1 0x0002
144#define THERMO13_CFG_WAIT_TIME_X0p5 0x0003
#define THERMO13_RETVAL
Definition thermo13.h:77
void thermo13_software_reset(thermo13_t *ctx)
Software reset.
uint8_t thermo13_get_interrupt_state(thermo13_t *ctx)
Interrupt state.
void thermo13_generic_read(thermo13_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len)
Generic read function.
void thermo13_default_cfg(thermo13_t *ctx)
Click Default Configuration function.
float thermo13_get_ambient_temperature_data(thermo13_t *ctx, uint8_t temp_in)
Ambient temperature data.
uint16_t thermo13_read_data(thermo13_t *ctx, uint8_t reg_addr)
Functions for read data from registers.
void thermo13_cfg_setup(thermo13_cfg_t *cfg)
Config Object Initialization function.
float thermo13_get_temp_limit(thermo13_t *ctx, uint8_t temp_reg)
Get temperature register.
void thermo13_configuration(thermo13_t *ctx, uint16_t cfg_data)
Configuration register.
void thermo13_generic_write(thermo13_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len)
Generic write function.
void thermo13_set_temp_limit(thermo13_t *ctx, uint8_t temp_reg, float temp)
Set temperature limit register.
THERMO13_RETVAL thermo13_init(thermo13_t *ctx, thermo13_cfg_t *cfg)
Initialization function.
struct thermo13_s thermo13_t
Click ctx object definition.
Click configuration structure definition.
Definition thermo13.h:177
uint32_t i2c_speed
Definition thermo13.h:189
pin_name_t scl
Definition thermo13.h:180
pin_name_t int_pin
Definition thermo13.h:185
pin_name_t sda
Definition thermo13.h:181
uint8_t i2c_address
Definition thermo13.h:190
Click ctx object definition.
Definition thermo13.h:158
i2c_master_t i2c
Definition thermo13.h:165
digital_out_t int_pin
Definition thermo13.h:161
uint8_t slave_address
Definition thermo13.h:169