Extended MaximInterface
Dependents: mbed_DS28EC20_GPIO
Diff: Links/RomCommands.hpp
- Revision:
- 6:a8c83a2e6fa4
- Parent:
- 0:f77ad7f72d04
- Child:
- 7:471901a04573
--- a/Links/RomCommands.hpp Fri Jan 19 10:25:02 2018 -0600 +++ b/Links/RomCommands.hpp Wed Jan 23 13:11:04 2019 -0600 @@ -30,7 +30,8 @@ * ownership rights. *******************************************************************************/ -/// @file ROM Commands for enumerating and selecting 1-Wire devices. +/// @file +/// ROM Commands for enumerating and selecting 1-Wire devices. #ifndef MaximInterface_RomCommands #define MaximInterface_RomCommands @@ -44,7 +45,7 @@ /// State used by Search ROM command. struct SearchRomState { - RomId romId; + RomId::array romId; int_least8_t lastDiscrepancy; int_least8_t lastFamilyDiscrepancy; bool lastDevice; @@ -53,11 +54,12 @@ : romId(), lastDiscrepancy(0), lastFamilyDiscrepancy(0), lastDevice(false) {} - explicit SearchRomState(const RomId & romId) - : romId(romId), lastDiscrepancy(64), lastFamilyDiscrepancy(0), - lastDevice(false) {} + explicit SearchRomState(RomId::const_span romId) + : lastDiscrepancy(64), lastFamilyDiscrepancy(0), lastDevice(false) { + copy(romId, make_span(this->romId)); + } - explicit SearchRomState(RomId::value_type familyCode) + explicit SearchRomState(RomId::element familyCode) : romId(), lastDiscrepancy(64), lastFamilyDiscrepancy(0), lastDevice(false) { setFamilyCode(romId, familyCode); @@ -70,13 +72,14 @@ /// Verify that the device with the specified ROM ID is present. MaximInterface_EXPORT error_code verifyRom(OneWireMaster & master, - const RomId & romId); + RomId::const_span romId); /// Use Read ROM command to read ROM ID from device on bus. /// @note Only use this command with a single drop bus, data /// collisions will occur if more than 1 device on bus. /// @param[out] romId ROM ID read from device. -MaximInterface_EXPORT error_code readRom(OneWireMaster & master, RomId & romId); +MaximInterface_EXPORT error_code readRom(OneWireMaster & master, + RomId::span romId); /// Issue Skip ROM command on bus. /// @note Only use this command with a single drop bus, data @@ -88,7 +91,7 @@ /// mode to switch to Overdrive timing. /// @param[in] romId ROM ID of device to select. MaximInterface_EXPORT error_code matchRom(OneWireMaster & master, - const RomId & romId); + RomId::const_span romId); /// Issue Overdrive Skip ROM command on bus. /// @note This command causes all devices supporting Overdrive @@ -100,7 +103,7 @@ /// Use the Overdrive Match ROM command to select the device by its known ID. /// @param[in] romId ROM ID of device to select. MaximInterface_EXPORT error_code overdriveMatchRom(OneWireMaster & master, - const RomId & romId); + RomId::const_span romId); /// Perform a Resume ROM command on bus. /// @details Resumes communication with the last device selected