Merge branch 'master' into chibios
This commit is contained in:
commit
b388269407
21 changed files with 148 additions and 39 deletions
|
|
@ -53,6 +53,7 @@
|
|||
#include "lufa.h"
|
||||
|
||||
uint8_t keyboard_idle = 0;
|
||||
/* 0: Boot Protocol, 1: Report Protocol(default) */
|
||||
uint8_t keyboard_protocol = 1;
|
||||
static uint8_t keyboard_led_stats = 0;
|
||||
|
||||
|
|
@ -217,6 +218,9 @@ void EVENT_USB_Device_StartOfFrame(void)
|
|||
|
||||
/** Event handler for the USB_ConfigurationChanged event.
|
||||
* This is fired when the host sets the current configuration of the USB device after enumeration.
|
||||
*
|
||||
* ATMega32u2 supports dual bank(ping-pong mode) only on endpoint 3 and 4,
|
||||
* it is safe to use singl bank for all endpoints.
|
||||
*/
|
||||
void EVENT_USB_Device_ConfigurationChanged(void)
|
||||
{
|
||||
|
|
@ -241,7 +245,7 @@ void EVENT_USB_Device_ConfigurationChanged(void)
|
|||
#ifdef CONSOLE_ENABLE
|
||||
/* Setup Console HID Report Endpoints */
|
||||
ConfigSuccess &= ENDPOINT_CONFIG(CONSOLE_IN_EPNUM, EP_TYPE_INTERRUPT, ENDPOINT_DIR_IN,
|
||||
CONSOLE_EPSIZE, ENDPOINT_BANK_DOUBLE);
|
||||
CONSOLE_EPSIZE, ENDPOINT_BANK_SINGLE);
|
||||
#if 0
|
||||
ConfigSuccess &= ENDPOINT_CONFIG(CONSOLE_OUT_EPNUM, EP_TYPE_INTERRUPT, ENDPOINT_DIR_OUT,
|
||||
CONSOLE_EPSIZE, ENDPOINT_BANK_SINGLE);
|
||||
|
|
@ -346,10 +350,7 @@ void EVENT_USB_Device_ControlRequest(void)
|
|||
Endpoint_ClearSETUP();
|
||||
Endpoint_ClearStatusStage();
|
||||
|
||||
keyboard_protocol = ((USB_ControlRequest.wValue & 0xFF) != 0x00);
|
||||
#ifdef NKRO_ENABLE
|
||||
keyboard_nkro = !!keyboard_protocol;
|
||||
#endif
|
||||
keyboard_protocol = (USB_ControlRequest.wValue & 0xFF);
|
||||
clear_keyboard();
|
||||
}
|
||||
}
|
||||
|
|
@ -396,7 +397,7 @@ static void send_keyboard(report_keyboard_t *report)
|
|||
|
||||
/* Select the Keyboard Report Endpoint */
|
||||
#ifdef NKRO_ENABLE
|
||||
if (keyboard_nkro) {
|
||||
if (keyboard_protocol && keyboard_nkro) {
|
||||
/* Report protocol - NKRO */
|
||||
Endpoint_SelectEndpoint(NKRO_IN_EPNUM);
|
||||
|
||||
|
|
|
|||
|
|
@ -59,10 +59,16 @@ static inline void query(void);
|
|||
static inline void reset(void);
|
||||
static inline uint32_t response(void);
|
||||
|
||||
#define out_hi_delay(intervals) do { out_hi(); _delay_us(NEXT_KBD_TIMING * intervals); } while (0);
|
||||
#define out_lo_delay(intervals) do { out_lo(); _delay_us(NEXT_KBD_TIMING * intervals); } while (0);
|
||||
#define query_delay(intervals) do { query(); _delay_us(NEXT_KBD_TIMING * intervals); } while (0);
|
||||
#define reset_delay(intervals) do { reset(); _delay_us(NEXT_KBD_TIMING * intervals); } while (0);
|
||||
/* The keyboard sends signal with 50us pulse width on OUT line
|
||||
* while it seems to miss the 50us pulse on In line.
|
||||
* next_kbd_set_leds() often fails to sync LED status with 50us
|
||||
* but it works well with 51us(+1us) on TMK converter(ATMeaga32u2) at least.
|
||||
* TODO: test on Teensy and Pro Micro configuration
|
||||
*/
|
||||
#define out_hi_delay(intervals) do { out_hi(); _delay_us((NEXT_KBD_TIMING+1) * intervals); } while (0);
|
||||
#define out_lo_delay(intervals) do { out_lo(); _delay_us((NEXT_KBD_TIMING+1) * intervals); } while (0);
|
||||
#define query_delay(intervals) do { query(); _delay_us((NEXT_KBD_TIMING+1) * intervals); } while (0);
|
||||
#define reset_delay(intervals) do { reset(); _delay_us((NEXT_KBD_TIMING+1) * intervals); } while (0);
|
||||
|
||||
void next_kbd_init(void)
|
||||
{
|
||||
|
|
@ -79,6 +85,7 @@ void next_kbd_init(void)
|
|||
|
||||
void next_kbd_set_leds(bool left, bool right)
|
||||
{
|
||||
cli();
|
||||
out_lo_delay(9);
|
||||
|
||||
out_hi_delay(3);
|
||||
|
|
@ -98,6 +105,7 @@ void next_kbd_set_leds(bool left, bool right)
|
|||
|
||||
out_lo_delay(7);
|
||||
out_hi();
|
||||
sei();
|
||||
}
|
||||
|
||||
#define NEXT_KBD_READ (NEXT_KBD_IN_PIN&(1<<NEXT_KBD_IN_BIT))
|
||||
|
|
|
|||
|
|
@ -1 +0,0 @@
|
|||
Subproject commit 94c560c854c7a1dfc35e9de9db05de1b202de6c6
|
||||
|
|
@ -1 +0,0 @@
|
|||
Subproject commit c30fcdf1f112de581de7b145a97630539e5cff44
|
||||
|
|
@ -1 +0,0 @@
|
|||
Subproject commit 77762338286535dabb9c94b87060e33e487ff0f3
|
||||
|
|
@ -1 +0,0 @@
|
|||
Subproject commit 77b033420485f7d3d35430c0e8d4d844aa894834
|
||||
Loading…
Add table
Add a link
Reference in a new issue