1-Wire® library for mbed. Complete 1-Wire library that supports our silicon masters along with a bit-bang master on the MAX32600MBED platform with one common interface for mbed. Slave support has also been included and more slaves will be added as time permits.
Dependents: MAXREFDES131_Qt_Demo MAX32630FTHR_iButton_uSD_Logger MAX32630FTHR_DS18B20_uSD_Logger MAXREFDES130_131_Demo ... more
Superseded by MaximInterface.
Diff: Switches/DS2413/DS2413.cpp
- Revision:
- 76:84e6c4994e29
- Parent:
- 75:8b627804927c
- Child:
- 77:529edb329ee0
--- a/Switches/DS2413/DS2413.cpp Fri May 13 14:52:50 2016 -0500 +++ b/Switches/DS2413/DS2413.cpp Sat May 14 14:27:56 2016 -0500 @@ -32,9 +32,11 @@ #include "DS2413.h" #include "Masters/OneWireMasters.h" +#include "RomCommands.h" -using OneWire::Switches::DS2413; -using OneWire::Masters::OneWireMaster; +using OneWire::DS2413; +using OneWire::OneWireMaster; +using namespace OneWire::RomCommands; enum DS2413_CMDS { @@ -49,7 +51,7 @@ PIOAB }; -DS2413::DS2413(OneWireMaster &owm) : _owm(owm) +DS2413::DS2413(OneWireMaster &owm) : OneWireSlave(&owm) { } @@ -132,15 +134,15 @@ { DS2413::CmdResult result = DS2413::OpFailure; - OneWireMaster::CmdResult ow_result = _owm.OWMatchRom(romId); + OneWireMaster::CmdResult ow_result = OWMatchRom(*p_owMaster, romId); if (ow_result == OneWireMaster::Success) { - ow_result = _owm.OWWriteByte(PIO_ACCESS_READ); + ow_result = p_owMaster->OWWriteByte(PIO_ACCESS_READ); if (ow_result == OneWireMaster::Success) { - ow_result = _owm.OWReadByte(val); + ow_result = p_owMaster->OWReadByte(val); if (ow_result == OneWireMaster::Success) { @@ -164,20 +166,20 @@ { DS2413::CmdResult result = DS2413::OpFailure; - OneWireMaster::CmdResult ow_result = _owm.OWMatchRom(romId); + OneWireMaster::CmdResult ow_result = OWMatchRom(*p_owMaster, romId); if (ow_result == OneWireMaster::Success) { uint8_t send_block[] = { PIO_ACCESS_WRITE, val, ~val }; - ow_result = _owm.OWWriteBlock(send_block, 3); + ow_result = p_owMaster->OWWriteBlock(send_block, 3); if (ow_result == OneWireMaster::Success) { uint8_t expected_status = ((0x01 & val) | ((0x01 & val) << 1) | ((0x02 & val) << 1) | ((0x02 & val) << 2)); uint8_t rcv_block[2]; - ow_result = _owm.OWReadBlock(rcv_block, 2); + ow_result = p_owMaster->OWReadBlock(rcv_block, 2); if (ow_result == OneWireMaster::Success) {