Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: MAXREFDES131_Qt_Demo MAX32630FTHR_iButton_uSD_Logger MAX32630FTHR_DS18B20_uSD_Logger MAXREFDES130_131_Demo ... more
Diff: Slaves/RomCommands.h
- Revision:
- 90:c233d1c265ff
- Child:
- 93:e496a45ce796
diff -r 3a0e12c9b898 -r c233d1c265ff Slaves/RomCommands.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Slaves/RomCommands.h Fri Jun 17 15:24:37 2016 -0500
@@ -0,0 +1,84 @@
+#ifndef OneWire_RomCommands
+#define OneWire_RomCommands
+
+#include <stdint.h>
+#include "RomId.h"
+#include "Masters/OneWireMaster.h"
+
+namespace OneWire
+{
+ namespace RomCommands
+ {
+ /// 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(); }
+ };
+
+ /// Find the 'first' devices on the 1-Wire bus.
+ OneWireMaster::CmdResult OWFirst(OneWireMaster & master, SearchState & searchState);
+
+ /// Find the 'next' devices on the 1-Wire bus.
+ OneWireMaster::CmdResult OWNext(OneWireMaster & master, SearchState & searchState);
+
+ /// Verify that the device with the specified ROM ID is present.
+ OneWireMaster::CmdResult OWVerify(OneWireMaster & master, 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.
+ OneWireMaster::CmdResult OWReadRom(OneWireMaster & master, 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.
+ OneWireMaster::CmdResult OWSkipRom(OneWireMaster & master);
+
+ /// 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.
+ OneWireMaster::CmdResult OWMatchRom(OneWireMaster & master, 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.
+ OneWireMaster::CmdResult OWOverdriveSkipRom(OneWireMaster & master);
+
+ /// Use the Overdrive Match ROM command to select the device by its known ID.
+ /// @param[in] romId ROM ID of device to select.
+ OneWireMaster::CmdResult OWOverdriveMatchRom(OneWireMaster & master, 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.
+ OneWireMaster::CmdResult OWResume(OneWireMaster & master);
+
+ /// 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.
+ OneWireMaster::CmdResult OWSearch(OneWireMaster & master, SearchState & searchState);
+ }
+}
+
+#endif