Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: Arduino_Nano33BLESense_examples
HTS221.h
00001 /** 00002 * @brief HTS221.h 00003 * @details Capacitive digital sensor for relative humidity and temperature. 00004 * Header file. 00005 * 00006 * 00007 * @return N/A 00008 * 00009 * @author Manuel Caballero 00010 * @date 31/May/2019 00011 * @version 31/May/2019 The ORIGIN 00012 * @pre N/A. 00013 * @warning N/A 00014 * @pre This code belongs to AqueronteBlog ( http://unbarquero.blogspot.com ). All rights reserved. 00015 */ 00016 #ifndef HTS221_H 00017 #define HTS221_H 00018 00019 #include "mbed.h" 00020 00021 00022 /** 00023 Example: 00024 @code 00025 #include "mbed.h" 00026 #include "HTS221.h" 00027 00028 HTS221 myHTS221 ( I2C_SDA, I2C_SCL, HTS221::HTS221_ADDRESS, 400000 ); // I2C_SDA | I2C_SCL 00029 Serial pc ( USBTX, USBRX ); // tx, rx 00030 00031 DigitalOut myled ( LED1 ); 00032 Ticker newAction; 00033 00034 00035 //@brief Constants. 00036 00037 00038 //@brief Variables. 00039 volatile uint32_t myState; // State that indicates when to perform a new sample 00040 00041 00042 // @brief FUNCTION PROTOTYPES 00043 void changeDATA ( void ); 00044 00045 00046 //@brief FUNCTION FOR APPLICATION MAIN ENTRY. 00047 int main() 00048 { 00049 HTS221::HTS221_status_t aux; 00050 HTS221::HTS221_data_t myHTS221_Data; 00051 00052 pc.baud ( 115200 ); 00053 00054 00055 myled = 1; 00056 wait(3); 00057 myled = 0; 00058 00059 // Get device ID 00060 aux = myHTS221.HTS221_GetDeviceID ( &myHTS221_Data ); 00061 00062 // Boot the device 00063 aux = myHTS221.HTS221_SetBoot (); 00064 00065 // Set device in ACTIVE mode 00066 aux = myHTS221.HTS221_SetPowerDown ( HTS221::CTRL_REG1_PD_ACTIVE_MODE ); 00067 00068 // Get calibration coefficients 00069 aux = myHTS221.HTS221_GetCalibrationCoefficients ( &myHTS221_Data ); 00070 00071 // Output registers not updated until MSB and LSB reading 00072 myHTS221_Data.bdu = HTS221::CTRL_REG1_BDU_DEFAULT_MODE; 00073 aux = myHTS221.HTS221_SetBlockDataUpdate ( myHTS221_Data ); 00074 00075 // Set resolution: 16 AVGT, 32 AVGH 00076 myHTS221_Data.temperatureResolution = HTS221::AV_CONF_AVGT_16; 00077 myHTS221_Data.humidityResolution = HTS221::AV_CONF_AVGH_32; 00078 aux = myHTS221.HTS221_SetResolution ( myHTS221_Data ); 00079 00080 // ODR 00081 myHTS221_Data.odr = HTS221::CTRL_REG1_ODR_ONE_SHOT; 00082 aux = myHTS221.HTS221_SetOutputDataRate ( myHTS221_Data ); 00083 00084 00085 myState = 0UL; // Reset the variable 00086 newAction.attach( &changeDATA, 1U ); // the address of the function to be attached ( changeDATA ) and the interval ( 1s ) 00087 00088 00089 // Let the callbacks take care of everything 00090 while(1) { 00091 sleep(); 00092 00093 if ( myState == 1UL ) { 00094 myled = 1U; 00095 00096 // Trigger to get a new data value 00097 aux = myHTS221.HTS221_SetOneShot (); 00098 00099 // Wait until there is a new data 00100 do { 00101 aux = myHTS221.HTS221_GetOneShot ( &myHTS221_Data ); 00102 } while( myHTS221_Data.one_shot == HTS221::CTRL_REG2_ONE_SHOT_WAITING ); 00103 00104 00105 aux = myHTS221.HTS221_GetCalibrationCoefficients ( &myHTS221_Data ); 00106 00107 // Get temperature 00108 do { 00109 aux = myHTS221.HTS221_GetTemperatureDataAvailable ( &myHTS221_Data ); 00110 } while( myHTS221_Data.t_da == HTS221::STATUS_REGISTER_T_DA_DATA_NOT_AVAILABLE ); 00111 00112 aux = myHTS221.HTS221_GetTemperature ( &myHTS221_Data ); 00113 00114 // Get humidity 00115 aux = myHTS221.HTS221_GetHumidity ( &myHTS221_Data ); 00116 00117 // Send data through the UART 00118 pc.printf ( "T: %0.1f C, RH: %0.1f %%\r\n", myHTS221_Data.temperature, myHTS221_Data.humidity ); 00119 00120 00121 // Reset the variables 00122 myState = 0UL; 00123 myled = 0U; 00124 } 00125 } 00126 } 00127 00128 00129 // @brief changeDATA ( void ) 00130 // 00131 // @details It changes myState variable 00132 // 00133 // @param[in] N/A 00134 // 00135 // @param[out] N/A. 00136 // 00137 // @return N/A. 00138 // 00139 // @author Manuel Caballero 00140 // @date 31/May/2019 00141 // @version 31/May/2019 The ORIGIN 00142 // @pre N/A 00143 // @warning N/A. 00144 void changeDATA ( void ) 00145 { 00146 myState = 1UL; 00147 } 00148 @endcode 00149 */ 00150 00151 00152 /*! 00153 Library for the HTS221 Capacitive digital sensor for relative humidity and temperature. 00154 */ 00155 class HTS221 00156 { 00157 public: 00158 typedef enum { 00159 HTS221_ADDRESS = ( 0b1011111 << 1U ) /*!< I2C slave address byte */ 00160 } HTS221_address_t ; 00161 00162 00163 00164 /** 00165 * @brief REGISTERS 00166 */ 00167 typedef enum { 00168 HTS221_WHO_AM_I = 0x0F, /*!< Device identification */ 00169 HTS221_AV_CONF = 0x10, /*!< Humidity and temperature resolution mode */ 00170 HTS221_CTRL_REG1 = 0x20, /*!< Control register 1 */ 00171 HTS221_CTRL_REG2 = 0x21, /*!< Control register 2 */ 00172 HTS221_CTRL_REG3 = 0x22, /*!< Control register 3 */ 00173 HTS221_STATUS_REG = 0x27, /*!< Status register */ 00174 HTS221_HUMIDITY_OUT_L = 0x28, /*!< Relative humidity data (LSB) */ 00175 HTS221_HUMIDITY_OUT_H = 0x29, /*!< Relative humidity data (MSB) */ 00176 HTS221_TEMP_OUT_L = 0x2A, /*!< Temperature data (LSB) */ 00177 HTS221_TEMP_OUT_H = 0x2B, /*!< Temperature data (MSB) */ 00178 HTS221_CALIB_0 = 0x30, /*!< Calibration register */ 00179 HTS221_CALIB_1 = 0x31, /*!< Calibration register */ 00180 HTS221_CALIB_2 = 0x32, /*!< Calibration register */ 00181 HTS221_CALIB_3 = 0x33, /*!< Calibration register */ 00182 HTS221_CALIB_4 = 0x34, /*!< Calibration register */ 00183 HTS221_CALIB_5 = 0x35, /*!< Calibration register */ 00184 HTS221_CALIB_6 = 0x36, /*!< Calibration register */ 00185 HTS221_CALIB_7 = 0x37, /*!< Calibration register */ 00186 HTS221_CALIB_8 = 0x38, /*!< Calibration register */ 00187 HTS221_CALIB_9 = 0x39, /*!< Calibration register */ 00188 HTS221_CALIB_A = 0x3A, /*!< Calibration register */ 00189 HTS221_CALIB_B = 0x3B, /*!< Calibration register */ 00190 HTS221_CALIB_C = 0x3C, /*!< Calibration register */ 00191 HTS221_CALIB_D = 0x3D, /*!< Calibration register */ 00192 HTS221_CALIB_E = 0x3E, /*!< Calibration register */ 00193 HTS221_CALIB_F = 0x3F /*!< Calibration register */ 00194 } HTS221_registers_t; 00195 00196 00197 00198 /** 00199 * @brief WHO_AM_I REGISTER 00200 */ 00201 typedef enum { 00202 WHO_AM_I_MASK = 0xFF, /*!< WHO_AM_I mask */ 00203 WHO_AM_I_VALUE = 0xBC /*!< WHO_AM_I value */ 00204 } HTS221_who_am_i_t; 00205 00206 00207 00208 /** 00209 * @brief AV_CONF REGISTER 00210 */ 00211 /* AVGT <5:3> 00212 * NOTE: Numbers of averaged temperature samples ( 2-256 ). 00213 */ 00214 typedef enum { 00215 AV_CONF_AVGT_MASK = ( 0b111 << 3U ), /*!< AVGT mask */ 00216 AV_CONF_AVGT_2 = ( 0b000 << 3U ), /*!< AVGT Nr. internal average 2 */ 00217 AV_CONF_AVGT_4 = ( 0b001 << 3U ), /*!< AVGT Nr. internal average 4 */ 00218 AV_CONF_AVGT_8 = ( 0b010 << 3U ), /*!< AVGT Nr. internal average 8 */ 00219 AV_CONF_AVGT_16 = ( 0b011 << 3U ), /*!< AVGT Nr. internal average 16 [ Default ] */ 00220 AV_CONF_AVGT_32 = ( 0b100 << 3U ), /*!< AVGT Nr. internal average 32 */ 00221 AV_CONF_AVGT_64 = ( 0b101 << 3U ), /*!< AVGT Nr. internal average 64 */ 00222 AV_CONF_AVGT_128 = ( 0b110 << 3U ), /*!< AVGT Nr. internal average 128 */ 00223 AV_CONF_AVGT_256 = ( 0b111 << 3U ) /*!< AVGT Nr. internal average 256 */ 00224 } HTS221_av_config_avgt_t; 00225 00226 00227 /* AVGH <2:0> 00228 * NOTE: Numbers of averaged humidity samples ( 4-512 ). 00229 */ 00230 typedef enum { 00231 AV_CONF_AVGH_MASK = ( 0b111 << 0U ), /*!< AVGH mask */ 00232 AV_CONF_AVGH_4 = ( 0b000 << 0U ), /*!< AVGH Nr. internal average 4 */ 00233 AV_CONF_AVGH_8 = ( 0b001 << 0U ), /*!< AVGH Nr. internal average 8 */ 00234 AV_CONF_AVGH_16 = ( 0b010 << 0U ), /*!< AVGH Nr. internal average 16 */ 00235 AV_CONF_AVGH_32 = ( 0b011 << 0U ), /*!< AVGH Nr. internal average 32 [ Default ] */ 00236 AV_CONF_AVGH_64 = ( 0b100 << 0U ), /*!< AVGH Nr. internal average 64 */ 00237 AV_CONF_AVGH_128 = ( 0b101 << 0U ), /*!< AVGH Nr. internal average 128 */ 00238 AV_CONF_AVGH_256 = ( 0b110 << 0U ), /*!< AVGH Nr. internal average 256 */ 00239 AV_CONF_AVGH_512 = ( 0b111 << 0U ) /*!< AVGH Nr. internal average 512 */ 00240 } HTS221_av_config_avgh_t ; 00241 00242 00243 00244 /** 00245 * @brief CTRL_REG1 REGISTER 00246 */ 00247 /* PD <7> 00248 * NOTE: Power-down control. 00249 */ 00250 typedef enum { 00251 CTRL_REG1_PD_MASK = ( 1U << 7U ), /*!< PD mask */ 00252 CTRL_REG1_PD_POWER_DOWN_MODE = ( 0U << 7U ), /*!< PD power-down mode [ Default ] */ 00253 CTRL_REG1_PD_ACTIVE_MODE = ( 1U << 7U ) /*!< PD active mode */ 00254 } HTS221_ctrl_reg1_pd_t; 00255 00256 00257 /* BDU <2> 00258 * NOTE: Block data update. 00259 */ 00260 typedef enum { 00261 CTRL_REG1_BDU_MASK = ( 1U << 2U ), /*!< BDU mask */ 00262 CTRL_REG1_BDU_CONTINUOUS_UPDATE = ( 0U << 2U ), /*!< Continuous update */ 00263 CTRL_REG1_BDU_DEFAULT_MODE = ( 1U << 2U ) /*!< Output registers not updated until MSB and LSB reading [ Default ] */ 00264 } HTS221_ctrl_reg1_bdu_t ; 00265 00266 00267 /* ODR <1:0> 00268 * NOTE: Output data rate selection. 00269 */ 00270 typedef enum { 00271 CTRL_REG1_ODR_MASK = ( 0b11 << 0U ), /*!< ODR mask */ 00272 CTRL_REG1_ODR_ONE_SHOT = ( 0b00 << 0U ), /*!< One-shot */ 00273 CTRL_REG1_ODR_1_HZ = ( 0b01 << 0U ), /*!< 1 Hz */ 00274 CTRL_REG1_ODR_7_HZ = ( 0b10 << 0U ), /*!< 7 Hz */ 00275 CTRL_REG1_ODR_12_5_HZ = ( 0b11 << 0U ) /*!< 12.5 Hz */ 00276 } HTS221_ctrl_reg1_odr_t ; 00277 00278 00279 00280 /** 00281 * @brief CTRL_REG2 REGISTER 00282 */ 00283 /* BOOT <7> 00284 * NOTE: Reboot memory content. 00285 */ 00286 typedef enum { 00287 CTRL_REG2_BOOT_MASK = ( 1U << 7U ), /*!< BOOT mask */ 00288 CTRL_REG2_BOOT_NORMAL_MODE = ( 0U << 7U ), /*!< normal mode [ Default ] */ 00289 CTRL_REG2_BOOT_REBOOT_MEMORY_CONTENT = ( 1U << 7U ) /*!< reboot memory content */ 00290 } HTS221_ctrl_reg2_boot_t; 00291 00292 00293 /* Heater <1> 00294 * NOTE: Controling an internal heating element. 00295 */ 00296 typedef enum { 00297 CTRL_REG2_HEATER_MASK = ( 1U << 1U ), /*!< Heater mask */ 00298 CTRL_REG2_HEATER_HEATER_DISABLED = ( 0U << 1U ), /*!< Heater disabled [ Default ] */ 00299 CTRL_REG2_HEATER_HEATER_ENABLED = ( 1U << 1U ) /*!< Heater enabled */ 00300 } HTS221_ctrl_reg2_heater_t ; 00301 00302 00303 /* ONE_SHOT <0> 00304 * NOTE: One-shot enable. 00305 */ 00306 typedef enum { 00307 CTRL_REG2_ONE_SHOT_MASK = ( 1U << 0U ), /*!< ONE_SHOT mask */ 00308 CTRL_REG2_ONE_SHOT_WAITING = ( 0U << 0U ), /*!< waiting for start of conversion [ Default ] */ 00309 CTRL_REG2_ONE_SHOT_START = ( 1U << 0U ) /*!< start for a new dataset */ 00310 } HTS221_ctrl_reg2_one_shot_t ; 00311 00312 00313 00314 /** 00315 * @brief CTRL_REG3 REGISTER 00316 */ 00317 /* DRDY_H_L <7> 00318 * NOTE: Data Ready output signal active high, low. 00319 */ 00320 typedef enum { 00321 CTRL_REG3_DRDY_H_L_MASK = ( 1U << 7U ), /*!< DRDY_H_L mask */ 00322 CTRL_REG3_DRDY_H_L_ACTIVE_HIGH = ( 0U << 7U ), /*!< active high [ Default ] */ 00323 CTRL_REG3_DRDY_H_L_ACTIVE_LOW = ( 1U << 7U ) /*!< active low */ 00324 } HTS221_ctrl_reg3_drdy_h_l_t; 00325 00326 00327 /* PP_OD <6> 00328 * NOTE: Push-pull / Open Drain selection on pin 3 (DRDY). 00329 */ 00330 typedef enum { 00331 CTRL_REG3_PP_OD_MASK = ( 1U << 6U ), /*!< PP_OD mask */ 00332 CTRL_REG3_PP_OD_PUSH_PULL = ( 0U << 6U ), /*!< push-pull [ Default ] */ 00333 CTRL_REG3_PP_OD_OPEN_DRAIN = ( 1U << 6U ) /*!< open drain */ 00334 } HTS221_ctrl_reg3_pp_od_t ; 00335 00336 00337 /* DRDY_EN <2> 00338 * NOTE: Data Ready enable. 00339 */ 00340 typedef enum { 00341 CTRL_REG3_DRDY_EN_MASK = ( 1U << 2U ), /*!< DRDY_EN mask */ 00342 CTRL_REG3_DRDY_DATA_READY_DISABLED = ( 0U << 2U ), /*!< Data Ready disabled [ Default ] */ 00343 CTRL_REG3_DRDY_DATA_READY_ENABLED = ( 1U << 2U ) /*!< Data Ready signal available on pin 3 */ 00344 } HTS221_ctrl_reg3_drdy_en_t ; 00345 00346 00347 00348 /** 00349 * @brief STATUS_REG REGISTER 00350 * 00351 * NOTE: H_DA is set to 1 whenever a new humidity sample is available. H_DA is cleared anytime 00352 * HUMIDITY_OUT_H (29h) register is read. T_DA is set to 1 whenever a new temperature sample is available. T_DA is cleared anytime TEMP_OUT_H (2Bh) register is read. 00353 */ 00354 /* H_DA <1> 00355 * NOTE: Humidity data available. 00356 */ 00357 typedef enum { 00358 STATUS_REGISTER_H_DA_MASK = ( 1U << 1U ), /*!< H_DA mask */ 00359 STATUS_REGISTER_H_DA_DATA_NOT_AVAILABLE = ( 0U << 1U ), /*!< new data for humidity is not yet available */ 00360 STATUS_REGISTER_H_DA_DATA_AVAILABLE = ( 1U << 1U ) /*!< new data for humidity is available */ 00361 } HTS221_status_reg_h_da_t; 00362 00363 00364 /* T_DA <0> 00365 * NOTE: Temperature data available. 00366 */ 00367 typedef enum { 00368 STATUS_REGISTER_T_DA_MASK = ( 1U << 0U ), /*!< T_DA mask */ 00369 STATUS_REGISTER_T_DA_DATA_NOT_AVAILABLE = ( 0U << 0U ), /*!< new data for temperature is not yet available */ 00370 STATUS_REGISTER_T_DA_DATA_AVAILABLE = ( 1U << 0U ) /*!< new data for temperature is available */ 00371 } HTS221_status_reg_t_da_t ; 00372 00373 00374 00375 /** 00376 * @brief HUMIDITY_OUT_L REGISTER 00377 * 00378 * NOTE: Relative humidity data (LSB) 00379 . * 00380 */ 00381 typedef enum { 00382 HUMIDITY_OUT_L_MASK = 0xFF /*!< Humidity data LSB mask */ 00383 } HTS221_humidity_out_l_t; 00384 00385 00386 00387 /** 00388 * @brief HUMIDITY_OUT_H REGISTER 00389 * 00390 * NOTE: Relative humidity data (LSB) 00391 . * 00392 */ 00393 typedef enum { 00394 HUMIDITY_OUT_H_MASK = 0xFF /*!< Humidity data MSB mask */ 00395 } HTS221_humidity_out_h_t; 00396 00397 00398 00399 /** 00400 * @brief TEMP_OUT_L REGISTER 00401 * 00402 * NOTE: Temperature data (LSB) 00403 . * 00404 */ 00405 typedef enum { 00406 TEMP_OUT_L_MASK = 0xFF /*!< Temperature data LSB mask */ 00407 } HTS221_temp_out_l_t; 00408 00409 00410 00411 /** 00412 * @brief TEMP_OUT_H REGISTER 00413 * 00414 * NOTE: Temperature data (MSB) 00415 . * 00416 */ 00417 typedef enum { 00418 TEMP_OUT_H_MASK = 0xFF /*!< Temperature data MSB mask */ 00419 } HTS221_temp_out_h_t; 00420 00421 00422 00423 00424 00425 #ifndef HTS221_VECTOR_STRUCT_H 00426 #define HTS221_VECTOR_STRUCT_H 00427 typedef struct { 00428 /* Output registers */ 00429 int16_t rawHumidity; /*!< Raw humidity */ 00430 int16_t rawTemperature; /*!< Raw temperature */ 00431 00432 float humidity; /*!< Humidity value */ 00433 float temperature; /*!< Temperature value */ 00434 00435 /* Calibration registers */ 00436 uint8_t h0_rH_x2; /*!< Calibration register */ 00437 uint8_t h1_rH_x2; /*!< Calibration register */ 00438 uint8_t t0_degC_x8; /*!< Calibration register */ 00439 uint8_t t1_degC_x8; /*!< Calibration register */ 00440 uint8_t t1_T0_msb; /*!< Calibration register */ 00441 int16_t h0_T0_OUT; /*!< Calibration register */ 00442 int16_t h1_T0_OUT; /*!< Calibration register */ 00443 int16_t t0_OUT; /*!< Calibration register */ 00444 int16_t t1_OUT; /*!< Calibration register */ 00445 00446 int16_t t0_degC; /*!< Calibration result */ 00447 int16_t t1_degC; /*!< Calibration result */ 00448 int16_t h0_RH; /*!< Calibration result */ 00449 int16_t h1_RH; /*!< Calibration result */ 00450 00451 /* Device identification */ 00452 uint8_t deviceID; /*!< Device ID */ 00453 00454 /* Device configuration */ 00455 HTS221_av_config_avgt_t temperatureResolution; /*!< Temperature resolution */ 00456 HTS221_av_config_avgh_t humidityResolution; /*!< Humidity resolution */ 00457 00458 HTS221_ctrl_reg1_bdu_t bdu; /*!< Block data update */ 00459 HTS221_ctrl_reg1_odr_t odr; /*!< Output data rate */ 00460 HTS221_ctrl_reg2_boot_t boot; /*!< Reboot mode content */ 00461 HTS221_ctrl_reg2_heater_t heater; /*!< Heater */ 00462 HTS221_ctrl_reg2_one_shot_t one_shot; /*!< One-Shot */ 00463 00464 /* Device status */ 00465 HTS221_status_reg_h_da_t h_da; /*!< Humidity data available */ 00466 HTS221_status_reg_t_da_t t_da; /*!< Temperature data available */ 00467 } HTS221_data_t; 00468 #endif 00469 00470 00471 /** 00472 * @brief INTERNAL CONSTANTS 00473 */ 00474 typedef enum { 00475 HTS221_SUCCESS = 0U, 00476 HTS221_FAILURE = 1U, 00477 I2C_SUCCESS = 0U /*!< I2C communication was fine */ 00478 } HTS221_status_t; 00479 00480 00481 00482 00483 /** Create an HTS221 object connected to the specified I2C pins. 00484 * 00485 * @param sda I2C data pin 00486 * @param scl I2C clock pin 00487 * @param addr I2C slave address 00488 * @param freq I2C frequency 00489 */ 00490 HTS221 ( PinName sda, PinName scl, uint32_t addr, uint32_t freq ); 00491 00492 /** Delete HTS221 object. 00493 */ 00494 ~HTS221(); 00495 00496 /** It gets the device identification. 00497 */ 00498 HTS221_status_t HTS221_GetDeviceID ( HTS221_data_t* myDeviceID ); 00499 00500 /** It sets humidity and temperature resolution mode. 00501 */ 00502 HTS221_status_t HTS221_SetResolution ( HTS221_data_t myTempHumResolution ); 00503 00504 /** It gets humidity and temperature resolution mode. 00505 */ 00506 HTS221_status_t HTS221_GetResolution ( HTS221_data_t* myTempHumResolution ); 00507 00508 /** It sets power-down control mode. 00509 */ 00510 HTS221_status_t HTS221_SetPowerDown ( HTS221_ctrl_reg1_pd_t myPowerMode ); 00511 00512 /** It sets the block data update. 00513 */ 00514 HTS221_status_t HTS221_SetBlockDataUpdate ( HTS221_data_t myBDU ); 00515 00516 /** It gets the block data update. 00517 */ 00518 HTS221_status_t HTS221_GetBlockDataUpdate ( HTS221_data_t* myBDU ); 00519 00520 /** It sets the output data rate ( ODR ). 00521 */ 00522 HTS221_status_t HTS221_SetOutputDataRate ( HTS221_data_t myODR ); 00523 00524 /** It gets the output data rate ( ODR ). 00525 */ 00526 HTS221_status_t HTS221_GetOutputDataRate ( HTS221_data_t* myODR ); 00527 00528 /** It sets reboot memory content. 00529 */ 00530 HTS221_status_t HTS221_SetBoot ( void ); 00531 00532 /** It gets reboot memory content. 00533 */ 00534 HTS221_status_t HTS221_GetBoot ( HTS221_data_t* myBOOT ); 00535 00536 /** It sets heater mode: Enabled/Disabled. 00537 */ 00538 HTS221_status_t HTS221_SetHeater ( HTS221_data_t myHeater ); 00539 00540 /** It gets heater mode. 00541 */ 00542 HTS221_status_t HTS221_GetHeater ( HTS221_data_t* myHeater ); 00543 00544 /** It sets one-shot, new data set. 00545 */ 00546 HTS221_status_t HTS221_SetOneShot ( void ); 00547 00548 /** It gets one-shot flag. 00549 */ 00550 HTS221_status_t HTS221_GetOneShot ( HTS221_data_t* myOneShot ); 00551 00552 /** It sets data ready output signal active high/low. 00553 */ 00554 HTS221_status_t HTS221_SetDataReadyOuput ( HTS221_ctrl_reg3_drdy_h_l_t myDRDY_H_L ); 00555 00556 /** It sets Push-pull/Open Drain selection on pin 3 ( DRDY ). 00557 */ 00558 HTS221_status_t HTS221_SetSelectionOnPin3 ( HTS221_ctrl_reg3_pp_od_t myDRDY ); 00559 00560 /** It sets data ready enable. 00561 */ 00562 HTS221_status_t HTS221_SetDataReadyEnable ( HTS221_ctrl_reg3_drdy_en_t myDRDY_EN ); 00563 00564 /** It gets humidity data available flag. 00565 */ 00566 HTS221_status_t HTS221_GetHumidityDataAvailable ( HTS221_data_t* myHumidityFlag ); 00567 00568 /** It gets temperature data available flag. 00569 */ 00570 HTS221_status_t HTS221_GetTemperatureDataAvailable ( HTS221_data_t* myTemperatureFlag ); 00571 00572 /** It gets raw humidity. 00573 */ 00574 HTS221_status_t HTS221_GetRawHumidity ( HTS221_data_t* myRawHumidity ); 00575 00576 /** It gets raw temperature. 00577 */ 00578 HTS221_status_t HTS221_GetRawTemperature ( HTS221_data_t* myRawTemperature ); 00579 00580 /** It gets calibration coefficients. 00581 */ 00582 HTS221_status_t HTS221_GetCalibrationCoefficients ( HTS221_data_t* myCoeff ); 00583 00584 /** It gets the current temperature value in Celsius degrees. 00585 */ 00586 HTS221_status_t HTS221_GetTemperature ( HTS221_data_t* myTemperature ); 00587 00588 /** It gets the current humidity value. 00589 */ 00590 HTS221_status_t HTS221_GetHumidity ( HTS221_data_t* myHumidity ); 00591 00592 00593 00594 private: 00595 I2C _i2c; 00596 uint32_t _HTS221_Addr; 00597 }; 00598 00599 #endif
Generated on Sun Jul 17 2022 08:46:37 by
