Implementation of 1-Wire with added Alarm Search Functionality

Dependents:   Max32630_One_Wire_Interface

Committer:
j3
Date:
Tue Dec 13 13:31:30 2016 -0800
Revision:
139:f0e0a7976846
Parent:
138:5bd0a7a82bb4
Merge from svn

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 OWLINK_H
j3 138:5bd0a7a82bb4 34 #define OWLINK_H
j3 138:5bd0a7a82bb4 35
j3 138:5bd0a7a82bb4 36 #ifdef TARGET_MAX32600
j3 138:5bd0a7a82bb4 37
j3 138:5bd0a7a82bb4 38 #include <stdint.h>
j3 138:5bd0a7a82bb4 39
j3 138:5bd0a7a82bb4 40 #ifdef __cplusplus
j3 138:5bd0a7a82bb4 41 extern "C" {
j3 138:5bd0a7a82bb4 42 #endif
j3 138:5bd0a7a82bb4 43
j3 138:5bd0a7a82bb4 44 /// Timing parameters for the 1-Wire bus.
j3 138:5bd0a7a82bb4 45 /// @note All times are in terms of microseconds.
j3 138:5bd0a7a82bb4 46 struct OwTiming
j3 138:5bd0a7a82bb4 47 {
j3 138:5bd0a7a82bb4 48 uint16_t tRSTL; ///< Reset Low Time
j3 138:5bd0a7a82bb4 49 uint16_t tMSP; ///< Presence-Detect Sample Time
j3 138:5bd0a7a82bb4 50 uint16_t tW0L; ///< Write-Zero Low Time
j3 138:5bd0a7a82bb4 51 uint16_t tW1L; ///< Write-One Low Time
j3 138:5bd0a7a82bb4 52 uint16_t tMSR; ///< Read Sample Time
j3 138:5bd0a7a82bb4 53 uint16_t tSLOT; ///< Time Slot Duration
j3 138:5bd0a7a82bb4 54 };
j3 138:5bd0a7a82bb4 55
j3 138:5bd0a7a82bb4 56 /// Delay for the specified number of microseconds.
j3 138:5bd0a7a82bb4 57 void ow_usdelay(unsigned int time_us);
j3 138:5bd0a7a82bb4 58
j3 138:5bd0a7a82bb4 59 /// Send and receive one bit of communication and set a new level on the 1-Wire bus.
j3 138:5bd0a7a82bb4 60 /// @note GPIO pin must be configured for open drain operation.
j3 138:5bd0a7a82bb4 61 /// @param[in,out] sendRecvBit Buffer containing the bit to send on 1-Wire bus in lsb.
j3 138:5bd0a7a82bb4 62 /// Read data from 1-Wire bus will be returned in lsb.
j3 138:5bd0a7a82bb4 63 /// @param inReg Input register for GPIO pin.
j3 138:5bd0a7a82bb4 64 /// @param outReg Output register for GPIO pin.
j3 138:5bd0a7a82bb4 65 /// @param pinMask Pin mask for input and output registers.
j3 138:5bd0a7a82bb4 66 /// @param[in] timing 1-Wire timing parameters to use.
j3 138:5bd0a7a82bb4 67 void ow_bit(uint8_t * sendRecvBit, volatile uint32_t * inReg, volatile uint32_t * outPortReg, unsigned int pinMask, const OwTiming * timing);
j3 138:5bd0a7a82bb4 68
j3 138:5bd0a7a82bb4 69 #ifdef __cplusplus
j3 138:5bd0a7a82bb4 70 }
j3 138:5bd0a7a82bb4 71 #endif
j3 138:5bd0a7a82bb4 72
j3 138:5bd0a7a82bb4 73 #endif /* TARGET_MAX32600 */
j3 138:5bd0a7a82bb4 74
j3 138:5bd0a7a82bb4 75 #endif /* OWLINK_H */