Implementation of 1-Wire with added Alarm Search Functionality

Dependents:   Max32630_One_Wire_Interface

Committer:
mfruge
Date:
Tue Aug 13 14:42:37 2019 +0000
Revision:
142:85b71cfd617e
Parent:
139:f0e0a7976846
Added functions to ROMCommands to add Alarm Search functionality

Who changed what in which revision?

UserRevisionLine numberNew contents of line
j3 138:5bd0a7a82bb4 1 /******************************************************************//**
j3 138:5bd0a7a82bb4 2 * Copyright (C) 2016 Maxim Integrated Products, Inc., All Rights Reserved.
j3 138:5bd0a7a82bb4 3 *
j3 138:5bd0a7a82bb4 4 * Permission is hereby granted, free of charge, to any person obtaining a
j3 138:5bd0a7a82bb4 5 * copy of this software and associated documentation files (the "Software"),
j3 138:5bd0a7a82bb4 6 * to deal in the Software without restriction, including without limitation
j3 138:5bd0a7a82bb4 7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
j3 138:5bd0a7a82bb4 8 * and/or sell copies of the Software, and to permit persons to whom the
j3 138:5bd0a7a82bb4 9 * Software is furnished to do so, subject to the following conditions:
j3 138:5bd0a7a82bb4 10 *
j3 138:5bd0a7a82bb4 11 * The above copyright notice and this permission notice shall be included
j3 138:5bd0a7a82bb4 12 * in all copies or substantial portions of the Software.
j3 138:5bd0a7a82bb4 13 *
j3 138:5bd0a7a82bb4 14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
j3 138:5bd0a7a82bb4 15 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
j3 138:5bd0a7a82bb4 16 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
j3 138:5bd0a7a82bb4 17 * IN NO EVENT SHALL MAXIM INTEGRATED BE LIABLE FOR ANY CLAIM, DAMAGES
j3 138:5bd0a7a82bb4 18 * OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
j3 138:5bd0a7a82bb4 19 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
j3 138:5bd0a7a82bb4 20 * OTHER DEALINGS IN THE SOFTWARE.
j3 138:5bd0a7a82bb4 21 *
j3 138:5bd0a7a82bb4 22 * Except as contained in this notice, the name of Maxim Integrated
j3 138:5bd0a7a82bb4 23 * Products, Inc. shall not be used except as stated in the Maxim Integrated
j3 138:5bd0a7a82bb4 24 * Products, Inc. Branding Policy.
j3 138:5bd0a7a82bb4 25 *
j3 138:5bd0a7a82bb4 26 * The mere transfer of this software does not imply any licenses
j3 138:5bd0a7a82bb4 27 * of trade secrets, proprietary technology, copyrights, patents,
j3 138:5bd0a7a82bb4 28 * trademarks, maskwork rights, or any other form of intellectual
j3 138:5bd0a7a82bb4 29 * property whatsoever. Maxim Integrated Products, Inc. retains all
j3 138:5bd0a7a82bb4 30 * ownership rights.
j3 138:5bd0a7a82bb4 31 **********************************************************************/
j3 138:5bd0a7a82bb4 32
j3 138:5bd0a7a82bb4 33 #ifndef OneWire_Masters_OwGpio
j3 138:5bd0a7a82bb4 34 #define OneWire_Masters_OwGpio
j3 138:5bd0a7a82bb4 35
j3 138:5bd0a7a82bb4 36 #ifdef TARGET_MAX32600
j3 138:5bd0a7a82bb4 37
j3 138:5bd0a7a82bb4 38 #include "Masters/OneWireMaster.h"
j3 138:5bd0a7a82bb4 39 #include "DigitalOut.h"
j3 138:5bd0a7a82bb4 40
j3 138:5bd0a7a82bb4 41 namespace OneWire
j3 138:5bd0a7a82bb4 42 {
j3 138:5bd0a7a82bb4 43 ///One Wire Bit-Bang master
j3 138:5bd0a7a82bb4 44 class OwGpio : public OneWireMaster
j3 138:5bd0a7a82bb4 45 {
j3 138:5bd0a7a82bb4 46 public:
j3 138:5bd0a7a82bb4 47 /// @param owGpio Pin to use for 1-Wire bus
j3 138:5bd0a7a82bb4 48 /// @param extSpu Pin to use for external Strong Pullup
j3 138:5bd0a7a82bb4 49 OwGpio(PinName owGpio, PinName extSpu = NC, bool extSpuActiveHigh = false);
j3 138:5bd0a7a82bb4 50
j3 138:5bd0a7a82bb4 51 virtual OneWireMaster::CmdResult OWInitMaster();
j3 138:5bd0a7a82bb4 52 virtual OneWireMaster::CmdResult OWReset();
j3 138:5bd0a7a82bb4 53 virtual OneWireMaster::CmdResult OWTouchBitSetLevel(uint8_t & sendRecvBit, OWLevel afterLevel);
j3 138:5bd0a7a82bb4 54 virtual OneWireMaster::CmdResult OWWriteByteSetLevel(uint8_t sendByte, OWLevel afterLevel);
j3 138:5bd0a7a82bb4 55 virtual OneWireMaster::CmdResult OWReadByteSetLevel(uint8_t & recvByte, OWLevel afterLevel);
j3 138:5bd0a7a82bb4 56 virtual OneWireMaster::CmdResult OWSetSpeed(OWSpeed newSpeed);
j3 138:5bd0a7a82bb4 57 virtual OneWireMaster::CmdResult OWSetLevel(OWLevel newLevel);
j3 138:5bd0a7a82bb4 58
j3 138:5bd0a7a82bb4 59 private:
j3 138:5bd0a7a82bb4 60 const unsigned int owPort;
j3 138:5bd0a7a82bb4 61 const unsigned int owPin;
j3 138:5bd0a7a82bb4 62
j3 138:5bd0a7a82bb4 63 OWSpeed owSpeed;
j3 138:5bd0a7a82bb4 64 mbed::DigitalOut extSpu;
j3 138:5bd0a7a82bb4 65 bool extSpuActiveHigh;
j3 138:5bd0a7a82bb4 66
j3 138:5bd0a7a82bb4 67 inline void writeOwGpioLow();
j3 138:5bd0a7a82bb4 68 inline void writeOwGpioHigh();
j3 138:5bd0a7a82bb4 69 inline bool readOwGpio();
j3 138:5bd0a7a82bb4 70 inline void setOwGpioMode(unsigned int mode);
j3 138:5bd0a7a82bb4 71 };
j3 138:5bd0a7a82bb4 72 }
j3 138:5bd0a7a82bb4 73
j3 138:5bd0a7a82bb4 74 #endif /* TARGET_MAX32600 */
j3 138:5bd0a7a82bb4 75
j3 138:5bd0a7a82bb4 76 #endif