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"
66#define TEMPHUM2_MAP_MIKROBUS( cfg, mikrobus ) \
67 cfg.scl = MIKROBUS( mikrobus, MIKROBUS_SCL ); \
68 cfg.sda = MIKROBUS( mikrobus, MIKROBUS_SDA )
75#define TEMPHUM2_RETVAL uint8_t
77#define TEMPHUM2_OK 0x00
78#define TEMPHUM2_INIT_ERROR 0xFF
85#define TEMPHUM2_REG_FIRMWARE_REVISION 0x84F1
86#define TEMPHUM2_REG_ELECTRONIC_ID_1 0xFA0F
87#define TEMPHUM2_REG_ELECTRONIC_ID_2 0xFCC9
88#define TEMPHUM2_REG_SOFT_RESET 0xFE
89#define TEMPHUM2_REG_TEMPHUM_HM_NORMAL_MODE 0x7CA2
90#define TEMPHUM2_REG_TEMPHUM_NHM_NORMAL_MODE 0x7866
91#define TEMPHUM2_REG_TEMPHUM_HM_FAST_MODE 0x6458
92#define TEMPHUM2_REG_TEMPHUM_NHM_FAST_MODE 0x609C
93#define TEMPHUM2_REG_QUERY_DEVICE_RESP 0xEFC8
94#define TEMPHUM2_REG_QUERY_DEVICE_RESP1 0x805D
95#define TEMPHUM2_REG_WRITE_HEATER_CONTROL 0xE6
96#define TEMPHUM2_REG_READ_HEATER_CONTROL 0xE7
103#define QUERY_DEVICE_ERROR 1
104#define QUERY_DEVICE_OK 0
111#define TEMPHUM2_HEATER_ENABLE 0x10
112#define TEMPHUM2_HEATER_DISABLE 0x00
113#define TEMPHUM2_HEATER_CURRENT_6_4mA 0x00
114#define TEMPHUM2_HEATER_CURRENT_9_7mA 0x01
115#define TEMPHUM2_HEATER_CURRENT_13_1mA 0x02
116#define TEMPHUM2_HEATER_CURRENT_19_6mA 0x04
117#define TEMPHUM2_HEATER_CURRENT_32_4mA 0x08
118#define TEMPHUM2_HEATER_CURRENT_53_5mA 0x0F
125#define TEMPHUM2_NO_HOLD_MODE 0x01
126#define TEMPHUM2_HOLD_MODE 0x02
127#define TEMPHUM2_NORMAL_MODE 0x01
128#define TEMPHUM2_FAST_MODE 0x01
#define TEMPHUM2_RETVAL
Definition temphum2.h:75
void temhum2_get_eletronic_id(temphum2_t *ctx, uint8_t *electronic_id)
This function for reads Eletronic ID.
void temphum2_cfg_setup(temphum2_cfg_t *cfg)
Config Object Initialization function.
uint8_t temphum2_get_query_device(temphum2_t *ctx)
This function for reads Query Device.
void temphum2_set_mode(uint8_t select_mode, uint8_t speed_mode)
Functions for set measurement mode.
TEMPHUM2_RETVAL temphum2_init(temphum2_t *ctx, temphum2_cfg_t *cfg)
Initialization function.
void temphum2_get_measurement(temphum2_t *ctx, float *data_buffer)
Functions for mesurement.
void temphum2_generic_write(temphum2_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len)
Generic write function.
uint8_t temphum2_read_firmware_revision(temphum2_t *ctx)
This function for reads Firmware Revision.
void temphum2_generic_read(temphum2_t *ctx, uint8_t *tx_buf, uint8_t *data_buf, uint8_t len)
Generic read function.
void temphum2_default_cfg(temphum2_t *ctx)
Click Default Configuration function.
Click configuration structure definition.
Definition temphum2.h:157
uint32_t i2c_speed
Definition temphum2.h:165
pin_name_t scl
Definition temphum2.h:160
pin_name_t sda
Definition temphum2.h:161
uint8_t i2c_address
Definition temphum2.h:166
Click ctx object definition.
Definition temphum2.h:142
i2c_master_t i2c
Definition temphum2.h:145
uint8_t slave_address
Definition temphum2.h:149