Пример #1
0
        public DS18B20(OneWire ow, OneWireBus.Device dev)
        {
            m_ow = ow;

            if (dev == null)
            {
                var devs = OneWireBus.Scan(ow, OneWireBus.Family.DS18B20);

                if (devs == null || devs.Length < 1)
                    throw new InvalidOperationException("No DS18B20 devices found on OneWire bus");

                dev = devs[0];
            }

            m_dev = dev;
        }
Пример #2
0
        public DS18B20(Cpu.Pin pin, OneWireBus.Device dev)
        {
            m_op = new OutputPort(pin, false);
            m_ow = new OneWire(m_op);

            if (dev == null)
            {
                var devs = OneWireBus.Scan(m_ow, OneWireBus.Family.DS18B20);

                if (devs == null || devs.Length < 1)
                    throw new InvalidOperationException("No DS18B20 devices found on OneWire bus");

                dev = devs[0];
            }

            m_dev = dev;
        }