Beispiel #1
0
        public static void Scan(MAVLinkInterface mav)
        {
            // look for valid devnames
            foreach (var spidev in spidevlist)
            {
                byte[] outBytes = new byte[0];
                var    obj      = spidev;//JsonConvert.DeserializeObject<List<string>>(spidev);
                if (mav.device_op(mav.MAV.sysid, mav.MAV.compid, out outBytes, MAVLink.DEVICE_OP_BUSTYPE.SPI, obj[2], 0,
                                  0, 0xff, 0) == (byte)device_op_error.BadResponse)
                {
                    log.Info(obj[2] + " spi driver available");
                }
            }

            foreach (var i2cdev in i2cdevlist)
            {
                byte[] outBytes = new byte[0];
                var    obj      = i2cdev;//JsonConvert.DeserializeObject<List<string>>(i2cdev);
                try
                {
                    if (mav.device_op(mav.MAV.sysid, mav.MAV.compid, out outBytes, MAVLink.DEVICE_OP_BUSTYPE.I2C, "",
                                      Convert.ToByte(obj[4]),
                                      Convert.ToByte(obj[5], 16), 0xff, 0) == (byte)device_op_error.BadResponse)
                    {
                        log.Info(obj[2] + " i2c driver available");
                    }
                }
                catch
                {
                }
            }
        }