public OneWireSensor(UART_Adapter UARTAdapter, byte[] rom = null) : base(UARTAdapter) { TempConversionTime = DefTempConversionTime; WriteTime = DefWriteTime; if (rom == null) { isSingleMode = true; romCode = ReadROM(); } else { isSingleMode = false; romCode = rom; if (!IsConnected(romToBits(romCode))) { throw new DeviceError($"Device with ROM code {romCode} not found"); } uart.Reset(); } isParasiticPwr = IsPowerSupply(); if (romCode[0] != FamilyCode) { throw new DeviceError($"The device is not a {DeviceName(FamilyCode)}"); } }
public static OneWireSensor CreateSensor(byte sensorType, UART_Adapter UARTAdapter, byte[] rom = null) { switch (sensorType) { case 0x01: return(new OneWireSensor(UARTAdapter, rom)); case 0x10: return(new OneWireSensor(UARTAdapter, rom)); case 0x22: return(new DS1822(UARTAdapter, rom)); case 0x28: return(new DS18B20(UARTAdapter, rom)); default: return(new OneWireSensor(UARTAdapter, rom)); } }
public OneWireDevice(UART_Adapter UARTAdapter) { uart = UARTAdapter; }
public DS18B20(UART_Adapter UARTAdapter, byte[] rom = null) : base(UARTAdapter, rom) { SetTempConv(GetResolution()); }
public DS1822(UART_Adapter UARTAdapter, byte[] rom = null) : base(UARTAdapter, rom) { }