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:
parent
2dadbb8292
commit
b02e9b172e
|
@ -343,6 +343,7 @@ bool onewire_master_rom_search(uint64_t* code, bool alarm)
|
||||||
*code &= ~(((uint64_t)1)<<bit); // remember valid bit 0
|
*code &= ~(((uint64_t)1)<<bit); // remember valid bit 0
|
||||||
break;
|
break;
|
||||||
default: // two 1's indicate there is no slave
|
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
|
goto end; // an error has occurred
|
||||||
}
|
}
|
||||||
buffer_size = 1; // to send next bit
|
buffer_size = 1; // to send next bit
|
||||||
|
|
|
@ -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,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
|
* @param[in] alarm search only for ROM codes for slaves with an alarm flag set
|
||||||
* @return if an additional slave has been detected
|
* @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);
|
bool onewire_master_rom_search(uint64_t* code, bool alarm);
|
||||||
/** send SKIP ROM command (all slaves on the bus will be selected)
|
/** send SKIP ROM command (all slaves on the bus will be selected)
|
||||||
|
|
Loading…
Reference in New Issue