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
Superseded by MaximInterface.
Masters/DS248x/DS2484/DS2484.h@104:3f48daed532b, 2016-08-02 (annotated)
- Committer:
- j3
- Date:
- Tue Aug 02 18:21:09 2016 +0000
- Revision:
- 104:3f48daed532b
- Parent:
- 92:aa40c49b8563
- Child:
- 139:f0e0a7976846
removed "OneWire" from absolute paths
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
j3 | 91:e80108bc870a | 1 | /********************************************************************** |
j3 | 91:e80108bc870a | 2 | * Copyright (C) 2016 Maxim Integrated Products, Inc., All Rights Reserved. |
j3 | 91:e80108bc870a | 3 | * |
j3 | 91:e80108bc870a | 4 | * Permission is hereby granted, free of charge, to any person obtaining a |
j3 | 91:e80108bc870a | 5 | * copy of this software and associated documentation files (the "Software"), |
j3 | 91:e80108bc870a | 6 | * to deal in the Software without restriction, including without limitation |
j3 | 91:e80108bc870a | 7 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, |
j3 | 91:e80108bc870a | 8 | * and/or sell copies of the Software, and to permit persons to whom the |
j3 | 91:e80108bc870a | 9 | * Software is furnished to do so, subject to the following conditions: |
j3 | 91:e80108bc870a | 10 | * |
j3 | 91:e80108bc870a | 11 | * The above copyright notice and this permission notice shall be included |
j3 | 91:e80108bc870a | 12 | * in all copies or substantial portions of the Software. |
j3 | 91:e80108bc870a | 13 | * |
j3 | 91:e80108bc870a | 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
j3 | 91:e80108bc870a | 15 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
j3 | 91:e80108bc870a | 16 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. |
j3 | 91:e80108bc870a | 17 | * IN NO EVENT SHALL MAXIM INTEGRATED BE LIABLE FOR ANY CLAIM, DAMAGES |
j3 | 91:e80108bc870a | 18 | * OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, |
j3 | 91:e80108bc870a | 19 | * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR |
j3 | 91:e80108bc870a | 20 | * OTHER DEALINGS IN THE SOFTWARE. |
j3 | 91:e80108bc870a | 21 | * |
j3 | 91:e80108bc870a | 22 | * Except as contained in this notice, the name of Maxim Integrated |
j3 | 91:e80108bc870a | 23 | * Products, Inc. shall not be used except as stated in the Maxim Integrated |
j3 | 91:e80108bc870a | 24 | * Products, Inc. Branding Policy. |
j3 | 91:e80108bc870a | 25 | * |
j3 | 91:e80108bc870a | 26 | * The mere transfer of this software does not imply any licenses |
j3 | 91:e80108bc870a | 27 | * of trade secrets, proprietary technology, copyrights, patents, |
j3 | 91:e80108bc870a | 28 | * trademarks, maskwork rights, or any other form of intellectual |
j3 | 91:e80108bc870a | 29 | * property whatsoever. Maxim Integrated Products, Inc. retains all |
j3 | 91:e80108bc870a | 30 | * ownership rights. |
j3 | 91:e80108bc870a | 31 | **********************************************************************/ |
j3 | 91:e80108bc870a | 32 | |
j3 | 91:e80108bc870a | 33 | |
j3 | 91:e80108bc870a | 34 | #ifndef OneWire_Masters_DS2484 |
j3 | 91:e80108bc870a | 35 | #define OneWire_Masters_DS2484 |
j3 | 91:e80108bc870a | 36 | |
j3 | 91:e80108bc870a | 37 | |
j3 | 104:3f48daed532b | 38 | #include "Masters/DS248x/DS248x.h" |
j3 | 91:e80108bc870a | 39 | |
j3 | 91:e80108bc870a | 40 | |
j3 | 91:e80108bc870a | 41 | namespace OneWire |
j3 | 91:e80108bc870a | 42 | { |
j3 | 92:aa40c49b8563 | 43 | ///DS2484 I2C to 1-wire Master |
j3 | 91:e80108bc870a | 44 | class DS2484: public DS248x |
j3 | 91:e80108bc870a | 45 | { |
j3 | 91:e80108bc870a | 46 | public: |
j3 | 91:e80108bc870a | 47 | |
j3 | 91:e80108bc870a | 48 | static const uint8_t I2C_ADRS = 0x30; |
j3 | 91:e80108bc870a | 49 | |
j3 | 91:e80108bc870a | 50 | /// 1-Wire port adjustment parameters. |
j3 | 91:e80108bc870a | 51 | /// @note See datasheet page 13. |
j3 | 91:e80108bc870a | 52 | enum OwAdjustParam |
j3 | 91:e80108bc870a | 53 | { |
j3 | 91:e80108bc870a | 54 | tRSTL = 0, |
j3 | 91:e80108bc870a | 55 | tRSTL_OD, |
j3 | 91:e80108bc870a | 56 | tMSP, |
j3 | 91:e80108bc870a | 57 | tMSP_OD, |
j3 | 91:e80108bc870a | 58 | tW0L, |
j3 | 91:e80108bc870a | 59 | tW0L_OD, |
j3 | 91:e80108bc870a | 60 | tREC0, // OD N/A |
j3 | 91:e80108bc870a | 61 | RWPU = 8 // OD N/A |
j3 | 91:e80108bc870a | 62 | }; |
j3 | 91:e80108bc870a | 63 | |
j3 | 91:e80108bc870a | 64 | /// Construct to use an existing I2C interface. |
j3 | 91:e80108bc870a | 65 | /// @param i2c_bus Configured I2C communication interface for DS248x. |
j3 | 91:e80108bc870a | 66 | DS2484(mbed::I2C & i2c_bus); |
j3 | 91:e80108bc870a | 67 | |
j3 | 91:e80108bc870a | 68 | ///Destroys DS2484 object |
j3 | 91:e80108bc870a | 69 | virtual ~DS2484(){}; |
j3 | 91:e80108bc870a | 70 | |
j3 | 91:e80108bc870a | 71 | /// Adjust 1-Wire port paramaters. |
j3 | 91:e80108bc870a | 72 | /// @note DS2484 only |
j3 | 91:e80108bc870a | 73 | /// @param param Parameter to adjust. |
j3 | 91:e80108bc870a | 74 | /// @param val New parameter value to set. Consult datasheet for value mappings. |
j3 | 91:e80108bc870a | 75 | OneWireMaster::CmdResult adjustOwPort(OwAdjustParam param, uint8_t val); |
j3 | 91:e80108bc870a | 76 | }; |
j3 | 91:e80108bc870a | 77 | } |
j3 | 91:e80108bc870a | 78 | |
j3 | 91:e80108bc870a | 79 | #endif /* OneWire_Masters_DS2484 */ |