Extended MaximInterface
Dependents: mbed_DS28EC20_GPIO
Diff: Utilities/RomId.hpp
- Revision:
- 7:471901a04573
- Parent:
- 6:a8c83a2e6fa4
--- a/Utilities/RomId.hpp Wed Jan 23 13:11:04 2019 -0600 +++ b/Utilities/RomId.hpp Mon Mar 04 08:10:00 2019 -0600 @@ -41,29 +41,37 @@ /// Standard container for a 1-Wire ROM ID. typedef array_span<uint_least8_t, 8> RomId; +/// @name Family Code /// @{ -/// Access the Family Code byte. + +/// Get the Family Code byte. inline RomId::element familyCode(RomId::const_span romId) { return romId[0]; } +/// Set the Family Code byte. inline void setFamilyCode(RomId::span romId, RomId::element familyCode) { romId[0] = familyCode; } + /// @} +/// @name CRC8 /// @{ -/// Access the CRC8 byte. + +/// Get the CRC8 byte. inline RomId::element crc8(RomId::const_span romId) { return *romId.last<1>().data(); } +/// Set the CRC8 byte. inline void setCrc8(RomId::span romId, RomId::element crc8) { *romId.last<1>().data() = crc8; } + /// @} -/// Check if the ROM ID is valid (Family Code and CRC8 are both valid). +/// @brief Check if the ROM ID is valid (Family Code and CRC8 are both valid). /// @returns True if the ROM ID is valid. inline bool valid(RomId::const_span romId) { return calculateCrc8(romId.first(romId.size() - 1)) == crc8(romId);