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"
52#include "drv_spi_master.h"
74#define TEMPHUM16_REG_DEVICE_ID 0x0F
75#define TEMPHUM16_REG_AVERAGE 0x10
76#define TEMPHUM16_REG_CTRL_1 0x20
77#define TEMPHUM16_REG_CTRL_2 0x21
78#define TEMPHUM16_REG_CTRL_3 0x22
79#define TEMPHUM16_REG_STATUS 0x27
80#define TEMPHUM16_REG_H_OUT_L 0x28
81#define TEMPHUM16_REG_H_OUT_H 0x29
82#define TEMPHUM16_REG_T_OUT_L 0x2A
83#define TEMPHUM16_REG_T_OUT_H 0x2B
84#define TEMPHUM16_REG_H0_RH_X2 0x30
85#define TEMPHUM16_REG_H1_RH_X2 0x31
86#define TEMPHUM16_REG_T0_DEGC_X8 0x32
87#define TEMPHUM16_REG_T1_DEGC_X8 0x33
88#define TEMPHUM16_REG_T0_T1_DEGC_H2 0x35
89#define TEMPHUM16_REG_H0_T0_OUT_L 0x36
90#define TEMPHUM16_REG_H0_T0_OUT_H 0x37
91#define TEMPHUM16_REG_H1_T0_OUT_L 0x3A
92#define TEMPHUM16_REG_H1_T0_OUT_H 0x3B
93#define TEMPHUM16_REG_T0_OUT_L 0x3C
94#define TEMPHUM16_REG_T0_OUT_H 0x3D
95#define TEMPHUM16_REG_T1_OUT_L 0x3E
96#define TEMPHUM16_REG_T1_OUT_H 0x3F
114#define TEMPHUM16_PWR_MODE_POWER_DOWN 0x00
115#define TEMPHUM16_PWR_MODE_CONTINUOUS 0x01
117#define TEMPHUM16_BDU_CONTINUOUS_UPDATE 0x00
118#define TEMPHUM16_BDU_NOT_UPDAT_UNTIL_READ 0x01
120#define TEMPHUM16_ODR_ONE_SHOT_MODE 0x00
121#define TEMPHUM16_ODR_1_Hz 0x01
122#define TEMPHUM16_ODR_7_Hz 0x02
123#define TEMPHUM16_ODR_12_5_Hz 0x03
125#define TEMPHUM16_HEATER_DISABLE 0x00
126#define TEMPHUM16_HEATER_ENABLE 0x01
132#define TEMPHUM16_DEVICE_ID 0xBC
138#define TEMPHUM16_DRDY 0x01
145#define TEMPHUM16_SET_DEV_ADDR 0x5F
163#define TEMPHUM16_MAP_MIKROBUS( cfg, mikrobus ) \
164 cfg.scl = MIKROBUS( mikrobus, MIKROBUS_SCL ); \
165 cfg.sda = MIKROBUS( mikrobus, MIKROBUS_SDA ); \
166 cfg.miso = MIKROBUS( mikrobus, MIKROBUS_MISO ); \
167 cfg.mosi = MIKROBUS( mikrobus, MIKROBUS_MOSI ); \
168 cfg.sck = MIKROBUS( mikrobus, MIKROBUS_SCK ); \
169 cfg.cs = MIKROBUS( mikrobus, MIKROBUS_CS ); \
170 cfg.rdy = MIKROBUS( mikrobus, MIKROBUS_INT )
err_t temphum16_generic_write(temphum16_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t len)
Temp&Hum 16 data writing function.
err_t temphum16_bdu_mode(temphum16_t *ctx, uint8_t bdu_mode)
Temp&Hum 16 set block data update mode function.
err_t temphum16_default_cfg(temphum16_t *ctx)
Temp&Hum 16 default configuration function.
err_t temphum16_heater(temphum16_t *ctx, uint8_t heater_mode)
Temp&Hum 16 heater function.
err_t temphum16_get_status(temphum16_t *ctx, uint8_t *status)
Temp&Hum 16 get status function.
err_t temphum16_get_device_id(temphum16_t *ctx, uint8_t *device_id)
Temp&Hum 16 get device ID function.
void temphum16_drv_interface_selection(temphum16_cfg_t *cfg, temphum16_drv_t drv_sel)
Temp&Hum 16 driver interface setup function.
uint8_t temphum16_check_ready(temphum16_t *ctx)
Temp&Hum 16 check ready function.
err_t temphum16_get_humidity(temphum16_t *ctx, float *humidity)
Temp&Hum 16 get humidity function.
err_t temphum16_get_temperature(temphum16_t *ctx, float *temperature)
Temp&Hum 16 get temperature function.
err_t temphum16_power_mode(temphum16_t *ctx, uint8_t pwr_mode)
Temp&Hum 16 set power mode function.
void temphum16_cfg_setup(temphum16_cfg_t *cfg)
Temp&Hum 16 configuration object setup function.
err_t temphum16_enable_data_ready_interrupt(temphum16_t *ctx)
Temp&Hum 16 enable data ready interrupt function.
err_t temphum16_init(temphum16_t *ctx, temphum16_cfg_t *cfg)
Temp&Hum 16 initialization function.
err_t temphum16_generic_read(temphum16_t *ctx, uint8_t reg, uint8_t *data_out, uint8_t len)
Temp&Hum 16 data reading function.
err_t temphum16_set_odr(temphum16_t *ctx, uint8_t odr)
Temp&Hum 16 set output data rate function.
Temp&Hum 16 Click configuration object.
Definition temphum16.h:217
temphum16_drv_t drv_sel
Definition temphum16.h:233
uint32_t i2c_speed
Definition temphum16.h:226
spi_master_chip_select_polarity_t cs_polarity
Definition temphum16.h:231
pin_name_t sck
Definition temphum16.h:222
spi_master_mode_t spi_mode
Definition temphum16.h:230
pin_name_t mosi
Definition temphum16.h:221
uint32_t spi_speed
Definition temphum16.h:229
pin_name_t scl
Definition temphum16.h:218
pin_name_t rdy
Definition temphum16.h:224
pin_name_t miso
Definition temphum16.h:220
pin_name_t sda
Definition temphum16.h:219
pin_name_t cs
Definition temphum16.h:223
uint8_t i2c_address
Definition temphum16.h:227
Temp&Hum 16 Click context object.
Definition temphum16.h:197
spi_master_t spi
Definition temphum16.h:201
temphum16_drv_t drv_sel
Definition temphum16.h:205
temphum16_master_io_t read_f
Definition temphum16.h:208
temphum16_master_io_t write_f
Definition temphum16.h:207
i2c_master_t i2c
Definition temphum16.h:200
uint8_t slave_address
Definition temphum16.h:203
pin_name_t chip_select
Definition temphum16.h:204
digital_in_t rdy
Definition temphum16.h:198
err_t(* temphum16_master_io_t)(struct temphum16_s *, uint8_t, uint8_t *, uint8_t)
Temp&Hum 16 Click driver interface.
Definition temphum16.h:190
temphum16_return_value_t
Temp&Hum 16 Click return value data.
Definition temphum16.h:242
@ TEMPHUM16_ERROR
Definition temphum16.h:244
@ TEMPHUM16_OK
Definition temphum16.h:243
struct temphum16_s temphum16_t
Temp&Hum 16 Click context object.
temphum16_drv_t
Temp&Hum 16 Click driver selector.
Definition temphum16.h:180
@ TEMPHUM16_DRV_SEL_SPI
Definition temphum16.h:181
@ TEMPHUM16_DRV_SEL_I2C
Definition temphum16.h:182