39#ifdef PREINIT_SUPPORTED
43#ifdef MikroCCoreVersion
44 #if MikroCCoreVersion >= 1
49#include "drv_digital_out.h"
50#include "drv_digital_in.h"
51#include "drv_i2c_master.h"
73#define IRTHERMO4_REG_TP_OBJECT 0x01
74#define IRTHERMO4_REG_TP_AMBIENT 0x03
75#define IRTHERMO4_REG_TP_OBJ_LP1 0x05
76#define IRTHERMO4_REG_TP_OBJ_LP2 0x07
77#define IRTHERMO4_REG_TP_AMB_LP3 0x0A
78#define IRTHERMO4_REG_TP_OBJ_LP2_FROZEN 0x0C
79#define IRTHERMO4_REG_TP_PRESENCE 0x0F
80#define IRTHERMO4_REG_TP_MOTION 0x10
81#define IRTHERMO4_REG_TP_AMB_SHOCK 0x11
82#define IRTHERMO4_REG_INTERRUPT_STATUS 0x12
83#define IRTHERMO4_REG_CHIP_STATUS 0x13
84#define IRTHERMO4_REG_S_LP1_LP2 0x14
85#define IRTHERMO4_REG_S_LP3 0x15
86#define IRTHERMO4_REG_TP_PRESENCE_THOLD 0x16
87#define IRTHERMO4_REG_TP_MOTION_THOLD 0x17
88#define IRTHERMO4_REG_TP_AMB_SHOCK_THOLD 0x18
89#define IRTHERMO4_REG_INTERRUPT_MASK 0x19
90#define IRTHERMO4_REG_MULTIPLE 0x1A
91#define IRTHERMO4_REG_TIMER_INTERRUPT 0x1B
92#define IRTHERMO4_REG_TP_OT_THOLD 0x1C
93#define IRTHERMO4_REG_EEPROM_CONTROL 0x1F
94#define IRTHERMO4_REG_EEPROM_CONTENT 0x20
95#define IRTHERMO4_REG_SLAVE_ADDRESS 0x3F
113#define IRTHERMO4_ROOM_TEMPERATURE 25.0f
114#define IRTHERMO4_FUNCTION_EXPONENT 4.2f
115#define IRTHERMO4_DIGITS_K_TO_M 100.0f
116#define IRTHERMO4_TP_OFFSET_TO_U0 32768
117#define IRTHERMO4_TP_OUT_TO_UOUT 2
123#define IRTHERMO4_EEPROM_READ_ENABLE 0x80
124#define IRTHERMO4_EEPROM_READ_DISABLE 0x00
130#define IRTHERMO4_CMD_RELOAD 0x04
137#define IRTHERMO4_DEVICE_ADDRESS_GEN_CALL 0x00
138#define IRTHERMO4_DEVICE_ADDRESS_GND 0x0C
139#define IRTHERMO4_DEVICE_ADDRESS_VCC 0x0E
157#define IRTHERMO4_MAP_MIKROBUS( cfg, mikrobus ) \
158 cfg.scl = MIKROBUS( mikrobus, MIKROBUS_SCL ); \
159 cfg.sda = MIKROBUS( mikrobus, MIKROBUS_SDA ); \
160 cfg.int_pin = MIKROBUS( mikrobus, MIKROBUS_INT )
err_t irthermo4_init(irthermo4_t *ctx, irthermo4_cfg_t *cfg)
IR Thermo 4 initialization function.
err_t irthermo4_read_regs(irthermo4_t *ctx, uint8_t reg, uint8_t *data_out, uint8_t len)
IR Thermo 4 read regs function.
err_t irthermo4_read_reg(irthermo4_t *ctx, uint8_t reg, uint8_t *data_out)
IR Thermo 4 read reg function.
err_t irthermo4_refresh_address(irthermo4_t *ctx)
IR Thermo 4 refresh address function.
err_t irthermo4_default_cfg(irthermo4_t *ctx)
IR Thermo 4 default configuration function.
err_t irthermo4_write_reg(irthermo4_t *ctx, uint8_t reg, uint8_t data_in)
IR Thermo 4 write reg function.
err_t irthermo4_write_regs(irthermo4_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t len)
IR Thermo 4 write regs function.
err_t irthermo4_read_ambient_temp(irthermo4_t *ctx, float *t_amb)
IR Thermo 4 read ambient temp function.
err_t irthermo4_read_eeprom(irthermo4_t *ctx)
IR Thermo 4 read EEPROM function.
void irthermo4_cfg_setup(irthermo4_cfg_t *cfg)
IR Thermo 4 configuration object setup function.
uint8_t irthermo4_get_int_pin(irthermo4_t *ctx)
IR Thermo 4 get int pin function.
err_t irthermo4_read_object_temp(irthermo4_t *ctx, float *t_obj, float t_amb)
IR Thermo 4 read object temp function.
irthermo4_return_value_t
IR Thermo 4 Click return value data.
Definition irthermo4.h:223
@ IRTHERMO4_ERROR
Definition irthermo4.h:225
@ IRTHERMO4_OK
Definition irthermo4.h:224
IR Thermo 4 Click configuration object.
Definition irthermo4.h:207
uint32_t i2c_speed
Definition irthermo4.h:213
pin_name_t scl
Definition irthermo4.h:208
pin_name_t int_pin
Definition irthermo4.h:211
pin_name_t sda
Definition irthermo4.h:209
uint8_t i2c_address
Definition irthermo4.h:214
IR Thermo 4 Click EEPROM content object.
Definition irthermo4.h:170
uint32_t uout1
Definition irthermo4.h:176
float m_val
Definition irthermo4.h:174
float k_val
Definition irthermo4.h:179
uint16_t ptat25
Definition irthermo4.h:173
uint32_t u0_val
Definition irthermo4.h:175
uint8_t tobj1
Definition irthermo4.h:177
uint8_t protocol
Definition irthermo4.h:171
uint8_t lookup
Definition irthermo4.h:172
uint8_t slave_add
Definition irthermo4.h:178
IR Thermo 4 Click context object.
Definition irthermo4.h:188
digital_in_t int_pin
Definition irthermo4.h:190
i2c_master_t i2c
Definition irthermo4.h:193
uint8_t slave_address
Definition irthermo4.h:196
irthermo4_eeprom_t eeprom
Definition irthermo4.h:198