Implementation of 1-Wire with added Alarm Search Functionality
Dependents: Max32630_One_Wire_Interface
Diff: Masters/DS248x/DS248x.cpp
- Revision:
- 78:0cbbac7f2016
- Parent:
- 76:84e6c4994e29
- Child:
- 79:7f22823a5a2d
diff -r 529edb329ee0 -r 0cbbac7f2016 Masters/DS248x/DS248x.cpp --- a/Masters/DS248x/DS248x.cpp Mon May 16 10:36:30 2016 -0500 +++ b/Masters/DS248x/DS248x.cpp Mon May 16 15:18:09 2016 -0500 @@ -36,16 +36,17 @@ using OneWire::OneWireMaster; using OneWire::DS248x; -enum DS248X_STATUS_BITS +/// DS248x Status Bits +enum StatusBit { - STATUS_1WB = 0x01, - STATUS_PPD = 0x02, - STATUS_SD = 0x04, - STATUS_LL = 0x08, - STATUS_RST = 0x10, - STATUS_SBR = 0x20, - STATUS_TSB = 0x40, - STATUS_DIR = 0x80 + Status_1WB = 0x01, + Status_PPD = 0x02, + Status_SD = 0x04, + Status_LL = 0x08, + Status_RST = 0x10, + Status_SBR = 0x20, + Status_TSB = 0x40, + Status_DIR = 0x80 }; static const int I2C_WRITE_OK = 0; @@ -269,9 +270,9 @@ if (result == OneWireMaster::Success) { // check bit results in status byte - sbr = ((status & STATUS_SBR) == STATUS_SBR); - tsb = ((status & STATUS_TSB) == STATUS_TSB); - searchDirection = ((status & STATUS_DIR) == STATUS_DIR) ? WriteOne : WriteZero; + sbr = ((status & Status_SBR) == Status_SBR); + tsb = ((status & Status_TSB) == Status_TSB); + searchDirection = ((status & Status_DIR) == Status_DIR) ? WriteOne : WriteZero; } } return result; @@ -298,7 +299,7 @@ if (result == OneWireMaster::Success) { // check for presence detect - if ((buf & STATUS_PPD) != STATUS_PPD) + if ((buf & Status_PPD) != Status_PPD) { result = OneWireMaster::OperationFailure; } @@ -335,7 +336,7 @@ if (result == OneWireMaster::Success) { - sendRecvBit = (status & STATUS_SBR); + sendRecvBit = (status & Status_SBR); } return result; @@ -500,7 +501,7 @@ { return OneWireMaster::TimeoutError; } - } while (status & STATUS_1WB); + } while (status & Status_1WB); return OneWireMaster::Success; }