Implementation of 1-Wire with added Alarm Search Functionality
Dependents: Max32630_One_Wire_Interface
Diff: OneWire_Masters/DS248x/ds248x.cpp
- Revision:
- 21:00c94aeb533e
- Parent:
- 17:b646b1e3970b
- Child:
- 23:e8e403d61359
diff -r ba60c076e92b -r 00c94aeb533e OneWire_Masters/DS248x/ds248x.cpp --- a/OneWire_Masters/DS248x/ds248x.cpp Mon Mar 21 01:28:34 2016 +0000 +++ b/OneWire_Masters/DS248x/ds248x.cpp Mon Mar 21 14:12:28 2016 -0500 @@ -849,6 +849,35 @@ } +OneWireInterface::CmdResult Ds248x::OWReadBytePower(uint8_t & recvbyte) +{ + OneWireInterface::CmdResult result = Success; + uint8_t recvbit; + + recvbyte = 0; + for (unsigned int i = 1; i <= 8; i++) + { + // Set strong pull-up on last bit + if (i == 8) + { + // set strong pull-up enable + _cSPU = CONFIG_SPU; + + // write the new config + result = write_config(_c1WS | _cSPU | _cPDN | _cAPU); + if (result != Success) + break; + } + result = OWReadBit(recvbit); + if (result != Success) + break; + recvbyte = (recvbyte << 1) | recvbit; + } + + return result; +} + + //********************************************************************* void Ds248x::set_i2c_adrs(DS248X_I2C_ADRS adrs) {