int onewire_firstAddress(littleWire* lwHandle) { littleWire* temp = lwHandle; // reset the search state LastDiscrepancy = 0; LastDeviceFlag = 0; LastFamilyDiscrepancy = 0; return onewire_nextAddress(temp); }
int main() { uint16_t i,t; initSerial(); xputs(PSTR("\r\n")); xputs(PSTR("> -------------------------------\r\n")); xputs(PSTR("> Hello Console!\r\n")); if(onewire_firstAddress()) { xprintf(PSTR("> Addr: %X\t"),ROM_NO[0]); for(t=0;t<7;t++) xprintf(PSTR("%X\t"),ROM_NO[t+1]); xmit('\r'); xmit('\n'); i=1; } while(onewire_nextAddress()) { xprintf(PSTR("> Addr: %X\t"),ROM_NO[0]); for(t=0;t<7;t++) xprintf(PSTR("%X\t"),ROM_NO[t+1]); xmit('\r'); xmit('\n'); i++; } xprintf(PSTR("> End of search with %d device(s) found\r\n"),i); while(1) { // ... } return 0; }