USB Component
Version 6.6
MDK-Professional Middleware for USB Device and Host
|
User API reference of the USB Device Core. More...
Functions | |
usbStatus | USBD_Initialize (uint8_t device) |
Initialize USB Device stack and controller. | |
usbStatus | USBD_Uninitialize (uint8_t device) |
De-initialize USB Device stack and controller. | |
usbStatus | USBD_Connect (uint8_t device) |
Activate pull-up on D+ or D- line to signal USB Device connection on USB Bus. | |
usbStatus | USBD_Disconnect (uint8_t device) |
Disconnect USB Device from USB Bus. | |
bool | USBD_Configured (uint8_t device) |
Return USB Device configuration status. | |
usbdRequestStatus | USBD_Devicen_Endpoint0_SetupPacketReceived (const USB_SETUP_PACKET *setup_packet, uint8_t **buf, int32_t *len) |
Callback function called when Device received SETUP PACKET on Control Endpoint 0. | |
void | USBD_Devicen_Endpoint0_SetupPacketProcessed (const USB_SETUP_PACKET *setup_packet) |
Callback function called when SETUP PACKET was processed by USB library. | |
usbdRequestStatus | USBD_Devicen_Endpoint0_OutDataReceived (uint32_t len) |
Callback function called when Device received OUT DATA on Control Endpoint 0. | |
usbdRequestStatus | USBD_Devicen_Endpoint0_InDataSent (uint32_t len) |
Callback function called when Device sent IN DATA on Control Endpoint 0. | |
void | USBD_Devicen_Initialize (void) |
Called during USBD_Initialize to initialize the USB Device. | |
void | USBD_Devicen_Uninitialize (void) |
Called during USBD_Uninitialize to de-initialize the USB Device. | |
void | USBD_Devicen_EventReset (void) |
Device Reset Event handling. | |
User API reference of the USB Device Core.
For a general function overview refer to the section Core.
bool USBD_Configured | ( | uint8_t | device | ) |
Return USB Device configuration status.
[in] | device | index of USB Device. |
The function USBD_Configured retrieves the configuration status of the USB Device. It determines whether the USB Device has been configured and is ready to communicate.
The argument device specifies the instance of the USB Device.
usbStatus USBD_Connect | ( | uint8_t | device | ) |
Activate pull-up on D+ or D- line to signal USB Device connection on USB Bus.
[in] | device | index of USB Device. |
The function USBD_Connect connects the USB Device to the USB Bus. This typically initiates the enumeration on the USB Host side for the USB Device.
The argument device specifies the instance of the USB Device.
Code Example
usbdRequestStatus USBD_Devicen_Endpoint0_InDataSent | ( | uint32_t | len | ) |
Callback function called when Device sent IN DATA on Control Endpoint 0.
[in] | len | number of sent data bytes. |
The callback function USBD_Devicen_Endpoint0_InDataSent is called when the USB Device sent IN DATA on Control Endpoint 0.
The argument len specifies the number of sent data bytes.
This function can be modified in the user code template file USBD_User_Device_n.c.
usbdRequestStatus USBD_Devicen_Endpoint0_OutDataReceived | ( | uint32_t | len | ) |
Callback function called when Device received OUT DATA on Control Endpoint 0.
[in] | len | number of received data bytes. |
The callback function USBD_Devicen_Endpoint0_OutDataReceived is called when the USB Device received an OUT DATA on Control Endpoint 0.
The argument len specifies the number of received data bytes.
This function can be modified in the user code template file USBD_User_Device_n.c.
void USBD_Devicen_Endpoint0_SetupPacketProcessed | ( | const USB_SETUP_PACKET * | setup_packet | ) |
Callback function called when SETUP PACKET was processed by USB library.
[in] | setup_packet | pointer to processed setup packet. |
The callback function USBD_Devicen_Endpoint0_SetupPacketProcessed is called when a SETUP PACKET was processed by the USB library.
The argument setup_packet is a pointer to the processed setup packet.
This function can be modified in the user code template file USBD_User_Device_n.c.
Code Example
usbdRequestStatus USBD_Devicen_Endpoint0_SetupPacketReceived | ( | const USB_SETUP_PACKET * | setup_packet, |
uint8_t ** | buf, | ||
int32_t * | len | ||
) |
Callback function called when Device received SETUP PACKET on Control Endpoint 0.
[in] | setup_packet | pointer to received setup packet. |
[out] | buf | pointer to data buffer used for data stage requested by setup packet. |
[out] | len | pointer to number of data bytes in data stage requested by setup packet. |
The callback function USBD_Devicen_Endpoint0_SetupPacketReceived is called when the USB Device Instance n received a SETUP PACKET on Control Endpoint 0.
The argument setup_packet is a pointer to the received setup packet.
The argument buf is a pointer to the data buffer that is used for data stage requested by setup packet.
The argument len is a pointer to the number of data bytes in the data stage requested by setup packet.
This function can be modified in the user code template file USBD_User_Device_n.c.
Code Example
void USBD_Devicen_EventReset | ( | void | ) |
Device Reset Event handling.
Use the function USBD_Devicen_EventReset to specify custom USB Device reset event handling. This function can be found in the user code template file USBD_User_Device_n.c.
void USBD_Devicen_Initialize | ( | void | ) |
Called during USBD_Initialize to initialize the USB Device.
If available, the function USBD_Devicen_Initialize is called automatically upon initialization of the USB Device and needs no invocation in the user code. Modify this function for custom USB Device handling. This function can be modified in the user code template file USBD_User_Device_n.c.
Code Example
void USBD_Devicen_Uninitialize | ( | void | ) |
Called during USBD_Uninitialize to de-initialize the USB Device.
If available, the function USBD_Devicen_Uninitialize is called automatically upon un-initialization of the USB Device and needs no invocation in the user code. Modify this function for custom USB Device handling. This function can be found in the user code template file USBD_User_Device_n.c.
Code Example
usbStatus USBD_Disconnect | ( | uint8_t | device | ) |
Disconnect USB Device from USB Bus.
[in] | device | index of USB Device. |
The function USBD_Disconnect disconnects the USB Device from the USB Bus. After executing this function the USB Device can no longer be accessed from the USB Host.
The argument device specifies the instance of the USB Device.
usbStatus USBD_Initialize | ( | uint8_t | device | ) |
Initialize USB Device stack and controller.
[in] | device | index of USB Device. |
The function USBD_Initialize initializes the USB Device Controller Core and Hardware Driver (such as the USB clock and pins). It starts all the tasks and sets up the main USB interrupt service routine. In any application, the USBD_Initialize function must be called before invoking any other USB Device function. The function does not initialize any non-USB hardware features.
The argument device specifies the instance of the USB Device.
Code Example
usbStatus USBD_Uninitialize | ( | uint8_t | device | ) |
De-initialize USB Device stack and controller.
[in] | device | index of USB Device. |
De-initialize the USB Device Controller Core and Hardware Driver. Invoke this function when USB is not to be used any more.
The argument device specifies the instance of the USB Device.