Main Site Documentation

USBH_Device where this class?


#1

USBH_Device not found!!! Bug???


using System;
using System.Threading;
using Microsoft.SPOT;
using Microsoft.SPOT.Hardware;
using GHIElectronics.NETMF.FEZ;
using Microsoft.SPOT.Net.NetworkInformation;
using System.Net;
using System.IO.Ports;
using GHIElectronics.NETMF.USBHost;


namespace FEZ_Cobra_Console_Application1
{
    public class Program
    {
        static USBH_SerialUSB serialUSB;
        static Thread serialUSBThread;

        public static void Main()
        {
            USBHostController.DeviceConnectedEvent += new USBH_DeviceConnectionEventHandler(USBHostController_DeviceConnectedEvent);
        }

        static void USBHostController_DeviceConnectedEvent(GHIElectronics.NETMF.USBHost.[b]USBH_Device[/b] device)
        {
            Debug.Print("Device connected");
            switch (device.TYPE)
            {
                case USBH_DeviceType.Serial_FTDI: // FTDI connected
                    serialUSB = new USBH_SerialUSB(device, 9600,
                    System.IO.Ports.Parity.None, 8,
                    System.IO.Ports.StopBits.One);
                    serialUSB.Open();
                    serialUSBThread = new Thread(SerialUSBThread);
                    serialUSBThread.Start();
                    break;
                case USBH_DeviceType.Unknown: // SiLabs but not recognized
                    // force SiLabs
                    USBH_Device silabs = new USBH_Device(device.ID,
                    device.INTERFACE_INDEX,
                    USBH_DeviceType.Serial_SiLabs, device.VENDOR_ID,
                    device.PRODUCT_ID, device.PORT_NUMBER);
                    serialUSB = new USBH_SerialUSB(silabs, 9600,
                    System.IO.Ports.Parity.None, 8,
                    System.IO.Ports.StopBits.One);
                    serialUSB.Open();
                    serialUSBThread = new Thread(SerialUSBThread);
                    serialUSBThread.Start();
                    break;
            }
        }


#2

Topic closed! Sorry, i found in…Systems namespace