EVENT_HANDLER(USB_UnhandledControlPacket)\r
{\r
/* Handle HID Class specific requests */\r
- switch (bRequest)\r
+ switch (USB_ControlRequest.bRequest)\r
{\r
case REQ_SetReport:\r
- if (bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE))\r
+ if (USB_ControlRequest.bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE))\r
{\r
- Endpoint_ClearSetupReceived();\r
+ Endpoint_ClearSETUP();\r
\r
/* Wait until the command (report) has been sent by the host */\r
- while (!(Endpoint_IsSetupOUTReceived()));\r
+ while (!(Endpoint_IsOUTReceived()));\r
\r
/* Read in the write destination address */\r
uint16_t PageAddress = Endpoint_Read_Word_LE();\r
/* Check if endpoint is empty - if so clear it and wait until ready for next packet */\r
if (!(Endpoint_BytesInEndpoint()))\r
{\r
- Endpoint_ClearSetupOUT();\r
- while (!(Endpoint_IsSetupOUTReceived()));\r
+ Endpoint_ClearOUT();\r
+ while (!(Endpoint_IsOUTReceived()));\r
}\r
\r
/* Write the next data word to the FLASH page */\r
boot_rww_enable();\r
}\r
\r
- Endpoint_ClearSetupOUT();\r
+ Endpoint_ClearOUT();\r
\r
- /* Wait until the host is ready to receive the request confirmation */\r
- while (!(Endpoint_IsSetupINReady()));\r
- \r
- /* Handshake the request by sending an empty IN packet */\r
- Endpoint_ClearSetupIN();\r
+ /* Acknowledge status stage */\r
+ while (!(Endpoint_IsINReady()));\r
+ Endpoint_ClearIN();\r
}\r
\r
break;\r