36#ifdef PREINIT_SUPPORTED
40#ifdef MikroCCoreVersion
41 #if MikroCCoreVersion >= 1
46#include "drv_digital_out.h"
47#include "drv_digital_in.h"
48#include "drv_i2c_master.h"
71#define IRTHERMO2_SENSOR_VOLTAGE 0x00
72#define IRTHERMO2_LOCAL_TEMPERATURE 0x01
73#define IRTHERMO2_CONFIGURATION 0x02
74#define IRTHERMO2_OBJECT_TEMPERATURE 0x03
75#define IRTHERMO2_STATUS 0x04
76#define IRTHERMO2_STATUS_MASK_AND_ENABLE 0x05
77#define IRTHERMO2_OBJECT_HIGH_LIMIT_TEMP 0x06
78#define IRTHERMO2_OBJECT_LOW_LIMIT_TEMP 0x07
79#define IRTHERMO2_LOCAL_HIGH_LIMIT_TEMP 0x08
80#define IRTHERMO2_LOCAL_LOW_LIMIT_TEMP 0x09
81#define IRTHERMO2_S0_COEFFICIENT 0x0A
82#define IRTHERMO2_A0_COEFFICIENT 0x0B
83#define IRTHERMO2_A1_COEFFICIENT 0x0C
84#define IRTHERMO2_B0_COEFFICIENT 0x0D
85#define IRTHERMO2_B1_COEFFICIENT 0x0E
86#define IRTHERMO2_B2_COEFFICIENT 0x0F
87#define IRTHERMO2_C_COEFFICIENT 0x10
88#define IRTHERMO2_TC0_COEFFICIENT 0X11
89#define IRTHERMO2_TC1_COEFFICIENT 0x12
90#define IRTHERMO2_DEVICE_ID 0x1F
91#define IRTHERMO2_MEMORY_ACCESS 0x2A
109#define IRTHERMO2_RESULT_OK 1
110#define IRTHERMO2_RESULT_ERROR 0
111#define IRTHERMO2_CFG_MODEON 0x1000
112#define IRTHERMO2_CFG_RESET 0x8000
113#define IRTHERMO2_CFG_1SAMPLE 0x0000
114#define IRTHERMO2_CFG_2SAMPLE 0x0200
115#define IRTHERMO2_CFG_4SAMPLE 0x0400
116#define IRTHERMO2_CFG_8SAMPLE 0x0600
117#define IRTHERMO2_CFG_16SAMPLE 0x0800
118#define IRTHERMO2_CFG_ALERTEN 0x0100
119#define IRTHERMO2_CFG_ALERTF 0x0080
120#define IRTHERMO2_CFG_TRANSC 0x0040
121#define IRTHERMO2_STAT_ALERTEN 0x8000
122#define IRTHERMO2_STAT_CRTEN 0x4000
123#define IRTHERMO2_DEVICE_ID_VALUE 0x0078
130#define IRTHERMO2_I2C_ADDRESS_0 0x40
131#define IRTHERMO2_I2C_ADDRESS_1 0x41
132#define IRTHERMO2_I2C_ADDRESS_2 0x44
133#define IRTHERMO2_I2C_ADDRESS_3 0x45
151#define IRTHERMO2_MAP_MIKROBUS( cfg, mikrobus ) \
152 cfg.scl = MIKROBUS( mikrobus, MIKROBUS_SCL ); \
153 cfg.sda = MIKROBUS( mikrobus, MIKROBUS_SDA ); \
154 cfg.al = MIKROBUS( mikrobus, MIKROBUS_INT )
err_t irthermo2_init(irthermo2_t *ctx, irthermo2_cfg_t *cfg)
Initialization function.
float irthermo2_get_object_temperature_c(irthermo2_t *ctx)
Get object temperature in degrees Celsius function.
void irthermo2_write_data(irthermo2_t *ctx, uint8_t address, uint16_t write_data)
Generic write 16-bit data function.
void irthermo2_generic_read(irthermo2_t *ctx, uint8_t reg, uint8_t *data_out, uint8_t len)
Generic read function.
void irthermo2_default_cfg(irthermo2_t *ctx)
Click Default Configuration function.
void irthermo2_generic_write(irthermo2_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t len)
Generic write function.
uint16_t irthermo2_read_data(irthermo2_t *ctx, uint8_t address)
Generic read 16-bit data from 8-bit address function.
uint8_t irhhermo2_get_alert(irthermo2_t *ctx)
Get state of alert function.
err_t irthermo2_check_id(irthermo2_t *ctx)
Check device ID function.
void irthermo2_cfg_setup(irthermo2_cfg_t *cfg)
Config Object Initialization function.
float irthermo2_get_object_temperature_f(irthermo2_t *ctx)
Get object temperature in degrees Fahrenheit function.
float irthermo2_get_raw_temperature(irthermo2_t *ctx)
Get raw temperature in degrees Celsius function.
irthermo2_return_value_t
IrThermo 2 Click return value data.
Definition irthermo2.h:205
@ IRTHERMO2_ERROR
Definition irthermo2.h:207
@ IRTHERMO2_OK
Definition irthermo2.h:206
Click configuration structure definition.
Definition irthermo2.h:183
uint32_t i2c_speed
Definition irthermo2.h:195
pin_name_t al
Definition irthermo2.h:191
pin_name_t scl
Definition irthermo2.h:186
pin_name_t sda
Definition irthermo2.h:187
uint8_t i2c_address
Definition irthermo2.h:196
Click ctx object definition.
Definition irthermo2.h:166
digital_in_t al
Definition irthermo2.h:168
i2c_master_t i2c
Definition irthermo2.h:171
uint8_t slave_address
Definition irthermo2.h:175