Extended MaximInterface
Dependents: mbed_DS28EC20_GPIO
Diff: Devices/DS28C36_DS2476.cpp
- Revision:
- 7:471901a04573
- Parent:
- 6:a8c83a2e6fa4
--- a/Devices/DS28C36_DS2476.cpp Wed Jan 23 13:11:04 2019 -0600 +++ b/Devices/DS28C36_DS2476.cpp Mon Mar 04 08:10:00 2019 -0600 @@ -670,9 +670,10 @@ error_code readRomIdAndManId(DS28C36 & ds28c36, RomId::span romId, ManId::span manId) { - DS28C36::RomOptions romOptions; - error_code result = ds28c36.readMemory(DS28C36::romOptionsPage, romOptions); + DS28C36::Page::array page; + error_code result = ds28c36.readMemory(DS28C36::romOptionsPage, page); if (!result) { + const DS28C36::RomOptions romOptions(page); copy(romOptions.romId(), romId); copy(romOptions.manId(), manId); } @@ -680,12 +681,26 @@ } error_code enableCoprocessor(DS2476 & ds2476) { - DS2476::GpioControl gpioControl; - error_code result = ds2476.readMemory(DS2476::gpioControlPage, gpioControl); + DS2476::Page::array page; + error_code result = ds2476.readMemory(DS2476::gpioControlPage, page); if (!result) { + DS2476::GpioControl gpioControl(page); if (!gpioControl.pioaConducting()) { gpioControl.setPioaConducting(true); - result = ds2476.writeMemory(DS2476::gpioControlPage, gpioControl); + result = ds2476.writeMemory(DS2476::gpioControlPage, page); + } + } + return result; +} + +error_code enableRomId(DS2476 & ds2476) { + DS2476::Page::array page; + error_code result = ds2476.readMemory(DS2476::romOptionsPage, page); + if (!result) { + DS2476::RomOptions romOptions(page); + if (!romOptions.romBlockDisable()) { + romOptions.setRomBlockDisable(true); + result = ds2476.writeMemory(DS2476::romOptionsPage, page); } } return result;