You are currently viewing the documentation for:
The ECUSB_Device_Init function configures and initialises a new USB device.
ECUSB_ErrorCode ECUSB_Device_Init(
   struct ECUSB_Device *pDevice,
   struct ECUSB_Device_Configuration *pConfiguration
A pointer to a struct ECUSB_Device. This struct holds internal data for the USB Device. ESUSB_Device_Init will clear and initialize the struct.
A pointer to a struct ECUSB_Device_Configuration. This struct needs to be created by the user, cleared and the necessary values needs to be filled in. See description of struct ECUSB_Device_Configuration for a reference of the fields in this struct.
Return value
Returns one of the ECUSB error codes (ECUSB_SUCCESS on success)
Example Code

   // Initialize the USB Device
   struct ECUSB_Device_Configuration deviceConfiguration;
   memset(&deviceConfiguration, 0, sizeof(deviceConfiguration));
   deviceConfiguration.m_wVendorID              = 0x2351;
   deviceConfiguration.m_wProductID             = 0x0200;
   deviceConfiguration.m_wDeviceReleaseMajor    = 0;
   deviceConfiguration.m_wDeviceReleaseMinor    = 1;
   deviceConfiguration.m_wPowerConsumption      = 100;
   deviceConfiguration.m_bSelfPowered           = FALSE;
   deviceConfiguration.m_szManufacturer         = "";
   deviceConfiguration.m_szProductDescription   = " USB Packet Sample Device";
   deviceConfiguration.m_dwSerialNumber         = 0x1234ABCD;
   printf("Calling ECUSB_Device_Init()...");
   err = ECUSB_Device_Init(&myUsbDevice.m_device, &deviceConfiguration);
   if(err != ECUSB_SUCCESS) 
      halt("ECUSB_Device_Init failed", err);