-
Notifications
You must be signed in to change notification settings - Fork 93
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
onewire: Implement
scan
for multiple devices (#139)
* onewire: Implement `scan` for multiple devices The former `scan` command only worked with a single 1-wire device attached. However, the 1-wire bus is ment as a bus, so there might be several devices connected to the bus. In that case, there is a suggested bus scanning scheme (cf. https://www.maximintegrated.com/en/design/technical-documents/app-notes/1/187.html) that makes clever use of pull-down collisions that will occur in such a situation. This allows to scan for all devices by basically doing a tree search. (The algorithm avoids recursion by using a few house-keeping variables to keep search state while discovering all devices ROM addresses.) * Reformat code The file was given to `astyle -t --style=linux --lineend=linux hydrabus_mode_onewire.c`. However, the crc constants array was left untouched to keep the commas aligned. * Rework "int search_result" to proper "bool device_found_p" * Add a comment to reference the bus scanning application note * Another missed whitespace * Fix missed variable rename
- Loading branch information
Showing
2 changed files
with
200 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters