-
- Permission to use, copy, modify, distribute, and sell this
+
+ Permission to use, copy, modify, distribute, and sell this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
software without specific, written prior permission.
The author disclaim all warranties with regard to this
* Main source file for the KeyboardMouse demo. This file contains the main tasks of the demo and
* is responsible for the initial application hardware configuration.
*/
* Main source file for the KeyboardMouse demo. This file contains the main tasks of the demo and
* is responsible for the initial application hardware configuration.
*/
#include "KeyboardMouse.h"
/** Global structure to hold the current keyboard interface HID report, for transmission to the host */
USB_KeyboardReport_Data_t KeyboardReportData;
/** Global structure to hold the current mouse interface HID report, for transmission to the host */
#include "KeyboardMouse.h"
/** Global structure to hold the current keyboard interface HID report, for transmission to the host */
USB_KeyboardReport_Data_t KeyboardReportData;
/** Global structure to hold the current mouse interface HID report, for transmission to the host */
HID_EPSIZE, ENDPOINT_BANK_SINGLE);
/* Indicate endpoint configuration success or failure */
HID_EPSIZE, ENDPOINT_BANK_SINGLE);
/* Indicate endpoint configuration success or failure */
-/** Event handler for the USB_UnhandledControlPacket event. This is used to catch standard and class specific
- * control requests that are not handled internally by the USB library (including the HID commands, which are
- * all issued via the control endpoint), so that they can be handled appropriately for the application.
+/** Event handler for the USB_ControlRequest event. This is used to catch and process control requests sent to
+ * the device from the USB host before passing along unhandled control requests to the library for processing
+ * internally.
/* Determine if it is the mouse or the keyboard data that is being requested */
if (!(USB_ControlRequest.wIndex))
{
/* Determine if it is the mouse or the keyboard data that is being requested */
if (!(USB_ControlRequest.wIndex))
{
/* Write the report data to the control endpoint */
Endpoint_Write_Control_Stream_LE(ReportData, ReportSize);
/* Write the report data to the control endpoint */
Endpoint_Write_Control_Stream_LE(ReportData, ReportSize);
/* Clear the report data afterwards */
memset(ReportData, 0, ReportSize);
/* Clear the report data afterwards */
memset(ReportData, 0, ReportSize);
if (!(Buttons_GetStatus() & BUTTONS_BUTTON1))
{
/* Make sent key uppercase by indicating that the left shift key is pressed */
if (!(Buttons_GetStatus() & BUTTONS_BUTTON1))
{
/* Make sent key uppercase by indicating that the left shift key is pressed */
/* Read in and process the LED report from the host */
Keyboard_ProcessLEDReport(Endpoint_Read_Byte());
/* Read in and process the LED report from the host */
Keyboard_ProcessLEDReport(Endpoint_Read_Byte());