1 /*----------------------------------------------------------------------------
3 *----------------------------------------------------------------------------
5 * Purpose: USB Custom User Module
7 *----------------------------------------------------------------------------
8 * This software is supplied "AS IS" without any warranties, express,
9 * implied or statutory, including but not limited to the implied
10 * warranties of fitness for purpose, satisfactory quality and
11 * noninfringement. Keil extends you a royalty-free right to reproduce
12 * and distribute executable files created using this software for use
13 * on NXP Semiconductors LPC microcontroller devices only. Nothing else
14 * gives you the right to use this software.
16 * Copyright (c) 2009 Keil - An ARM Company. All rights reserved.
17 *---------------------------------------------------------------------------*/
18 #include "projectconfig.h"
29 * USB Power Event Callback
30 * Called automatically on USB Power Event
31 * Parameter: power: On(TRUE)/Off(FALSE)
35 void USB_Power_Event (uint32_t power
) {
41 * USB Reset Event Callback
42 * Called automatically on USB Reset Event
46 void USB_Reset_Event (void) {
53 * USB Suspend Event Callback
54 * Called automatically on USB Suspend Event
58 void USB_Suspend_Event (void) {
64 * USB Resume Event Callback
65 * Called automatically on USB Resume Event
69 void USB_Resume_Event (void) {
75 * USB Remote Wakeup Event Callback
76 * Called automatically on USB Remote Wakeup Event
80 void USB_WakeUp_Event (void) {
86 * USB Start of Frame Event Callback
87 * Called automatically on USB Start of Frame Event
91 void USB_SOF_Event (void) {
97 * USB Error Event Callback
98 * Called automatically on USB Error Event
99 * Parameter: error: Error Code
103 void USB_Error_Event (uint32_t error
) {
109 * USB Set Configuration Event Callback
110 * Called automatically on USB Set Configuration Request
113 #if USB_CONFIGURE_EVENT
114 void USB_Configure_Event (void) {
116 if (USB_Configuration
) { /* Check if USB is configured */
117 /* add your code here */
124 * USB Set Interface Event Callback
125 * Called automatically on USB Set Interface Request
128 #if USB_INTERFACE_EVENT
129 void USB_Interface_Event (void) {
135 * USB Set/Clear Feature Event Callback
136 * Called automatically on USB Set/Clear Feature Request
139 #if USB_FEATURE_EVENT
140 void USB_Feature_Event (void) {
145 #define P_EP(n) ((USB_EP_EVENT & (1 << (n))) ? USB_EndPoint##n : NULL)
147 /* USB Endpoint Events Callback Pointers */
148 void (* const USB_P_EP
[USB_LOGIC_EP_NUM
]) (uint32_t event
) = {
158 * USB Endpoint 1 Event Callback
159 * Called automatically on USB Endpoint 1 Event
163 void USB_EndPoint1 (uint32_t event
) {
165 static uint16_t serialState
;
169 temp
= CDC_GetSerialState();
170 if (serialState
!= temp
) {
172 CDC_NotificationIn(); /* send SERIAL_STATE notification */
180 * USB Endpoint 2 Event Callback
181 * Called automatically on USB Endpoint 2 Event
185 void USB_EndPoint2 (uint32_t event
) {
191 * USB Endpoint 3 Event Callback
192 * Called automatically on USB Endpoint 3 Event
196 void USB_EndPoint3 (uint32_t event
) {
199 CDC_BulkOut (); /* data received from Host */
202 CDC_BulkIn (); /* data expected from Host */
This page took 0.047284 seconds and 5 git commands to generate.