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 TEMPHUM27_CMD_HOLD_TEMP_MEAS 0xE3
74#define TEMPHUM27_CMD_NO_HOLD_TEMP_MEAS 0xF3
75#define TEMPHUM27_CMD_HOLD_TEMP_HUM_MEAS 0xE5
76#define TEMPHUM27_CMD_NO_HOLD_TEMP_HUM_MEAS 0xF5
77#define TEMPHUM27_CMD_READ_REG 0xA7
78#define TEMPHUM27_CMD_WRITE_REG 0xA6
79#define TEMPHUM27_CMD_STOP_PERIODIC_MEAS 0x30
80#define TEMPHUM27_CMD_READ_SENSOR_ID 0xD7
86#define TEMPHUM27_REG_MEAS_RESOLUTION 0x00
87#define TEMPHUM27_REG_PERIODIC_CONFIG 0x02
88#define TEMPHUM27_REG_ALERT_ENABLE 0x03
89#define TEMPHUM27_REG_RST_THOLD_TEMP_H_LSB 0x05
90#define TEMPHUM27_REG_RST_THOLD_TEMP_H_MSB 0x06
91#define TEMPHUM27_REG_TRG_THOLD_TEMP_H_LSB 0x07
92#define TEMPHUM27_REG_TRG_THOLD_TEMP_H_MSB 0x08
93#define TEMPHUM27_REG_TRG_THOLD_TEMP_L_LSB 0x09
94#define TEMPHUM27_REG_TRG_THOLD_TEMP_L_MSB 0x0A
95#define TEMPHUM27_REG_RST_THOLD_TEMP_L_LSB 0x0B
96#define TEMPHUM27_REG_RST_THOLD_TEMP_L_MSB 0x0C
97#define TEMPHUM27_REG_RST_THOLD_HUM_H_LSB 0x0D
98#define TEMPHUM27_REG_RST_THOLD_HUM_H_MSB 0x0E
99#define TEMPHUM27_REG_TRG_THOLD_HUM_H_LSB 0x0F
100#define TEMPHUM27_REG_TRG_THOLD_HUM_H_MSB 0x10
101#define TEMPHUM27_REG_TRG_THOLD_HUM_L_LSB 0x11
102#define TEMPHUM27_REG_TRG_THOLD_HUM_L_MSB 0x12
103#define TEMPHUM27_REG_RST_THOLD_HUM_L_LSB 0x13
104#define TEMPHUM27_REG_RST_THOLD_HUM_L_MSB 0x14
122#define TEMPHUM27_PERIODIC_CONFIG_ACTIVATE 0x80
123#define TEMPHUM27_PERIODIC_CONFIG_FREQ_0_5S 0x00
124#define TEMPHUM27_PERIODIC_CONFIG_FREQ_1S 0x10
125#define TEMPHUM27_PERIODIC_CONFIG_FREQ_2_5S 0x20
126#define TEMPHUM27_PERIODIC_CONFIG_FREQ_MASK 0x30
127#define TEMPHUM27_PERIODIC_CONFIG_ALR_POL_LOW 0x00
128#define TEMPHUM27_PERIODIC_CONFIG_ALR_POL_HIGH 0x01
129#define TEMPHUM27_PERIODIC_CONFIG_ALR_POL_MASK 0x01
135#define TEMPHUM27_PERIODIC_FREQ_0_5S 0
136#define TEMPHUM27_PERIODIC_FREQ_1S 1
137#define TEMPHUM27_PERIODIC_FREQ_2_5S 2
143#define TEMPHUM27_DATA_RESOLUTION 0x3FFF
144#define TEMPHUM27_TEMP_DATA_RES 165
145#define TEMPHUM27_TEMP_DATA_OFFSET 40
146#define TEMPHUM27_HUM_DATA_RES 100
153#define TEMPHUM27_DEVICE_ADDRESS 0x54
171#define TEMPHUM27_MAP_MIKROBUS( cfg, mikrobus ) \
172 cfg.scl = MIKROBUS( mikrobus, MIKROBUS_SCL ); \
173 cfg.sda = MIKROBUS( mikrobus, MIKROBUS_SDA ); \
174 cfg.en = MIKROBUS( mikrobus, MIKROBUS_PWM ); \
175 cfg.alr = MIKROBUS( mikrobus, MIKROBUS_INT )
err_t temphum27_read_reg(temphum27_t *ctx, uint8_t reg, uint8_t *data_out)
TempHum 27 read register function.
err_t temphum27_read_data_no_hold(temphum27_t *ctx, float *temp, float *hum)
TempHum 27 read data (no hold mode) function.
err_t temphum27_read_data_hold(temphum27_t *ctx, float *temp, float *hum)
TempHum 27 read data (hold mode) function.
err_t temphum27_stop_periodic_meas(temphum27_t *ctx)
TempHum 27 stop periodic measurement function.
err_t temphum27_read_sensor_id(temphum27_t *ctx, uint32_t *sensor_id)
TempHum 27 read sensor ID function.
uint8_t temphum27_get_alert_pin(temphum27_t *ctx)
TempHum 27 get alert pin function.
err_t temphum27_write_reg(temphum27_t *ctx, uint8_t reg, uint8_t data_in)
TempHum 27 write register function.
void temphum27_cfg_setup(temphum27_cfg_t *cfg)
TempHum 27 configuration object setup function.
err_t temphum27_read_data_periodic_al(temphum27_t *ctx, float *temp, float *hum, uint8_t *alert)
TempHum 27 read data and alert in periodic mode function.
err_t temphum27_read_data_periodic(temphum27_t *ctx, float *temp, float *hum)
TempHum 27 read data in periodic mode function.
void temphum27_disable_device(temphum27_t *ctx)
TempHum 27 disable device function.
void temphum27_enable_device(temphum27_t *ctx)
TempHum 27 enable device function.
err_t temphum27_init(temphum27_t *ctx, temphum27_cfg_t *cfg)
TempHum 27 initialization function.
err_t temphum27_start_periodic_meas(temphum27_t *ctx, uint8_t freq)
TempHum 27 start periodic measurement function.
void temphum27_reset_device(temphum27_t *ctx)
TempHum 27 reset device function.
TempHum 27 Click configuration object.
Definition temphum27.h:205
pin_name_t alr
Definition temphum27.h:210
uint32_t i2c_speed
Definition temphum27.h:212
pin_name_t scl
Definition temphum27.h:206
pin_name_t en
Definition temphum27.h:209
pin_name_t sda
Definition temphum27.h:207
uint8_t i2c_address
Definition temphum27.h:213
TempHum 27 Click context object.
Definition temphum27.h:185
digital_in_t alr
Definition temphum27.h:190
i2c_master_t i2c
Definition temphum27.h:193
digital_out_t en
Definition temphum27.h:187
uint8_t slave_address
Definition temphum27.h:196
temphum27_return_value_t
TempHum 27 Click return value data.
Definition temphum27.h:222
@ TEMPHUM27_OK
Definition temphum27.h:223
@ TEMPHUM27_ERROR
Definition temphum27.h:224