Пример #1
0
 public void TestGetFloorAddr()
 {
     Assert.AreEqual(_vbmsDriverAddr.GetFloorAddr(0), 0x0);
     Assert.AreEqual(_vbmsDriverAddr.GetFloorAddr(1), 0xE0);
     Assert.AreEqual(_vbmsDriverAddr.GetFloorAddr(2), 0xE2);
     Assert.AreEqual(_vbmsDriverAddr.GetFloorAddr(3), 0xE4);
     Assert.AreEqual(_vbmsDriverAddr.GetFloorAddr(4), 0xE6);
     Assert.AreEqual(_vbmsDriverAddr.GetFloorAddr(5), 0xE8);
     Assert.AreEqual(_vbmsDriverAddr.GetFloorAddr(6), 0xEA);
     Assert.AreEqual(_vbmsDriverAddr.GetFloorAddr(7), 0xEC);
     Assert.AreEqual(_vbmsDriverAddr.GetFloorAddr(8), 0xEE);
 }
Пример #2
0
        protected bool EnableFloor(int floor, bool enable, out string msg)
        {
            msg = "";
            if (!IsFloorValid(floor, out msg))
            {
                return(false);
            }
            var status = new byte[0x100];
            var addr   = enable ? 0x0 : 0x01;

            int devAddr = DriverAddr.GetFloorAddr(floor);

            if (1 == eDriver_IO.Cls_edriverdll.i2c_write(devAddr, addr, 1, 0, new byte[] { 0 }, status))
            {
                return(true);
            }
            msg = Encoding.ASCII.GetString(status);
            return(false);
        }