David Jung / MAX31725_Accurate_Temperature_Sensor

Dependents:   MAX31725_High_Temperature_Accurate_IC

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers max31725.h Source File

max31725.h

00001 /*******************************************************************************
00002 * Copyright (C) 2019 Maxim Integrated Products, Inc., All Rights Reserved.
00003 *
00004 * Permission is hereby granted, free of charge, to any person obtaining a
00005 * copy of this software and associated documentation files (the "Software"),
00006 * to deal in the Software without restriction, including without limitation
00007 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
00008 * and/or sell copies of the Software, and to permit persons to whom the
00009 * Software is furnished to do so, subject to the following conditions:
00010 *
00011 * The above copyright notice and this permission notice shall be included
00012 * in all copies or substantial portions of the Software.
00013 *
00014 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
00015 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
00016 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
00017 * IN NO EVENT SHALL MAXIM INTEGRATED BE LIABLE FOR ANY CLAIM, DAMAGES
00018 * OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
00019 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
00020 * OTHER DEALINGS IN THE SOFTWARE.
00021 *
00022 * Except as contained in this notice, the name of Maxim Integrated
00023 * Products, Inc. shall not be used except as stated in the Maxim Integrated
00024 * Products, Inc. Branding Policy.
00025 *
00026 * The mere transfer of this software does not imply any licenses
00027 * of trade secrets, proprietary technology, copyrights, patents,
00028 * trademarks, maskwork rights, or any other form of intellectual
00029 * property whatsoever. Maxim Integrated Products, Inc. retains all
00030 * ownership rights.
00031 *******************************************************************************
00032 * @file MAX31725.h
00033 *******************************************************************************
00034 */
00035 #ifndef MAX31725_H
00036 #define MAX31725_H
00037 #include "mbed.h"
00038 
00039 #define MAX31725_NO_ERROR   0
00040 #define MAX31725_ERROR      -1
00041 
00042 #define MAX31725_REG_TEMPERATURE      0X00
00043 #define MAX31725_REG_CONFIGURATION    0X01
00044 #define MAX31725_REG_THYST_LOW_TRIP   0X02 
00045 #define MAX31725_REG_TOS_HIGH_TRIP    0X03 
00046 #define MAX31725_REG_MAX              0X03
00047 
00048 #define WAIT_MARGIN (0.0000)
00049 #define MAX31725_WAIT_CONV_TIME  (.050+WAIT_MARGIN)
00050 
00051 #define MAX31725_CFG_CONTINUOUS       (0X00 << 0)
00052 #define MAX31725_CFG_SHUTDOWN         (0X01 << 0)
00053 
00054 #define MAX31725_CFG_COMPARATOR_MODE  (0X00 << 1)
00055 #define MAX31725_CFG_INTERRUPT_MODE   (0X01 << 1)
00056 
00057 #define MAX31725_CFG_OS_POLARITY_ACT_LOW  (0x00 << 2)
00058 #define MAX31725_CFG_OS_POLARITY_ACT_HIGH (0x01 << 2)
00059 
00060 #define MAX31725_CFG_FAULT_FILTER_1   (0x00 << 3)
00061 #define MAX31725_CFG_FAULT_FILTER_2   (0x01 << 3)
00062 #define MAX31725_CFG_FAULT_FILTER_4   (0x02 << 3)
00063 #define MAX31725_CFG_FAULT_FILTER_6   (0x03 << 3)
00064 
00065 #define MAX31725_CFG_NORMAL_FORMAT    (0x00 << 5)
00066 #define MAX31725_CFG_EXTENDED_FORMAT  (0x01 << 5)  /* add 64°C to temperature */
00067 #define MAX31725_EXTENDED_FORMAT_OFFSET (64.0f)
00068 #define MAX31725_CFG_TIMEOUT_ENABLE   (0X00 << 6)
00069 #define MAX31725_CFG_TIMEOUT_DISABLE  (0X01 << 6)
00070 #define MAX31725_CFG_ONE_SHOT_START   (0X01 << 7)
00071 
00072                                                /* A1  A2  A3  */
00073 #define MAX31725_I2C_SLAVE_ADR_00 (0x90 >> 1)  /* GND GND GND */
00074 #define MAX31725_I2C_SLAVE_ADR_01 (0x92 >> 1)  /* GND GND VDD */
00075 #define MAX31725_I2C_SLAVE_ADR_02 (0x82 >> 1)  /* GND GND SCL */
00076 #define MAX31725_I2C_SLAVE_ADR_03 (0x80 >> 1)  /* GND GND SDA */
00077 #define MAX31725_I2C_SLAVE_ADR_04 (0x94 >> 1)  /* GND VDD GND */
00078                                               
00079 #define MAX31725_I2C_SLAVE_ADR_05 (0x96 >> 1)  /* GND VDD VDD */
00080 #define MAX31725_I2C_SLAVE_ADR_06 (0x86 >> 1)  /* GND VDD SCL */
00081 #define MAX31725_I2C_SLAVE_ADR_07 (0x84 >> 1)  /* GND VDD SDA */
00082 #define MAX31725_I2C_SLAVE_ADR_08 (0xB4 >> 1)  /* GND SCL GND */
00083 #define MAX31725_I2C_SLAVE_ADR_09 (0xB6 >> 1)  /* GND SCL VDD */
00084                                               
00085 #define MAX31725_I2C_SLAVE_ADR_10 (0xA6 >> 1)  /* GND SCL SCL */
00086 #define MAX31725_I2C_SLAVE_ADR_11 (0xA4 >> 1)  /* GND SCL SDA */
00087 #define MAX31725_I2C_SLAVE_ADR_12 (0xB0 >> 1)  /* GND SDA GND */
00088 #define MAX31725_I2C_SLAVE_ADR_13 (0xB2 >> 1)  /* GND SDA VDD */
00089 #define MAX31725_I2C_SLAVE_ADR_14 (0xA2 >> 1)  /* GND SDA SCL */
00090                                               
00091 #define MAX31725_I2C_SLAVE_ADR_15 (0xA0 >> 1)  /* GND SDA SDA */
00092 #define MAX31725_I2C_SLAVE_ADR_16 (0x98 >> 1)  /* VDD GND GND */
00093 #define MAX31725_I2C_SLAVE_ADR_17 (0x9A >> 1)  /* VDD GND VDD */
00094 #define MAX31725_I2C_SLAVE_ADR_18 (0x8A >> 1)  /* VDD GND SCL */
00095 #define MAX31725_I2C_SLAVE_ADR_19 (0x88 >> 1)  /* VDD GND SDA */
00096                                               
00097 #define MAX31725_I2C_SLAVE_ADR_20 (0x9C >> 1)  /* VDD VDD GND */
00098 #define MAX31725_I2C_SLAVE_ADR_21 (0x9E >> 1)  /* VDD VDD VDD */
00099 #define MAX31725_I2C_SLAVE_ADR_22 (0x8E >> 1)  /* VDD VDD SCL */
00100 #define MAX31725_I2C_SLAVE_ADR_23 (0x8C >> 1)  /* VDD VDD SDA */
00101 #define MAX31725_I2C_SLAVE_ADR_24 (0xBC >> 1)  /* VDD SCL GND */
00102                                               
00103 #define MAX31725_I2C_SLAVE_ADR_25 (0xBE >> 1)  /* VDD SCL VDD */
00104 #define MAX31725_I2C_SLAVE_ADR_26 (0xAE >> 1)  /* VDD SCL SCL */
00105 #define MAX31725_I2C_SLAVE_ADR_27 (0xAC >> 1)  /* VDD SCL SDA */
00106 #define MAX31725_I2C_SLAVE_ADR_28 (0xB8 >> 1)  /* VDD SDA GND */
00107 #define MAX31725_I2C_SLAVE_ADR_29 (0xBA >> 1)  /* VDD SDA VDD */
00108                                               
00109 #define MAX31725_I2C_SLAVE_ADR_30 (0xAA >> 1)  /* VDD SDA SCL */
00110 #define MAX31725_I2C_SLAVE_ADR_31 (0xA8 >> 1)  /* VDD SDA SDA */
00111 
00112 
00113 #define MAX31726_I2C_SLAVE_ADR_00 (0x98 >> 1)  /* GND GND */
00114 #define MAX31726_I2C_SLAVE_ADR_01 (0x9A >> 1)  /* GND VDD */
00115 #define MAX31726_I2C_SLAVE_ADR_02 (0x8A >> 1)  /* GND SCL */
00116 #define MAX31726_I2C_SLAVE_ADR_03 (0x88 >> 1)  /* GND SDA */
00117 #define MAX31726_I2C_SLAVE_ADR_04 (0x9C >> 1)  /* VDD GND */
00118 
00119 #define MAX31726_I2C_SLAVE_ADR_05 (0x9E >> 1)  /* VDD VDD */
00120 #define MAX31726_I2C_SLAVE_ADR_06 (0x8E >> 1)  /* VDD SCL */
00121 #define MAX31726_I2C_SLAVE_ADR_07 (0x8C >> 1)  /* VDD SDA */
00122 #define MAX31726_I2C_SLAVE_ADR_08 (0xBC >> 1)  /* SCL GND */
00123 #define MAX31726_I2C_SLAVE_ADR_09 (0xBE >> 1)  /* SCL VDD */
00124 
00125 #define MAX31726_I2C_SLAVE_ADR_10 (0xAE >> 1)  /* SCL SCL */
00126 #define MAX31726_I2C_SLAVE_ADR_11 (0xAC >> 1)  /* SCL SDA */
00127 #define MAX31726_I2C_SLAVE_ADR_12 (0xB8 >> 1)  /* SDA GND */
00128 #define MAX31726_I2C_SLAVE_ADR_13 (0xBA >> 1)  /* SDA VDD */
00129 #define MAX31726_I2C_SLAVE_ADR_14 (0xAA >> 1)  /* SDA SCL */
00130 
00131 #define MAX31726_I2C_SLAVE_ADR_15 (0xA8 >> 1)  /* SDA SDA */
00132 
00133 
00134 #define MAX31725_CF_LSB           (0.00390625F)
00135 
00136 /** @union max31725_raw_data
00137  * @brief union data structure for byte word manipulations
00138  */
00139 union max31725_raw_data {
00140     struct {
00141         uint8_t lsb;
00142         uint8_t msb;
00143     };
00144     struct {
00145         uint16_t magnitude_bits:15;
00146         uint16_t sign_bit:1;
00147     };
00148     uint16_t uwrd;
00149     int16_t swrd;
00150 };
00151 
00152 #endif/* MAX31875_H */