Beispiel #1
0
 public ADT7410(string port, byte adr)
 {
     if (!SC18IM700.Open(port))
     {
         Console.WriteLine("COM Port Open Failed");
         return;
     }
     address = adr;
 }
Beispiel #2
0
        public double TempRead()
        {
            var data = SC18IM700.I2cRead(address, 2);

            if (data == Array.Empty <byte>())
            {
                return(0.0);
            }

            if (!BitConverter.IsLittleEndian)
            {
                data.Reverse();
            }
            var temp = ((data[0] << 8 | data[1]) >> 3);

            return((double)temp / 16);
        }
Beispiel #3
0
 public void CommandWrite(byte command)
 {
     SC18IM700.I2cWrite(address, new Byte[] { 0x00, command });
     Task.Delay(10).Wait();
 }
Beispiel #4
0
 public void DataWrite(byte data)
 {
     SC18IM700.I2cWrite(address, new Byte[] { 0x40, data });
     Task.Delay(10).Wait();
 }
Beispiel #5
0
 public byte[] RegRead(byte reg)
 {
     SC18IM700.I2cRead(address, reg);
     return(SC18IM700.I2cRead(address));
 }
Beispiel #6
0
 public bool RegWrite(byte reg, byte val)
 {
     return(SC18IM700.I2cWrite(address, new Byte[] { reg, val }));
 }