Adaptation of SMPIR for the Window Sensor Module of the Agile-IoT project.
Dependencies: BLE_API mbed nRF51822
Fork of SensorModulePIR by
Si7020.h@22:88b6e11eb8d5, 2018-06-06 (annotated)
- Committer:
- MisterGiet
- Date:
- Wed Jun 06 14:53:43 2018 +0000
- Revision:
- 22:88b6e11eb8d5
- Parent:
- 0:eb280529b0ef
Modification for Window Sensor Module for the Agile IoT final review.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
waltercolitti | 0:eb280529b0ef | 1 | /******************************************************************************* |
waltercolitti | 0:eb280529b0ef | 2 | * Copyright (C) 2015 Maxim Integrated Products, Inc., All Rights Reserved. |
waltercolitti | 0:eb280529b0ef | 3 | * |
waltercolitti | 0:eb280529b0ef | 4 | * Permission is hereby granted, free of charge, to any person obtaining a |
waltercolitti | 0:eb280529b0ef | 5 | * copy of this software and associated documentation files (the "Software"), |
waltercolitti | 0:eb280529b0ef | 6 | * to deal in the Software without restriction, including without limitation |
waltercolitti | 0:eb280529b0ef | 7 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, |
waltercolitti | 0:eb280529b0ef | 8 | * and/or sell copies of the Software, and to permit persons to whom the |
waltercolitti | 0:eb280529b0ef | 9 | * Software is furnished to do so, subject to the following conditions: |
waltercolitti | 0:eb280529b0ef | 10 | * |
waltercolitti | 0:eb280529b0ef | 11 | * The above copyright notice and this permission notice shall be included |
waltercolitti | 0:eb280529b0ef | 12 | * in all copies or substantial portions of the Software. |
waltercolitti | 0:eb280529b0ef | 13 | * |
waltercolitti | 0:eb280529b0ef | 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
waltercolitti | 0:eb280529b0ef | 15 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
waltercolitti | 0:eb280529b0ef | 16 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. |
waltercolitti | 0:eb280529b0ef | 17 | * IN NO EVENT SHALL MAXIM INTEGRATED BE LIABLE FOR ANY CLAIM, DAMAGES |
waltercolitti | 0:eb280529b0ef | 18 | * OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, |
waltercolitti | 0:eb280529b0ef | 19 | * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR |
waltercolitti | 0:eb280529b0ef | 20 | * OTHER DEALINGS IN THE SOFTWARE. |
waltercolitti | 0:eb280529b0ef | 21 | * |
waltercolitti | 0:eb280529b0ef | 22 | * Except as contained in this notice, the name of Maxim Integrated |
waltercolitti | 0:eb280529b0ef | 23 | * Products, Inc. shall not be used except as stated in the Maxim Integrated |
waltercolitti | 0:eb280529b0ef | 24 | * Products, Inc. Branding Policy. |
waltercolitti | 0:eb280529b0ef | 25 | * |
waltercolitti | 0:eb280529b0ef | 26 | * The mere transfer of this software does not imply any licenses |
waltercolitti | 0:eb280529b0ef | 27 | * of trade secrets, proprietary technology, copyrights, patents, |
waltercolitti | 0:eb280529b0ef | 28 | * trademarks, maskwork rights, or any other form of intellectual |
waltercolitti | 0:eb280529b0ef | 29 | * property whatsoever. Maxim Integrated Products, Inc. retains all |
waltercolitti | 0:eb280529b0ef | 30 | * ownership rights. |
waltercolitti | 0:eb280529b0ef | 31 | ******************************************************************************* |
waltercolitti | 0:eb280529b0ef | 32 | */ |
waltercolitti | 0:eb280529b0ef | 33 | |
waltercolitti | 0:eb280529b0ef | 34 | #ifndef _SI7020_H_ |
waltercolitti | 0:eb280529b0ef | 35 | #define _SI7020_H_ |
waltercolitti | 0:eb280529b0ef | 36 | |
waltercolitti | 0:eb280529b0ef | 37 | #include "mbed.h" |
waltercolitti | 0:eb280529b0ef | 38 | |
waltercolitti | 0:eb280529b0ef | 39 | /** |
waltercolitti | 0:eb280529b0ef | 40 | * Silicon Labs Si7020 Humidity and Temperature Sensor |
waltercolitti | 0:eb280529b0ef | 41 | * |
waltercolitti | 0:eb280529b0ef | 42 | * @code |
waltercolitti | 0:eb280529b0ef | 43 | * #include <stdio.h> |
waltercolitti | 0:eb280529b0ef | 44 | * #include "mbed.h" |
waltercolitti | 0:eb280529b0ef | 45 | * #include "Si7020.h" |
waltercolitti | 0:eb280529b0ef | 46 | * |
waltercolitti | 0:eb280529b0ef | 47 | * I2C i2c(I2C_SDA, I2C_SCL); |
waltercolitti | 0:eb280529b0ef | 48 | * Si7020 si(&i2c); |
waltercolitti | 0:eb280529b0ef | 49 | * |
waltercolitti | 0:eb280529b0ef | 50 | * int main() |
waltercolitti | 0:eb280529b0ef | 51 | * { |
waltercolitti | 0:eb280529b0ef | 52 | * while(1) { |
waltercolitti | 0:eb280529b0ef | 53 | * |
waltercolitti | 0:eb280529b0ef | 54 | * float humid; |
waltercolitti | 0:eb280529b0ef | 55 | * if(si.getHumidity(&humid) != 0) { |
waltercolitti | 0:eb280529b0ef | 56 | * printf("Error getting humidity\n"); |
waltercolitti | 0:eb280529b0ef | 57 | * humid = -1; |
waltercolitti | 0:eb280529b0ef | 58 | * } |
waltercolitti | 0:eb280529b0ef | 59 | * |
waltercolitti | 0:eb280529b0ef | 60 | * float temp; |
waltercolitti | 0:eb280529b0ef | 61 | * if(si.getTemperature(&temp) != 0) { |
waltercolitti | 0:eb280529b0ef | 62 | * printf("Error getting temperature"); |
waltercolitti | 0:eb280529b0ef | 63 | * temp = -1; |
waltercolitti | 0:eb280529b0ef | 64 | * } |
waltercolitti | 0:eb280529b0ef | 65 | * printf("Humidity = %f%% Temperature = %fC\n", humid, temp); |
waltercolitti | 0:eb280529b0ef | 66 | * |
waltercolitti | 0:eb280529b0ef | 67 | * wait(1); |
waltercolitti | 0:eb280529b0ef | 68 | * } |
waltercolitti | 0:eb280529b0ef | 69 | * } |
waltercolitti | 0:eb280529b0ef | 70 | * @endcode |
waltercolitti | 0:eb280529b0ef | 71 | */ |
waltercolitti | 0:eb280529b0ef | 72 | class Si7020 |
waltercolitti | 0:eb280529b0ef | 73 | { |
waltercolitti | 0:eb280529b0ef | 74 | |
waltercolitti | 0:eb280529b0ef | 75 | public: |
waltercolitti | 0:eb280529b0ef | 76 | |
waltercolitti | 0:eb280529b0ef | 77 | /** |
waltercolitti | 0:eb280529b0ef | 78 | * @brief Measurement resolution. |
waltercolitti | 0:eb280529b0ef | 79 | * @details Controls the resolution of the humidity and temperarure readings. |
waltercolitti | 0:eb280529b0ef | 80 | */ |
waltercolitti | 0:eb280529b0ef | 81 | typedef enum { |
waltercolitti | 0:eb280529b0ef | 82 | RH_12b_TEMP_14b = 0x0, ///< 12 bits for RH, 14 bits for Temp |
waltercolitti | 0:eb280529b0ef | 83 | RH_8b_TEMP_12b = 0x1, ///< 8 bits for RH, 12 bits for Temp |
waltercolitti | 0:eb280529b0ef | 84 | RH_10b_TEMP_13b = 0x2, ///< 10 bits for RH, 13 bits for Temp |
waltercolitti | 0:eb280529b0ef | 85 | RH_11b_TEMP_11b = 0x3, ///< 11 bits for RH, 11 bits for Temp |
waltercolitti | 0:eb280529b0ef | 86 | } resolution_t; |
waltercolitti | 0:eb280529b0ef | 87 | |
waltercolitti | 0:eb280529b0ef | 88 | /** |
waltercolitti | 0:eb280529b0ef | 89 | * Si7020 constructor. |
waltercolitti | 0:eb280529b0ef | 90 | * |
waltercolitti | 0:eb280529b0ef | 91 | * @param sda mbed pin to use for SDA line of I2C interface. |
waltercolitti | 0:eb280529b0ef | 92 | * @param scl mbed pin to use for SCL line of I2C interface. |
waltercolitti | 0:eb280529b0ef | 93 | */ |
waltercolitti | 0:eb280529b0ef | 94 | Si7020(PinName sda, PinName scl); |
waltercolitti | 0:eb280529b0ef | 95 | |
waltercolitti | 0:eb280529b0ef | 96 | /** |
waltercolitti | 0:eb280529b0ef | 97 | * Si7020 constructor. |
waltercolitti | 0:eb280529b0ef | 98 | * |
waltercolitti | 0:eb280529b0ef | 99 | * @param i2c I2C object to use |
waltercolitti | 0:eb280529b0ef | 100 | */ |
waltercolitti | 0:eb280529b0ef | 101 | Si7020(I2C *i2c); |
waltercolitti | 0:eb280529b0ef | 102 | |
waltercolitti | 0:eb280529b0ef | 103 | /** |
waltercolitti | 0:eb280529b0ef | 104 | * Si7020 destructor. |
waltercolitti | 0:eb280529b0ef | 105 | */ |
waltercolitti | 0:eb280529b0ef | 106 | ~Si7020(); |
waltercolitti | 0:eb280529b0ef | 107 | |
waltercolitti | 0:eb280529b0ef | 108 | /** |
waltercolitti | 0:eb280529b0ef | 109 | * @brief Reset. |
waltercolitti | 0:eb280529b0ef | 110 | * @details Sends the rest command. |
waltercolitti | 0:eb280529b0ef | 111 | * @returns 0 if no errors, -1 if error. |
waltercolitti | 0:eb280529b0ef | 112 | */ |
waltercolitti | 0:eb280529b0ef | 113 | int reset(void); |
waltercolitti | 0:eb280529b0ef | 114 | |
waltercolitti | 0:eb280529b0ef | 115 | /** |
waltercolitti | 0:eb280529b0ef | 116 | * @brief Get Electronic ID. |
waltercolitti | 0:eb280529b0ef | 117 | * @details Gets the Electronic ID of the connected device. Verifies the |
waltercolitti | 0:eb280529b0ef | 118 | * ID with an 8-bit CRC. |
waltercolitti | 0:eb280529b0ef | 119 | * |
waltercolitti | 0:eb280529b0ef | 120 | * @param Character buffer to store the id. Needs to be at least 8 bytes. |
waltercolitti | 0:eb280529b0ef | 121 | * @returns 0 if no errors, -1 if error. |
waltercolitti | 0:eb280529b0ef | 122 | */ |
waltercolitti | 0:eb280529b0ef | 123 | int getElectronicId(char *id); |
waltercolitti | 0:eb280529b0ef | 124 | |
waltercolitti | 0:eb280529b0ef | 125 | /** |
waltercolitti | 0:eb280529b0ef | 126 | * @brief Configure sample resolution. |
waltercolitti | 0:eb280529b0ef | 127 | * @details Sets the number of bits used for humidity and temperature readings. |
waltercolitti | 0:eb280529b0ef | 128 | * @param resolution Enum for the resolution setting. |
waltercolitti | 0:eb280529b0ef | 129 | * @returns 0 if no errors, -1 if error. |
waltercolitti | 0:eb280529b0ef | 130 | */ |
waltercolitti | 0:eb280529b0ef | 131 | int configResolution(Si7020::resolution_t resolution); |
waltercolitti | 0:eb280529b0ef | 132 | |
waltercolitti | 0:eb280529b0ef | 133 | /** |
waltercolitti | 0:eb280529b0ef | 134 | * @brief Get temperature reading. |
waltercolitti | 0:eb280529b0ef | 135 | * @details Initiates a temperature reading and blocks until reading has |
waltercolitti | 0:eb280529b0ef | 136 | * been calculated. |
waltercolitti | 0:eb280529b0ef | 137 | * |
waltercolitti | 0:eb280529b0ef | 138 | * @note Will hold the I2C bus until reading is complete. Refer to datasheet |
waltercolitti | 0:eb280529b0ef | 139 | * for timing specifications. |
waltercolitti | 0:eb280529b0ef | 140 | * |
waltercolitti | 0:eb280529b0ef | 141 | * @param tempCx10 Pointer for temperature reading. Unit is 1/10th degree Celcius. |
waltercolitti | 0:eb280529b0ef | 142 | * @returns 0 if no errors, -1 if error. |
waltercolitti | 0:eb280529b0ef | 143 | */ |
waltercolitti | 0:eb280529b0ef | 144 | int getTemperature(int16_t *tempCx10); |
waltercolitti | 0:eb280529b0ef | 145 | |
waltercolitti | 0:eb280529b0ef | 146 | /** |
waltercolitti | 0:eb280529b0ef | 147 | * @brief Get temperature reading. |
waltercolitti | 0:eb280529b0ef | 148 | * @details Initiates a temperature reading and blocks until reading has |
waltercolitti | 0:eb280529b0ef | 149 | * been calculated. |
waltercolitti | 0:eb280529b0ef | 150 | * |
waltercolitti | 0:eb280529b0ef | 151 | * @note Will hold the I2C bus until reading is complete. Refer to datasheet |
waltercolitti | 0:eb280529b0ef | 152 | * for timing specifications. |
waltercolitti | 0:eb280529b0ef | 153 | * |
waltercolitti | 0:eb280529b0ef | 154 | * @param tempC Pointer for temperature reading. Unit is degree Celcius. |
waltercolitti | 0:eb280529b0ef | 155 | * @returns 0 if no errors, -1 if error. |
waltercolitti | 0:eb280529b0ef | 156 | */ |
waltercolitti | 0:eb280529b0ef | 157 | int getTemperature(float *tempC); |
waltercolitti | 0:eb280529b0ef | 158 | |
waltercolitti | 0:eb280529b0ef | 159 | /** |
waltercolitti | 0:eb280529b0ef | 160 | * @brief Start temperature reading. |
waltercolitti | 0:eb280529b0ef | 161 | * @details Initiates a temperature reading. Will not hold the bus or block. |
waltercolitti | 0:eb280529b0ef | 162 | * @returns 0 if no errors, -1 if error. |
waltercolitti | 0:eb280529b0ef | 163 | */ |
waltercolitti | 0:eb280529b0ef | 164 | int startTemperature(void); |
waltercolitti | 0:eb280529b0ef | 165 | |
waltercolitti | 0:eb280529b0ef | 166 | /** |
waltercolitti | 0:eb280529b0ef | 167 | * @brief Check temperature reading. |
waltercolitti | 0:eb280529b0ef | 168 | * @details Checks to see if the temperature reading has been completed. |
waltercolitti | 0:eb280529b0ef | 169 | Returns temperature if reading complete. |
waltercolitti | 0:eb280529b0ef | 170 | * @note Must call startTemperature() prior to calling this function. |
waltercolitti | 0:eb280529b0ef | 171 | * @param tempCx10 Pointer for temperature reading. Unit is 1/10th degree Celcius. |
waltercolitti | 0:eb280529b0ef | 172 | * @returns 0 if reading taken, -1 if reading pending. |
waltercolitti | 0:eb280529b0ef | 173 | */ |
waltercolitti | 0:eb280529b0ef | 174 | int checkTemperature(int16_t *tempCx10); |
waltercolitti | 0:eb280529b0ef | 175 | |
waltercolitti | 0:eb280529b0ef | 176 | /** |
waltercolitti | 0:eb280529b0ef | 177 | * @brief Check temperature reading. |
waltercolitti | 0:eb280529b0ef | 178 | * @details Checks to see if the temperature reading has been completed. |
waltercolitti | 0:eb280529b0ef | 179 | Returns temperature if reading complete. |
waltercolitti | 0:eb280529b0ef | 180 | * @note Must call startTemperature() prior to calling this function. |
waltercolitti | 0:eb280529b0ef | 181 | * @param tempC Pointer for temperature reading. Unit is degree Celcius. |
waltercolitti | 0:eb280529b0ef | 182 | * @returns 0 if reading taken, -1 if reading pending. |
waltercolitti | 0:eb280529b0ef | 183 | */ |
waltercolitti | 0:eb280529b0ef | 184 | int checkTemperature(float *tempC); |
waltercolitti | 0:eb280529b0ef | 185 | |
waltercolitti | 0:eb280529b0ef | 186 | /** |
waltercolitti | 0:eb280529b0ef | 187 | * @brief Get humidity reading. |
waltercolitti | 0:eb280529b0ef | 188 | * @details Initiates a humidity reading and blocks until reading has |
waltercolitti | 0:eb280529b0ef | 189 | * been calculated. |
waltercolitti | 0:eb280529b0ef | 190 | * |
waltercolitti | 0:eb280529b0ef | 191 | * @note Will hold the I2C bus until reading is complete. Refer to datasheet |
waltercolitti | 0:eb280529b0ef | 192 | * for timing specifications. |
waltercolitti | 0:eb280529b0ef | 193 | * |
waltercolitti | 0:eb280529b0ef | 194 | * @param humidx10 Pointer for humidity reading. Unit is 1/10th percent. |
waltercolitti | 0:eb280529b0ef | 195 | * @returns 0 if no errors, -1 if error. |
waltercolitti | 0:eb280529b0ef | 196 | */ |
waltercolitti | 0:eb280529b0ef | 197 | int getHumidity(int16_t *humidx10); |
waltercolitti | 0:eb280529b0ef | 198 | |
waltercolitti | 0:eb280529b0ef | 199 | /** |
waltercolitti | 0:eb280529b0ef | 200 | * @brief Get humidity reading. |
waltercolitti | 0:eb280529b0ef | 201 | * @details Initiates a humidity reading and blocks until reading has |
waltercolitti | 0:eb280529b0ef | 202 | * been calculated. |
waltercolitti | 0:eb280529b0ef | 203 | * |
waltercolitti | 0:eb280529b0ef | 204 | * @note Will hold the I2C bus until reading is complete. Refer to datasheet |
waltercolitti | 0:eb280529b0ef | 205 | * for timing specifications. |
waltercolitti | 0:eb280529b0ef | 206 | * |
waltercolitti | 0:eb280529b0ef | 207 | * @param humid Pointer for humidity reading. Unit is percent. |
waltercolitti | 0:eb280529b0ef | 208 | * @returns 0 if no errors, -1 if error. |
waltercolitti | 0:eb280529b0ef | 209 | */ |
waltercolitti | 0:eb280529b0ef | 210 | int getHumidity(float *humid); |
waltercolitti | 0:eb280529b0ef | 211 | |
waltercolitti | 0:eb280529b0ef | 212 | /** |
waltercolitti | 0:eb280529b0ef | 213 | * @brief Start humidity reading. |
waltercolitti | 0:eb280529b0ef | 214 | * @details Initiates a humidity reading. Will not hold the bus or block. |
waltercolitti | 0:eb280529b0ef | 215 | * @returns 0 if no errors, -1 if error. |
waltercolitti | 0:eb280529b0ef | 216 | */ |
waltercolitti | 0:eb280529b0ef | 217 | int startHumidity(void); |
waltercolitti | 0:eb280529b0ef | 218 | |
waltercolitti | 0:eb280529b0ef | 219 | /** |
waltercolitti | 0:eb280529b0ef | 220 | * @brief Check humidity reading. |
waltercolitti | 0:eb280529b0ef | 221 | * @details Checks to see if the humidity reading has been completed. |
waltercolitti | 0:eb280529b0ef | 222 | Returns humidity if reading complete. |
waltercolitti | 0:eb280529b0ef | 223 | |
waltercolitti | 0:eb280529b0ef | 224 | * @note Must call startHumidity() prior to calling this function. |
waltercolitti | 0:eb280529b0ef | 225 | * @param humidCx10 Pointer for humidity reading. Unit is 1/10th percent. |
waltercolitti | 0:eb280529b0ef | 226 | * @returns 0 if reading taken, -1 if reading pending. |
waltercolitti | 0:eb280529b0ef | 227 | */ |
waltercolitti | 0:eb280529b0ef | 228 | int checkHumidity(int16_t *humidx10); |
waltercolitti | 0:eb280529b0ef | 229 | |
waltercolitti | 0:eb280529b0ef | 230 | /** |
waltercolitti | 0:eb280529b0ef | 231 | * @brief Check humidity reading. |
waltercolitti | 0:eb280529b0ef | 232 | * @details Checks to see if the humidity reading has been completed. |
waltercolitti | 0:eb280529b0ef | 233 | Returns humidity if reading complete. |
waltercolitti | 0:eb280529b0ef | 234 | |
waltercolitti | 0:eb280529b0ef | 235 | * @note Must call startHumidity() prior to calling this function. |
waltercolitti | 0:eb280529b0ef | 236 | * @param humid Pointer for humidity reading. Unit is percent. |
waltercolitti | 0:eb280529b0ef | 237 | * @returns 0 if reading taken, -1 if reading pending. |
waltercolitti | 0:eb280529b0ef | 238 | */ |
waltercolitti | 0:eb280529b0ef | 239 | int checkHumidity(float *humid); |
waltercolitti | 0:eb280529b0ef | 240 | |
waltercolitti | 0:eb280529b0ef | 241 | /** |
waltercolitti | 0:eb280529b0ef | 242 | * @brief Get temperature from humidity reading. |
waltercolitti | 0:eb280529b0ef | 243 | * @details Gets temperature reading from previous humidity reading. |
waltercolitti | 0:eb280529b0ef | 244 | * @note Must call startHumidity() prior to calling this function. |
waltercolitti | 0:eb280529b0ef | 245 | * @param tempC Pointer for temperature reading. Unit is degree Celcius. |
waltercolitti | 0:eb280529b0ef | 246 | * @returns 0 if reading taken, -1 if reading pending. |
waltercolitti | 0:eb280529b0ef | 247 | */ |
waltercolitti | 0:eb280529b0ef | 248 | int getPrevTemperature(float* tempC); |
waltercolitti | 0:eb280529b0ef | 249 | |
waltercolitti | 0:eb280529b0ef | 250 | /** |
waltercolitti | 0:eb280529b0ef | 251 | * @brief Get temperature from humidity reading. |
waltercolitti | 0:eb280529b0ef | 252 | * @details Gets temperature reading from previous humidity reading. |
waltercolitti | 0:eb280529b0ef | 253 | * @note Must call startHumidity() prior to calling this function. |
waltercolitti | 0:eb280529b0ef | 254 | * @param tempCx10 Pointer for temperature reading. Unit is 1/10th degree Celcius. |
waltercolitti | 0:eb280529b0ef | 255 | * @returns 0 if reading taken, -1 if reading pending. |
waltercolitti | 0:eb280529b0ef | 256 | */ |
waltercolitti | 0:eb280529b0ef | 257 | int getPrevTemperature(int16_t *tempCx10); |
waltercolitti | 0:eb280529b0ef | 258 | |
waltercolitti | 0:eb280529b0ef | 259 | /** |
waltercolitti | 0:eb280529b0ef | 260 | * @brief Get firmware revision. |
waltercolitti | 0:eb280529b0ef | 261 | * @details Reads the firmware revision, refer to datasheet for codes. |
waltercolitti | 0:eb280529b0ef | 262 | * @param rev Pointer to store firmware revision. |
waltercolitti | 0:eb280529b0ef | 263 | * @returns 0 if no errors, -1 if error. |
waltercolitti | 0:eb280529b0ef | 264 | */ |
waltercolitti | 0:eb280529b0ef | 265 | int getRev(char *rev); |
waltercolitti | 0:eb280529b0ef | 266 | |
waltercolitti | 0:eb280529b0ef | 267 | /** |
waltercolitti | 0:eb280529b0ef | 268 | * @brief Control heater. |
waltercolitti | 0:eb280529b0ef | 269 | * @details Enable or disable the heater. |
waltercolitti | 0:eb280529b0ef | 270 | * @param enable True to enable heater, false to disable. |
waltercolitti | 0:eb280529b0ef | 271 | * @returns 0 if no errors, -1 if error. |
waltercolitti | 0:eb280529b0ef | 272 | */ |
waltercolitti | 0:eb280529b0ef | 273 | int heater(bool enable); |
waltercolitti | 0:eb280529b0ef | 274 | |
waltercolitti | 0:eb280529b0ef | 275 | private: |
waltercolitti | 0:eb280529b0ef | 276 | |
waltercolitti | 0:eb280529b0ef | 277 | char crc8(char value, char seed); |
waltercolitti | 0:eb280529b0ef | 278 | I2C *i2c_; |
waltercolitti | 0:eb280529b0ef | 279 | bool i2c_owner; |
waltercolitti | 0:eb280529b0ef | 280 | }; |
waltercolitti | 0:eb280529b0ef | 281 | |
waltercolitti | 0:eb280529b0ef | 282 | #endif /* _SI7020_H_ */ |