1-Wire® library for mbed. Complete 1-Wire library that supports our silicon masters along with a bit-bang master on the MAX32600MBED platform with one common interface for mbed. Slave support has also been included and more slaves will be added as time permits.
Dependents: MAXREFDES131_Qt_Demo MAX32630FTHR_iButton_uSD_Logger MAX32630FTHR_DS18B20_uSD_Logger MAXREFDES130_131_Demo ... more
DS2413.h
00001 /******************************************************************//** 00002 * Copyright (C) 2016 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 00033 #ifndef OneWire_Switches_DS2413 00034 #define OneWire_Switches_DS2413 00035 00036 #include <stdint.h> 00037 #include "Slaves/OneWireSlave.h" 00038 00039 namespace OneWire 00040 { 00041 /** 00042 * @brief DS2413 1-Wire Dual Channel Addressable Switch 00043 * 00044 * @details The DS2413 is a dual-channel programmable I/O 1-Wire® 00045 * chip. The PIO outputs are configured as open-drain and provide up 00046 * to 20mA continuous sink capability and off-state operating voltage 00047 * up to 28V. Control and sensing of the PIO pins is performed with 00048 * a dedicated device-level command protocol. To provide a high level 00049 * of fault tolerance in the end application, the 1-Wire I/O and PIO 00050 * pins are all capable of withstanding continuous application of 00051 * voltages up to 28V max. Communication and operation of the DS2413 00052 * is performed with the single contact Maxim 1-Wire serial interface. 00053 */ 00054 class DS2413 : public OneWireSlave 00055 { 00056 public: 00057 00058 ///Result of operations 00059 enum CmdResult 00060 { 00061 Success, 00062 CommsReadError, 00063 CommsWriteError, 00064 OpFailure 00065 }; 00066 00067 /**********************************************************//** 00068 * @brief DS2413 constructor 00069 * 00070 * @details 00071 * 00072 * On Entry: 00073 * @param[in] owm - reference to 1-wire master 00074 * 00075 * On Exit: 00076 * 00077 * @return 00078 **************************************************************/ 00079 DS2413(RandomAccessRomIterator &selector); 00080 00081 /**********************************************************//** 00082 * @brief pioAccessReadChA() 00083 * 00084 * @details reads state of pio 00085 * 00086 * 00087 * On Exit: 00088 * @param[out] val - lsb represents the state of the pio 00089 * 00090 * @return CmdResult - result of operation 00091 **************************************************************/ 00092 CmdResult pioAccessReadChA(uint8_t & val); 00093 00094 /**********************************************************//** 00095 * @brief pioAccessReadChB() 00096 * 00097 * @details reads state of pio 00098 * 00099 * 00100 * On Exit: 00101 * @param[out] val - lsb represents the state of the pio 00102 * 00103 * @return CmdResult - result of operation 00104 **************************************************************/ 00105 CmdResult pioAccessReadChB(uint8_t & val); 00106 00107 /**********************************************************//** 00108 * @brief pioAccessWriteChA() 00109 * 00110 * @details writes to pio 00111 * 00112 * On Entry: 00113 * @param[in] val - lsb sets state of pio 00114 * 00115 * @return CmdResult - result of operation 00116 **************************************************************/ 00117 CmdResult pioAccessWriteChA(uint8_t val); 00118 00119 /**********************************************************//** 00120 * @brief pioAccessWriteChB() 00121 * 00122 * @details writes to pio 00123 * 00124 * On Entry: 00125 * @param[in] val - lsb sets state of pio 00126 * 00127 * @return CmdResult - result of operation 00128 **************************************************************/ 00129 CmdResult pioAccessWriteChB(uint8_t val); 00130 00131 /**********************************************************//** 00132 * @brief pioAccessWriteChAB() 00133 * 00134 * @details writes to pio 00135 * 00136 * On Entry: 00137 * @param[in] val - Bits 1:0 set PIOB and PIOB respectively 00138 * 00139 * @return CmdResult - result of operation 00140 **************************************************************/ 00141 CmdResult pioAccessWriteChAB(uint8_t val); 00142 00143 private: 00144 00145 CmdResult pioAccessRead(uint8_t & val); 00146 00147 CmdResult pioAccessWrite(uint8_t val); 00148 }; 00149 } 00150 00151 #endif
Generated on Tue Jul 12 2022 15:46:20 by 1.7.2