Implementation of 1-Wire with added Alarm Search Functionality
Dependents: Max32630_One_Wire_Interface
Diff: Switches/DS2413/DS2413.cpp
- Revision:
- 75:8b627804927c
- Parent:
- 74:23be10c32fa3
- Child:
- 76:84e6c4994e29
diff -r 23be10c32fa3 -r 8b627804927c Switches/DS2413/DS2413.cpp --- a/Switches/DS2413/DS2413.cpp Fri May 13 07:48:35 2016 -0500 +++ b/Switches/DS2413/DS2413.cpp Fri May 13 14:52:50 2016 -0500 @@ -36,6 +36,19 @@ using OneWire::Switches::DS2413; using OneWire::Masters::OneWireMaster; +enum DS2413_CMDS +{ + PIO_ACCESS_READ = 0xF5, + PIO_ACCESS_WRITE = 0x5A +}; + +enum DS2413_PIO +{ + PIOA, + PIOB, + PIOAB +}; + DS2413::DS2413(OneWireMaster &owm) : _owm(owm) { } @@ -119,11 +132,11 @@ { DS2413::CmdResult result = DS2413::OpFailure; - OneWireMaster::CmdResult ow_result = _owm.OWMatchROM(romId); + OneWireMaster::CmdResult ow_result = _owm.OWMatchRom(romId); if (ow_result == OneWireMaster::Success) { - ow_result = _owm.OWWriteByte(DS2413::PIO_ACCESS_READ); + ow_result = _owm.OWWriteByte(PIO_ACCESS_READ); if (ow_result == OneWireMaster::Success) { @@ -151,11 +164,11 @@ { DS2413::CmdResult result = DS2413::OpFailure; - OneWireMaster::CmdResult ow_result = _owm.OWMatchROM(romId); + OneWireMaster::CmdResult ow_result = _owm.OWMatchRom(romId); if (ow_result == OneWireMaster::Success) { - uint8_t send_block[] = { DS2413::PIO_ACCESS_WRITE, val, ~val }; + uint8_t send_block[] = { PIO_ACCESS_WRITE, val, ~val }; ow_result = _owm.OWWriteBlock(send_block, 3); if (ow_result == OneWireMaster::Success)