void add_key(uint8_t key) | void add_key(uint8_t key) | ||||
{ | { | ||||
#ifdef NKRO_ENABLE | #ifdef NKRO_ENABLE | ||||
if (keyboard_nkro) { | |||||
if (keyboard_protocol && keyboard_nkro) { | |||||
add_key_bit(key); | add_key_bit(key); | ||||
return; | return; | ||||
} | } | ||||
void del_key(uint8_t key) | void del_key(uint8_t key) | ||||
{ | { | ||||
#ifdef NKRO_ENABLE | #ifdef NKRO_ENABLE | ||||
if (keyboard_nkro) { | |||||
if (keyboard_protocol && keyboard_nkro) { | |||||
del_key_bit(key); | del_key_bit(key); | ||||
return; | return; | ||||
} | } | ||||
uint8_t get_first_key(void) | uint8_t get_first_key(void) | ||||
{ | { | ||||
#ifdef NKRO_ENABLE | #ifdef NKRO_ENABLE | ||||
if (keyboard_nkro) { | |||||
if (keyboard_protocol && keyboard_nkro) { | |||||
uint8_t i = 0; | uint8_t i = 0; | ||||
for (; i < KEYBOARD_REPORT_BITS && !keyboard_report->nkro.bits[i]; i++) | for (; i < KEYBOARD_REPORT_BITS && !keyboard_report->nkro.bits[i]; i++) | ||||
; | ; |
print_val_hex8(host_keyboard_leds()); | print_val_hex8(host_keyboard_leds()); | ||||
print_val_hex8(keyboard_protocol); | print_val_hex8(keyboard_protocol); | ||||
print_val_hex8(keyboard_idle); | print_val_hex8(keyboard_idle); | ||||
print_val_hex8(keyboard_nkro); | |||||
print_val_hex32(timer_count); | print_val_hex32(timer_count); | ||||
#ifdef PROTOCOL_PJRC | #ifdef PROTOCOL_PJRC |
#include "lufa.h" | #include "lufa.h" | ||||
uint8_t keyboard_idle = 0; | uint8_t keyboard_idle = 0; | ||||
/* 0: Boot Protocol, 1: Report Protocol(default) */ | |||||
uint8_t keyboard_protocol = 1; | uint8_t keyboard_protocol = 1; | ||||
static uint8_t keyboard_led_stats = 0; | static uint8_t keyboard_led_stats = 0; | ||||
Endpoint_ClearSETUP(); | Endpoint_ClearSETUP(); | ||||
Endpoint_ClearStatusStage(); | 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(); | clear_keyboard(); | ||||
} | } | ||||
} | } | ||||
/* Select the Keyboard Report Endpoint */ | /* Select the Keyboard Report Endpoint */ | ||||
#ifdef NKRO_ENABLE | #ifdef NKRO_ENABLE | ||||
if (keyboard_nkro) { | |||||
if (keyboard_protocol && keyboard_nkro) { | |||||
/* Report protocol - NKRO */ | /* Report protocol - NKRO */ | ||||
Endpoint_SelectEndpoint(NKRO_IN_EPNUM); | Endpoint_SelectEndpoint(NKRO_IN_EPNUM); | ||||