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.
Diff: Masters/DS2465/DS2465.h
- Revision:
- 75:8b627804927c
- Parent:
- 74:23be10c32fa3
- Child:
- 76:84e6c4994e29
diff -r 23be10c32fa3 -r 8b627804927c Masters/DS2465/DS2465.h --- a/Masters/DS2465/DS2465.h Fri May 13 07:48:35 2016 -0500 +++ b/Masters/DS2465/DS2465.h Fri May 13 14:52:50 2016 -0500 @@ -1,3 +1,35 @@ +/******************************************************************//** +* Copyright (C) 2016 Maxim Integrated Products, Inc., 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 MAXIM INTEGRATED 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 Maxim Integrated +* Products, Inc. shall not be used except as stated in the Maxim Integrated +* Products, Inc. Branding Policy. +* +* The mere transfer of this software does not imply any licenses +* of trade secrets, proprietary technology, copyrights, patents, +* trademarks, maskwork rights, or any other form of intellectual +* property whatsoever. Maxim Integrated Products, Inc. retains all +* ownership rights. +**********************************************************************/ + #ifndef OneWire_Masters_DS2465 #define OneWire_Masters_DS2465 @@ -97,8 +129,9 @@ // Const member functions should not change the settings of the DS2465 or affect the state of the 1-Wire bus. // Read pointer, scratchpad, MAC output register, and command register on the DS2465 are considered mutable. - /// Performs a soft reset on the DS2465. This is NOT a 1-Wire Reset. - OneWireMaster::CmdResult reset(void); + /// Performs a soft reset on the DS2465. + /// @note This is note a 1-Wire Reset. + OneWireMaster::CmdResult reset(); /// Write a new configuration to the DS2465. /// @param[in] config New configuration to write. @@ -111,20 +144,20 @@ // DS2465 Memory Commands - /// Read memory from the DS2465 + /// Read memory from the DS2465. /// @param addr Address to begin reading from. /// @param[out] buf Buffer to hold read data. /// @param bufLen Length of buffer, buf, and number of bytes to read. /// @param skipSetPointer Assume that the read pointer is already set to the correct address. OneWireMaster::CmdResult readMemory(uint8_t addr, uint8_t * buf, size_t bufLen, bool skipSetPointer = false) const; - /// Write to SRAM memory on the DS2465 + /// Write to SRAM memory on the DS2465. /// @param addr Address to begin writing to. /// @param[in] buf Buffer containing the data to write. /// @param bufLen Length of buffer, buf, and number of bytes to write. OneWireMaster::CmdResult writeMemory(uint8_t addr, const uint8_t * buf, size_t bufLen) { return cWriteMemory(addr, buf, bufLen); } - /// Write data to the scratchpad area of the DS2465 + /// Write data to the scratchpad area of the DS2465. /// @param[in] buf Buffer containing the data to write. /// @param bufLen Length of buffer, buf, and the number of bytes to write. OneWireMaster::CmdResult writeScratchpad(const uint8_t * buf, size_t bufLen) const { return cWriteMemory(ADDR_SPAD, buf, bufLen); } @@ -142,17 +175,17 @@ OneWireMaster::CmdResult copyScratchpadToSecret() { return copyScratchpad(true, 0, false, 0); } // 1-Wire Master Commands - virtual OneWireMaster::CmdResult OWInitMaster(void); - virtual OneWireMaster::CmdResult OWReset(void); - virtual OneWireMaster::CmdResult OWTouchBitSetLevel(uint8_t & sendrecvbit, OWLevel after_level); - virtual OneWireMaster::CmdResult OWReadByteSetLevel(uint8_t & recvbyte, OWLevel after_level); - virtual OneWireMaster::CmdResult OWWriteByteSetLevel(uint8_t sendbyte, OWLevel after_level); - virtual OneWireMaster::CmdResult OWReadBlock(uint8_t *rx_buf, uint8_t rx_len); - virtual OneWireMaster::CmdResult OWWriteBlock(const uint8_t *tran_buf, uint8_t tran_len); - virtual OneWireMaster::CmdResult OWSetSpeed(OWSpeed new_speed); + virtual OneWireMaster::CmdResult OWInitMaster(); + virtual OneWireMaster::CmdResult OWReset(); + virtual OneWireMaster::CmdResult OWTouchBitSetLevel(uint8_t & sendRecvBit, OWLevel afterLevel); + virtual OneWireMaster::CmdResult OWReadByteSetLevel(uint8_t & recvByte, OWLevel afterLevel); + virtual OneWireMaster::CmdResult OWWriteByteSetLevel(uint8_t sendByte, OWLevel afterLevel); + virtual OneWireMaster::CmdResult OWReadBlock(uint8_t *recvBuf, uint8_t recvLen); + virtual OneWireMaster::CmdResult OWWriteBlock(const uint8_t *sendBuf, uint8_t sendLen); + virtual OneWireMaster::CmdResult OWSetSpeed(OWSpeed newSpeed); /// @note The DS2465 only supports enabling strong pullup following a 1-Wire read or write operation. - virtual OneWireMaster::CmdResult OWSetLevel(OWLevel new_level); - virtual OneWireMaster::CmdResult OWTriplet(SearchDirection & search_direction, uint8_t & sbr, uint8_t & tsb); + virtual OneWireMaster::CmdResult OWSetLevel(OWLevel newLevel); + virtual OneWireMaster::CmdResult OWTriplet(SearchDirection & searchDirection, uint8_t & sbr, uint8_t & tsb); /// Write the last computed MAC to the 1-Wire bus OneWireMaster::CmdResult OWWriteBlockMac();