@ -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 ) ;
@ -273,7 +274,6 @@ void Keyboard_HID_Task(void)
/* Handshake the OUT Endpoint - clear endpoint and ready for next report */
Endpoint_ClearOUT ( ) ;
}
}
}
/** Mouse task. This generates the next mouse HID report for the host, and transmits it via the
@ -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 ) ;
@ -318,5 +319,4 @@ void Mouse_HID_Task(void)
/* Clear the report data afterwards */
memset ( & MouseReportData , 0 , sizeof ( MouseReportData ) ) ;
}
}
}