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: Masters/DS2465/DS2465.cpp
- Revision:
- 79:7f22823a5a2d
- Parent:
- 78:0cbbac7f2016
- Child:
- 104:3f48daed532b
--- a/Masters/DS2465/DS2465.cpp Mon May 16 15:18:09 2016 -0500 +++ b/Masters/DS2465/DS2465.cpp Mon May 23 18:57:12 2016 -0500 @@ -493,8 +493,6 @@ OneWireMaster::CmdResult DS2465::cWriteMemory(uint8_t addr, const uint8_t * buf, size_t bufLen) const { - int i; - // Write SRAM (Case A) // S AD,0 [A] VSA [A] DD [A] P // \-----/ @@ -515,7 +513,7 @@ return OneWireMaster::CommunicationWriteError; } // loop to write each byte - for (i = 0; i < bufLen; i++) + for (int i = 0; i < bufLen; i++) { if (m_I2C_interface.write(buf[i]) != I2C_WRITE_OK) { @@ -530,8 +528,6 @@ OneWireMaster::CmdResult DS2465::readMemory(uint8_t addr, uint8_t * buf, size_t bufLen, bool skipSetPointer) const { - int i; - // Read (Case A) // S AD,0 [A] MA [A] Sr AD,1 [A] [DD] A [DD] A\ P // \-----/ @@ -562,7 +558,7 @@ return OneWireMaster::CommunicationWriteError; } // loop to read each byte, NAK last byte - for (i = 0; i < bufLen; i++) + for (int i = 0; i < bufLen; i++) { buf[i] = m_I2C_interface.read((i == (bufLen - 1)) ? mbed::I2C::NoACK : mbed::I2C::ACK); }