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/TARGET_Maxim/TARGET_MAX32600/OwGpio/owlink.h@138:5bd0a7a82bb4, 2016-12-02 (annotated)
- Committer:
- j3
- Date:
- Fri Dec 02 19:21:55 2016 +0000
- Revision:
- 138:5bd0a7a82bb4
- Child:
- 139:f0e0a7976846
Updated project tree under Masters to add TARGET and TOOLCHAIN folders for new build tools to support asm code needed by OwGpio class.
Who changed what in which revision?
User | Revision | Line number | New 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 */ |
j3 | 138:5bd0a7a82bb4 | 76 |