[Missing <summary> documentation for "N:UsbFunctionLibrary"]

Classes

  ClassDescription
ConnectEvent
Event Handler for Device Connected / Disconnected
DataReceivedEvent
Event for receiving data
EndPointIN
Used for IN-Direction endpoints. Handles initialisation, enable, data-receive and close features
EndPointOUT
Used for OUT-Direction endpoints. Handles initialisation, send-data and close features
UsbFunctions
Main Class for USB functionality with use of LibUsbDotNet

Examples

CopyC#
public UsbFunctions USB;
private void InitUsbWithAutoConnect()
{
    USB = new UsbFunctions();
    bool res = USB.OpenUsbDevice(0x1F55,0x000F,512); // Vendor ID, Product ID, Max Incoming Buffer Size
}

private void InitUsbWithoutAutoConnect()
{
    UsbFunctions USB = new UsbFunctions();
    bool res = USB.OpenUsbDevice(0x1F55,0x000F,512); // Vendor ID, Product ID, Max Incoming Buffer Size
    if (res == false) 
    {
        USB.CloseUsbDevice();
    }
    // USB was succesful initalized
}

private CloseDevice()
{
    USB.CloseUsbDevice();
}

private void WriteData(int endpoint, byte[] data, int timeout)
{
    int byteswritten;
    USB.GetWriteEndpoint(endpoint).Write(data,timeout,out byteswritten);
}

private void ReadData()
{
    if(USB.GetReadEndpoint(endpoint).BytesReceived > 0)
    {
       byte[] data = USB.GetReadEndpoint(endpoint).GetReadPackage();
    }
}
UsbHandShake
Usb Hand Shake Class, which enables two endpoints for an handshaking protocoll. The class can be used to send multiple data packages to the microcontroller. The microcontroller answers with an handshake for next data.