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.
MAX30205/MAX30205.h@22:5c07298d3383, 2019-08-26 (annotated)
- Committer:
- lucaslwl
- Date:
- Mon Aug 26 08:11:41 2019 +0000
- Revision:
- 22:5c07298d3383
add library folder
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
lucaslwl | 22:5c07298d3383 | 1 | ///******************************************************************************* |
lucaslwl | 22:5c07298d3383 | 2 | // * Copyright (C) 2017 Maxim Integrated Products, Inc., All Rights Reserved. |
lucaslwl | 22:5c07298d3383 | 3 | // * |
lucaslwl | 22:5c07298d3383 | 4 | // * Permission is hereby granted, free of charge, to any person obtaining a |
lucaslwl | 22:5c07298d3383 | 5 | // * copy of this software and associated documentation files (the "Software"), |
lucaslwl | 22:5c07298d3383 | 6 | // * to deal in the Software without restriction, including without limitation |
lucaslwl | 22:5c07298d3383 | 7 | // * the rights to use, copy, modify, merge, publish, distribute, sublicense, |
lucaslwl | 22:5c07298d3383 | 8 | // * and/or sell copies of the Software, and to permit persons to whom the |
lucaslwl | 22:5c07298d3383 | 9 | // * Software is furnished to do so, subject to the following conditions: |
lucaslwl | 22:5c07298d3383 | 10 | // * |
lucaslwl | 22:5c07298d3383 | 11 | // * The above copyright notice and this permission notice shall be included |
lucaslwl | 22:5c07298d3383 | 12 | // * in all copies or substantial portions of the Software. |
lucaslwl | 22:5c07298d3383 | 13 | // * |
lucaslwl | 22:5c07298d3383 | 14 | // * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
lucaslwl | 22:5c07298d3383 | 15 | // * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
lucaslwl | 22:5c07298d3383 | 16 | // * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. |
lucaslwl | 22:5c07298d3383 | 17 | // * IN NO EVENT SHALL MAXIM INTEGRATED BE LIABLE FOR ANY CLAIM, DAMAGES |
lucaslwl | 22:5c07298d3383 | 18 | // * OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, |
lucaslwl | 22:5c07298d3383 | 19 | // * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR |
lucaslwl | 22:5c07298d3383 | 20 | // * OTHER DEALINGS IN THE SOFTWARE. |
lucaslwl | 22:5c07298d3383 | 21 | // * |
lucaslwl | 22:5c07298d3383 | 22 | // * Except as contained in this notice, the name of Maxim Integrated |
lucaslwl | 22:5c07298d3383 | 23 | // * Products, Inc. shall not be used except as stated in the Maxim Integrated |
lucaslwl | 22:5c07298d3383 | 24 | // * Products, Inc. Branding Policy. |
lucaslwl | 22:5c07298d3383 | 25 | // * |
lucaslwl | 22:5c07298d3383 | 26 | // * The mere transfer of this software does not imply any licenses |
lucaslwl | 22:5c07298d3383 | 27 | // * of trade secrets, proprietary technology, copyrights, patents, |
lucaslwl | 22:5c07298d3383 | 28 | // * trademarks, maskwork rights, or any other form of intellectual |
lucaslwl | 22:5c07298d3383 | 29 | // * property whatsoever. Maxim Integrated Products, Inc. retains all |
lucaslwl | 22:5c07298d3383 | 30 | // * ownership rights. |
lucaslwl | 22:5c07298d3383 | 31 | // ******************************************************************************* |
lucaslwl | 22:5c07298d3383 | 32 | // */ |
lucaslwl | 22:5c07298d3383 | 33 | //#ifndef __MAX30205_H_ |
lucaslwl | 22:5c07298d3383 | 34 | //#define __MAX30205_H_ |
lucaslwl | 22:5c07298d3383 | 35 | // |
lucaslwl | 22:5c07298d3383 | 36 | //#include "mbed.h" |
lucaslwl | 22:5c07298d3383 | 37 | // |
lucaslwl | 22:5c07298d3383 | 38 | ///** |
lucaslwl | 22:5c07298d3383 | 39 | // * @brief Library for the MAX30205\n |
lucaslwl | 22:5c07298d3383 | 40 | // * The MAX30205 temperature sensor accurately measures temperature and provide |
lucaslwl | 22:5c07298d3383 | 41 | // * an overtemperature alarm/interrupt/shutdown output. This device converts the |
lucaslwl | 22:5c07298d3383 | 42 | // * temperature measurements to digital form using a high-resolution, |
lucaslwl | 22:5c07298d3383 | 43 | // * sigma-delta, analog-to-digital converter (ADC). Accuracy meets clinical |
lucaslwl | 22:5c07298d3383 | 44 | // * thermometry specification of the ASTM E1112 when soldered on the final PCB. |
lucaslwl | 22:5c07298d3383 | 45 | // * Communication is through an I2C-compatible 2-wire serial interface. |
lucaslwl | 22:5c07298d3383 | 46 | // * |
lucaslwl | 22:5c07298d3383 | 47 | // * @code |
lucaslwl | 22:5c07298d3383 | 48 | // * #include "mbed.h" |
lucaslwl | 22:5c07298d3383 | 49 | // * #include "max32630fthr.h" |
lucaslwl | 22:5c07298d3383 | 50 | // * #include "MAX30205.h" |
lucaslwl | 22:5c07298d3383 | 51 | // * |
lucaslwl | 22:5c07298d3383 | 52 | // * MAX32630FTHR pegasus(MAX32630FTHR::VIO_3V3); |
lucaslwl | 22:5c07298d3383 | 53 | // * |
lucaslwl | 22:5c07298d3383 | 54 | // * //Get I2C instance |
lucaslwl | 22:5c07298d3383 | 55 | // * I2C i2cBus(I2C1_SDA, I2C1_SCL); |
lucaslwl | 22:5c07298d3383 | 56 | // * |
lucaslwl | 22:5c07298d3383 | 57 | // * //Get temp sensor instance |
lucaslwl | 22:5c07298d3383 | 58 | // * MAX30205 bodyTempSensor(i2cBus, 0x4D); //Constructor takes 7-bit slave adrs |
lucaslwl | 22:5c07298d3383 | 59 | // * |
lucaslwl | 22:5c07298d3383 | 60 | // * int main(void) |
lucaslwl | 22:5c07298d3383 | 61 | // * { |
lucaslwl | 22:5c07298d3383 | 62 | // * //use sensor |
lucaslwl | 22:5c07298d3383 | 63 | // * } |
lucaslwl | 22:5c07298d3383 | 64 | // * @endcode |
lucaslwl | 22:5c07298d3383 | 65 | // */ |
lucaslwl | 22:5c07298d3383 | 66 | // |
lucaslwl | 22:5c07298d3383 | 67 | //class MAX30205 |
lucaslwl | 22:5c07298d3383 | 68 | //{ |
lucaslwl | 22:5c07298d3383 | 69 | // |
lucaslwl | 22:5c07298d3383 | 70 | //public: |
lucaslwl | 22:5c07298d3383 | 71 | // /// MAX30205 Register Addresses |
lucaslwl | 22:5c07298d3383 | 72 | // enum Registers_e |
lucaslwl | 22:5c07298d3383 | 73 | // { |
lucaslwl | 22:5c07298d3383 | 74 | // Temperature = 0x00, |
lucaslwl | 22:5c07298d3383 | 75 | // Configuration = 0x01, |
lucaslwl | 22:5c07298d3383 | 76 | // THYST = 0x02, |
lucaslwl | 22:5c07298d3383 | 77 | // TOS = 0x03 |
lucaslwl | 22:5c07298d3383 | 78 | // }; |
lucaslwl | 22:5c07298d3383 | 79 | // |
lucaslwl | 22:5c07298d3383 | 80 | // ///MAX30205 Configuration register bitfields |
lucaslwl | 22:5c07298d3383 | 81 | // union Configuration_u |
lucaslwl | 22:5c07298d3383 | 82 | // { |
lucaslwl | 22:5c07298d3383 | 83 | // uint8_t all; |
lucaslwl | 22:5c07298d3383 | 84 | // struct BitField_s |
lucaslwl | 22:5c07298d3383 | 85 | // { |
lucaslwl | 22:5c07298d3383 | 86 | // uint8_t shutdown : 1; |
lucaslwl | 22:5c07298d3383 | 87 | // uint8_t comp_int : 1; |
lucaslwl | 22:5c07298d3383 | 88 | // uint8_t os_polarity : 1; |
lucaslwl | 22:5c07298d3383 | 89 | // uint8_t fault_queue : 2; |
lucaslwl | 22:5c07298d3383 | 90 | // uint8_t data_format : 1; |
lucaslwl | 22:5c07298d3383 | 91 | // uint8_t timeout : 1; |
lucaslwl | 22:5c07298d3383 | 92 | // uint8_t one_shot : 1; |
lucaslwl | 22:5c07298d3383 | 93 | // }bits; |
lucaslwl | 22:5c07298d3383 | 94 | // }; |
lucaslwl | 22:5c07298d3383 | 95 | // |
lucaslwl | 22:5c07298d3383 | 96 | // /** |
lucaslwl | 22:5c07298d3383 | 97 | // * @brief Constructor using reference to I2C object |
lucaslwl | 22:5c07298d3383 | 98 | // * @param i2c - Reference to I2C object |
lucaslwl | 22:5c07298d3383 | 99 | // * @param slaveAddress - 7-bit I2C address |
lucaslwl | 22:5c07298d3383 | 100 | // */ |
lucaslwl | 22:5c07298d3383 | 101 | // MAX30205(I2C &i2c, uint8_t slaveAddress); |
lucaslwl | 22:5c07298d3383 | 102 | // |
lucaslwl | 22:5c07298d3383 | 103 | // /** @brief Destructor */ |
lucaslwl | 22:5c07298d3383 | 104 | // ~MAX30205(void); |
lucaslwl | 22:5c07298d3383 | 105 | // |
lucaslwl | 22:5c07298d3383 | 106 | // /** |
lucaslwl | 22:5c07298d3383 | 107 | // * @brief Read the temperature from the device into a 16 bit value |
lucaslwl | 22:5c07298d3383 | 108 | // * @param[out] value - Raw temperature data on success |
lucaslwl | 22:5c07298d3383 | 109 | // * @return 0 on success, non-zero on failure |
lucaslwl | 22:5c07298d3383 | 110 | // */ |
lucaslwl | 22:5c07298d3383 | 111 | // int32_t readTemperature(uint16_t &value); |
lucaslwl | 22:5c07298d3383 | 112 | // |
lucaslwl | 22:5c07298d3383 | 113 | // /** |
lucaslwl | 22:5c07298d3383 | 114 | // * @brief Read the configuration register |
lucaslwl | 22:5c07298d3383 | 115 | // * @param config - Reference to Configuration type |
lucaslwl | 22:5c07298d3383 | 116 | // * @return 0 on success, non-zero on failure |
lucaslwl | 22:5c07298d3383 | 117 | // */ |
lucaslwl | 22:5c07298d3383 | 118 | // int32_t readConfiguration(Configuration_u &config); |
lucaslwl | 22:5c07298d3383 | 119 | // |
lucaslwl | 22:5c07298d3383 | 120 | // /** |
lucaslwl | 22:5c07298d3383 | 121 | // * @brief Write the configuration register with given configuration |
lucaslwl | 22:5c07298d3383 | 122 | // * @param config - Configuration to write |
lucaslwl | 22:5c07298d3383 | 123 | // * @return 0 on success, non-zero on failure |
lucaslwl | 22:5c07298d3383 | 124 | // */ |
lucaslwl | 22:5c07298d3383 | 125 | // int32_t writeConfiguration(const Configuration_u config); |
lucaslwl | 22:5c07298d3383 | 126 | // |
lucaslwl | 22:5c07298d3383 | 127 | // /** |
lucaslwl | 22:5c07298d3383 | 128 | // * @brief Read the THYST value from a specified device instance |
lucaslwl | 22:5c07298d3383 | 129 | // * @param[out] value - THYST register value on success |
lucaslwl | 22:5c07298d3383 | 130 | // * @return 0 on success, non-zero on failure |
lucaslwl | 22:5c07298d3383 | 131 | // */ |
lucaslwl | 22:5c07298d3383 | 132 | // int32_t readTHYST(uint16_t &value); |
lucaslwl | 22:5c07298d3383 | 133 | // |
lucaslwl | 22:5c07298d3383 | 134 | // /** |
lucaslwl | 22:5c07298d3383 | 135 | // * @brief Write the THYST to a device instance |
lucaslwl | 22:5c07298d3383 | 136 | // * @param value - 16-bit value to write |
lucaslwl | 22:5c07298d3383 | 137 | // * @return 0 on success, non-zero on failure |
lucaslwl | 22:5c07298d3383 | 138 | // */ |
lucaslwl | 22:5c07298d3383 | 139 | // int32_t writeTHYST(const uint16_t value); |
lucaslwl | 22:5c07298d3383 | 140 | // |
lucaslwl | 22:5c07298d3383 | 141 | // /** |
lucaslwl | 22:5c07298d3383 | 142 | // * @brief Read the TOS value from device |
lucaslwl | 22:5c07298d3383 | 143 | // * @param[out] value - TOS register value on success |
lucaslwl | 22:5c07298d3383 | 144 | // * @return 0 on success, non-zero on failure |
lucaslwl | 22:5c07298d3383 | 145 | // */ |
lucaslwl | 22:5c07298d3383 | 146 | // int32_t readTOS(uint16_t &value); |
lucaslwl | 22:5c07298d3383 | 147 | // |
lucaslwl | 22:5c07298d3383 | 148 | // /** |
lucaslwl | 22:5c07298d3383 | 149 | // * @brief Write the TOS register |
lucaslwl | 22:5c07298d3383 | 150 | // * @param value - 16-bit value to write |
lucaslwl | 22:5c07298d3383 | 151 | // * @return 0 on success, non-zero on failure |
lucaslwl | 22:5c07298d3383 | 152 | // */ |
lucaslwl | 22:5c07298d3383 | 153 | // int32_t writeTOS(const uint16_t value); |
lucaslwl | 22:5c07298d3383 | 154 | // |
lucaslwl | 22:5c07298d3383 | 155 | // /** |
lucaslwl | 22:5c07298d3383 | 156 | // * @brief Convert a raw temperature value into a float |
lucaslwl | 22:5c07298d3383 | 157 | // * @param rawTemp - raw temperature value to convert |
lucaslwl | 22:5c07298d3383 | 158 | // * @return the convereted value in degrees C |
lucaslwl | 22:5c07298d3383 | 159 | // */ |
lucaslwl | 22:5c07298d3383 | 160 | // float toCelsius(uint32_t rawTemp); |
lucaslwl | 22:5c07298d3383 | 161 | // |
lucaslwl | 22:5c07298d3383 | 162 | // /** |
lucaslwl | 22:5c07298d3383 | 163 | // * @brief Convert the passed in temperature in C to Fahrenheit |
lucaslwl | 22:5c07298d3383 | 164 | // * @param temperatureC Temperature in C to convert |
lucaslwl | 22:5c07298d3383 | 165 | // * @returns Returns the converted Fahrenheit value |
lucaslwl | 22:5c07298d3383 | 166 | // */ |
lucaslwl | 22:5c07298d3383 | 167 | // float toFahrenheit(float temperatureC); |
lucaslwl | 22:5c07298d3383 | 168 | // |
lucaslwl | 22:5c07298d3383 | 169 | //protected: |
lucaslwl | 22:5c07298d3383 | 170 | // |
lucaslwl | 22:5c07298d3383 | 171 | // /** |
lucaslwl | 22:5c07298d3383 | 172 | // * @brief Write register of device at slave address |
lucaslwl | 22:5c07298d3383 | 173 | // * @param reg - Register address |
lucaslwl | 22:5c07298d3383 | 174 | // * @param value - Value to write |
lucaslwl | 22:5c07298d3383 | 175 | // * @return 0 on success, non-zero on failure |
lucaslwl | 22:5c07298d3383 | 176 | // */ |
lucaslwl | 22:5c07298d3383 | 177 | // int32_t writeRegister(Registers_e reg, uint16_t value); |
lucaslwl | 22:5c07298d3383 | 178 | // |
lucaslwl | 22:5c07298d3383 | 179 | // /** |
lucaslwl | 22:5c07298d3383 | 180 | // * @brief Read register of device at slave address |
lucaslwl | 22:5c07298d3383 | 181 | // * @param reg - Register address |
lucaslwl | 22:5c07298d3383 | 182 | // * @param[out] value - Read data on success |
lucaslwl | 22:5c07298d3383 | 183 | // * @return 0 on success, non-zero on failure |
lucaslwl | 22:5c07298d3383 | 184 | // */ |
lucaslwl | 22:5c07298d3383 | 185 | // int32_t readRegister(Registers_e reg, uint16_t &value); |
lucaslwl | 22:5c07298d3383 | 186 | // |
lucaslwl | 22:5c07298d3383 | 187 | //private: |
lucaslwl | 22:5c07298d3383 | 188 | // /// I2C object |
lucaslwl | 22:5c07298d3383 | 189 | // I2C & m_i2c; |
lucaslwl | 22:5c07298d3383 | 190 | // /// Device slave addresses |
lucaslwl | 22:5c07298d3383 | 191 | // uint8_t m_writeAddress, m_readAddress; |
lucaslwl | 22:5c07298d3383 | 192 | //}; |
lucaslwl | 22:5c07298d3383 | 193 | // |
lucaslwl | 22:5c07298d3383 | 194 | //#endif /* __MAX30205_H_ */ |
lucaslwl | 22:5c07298d3383 | 195 | |
lucaslwl | 22:5c07298d3383 | 196 | |
lucaslwl | 22:5c07298d3383 | 197 | |
lucaslwl | 22:5c07298d3383 | 198 | /******************************************************************************* |
lucaslwl | 22:5c07298d3383 | 199 | * Copyright (C) 2016 Maxim Integrated Products, Inc., All Rights Reserved. |
lucaslwl | 22:5c07298d3383 | 200 | * |
lucaslwl | 22:5c07298d3383 | 201 | * Permission is hereby granted, free of charge, to any person obtaining a |
lucaslwl | 22:5c07298d3383 | 202 | * copy of this software and associated documentation files (the "Software"), |
lucaslwl | 22:5c07298d3383 | 203 | * to deal in the Software without restriction, including without limitation |
lucaslwl | 22:5c07298d3383 | 204 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, |
lucaslwl | 22:5c07298d3383 | 205 | * and/or sell copies of the Software, and to permit persons to whom the |
lucaslwl | 22:5c07298d3383 | 206 | * Software is furnished to do so, subject to the following conditions: |
lucaslwl | 22:5c07298d3383 | 207 | * |
lucaslwl | 22:5c07298d3383 | 208 | * The above copyright notice and this permission notice shall be included |
lucaslwl | 22:5c07298d3383 | 209 | * in all copies or substantial portions of the Software. |
lucaslwl | 22:5c07298d3383 | 210 | * |
lucaslwl | 22:5c07298d3383 | 211 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
lucaslwl | 22:5c07298d3383 | 212 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
lucaslwl | 22:5c07298d3383 | 213 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. |
lucaslwl | 22:5c07298d3383 | 214 | * IN NO EVENT SHALL MAXIM INTEGRATED BE LIABLE FOR ANY CLAIM, DAMAGES |
lucaslwl | 22:5c07298d3383 | 215 | * OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, |
lucaslwl | 22:5c07298d3383 | 216 | * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR |
lucaslwl | 22:5c07298d3383 | 217 | * OTHER DEALINGS IN THE SOFTWARE. |
lucaslwl | 22:5c07298d3383 | 218 | * |
lucaslwl | 22:5c07298d3383 | 219 | * Except as contained in this notice, the name of Maxim Integrated |
lucaslwl | 22:5c07298d3383 | 220 | * Products, Inc. shall not be used except as stated in the Maxim Integrated |
lucaslwl | 22:5c07298d3383 | 221 | * Products, Inc. Branding Policy. |
lucaslwl | 22:5c07298d3383 | 222 | * |
lucaslwl | 22:5c07298d3383 | 223 | * The mere transfer of this software does not imply any licenses |
lucaslwl | 22:5c07298d3383 | 224 | * of trade secrets, proprietary technology, copyrights, patents, |
lucaslwl | 22:5c07298d3383 | 225 | * trademarks, maskwork rights, or any other form of intellectual |
lucaslwl | 22:5c07298d3383 | 226 | * property whatsoever. Maxim Integrated Products, Inc. retains all |
lucaslwl | 22:5c07298d3383 | 227 | * ownership rights. |
lucaslwl | 22:5c07298d3383 | 228 | ******************************************************************************* |
lucaslwl | 22:5c07298d3383 | 229 | */ |
lucaslwl | 22:5c07298d3383 | 230 | #ifndef __MAX30205_H_ |
lucaslwl | 22:5c07298d3383 | 231 | #define __MAX30205_H_ |
lucaslwl | 22:5c07298d3383 | 232 | |
lucaslwl | 22:5c07298d3383 | 233 | #include "mbed.h" |
lucaslwl | 22:5c07298d3383 | 234 | |
lucaslwl | 22:5c07298d3383 | 235 | /** |
lucaslwl | 22:5c07298d3383 | 236 | * @brief Driver for the MAX30205 on the HSP Platform |
lucaslwl | 22:5c07298d3383 | 237 | */ |
lucaslwl | 22:5c07298d3383 | 238 | |
lucaslwl | 22:5c07298d3383 | 239 | class MAX30205 { |
lucaslwl | 22:5c07298d3383 | 240 | public: |
lucaslwl | 22:5c07298d3383 | 241 | ///< MAX30205 Register Addresses |
lucaslwl | 22:5c07298d3383 | 242 | typedef enum Registers { |
lucaslwl | 22:5c07298d3383 | 243 | MAX30205_Temperature = 0x00, |
lucaslwl | 22:5c07298d3383 | 244 | MAX30205_Configuration = 0x01, |
lucaslwl | 22:5c07298d3383 | 245 | MAX30205_THYST = 0x02, |
lucaslwl | 22:5c07298d3383 | 246 | MAX30205_TOS = 0x03 |
lucaslwl | 22:5c07298d3383 | 247 | } Registers_t; |
lucaslwl | 22:5c07298d3383 | 248 | |
lucaslwl | 22:5c07298d3383 | 249 | /** |
lucaslwl | 22:5c07298d3383 | 250 | * @brief Constructor using I2C PinNames |
lucaslwl | 22:5c07298d3383 | 251 | * @param sda Pinname for sda |
lucaslwl | 22:5c07298d3383 | 252 | * @param scl Pinname for scl |
lucaslwl | 22:5c07298d3383 | 253 | */ |
lucaslwl | 22:5c07298d3383 | 254 | MAX30205(PinName sda, PinName scl, int slaveAddress); |
lucaslwl | 22:5c07298d3383 | 255 | /** |
lucaslwl | 22:5c07298d3383 | 256 | * @brief Constructor using pointer to I2C object |
lucaslwl | 22:5c07298d3383 | 257 | * @param *i2c Pointer to I2C object |
lucaslwl | 22:5c07298d3383 | 258 | */ |
lucaslwl | 22:5c07298d3383 | 259 | MAX30205(I2C *i2c, int slaveAddress); |
lucaslwl | 22:5c07298d3383 | 260 | |
lucaslwl | 22:5c07298d3383 | 261 | /** @brief Destructor */ |
lucaslwl | 22:5c07298d3383 | 262 | ~MAX30205(void); |
lucaslwl | 22:5c07298d3383 | 263 | |
lucaslwl | 22:5c07298d3383 | 264 | /** @brief Write a register into device at slave address |
lucaslwl | 22:5c07298d3383 | 265 | * @param reg register address |
lucaslwl | 22:5c07298d3383 | 266 | * @param value value to write |
lucaslwl | 22:5c07298d3383 | 267 | */ |
lucaslwl | 22:5c07298d3383 | 268 | int reg_write(char reg, char value); |
lucaslwl | 22:5c07298d3383 | 269 | |
lucaslwl | 22:5c07298d3383 | 270 | /** |
lucaslwl | 22:5c07298d3383 | 271 | * @brief Detect the second instance of the MAX30205 |
lucaslwl | 22:5c07298d3383 | 272 | * @param reg register address |
lucaslwl | 22:5c07298d3383 | 273 | * @param value 8-bit value to writes |
lucaslwl | 22:5c07298d3383 | 274 | */ |
lucaslwl | 22:5c07298d3383 | 275 | int reg_read(char reg, char *value); |
lucaslwl | 22:5c07298d3383 | 276 | |
lucaslwl | 22:5c07298d3383 | 277 | /** |
lucaslwl | 22:5c07298d3383 | 278 | * @brief Write a 16-bit value into device at slave address |
lucaslwl | 22:5c07298d3383 | 279 | * @param reg register address |
lucaslwl | 22:5c07298d3383 | 280 | * @param value 16-bit value to write |
lucaslwl | 22:5c07298d3383 | 281 | */ |
lucaslwl | 22:5c07298d3383 | 282 | int reg_write16(char reg, uint16_t value); |
lucaslwl | 22:5c07298d3383 | 283 | |
lucaslwl | 22:5c07298d3383 | 284 | /** |
lucaslwl | 22:5c07298d3383 | 285 | * @brief Read a 16-bit value from a device at a slave address |
lucaslwl | 22:5c07298d3383 | 286 | * @param reg register address |
lucaslwl | 22:5c07298d3383 | 287 | * @param value pointer to store read value |
lucaslwl | 22:5c07298d3383 | 288 | */ |
lucaslwl | 22:5c07298d3383 | 289 | int reg_read16(char reg, uint16_t *value); |
lucaslwl | 22:5c07298d3383 | 290 | |
lucaslwl | 22:5c07298d3383 | 291 | /** |
lucaslwl | 22:5c07298d3383 | 292 | * @brief Read the temperature from the device into a 16 bit value |
lucaslwl | 22:5c07298d3383 | 293 | * @param value pointer to a 16 bit short |
lucaslwl | 22:5c07298d3383 | 294 | */ |
lucaslwl | 22:5c07298d3383 | 295 | int readTemperature(uint16_t *value); |
lucaslwl | 22:5c07298d3383 | 296 | |
lucaslwl | 22:5c07298d3383 | 297 | /** |
lucaslwl | 22:5c07298d3383 | 298 | * @brief Read the THYST value from a specified device instance |
lucaslwl | 22:5c07298d3383 | 299 | * @param value 16-bit pointer of value to read into |
lucaslwl | 22:5c07298d3383 | 300 | */ |
lucaslwl | 22:5c07298d3383 | 301 | int reg_THYST_Read(uint16_t *value); |
lucaslwl | 22:5c07298d3383 | 302 | |
lucaslwl | 22:5c07298d3383 | 303 | /** |
lucaslwl | 22:5c07298d3383 | 304 | * @brief Write the THYST to a device instance |
lucaslwl | 22:5c07298d3383 | 305 | * @param value 16-bit value to write |
lucaslwl | 22:5c07298d3383 | 306 | */ |
lucaslwl | 22:5c07298d3383 | 307 | int reg_THYST_Write(uint16_t value); |
lucaslwl | 22:5c07298d3383 | 308 | |
lucaslwl | 22:5c07298d3383 | 309 | /** |
lucaslwl | 22:5c07298d3383 | 310 | * @brief Convert a raw temperature value into a float |
lucaslwl | 22:5c07298d3383 | 311 | * @param rawTemp raw temperature value to convert |
lucaslwl | 22:5c07298d3383 | 312 | * @return the convereted value in degrees C |
lucaslwl | 22:5c07298d3383 | 313 | */ |
lucaslwl | 22:5c07298d3383 | 314 | float toCelsius(unsigned int rawTemp); |
lucaslwl | 22:5c07298d3383 | 315 | |
lucaslwl | 22:5c07298d3383 | 316 | /** |
lucaslwl | 22:5c07298d3383 | 317 | * @brief Convert the passed in temperature in C to Fahrenheit |
lucaslwl | 22:5c07298d3383 | 318 | * @param temperatureC Temperature in C to convert |
lucaslwl | 22:5c07298d3383 | 319 | * @returns Returns the converted Fahrenheit value |
lucaslwl | 22:5c07298d3383 | 320 | */ |
lucaslwl | 22:5c07298d3383 | 321 | float toFahrenheit(float temperatureC); |
lucaslwl | 22:5c07298d3383 | 322 | |
lucaslwl | 22:5c07298d3383 | 323 | private: |
lucaslwl | 22:5c07298d3383 | 324 | /** |
lucaslwl | 22:5c07298d3383 | 325 | * @brief I2C pointer |
lucaslwl | 22:5c07298d3383 | 326 | */ |
lucaslwl | 22:5c07298d3383 | 327 | I2C *i2c; |
lucaslwl | 22:5c07298d3383 | 328 | /** |
lucaslwl | 22:5c07298d3383 | 329 | * @brief Is this object the owner of the I2C object |
lucaslwl | 22:5c07298d3383 | 330 | */ |
lucaslwl | 22:5c07298d3383 | 331 | bool isOwner; |
lucaslwl | 22:5c07298d3383 | 332 | /** |
lucaslwl | 22:5c07298d3383 | 333 | * @brief Device slave address |
lucaslwl | 22:5c07298d3383 | 334 | */ |
lucaslwl | 22:5c07298d3383 | 335 | int slaveAddress; |
lucaslwl | 22:5c07298d3383 | 336 | }; |
lucaslwl | 22:5c07298d3383 | 337 | |
lucaslwl | 22:5c07298d3383 | 338 | #endif /* __MAX30205_H_ */ |