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.
AHT20.cpp@2:ec96fb27c02d, 2022-02-08 (annotated)
- Committer:
- mcm
- Date:
- Tue Feb 08 19:39:29 2022 +0000
- Revision:
- 2:ec96fb27c02d
- Parent:
- 1:9593a4080e4c
The driver was completed and tested (NUCLEO-F103RB), it works as expected.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
mcm | 1:9593a4080e4c | 1 | /** |
mcm | 1:9593a4080e4c | 2 | * @brief AHT20.cpp |
mcm | 1:9593a4080e4c | 3 | * @details Humidity and Temperature Sensor. |
mcm | 1:9593a4080e4c | 4 | * Function file. |
mcm | 1:9593a4080e4c | 5 | * |
mcm | 1:9593a4080e4c | 6 | * |
mcm | 1:9593a4080e4c | 7 | * @return N/A |
mcm | 1:9593a4080e4c | 8 | * |
mcm | 1:9593a4080e4c | 9 | * @author Manuel Caballero |
mcm | 1:9593a4080e4c | 10 | * @date 08/February/2022 |
mcm | 1:9593a4080e4c | 11 | * @version 08/February/2022 The ORIGIN |
mcm | 1:9593a4080e4c | 12 | * @pre N/A. |
mcm | 1:9593a4080e4c | 13 | * @warning N/A |
mcm | 1:9593a4080e4c | 14 | * @pre This code belongs to AqueronteBlog ( http://unbarquero.blogspot.com ). |
mcm | 1:9593a4080e4c | 15 | */ |
mcm | 1:9593a4080e4c | 16 | |
mcm | 1:9593a4080e4c | 17 | #include "AHT20.h" |
mcm | 1:9593a4080e4c | 18 | |
mcm | 1:9593a4080e4c | 19 | |
mcm | 1:9593a4080e4c | 20 | AHT20::AHT20 ( PinName sda, PinName scl, uint32_t addr, uint32_t freq ) |
mcm | 1:9593a4080e4c | 21 | : _i2c ( sda, scl ) |
mcm | 1:9593a4080e4c | 22 | , _AHT20_Addr ( addr ) |
mcm | 1:9593a4080e4c | 23 | { |
mcm | 1:9593a4080e4c | 24 | _i2c.frequency( freq ); |
mcm | 1:9593a4080e4c | 25 | } |
mcm | 1:9593a4080e4c | 26 | |
mcm | 1:9593a4080e4c | 27 | |
mcm | 1:9593a4080e4c | 28 | AHT20::~AHT20() |
mcm | 1:9593a4080e4c | 29 | { |
mcm | 1:9593a4080e4c | 30 | } |
mcm | 1:9593a4080e4c | 31 | |
mcm | 1:9593a4080e4c | 32 | |
mcm | 1:9593a4080e4c | 33 | |
mcm | 1:9593a4080e4c | 34 | /** |
mcm | 1:9593a4080e4c | 35 | * @brief AHT20_Calibrate ( void ) |
mcm | 1:9593a4080e4c | 36 | * @details It calibrates the device. |
mcm | 1:9593a4080e4c | 37 | * |
mcm | 1:9593a4080e4c | 38 | * @param[in] N/A. |
mcm | 1:9593a4080e4c | 39 | * |
mcm | 1:9593a4080e4c | 40 | * @param[out] N/A. |
mcm | 1:9593a4080e4c | 41 | * |
mcm | 1:9593a4080e4c | 42 | * |
mcm | 1:9593a4080e4c | 43 | * @return Status of AHT20_Calibrate |
mcm | 1:9593a4080e4c | 44 | * |
mcm | 1:9593a4080e4c | 45 | * @author Manuel Caballero |
mcm | 1:9593a4080e4c | 46 | * @date 08/February/2022 |
mcm | 1:9593a4080e4c | 47 | * @version 08/February/2022 The ORIGIN |
mcm | 1:9593a4080e4c | 48 | * @pre N/A |
mcm | 1:9593a4080e4c | 49 | * @warning N/A. |
mcm | 1:9593a4080e4c | 50 | */ |
mcm | 1:9593a4080e4c | 51 | AHT20::AHT20_status_t AHT20::AHT20_Calibrate ( void ) |
mcm | 1:9593a4080e4c | 52 | { |
mcm | 2:ec96fb27c02d | 53 | char cmd[3] = { 0 }; |
mcm | 1:9593a4080e4c | 54 | uint32_t aux; |
mcm | 1:9593a4080e4c | 55 | |
mcm | 1:9593a4080e4c | 56 | |
mcm | 1:9593a4080e4c | 57 | /* Update the register */ |
mcm | 1:9593a4080e4c | 58 | cmd[0] = AHT20_INITIALIZATION; |
mcm | 1:9593a4080e4c | 59 | cmd[1] = INITIALIZATION_DATA_1; |
mcm | 1:9593a4080e4c | 60 | cmd[2] = INITIALIZATION_DATA_2; |
mcm | 2:ec96fb27c02d | 61 | aux = _i2c.write ( _AHT20_Addr, &cmd[0], sizeof( cmd )/sizeof( cmd[0] ), false ); |
mcm | 1:9593a4080e4c | 62 | |
mcm | 1:9593a4080e4c | 63 | |
mcm | 1:9593a4080e4c | 64 | |
mcm | 1:9593a4080e4c | 65 | |
mcm | 1:9593a4080e4c | 66 | if ( aux == I2C_SUCCESS ) |
mcm | 1:9593a4080e4c | 67 | { |
mcm | 1:9593a4080e4c | 68 | return AHT20_SUCCESS; |
mcm | 1:9593a4080e4c | 69 | } |
mcm | 1:9593a4080e4c | 70 | else |
mcm | 1:9593a4080e4c | 71 | { |
mcm | 1:9593a4080e4c | 72 | return AHT20_FAILURE; |
mcm | 1:9593a4080e4c | 73 | } |
mcm | 1:9593a4080e4c | 74 | } |
mcm | 1:9593a4080e4c | 75 | |
mcm | 1:9593a4080e4c | 76 | |
mcm | 1:9593a4080e4c | 77 | |
mcm | 1:9593a4080e4c | 78 | /** |
mcm | 1:9593a4080e4c | 79 | * @brief AHT20_SoftReset ( void ) |
mcm | 1:9593a4080e4c | 80 | * @details It performs a soft-reset. |
mcm | 1:9593a4080e4c | 81 | * |
mcm | 1:9593a4080e4c | 82 | * @param[in] N/A. |
mcm | 1:9593a4080e4c | 83 | * |
mcm | 1:9593a4080e4c | 84 | * @param[out] N/A. |
mcm | 1:9593a4080e4c | 85 | * |
mcm | 1:9593a4080e4c | 86 | * |
mcm | 1:9593a4080e4c | 87 | * @return Status of AHT20_SoftReset |
mcm | 1:9593a4080e4c | 88 | * |
mcm | 1:9593a4080e4c | 89 | * @author Manuel Caballero |
mcm | 1:9593a4080e4c | 90 | * @date 08/February/2022 |
mcm | 1:9593a4080e4c | 91 | * @version 08/February/2022 The ORIGIN |
mcm | 1:9593a4080e4c | 92 | * @pre The user must consider that the time required for soft-reset does not exceed 20 ms. |
mcm | 1:9593a4080e4c | 93 | * @warning N/A. |
mcm | 1:9593a4080e4c | 94 | */ |
mcm | 1:9593a4080e4c | 95 | AHT20::AHT20_status_t AHT20::AHT20_SoftReset ( void ) |
mcm | 1:9593a4080e4c | 96 | { |
mcm | 1:9593a4080e4c | 97 | char cmd = 0U; |
mcm | 1:9593a4080e4c | 98 | uint32_t aux; |
mcm | 1:9593a4080e4c | 99 | |
mcm | 1:9593a4080e4c | 100 | |
mcm | 1:9593a4080e4c | 101 | /* Update the register */ |
mcm | 1:9593a4080e4c | 102 | cmd = AHT20_SOFTRESET; |
mcm | 2:ec96fb27c02d | 103 | aux = _i2c.write ( _AHT20_Addr, (char*)&cmd, 1U, false ); |
mcm | 1:9593a4080e4c | 104 | |
mcm | 1:9593a4080e4c | 105 | |
mcm | 1:9593a4080e4c | 106 | |
mcm | 1:9593a4080e4c | 107 | |
mcm | 1:9593a4080e4c | 108 | if ( aux == I2C_SUCCESS ) |
mcm | 1:9593a4080e4c | 109 | { |
mcm | 1:9593a4080e4c | 110 | return AHT20_SUCCESS; |
mcm | 1:9593a4080e4c | 111 | } |
mcm | 1:9593a4080e4c | 112 | else |
mcm | 1:9593a4080e4c | 113 | { |
mcm | 1:9593a4080e4c | 114 | return AHT20_FAILURE; |
mcm | 1:9593a4080e4c | 115 | } |
mcm | 1:9593a4080e4c | 116 | } |
mcm | 1:9593a4080e4c | 117 | |
mcm | 1:9593a4080e4c | 118 | |
mcm | 1:9593a4080e4c | 119 | |
mcm | 1:9593a4080e4c | 120 | /** |
mcm | 1:9593a4080e4c | 121 | * @brief AHT20_TriggerMeasurement ( void ) |
mcm | 1:9593a4080e4c | 122 | * @details It triggers a new measurement data (raw data). |
mcm | 1:9593a4080e4c | 123 | * |
mcm | 1:9593a4080e4c | 124 | * @param[in] N/A. |
mcm | 1:9593a4080e4c | 125 | * |
mcm | 1:9593a4080e4c | 126 | * @param[out] N/A. |
mcm | 1:9593a4080e4c | 127 | * |
mcm | 1:9593a4080e4c | 128 | * |
mcm | 1:9593a4080e4c | 129 | * @return Status of AHT20_TriggerMeasurement |
mcm | 1:9593a4080e4c | 130 | * |
mcm | 1:9593a4080e4c | 131 | * @author Manuel Caballero |
mcm | 1:9593a4080e4c | 132 | * @date 08/February/2022 |
mcm | 1:9593a4080e4c | 133 | * @version 08/February/2022 The ORIGIN |
mcm | 1:9593a4080e4c | 134 | * @pre The user must consider to wait for 80ms for the measurement to be completed. |
mcm | 1:9593a4080e4c | 135 | * @warning N/A. |
mcm | 1:9593a4080e4c | 136 | */ |
mcm | 1:9593a4080e4c | 137 | AHT20::AHT20_status_t AHT20::AHT20_TriggerMeasurement ( void ) |
mcm | 1:9593a4080e4c | 138 | { |
mcm | 2:ec96fb27c02d | 139 | char cmd[3] = {0U}; |
mcm | 1:9593a4080e4c | 140 | uint32_t aux; |
mcm | 1:9593a4080e4c | 141 | |
mcm | 1:9593a4080e4c | 142 | |
mcm | 1:9593a4080e4c | 143 | /* Update the register */ |
mcm | 1:9593a4080e4c | 144 | cmd[0] = AHT20_TRIGGER_MEASUREMENT; |
mcm | 1:9593a4080e4c | 145 | cmd[1] = TRIGGER_MEASUREMENT_DATA_1; |
mcm | 1:9593a4080e4c | 146 | cmd[2] = TRIGGER_MEASUREMENT_DATA_2; |
mcm | 2:ec96fb27c02d | 147 | aux = _i2c.write ( _AHT20_Addr, &cmd[0], sizeof( cmd )/sizeof( cmd[0] ), false ); |
mcm | 1:9593a4080e4c | 148 | |
mcm | 1:9593a4080e4c | 149 | |
mcm | 1:9593a4080e4c | 150 | |
mcm | 1:9593a4080e4c | 151 | if ( aux == I2C_SUCCESS ) |
mcm | 1:9593a4080e4c | 152 | { |
mcm | 1:9593a4080e4c | 153 | return AHT20_SUCCESS; |
mcm | 1:9593a4080e4c | 154 | } |
mcm | 1:9593a4080e4c | 155 | else |
mcm | 1:9593a4080e4c | 156 | { |
mcm | 1:9593a4080e4c | 157 | return AHT20_FAILURE; |
mcm | 1:9593a4080e4c | 158 | } |
mcm | 1:9593a4080e4c | 159 | } |
mcm | 1:9593a4080e4c | 160 | |
mcm | 1:9593a4080e4c | 161 | |
mcm | 1:9593a4080e4c | 162 | |
mcm | 1:9593a4080e4c | 163 | /** |
mcm | 1:9593a4080e4c | 164 | * @brief AHT20_TriggerStatus ( void ) |
mcm | 1:9593a4080e4c | 165 | * @details It triggers the state byte. |
mcm | 1:9593a4080e4c | 166 | * |
mcm | 1:9593a4080e4c | 167 | * @param[in] N/A. |
mcm | 1:9593a4080e4c | 168 | * |
mcm | 1:9593a4080e4c | 169 | * @param[out] N/A. |
mcm | 1:9593a4080e4c | 170 | * |
mcm | 1:9593a4080e4c | 171 | * |
mcm | 1:9593a4080e4c | 172 | * @return Status of AHT20_TriggerStatus |
mcm | 1:9593a4080e4c | 173 | * |
mcm | 1:9593a4080e4c | 174 | * @author Manuel Caballero |
mcm | 1:9593a4080e4c | 175 | * @date 08/February/2022 |
mcm | 1:9593a4080e4c | 176 | * @version 08/February/2022 The ORIGIN |
mcm | 1:9593a4080e4c | 177 | * @pre N/A. |
mcm | 1:9593a4080e4c | 178 | * @warning N/A. |
mcm | 1:9593a4080e4c | 179 | */ |
mcm | 1:9593a4080e4c | 180 | AHT20::AHT20_status_t AHT20::AHT20_TriggerStatus ( void ) |
mcm | 1:9593a4080e4c | 181 | { |
mcm | 1:9593a4080e4c | 182 | char cmd = 0U; |
mcm | 1:9593a4080e4c | 183 | uint32_t aux; |
mcm | 1:9593a4080e4c | 184 | |
mcm | 1:9593a4080e4c | 185 | /* Update the register */ |
mcm | 1:9593a4080e4c | 186 | cmd = AHT20_STATUS; |
mcm | 2:ec96fb27c02d | 187 | aux = _i2c.write ( _AHT20_Addr, (char*)&cmd, 1U, false ); |
mcm | 1:9593a4080e4c | 188 | |
mcm | 1:9593a4080e4c | 189 | |
mcm | 1:9593a4080e4c | 190 | |
mcm | 1:9593a4080e4c | 191 | if ( aux == I2C_SUCCESS ) |
mcm | 1:9593a4080e4c | 192 | { |
mcm | 1:9593a4080e4c | 193 | return AHT20_SUCCESS; |
mcm | 1:9593a4080e4c | 194 | } |
mcm | 1:9593a4080e4c | 195 | else |
mcm | 1:9593a4080e4c | 196 | { |
mcm | 1:9593a4080e4c | 197 | return AHT20_FAILURE; |
mcm | 1:9593a4080e4c | 198 | } |
mcm | 1:9593a4080e4c | 199 | } |
mcm | 1:9593a4080e4c | 200 | |
mcm | 1:9593a4080e4c | 201 | |
mcm | 1:9593a4080e4c | 202 | |
mcm | 1:9593a4080e4c | 203 | /** |
mcm | 1:9593a4080e4c | 204 | * @brief AHT20_GetStatus ( uint8_t* ) |
mcm | 1:9593a4080e4c | 205 | * @details It gets the state byte. |
mcm | 1:9593a4080e4c | 206 | * |
mcm | 1:9593a4080e4c | 207 | * @param[in] N/A. |
mcm | 1:9593a4080e4c | 208 | * |
mcm | 1:9593a4080e4c | 209 | * @param[out] myState: State byte. |
mcm | 1:9593a4080e4c | 210 | * |
mcm | 1:9593a4080e4c | 211 | * |
mcm | 1:9593a4080e4c | 212 | * @return Status of AHT20_GetStatus |
mcm | 1:9593a4080e4c | 213 | * |
mcm | 1:9593a4080e4c | 214 | * @author Manuel Caballero |
mcm | 1:9593a4080e4c | 215 | * @date 08/February/2022 |
mcm | 1:9593a4080e4c | 216 | * @version 08/February/2022 The ORIGIN |
mcm | 1:9593a4080e4c | 217 | * @pre N/A. |
mcm | 1:9593a4080e4c | 218 | * @warning N/A. |
mcm | 1:9593a4080e4c | 219 | */ |
mcm | 1:9593a4080e4c | 220 | AHT20::AHT20_status_t AHT20::AHT20_GetStatus ( uint8_t* myState ) |
mcm | 1:9593a4080e4c | 221 | { |
mcm | 1:9593a4080e4c | 222 | uint32_t aux; |
mcm | 1:9593a4080e4c | 223 | |
mcm | 1:9593a4080e4c | 224 | /* Read the register */ |
mcm | 2:ec96fb27c02d | 225 | aux = _i2c.read ( _AHT20_Addr, (char*)&myState, 1U ); |
mcm | 1:9593a4080e4c | 226 | |
mcm | 1:9593a4080e4c | 227 | |
mcm | 1:9593a4080e4c | 228 | if ( aux == I2C_SUCCESS ) |
mcm | 1:9593a4080e4c | 229 | { |
mcm | 1:9593a4080e4c | 230 | return AHT20_SUCCESS; |
mcm | 1:9593a4080e4c | 231 | } |
mcm | 1:9593a4080e4c | 232 | else |
mcm | 1:9593a4080e4c | 233 | { |
mcm | 1:9593a4080e4c | 234 | return AHT20_FAILURE; |
mcm | 1:9593a4080e4c | 235 | } |
mcm | 1:9593a4080e4c | 236 | } |
mcm | 1:9593a4080e4c | 237 | |
mcm | 1:9593a4080e4c | 238 | |
mcm | 1:9593a4080e4c | 239 | |
mcm | 1:9593a4080e4c | 240 | /** |
mcm | 1:9593a4080e4c | 241 | * @brief AHT20_GetAllData ( AHT20_user_data_t* ) |
mcm | 1:9593a4080e4c | 242 | * @details It gets all the raw data. |
mcm | 1:9593a4080e4c | 243 | * |
mcm | 1:9593a4080e4c | 244 | * @param[in] N/A. |
mcm | 1:9593a4080e4c | 245 | * |
mcm | 1:9593a4080e4c | 246 | * @param[out] myAllData: All the data. |
mcm | 1:9593a4080e4c | 247 | * |
mcm | 1:9593a4080e4c | 248 | * |
mcm | 1:9593a4080e4c | 249 | * @return Status of AHT20_GetAllData |
mcm | 1:9593a4080e4c | 250 | * |
mcm | 1:9593a4080e4c | 251 | * @author Manuel Caballero |
mcm | 1:9593a4080e4c | 252 | * @date 08/February/2022 The ORIGIN |
mcm | 1:9593a4080e4c | 253 | * @pre AHT20_TriggerMeasurement function must be called before using AHT20_GetAllData function. |
mcm | 1:9593a4080e4c | 254 | * @pre The user must consider to wait for 80ms for the measurement to be completed. |
mcm | 1:9593a4080e4c | 255 | * @warning N/A. |
mcm | 1:9593a4080e4c | 256 | */ |
mcm | 1:9593a4080e4c | 257 | AHT20::AHT20_status_t AHT20::AHT20_GetAllData ( AHT20_user_data_t* myAllData ) |
mcm | 1:9593a4080e4c | 258 | { |
mcm | 1:9593a4080e4c | 259 | char cmd[7] = {0U}; |
mcm | 1:9593a4080e4c | 260 | uint32_t aux; |
mcm | 1:9593a4080e4c | 261 | |
mcm | 1:9593a4080e4c | 262 | |
mcm | 1:9593a4080e4c | 263 | /* Read the register */ |
mcm | 2:ec96fb27c02d | 264 | aux = _i2c.read ( _AHT20_Addr, &cmd[0], sizeof( cmd )/sizeof( cmd[0] ) ); |
mcm | 1:9593a4080e4c | 265 | |
mcm | 1:9593a4080e4c | 266 | /* Parse the data */ |
mcm | 1:9593a4080e4c | 267 | myAllData->state = cmd[0]; |
mcm | 1:9593a4080e4c | 268 | |
mcm | 1:9593a4080e4c | 269 | myAllData->humidity.raw_humidity = cmd[1]; |
mcm | 1:9593a4080e4c | 270 | myAllData->humidity.raw_humidity <<= 8U; |
mcm | 1:9593a4080e4c | 271 | myAllData->humidity.raw_humidity |= cmd[2]; |
mcm | 1:9593a4080e4c | 272 | myAllData->humidity.raw_humidity <<= 8U; |
mcm | 1:9593a4080e4c | 273 | myAllData->humidity.raw_humidity |= ( cmd[3] & 0b11110000 ); |
mcm | 1:9593a4080e4c | 274 | myAllData->humidity.raw_humidity >>= 4U; |
mcm | 1:9593a4080e4c | 275 | |
mcm | 1:9593a4080e4c | 276 | myAllData->temperature.raw_temperature = ( cmd[3] & 0b00001111 ); |
mcm | 1:9593a4080e4c | 277 | myAllData->temperature.raw_temperature <<= 8U; |
mcm | 1:9593a4080e4c | 278 | myAllData->temperature.raw_temperature |= cmd[4]; |
mcm | 1:9593a4080e4c | 279 | myAllData->temperature.raw_temperature <<= 8U; |
mcm | 1:9593a4080e4c | 280 | myAllData->temperature.raw_temperature |= cmd[5]; |
mcm | 1:9593a4080e4c | 281 | |
mcm | 1:9593a4080e4c | 282 | myAllData->crc = cmd[6]; |
mcm | 1:9593a4080e4c | 283 | |
mcm | 1:9593a4080e4c | 284 | |
mcm | 1:9593a4080e4c | 285 | |
mcm | 1:9593a4080e4c | 286 | if ( aux == I2C_SUCCESS ) |
mcm | 1:9593a4080e4c | 287 | { |
mcm | 1:9593a4080e4c | 288 | return AHT20_SUCCESS; |
mcm | 1:9593a4080e4c | 289 | } |
mcm | 1:9593a4080e4c | 290 | else |
mcm | 1:9593a4080e4c | 291 | { |
mcm | 1:9593a4080e4c | 292 | return AHT20_FAILURE; |
mcm | 1:9593a4080e4c | 293 | } |
mcm | 1:9593a4080e4c | 294 | } |
mcm | 1:9593a4080e4c | 295 | |
mcm | 1:9593a4080e4c | 296 | |
mcm | 1:9593a4080e4c | 297 | |
mcm | 1:9593a4080e4c | 298 | /** |
mcm | 1:9593a4080e4c | 299 | * @brief AHT20_ProcessTemperature ( uint32_t myRawTemperature ) |
mcm | 1:9593a4080e4c | 300 | * @details It processes the temperature data. |
mcm | 1:9593a4080e4c | 301 | * |
mcm | 1:9593a4080e4c | 302 | * @param[in] myRawTemperature: Raw temperature data. |
mcm | 1:9593a4080e4c | 303 | * |
mcm | 1:9593a4080e4c | 304 | * @param[out] N/A. |
mcm | 1:9593a4080e4c | 305 | * |
mcm | 1:9593a4080e4c | 306 | * |
mcm | 1:9593a4080e4c | 307 | * @return Temperature data is processed |
mcm | 1:9593a4080e4c | 308 | * |
mcm | 1:9593a4080e4c | 309 | * @author Manuel Caballero |
mcm | 1:9593a4080e4c | 310 | * @date 08/February/2022 |
mcm | 1:9593a4080e4c | 311 | * @version 08/February/2022 The ORIGIN |
mcm | 1:9593a4080e4c | 312 | * @pre N/A. |
mcm | 1:9593a4080e4c | 313 | * @warning N/A. |
mcm | 1:9593a4080e4c | 314 | */ |
mcm | 1:9593a4080e4c | 315 | float AHT20::AHT20_ProcessTemperature ( uint32_t myRawTemperature ) |
mcm | 1:9593a4080e4c | 316 | { |
mcm | 1:9593a4080e4c | 317 | /* Calculate the temperature */ |
mcm | 1:9593a4080e4c | 318 | return ( ( myRawTemperature * 200.0 )/1048576.0 - 50.0 ); |
mcm | 1:9593a4080e4c | 319 | } |
mcm | 1:9593a4080e4c | 320 | |
mcm | 1:9593a4080e4c | 321 | |
mcm | 1:9593a4080e4c | 322 | |
mcm | 1:9593a4080e4c | 323 | /** |
mcm | 1:9593a4080e4c | 324 | * @brief AHT20_ProcessHumidity ( uint32_t myRawHumidity ) |
mcm | 1:9593a4080e4c | 325 | * @details It processes the humidity data. |
mcm | 1:9593a4080e4c | 326 | * |
mcm | 1:9593a4080e4c | 327 | * @param[in] myRawHumidity: Raw humidity data. |
mcm | 1:9593a4080e4c | 328 | * |
mcm | 1:9593a4080e4c | 329 | * @param[out] N/A. |
mcm | 1:9593a4080e4c | 330 | * |
mcm | 1:9593a4080e4c | 331 | * |
mcm | 1:9593a4080e4c | 332 | * @return Humidity data is processed |
mcm | 1:9593a4080e4c | 333 | * |
mcm | 1:9593a4080e4c | 334 | * @author Manuel Caballero |
mcm | 1:9593a4080e4c | 335 | * @date 08/February/2022 |
mcm | 1:9593a4080e4c | 336 | * @version 08/February/2022 The ORIGIN |
mcm | 1:9593a4080e4c | 337 | * @pre N/A. |
mcm | 1:9593a4080e4c | 338 | * @warning N/A. |
mcm | 1:9593a4080e4c | 339 | */ |
mcm | 1:9593a4080e4c | 340 | float AHT20::AHT20_ProcessHumidity ( uint32_t myRawHumidity ) |
mcm | 1:9593a4080e4c | 341 | { |
mcm | 1:9593a4080e4c | 342 | /* Calculate the humidity */ |
mcm | 1:9593a4080e4c | 343 | return ( myRawHumidity * 100.0 )/1048576.0; |
mcm | 1:9593a4080e4c | 344 | } |