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

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers DS28E15.h Source File

DS28E15.h

00001 /******************************************************************//**
00002 * Copyright (C) 2016 Maxim Integrated Products, Inc., All Rights Reserved.
00003 *
00004 * Permission is hereby granted, free of charge, to any person obtaining a
00005 * copy of this software and associated documentation files (the "Software"),
00006 * to deal in the Software without restriction, including without limitation
00007 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
00008 * and/or sell copies of the Software, and to permit persons to whom the
00009 * Software is furnished to do so, subject to the following conditions:
00010 *
00011 * The above copyright notice and this permission notice shall be included
00012 * in all copies or substantial portions of the Software.
00013 *
00014 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
00015 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
00016 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
00017 * IN NO EVENT SHALL MAXIM INTEGRATED BE LIABLE FOR ANY CLAIM, DAMAGES
00018 * OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
00019 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
00020 * OTHER DEALINGS IN THE SOFTWARE.
00021 *
00022 * Except as contained in this notice, the name of Maxim Integrated
00023 * Products, Inc. shall not be used except as stated in the Maxim Integrated
00024 * Products, Inc. Branding Policy.
00025 *
00026 * The mere transfer of this software does not imply any licenses
00027 * of trade secrets, proprietary technology, copyrights, patents,
00028 * trademarks, maskwork rights, or any other form of intellectual
00029 * property whatsoever. Maxim Integrated Products, Inc. retains all
00030 * ownership rights.
00031 **********************************************************************/
00032 
00033 #ifndef OneWire_Authenticators_DS28E15
00034 #define OneWire_Authenticators_DS28E15
00035 
00036 #include "DS28E15_22_25.h"
00037 
00038 namespace OneWire
00039 {    
00040     /// Interface to the DS28E15 and DS28EL15 (low power) authenticators.
00041     class DS28E15 : public DS28E15_22_25
00042     {
00043     public:            
00044         // DS28E15_22_25 traits
00045         static const unsigned int memoryPages = 2;
00046         static const unsigned int protectionBlocks = 4;
00047     
00048         /// @param owMaster 1-Wire Master to use for communication with DS28E15.
00049         /// @param lowVoltage Enable low voltage timing.
00050         DS28E15 (RandomAccessRomIterator & selector, bool lowVoltage  = false)
00051             : DS28E15_22_25(selector, lowVoltage ) { }
00052             
00053         /// Perform Write Scratchpad operation on the device.
00054         /// @note 1-Wire ROM selection should have already occurred.
00055         /// @param[in] data Data to write to the scratchpad.
00056         CmdResult writeScratchpad(const Scratchpad & data) const;
00057 
00058         /// Perform a Read Scratchpad operation on the device.
00059         /// @note 1-Wire ROM selection should have already occurred.
00060         /// @param[out] data Buffer to read data from the scratchpad into.
00061         CmdResult readScratchpad(Scratchpad & data) const;
00062         
00063         /// Read the status of a memory protection block using the Read Status command.
00064         /// @note 1-Wire ROM selection should have already occurred.
00065         /// @param blockNum Block number to to read status of.
00066         /// @param[out] protection Receives protection status read from device.
00067         CmdResult readBlockProtection(unsigned int blockNum, BlockProtection & protection) const;
00068 
00069         /// Read the personality bytes using the Read Status command.
00070         /// @note 1-Wire ROM selection should have already occurred.
00071         /// @param[out] personality Receives personality read from device.
00072         CmdResult readPersonality(Personality & personality) const;
00073         
00074         /// Write memory segment with authentication using the Authenticated Write Memory command.
00075         /// @note 1-Wire ROM selection should have already occurred.
00076         /// @param MacCoproc Coprocessor to use for Write MAC computation.
00077         /// @param pageNum Page number for write operation.
00078         /// @param segmentNum Segment number within page for write operation.
00079         /// @param[in] newData New data to write to the segment.
00080         /// @param[in] oldData Existing data contained in the segment.
00081         /// @param continuing True to continue writing with the next sequential segment.
00082         ///                   False to begin a new command.
00083         CmdResult writeAuthSegment(const ISha256MacCoproc & MacCoproc,
00084                                    unsigned int pageNum,
00085                                    unsigned int segmentNum,
00086                                    const Segment & newData,
00087                                    const Segment & oldData,
00088                                    bool continuing = false);
00089 
00090         /// Write memory segment with authentication using the Authenticated Write Memory command.
00091         /// @note 1-Wire ROM selection should have already occurred.
00092         /// @param pageNum Page number for write operation.
00093         /// @param segmentNum Segment number within page for write operation.
00094         /// @param[in] newData New data to write to the segment.
00095         /// @param[in] mac Write MAC computed for this operation.
00096         /// @param continuing True to continue writing with the next sequential segment.
00097         ///                   False to begin a new command.
00098         CmdResult writeAuthSegmentMac(unsigned int pageNum,
00099                                       unsigned int segmentNum,
00100                                       const Segment & newData,
00101                                       const Mac & mac,
00102                                       bool continuing = false);
00103         
00104         /// Read the status of all memory protection blocks using the Read Status command.
00105         /// @note 1-Wire ROM selection should have already occurred.
00106         /// @param[out] protection Receives protection statuses read from device.    
00107         CmdResult readAllBlockProtection(array<BlockProtection, protectionBlocks> & protection) const;
00108     };
00109 }
00110 
00111 #endif