1-wire: stop search when not slave is detected, and mention that code 0 means the data line might not be pulled up

This commit is contained in:
King Kévin 2018-06-16 11:05:12 +02:00
parent 2dadbb8292
commit b02e9b172e
2 changed files with 2 additions and 0 deletions

View File

@ -343,6 +343,7 @@ bool onewire_master_rom_search(uint64_t* code, bool alarm)
*code &= ~(((uint64_t)1)<<bit); // remember valid bit 0
break;
default: // two 1's indicate there is no slave
conflict_current = 64; // remember there was no conflict because there is no slave
goto end; // an error has occurred
}
buffer_size = 1; // to send next bit

View File

@ -57,6 +57,7 @@ uint64_t onewire_master_rom_read(void);
* @param[in,out] code use 0 to start search ROM code from scratch, or last know value to search next; writes back next ROM code found, or 0 if error occurred
* @param[in] alarm search only for ROM codes for slaves with an alarm flag set
* @return if an additional slave has been detected
* @warning when the code found is 0 it very probably means that the 1-wire line is not pulled up instead of actually having found a slave with ROM code 0
*/
bool onewire_master_rom_search(uint64_t* code, bool alarm);
/** send SKIP ROM command (all slaves on the bus will be selected)