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.

Committer:
IanBenzMaxim
Date:
Thu Jun 30 09:17:30 2016 -0500
Revision:
98:c4ac93efc036
Parent:
93:e496a45ce796
Child:
99:871eb0058a16
Attempting to display documentation for RomCommands.h in Doxygen.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
IanBenzMaxim 98:c4ac93efc036 1 /// @file RomCommands.h
IanBenzMaxim 98:c4ac93efc036 2 /// @brief Procedural 1-Wire ROM Commands for enumerating and selecting devices.
IanBenzMaxim 98:c4ac93efc036 3
IanBenzMaxim 90:c233d1c265ff 4 #ifndef OneWire_RomCommands
IanBenzMaxim 90:c233d1c265ff 5 #define OneWire_RomCommands
IanBenzMaxim 90:c233d1c265ff 6
IanBenzMaxim 90:c233d1c265ff 7 #include <stdint.h>
IanBenzMaxim 90:c233d1c265ff 8 #include "RomId.h"
IanBenzMaxim 90:c233d1c265ff 9 #include "Masters/OneWireMaster.h"
IanBenzMaxim 90:c233d1c265ff 10
IanBenzMaxim 90:c233d1c265ff 11 namespace OneWire
IanBenzMaxim 90:c233d1c265ff 12 {
IanBenzMaxim 90:c233d1c265ff 13 namespace RomCommands
IanBenzMaxim 90:c233d1c265ff 14 {
IanBenzMaxim 90:c233d1c265ff 15 /// State used by all ROM ID search functions.
IanBenzMaxim 90:c233d1c265ff 16 struct SearchState
IanBenzMaxim 90:c233d1c265ff 17 {
IanBenzMaxim 90:c233d1c265ff 18 RomId romId;
IanBenzMaxim 90:c233d1c265ff 19 uint8_t last_discrepancy;
IanBenzMaxim 90:c233d1c265ff 20 uint8_t last_family_discrepancy;
IanBenzMaxim 90:c233d1c265ff 21 bool last_device_flag;
IanBenzMaxim 90:c233d1c265ff 22
IanBenzMaxim 90:c233d1c265ff 23 /// Reset to the search state to start at the beginning.
IanBenzMaxim 90:c233d1c265ff 24 void reset();
IanBenzMaxim 90:c233d1c265ff 25
IanBenzMaxim 90:c233d1c265ff 26 /// Setup the search to find the device type 'family_code'
IanBenzMaxim 90:c233d1c265ff 27 /// on the next call to OWNext() if it is present.
IanBenzMaxim 90:c233d1c265ff 28 void findFamily(uint8_t familyCode);
IanBenzMaxim 90:c233d1c265ff 29
IanBenzMaxim 90:c233d1c265ff 30 /// Setup the search to skip the current device type on the
IanBenzMaxim 90:c233d1c265ff 31 /// next call to OWNext().
IanBenzMaxim 90:c233d1c265ff 32 void skipCurrentFamily();
IanBenzMaxim 90:c233d1c265ff 33
IanBenzMaxim 90:c233d1c265ff 34 SearchState() { reset(); }
IanBenzMaxim 90:c233d1c265ff 35 };
IanBenzMaxim 90:c233d1c265ff 36
j3 93:e496a45ce796 37 ///Find the 'first' devices on the 1-Wire bus.
IanBenzMaxim 90:c233d1c265ff 38 OneWireMaster::CmdResult OWFirst(OneWireMaster & master, SearchState & searchState);
IanBenzMaxim 90:c233d1c265ff 39
IanBenzMaxim 90:c233d1c265ff 40 /// Find the 'next' devices on the 1-Wire bus.
IanBenzMaxim 90:c233d1c265ff 41 OneWireMaster::CmdResult OWNext(OneWireMaster & master, SearchState & searchState);
IanBenzMaxim 90:c233d1c265ff 42
IanBenzMaxim 90:c233d1c265ff 43 /// Verify that the device with the specified ROM ID is present.
IanBenzMaxim 90:c233d1c265ff 44 OneWireMaster::CmdResult OWVerify(OneWireMaster & master, const RomId & romId);
IanBenzMaxim 90:c233d1c265ff 45
IanBenzMaxim 90:c233d1c265ff 46 /// Use Read ROM command to read ROM ID from device on bus.
IanBenzMaxim 90:c233d1c265ff 47 /// @note Only use this command with a single drop bus, data
IanBenzMaxim 90:c233d1c265ff 48 /// collisions will occur if more than 1 device on bus.
IanBenzMaxim 90:c233d1c265ff 49 /// @param[out] romId ROM ID read from device.
IanBenzMaxim 90:c233d1c265ff 50 OneWireMaster::CmdResult OWReadRom(OneWireMaster & master, RomId & romId);
IanBenzMaxim 90:c233d1c265ff 51
IanBenzMaxim 90:c233d1c265ff 52 /// Issue Skip ROM command on bus.
IanBenzMaxim 90:c233d1c265ff 53 /// @note Only use this command with a single drop bus, data
IanBenzMaxim 90:c233d1c265ff 54 /// collisions will occur if more than 1 device on bus.
IanBenzMaxim 90:c233d1c265ff 55 OneWireMaster::CmdResult OWSkipRom(OneWireMaster & master);
IanBenzMaxim 90:c233d1c265ff 56
IanBenzMaxim 90:c233d1c265ff 57 /// Use the Match ROM command to select the device by its known ID.
IanBenzMaxim 90:c233d1c265ff 58 /// @note This command causes all devices supporting Overdrive
IanBenzMaxim 90:c233d1c265ff 59 /// mode to switch to Overdrive timing.
IanBenzMaxim 90:c233d1c265ff 60 /// @param[in] romId ROM ID of device to select.
IanBenzMaxim 90:c233d1c265ff 61 OneWireMaster::CmdResult OWMatchRom(OneWireMaster & master, const RomId & romId);
IanBenzMaxim 90:c233d1c265ff 62
IanBenzMaxim 90:c233d1c265ff 63 /// Issue Overdrive Skip ROM command on bus.
IanBenzMaxim 90:c233d1c265ff 64 /// @note This command causes all devices supporting Overdrive
IanBenzMaxim 90:c233d1c265ff 65 /// mode to switch to Overdrive timing.
IanBenzMaxim 90:c233d1c265ff 66 /// @note Only use this command with a single drop bus, data
IanBenzMaxim 90:c233d1c265ff 67 /// collisions will occur if more than 1 device on bus.
IanBenzMaxim 90:c233d1c265ff 68 OneWireMaster::CmdResult OWOverdriveSkipRom(OneWireMaster & master);
IanBenzMaxim 90:c233d1c265ff 69
IanBenzMaxim 90:c233d1c265ff 70 /// Use the Overdrive Match ROM command to select the device by its known ID.
IanBenzMaxim 90:c233d1c265ff 71 /// @param[in] romId ROM ID of device to select.
IanBenzMaxim 90:c233d1c265ff 72 OneWireMaster::CmdResult OWOverdriveMatchRom(OneWireMaster & master, const RomId & romId);
IanBenzMaxim 90:c233d1c265ff 73
IanBenzMaxim 90:c233d1c265ff 74 /// Perform a Resume ROM command on bus.
IanBenzMaxim 90:c233d1c265ff 75 /// @details Resumes communication with the last device selected
IanBenzMaxim 90:c233d1c265ff 76 /// though a Match ROM or Search ROM operation.
IanBenzMaxim 90:c233d1c265ff 77 OneWireMaster::CmdResult OWResume(OneWireMaster & master);
IanBenzMaxim 90:c233d1c265ff 78
IanBenzMaxim 90:c233d1c265ff 79 /// Find device on the 1-Wire bus.
IanBenzMaxim 90:c233d1c265ff 80 /// @details This command uses the Search ROM command to enumerate all 1-Wire devices in sequence.
IanBenzMaxim 90:c233d1c265ff 81 /// Begin with a new search state and continue using the same search state until the last
IanBenzMaxim 90:c233d1c265ff 82 /// device flag is set which indicates that all devices have been discovered.
IanBenzMaxim 90:c233d1c265ff 83 OneWireMaster::CmdResult OWSearch(OneWireMaster & master, SearchState & searchState);
IanBenzMaxim 90:c233d1c265ff 84 }
IanBenzMaxim 90:c233d1c265ff 85 }
IanBenzMaxim 90:c233d1c265ff 86
IanBenzMaxim 90:c233d1c265ff 87 #endif