onewire_master: fix rom search

This commit is contained in:
King Kévin 2017-08-02 15:20:01 +02:00
parent 4f00788b8a
commit d25a25f9a8
1 changed files with 2 additions and 1 deletions

View File

@ -306,6 +306,7 @@ bool onewire_master_rom_search(uint64_t* code, bool alarm)
{
static uint8_t conflict_last = 64; // on which bit has the conflict been detected (64 means there hasn't been)
uint8_t conflict_current = 64; // to remember on which bit the last unknown conflict has been detected
uint8_t bits[1] = {0}; // small buffer to store the bits used to search the ROM codes
// send SEARCH ROM command
uint8_t command = 0xf0; // SEARCH ROM command
@ -320,7 +321,7 @@ bool onewire_master_rom_search(uint64_t* code, bool alarm)
*code = 0; // restart search codes
}
buffer = (uint8_t*){0}; // buffer to read up to two bits
buffer = bits; // buffer to read up to two bits
for (uint8_t bit=0; bit<64; bit++) { // go through all 64 bits ROM code
buffer_size = 2; // read two first bits to detect conflict
if (!onewire_master_read()) { // read ROM ID from slave