@ -94,18 +94,12 @@ void SetupHardware(void)
/* Hardware Initialization */
/* Hardware Initialization */
LEDs_Init ( ) ;
LEDs_Init ( ) ;
USB_Init ( ) ;
USB_Init ( ) ;
/* Millisecond timer initialization, with output compare interrupt enabled for the idle timing */
OCR0A = ( ( F_CPU / 64 ) / 1000 ) ;
TCCR0A = ( 1 < < WGM01 ) ;
TCCR0B = ( ( 1 < < CS01 ) | ( 1 < < CS00 ) ) ;
TIMSK0 = ( 1 < < OCIE0A ) ;
}
}
/** Event handler for the library USB Connection event. */
/** Event handler for the library USB Connection event. */
void EVENT_USB_Device_Connect ( void )
void EVENT_USB_Device_Connect ( void )
{
{
LEDs_SetAllLEDs ( LEDMASK_USB_ENUMERATING ) ;
LEDs_SetAllLEDs ( LEDMASK_USB_ENUMERATING ) ;
}
}
/** Event handler for the library USB Disconnection event. */
/** Event handler for the library USB Disconnection event. */
@ -121,6 +115,8 @@ void EVENT_USB_Device_ConfigurationChanged(void)
if ( ! ( HID_Device_ConfigureEndpoints ( & Generic_HID_Interface ) ) )
if ( ! ( HID_Device_ConfigureEndpoints ( & Generic_HID_Interface ) ) )
LEDs_SetAllLEDs ( LEDMASK_USB_ERROR ) ;
LEDs_SetAllLEDs ( LEDMASK_USB_ERROR ) ;
USB_Device_EnableSOFEvents ( ) ;
}
}
/** Event handler for the library USB Unhandled Control Request event. */
/** Event handler for the library USB Unhandled Control Request event. */
@ -129,8 +125,8 @@ void EVENT_USB_Device_UnhandledControlRequest(void)
HID_Device_ProcessControlRequest ( & Generic_HID_Interface ) ;
HID_Device_ProcessControlRequest ( & Generic_HID_Interface ) ;
}
}
/** ISR to keep track of each millisecond interrupt, for determining the HID class idle period remaining when se t. */
/** Event handler for the USB device Start Of Frame even t. */
ISR ( TIMER0_COMPA_vect , ISR_BLOCK )
void EVENT_USB_Device_StartOfFrame ( void )
{
{
HID_Device_MillisecondElapsed ( & Generic_HID_Interface ) ;
HID_Device_MillisecondElapsed ( & Generic_HID_Interface ) ;
}
}