Ejemplo n.º 1
0
// USB Data Send
inline void Output_send()
{
	// USB status checks
	// Non-standard USB state manipulation, usually does nothing
	usb_device_check();

	// XXX - Behaves oddly on Mac OSX, might help with corrupted packets specific to OSX? -HaaTa
	/*
	// Check if idle count has been exceed, this forces usb_keyboard_send and usb_mouse_send to update
	// TODO Add joystick as well (may be endpoint specific, currently not kept track of)
	if ( usb_configuration && USBKeys_Idle_Config && (
		USBKeys_Idle_Expiry < systick_millis_count ||
		USBKeys_Idle_Expiry + USBKeys_Idle_Config * 4 >= systick_millis_count ) )
	{
		USBKeys_Changed = USBKeyChangeState_All;
		USBMouse_Changed = USBMouseChangeState_All;
	}
	*/

#if enableRawIO_define == 1
	// HID-IO Process
	HIDIO_process();
#endif

#if enableMouse_define == 1
	// Process mouse actions
	while ( USBMouse_Changed )
		usb_mouse_send();
#endif

#if enableKeyboard_define == 1
	// Boot Mode Only, unset stale keys
	if ( USBKeys_Protocol == 0 )
	{
		for ( uint8_t c = USBKeys_Sent; c < USB_BOOT_MAX_KEYS; c++ )
		{
			USBKeys_Keys[c] = 0;
		}
	}

	// Send keypresses while there are pending changes
	while ( USBKeys_Changed )
		usb_keyboard_send();

	// Signal Scan Module we are finished
	switch ( USBKeys_Protocol )
	{
	case 0: // Boot Mode
		Scan_finishedWithOutput( USBKeys_Sent <= USB_BOOT_MAX_KEYS ? USBKeys_Sent : USB_BOOT_MAX_KEYS );
		break;
	case 1: // NKRO Mode
		Scan_finishedWithOutput( USBKeys_Sent );
		break;
	}
#endif
}
Ejemplo n.º 2
0
// USB Data Poll
inline void Output_poll()
{
	// Start latency measurement
	Latency_start_time( outputPollLatencyResource );

#if enableRawIO_define == 1
	// HID-IO Process
	HIDIO_process();
#endif

	// End latency measurement
	Latency_end_time( outputPollLatencyResource );
}