Driver for 1-wire protocol.
- Author
- MakeBlock
- Version
- V1.0.0
- Date
- 2015/09/04
- Copyright
- This software is Copyright (C), 2012-2016, MakeBlock. Use is subject to license
conditions. The main licensing options available are GPL V2 or Commercial:
- Open Source Licensing GPL V2
- This is the appropriate option if you want to share the source code of your
application with everyone you distribute it to, and you also want to give them
the right to share who uses it. If you wish to use this software under Open
Source Licensing, you must contribute all your source code to the open source
community in accordance with the GPL Version 2 when your application is
distributed. See http://www.gnu.org/copyleft/gpl.html
- Description
- This file is a drive for 1-wire protocol, 1-Wire communication protocol was developed by Dallas Semiconductor owned by Maxim. This protocol allows communication of multiple chips to one host with minimal pin count. The protocol is called 1-Wire because it uses 1 wire to transfer data. 1-Wire architecture uses pull up resistor to pull voltage of data line at master side.
- Method List:
- bool MeOneWire::readIO(void)
- void MeOneWire::reset(uint8_t pin)
- uint8_t MeOneWire::reset(void)
- void MeOneWire::select(const uint8_t rom[8])
- void MeOneWire::skip(void)()
- void MeOneWire::write(uint8_t v, uint8_t power)
- void MeOneWire::write_bytes(const uint8_t *buf, uint16_t count, bool power)
- uint8_t MeOneWire::read(void)
- void MeOneWire::read_bytes(uint8_t *buf, uint16_t count)
- void MeOneWire::write_bit(uint8_t v)
- uint8_t MeOneWire::read_bit(void)
- void MeOneWire::depower(void)
- void MeOneWire::reset_search(void)
- void MeOneWire::target_search(uint8_t family_code)
- uint8_t MeOneWire::search(uint8_t *newAddr)
- History:
`<Author>` `<Time>` `<Version>` `<Descr>`
Mark Yan 2015/09/04 1.0.0 Rebuild the old lib.
DERIVED FROM Copyright (c) 2007, Jim Studt (original old version - many contributors since) The latest version of this library may be found at: http://www.pjrc.com/teensy/td_libs_OneWire.html Version 2.1: Arduino 1.0 compatibility, Paul Stoffregen Improve temperature example, Paul Stoffregen DS250x_PROM example, Guillermo Lovato PIC32 (chipKit) compatibility, Jason Dangel, dangel.jason AT gmail.com Improvements from Glenn Trewitt:
- crc16() now works
- check_crc16() does all of calculation/checking work.
- Added read_bytes() and write_bytes(), to reduce tedious loops.
- Added ds2408 example. Delete very old, out-of-date readme file (info is here) Version 2.0: Modifications by Paul Stoffregen, January 2010: http://www.pjrc.com/teensy/td_libs_OneWire.html Search fix from Robin James http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1238032295/27#27 Use direct optimized I/O in all cases Disable interrupts during timing critical sections (this solves many random communication errors) Disable interrupts during read-modify-write I/O Reduce RAM consumption by eliminating unnecessary variables and trimming many to 8 bits Optimize both crc8 - table version moved to flash Modified to work with larger numbers of devices - avoids loop. Tested in Arduino 11 alpha with 12 sensors. 26 Sept 2008 – Robin James http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1238032295/27#27 Updated to work with arduino-0008 and to include skip() as of 2007/07/06. –RJL20 Modified to calculate the 8-bit CRC directly, avoiding the need for the 256-byte lookup table to be loaded in RAM. Tested in arduino-0010 – Tom Pollard, Jan 23, 2008 Jim Studt's original library was modified by Josh Larios. Tom Pollard, polla.nosp@m.rd@a.nosp@m.lum.m.nosp@m.it.e.nosp@m.du, contributed around May 20, 2008 Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Much of the code was inspired by Derek Yerger's code, though I don't think much of that remains. In any event that was.. (copyleft) 2006 by Derek Yerger - Free to distribute freely. The CRC code was excerpted and inspired by the Dallas Semiconductor sample code bearing this copyright. //------------------------------------------------------------------------— // Copyright (C) 2000 Dallas Semiconductor Corporation, All Rights Reserved. // // Permission is hereby granted, free of charge, to any person obtaining a // copy of this software and associated documentation files (the "Software"), // to deal in the Software without restriction, including without limitation // the rights to use, copy, modify, merge, publish, distribute, sublicense, // and/or sell copies of the Software, and to permit persons to whom the // Software is furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included // in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. // IN NO EVENT SHALL DALLAS SEMICONDUCTOR BE LIABLE FOR ANY CLAIM, DAMAGES // OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, // ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR // OTHER DEALINGS IN THE SOFTWARE. // // Except as contained in this notice, the name of Dallas Semiconductor // shall not be used except as stated in the Dallas Semiconductor // Branding Policy. //-----------------------------------------------------------------------—