void DallasTemperature::begin(void) { DeviceAddress deviceAddress; _wire->reset_search(); devices = 0; // Reset the number of devices when we enumerate wire devices while (_wire->search(deviceAddress)) { if (validAddress(deviceAddress)) { #if REQUIRESPARASITEPOWERAVAILABLE if (!parasite && readPowerSupply(deviceAddress)) parasite = true; #endif ScratchPad scratchPad; readScratchPad(deviceAddress, scratchPad); #if REQUIRESONLY12BITCONVERSION setResolution(deviceAddress, 12); #else //bitResolution = max(bitResolution, getResolution(deviceAddress)); uint8_t newResolution = getResolution(deviceAddress); if (newResolution > bitResolution) { // the max macro may call getResultion multiple times. bitResolution = newResolution; } #endif devices++; } } }
// initialise the bus void DallasTemperature::begin(void){ DeviceAddress deviceAddress; _wire->reset_search(); devices = 0; // Reset the number of devices when we enumerate wire devices while (_wire->search(deviceAddress)){ if (validAddress(deviceAddress)){ if (!parasite && readPowerSupply(deviceAddress)) parasite = true; bitResolution = max(bitResolution, getResolution(deviceAddress)); devices++; } } }
// initialize the bus void DallasTemperature::begin(void) { DeviceAddress deviceAddress; _wire->reset_search(); while (_wire->search(deviceAddress)) { if (validAddress(deviceAddress)) { if (!parasite && readPowerSupply(deviceAddress)) parasite = true; ScratchPad scratchPad; readScratchPad(deviceAddress, scratchPad); if (deviceAddress[0] == DS18S20MODEL) conversionDelay = TEMP_12_BIT; // 750 ms else if (scratchPad[CONFIGURATION] > conversionDelay) conversionDelay = scratchPad[CONFIGURATION]; devices++; } } }