C, C++ source code driver software for the Maxim Integrated MAX31725, MAX31726 thermostat : The MAX31725, MAX31726 temperature sensors provides temperature measurements with an accuracy of up to +-0.5°C. Extended format allows for high temperature readings up to 150°C. The MAX31725 can operate in a low powered mode by utilizing the shutdown and one-shot mode. MAX31725 supports two-wire serial, I2C bus communications in an 8-pin TQDFN 3x3 mm package.
Dependents: MAX31725_High_Temperature_Accurate_IC
max31725.h@22:692515ac2bb7, 2019-04-09 (annotated)
- Committer:
- phonemacro
- Date:
- Tue Apr 09 22:58:02 2019 +0000
- Revision:
- 22:692515ac2bb7
- Parent:
- 20:c9805b01e814
- Child:
- 23:3fa31b45fa1a
add max31725 i2c addresses
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
phonemacro | 20:c9805b01e814 | 1 | /******************************************************************************* |
phonemacro | 20:c9805b01e814 | 2 | * Copyright (C) 2019 Maxim Integrated Products, Inc., All Rights Reserved. |
phonemacro | 20:c9805b01e814 | 3 | * |
phonemacro | 20:c9805b01e814 | 4 | * Permission is hereby granted, free of charge, to any person obtaining a |
phonemacro | 20:c9805b01e814 | 5 | * copy of this software and associated documentation files (the "Software"), |
phonemacro | 20:c9805b01e814 | 6 | * to deal in the Software without restriction, including without limitation |
phonemacro | 20:c9805b01e814 | 7 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, |
phonemacro | 20:c9805b01e814 | 8 | * and/or sell copies of the Software, and to permit persons to whom the |
phonemacro | 20:c9805b01e814 | 9 | * Software is furnished to do so, subject to the following conditions: |
phonemacro | 20:c9805b01e814 | 10 | * |
phonemacro | 20:c9805b01e814 | 11 | * The above copyright notice and this permission notice shall be included |
phonemacro | 20:c9805b01e814 | 12 | * in all copies or substantial portions of the Software. |
phonemacro | 20:c9805b01e814 | 13 | * |
phonemacro | 20:c9805b01e814 | 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
phonemacro | 20:c9805b01e814 | 15 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
phonemacro | 20:c9805b01e814 | 16 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. |
phonemacro | 20:c9805b01e814 | 17 | * IN NO EVENT SHALL MAXIM INTEGRATED BE LIABLE FOR ANY CLAIM, DAMAGES |
phonemacro | 20:c9805b01e814 | 18 | * OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, |
phonemacro | 20:c9805b01e814 | 19 | * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR |
phonemacro | 20:c9805b01e814 | 20 | * OTHER DEALINGS IN THE SOFTWARE. |
phonemacro | 20:c9805b01e814 | 21 | * |
phonemacro | 20:c9805b01e814 | 22 | * Except as contained in this notice, the name of Maxim Integrated |
phonemacro | 20:c9805b01e814 | 23 | * Products, Inc. shall not be used except as stated in the Maxim Integrated |
phonemacro | 20:c9805b01e814 | 24 | * Products, Inc. Branding Policy. |
phonemacro | 20:c9805b01e814 | 25 | * |
phonemacro | 20:c9805b01e814 | 26 | * The mere transfer of this software does not imply any licenses |
phonemacro | 20:c9805b01e814 | 27 | * of trade secrets, proprietary technology, copyrights, patents, |
phonemacro | 20:c9805b01e814 | 28 | * trademarks, maskwork rights, or any other form of intellectual |
phonemacro | 20:c9805b01e814 | 29 | * property whatsoever. Maxim Integrated Products, Inc. retains all |
phonemacro | 20:c9805b01e814 | 30 | * ownership rights. |
phonemacro | 20:c9805b01e814 | 31 | ******************************************************************************* |
phonemacro | 20:c9805b01e814 | 32 | * @file MAX31725.h |
phonemacro | 20:c9805b01e814 | 33 | ******************************************************************************* |
phonemacro | 20:c9805b01e814 | 34 | */ |
phonemacro | 20:c9805b01e814 | 35 | #ifndef MAX31725_H |
phonemacro | 20:c9805b01e814 | 36 | #define MAX31725_H |
phonemacro | 20:c9805b01e814 | 37 | #include "mbed.h" |
phonemacro | 20:c9805b01e814 | 38 | |
phonemacro | 20:c9805b01e814 | 39 | #define MAX31725_NO_ERROR 0 |
phonemacro | 20:c9805b01e814 | 40 | #define MAX31725_ERROR -1 |
phonemacro | 20:c9805b01e814 | 41 | |
phonemacro | 20:c9805b01e814 | 42 | #define MAX31725_REG_TEMPERATURE 0X00 |
phonemacro | 20:c9805b01e814 | 43 | #define MAX31725_REG_CONFIGURATION 0X01 |
phonemacro | 20:c9805b01e814 | 44 | #define MAX31725_REG_THYST_LOW_TRIP 0X02 |
phonemacro | 20:c9805b01e814 | 45 | #define MAX31725_REG_TOS_HIGH_TRIP 0X03 |
phonemacro | 20:c9805b01e814 | 46 | #define MAX31725_REG_MAX 0X03 |
phonemacro | 20:c9805b01e814 | 47 | |
phonemacro | 20:c9805b01e814 | 48 | #define WAIT_MARGIN (0.0000) |
phonemacro | 20:c9805b01e814 | 49 | #define MAX31725_WAIT_CONV_TIME (.050+WAIT_MARGIN) |
phonemacro | 20:c9805b01e814 | 50 | |
phonemacro | 20:c9805b01e814 | 51 | #define MAX31725_CFG_CONTINUOUS (0X00 << 0) |
phonemacro | 20:c9805b01e814 | 52 | #define MAX31725_CFG_SHUTDOWN (0X01 << 0) |
phonemacro | 20:c9805b01e814 | 53 | |
phonemacro | 20:c9805b01e814 | 54 | #define MAX31725_CFG_COMPARATOR_MODE (0X00 << 1) |
phonemacro | 20:c9805b01e814 | 55 | #define MAX31725_CFG_INTERRUPT_MODE (0X01 << 1) |
phonemacro | 20:c9805b01e814 | 56 | |
phonemacro | 20:c9805b01e814 | 57 | #define MAX31725_CFG_OS_POLARITY_ACT_LOW (0x00 << 2) |
phonemacro | 20:c9805b01e814 | 58 | #define MAX31725_CFG_OS_POLARITY_ACT_HIGH (0x01 << 2) |
phonemacro | 20:c9805b01e814 | 59 | |
phonemacro | 20:c9805b01e814 | 60 | #define MAX31725_CFG_FAULT_FILTER_1 (0x00 << 3) |
phonemacro | 20:c9805b01e814 | 61 | #define MAX31725_CFG_FAULT_FILTER_2 (0x01 << 3) |
phonemacro | 20:c9805b01e814 | 62 | #define MAX31725_CFG_FAULT_FILTER_4 (0x02 << 3) |
phonemacro | 20:c9805b01e814 | 63 | #define MAX31725_CFG_FAULT_FILTER_6 (0x03 << 3) |
phonemacro | 20:c9805b01e814 | 64 | |
phonemacro | 20:c9805b01e814 | 65 | #define MAX31725_CFG_NORMAL_FORMAT (0x00 << 5) |
phonemacro | 20:c9805b01e814 | 66 | #define MAX31725_CFG_EXTENDED_FORMAT (0x01 << 5) /* add 64°C to temperature */ |
phonemacro | 20:c9805b01e814 | 67 | #define MAX31725_EXTENDED_FORMAT_OFFSET (64.0f) |
phonemacro | 20:c9805b01e814 | 68 | #define MAX31725_CFG_TIMEOUT_ENABLE (0X00 << 6) |
phonemacro | 20:c9805b01e814 | 69 | #define MAX31725_CFG_TIMEOUT_DISABLE (0X01 << 6) |
phonemacro | 20:c9805b01e814 | 70 | #define MAX31725_CFG_ONE_SHOT_START (0X01 << 7) |
phonemacro | 20:c9805b01e814 | 71 | |
phonemacro | 20:c9805b01e814 | 72 | |
phonemacro | 22:692515ac2bb7 | 73 | #define MAX31725_I2C_SLAVE_ADR_00 (0x90 >> 1) |
phonemacro | 22:692515ac2bb7 | 74 | #define MAX31725_I2C_SLAVE_ADR_01 (0x92 >> 1) |
phonemacro | 22:692515ac2bb7 | 75 | #define MAX31725_I2C_SLAVE_ADR_02 (0x82 >> 1) |
phonemacro | 22:692515ac2bb7 | 76 | #define MAX31725_I2C_SLAVE_ADR_03 (0x80 >> 1) |
phonemacro | 22:692515ac2bb7 | 77 | #define MAX31725_I2C_SLAVE_ADR_04 (0x94 >> 1) |
phonemacro | 22:692515ac2bb7 | 78 | |
phonemacro | 22:692515ac2bb7 | 79 | #define MAX31725_I2C_SLAVE_ADR_05 (0x96 >> 1) |
phonemacro | 22:692515ac2bb7 | 80 | #define MAX31725_I2C_SLAVE_ADR_06 (0x86 >> 1) |
phonemacro | 22:692515ac2bb7 | 81 | #define MAX31725_I2C_SLAVE_ADR_07 (0x84 >> 1) |
phonemacro | 22:692515ac2bb7 | 82 | #define MAX31725_I2C_SLAVE_ADR_08 (0xB4 >> 1) |
phonemacro | 22:692515ac2bb7 | 83 | #define MAX31725_I2C_SLAVE_ADR_09 (0xB6 >> 1) |
phonemacro | 22:692515ac2bb7 | 84 | |
phonemacro | 22:692515ac2bb7 | 85 | #define MAX31725_I2C_SLAVE_ADR_10 (0xA6 >> 1) |
phonemacro | 22:692515ac2bb7 | 86 | #define MAX31725_I2C_SLAVE_ADR_11 (0xA4 >> 1) |
phonemacro | 22:692515ac2bb7 | 87 | #define MAX31725_I2C_SLAVE_ADR_12 (0xB0 >> 1) |
phonemacro | 22:692515ac2bb7 | 88 | #define MAX31725_I2C_SLAVE_ADR_13 (0xB2 >> 1) |
phonemacro | 22:692515ac2bb7 | 89 | #define MAX31725_I2C_SLAVE_ADR_14 (0xA2 >> 1) |
phonemacro | 22:692515ac2bb7 | 90 | |
phonemacro | 22:692515ac2bb7 | 91 | #define MAX31725_I2C_SLAVE_ADR_15 (0xA0 >> 1) |
phonemacro | 22:692515ac2bb7 | 92 | #define MAX31725_I2C_SLAVE_ADR_16 (0x98 >> 1) |
phonemacro | 22:692515ac2bb7 | 93 | #define MAX31725_I2C_SLAVE_ADR_17 (0x9A >> 1) |
phonemacro | 22:692515ac2bb7 | 94 | #define MAX31725_I2C_SLAVE_ADR_18 (0x8A >> 1) |
phonemacro | 22:692515ac2bb7 | 95 | #define MAX31725_I2C_SLAVE_ADR_19 (0x88 >> 1) |
phonemacro | 22:692515ac2bb7 | 96 | |
phonemacro | 22:692515ac2bb7 | 97 | #define MAX31725_I2C_SLAVE_ADR_20 (0x9C >> 1) |
phonemacro | 22:692515ac2bb7 | 98 | #define MAX31725_I2C_SLAVE_ADR_21 (0x9E >> 1) |
phonemacro | 22:692515ac2bb7 | 99 | #define MAX31725_I2C_SLAVE_ADR_22 (0x8E >> 1) |
phonemacro | 22:692515ac2bb7 | 100 | #define MAX31725_I2C_SLAVE_ADR_23 (0x8C >> 1) |
phonemacro | 22:692515ac2bb7 | 101 | #define MAX31725_I2C_SLAVE_ADR_24 (0xBC >> 1) |
phonemacro | 22:692515ac2bb7 | 102 | |
phonemacro | 22:692515ac2bb7 | 103 | #define MAX31725_I2C_SLAVE_ADR_25 (0xBE >> 1) |
phonemacro | 22:692515ac2bb7 | 104 | #define MAX31725_I2C_SLAVE_ADR_26 (0xAE >> 1) |
phonemacro | 22:692515ac2bb7 | 105 | #define MAX31725_I2C_SLAVE_ADR_27 (0xAC >> 1) |
phonemacro | 22:692515ac2bb7 | 106 | #define MAX31725_I2C_SLAVE_ADR_28 (0xB8 >> 1) |
phonemacro | 22:692515ac2bb7 | 107 | #define MAX31725_I2C_SLAVE_ADR_29 (0xBA >> 1) |
phonemacro | 22:692515ac2bb7 | 108 | |
phonemacro | 22:692515ac2bb7 | 109 | #define MAX31725_I2C_SLAVE_ADR_30 (0xAA >> 1) |
phonemacro | 22:692515ac2bb7 | 110 | #define MAX31725_I2C_SLAVE_ADR_31 (0xA8 >> 1) |
phonemacro | 22:692515ac2bb7 | 111 | |
phonemacro | 22:692515ac2bb7 | 112 | #define MAX31726_I2C_SLAVE_ADR_00 (0x98 >> 1) |
phonemacro | 22:692515ac2bb7 | 113 | #define MAX31726_I2C_SLAVE_ADR_01 (0x9A >> 1) |
phonemacro | 22:692515ac2bb7 | 114 | #define MAX31726_I2C_SLAVE_ADR_02 (0x8A >> 1) |
phonemacro | 22:692515ac2bb7 | 115 | #define MAX31726_I2C_SLAVE_ADR_03 (0x88 >> 1) |
phonemacro | 22:692515ac2bb7 | 116 | #define MAX31726_I2C_SLAVE_ADR_04 (0x9C >> 1) |
phonemacro | 22:692515ac2bb7 | 117 | |
phonemacro | 22:692515ac2bb7 | 118 | #define MAX31726_I2C_SLAVE_ADR_05 (0x9E >> 1) |
phonemacro | 22:692515ac2bb7 | 119 | #define MAX31726_I2C_SLAVE_ADR_06 (0x8E >> 1) |
phonemacro | 22:692515ac2bb7 | 120 | #define MAX31726_I2C_SLAVE_ADR_07 (0x8C >> 1) |
phonemacro | 22:692515ac2bb7 | 121 | #define MAX31726_I2C_SLAVE_ADR_08 (0xBC >> 1) |
phonemacro | 22:692515ac2bb7 | 122 | #define MAX31726_I2C_SLAVE_ADR_09 (0xBE >> 1) |
phonemacro | 22:692515ac2bb7 | 123 | |
phonemacro | 22:692515ac2bb7 | 124 | #define MAX31726_I2C_SLAVE_ADR_10 (0xAE >> 1) |
phonemacro | 22:692515ac2bb7 | 125 | #define MAX31726_I2C_SLAVE_ADR_11 (0xAC >> 1) |
phonemacro | 22:692515ac2bb7 | 126 | #define MAX31726_I2C_SLAVE_ADR_12 (0xB8 >> 1) |
phonemacro | 22:692515ac2bb7 | 127 | #define MAX31726_I2C_SLAVE_ADR_13 (0xBA >> 1) |
phonemacro | 22:692515ac2bb7 | 128 | #define MAX31726_I2C_SLAVE_ADR_14 (0xAA >> 1) |
phonemacro | 22:692515ac2bb7 | 129 | |
phonemacro | 22:692515ac2bb7 | 130 | #define MAX31726_I2C_SLAVE_ADR_15 (0xA8 >> 1) |
phonemacro | 22:692515ac2bb7 | 131 | |
phonemacro | 20:c9805b01e814 | 132 | |
phonemacro | 20:c9805b01e814 | 133 | #define MAX31725_CF_LSB (0.00390625F) |
phonemacro | 20:c9805b01e814 | 134 | |
phonemacro | 20:c9805b01e814 | 135 | /** @union max31725_raw_data |
phonemacro | 20:c9805b01e814 | 136 | * @brief union data structure for byte word manipulations |
phonemacro | 20:c9805b01e814 | 137 | */ |
phonemacro | 20:c9805b01e814 | 138 | union max31725_raw_data { |
phonemacro | 20:c9805b01e814 | 139 | struct { |
phonemacro | 20:c9805b01e814 | 140 | uint8_t lsb; |
phonemacro | 20:c9805b01e814 | 141 | uint8_t msb; |
phonemacro | 20:c9805b01e814 | 142 | }; |
phonemacro | 20:c9805b01e814 | 143 | struct { |
phonemacro | 20:c9805b01e814 | 144 | uint16_t magnitude_bits:15; |
phonemacro | 20:c9805b01e814 | 145 | uint16_t sign_bit:1; |
phonemacro | 20:c9805b01e814 | 146 | }; |
phonemacro | 20:c9805b01e814 | 147 | uint16_t uwrd; |
phonemacro | 20:c9805b01e814 | 148 | int16_t swrd; |
phonemacro | 20:c9805b01e814 | 149 | }; |
phonemacro | 20:c9805b01e814 | 150 | |
phonemacro | 20:c9805b01e814 | 151 | #endif/* MAX31875_H */ |