Implementation of 1-Wire with added Alarm Search Functionality
Dependents: Max32630_One_Wire_Interface
Diff: Masters/OneWireMaster.h
- Revision:
- 90:c233d1c265ff
- Parent:
- 86:2ce08ca58b9e
- Child:
- 141:cf38f48a2a49
--- a/Masters/OneWireMaster.h Thu Jun 16 10:45:24 2016 -0500 +++ b/Masters/OneWireMaster.h Fri Jun 17 15:24:37 2016 -0500 @@ -35,7 +35,6 @@ #include <stdint.h> #include <stddef.h> -#include "Slaves/RomId.h" namespace OneWire { @@ -73,28 +72,6 @@ TimeoutError, OperationFailure }; - - /// State used by all ROM ID search functions. - struct SearchState - { - RomId romId; - uint8_t last_discrepancy; - uint8_t last_family_discrepancy; - bool last_device_flag; - - /// Reset to the search state to start at the beginning. - void reset(); - - /// Setup the search to find the device type 'family_code' - /// on the next call to OWNext() if it is present. - void findFamily(uint8_t familyCode); - - /// Setup the search to skip the current device type on the - /// next call to OWNext(). - void skipCurrentFamily(); - - SearchState() { reset(); } - }; /// Allow freeing through a base class pointer. virtual ~OneWireMaster() { } @@ -174,54 +151,6 @@ CmdResult OWReadByte(uint8_t & recvByte) { return OWReadByteSetLevel(recvByte, NormalLevel); } CmdResult OWWriteBytePower(uint8_t sendByte) { return OWWriteByteSetLevel(sendByte, StrongLevel); } CmdResult OWReadBytePower(uint8_t & recvByte) { return OWReadByteSetLevel(recvByte, StrongLevel); } - - /// Find the 'first' devices on the 1-Wire bus. - CmdResult OWFirst(SearchState & searchState); - - /// Find the 'next' devices on the 1-Wire bus. - CmdResult OWNext(SearchState & searchState); - - /// Verify that the device with the specified ROM ID is present. - CmdResult OWVerify(const RomId & romId); - - /// Use Read ROM command to read ROM ID from device on bus. - /// @note Only use this command with a single drop bus, data - /// collisions will occur if more than 1 device on bus. - /// @param[out] romId ROM ID read from device. - CmdResult OWReadRom(RomId & romId); - - /// Issue Skip ROM command on bus. - /// @note Only use this command with a single drop bus, data - /// collisions will occur if more than 1 device on bus. - CmdResult OWSkipRom(); - - /// Use the Match ROM command to select the device by its known ID. - /// @note This command causes all devices supporting Overdrive - /// mode to switch to Overdrive timing. - /// @param[in] romId ROM ID of device to select. - CmdResult OWMatchRom(const RomId & romId); - - /// Issue Overdrive Skip ROM command on bus. - /// @note This command causes all devices supporting Overdrive - /// mode to switch to Overdrive timing. - /// @note Only use this command with a single drop bus, data - /// collisions will occur if more than 1 device on bus. - CmdResult OWOverdriveSkipRom(); - - /// Use the Overdrive Match ROM command to select the device by its known ID. - /// @param[in] romId ROM ID of device to select. - CmdResult OWOverdriveMatchRom(const RomId & romId); - - /// Perform a Resume ROM command on bus. - /// @details Resumes communication with the last device selected - /// though a Match ROM or Search ROM operation. - CmdResult OWResume(); - - /// Find device on the 1-Wire bus. - /// @details This command uses the Search ROM command to enumerate all 1-Wire devices in sequence. - /// Begin with a new search state and continue using the same search state until the last - /// device flag is set which indicates that all devices have been discovered. - CmdResult OWSearch(SearchState & searchState); }; }