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 TEMPHIM_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 TEMPHIM_RETVAL uint8_t
79#define TEMPHIM_OK 0x00
80#define TEMPHIM_INIT_ERROR 0xFF
87#define TEMPANDHUM_I2C_ADDRESS 0x5F
94#define TEMPANDHUM_WHO_AM_I 0x0F
95#define TEMPANDHUM_AV_CONF 0x10
96#define TEMPANDHUM_CTRL_REG1 0x20
97#define TEMPANDHUM_CTRL_REG2 0x21
98#define TEMPANDHUM_CTRL_REG3 0x22
99#define TEMPANDHUM_STATUS_REG 0x27
100#define TEMPANDHUM_HUMIDITY_OUT_L 0x28
101#define TEMPANDHUM_HUMIDITY_OUT_H 0x29
102#define TEMPANDHUM_TEMP_OUT_L 0x2A
103#define TEMPANDHUM_TEMP_OUT_H 0x2B
104#define TEMPANDHUM_H0_RH_X2 0x30
105#define TEMPANDHUM_H1_RH_X2 0x31
106#define TEMPANDHUM_T0_DEGC_X8 0x32
107#define TEMPANDHUM_T1_DEGC_X8 0x33
108#define TEMPANDHUM_T1_T0_MSB 0x35
109#define TEMPANDHUM_H0_T0_OUT_L 0x36
110#define TEMPANDHUM_H0_T0_OUT_H 0x37
111#define TEMPANDHUM_H1_T0_OUT_L 0x3A
112#define TEMPANDHUM_H1_T0_OUT_H 0x3B
113#define TEMPANDHUM_T0_OUT_L 0x3C
114#define TEMPANDHUM_T0_OUT_H 0x3D
115#define TEMPANDHUM_T1_OUT_L 0x3E
116#define TEMPANDHUM_T1_OUT_H 0x3F
123#define TEMPANDHUM_AV_CONF_DEFAULT_VALUE 0x1B
124#define TEMPANDHUM_CTRL_REG1_DEFAULT_VALUE 0x85
125#define TEMPANDHUM_CTRL_REG2_DEFAULT_VALUE 0x00
126#define TEMPANDHUM_CTRL_REG3_DEFAULT_VALUE 0x00
#define TEMPHIM_RETVAL
Definition temphum.h:77
uint16_t temphum_get_hum_data(temphum_t *ctx)
Gets humidity data function.
void temphum_default_cfg(temphum_t *ctx)
Click Default Configuration function.
TEMPHIM_RETVAL temphum_init(temphum_t *ctx, temphum_cfg_t *cfg)
Initialization function.
void temphum_generic_read(temphum_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len)
Generic read function.
void temphum_generic_write(temphum_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len)
Generic write function.
float temphum_get_humidity(temphum_t *ctx)
Gets humidity in degrees Celsius function.
uint16_t temphum_get_temp_data(temphum_t *ctx)
Gets temperature data function.
void temphum_get_temp_hum(temphum_t *ctx, float *temperature, float *humidity)
Gets temperature and humidity function.
float temphum_get_temperature(temphum_t *ctx)
Gets temperature in degrees Celsius function.
void temphum_cfg_setup(temphum_cfg_t *cfg)
Config Object Initialization function.
Click configuration structure definition.
Definition temphum.h:174
uint32_t i2c_speed
Definition temphum.h:186
pin_name_t scl
Definition temphum.h:177
pin_name_t int_pin
Definition temphum.h:182
pin_name_t sda
Definition temphum.h:178
uint8_t i2c_address
Definition temphum.h:187
Click ctx object definition.
Definition temphum.h:140
int16_t t0_out
Definition temphum.h:161
float float_h_out
Definition temphum.h:153
uint8_t t1_deg_c_x8
Definition temphum.h:158
uint8_t h0_rh_x2
Definition temphum.h:155
int16_t t1_out
Definition temphum.h:162
int16_t h0_t0_out
Definition temphum.h:159
float h0_rh_cal
Definition temphum.h:165
digital_in_t int_pin
Definition temphum.h:143
uint8_t h1_rh_x2
Definition temphum.h:156
i2c_master_t i2c
Definition temphum.h:147
float t1_deg_c_cal
Definition temphum.h:164
float t0_deg_c_cal
Definition temphum.h:163
uint8_t slave_address
Definition temphum.h:151
uint8_t t0_deg_c_x8
Definition temphum.h:157
int16_t h1_t0_out
Definition temphum.h:160
float float_t_out
Definition temphum.h:154
float h1_rh_cal
Definition temphum.h:166