#include "mousekey.h" | #include "mousekey.h" | ||||
#endif | #endif | ||||
#ifdef HOST_PJRC | |||||
#ifdef PROTOCOL_PJRC | |||||
# include "usb_keyboard.h" | # include "usb_keyboard.h" | ||||
# ifdef EXTRAKEY_ENABLE | # ifdef EXTRAKEY_ENABLE | ||||
# include "usb_extra.h" | # include "usb_extra.h" | ||||
# endif | # endif | ||||
#endif | #endif | ||||
#ifdef HOST_VUSB | |||||
#ifdef PROTOCOL_VUSB | |||||
# include "usbdrv.h" | # include "usbdrv.h" | ||||
#endif | #endif | ||||
case KC_S: | case KC_S: | ||||
print("\n\n----- Status -----\n"); | print("\n\n----- Status -----\n"); | ||||
print_val_hex8(host_keyboard_leds()); | print_val_hex8(host_keyboard_leds()); | ||||
#ifdef HOST_PJRC | |||||
#ifdef PROTOCOL_PJRC | |||||
print_val_hex8(UDCON); | print_val_hex8(UDCON); | ||||
print_val_hex8(UDIEN); | print_val_hex8(UDIEN); | ||||
print_val_hex8(UDINT); | print_val_hex8(UDINT); | ||||
print_val_hex8(usb_keyboard_idle_count); | print_val_hex8(usb_keyboard_idle_count); | ||||
#endif | #endif | ||||
#ifdef HOST_VUSB | |||||
#ifdef PROTOCOL_PJRC | |||||
# if USB_COUNT_SOF | # if USB_COUNT_SOF | ||||
print_val_hex8(usbSofCount); | print_val_hex8(usbSofCount); | ||||
# endif | # endif | ||||
#ifdef EXTRAKEY_ENABLE | #ifdef EXTRAKEY_ENABLE | ||||
case KC_PSCREEN: | case KC_PSCREEN: | ||||
// TODO: Power key should take this feature? otherwise any key during suspend. | // TODO: Power key should take this feature? otherwise any key during suspend. | ||||
#ifdef HOST_PJRC | |||||
#ifdef PROTOCOL_PJRC | |||||
if (suspend && remote_wakeup) { | if (suspend && remote_wakeup) { | ||||
usb_remote_wakeup(); | usb_remote_wakeup(); | ||||
} else { | } else { |
/* key report size(NKRO or boot mode) */ | /* key report size(NKRO or boot mode) */ | ||||
#if defined(HOST_PJRC) | |||||
#if defined(PROTOCOL_PJRC) | |||||
# include "usb.h" | # include "usb.h" | ||||
# if defined(KBD2_REPORT_KEYS) && KBD2_REPORT_KEYS > KBD_REPORT_KEYS | # if defined(KBD2_REPORT_KEYS) && KBD2_REPORT_KEYS > KBD_REPORT_KEYS | ||||
# define REPORT_KEYS KBD2_REPORT_KEYS | # define REPORT_KEYS KBD2_REPORT_KEYS |
IWRAP_DIR = protocol/iwrap | IWRAP_DIR = protocol/iwrap | ||||
OPT_DEFS += -DHOST_IWRAP | |||||
OPT_DEFS += -DPROTOCOL_IWRAP | |||||
SRC += $(IWRAP_DIR)/iwrap.c \ | SRC += $(IWRAP_DIR)/iwrap.c \ | ||||
$(IWRAP_DIR)/suart.S \ | $(IWRAP_DIR)/suart.S \ |
#include "matrix.h" | #include "matrix.h" | ||||
#include "host.h" | #include "host.h" | ||||
#include "iwrap.h" | #include "iwrap.h" | ||||
#ifdef HOST_VUSB | |||||
#ifdef PROTOCOL_VUSB | |||||
# include "vusb.h" | # include "vusb.h" | ||||
# include "usbdrv.h" | # include "usbdrv.h" | ||||
#endif | #endif | ||||
*/ | */ | ||||
#ifdef HOST_VUSB | |||||
#ifdef PROTOCOL_VUSB | |||||
static void disable_vusb(void) | static void disable_vusb(void) | ||||
{ | { | ||||
// disable interrupt & disconnect to prevent host from enumerating | // disable interrupt & disconnect to prevent host from enumerating | ||||
//pullup_pins(); | //pullup_pins(); | ||||
//set_prr(); | //set_prr(); | ||||
#ifdef HOST_VUSB | |||||
#ifdef PROTOCOL_VUSB | |||||
disable_vusb(); | disable_vusb(); | ||||
#endif | #endif | ||||
uart_init(115200); | uart_init(115200); | ||||
last_timer = timer_read(); | last_timer = timer_read(); | ||||
while (true) { | while (true) { | ||||
#ifdef HOST_VUSB | |||||
#ifdef PROTOCOL_VUSB | |||||
if (host_get_driver() == vusb_driver()) | if (host_get_driver() == vusb_driver()) | ||||
usbPoll(); | usbPoll(); | ||||
#endif | #endif | ||||
keyboard_task(); | keyboard_task(); | ||||
#ifdef HOST_VUSB | |||||
#ifdef PROTOCOL_VUSB | |||||
if (host_get_driver() == vusb_driver()) | if (host_get_driver() == vusb_driver()) | ||||
vusb_transfer_keyboard(); | vusb_transfer_keyboard(); | ||||
#endif | #endif | ||||
print("r: reset. software reset by watchdog\n"); | print("r: reset. software reset by watchdog\n"); | ||||
print("i: insomniac. prevent KB from sleeping\n"); | print("i: insomniac. prevent KB from sleeping\n"); | ||||
print("c: iwrap_call. CALL for BT connection.\n"); | print("c: iwrap_call. CALL for BT connection.\n"); | ||||
#ifdef HOST_VUSB | |||||
#ifdef PROTOCOL_VUSB | |||||
print("u: USB mode. switch to USB.\n"); | print("u: USB mode. switch to USB.\n"); | ||||
print("w: BT mode. switch to Bluetooth.\n"); | print("w: BT mode. switch to Bluetooth.\n"); | ||||
#endif | #endif | ||||
print("iwrap_call()\n"); | print("iwrap_call()\n"); | ||||
iwrap_call(); | iwrap_call(); | ||||
return 1; | return 1; | ||||
#ifdef HOST_VUSB | |||||
#ifdef PROTOCOL_VUSB | |||||
case 'u': | case 'u': | ||||
print("USB mode\n"); | print("USB mode\n"); | ||||
init_vusb(); | init_vusb(); |
VPATH += $(TOP_DIR)/$(PJRC_DIR) | VPATH += $(TOP_DIR)/$(PJRC_DIR) | ||||
# This indicates using LUFA stack | # This indicates using LUFA stack | ||||
# TODO: remove HOST_PJRC | |||||
OPT_DEFS += -DHOST_PJRC | |||||
OPT_DEFS += -DPROTOCOL_PJRC | OPT_DEFS += -DPROTOCOL_PJRC | ||||
VUSB_DIR = protocol/vusb | VUSB_DIR = protocol/vusb | ||||
OPT_DEFS += -DHOST_VUSB | |||||
OPT_DEFS += -DPROTOCOL_VUSB | |||||
SRC += $(VUSB_DIR)/main.c \ | SRC += $(VUSB_DIR)/main.c \ | ||||
$(VUSB_DIR)/vusb.c \ | $(VUSB_DIR)/vusb.c \ |