Maxim Integrated MAX30205 C, C++ source code driver software: MAX30205 is accurate to +-0.1°C over the range of 37.0°C to 39.0°C. One-shot, shutdown modes are available for reduced power usage. Thermostat thresholds allow for temperature hysteresis or for alarm settings. The MAX30205 is available in a compact 3x3 mm, 8-pin TDFN package. Operating supply voltage range is 2.7V to 3.3V. Typical applications are for clinical digital thermometers, thermostats with hysteresis, and temperature alarms.
Dependents: MAX30205_Human_Body_Temperature_Sensor
max30205.h@10:9c5dc1393570, 2019-04-17 (annotated)
- Committer:
- phonemacro
- Date:
- Wed Apr 17 21:13:54 2019 +0000
- Revision:
- 10:9c5dc1393570
- Parent:
- 9:d98e4a80a866
Updated comments
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
phonemacro | 9:d98e4a80a866 | 1 | /******************************************************************************* |
phonemacro | 9:d98e4a80a866 | 2 | * Copyright (C) 2019 Maxim Integrated Products, Inc., All Rights Reserved. |
phonemacro | 9:d98e4a80a866 | 3 | * |
phonemacro | 9:d98e4a80a866 | 4 | * Permission is hereby granted, free of charge, to any person obtaining a |
phonemacro | 9:d98e4a80a866 | 5 | * copy of this software and associated documentation files (the "Software"), |
phonemacro | 9:d98e4a80a866 | 6 | * to deal in the Software without restriction, including without limitation |
phonemacro | 9:d98e4a80a866 | 7 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, |
phonemacro | 9:d98e4a80a866 | 8 | * and/or sell copies of the Software, and to permit persons to whom the |
phonemacro | 9:d98e4a80a866 | 9 | * Software is furnished to do so, subject to the following conditions: |
phonemacro | 9:d98e4a80a866 | 10 | * |
phonemacro | 9:d98e4a80a866 | 11 | * The above copyright notice and this permission notice shall be included |
phonemacro | 9:d98e4a80a866 | 12 | * in all copies or substantial portions of the Software. |
phonemacro | 9:d98e4a80a866 | 13 | * |
phonemacro | 9:d98e4a80a866 | 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
phonemacro | 9:d98e4a80a866 | 15 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
phonemacro | 9:d98e4a80a866 | 16 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. |
phonemacro | 9:d98e4a80a866 | 17 | * IN NO EVENT SHALL MAXIM INTEGRATED BE LIABLE FOR ANY CLAIM, DAMAGES |
phonemacro | 9:d98e4a80a866 | 18 | * OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, |
phonemacro | 9:d98e4a80a866 | 19 | * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR |
phonemacro | 9:d98e4a80a866 | 20 | * OTHER DEALINGS IN THE SOFTWARE. |
phonemacro | 9:d98e4a80a866 | 21 | * |
phonemacro | 9:d98e4a80a866 | 22 | * Except as contained in this notice, the name of Maxim Integrated |
phonemacro | 9:d98e4a80a866 | 23 | * Products, Inc. shall not be used except as stated in the Maxim Integrated |
phonemacro | 9:d98e4a80a866 | 24 | * Products, Inc. Branding Policy. |
phonemacro | 9:d98e4a80a866 | 25 | * |
phonemacro | 9:d98e4a80a866 | 26 | * The mere transfer of this software does not imply any licenses |
phonemacro | 9:d98e4a80a866 | 27 | * of trade secrets, proprietary technology, copyrights, patents, |
phonemacro | 9:d98e4a80a866 | 28 | * trademarks, maskwork rights, or any other form of intellectual |
phonemacro | 9:d98e4a80a866 | 29 | * property whatsoever. Maxim Integrated Products, Inc. retains all |
phonemacro | 9:d98e4a80a866 | 30 | * ownership rights. |
phonemacro | 9:d98e4a80a866 | 31 | ******************************************************************************* |
phonemacro | 9:d98e4a80a866 | 32 | * @file MAX30205.h |
phonemacro | 9:d98e4a80a866 | 33 | ******************************************************************************* |
phonemacro | 9:d98e4a80a866 | 34 | */ |
phonemacro | 9:d98e4a80a866 | 35 | #ifndef MAX30205_H |
phonemacro | 9:d98e4a80a866 | 36 | #define MAX30205_H |
phonemacro | 9:d98e4a80a866 | 37 | #include "mbed.h" |
phonemacro | 9:d98e4a80a866 | 38 | |
phonemacro | 9:d98e4a80a866 | 39 | #define MAX30205_NO_ERROR 0 |
phonemacro | 9:d98e4a80a866 | 40 | #define MAX30205_ERROR -1 |
phonemacro | 9:d98e4a80a866 | 41 | |
phonemacro | 9:d98e4a80a866 | 42 | #define MAX30205_REG_TEMPERATURE 0X00 |
phonemacro | 9:d98e4a80a866 | 43 | #define MAX30205_REG_CONFIGURATION 0X01 |
phonemacro | 9:d98e4a80a866 | 44 | #define MAX30205_REG_THYST_LOW_TRIP 0X02 |
phonemacro | 9:d98e4a80a866 | 45 | #define MAX30205_REG_TOS_HIGH_TRIP 0X03 |
phonemacro | 9:d98e4a80a866 | 46 | #define MAX30205_REG_MAX 0X03 |
phonemacro | 9:d98e4a80a866 | 47 | |
phonemacro | 9:d98e4a80a866 | 48 | #define WAIT_MARGIN (0.0000) |
phonemacro | 9:d98e4a80a866 | 49 | #define MAX30205_WAIT_CONV_TIME (.050+WAIT_MARGIN) |
phonemacro | 9:d98e4a80a866 | 50 | |
phonemacro | 9:d98e4a80a866 | 51 | #define MAX30205_CFG_CONTINUOUS (0X00 << 0) |
phonemacro | 9:d98e4a80a866 | 52 | #define MAX30205_CFG_SHUTDOWN (0X01 << 0) |
phonemacro | 9:d98e4a80a866 | 53 | |
phonemacro | 9:d98e4a80a866 | 54 | #define MAX30205_CFG_COMPARATOR_MODE (0X00 << 1) |
phonemacro | 9:d98e4a80a866 | 55 | #define MAX30205_CFG_INTERRUPT_MODE (0X01 << 1) |
phonemacro | 9:d98e4a80a866 | 56 | |
phonemacro | 9:d98e4a80a866 | 57 | #define MAX30205_CFG_OS_POLARITY_ACT_LOW (0x00 << 2) |
phonemacro | 9:d98e4a80a866 | 58 | #define MAX30205_CFG_OS_POLARITY_ACT_HIGH (0x01 << 2) |
phonemacro | 9:d98e4a80a866 | 59 | |
phonemacro | 9:d98e4a80a866 | 60 | #define MAX30205_CFG_FAULT_FILTER_1 (0x00 << 3) |
phonemacro | 9:d98e4a80a866 | 61 | #define MAX30205_CFG_FAULT_FILTER_2 (0x01 << 3) |
phonemacro | 9:d98e4a80a866 | 62 | #define MAX30205_CFG_FAULT_FILTER_4 (0x02 << 3) |
phonemacro | 9:d98e4a80a866 | 63 | #define MAX30205_CFG_FAULT_FILTER_6 (0x03 << 3) |
phonemacro | 9:d98e4a80a866 | 64 | |
phonemacro | 9:d98e4a80a866 | 65 | #define MAX30205_CFG_NORMAL_FORMAT (0x00 << 5) |
phonemacro | 9:d98e4a80a866 | 66 | #define MAX30205_CFG_EXTENDED_FORMAT (0x01 << 5) /* add 64°C to temperature */ |
phonemacro | 9:d98e4a80a866 | 67 | #define MAX30205_EXTENDED_FORMAT_OFFSET (64.0f) |
phonemacro | 9:d98e4a80a866 | 68 | #define MAX30205_CFG_TIMEOUT_ENABLE (0X00 << 6) |
phonemacro | 9:d98e4a80a866 | 69 | #define MAX30205_CFG_TIMEOUT_DISABLE (0X01 << 6) |
phonemacro | 9:d98e4a80a866 | 70 | #define MAX30205_CFG_ONE_SHOT_START (0X01 << 7) |
phonemacro | 9:d98e4a80a866 | 71 | |
phonemacro | 9:d98e4a80a866 | 72 | /* A1 A2 A3 */ |
phonemacro | 9:d98e4a80a866 | 73 | #define MAX30205_I2C_SLAVE_ADR_00 (0x90 >> 1) /* GND GND GND */ |
phonemacro | 9:d98e4a80a866 | 74 | #define MAX30205_I2C_SLAVE_ADR_01 (0x92 >> 1) /* GND GND VDD */ |
phonemacro | 9:d98e4a80a866 | 75 | #define MAX30205_I2C_SLAVE_ADR_02 (0x82 >> 1) /* GND GND SCL */ |
phonemacro | 9:d98e4a80a866 | 76 | #define MAX30205_I2C_SLAVE_ADR_03 (0x80 >> 1) /* GND GND SDA */ |
phonemacro | 9:d98e4a80a866 | 77 | #define MAX30205_I2C_SLAVE_ADR_04 (0x94 >> 1) /* GND VDD GND */ |
phonemacro | 9:d98e4a80a866 | 78 | |
phonemacro | 9:d98e4a80a866 | 79 | #define MAX30205_I2C_SLAVE_ADR_05 (0x96 >> 1) /* GND VDD VDD */ |
phonemacro | 9:d98e4a80a866 | 80 | #define MAX30205_I2C_SLAVE_ADR_06 (0x86 >> 1) /* GND VDD SCL */ |
phonemacro | 9:d98e4a80a866 | 81 | #define MAX30205_I2C_SLAVE_ADR_07 (0x84 >> 1) /* GND VDD SDA */ |
phonemacro | 9:d98e4a80a866 | 82 | #define MAX30205_I2C_SLAVE_ADR_08 (0xB4 >> 1) /* GND SCL GND */ |
phonemacro | 9:d98e4a80a866 | 83 | #define MAX30205_I2C_SLAVE_ADR_09 (0xB6 >> 1) /* GND SCL VDD */ |
phonemacro | 9:d98e4a80a866 | 84 | |
phonemacro | 9:d98e4a80a866 | 85 | #define MAX30205_I2C_SLAVE_ADR_10 (0xA6 >> 1) /* GND SCL SCL */ |
phonemacro | 9:d98e4a80a866 | 86 | #define MAX30205_I2C_SLAVE_ADR_11 (0xA4 >> 1) /* GND SCL SDA */ |
phonemacro | 9:d98e4a80a866 | 87 | #define MAX30205_I2C_SLAVE_ADR_12 (0xB0 >> 1) /* GND SDA GND */ |
phonemacro | 9:d98e4a80a866 | 88 | #define MAX30205_I2C_SLAVE_ADR_13 (0xB2 >> 1) /* GND SDA VDD */ |
phonemacro | 9:d98e4a80a866 | 89 | #define MAX30205_I2C_SLAVE_ADR_14 (0xA2 >> 1) /* GND SDA SCL */ |
phonemacro | 9:d98e4a80a866 | 90 | |
phonemacro | 9:d98e4a80a866 | 91 | #define MAX30205_I2C_SLAVE_ADR_15 (0xA0 >> 1) /* GND SDA SDA */ |
phonemacro | 9:d98e4a80a866 | 92 | #define MAX30205_I2C_SLAVE_ADR_16 (0x98 >> 1) /* VDD GND GND */ |
phonemacro | 9:d98e4a80a866 | 93 | #define MAX30205_I2C_SLAVE_ADR_17 (0x9A >> 1) /* VDD GND VDD */ |
phonemacro | 9:d98e4a80a866 | 94 | #define MAX30205_I2C_SLAVE_ADR_18 (0x8A >> 1) /* VDD GND SCL */ |
phonemacro | 9:d98e4a80a866 | 95 | #define MAX30205_I2C_SLAVE_ADR_19 (0x88 >> 1) /* VDD GND SDA */ |
phonemacro | 9:d98e4a80a866 | 96 | |
phonemacro | 9:d98e4a80a866 | 97 | #define MAX30205_I2C_SLAVE_ADR_20 (0x9C >> 1) /* VDD VDD GND */ |
phonemacro | 9:d98e4a80a866 | 98 | #define MAX30205_I2C_SLAVE_ADR_21 (0x9E >> 1) /* VDD VDD VDD */ |
phonemacro | 9:d98e4a80a866 | 99 | #define MAX30205_I2C_SLAVE_ADR_22 (0x8E >> 1) /* VDD VDD SCL */ |
phonemacro | 9:d98e4a80a866 | 100 | #define MAX30205_I2C_SLAVE_ADR_23 (0x8C >> 1) /* VDD VDD SDA */ |
phonemacro | 9:d98e4a80a866 | 101 | #define MAX30205_I2C_SLAVE_ADR_24 (0xBC >> 1) /* VDD SCL GND */ |
phonemacro | 9:d98e4a80a866 | 102 | |
phonemacro | 9:d98e4a80a866 | 103 | #define MAX30205_I2C_SLAVE_ADR_25 (0xBE >> 1) /* VDD SCL VDD */ |
phonemacro | 9:d98e4a80a866 | 104 | #define MAX30205_I2C_SLAVE_ADR_26 (0xAE >> 1) /* VDD SCL SCL */ |
phonemacro | 9:d98e4a80a866 | 105 | #define MAX30205_I2C_SLAVE_ADR_27 (0xAC >> 1) /* VDD SCL SDA */ |
phonemacro | 9:d98e4a80a866 | 106 | #define MAX30205_I2C_SLAVE_ADR_28 (0xB8 >> 1) /* VDD SDA GND */ |
phonemacro | 9:d98e4a80a866 | 107 | #define MAX30205_I2C_SLAVE_ADR_29 (0xBA >> 1) /* VDD SDA VDD */ |
phonemacro | 9:d98e4a80a866 | 108 | |
phonemacro | 9:d98e4a80a866 | 109 | #define MAX30205_I2C_SLAVE_ADR_30 (0xAA >> 1) /* VDD SDA SCL */ |
phonemacro | 9:d98e4a80a866 | 110 | #define MAX30205_I2C_SLAVE_ADR_31 (0xA8 >> 1) /* VDD SDA SDA */ |
phonemacro | 9:d98e4a80a866 | 111 | |
phonemacro | 9:d98e4a80a866 | 112 | #define MAX30205_CF_LSB (0.00390625F) |
phonemacro | 9:d98e4a80a866 | 113 | |
phonemacro | 9:d98e4a80a866 | 114 | /** @union max30205_raw_data |
phonemacro | 9:d98e4a80a866 | 115 | * @brief union data structure for byte word manipulations |
phonemacro | 9:d98e4a80a866 | 116 | */ |
phonemacro | 9:d98e4a80a866 | 117 | union max30205_raw_data { |
phonemacro | 9:d98e4a80a866 | 118 | struct { |
phonemacro | 9:d98e4a80a866 | 119 | uint8_t lsb; |
phonemacro | 9:d98e4a80a866 | 120 | uint8_t msb; |
phonemacro | 9:d98e4a80a866 | 121 | }; |
phonemacro | 9:d98e4a80a866 | 122 | struct { |
phonemacro | 9:d98e4a80a866 | 123 | uint16_t magnitude_bits:15; |
phonemacro | 9:d98e4a80a866 | 124 | uint16_t sign_bit:1; |
phonemacro | 9:d98e4a80a866 | 125 | }; |
phonemacro | 9:d98e4a80a866 | 126 | uint16_t uwrd; |
phonemacro | 9:d98e4a80a866 | 127 | int16_t swrd; |
phonemacro | 9:d98e4a80a866 | 128 | }; |
phonemacro | 9:d98e4a80a866 | 129 | |
phonemacro | 9:d98e4a80a866 | 130 | #endif/* MAX31875_H */ |