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: 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;