Implementation of 1-Wire with added Alarm Search Functionality
Dependents: Max32630_One_Wire_Interface
Diff: OneWire_Masters/OneWireMaster.cpp
- Revision:
- 43:23017dcd2ec3
- Parent:
- 42:698635a0d073
- Child:
- 48:6f9208ae280e
--- a/OneWire_Masters/OneWireMaster.cpp Wed Apr 06 04:30:37 2016 +0000 +++ b/OneWire_Masters/OneWireMaster.cpp Wed Apr 06 08:49:27 2016 -0500 @@ -38,7 +38,16 @@ using namespace std; -const uint16_t OneWireMaster::_oddparity[] = { 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0 }; +enum OW_ROM_CMD +{ + READ_ROM = 0x33, + MATCH_ROM = 0x55, + SEARCH_ROM = 0xF0, + SKIP_ROM = 0xCC, + RESUME = 0xA5, + OVERDRIVE_SKIP_ROM = 0x3C, + OVERDRIVE_MATCH_ROM = 0x69 +}; OneWireMaster::CmdResult OneWireMaster::OWFirst(SearchState & searchState) @@ -384,6 +393,8 @@ // uint16_t OneWireMaster::calculateCRC16(uint16_t CRC16, uint16_t data) { + const uint16_t _oddparity[] = { 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0 }; + data = (data ^ (CRC16 & 0xff)) & 0xff; CRC16 >>= 8;