static bool command_common(uint8_t code) { static host_driver_t *host_driver = 0; switch (code) { #ifdef SLEEP_LED_ENABLE case KC_Z: // test breathing sleep LED print("Sleep LED test\n"); sleep_led_toggle(); led_set(host_keyboard_leds()); break; #endif #ifdef BOOTMAGIC_ENABLE case KC_E: print("eeconfig:\n"); print_eeconfig(); break; #endif #ifdef KEYBOARD_LOCK_ENABLE case KC_CAPSLOCK: if (host_get_driver()) { host_driver = host_get_driver(); clear_keyboard(); host_set_driver(0); print("Locked.\n"); } else { host_set_driver(host_driver); print("Unlocked.\n"); } break; #endif case KC_H: case KC_SLASH: /* ? */ command_common_help(); break; case KC_C: debug_matrix = false; debug_keyboard = false; debug_mouse = false; debug_enable = false; command_console_help(); print("C> "); command_state = CONSOLE; break; case KC_PAUSE: clear_keyboard(); print("\n\nbootloader... "); _delay_ms(1000); bootloader_jump(); // not return break; case KC_D: if (debug_enable) { <<<<<<< HEAD print("\ndebug: off\n"); ======= print("\ndebug: on\n"); >>>>>>> upstream/master
static void enter_command_mode_2(void) { prev_driver = host_get_driver(); clear_keyboard(); host_set_driver(&rn42_config_driver); // null driver; not to send a key to host //while (rn42_linked()) ; wait_ms(1100); // need 1 sec SEND_COMMAND("$$$"); wait_ms(600); // need 1 sec print_rn42(); const char *s = SEND_COMMAND("v\r\n"); if (strncmp("v", s, 1) != 0) SEND_COMMAND("+\r\n"); // local echo on }
static bool command_common(uint8_t code) { static host_driver_t *host_driver = 0; switch (code) { #ifdef SLEEP_LED_ENABLE case KC_Z: // test breathing sleep LED print("Sleep LED test\n"); sleep_led_toggle(); led_set(host_keyboard_leds()); break; #endif #ifdef BOOTMAGIC_ENABLE case KC_E: print("eeconfig:\n"); print_eeconfig(); break; #endif case KC_CAPSLOCK: if (host_get_driver()) { host_driver = host_get_driver(); host_set_driver(0); print("Locked.\n"); } else { host_set_driver(host_driver); print("Unlocked.\n"); } break; case KC_H: case KC_SLASH: /* ? */ command_common_help(); break; case KC_C: debug_matrix = false; debug_keyboard = false; debug_mouse = false; debug_enable = false; command_console_help(); print("\nEnter Console Mode\n"); print("C> "); state = CONSOLE; break; case KC_PAUSE: clear_keyboard(); print("\n\nJump to bootloader... "); _delay_ms(1000); bootloader_jump(); // not return print("not supported.\n"); break; case KC_D: if (debug_enable) { print("\nDEBUG: disabled.\n"); debug_matrix = false; debug_keyboard = false; debug_mouse = false; debug_enable = false; } else { print("\nDEBUG: enabled.\n"); debug_enable = true; } break; case KC_X: // debug matrix toggle debug_matrix = !debug_matrix; if (debug_matrix) { print("\nDEBUG: matrix enabled.\n"); debug_enable = true; } else { print("\nDEBUG: matrix disabled.\n"); } break; case KC_K: // debug keyboard toggle debug_keyboard = !debug_keyboard; if (debug_keyboard) { print("\nDEBUG: keyboard enabled.\n"); debug_enable = true; } else { print("\nDEBUG: keyboard disabled.\n"); } break; case KC_M: // debug mouse toggle debug_mouse = !debug_mouse; if (debug_mouse) { print("\nDEBUG: mouse enabled.\n"); debug_enable = true; } else { print("\nDEBUG: mouse disabled.\n"); } break; case KC_V: // print version & information print("\n\n----- Version -----\n"); print("DESC: " STR(DESCRIPTION) "\n"); print("VID: " STR(VENDOR_ID) "(" STR(MANUFACTURER) ") " "PID: " STR(PRODUCT_ID) "(" STR(PRODUCT) ") " "VER: " STR(DEVICE_VER) "\n"); print("BUILD: " STR(VERSION) " (" __TIME__ " " __DATE__ ")\n"); /* build options */ print("OPTIONS:" #ifdef PROTOCOL_PJRC " PJRC" #endif #ifdef PROTOCOL_LUFA " LUFA" #endif #ifdef PROTOCOL_VUSB " VUSB" #endif #ifdef BOOTMAGIC_ENABLE " BOOTMAGIC" #endif #ifdef MOUSEKEY_ENABLE " MOUSEKEY" #endif #ifdef EXTRAKEY_ENABLE " EXTRAKEY" #endif #ifdef CONSOLE_ENABLE " CONSOLE" #endif #ifdef COMMAND_ENABLE " COMMAND" #endif #ifdef NKRO_ENABLE " NKRO" #endif #ifdef KEYMAP_SECTION_ENABLE " KEYMAP_SECTION" #endif " " STR(BOOTLOADER_SIZE) "\n"); print("GCC: " STR(__GNUC__) "." STR(__GNUC_MINOR__) "." STR(__GNUC_PATCHLEVEL__) " AVR-LIBC: " __AVR_LIBC_VERSION_STRING__ " AVR_ARCH: avr" STR(__AVR_ARCH__) "\n"); break; case KC_T: // print timer print_val_hex32(timer_count); break; case KC_S: print("\n\n----- Status -----\n"); print_val_hex8(host_keyboard_leds()); #ifdef PROTOCOL_PJRC print_val_hex8(UDCON); print_val_hex8(UDIEN); print_val_hex8(UDINT); print_val_hex8(usb_keyboard_leds); print_val_hex8(usb_keyboard_protocol); print_val_hex8(usb_keyboard_idle_config); print_val_hex8(usb_keyboard_idle_count); #endif #ifdef PROTOCOL_PJRC # if USB_COUNT_SOF print_val_hex8(usbSofCount); # endif #endif break; #ifdef NKRO_ENABLE case KC_N: clear_keyboard(); //Prevents stuck keys. keyboard_nkro = !keyboard_nkro; if (keyboard_nkro) print("NKRO: enabled\n"); else print("NKRO: disabled\n"); break; #endif #ifdef EXTRAKEY_ENABLE case KC_PSCREEN: // TODO: Power key should take this feature? otherwise any key during suspend. #ifdef PROTOCOL_PJRC if (suspend && remote_wakeup) { usb_remote_wakeup(); } else { host_system_send(SYSTEM_POWER_DOWN); host_system_send(0); _delay_ms(500); } #else host_system_send(SYSTEM_POWER_DOWN); _delay_ms(100); host_system_send(0); _delay_ms(500); #endif break; #endif case KC_ESC: case KC_GRV: case KC_0: switch_default_layer(0); break; case KC_1 ... KC_9: switch_default_layer((code - KC_1) + 1); break; case KC_F1 ... KC_F12: switch_default_layer((code - KC_F1) + 1); break; default: print("?"); return false; } return true; }
static bool command_common(uint8_t code) { #ifdef KEYBOARD_LOCK_ENABLE static host_driver_t *host_driver = 0; #endif switch (code) { #ifdef SLEEP_LED_ENABLE // test breathing sleep LED case MAGIC_KC(MAGIC_KEY_SLEEP_LED): print("Sleep LED Test\n"); sleep_led_toggle(); led_set(host_keyboard_leds()); break; #endif #ifdef BOOTMAGIC_ENABLE // print stored eeprom config case MAGIC_KC(MAGIC_KEY_EEPROM): print("eeconfig:\n"); print_eeconfig(); break; #endif #ifdef KEYBOARD_LOCK_ENABLE // lock/unlock keyboard case MAGIC_KC(MAGIC_KEY_LOCK): if (host_get_driver()) { host_driver = host_get_driver(); clear_keyboard(); host_set_driver(0); print("Locked.\n"); } else { host_set_driver(host_driver); print("Unlocked.\n"); } break; #endif // print help case MAGIC_KC(MAGIC_KEY_HELP1): case MAGIC_KC(MAGIC_KEY_HELP2): command_common_help(); break; // activate console case MAGIC_KC(MAGIC_KEY_CONSOLE): debug_matrix = false; debug_keyboard = false; debug_mouse = false; debug_enable = false; command_console_help(); print("C> "); command_state = CONSOLE; break; // jump to bootloader case MAGIC_KC(MAGIC_KEY_BOOTLOADER): clear_keyboard(); // clear to prevent stuck keys print("\n\nJumping to bootloader... "); #ifdef AUDIO_ENABLE stop_all_notes(); shutdown_user(); #else wait_ms(1000); #endif bootloader_jump(); // not return break; // debug toggle case MAGIC_KC(MAGIC_KEY_DEBUG): debug_enable = !debug_enable; if (debug_enable) { print("\ndebug: on\n"); debug_matrix = true; debug_keyboard = true; debug_mouse = true; } else { print("\ndebug: off\n"); } break; // debug matrix toggle case MAGIC_KC(MAGIC_KEY_DEBUG_MATRIX): debug_matrix = !debug_matrix; if (debug_matrix) { print("\nmatrix: on\n"); debug_enable = true; } else { print("\nmatrix: off\n"); } break; // debug keyboard toggle case MAGIC_KC(MAGIC_KEY_DEBUG_KBD): debug_keyboard = !debug_keyboard; if (debug_keyboard) { print("\nkeyboard: on\n"); debug_enable = true; } else { print("\nkeyboard: off\n"); } break; // debug mouse toggle case MAGIC_KC(MAGIC_KEY_DEBUG_MOUSE): debug_mouse = !debug_mouse; if (debug_mouse) { print("\nmouse: on\n"); debug_enable = true; } else { print("\nmouse: off\n"); } break; // print version case MAGIC_KC(MAGIC_KEY_VERSION): print_version(); break; // print status case MAGIC_KC(MAGIC_KEY_STATUS): print_status(); break; #ifdef NKRO_ENABLE // NKRO toggle case MAGIC_KC(MAGIC_KEY_NKRO): clear_keyboard(); // clear to prevent stuck keys keymap_config.nkro = !keymap_config.nkro; if (keymap_config.nkro) { print("NKRO: on\n"); } else { print("NKRO: off\n"); } break; #endif // switch layers case MAGIC_KC(MAGIC_KEY_LAYER0_ALT1): case MAGIC_KC(MAGIC_KEY_LAYER0_ALT2): switch_default_layer(0); break; #if MAGIC_KEY_SWITCH_LAYER_WITH_CUSTOM case MAGIC_KC(MAGIC_KEY_LAYER0): switch_default_layer(0); break; case MAGIC_KC(MAGIC_KEY_LAYER1): switch_default_layer(1); break; case MAGIC_KC(MAGIC_KEY_LAYER2): switch_default_layer(2); break; case MAGIC_KC(MAGIC_KEY_LAYER3): switch_default_layer(3); break; case MAGIC_KC(MAGIC_KEY_LAYER4): switch_default_layer(4); break; case MAGIC_KC(MAGIC_KEY_LAYER5): switch_default_layer(5); break; case MAGIC_KC(MAGIC_KEY_LAYER6): switch_default_layer(6); break; case MAGIC_KC(MAGIC_KEY_LAYER7): switch_default_layer(7); break; case MAGIC_KC(MAGIC_KEY_LAYER8): switch_default_layer(8); break; case MAGIC_KC(MAGIC_KEY_LAYER9): switch_default_layer(9); break; #endif #if MAGIC_KEY_SWITCH_LAYER_WITH_FKEYS case KC_F1 ... KC_F9: switch_default_layer((code - KC_F1) + 1); break; case KC_F10: switch_default_layer(0); break; #endif #if MAGIC_KEY_SWITCH_LAYER_WITH_NKEYS case KC_1 ... KC_9: switch_default_layer((code - KC_1) + 1); break; case KC_0: switch_default_layer(0); break; #endif default: print("?"); return false; } return true; }
bool command_extra(uint8_t code) { uint32_t t; uint16_t b; switch (code) { case KC_H: case KC_SLASH: /* ? */ print("\n\n----- Bluetooth RN-42 Help -----\n"); print("i: RN-42 info\n"); print("b: battery voltage\n"); print("Del: enter/exit RN-42 config mode\n"); print("Slck: RN-42 initialize\n"); print("1-4: restore link\n"); print("F1-F4: store link\n"); print("p: pairing\n"); if (config_mode) { return true; } else { print("u: toggle Force USB mode\n"); return false; // to display default command help } case KC_P: pairing(); return true; /* Store link address to EEPROM */ case KC_F1: store_link(RN42_LINK0); return true; case KC_F2: store_link(RN42_LINK1); return true; case KC_F3: store_link(RN42_LINK2); return true; case KC_F4: store_link(RN42_LINK3); return true; /* Restore link address to EEPROM */ case KC_1: restore_link(RN42_LINK0); return true; case KC_2: restore_link(RN42_LINK1); return true; case KC_3: restore_link(RN42_LINK2); return true; case KC_4: restore_link(RN42_LINK3); return true; case KC_5: xprintf("blah! \n"); //rn42_cts_hi(); if (stay_connected == 1){ dprintf("Disconnect after 5 min.\n"); stay_connected = !stay_connected; }else{ dprintf("Stay connected.\n"); stay_connected = 1; //last_press_timer = timer_read32(); } return true; case KC_6: clear_keyboard(); host_set_driver(&rn42_config_driver); // null driver; not to send a key to host rn42_disconnect(); return true; case KC_I: print("\n----- RN-42 info -----\n"); xprintf("protocol: %s\n", (host_get_driver() == &rn42_driver) ? "RN-42" : "LUFA"); xprintf("force_usb: %X\n", force_usb); xprintf("rn42: %s\n", rn42_rts() ? "OFF" : (rn42_linked() ? "CONN" : "ON")); xprintf("rn42_autoconnecting(): %X\n", rn42_autoconnecting()); xprintf("config_mode: %X\n", config_mode); xprintf("USB State: %s\n", (USB_DeviceState == DEVICE_STATE_Unattached) ? "Unattached" : (USB_DeviceState == DEVICE_STATE_Powered) ? "Powered" : (USB_DeviceState == DEVICE_STATE_Default) ? "Default" : (USB_DeviceState == DEVICE_STATE_Addressed) ? "Addressed" : (USB_DeviceState == DEVICE_STATE_Configured) ? "Configured" : (USB_DeviceState == DEVICE_STATE_Suspended) ? "Suspended" : "?"); xprintf("battery: "); switch (battery_status()) { case FULL_CHARGED: xprintf("FULL"); break; case CHARGING: xprintf("CHARG"); break; case DISCHARGING: xprintf("DISCHG"); break; case LOW_VOLTAGE: xprintf("LOW"); break; default: xprintf("?"); break; }; xprintf("\n"); xprintf("RemoteWakeupEnabled: %X\n", USB_Device_RemoteWakeupEnabled); xprintf("VBUS: %X\n", USBSTA&(1<<VBUS)); t = timer_read32()/1000; uint8_t d = t/3600/24; uint8_t h = t/3600; uint8_t m = t%3600/60; uint8_t s = t%60; xprintf("uptime: %02u %02u:%02u:%02u\n", d, h, m, s); xprintf("LINK0: %s\r\n", get_link(RN42_LINK0)); xprintf("LINK1: %s\r\n", get_link(RN42_LINK1)); xprintf("LINK2: %s\r\n", get_link(RN42_LINK2)); xprintf("LINK3: %s\r\n", get_link(RN42_LINK3)); return true; case KC_B: // battery monitor t = timer_read32()/1000; b = battery_voltage(); xprintf("BAT: %umV\t", b); xprintf("%02u:", t/3600); xprintf("%02u:", t%3600/60); xprintf("%02u\n", t%60); return true; case KC_U: if (config_mode) return false; if (force_usb) { print("Auto mode\n"); force_usb = false; } else { print("USB mode\n"); clear_keyboard(); host_set_driver(&rn42_driver); } return true; case KC_DELETE: /* RN-42 Command mode */ if (rn42_autoconnecting()) { enter_command_mode(); command_state = CONSOLE; config_mode = true; } else { exit_command_mode(); command_state = ONESHOT; config_mode = false; } return true; case KC_SCROLLLOCK: init_rn42(); return true; default: if (config_mode) return true; else return false; // yield to default command } return true; }
void rn42_task(void) { int16_t c; // Raw mode: interpret output report of LED state while ((c = rn42_getc()) != -1) { // LED Out report: 0xFE, 0x02, 0x01, <leds> // To get the report over UART set bit3 with SH, command. static enum {LED_INIT, LED_FE, LED_02, LED_01} state = LED_INIT; switch (state) { case LED_INIT: if (c == 0xFE) state = LED_FE; else { if (0x0 <= c && c <= 0x7f) xprintf("%c", c); else xprintf(" %02X", c); } break; case LED_FE: if (c == 0x02) state = LED_02; else state = LED_INIT; break; case LED_02: if (c == 0x01) state = LED_01; else state = LED_INIT; break; case LED_01: dprintf("LED status: %02X\n", c); rn42_set_leds(c); state = LED_INIT; break; default: state = LED_INIT; } } /* Bluetooth mode when ready */ if (!config_mode && !force_usb) { if (!rn42_rts() && host_get_driver() != &rn42_driver) { clear_keyboard(); host_set_driver(&rn42_driver); } else if (rn42_rts() && host_get_driver() != &lufa_driver) { clear_keyboard(); host_set_driver(&lufa_driver); } } static uint16_t prev_timer = 0; uint16_t e = timer_elapsed(prev_timer); if (e > 1000) { /* every second */ prev_timer += e/1000*1000; /* Low voltage alert */ uint8_t bs = battery_status(); if (bs == LOW_VOLTAGE) { battery_led(LED_ON); } else { battery_led(LED_CHARGER); } /* every minute */ uint32_t t = timer_read32()/1000; if (t%60 == 0) { uint16_t v = battery_voltage(); uint8_t h = t/3600; uint8_t m = t%3600/60; uint8_t s = t%60; dprintf("%02u:%02u:%02u\t%umV\n", h, m, s, v); /* TODO: xprintf doesn't work for this. xprintf("%02u:%02u:%02u\t%umV\n", (t/3600), (t%3600/60), (t%60), v); */ } } /* Connection monitor */ if (!rn42_rts() && rn42_linked()) { status_led(true); } else { status_led(false); } }
static bool command_common(uint8_t code) { #ifdef KEYBOARD_LOCK_ENABLE static host_driver_t *host_driver = 0; #endif #ifdef SLEEP_LED_ENABLE static bool sleep_led_test = false; #endif switch (code) { #ifdef SLEEP_LED_ENABLE case KC_Z: // test breathing sleep LED print("Sleep LED test\n"); if (sleep_led_test) { sleep_led_disable(); led_set(host_keyboard_leds()); } else { sleep_led_enable(); } sleep_led_test = !sleep_led_test; break; #endif #ifdef BOOTMAGIC_ENABLE case KC_E: print("eeconfig:\n"); print_eeconfig(); break; #endif #ifdef KEYBOARD_LOCK_ENABLE case KC_CAPSLOCK: if (host_get_driver()) { host_driver = host_get_driver(); clear_keyboard(); host_set_driver(0); print("Locked.\n"); } else { host_set_driver(host_driver); print("Unlocked.\n"); } break; #endif case KC_H: case KC_SLASH: /* ? */ command_common_help(); break; case KC_C: debug_matrix = false; debug_keyboard = false; debug_mouse = false; debug_enable = false; command_console_help(); print("C> "); command_state = CONSOLE; break; case KC_PAUSE: clear_keyboard(); print("\n\nbootloader... "); wait_ms(1000); bootloader_jump(); // not return break; case KC_D: if (debug_enable) { print("\ndebug: off\n"); debug_matrix = false; debug_keyboard = false; debug_mouse = false; debug_enable = false; } else { print("\ndebug: on\n"); debug_enable = true; } break; case KC_X: // debug matrix toggle debug_matrix = !debug_matrix; if (debug_matrix) { print("\nmatrix: on\n"); debug_enable = true; } else { print("\nmatrix: off\n"); } break; case KC_K: // debug keyboard toggle debug_keyboard = !debug_keyboard; if (debug_keyboard) { print("\nkeyboard: on\n"); debug_enable = true; } else { print("\nkeyboard: off\n"); } break; case KC_M: // debug mouse toggle debug_mouse = !debug_mouse; if (debug_mouse) { print("\nmouse: on\n"); debug_enable = true; } else { print("\nmouse: off\n"); } break; case KC_V: // print version & information print("\n\t- Version -\n"); print("DESC: " STR(DESCRIPTION) "\n"); print("VID: " STR(VENDOR_ID) "(" STR(MANUFACTURER) ") " "PID: " STR(PRODUCT_ID) "(" STR(PRODUCT) ") " "VER: " STR(DEVICE_VER) "\n"); print("BUILD: " STR(VERSION) " (" __TIME__ " " __DATE__ ")\n"); /* build options */ print("OPTIONS:" #ifdef PROTOCOL_PJRC " PJRC" #endif #ifdef PROTOCOL_LUFA " LUFA" #endif #ifdef PROTOCOL_VUSB " VUSB" #endif #ifdef PROTOCOL_CHIBIOS " CHIBIOS" #endif #ifdef BOOTMAGIC_ENABLE " BOOTMAGIC" #endif #ifdef MOUSEKEY_ENABLE " MOUSEKEY" #endif #ifdef EXTRAKEY_ENABLE " EXTRAKEY" #endif #ifdef CONSOLE_ENABLE " CONSOLE" #endif #ifdef COMMAND_ENABLE " COMMAND" #endif #ifdef NKRO_ENABLE " NKRO" #endif #ifdef KEYMAP_SECTION_ENABLE " KEYMAP_SECTION" #endif " " STR(BOOTLOADER_SIZE) "\n"); print("GCC: " STR(__GNUC__) "." STR(__GNUC_MINOR__) "." STR(__GNUC_PATCHLEVEL__) #if defined(__AVR__) " AVR-LIBC: " __AVR_LIBC_VERSION_STRING__ " AVR_ARCH: avr" STR(__AVR_ARCH__) "\n"); #elif defined(__arm__) // TODO ); #endif break; case KC_S: print("\n\t- Status -\n"); print_val_hex8(host_keyboard_leds()); print_val_hex8(keyboard_protocol); print_val_hex8(keyboard_idle); #ifdef NKRO_ENABLE print_val_hex8(keyboard_nkro); #endif print_val_hex32(timer_read32()); #ifdef PROTOCOL_PJRC print_val_hex8(UDCON); print_val_hex8(UDIEN); print_val_hex8(UDINT); print_val_hex8(usb_keyboard_leds); print_val_hex8(usb_keyboard_idle_count); #endif #ifdef PROTOCOL_PJRC # if USB_COUNT_SOF print_val_hex8(usbSofCount); # endif #endif break; #ifdef NKRO_ENABLE case KC_N: clear_keyboard(); //Prevents stuck keys. keyboard_nkro = !keyboard_nkro; if (keyboard_nkro) { print("NKRO: on\n"); } else { print("NKRO: off\n"); } break; #endif case KC_ESC: case KC_GRV: case KC_0: case KC_F10: switch_default_layer(0); break; case KC_1 ... KC_9: switch_default_layer((code - KC_1) + 1); break; case KC_F1 ... KC_F9: switch_default_layer((code - KC_F1) + 1); break; default: print("?"); return false; }
static bool command_common(uint8_t code) { static host_driver_t *host_driver = 0; switch (code) { case KC_CAPSLOCK: if (host_get_driver()) { host_driver = host_get_driver(); host_set_driver(0); print("Locked.\n"); } else { host_set_driver(host_driver); print("Unlocked.\n"); } break; case KC_H: case KC_SLASH: /* ? */ command_common_help(); break; case KC_C: print_enable = true; debug_matrix = false; debug_keyboard = false; debug_mouse = false; debug_enable = false; command_console_help(); print("\nEnter Console Mode\n"); print("C> "); state = CONSOLE; break; case KC_PAUSE: clear_keyboard(); print("\n\nJump to bootloader... "); _delay_ms(1000); bootloader_jump(); // not return print("not supported.\n"); break; case KC_D: if (debug_enable) { print("\nDEBUG: disabled.\n"); debug_matrix = false; debug_keyboard = false; debug_mouse = false; debug_enable = false; } else { print("\nDEBUG: enabled.\n"); debug_enable = true; } break; case KC_X: // debug matrix toggle debug_matrix = !debug_matrix; if (debug_matrix) { print("\nDEBUG: matrix enabled.\n"); debug_enable = true; } else { print("\nDEBUG: matrix disabled.\n"); } break; case KC_K: // debug keyboard toggle debug_keyboard = !debug_keyboard; if (debug_keyboard) { print("\nDEBUG: keyboard enabled.\n"); debug_enable = true; } else { print("\nDEBUG: keyboard disabled.\n"); } break; case KC_M: // debug mouse toggle debug_mouse = !debug_mouse; if (debug_mouse) { print("\nDEBUG: mouse enabled.\n"); debug_enable = true; } else { print("\nDEBUG: mouse disabled.\n"); } break; case KC_V: // print version & information print("\n\n----- Version -----\n"); print(STR(DESCRIPTION) "\n"); print(STR(MANUFACTURER) "(" STR(VENDOR_ID) ")/"); print(STR(PRODUCT) "(" STR(PRODUCT_ID) ") "); print("VERSION: " STR(DEVICE_VER) "\n"); break; case KC_T: // print timer print_val_hex32(timer_count); break; case KC_P: // print toggle if (print_enable) { print("print disabled.\n"); print_enable = false; } else { print_enable = true; print("print enabled.\n"); } break; case KC_S: print("\n\n----- Status -----\n"); print_val_hex8(host_keyboard_leds()); #ifdef HOST_PJRC print_val_hex8(UDCON); print_val_hex8(UDIEN); print_val_hex8(UDINT); print_val_hex8(usb_keyboard_leds); print_val_hex8(usb_keyboard_protocol); print_val_hex8(usb_keyboard_idle_config); print_val_hex8(usb_keyboard_idle_count); #endif #ifdef HOST_VUSB # if USB_COUNT_SOF print_val_hex8(usbSofCount); # endif #endif break; #ifdef NKRO_ENABLE case KC_N: clear_keyboard(); //Prevents stuck keys. keyboard_nkro = !keyboard_nkro; if (keyboard_nkro) print("NKRO: enabled\n"); else print("NKRO: disabled\n"); break; #endif #ifdef EXTRAKEY_ENABLE case KC_PSCREEN: // TODO: Power key should take this feature? otherwise any key during suspend. #ifdef HOST_PJRC if (suspend && remote_wakeup) { usb_remote_wakeup(); } else { host_system_send(SYSTEM_POWER_DOWN); host_system_send(0); _delay_ms(500); } #else host_system_send(SYSTEM_POWER_DOWN); _delay_ms(100); host_system_send(0); _delay_ms(500); #endif break; #endif case KC_0: case KC_F10: switch_layer(0); break; case KC_1: case KC_F1: switch_layer(1); break; case KC_2: case KC_F2: switch_layer(2); break; case KC_3: case KC_F3: switch_layer(3); break; case KC_4: case KC_F4: switch_layer(4); break; case KC_5: case KC_F5: switch_layer(5); break; case KC_6: case KC_F6: switch_layer(6); break; default: print("?"); return false; } return true; }