diff --git a/lib/onewire_master.c b/lib/onewire_master.c index 88951d5..e307091 100644 --- a/lib/onewire_master.c +++ b/lib/onewire_master.c @@ -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