C code and C++ library, driver software for Maxim Integrated DS1775, DS75 thermometer and thermostat temperature sensor. Code supports continuous or shut-down/standby, hysteresis, alarm limits, comparator or interrupt mode, fault filtering, and active low/high. Compact 5-pin SOT23 packaging
Dependents: DS1775_Digital_Thermostat_Temperature
ds1775.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 DS1775.h 00033 ******************************************************************************* 00034 */ 00035 #ifndef DS1775_H 00036 #define DS1775_H 00037 #include "mbed.h" 00038 00039 #define DS1775_NO_ERROR 0 00040 #define DS1775_ERROR -1 00041 00042 #define DS1775_REG_TEMPERATURE 0X00 00043 #define DS1775_REG_CONFIGURATION 0X01 00044 #define DS1775_REG_THYST_LOW_TRIP 0X02 00045 #define DS1775_REG_TOS_HIGH_TRIP 0X03 00046 #define DS1775_REG_MAX 0X03 00047 00048 #define WAIT_MARGIN (0.0000) 00049 #define DS1775_WAIT_CONV_TIME_9BIT (0.1875+WAIT_MARGIN) 00050 #define DS1775_WAIT_CONV_TIME_10BIT (0.375+2*WAIT_MARGIN) 00051 #define DS1775_WAIT_CONV_TIME_11BIT (0.750+4*WAIT_MARGIN) 00052 #define DS1775_WAIT_CONV_TIME_12BIT (1.5+8*WAIT_MARGIN) 00053 00054 #define DS75_WAIT_CONV_TIME_9BIT (0.12+WAIT_MARGIN) 00055 #define DS75_WAIT_CONV_TIME_10BIT (0.3+2*WAIT_MARGIN) 00056 #define DS75_WAIT_CONV_TIME_11BIT (0.6+4*WAIT_MARGIN) 00057 #define DS75_WAIT_CONV_TIME_12BIT (1.2+8*WAIT_MARGIN) 00058 00059 #define DS1775_CFG_CONTINUOUS (0X00 << 0) 00060 #define DS1775_CFG_SHUTDOWN (0X01 << 0) 00061 00062 #define DS1775_CFG_COMPARATOR_MODE (0X00 << 1) 00063 #define DS1775_CFG_INTERRUPT_MODE (0X01 << 1) 00064 00065 #define DS1775_CFG_OS_POLARITY_ACT_LOW (0x00 << 2) 00066 #define DS1775_CFG_OS_POLARITY_ACT_HIGH (0x01 << 2) 00067 00068 #define DS1775_CFG_FAULT_FILTER_1 (0x00 << 3) 00069 #define DS1775_CFG_FAULT_FILTER_2 (0x01 << 3) 00070 #define DS1775_CFG_FAULT_FILTER_4 (0x02 << 3) 00071 #define DS1775_CFG_FAULT_FILTER_6 (0x03 << 3) 00072 00073 #define DS1775_CFG_RESOLUTION_9BIT (0x00 << 5) 00074 #define DS1775_CFG_RESOLUTION_10BIT (0x01 << 5) 00075 #define DS1775_CFG_RESOLUTION_11BIT (0x02 << 5) 00076 #define DS1775_CFG_RESOLUTION_12BIT (0x03 << 5) 00077 00078 #define DS1775_I2C_SLAVE_ADR_R0 (0x90 >> 1) // code uses the 7 bit address 00079 #define DS1775_I2C_SLAVE_ADR_R1 (0x92 >> 1) 00080 #define DS1775_I2C_SLAVE_ADR_R2 (0x94 >> 1) 00081 #define DS1775_I2C_SLAVE_ADR_R3 (0x96 >> 1) 00082 #define DS1775_I2C_SLAVE_ADR_R4 (0x98 >> 1) 00083 #define DS1775_I2C_SLAVE_ADR_R5 (0x9A >> 1) 00084 #define DS1775_I2C_SLAVE_ADR_R6 (0x9C >> 1) 00085 #define DS1775_I2C_SLAVE_ADR_R7 (0x9E >> 1) 00086 00087 #define DS1775_CF_LSB (0.00390625F) 00088 00089 /** @union ds1775_raw_data 00090 * @brief union data structure for byte word manipulations 00091 */ 00092 union ds1775_raw_data { 00093 struct { 00094 uint8_t lsb; 00095 uint8_t msb; 00096 }; 00097 struct { 00098 uint16_t magnitude_bits:15; 00099 uint16_t sign_bit:1; 00100 }; 00101 uint16_t uwrd; 00102 int16_t swrd; 00103 }; 00104 00105 #endif/* MAX31875_H */
Generated on Fri Jul 15 2022 10:27:39 by 1.7.2