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.

Committer:
IanBenzMaxim
Date:
Sat May 14 14:27:56 2016 -0500
Revision:
76:84e6c4994e29
Parent:
75:8b627804927c
Child:
77:529edb329ee0
Move ROM commands outside of OneWireMaster to increase cohesiveness of the class. Do not use subdivide OneWire namespace since it will likely not provide value on this project.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
IanBenzMaxim 75:8b627804927c 1 /******************************************************************//**
IanBenzMaxim 75:8b627804927c 2 * Copyright (C) 2016 Maxim Integrated Products, Inc., All Rights Reserved.
IanBenzMaxim 75:8b627804927c 3 *
IanBenzMaxim 75:8b627804927c 4 * Permission is hereby granted, free of charge, to any person obtaining a
IanBenzMaxim 75:8b627804927c 5 * copy of this software and associated documentation files (the "Software"),
IanBenzMaxim 75:8b627804927c 6 * to deal in the Software without restriction, including without limitation
IanBenzMaxim 75:8b627804927c 7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
IanBenzMaxim 75:8b627804927c 8 * and/or sell copies of the Software, and to permit persons to whom the
IanBenzMaxim 75:8b627804927c 9 * Software is furnished to do so, subject to the following conditions:
IanBenzMaxim 75:8b627804927c 10 *
IanBenzMaxim 75:8b627804927c 11 * The above copyright notice and this permission notice shall be included
IanBenzMaxim 75:8b627804927c 12 * in all copies or substantial portions of the Software.
IanBenzMaxim 75:8b627804927c 13 *
IanBenzMaxim 75:8b627804927c 14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
IanBenzMaxim 75:8b627804927c 15 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
IanBenzMaxim 75:8b627804927c 16 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IanBenzMaxim 75:8b627804927c 17 * IN NO EVENT SHALL MAXIM INTEGRATED BE LIABLE FOR ANY CLAIM, DAMAGES
IanBenzMaxim 75:8b627804927c 18 * OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
IanBenzMaxim 75:8b627804927c 19 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
IanBenzMaxim 75:8b627804927c 20 * OTHER DEALINGS IN THE SOFTWARE.
IanBenzMaxim 75:8b627804927c 21 *
IanBenzMaxim 75:8b627804927c 22 * Except as contained in this notice, the name of Maxim Integrated
IanBenzMaxim 75:8b627804927c 23 * Products, Inc. shall not be used except as stated in the Maxim Integrated
IanBenzMaxim 75:8b627804927c 24 * Products, Inc. Branding Policy.
IanBenzMaxim 75:8b627804927c 25 *
IanBenzMaxim 75:8b627804927c 26 * The mere transfer of this software does not imply any licenses
IanBenzMaxim 75:8b627804927c 27 * of trade secrets, proprietary technology, copyrights, patents,
IanBenzMaxim 75:8b627804927c 28 * trademarks, maskwork rights, or any other form of intellectual
IanBenzMaxim 75:8b627804927c 29 * property whatsoever. Maxim Integrated Products, Inc. retains all
IanBenzMaxim 75:8b627804927c 30 * ownership rights.
IanBenzMaxim 75:8b627804927c 31 **********************************************************************/
IanBenzMaxim 75:8b627804927c 32
IanBenzMaxim 74:23be10c32fa3 33 #ifndef OneWire_OneWireSlave
IanBenzMaxim 74:23be10c32fa3 34 #define OneWire_OneWireSlave
IanBenzMaxim 25:bdb1c5a53b58 35
IanBenzMaxim 76:84e6c4994e29 36 #include <stddef.h>
IanBenzMaxim 73:2cecc1372acc 37 #include "RomId.h"
IanBenzMaxim 25:bdb1c5a53b58 38
IanBenzMaxim 73:2cecc1372acc 39 namespace OneWire
IanBenzMaxim 25:bdb1c5a53b58 40 {
IanBenzMaxim 76:84e6c4994e29 41 class OneWireMaster;
IanBenzMaxim 76:84e6c4994e29 42
IanBenzMaxim 74:23be10c32fa3 43 /// Base class for all 1-Wire Slaves.
IanBenzMaxim 74:23be10c32fa3 44 class OneWireSlave
IanBenzMaxim 73:2cecc1372acc 45 {
IanBenzMaxim 74:23be10c32fa3 46 public:
IanBenzMaxim 74:23be10c32fa3 47 enum CmdResult
IanBenzMaxim 74:23be10c32fa3 48 {
IanBenzMaxim 74:23be10c32fa3 49 Success,
IanBenzMaxim 74:23be10c32fa3 50 CommunicationError,
IanBenzMaxim 74:23be10c32fa3 51 TimeoutError,
IanBenzMaxim 74:23be10c32fa3 52 OperationFailure
IanBenzMaxim 74:23be10c32fa3 53 };
IanBenzMaxim 74:23be10c32fa3 54
IanBenzMaxim 74:23be10c32fa3 55 /// 1-Wire ROM ID for this slave device.
IanBenzMaxim 74:23be10c32fa3 56 RomId romId;
IanBenzMaxim 76:84e6c4994e29 57
IanBenzMaxim 76:84e6c4994e29 58 protected:
IanBenzMaxim 76:84e6c4994e29 59 OneWireMaster * p_owMaster;
IanBenzMaxim 76:84e6c4994e29 60
IanBenzMaxim 76:84e6c4994e29 61 OneWireSlave(OneWireMaster * p_owMaster = NULL) : p_owMaster(p_owMaster) { }
IanBenzMaxim 73:2cecc1372acc 62 };
IanBenzMaxim 73:2cecc1372acc 63 }
IanBenzMaxim 25:bdb1c5a53b58 64
IanBenzMaxim 49:36954b62f503 65 #endif