Implementation of 1-Wire with added Alarm Search Functionality
Dependents: Max32630_One_Wire_Interface
Diff: Masters/DS2465/DS2465.h
- Revision:
- 78:0cbbac7f2016
- Parent:
- 76:84e6c4994e29
- Child:
- 86:2ce08ca58b9e
diff -r 529edb329ee0 -r 0cbbac7f2016 Masters/DS2465/DS2465.h --- a/Masters/DS2465/DS2465.h Mon May 16 10:36:30 2016 -0500 +++ b/Masters/DS2465/DS2465.h Mon May 16 15:18:09 2016 -0500 @@ -54,29 +54,29 @@ /// Page region to use for swapping. enum PageRegion { - REGION_FULL_PAGE = 0x03, - REGION_FIRST_HALF = 0x01, - REGION_SECOND_HALF = 0x02 + FullPage = 0x03, + FirstHalf = 0x01, + SecondHalf = 0x02 }; /// Starting memory addresses. - enum MemoryAddr + enum MemoryAddress { - ADDR_SPAD = 0x00, - ADDR_CMD_REG = 0x60, - ADDR_STATUS_REG = 0x61, - ADDR_DATA_REG = 0x62, - ADDR_MAC_READ = 0x63, - ADDR_SHA_SELECT_REG = 0x66, - ADDR_WCFG_REG = 0x67, - ADDR_TRSTL_REG = 0x68, - ADDR_TMSP_REG = 0x69, - ADDR_TW0L_REG = 0x6A, - ADDR_TREC0_REG = 0x6B, - ADDR_RWPU_REG = 0x6C, - ADDR_TW1L_REG = 0x6D, - ADDR_USER_MEM_PAGE_0 = 0x80, - ADDR_USER_MEM_PAGE_1 = 0xA0 + Scratchpad = 0x00, + CommandReg = 0x60, + StatusReg = 0x61, + ReadDataReg = 0x62, + MacReadoutReg = 0x63, + MemoryProtectionReg = 0x64, + ConfigReg = 0x67, + tRSTL_Reg = 0x68, + tMSP_Reg = 0x69, + tW0L_Reg = 0x6A, + tREC0_Reg = 0x6B, + RWPU_Reg = 0x6C, + tW1L_Reg = 0x6D, + UserMemoryPage0 = 0x80, + UserMemoryPage1 = 0xA0 }; /// Represents a DS2465 configuration. @@ -158,7 +158,7 @@ /// 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); } + OneWireMaster::CmdResult writeScratchpad(const uint8_t * buf, size_t bufLen) const { return cWriteMemory(Scratchpad, buf, bufLen); } /// Copy the scratchpad contents to an EEPROM memory page. /// @param pageNum Page number to copy to. @@ -191,7 +191,7 @@ // DS2465 Coprocessor Commands /// Compute Next Master Secret with scratchpad data. - OneWireMaster::CmdResult computeNextMasterSecret() { return computeNextMasterSecret(false, 0, REGION_FULL_PAGE); } + OneWireMaster::CmdResult computeNextMasterSecret() { return computeNextMasterSecret(false, 0, FullPage); } /// Compute Next Master Secret with page swapping. /// @param pageNum Page number to swap in. @@ -209,7 +209,7 @@ OneWireMaster::CmdResult computeWriteMacSwap(bool regwrite, unsigned int pageNum, unsigned int segmentNum) const { return computeWriteMac(regwrite, true, pageNum, segmentNum); } /// Compute Slave Secret (S-Secret) with scratchpad data. - OneWireMaster::CmdResult computeSlaveSecret() { return computeSlaveSecret(false, 0, REGION_FULL_PAGE); } + OneWireMaster::CmdResult computeSlaveSecret() { return computeSlaveSecret(false, 0, FullPage); } /// Compute Slave Secret (S-Secret) with page swapping. /// @param pageNum Page number to swap in. @@ -217,7 +217,7 @@ OneWireMaster::CmdResult computeSlaveSecretSwap(unsigned int pageNum, PageRegion region) { return computeSlaveSecret(true, pageNum, region); } /// Compute Authentication MAC with scratchpad data. - OneWireMaster::CmdResult computeAuthMac() const { return computeAuthMac(false, 0, REGION_FULL_PAGE); } + OneWireMaster::CmdResult computeAuthMac() const { return computeAuthMac(false, 0, FullPage); } /// Compute Authentication MAC with page swapping. /// @param pageNum Page number to swap in.