|
@@ -19,7 +19,7 @@
|
|
|
/*
|
|
|
* | -- 8 BIT CRC -- | -- 48 BIT SERIAL NUMBER -- | -- 8 BIT FAMILY CODE (28h) -- |
|
|
|
*/
|
|
|
-uint8_t ROM[8] = {0,0,0,0,0,0,0,0};
|
|
|
+uint8_t rom[8] = {0,0,0,0,0,0,0,0};
|
|
|
double deviceID;
|
|
|
|
|
|
/**
|
|
@@ -30,22 +30,23 @@ double deviceID;
|
|
|
void DS18B20_init(void){
|
|
|
OneWire_init();
|
|
|
if(OW_reset()){
|
|
|
- logger_error("Unable to reset 1-Wire Bus, no Device present %s\n", strerror(errno));
|
|
|
+ logger_error("Unable to reset 1-Wire Bus, no device present %s\n", strerror(errno));
|
|
|
return;
|
|
|
}
|
|
|
+ logger(V_HAL, "Checking 1-Wire Bus for sensors..\n");
|
|
|
DS18B20_readRom();
|
|
|
- deviceID = double (ROM[1]);// | ROM[5] << 8 | ROM[5] << 16 | ROM[5] << 24 | ROM[5] << 32 | ROM[5] << 40);
|
|
|
- if(ROM[7] == 0x28){
|
|
|
- logger(V_HAL, "Found Temperatur Sensor on 1-Wire Bus\n");
|
|
|
- logger(V_HAL, "Device ID: %12X", deviceID);
|
|
|
+ deviceID = double (rom[1]);// | ROM[5] << 8 | ROM[5] << 16 | ROM[5] << 24 | ROM[5] << 32 | ROM[5] << 40);
|
|
|
+ if(rom[7] == 0x28){
|
|
|
+ logger(V_HAL, "Found temperatur sensor on 1-Wire Bus\n");
|
|
|
+ logger(V_HAL, "Device ID: %12X\n", deviceID);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
void DS18B20_readRom(void){
|
|
|
OW_writeByte(READ_ROM);
|
|
|
- uint8_t i;
|
|
|
- for(i = 8; i >= 0; i--){
|
|
|
- ROM[i] = OW_readByte();
|
|
|
+ int i;
|
|
|
+ for(i = 7; i >= 0; i--){
|
|
|
+ rom[i] = OW_readByte();
|
|
|
}
|
|
|
}
|
|
|
|