Digital Humidity Sensor
SHT3X.h@1:c3590e18b517, 2021-03-25 (annotated)
- Committer:
- mcm
- Date:
- Thu Mar 25 20:02:49 2021 +0000
- Revision:
- 1:c3590e18b517
- Parent:
- 0:5e2a8080b276
- Child:
- 2:870701ee67c4
Header file is completed and ready to test.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
mcm | 1:c3590e18b517 | 1 | /** |
mcm | 1:c3590e18b517 | 2 | * @brief SHT3X.h |
mcm | 1:c3590e18b517 | 3 | * @details Humidity and Temperature Sensor. |
mcm | 1:c3590e18b517 | 4 | * Header file. |
mcm | 1:c3590e18b517 | 5 | * |
mcm | 1:c3590e18b517 | 6 | * |
mcm | 1:c3590e18b517 | 7 | * @return N/A |
mcm | 1:c3590e18b517 | 8 | * |
mcm | 1:c3590e18b517 | 9 | * @author Manuel Caballero |
mcm | 1:c3590e18b517 | 10 | * @date 25/March/2021 |
mcm | 1:c3590e18b517 | 11 | * @version 25/March/2021 The ORIGIN |
mcm | 1:c3590e18b517 | 12 | * @pre N/A |
mcm | 1:c3590e18b517 | 13 | * @warning N/A |
mcm | 1:c3590e18b517 | 14 | * @pre This code belongs to Nimbus Centre ( http://www.nimbus.cit.ie ). |
mcm | 1:c3590e18b517 | 15 | */ |
mcm | 1:c3590e18b517 | 16 | #ifndef SHT3X_H_ |
mcm | 1:c3590e18b517 | 17 | #define SHT3X_H_ |
mcm | 1:c3590e18b517 | 18 | |
mcm | 1:c3590e18b517 | 19 | #include "mbed.h" |
mcm | 1:c3590e18b517 | 20 | |
mcm | 1:c3590e18b517 | 21 | |
mcm | 1:c3590e18b517 | 22 | /** |
mcm | 1:c3590e18b517 | 23 | Example: |
mcm | 1:c3590e18b517 | 24 | |
mcm | 1:c3590e18b517 | 25 | @code |
mcm | 1:c3590e18b517 | 26 | |
mcm | 1:c3590e18b517 | 27 | @endcode |
mcm | 1:c3590e18b517 | 28 | */ |
mcm | 1:c3590e18b517 | 29 | |
mcm | 1:c3590e18b517 | 30 | |
mcm | 1:c3590e18b517 | 31 | /*! |
mcm | 1:c3590e18b517 | 32 | Library for the SHT3X Humidity and Temperature Sensor. |
mcm | 1:c3590e18b517 | 33 | */ |
mcm | 1:c3590e18b517 | 34 | class SHT3X |
mcm | 1:c3590e18b517 | 35 | { |
mcm | 1:c3590e18b517 | 36 | public: |
mcm | 1:c3590e18b517 | 37 | /** |
mcm | 1:c3590e18b517 | 38 | * @brief DEFAULT ADDRESSES |
mcm | 1:c3590e18b517 | 39 | */ |
mcm | 1:c3590e18b517 | 40 | typedef enum { |
mcm | 1:c3590e18b517 | 41 | SHT3X_ADDRESS_A = ( 0x44 << 1U ), /*!< SHT3X ADDR pin connected to logic low */ |
mcm | 1:c3590e18b517 | 42 | SHT3X_ADDRESS_B = ( 0x45 << 1U ) /*!< SHT3X ADDR pin connected to logic high */ |
mcm | 1:c3590e18b517 | 43 | } SHT3X_address_t; |
mcm | 1:c3590e18b517 | 44 | |
mcm | 1:c3590e18b517 | 45 | |
mcm | 1:c3590e18b517 | 46 | |
mcm | 1:c3590e18b517 | 47 | /** |
mcm | 1:c3590e18b517 | 48 | * @brief COMMAND REGISTERS |
mcm | 1:c3590e18b517 | 49 | */ |
mcm | 1:c3590e18b517 | 50 | typedef enum { |
mcm | 1:c3590e18b517 | 51 | SHT3X_CLOCK_STRETCHING_ENABLED_REPEATABILITY_HIGH = 0x2C06, /*!< High repeatability measurement with clock stretching enabled */ |
mcm | 1:c3590e18b517 | 52 | SHT3X_CLOCK_STRETCHING_ENABLED_REPEATABILITY_MEDIUM = 0x2C0D, /*!< Medium repeatability measurement with clock stretching enabled */ |
mcm | 1:c3590e18b517 | 53 | SHT3X_CLOCK_STRETCHING_ENABLED_REPEATABILITY_LOW = 0x2C10, /*!< Low repeatability measurement with clock stretching enabled */ |
mcm | 1:c3590e18b517 | 54 | |
mcm | 1:c3590e18b517 | 55 | SHT3X_CLOCK_STRETCHING_DISABLED_REPEATABILITY_HIGH = 0x2400, /*!< High repeatability measurement with clock stretching disabled */ |
mcm | 1:c3590e18b517 | 56 | SHT3X_CLOCK_STRETCHING_DISABLED_REPEATABILITY_MEDIUM = 0x240B, /*!< Medium repeatability measurement with clock stretching disabled */ |
mcm | 1:c3590e18b517 | 57 | SHT3X_CLOCK_STRETCHING_DISABLED_REPEATABILITY_LOW = 0x2416, /*!< Low repeatability measurement with clock stretching disabled */ |
mcm | 1:c3590e18b517 | 58 | } SHT3X_command_registers_single_shot_mode_t; |
mcm | 1:c3590e18b517 | 59 | |
mcm | 1:c3590e18b517 | 60 | |
mcm | 1:c3590e18b517 | 61 | typedef enum { |
mcm | 1:c3590e18b517 | 62 | SHT3X_HEATER_ENABLE = 0x306D, /*!< Heater enable command */ |
mcm | 1:c3590e18b517 | 63 | SHT3X_HEATER_DISABLE = 0x3066, /*!< Heater disable command */ |
mcm | 1:c3590e18b517 | 64 | } SHT3X_command_registers_heater_t; |
mcm | 1:c3590e18b517 | 65 | |
mcm | 1:c3590e18b517 | 66 | |
mcm | 1:c3590e18b517 | 67 | typedef enum { |
mcm | 1:c3590e18b517 | 68 | SHT3X_MPS_0_5_REPEATABILITY_HIGH = 0x2032, /*!< High repeatability 0.5 measurement per second */ |
mcm | 1:c3590e18b517 | 69 | SHT3X_MPS_0_5_REPEATABILITY_MEDIUM = 0x2024, /*!< Medium repeatability 0.5 measurement per second */ |
mcm | 1:c3590e18b517 | 70 | SHT3X_MPS_0_5_REPEATABILITY_LOW = 0x202F, /*!< Low repeatability 0.5 measurement per second */ |
mcm | 1:c3590e18b517 | 71 | |
mcm | 1:c3590e18b517 | 72 | SHT3X_MPS_1_REPEATABILITY_HIGH = 0x2130, /*!< High repeatability 1 measurement per second */ |
mcm | 1:c3590e18b517 | 73 | SHT3X_MPS_1_REPEATABILITY_MEDIUM = 0x2126, /*!< Medium repeatability 1 measurement per second */ |
mcm | 1:c3590e18b517 | 74 | SHT3X_MPS_1_REPEATABILITY_LOW = 0x212D, /*!< Low repeatability 1 measurement per second */ |
mcm | 1:c3590e18b517 | 75 | |
mcm | 1:c3590e18b517 | 76 | SHT3X_MPS_2_REPEATABILITY_HIGH = 0x2236, /*!< High repeatability 2 measurement per second */ |
mcm | 1:c3590e18b517 | 77 | SHT3X_MPS_2_REPEATABILITY_MEDIUM = 0x2220, /*!< Medium repeatability 2 measurement per second */ |
mcm | 1:c3590e18b517 | 78 | SHT3X_MPS_2_REPEATABILITY_LOW = 0x222B, /*!< Low repeatability 2 measurement per second */ |
mcm | 1:c3590e18b517 | 79 | |
mcm | 1:c3590e18b517 | 80 | SHT3X_MPS_4_REPEATABILITY_HIGH = 0x2334, /*!< High repeatability 4 measurement per second */ |
mcm | 1:c3590e18b517 | 81 | SHT3X_MPS_4_REPEATABILITY_MEDIUM = 0x2322, /*!< Medium repeatability 4 measurement per second */ |
mcm | 1:c3590e18b517 | 82 | SHT3X_MPS_4_REPEATABILITY_LOW = 0x2329, /*!< Low repeatability 4 measurement per second */ |
mcm | 1:c3590e18b517 | 83 | |
mcm | 1:c3590e18b517 | 84 | SHT3X_MPS_10_REPEATABILITY_HIGH = 0x2737, /*!< High repeatability 10 measurement per second */ |
mcm | 1:c3590e18b517 | 85 | SHT3X_MPS_10_REPEATABILITY_MEDIUM = 0x2721, /*!< Medium repeatability 10 measurement per second */ |
mcm | 1:c3590e18b517 | 86 | SHT3X_MPS_10_REPEATABILITY_LOW = 0x272A, /*!< Low repeatability 10 measurement per second */ |
mcm | 1:c3590e18b517 | 87 | } SHT3X_command_registers_periodic_data_mode_t; |
mcm | 1:c3590e18b517 | 88 | |
mcm | 1:c3590e18b517 | 89 | |
mcm | 1:c3590e18b517 | 90 | typedef enum { |
mcm | 1:c3590e18b517 | 91 | SHT3X_FETCH_DATA = 0xE000, /*!< Fetch data command */ |
mcm | 1:c3590e18b517 | 92 | SHT3X_PERIODIC_MESUREMENT_WITH_ART = 0x2B32, /*!< ART command */ |
mcm | 1:c3590e18b517 | 93 | SHT3X_BREAK = 0x3093, /*!< Break command */ |
mcm | 1:c3590e18b517 | 94 | SHT3X_SOFT_RESET = 0x30A2, /*!< Software reset command */ |
mcm | 1:c3590e18b517 | 95 | SHT3X_STATUS_REGISTER = 0xF32D, /*!< Status command */ |
mcm | 1:c3590e18b517 | 96 | SHT3X_CLEAR_STATUS_REGISTER = 0x3041 /*!< Clear Status register command */ |
mcm | 1:c3590e18b517 | 97 | } SHT3X_command_registers_t; |
mcm | 1:c3590e18b517 | 98 | |
mcm | 1:c3590e18b517 | 99 | |
mcm | 1:c3590e18b517 | 100 | |
mcm | 1:c3590e18b517 | 101 | // GENERAL CALL |
mcm | 1:c3590e18b517 | 102 | /** |
mcm | 1:c3590e18b517 | 103 | * @brief RESET |
mcm | 1:c3590e18b517 | 104 | */ |
mcm | 1:c3590e18b517 | 105 | typedef enum { |
mcm | 1:c3590e18b517 | 106 | SHT3X_GENERAL_CALL_RESET_ADDRESS_BYTE = 0x00, /*!< Reset. Address byte */ |
mcm | 1:c3590e18b517 | 107 | SHT3X_GENERAL_CALL_RESET_SECOND_BYTE = 0x06 /*!< Reset. Second byte */ |
mcm | 1:c3590e18b517 | 108 | } SHT3X_general_call_t; |
mcm | 1:c3590e18b517 | 109 | |
mcm | 1:c3590e18b517 | 110 | |
mcm | 1:c3590e18b517 | 111 | |
mcm | 1:c3590e18b517 | 112 | /** |
mcm | 1:c3590e18b517 | 113 | * @brief STATUS REGISTER. |
mcm | 1:c3590e18b517 | 114 | * NOTE: N/A. |
mcm | 1:c3590e18b517 | 115 | */ |
mcm | 1:c3590e18b517 | 116 | /* ALERT_PENDING_STATUS <15> |
mcm | 1:c3590e18b517 | 117 | * NOTE: N/A. |
mcm | 1:c3590e18b517 | 118 | */ |
mcm | 1:c3590e18b517 | 119 | typedef enum { |
mcm | 1:c3590e18b517 | 120 | STATUS_ALERT_PENDING_STATUS_MASK = ( 1U << 15U ), /*!< ALERT_PENDING_STATUS mask */ |
mcm | 1:c3590e18b517 | 121 | STATUS_ALERT_PENDING_STATUS_NO_PENDING_ALERTS = ( 0U << 15U ), /*!< No pending alerts */ |
mcm | 1:c3590e18b517 | 122 | STATUS_ALERT_PENDING_STATUS_AT_LEAST_ONE_PENDING_ALERT = ( 1U << 15U ) /*!< At least one pending alert [Default] */ |
mcm | 1:c3590e18b517 | 123 | } SHT3X_status_alert_pending_status_t; |
mcm | 1:c3590e18b517 | 124 | |
mcm | 1:c3590e18b517 | 125 | |
mcm | 1:c3590e18b517 | 126 | /* HEATER_STATUS <13> |
mcm | 1:c3590e18b517 | 127 | * NOTE: N/A. |
mcm | 1:c3590e18b517 | 128 | */ |
mcm | 1:c3590e18b517 | 129 | typedef enum { |
mcm | 1:c3590e18b517 | 130 | STATUS_HEATER_STATUS_MASK = ( 1U << 13U ), /*!< HEATER_STATUS mask */ |
mcm | 1:c3590e18b517 | 131 | STATUS_HEATER_OFF = ( 0U << 13U ), /*!< Heater off [Default] */ |
mcm | 1:c3590e18b517 | 132 | STATUS_HEATER_ON = ( 1U << 13U ) /*!< Heater on */ |
mcm | 1:c3590e18b517 | 133 | } SHT3X_status_heater_status_t; |
mcm | 1:c3590e18b517 | 134 | |
mcm | 1:c3590e18b517 | 135 | |
mcm | 1:c3590e18b517 | 136 | /* RH_TRACKING_ALERT <11> |
mcm | 1:c3590e18b517 | 137 | * NOTE: N/A. |
mcm | 1:c3590e18b517 | 138 | */ |
mcm | 1:c3590e18b517 | 139 | typedef enum { |
mcm | 1:c3590e18b517 | 140 | STATUS_RH_TRACKING_ALERT_MASK = ( 1U << 11U ), /*!< RH_TRACKING_ALERT mask */ |
mcm | 1:c3590e18b517 | 141 | STATUS_RH_TRACKING_ALERT_NO_ALERT = ( 0U << 11U ), /*!< No alert [Default] */ |
mcm | 1:c3590e18b517 | 142 | STATUS_RH_TRACKING_ALERT_ALERT = ( 1U << 11U ) /*!< Alert */ |
mcm | 1:c3590e18b517 | 143 | } SHT3X_status_rh_tracking_alert_t; |
mcm | 1:c3590e18b517 | 144 | |
mcm | 1:c3590e18b517 | 145 | |
mcm | 1:c3590e18b517 | 146 | /* T_TRACKING_ALERT <10> |
mcm | 1:c3590e18b517 | 147 | * NOTE: N/A. |
mcm | 1:c3590e18b517 | 148 | */ |
mcm | 1:c3590e18b517 | 149 | typedef enum { |
mcm | 1:c3590e18b517 | 150 | STATUS_T_TRACKING_ALERT_MASK = ( 1U << 10U ), /*!< T_TRACKING_ALERT mask */ |
mcm | 1:c3590e18b517 | 151 | STATUS_T_TRACKING_ALERT_NO_ALERT = ( 0U << 10U ), /*!< No alert [Default] */ |
mcm | 1:c3590e18b517 | 152 | STATUS_T_TRACKING_ALERT_ALERT = ( 1U << 10U ) /*!< Alert */ |
mcm | 1:c3590e18b517 | 153 | } SHT3X_status_t_tracking_alert_t; |
mcm | 1:c3590e18b517 | 154 | |
mcm | 1:c3590e18b517 | 155 | |
mcm | 1:c3590e18b517 | 156 | /* SYSTEM_RESET_DETECTED <4> |
mcm | 1:c3590e18b517 | 157 | * NOTE: N/A. |
mcm | 1:c3590e18b517 | 158 | */ |
mcm | 1:c3590e18b517 | 159 | typedef enum { |
mcm | 1:c3590e18b517 | 160 | STATUS_SYSTEM_RESET_DETECTED_MASK = ( 1U << 4U ), /*!< SYSTEM_RESET_DETECTED mask */ |
mcm | 1:c3590e18b517 | 161 | STATUS_SYSTEM_RESET_DETECTED_NO_RESET_DETECTED = ( 0U << 4U ), /*!< No reset detected since last 'clear status register' command */ |
mcm | 1:c3590e18b517 | 162 | STATUS_SYSTEM_RESET_DETECTED_RESET_DETECTED = ( 1U << 4U ) /*!< Reset detected (hard reset, soft reset command or supply fail)[Default] */ |
mcm | 1:c3590e18b517 | 163 | } SHT3X_status_system_reset_detected_t; |
mcm | 1:c3590e18b517 | 164 | |
mcm | 1:c3590e18b517 | 165 | |
mcm | 1:c3590e18b517 | 166 | /* COMMAND_STATUS <1> |
mcm | 1:c3590e18b517 | 167 | * NOTE: N/A. |
mcm | 1:c3590e18b517 | 168 | */ |
mcm | 1:c3590e18b517 | 169 | typedef enum { |
mcm | 1:c3590e18b517 | 170 | STATUS_COMMAND_STATUS_MASK = ( 1U << 10U ), /*!< COMMAND_STATUS mask */ |
mcm | 1:c3590e18b517 | 171 | STATUS_COMMAND_STATUS_COMMAND_EXECUTED_SUCCESSFULLY = ( 0U << 10U ), /*!< Last command executed successfully [Default] */ |
mcm | 1:c3590e18b517 | 172 | STATUS_COMMAND_STATUS_LAST_COMMAND_NOT_PROCESSED = ( 1U << 10U ) /*!< Last command not processed */ |
mcm | 1:c3590e18b517 | 173 | } SHT3X_status_command_status_t; |
mcm | 1:c3590e18b517 | 174 | |
mcm | 1:c3590e18b517 | 175 | |
mcm | 1:c3590e18b517 | 176 | /* WRITE_DATA_CHECKSUM_STATUS <0> |
mcm | 1:c3590e18b517 | 177 | * NOTE: N/A. |
mcm | 1:c3590e18b517 | 178 | */ |
mcm | 1:c3590e18b517 | 179 | typedef enum { |
mcm | 1:c3590e18b517 | 180 | STATUS_WRITE_DATA_CHECKSUM_STATUS_MASK = ( 1U << 0U ), /*!< COMMAND_STATUS mask */ |
mcm | 1:c3590e18b517 | 181 | STATUS_WRITE_DATA_CHECKSUM_STATUS_CHECKSUM_CORRECT = ( 0U << 0U ), /*!< Checksum of last write transfer was correct[Default] */ |
mcm | 1:c3590e18b517 | 182 | STATUS_WRITE_DATA_CHECKSUM_STATUS_CHECKSUM_FAILED = ( 1U << 0U ) /*!< Checksum of last write transfer failed */ |
mcm | 1:c3590e18b517 | 183 | } SHT3X_status_write_data_checksum_status_t; |
mcm | 1:c3590e18b517 | 184 | |
mcm | 1:c3590e18b517 | 185 | |
mcm | 1:c3590e18b517 | 186 | |
mcm | 1:c3590e18b517 | 187 | |
mcm | 1:c3590e18b517 | 188 | |
mcm | 1:c3590e18b517 | 189 | #ifndef SHT3X_VECTOR_STRUCT_H |
mcm | 1:c3590e18b517 | 190 | #define SHT3X_VECTOR_STRUCT_H |
mcm | 1:c3590e18b517 | 191 | /* RAW DATA */ |
mcm | 1:c3590e18b517 | 192 | typedef struct { |
mcm | 1:c3590e18b517 | 193 | uint16_t rawRelativeHumidity; |
mcm | 1:c3590e18b517 | 194 | uint16_t rawTemperature; |
mcm | 1:c3590e18b517 | 195 | |
mcm | 1:c3590e18b517 | 196 | uint8_t temperatureCRC; |
mcm | 1:c3590e18b517 | 197 | uint8_t relativeHumidityCRC; |
mcm | 1:c3590e18b517 | 198 | } SHT3X_raw_data_t; |
mcm | 1:c3590e18b517 | 199 | |
mcm | 1:c3590e18b517 | 200 | |
mcm | 1:c3590e18b517 | 201 | /* DATA: Temperature and Relative Humidity */ |
mcm | 1:c3590e18b517 | 202 | typedef struct { |
mcm | 1:c3590e18b517 | 203 | float relativeHumidity; |
mcm | 1:c3590e18b517 | 204 | float temperature; |
mcm | 1:c3590e18b517 | 205 | |
mcm | 1:c3590e18b517 | 206 | uint8_t temperatureCRC; |
mcm | 1:c3590e18b517 | 207 | uint8_t relativeHumidityCRC; |
mcm | 1:c3590e18b517 | 208 | } SHT3X_final_data_t; |
mcm | 1:c3590e18b517 | 209 | |
mcm | 1:c3590e18b517 | 210 | |
mcm | 1:c3590e18b517 | 211 | /* STATUS REGISTER */ |
mcm | 1:c3590e18b517 | 212 | typedef struct { |
mcm | 1:c3590e18b517 | 213 | uint16_t status; |
mcm | 1:c3590e18b517 | 214 | uint8_t statusCRC; |
mcm | 1:c3590e18b517 | 215 | } SHT3X_status_data_t; |
mcm | 1:c3590e18b517 | 216 | |
mcm | 1:c3590e18b517 | 217 | |
mcm | 1:c3590e18b517 | 218 | |
mcm | 1:c3590e18b517 | 219 | /* USER: User's variables */ |
mcm | 1:c3590e18b517 | 220 | typedef struct { |
mcm | 1:c3590e18b517 | 221 | /* Output data */ |
mcm | 1:c3590e18b517 | 222 | SHT3X_raw_data_t rawData; |
mcm | 1:c3590e18b517 | 223 | SHT3X_final_data_t data; |
mcm | 1:c3590e18b517 | 224 | |
mcm | 1:c3590e18b517 | 225 | /* Status register */ |
mcm | 1:c3590e18b517 | 226 | SHT3X_status_data_t status; |
mcm | 1:c3590e18b517 | 227 | } SHT3X_data_t; |
mcm | 1:c3590e18b517 | 228 | #endif |
mcm | 1:c3590e18b517 | 229 | |
mcm | 1:c3590e18b517 | 230 | |
mcm | 1:c3590e18b517 | 231 | |
mcm | 1:c3590e18b517 | 232 | |
mcm | 1:c3590e18b517 | 233 | |
mcm | 1:c3590e18b517 | 234 | /** |
mcm | 1:c3590e18b517 | 235 | * @brief INTERNAL CONSTANTS |
mcm | 1:c3590e18b517 | 236 | */ |
mcm | 1:c3590e18b517 | 237 | typedef enum { |
mcm | 1:c3590e18b517 | 238 | SHT3X_SUCCESS = 0, |
mcm | 1:c3590e18b517 | 239 | SHT3X_FAILURE = 1, |
mcm | 1:c3590e18b517 | 240 | I2C_SUCCESS = 2 |
mcm | 1:c3590e18b517 | 241 | } SHT3X_status_t; |
mcm | 1:c3590e18b517 | 242 | |
mcm | 1:c3590e18b517 | 243 | |
mcm | 1:c3590e18b517 | 244 | |
mcm | 1:c3590e18b517 | 245 | /** |
mcm | 1:c3590e18b517 | 246 | * @brief FUNCTION PROTOTYPES |
mcm | 1:c3590e18b517 | 247 | */ |
mcm | 1:c3590e18b517 | 248 | /** It configures the I2C peripheral. |
mcm | 1:c3590e18b517 | 249 | */ |
mcm | 1:c3590e18b517 | 250 | SHT3X_status_t SHT3X_Init ( void ); |
mcm | 1:c3590e18b517 | 251 | |
mcm | 1:c3590e18b517 | 252 | /** It triggers all the raw data in single shot mode. |
mcm | 1:c3590e18b517 | 253 | */ |
mcm | 1:c3590e18b517 | 254 | SHT3X_status_t SHT3X_OneShotTriggerAllData ( SHT3X_command_registers_single_shot_mode_t mode ); |
mcm | 1:c3590e18b517 | 255 | |
mcm | 1:c3590e18b517 | 256 | /** It gets all the raw data in single shot mode. |
mcm | 1:c3590e18b517 | 257 | */ |
mcm | 1:c3590e18b517 | 258 | SHT3X_status_t SHT3X_OneShotGetAllRawData ( SHT3X_raw_data_t* rawData ); |
mcm | 1:c3590e18b517 | 259 | |
mcm | 1:c3590e18b517 | 260 | /** It sets periodic measurement with ART (accelerated response time). |
mcm | 1:c3590e18b517 | 261 | */ |
mcm | 1:c3590e18b517 | 262 | SHT3X_status_t SHT3X_SetPeriodicMeasurementART ( void ); |
mcm | 1:c3590e18b517 | 263 | |
mcm | 1:c3590e18b517 | 264 | /** It sets the break command (stop periodic data acquisition mode). |
mcm | 1:c3590e18b517 | 265 | */ |
mcm | 1:c3590e18b517 | 266 | SHT3X_status_t SHT3X_SetBreakCommand ( void ); |
mcm | 1:c3590e18b517 | 267 | |
mcm | 1:c3590e18b517 | 268 | /** It perfoms a software reset. |
mcm | 1:c3590e18b517 | 269 | */ |
mcm | 1:c3590e18b517 | 270 | SHT3X_status_t SHT3X_SetSoftReset ( void ); |
mcm | 1:c3590e18b517 | 271 | |
mcm | 1:c3590e18b517 | 272 | /** It perfoms a reset through a general call address. |
mcm | 1:c3590e18b517 | 273 | */ |
mcm | 1:c3590e18b517 | 274 | SHT3X_status_t SHT3X_SetGeneralCallReset ( void ); |
mcm | 1:c3590e18b517 | 275 | |
mcm | 1:c3590e18b517 | 276 | /** It sets the heater. |
mcm | 1:c3590e18b517 | 277 | */ |
mcm | 1:c3590e18b517 | 278 | SHT3X_status_t SHT3X_SetHeater ( SHT3X_command_registers_heater_t heater ); |
mcm | 1:c3590e18b517 | 279 | |
mcm | 1:c3590e18b517 | 280 | /** It gets the status register. |
mcm | 1:c3590e18b517 | 281 | */ |
mcm | 1:c3590e18b517 | 282 | SHT3X_status_t SHT3X_GetStatus ( SHT3X_status_data_t* status ); |
mcm | 1:c3590e18b517 | 283 | |
mcm | 1:c3590e18b517 | 284 | /** It clears the status register. |
mcm | 1:c3590e18b517 | 285 | */ |
mcm | 1:c3590e18b517 | 286 | SHT3X_status_t SHT3X_ClearStatus ( void ); |
mcm | 1:c3590e18b517 | 287 | |
mcm | 1:c3590e18b517 | 288 | /** It sets the periodic data aquisition mode. |
mcm | 1:c3590e18b517 | 289 | */ |
mcm | 1:c3590e18b517 | 290 | SHT3X_status_t SHT3X_SetPeriodicAquisitionMode ( SHT3X_command_registers_periodic_data_mode_t mo ); |
mcm | 1:c3590e18b517 | 291 | |
mcm | 1:c3590e18b517 | 292 | /** It gets the all raw data (in periodic aquisition mode). |
mcm | 1:c3590e18b517 | 293 | */ |
mcm | 1:c3590e18b517 | 294 | SHT3X_status_t SHT3X_GetAllRawDataFetchData ( SHT3X_raw_data_t* rawData ); |
mcm | 1:c3590e18b517 | 295 | |
mcm | 1:c3590e18b517 | 296 | /** It processes all data: Temperature and Relative Humidity. |
mcm | 1:c3590e18b517 | 297 | */ |
mcm | 1:c3590e18b517 | 298 | void SHT3X_ProccessData ( SHT3X_raw_data_t rawData, SHT3X_final_data_t* data ); |
mcm | 1:c3590e18b517 | 299 | |
mcm | 1:c3590e18b517 | 300 | private: |
mcm | 1:c3590e18b517 | 301 | I2C _i2c; |
mcm | 1:c3590e18b517 | 302 | uint32_t _SHT3X_Addr; |
mcm | 1:c3590e18b517 | 303 | }; |
mcm | 1:c3590e18b517 | 304 | |
mcm | 1:c3590e18b517 | 305 | #endif /* SHT3X_H */ |