48 #ifndef __DRV_HTS221_H__ 49 #define __DRV_HTS221_H__ 51 #include "nrf_drv_twi.h" 55 #define WHO_AM_I_REG 0x0F 56 #define WHO_AM_I_VAL 0xBC 59 #define AV_CONF_REG 0x10 60 #define AV_CONF_REG_DEFAULT 0x1B 63 #define AV_CONF_REG_AVGT_Pos 3 64 #define AV_CONF_REG_AVGT_Msk (7 << AV_CONF_REG_AVGT_Pos) 65 #define AV_CONF_REG_AVGT_2 0 66 #define AV_CONF_REG_AVGT_4 1 67 #define AV_CONF_REG_AVGT_8 2 68 #define AV_CONF_REG_AVGT_16 3 69 #define AV_CONF_REG_AVGT_32 4 70 #define AV_CONF_REG_AVGT_64 5 71 #define AV_CONF_REG_AVGT_128 6 72 #define AV_CONF_REG_AVGT_256 7 75 #define AV_CONF_REG_AVGH_Pos 0 76 #define AV_CONF_REG_AVGH_Msk (7 << AV_CONF_REG_AVGH_Pos) 77 #define AV_CONF_REG_AVGH_4 0 78 #define AV_CONF_REG_AVGH_8 1 79 #define AV_CONF_REG_AVGH_16 2 80 #define AV_CONF_REG_AVGH_32 3 81 #define AV_CONF_REG_AVGH_64 4 82 #define AV_CONF_REG_AVGH_128 5 83 #define AV_CONF_REG_AVGH_256 6 84 #define AV_CONF_REG_AVGH_512 7 87 #define CTRL_REG1 0x20 88 #define CTRL_REG1_DEFAULT 0x00 91 #define CTRL_REG1_PD_Pos 7 92 #define CTRL_REG1_PD_Msk (1 << CTRL_REG1_PD_Pos) 93 #define CTRL_REG1_PD_PowerDown 0 94 #define CTRL_REG1_PD_Active 1 97 #define CTRL_REG1_BDU_Pos 2 98 #define CTRL_REG1_BDU_Msk (1 << CTRL_REG1_BDU_Pos) 99 #define CTRL_REG1_BDU_Continuous 0 100 #define CTRL_REG1_BDU_Set 1 103 #define CTRL_REG1_ODR_Pos 0 104 #define CTRL_REG1_ODR_Msk (3 << CTRL_REG1_ODR_Pos) 105 #define CTRL_REG1_ODR_OneShot 0 106 #define CTRL_REG1_ODR_1Hz 1 107 #define CTRL_REG1_ODR_7Hz 2 108 #define CTRL_REG1_ODR_12_5Hz 3 111 #define CTRL_REG2 0x21 112 #define CTRL_REG2_DEFAULT 0x00 115 #define CTRL_REG2_BOOT_Pos 7 116 #define CTRL_REG2_BOOT_Msk (1 << CTRL_REG2_BOOT_Pos) 117 #define CTRL_REG2_BOOT_Normal 0 118 #define CTRL_REG2_BOOT_Reboot 1 121 #define CTRL_REG2_HEATER_Pos 1 122 #define CTRL_REG2_HEATER_Msk (1 << CTRL_REG2_HEATER_Pos) 123 #define CTRL_REG2_HEATER_Disable 0 124 #define CTRL_REG2_HEATER_Enable 1 127 #define CTRL_REG2_ONE_SHOT_Pos 0 128 #define CTRL_REG2_ONE_SHOT_Msk (1 << CTRL_REG2_ONE_SHOT_Pos) 129 #define CTRL_REG2_ONE_SHOT_WaitingForStart 0 130 #define CTRL_REG2_ONE_SHOT_Start 1 133 #define CTRL_REG3 0x22 134 #define CTRL_REG3_DEFAULT 0x00 137 #define CTRL_REG3_DRDY_H_L_Pos 7 138 #define CTRL_REG3_DRDY_H_L_Msk (1 << CTRL_REG3_DRDY_H_L_Pos) 139 #define CTRL_REG3_DRDY_H_L_ActiveHigh 0 140 #define CTRL_REG3_DRDY_H_L_ActiveLow 1 143 #define CTRL_REG3_PP_OD_Pos 6 144 #define CTRL_REG3_PP_OD_Msk (1 << CTRL_REG3_PP_OD_Pos) 145 #define CTRL_REG3_PP_OD_PushPull 0 146 #define CTRL_REG3_PP_OD_OpenDrain 1 149 #define CTRL_REG3_DRDY_Pos 2 150 #define CTRL_REG3_DRDY_Msk (1 << CTRL_REG3_DRDY_Pos) 151 #define CTRL_REG3_DRDY_Disable 0 152 #define CTRL_REG3_DRDY_Enable 1 155 #define STATUS_REG 0x27 158 #define STATUS_REG_H_DA_Pos 1 159 #define STATUS_REG_H_DA_Msk (1 << STATUS_REG_H_DA_Pos) 160 #define STATUS_REG_H_DA_NotAvail 0 161 #define STATUS_REG_H_DA_Avail 1 164 #define STATUS_REG_T_DA_Pos 0 165 #define STATUS_REG_T_DA_Msk (1 << STATUS_REG_T_DA_Pos) 166 #define STATUS_REG_T_DA_NotAvail 0 167 #define STATUS_REG_T_DA_Avail 1 170 #define HUMIDITY_OUT_L_REG 0x28 173 #define HUMIDITY_OUT_H_REG 0x29 176 #define TEMP_OUT_L_REG 0x2A 179 #define TEMP_OUT_H_REG 0x2B 181 #define CALIBRATION_REGS 0x30 182 #define CALIBRATION_REGS_NUM 16 uint32_t drv_hts221_cfg_set(drv_hts221_cfg_t const *const p_cfg)
Function for configuring the HTS221 sensor according to the specified configuration.
uint32_t drv_hts221_open(drv_hts221_twi_cfg_t const *const p_cfg)
Function for opening the HTS221 driver according to the specified configuration.
uint32_t pin_int
Interrupt pin.
Definition: drv_hts221.h:213
uint32_t drv_hts221_cfg_get(drv_hts221_cfg_t *p_cfg)
Function for reading the configuration of the HTS221 sensor.
uint8_t twi_addr
TWI address on bus.
Definition: drv_hts221.h:212
nrf_drv_twi_config_t const * p_twi_config
TWI configuraion.
Definition: drv_hts221.h:215
Configuration struct for HTS221 humidity sensor.
Definition: drv_hts221.h:186
uint32_t drv_hts221_reboot(void)
Function for rebooting the HTS221 memory content.
Calibration struct.
Definition: drv_hts221.h:196
uint32_t drv_hts221_humidity_get(int16_t *p_humidity)
Function for getting the humidity data.
uint32_t drv_hts221_close(void)
Function for closing the HTS221 driver.
uint32_t drv_hts221_init(void)
Function for initializing the HTS221 driver.
uint32_t drv_hts221_verify(void)
Function for verifying the HTS221 WHO_AM_I register.
Initialization struct for the humidity driver.
Definition: drv_hts221.h:210
nrf_drv_twi_t const * p_twi_instance
TWI instance.
Definition: drv_hts221.h:214
uint32_t drv_hts221_status_get(uint8_t *p_status)
Function for getting the status.
uint32_t drv_hts221_temperature_get(int16_t *p_temperature)
Function for getting the temperature data.
uint32_t drv_hts221_one_shot(void)
Function for starting one shot conversion.
uint32_t drv_hts221_calib_get(drv_hts221_calib_t *p_calib)
Function for getting the sensor calibration data.