@ -212,6 +212,10 @@ void Keyboard_HID_Task(void)
{
uint8_t JoyStatus_LCL = Joystick_GetStatus ( ) ;
/* Device must be connected and configured for the task to run */
if ( ! ( USB_IsConnected ) | | ! ( USB_ConfigurationNumber ) )
return ;
/* Check if board button is not pressed, if so mouse mode enabled */
if ( ! ( Buttons_GetStatus ( ) & BUTTONS_BUTTON1 ) )
{
@ -229,9 +233,6 @@ void Keyboard_HID_Task(void)
KeyboardReportData . KeyCode [ 0 ] = 0x08 ; // E
}
/* Check if the USB system is connected to a host and report protocol mode is enabled */
if ( USB_IsConnected )
{
/* Select the Keyboard Report Endpoint */
Endpoint_SelectEndpoint ( KEYBOARD_IN_EPNUM ) ;
@ -274,7 +275,6 @@ void Keyboard_HID_Task(void)
Endpoint_ClearOUT ( ) ;
}
}
}
/** Mouse task. This generates the next mouse HID report for the host, and transmits it via the
* mouse IN endpoint when the host is ready for more data .
@ -283,6 +283,10 @@ void Mouse_HID_Task(void)
{
uint8_t JoyStatus_LCL = Joystick_GetStatus ( ) ;
/* Device must be connected and configured for the task to run */
if ( ! ( USB_IsConnected ) | | ! ( USB_ConfigurationNumber ) )
return ;
/* Check if board button is pressed, if so mouse mode enabled */
if ( Buttons_GetStatus ( ) & BUTTONS_BUTTON1 )
{
@ -300,9 +304,6 @@ void Mouse_HID_Task(void)
MouseReportData . Button = ( 1 < < 0 ) ;
}
/* Check if the USB system is connected to a host and report protocol mode is enabled */
if ( USB_IsConnected )
{
/* Select the Mouse Report Endpoint */
Endpoint_SelectEndpoint ( MOUSE_IN_EPNUM ) ;
@ -319,4 +320,3 @@ void Mouse_HID_Task(void)
memset ( & MouseReportData , 0 , sizeof ( MouseReportData ) ) ;
}
}
}