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: Slaves/Authenticators/DS28E15_22_25/DS28E22.h
- Revision:
- 139:f0e0a7976846
- Parent:
- 113:13e2865603df
diff -r 5bd0a7a82bb4 -r f0e0a7976846 Slaves/Authenticators/DS28E15_22_25/DS28E22.h --- a/Slaves/Authenticators/DS28E15_22_25/DS28E22.h Fri Dec 02 19:21:55 2016 +0000 +++ b/Slaves/Authenticators/DS28E15_22_25/DS28E22.h Tue Dec 13 13:31:30 2016 -0800 @@ -36,15 +36,75 @@ #include "DS28E15_22_25.h" namespace OneWire -{ +{ /// Interface to the DS28E22 and DS28EL22 (low power) authenticators. class DS28E22 : public DS28E15_22_25 { - public: + public: + // DS28E15_22_25 traits + static const unsigned int memoryPages = 8; + static const unsigned int protectionBlocks = 4; + /// @param owMaster 1-Wire Master to use for communication with DS28E15. /// @param lowVoltage Enable low voltage timing. DS28E22(RandomAccessRomIterator & selector, bool lowVoltage = false) - : DS28E15_22_25(selector, lowVoltage, DS28E22_Family) { } + : DS28E15_22_25(selector, lowVoltage) { } + + /// Perform Write Scratchpad operation on the device. + /// @note 1-Wire ROM selection should have already occurred. + /// @param[in] data Data to write to the scratchpad. + CmdResult writeScratchpad(const Scratchpad & data) const; + + /// Perform a Read Scratchpad operation on the device. + /// @note 1-Wire ROM selection should have already occurred. + /// @param[out] data Buffer to read data from the scratchpad into. + CmdResult readScratchpad(Scratchpad & data) const; + + /// Read the status of a memory protection block using the Read Status command. + /// @note 1-Wire ROM selection should have already occurred. + /// @param blockNum Block number to to read status of. + /// @param[out] protection Receives protection status read from device. + CmdResult readBlockProtection(unsigned int blockNum, BlockProtection & protection) const; + + /// Read the personality bytes using the Read Status command. + /// @note 1-Wire ROM selection should have already occurred. + /// @param[out] personality Receives personality read from device. + CmdResult readPersonality(Personality & personality) const; + + /// Write memory segment with authentication using the Authenticated Write Memory command. + /// @note 1-Wire ROM selection should have already occurred. + /// @param MacCoproc Coprocessor to use for Write MAC computation. + /// @param pageNum Page number for write operation. + /// @param segmentNum Segment number within page for write operation. + /// @param[in] newData New data to write to the segment. + /// @param[in] oldData Existing data contained in the segment. + /// @param continuing True to continue writing with the next sequential segment. + /// False to begin a new command. + CmdResult writeAuthSegment(const ISha256MacCoproc & MacCoproc, + unsigned int pageNum, + unsigned int segmentNum, + const Segment & newData, + const Segment & oldData, + bool continuing = false); + + /// Write memory segment with authentication using the Authenticated Write Memory command. + /// @note 1-Wire ROM selection should have already occurred. + /// @param pageNum Page number for write operation. + /// @param segmentNum Segment number within page for write operation. + /// @param[in] newData New data to write to the segment. + /// @param[in] mac Write MAC computed for this operation. + /// @param continuing True to continue writing with the next sequential segment. + /// False to begin a new command. + CmdResult writeAuthSegmentMac(unsigned int pageNum, + unsigned int segmentNum, + const Segment & newData, + const Mac & mac, + bool continuing = false); + + /// Read the status of all memory protection blocks using the Read Status command. + /// @note 1-Wire ROM selection should have already occurred. + /// @param[out] protection Receives protection statuses read from device. + CmdResult readAllBlockProtection(array<BlockProtection, protectionBlocks> & protection) const; }; }