예제 #1
0
// USB Data Send
inline void Output_send()
{
	// USB status checks
	// Non-standard USB state manipulation, usually does nothing
	usb_device_check();

	// 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;

	// Process mouse actions
	while ( USBMouse_Changed )
		usb_mouse_send();

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

	// Clear keys sent
	USBKeys_Sent = 0;

	// Signal Scan Module we are finished
	switch ( USBKeys_Protocol )
	{
	case 0: // Boot Mode
		// Clear modifiers only in boot mode
		USBKeys_Modifiers = 0;
		Scan_finishedWithOutput( USBKeys_Sent <= USB_BOOT_MAX_KEYS ? USBKeys_Sent : USB_BOOT_MAX_KEYS );
		break;
	case 1: // NKRO Mode
		Scan_finishedWithOutput( USBKeys_Sent );
		break;
	}
}
예제 #2
0
// USB Data Send
inline void Output_send()
{
	// 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();

	// Clear keys sent
	USBKeys_Sent = 0;

	// Signal Scan Module we are finished
	switch ( USBKeys_Protocol )
	{
	case 0: // Boot Mode
		// Clear modifiers only in boot mode
		USBKeys_Modifiers = 0;
		Scan_finishedWithOutput( USBKeys_Sent <= USB_BOOT_MAX_KEYS ? USBKeys_Sent : USB_BOOT_MAX_KEYS );
		break;
	case 1: // NKRO Mode
		Scan_finishedWithOutput( USBKeys_Sent );
		break;
	}
}
예제 #3
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
}
예제 #4
0
파일: output_com.c 프로젝트: Olical/ergodox
// USB Data Periodic
inline void Output_periodic()
{
	// Start latency measurement
	Latency_start_time( outputPeriodicLatencyResource );

#if enableMouse_define == 1
	// Process mouse actions
	while ( USBMouse_Changed )
		Output_callback( "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_primary.keys[c] = 0;
		}
	}

	// Send keypresses while there are pending changes
	while ( USBKeys_primary.changed )
		Output_callback( "keyboard_send", "" );

	// Clear keys sent
	USBKeys_Sent = 0;

	// Signal Scan Module we are finished
	switch ( USBKeys_Protocol )
	{
	case 0: // Boot Mode
		// Clear modifiers only in boot mode
		USBKeys_primary.modifiers = 0;
		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

	// End latency measurement
	Latency_end_time( outputPeriodicLatencyResource );
}