Manuals
General operations
USB Device operations
Packet function operations
Serial function operations
Stream function operations
ECUSB_Packet_Init
The ECUSB_Packet_Init function configures and initialises the packet function driver.
ECUSB_ErrorCode ECUSB_Packet_Init(
struct ECUSB_Packet_Function *pPacketFunction,
struct ECUSB_Packet_Configuration *pConfiguration
);
struct ECUSB_Packet_Function *pPacketFunction,
struct ECUSB_Packet_Configuration *pConfiguration
);
Parameters
pPacketFunction
A pointer to a struct ECUSB_Packet_Function that will be cleared and initialized by ECF_Packet_Init().
pConfiguration
A pointer to a struct ECUSB_Packet_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_Packet_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 Packet function driver
struct ECUSB_Packet_Configuration packetConfiguration;
memset(&packetConfiguration, 0, sizeof(packetConfiguration));
packetConfiguration.m_pDevice = &myUsbDevice.m_device;
printf("Calling ECUSB_Packet_Init()...");
err = ECUSB_Packet_Init(&myUsbDevice.m_packetFunction, &packetConfiguration);
if(err != ECUSB_SUCCESS)
halt("ECUSB_Packet_Init failed", err);
printf("ok!\r\n");