X-Git-Url: https://git.friedersdorff.com/?a=blobdiff_plain;f=tmk_core%2Fcommon%2Fcommand.c;h=e08f91e51376ebd0fe26cd67716acce2b5ae2381;hb=ad6059adc7039a54d1db75da783068654906a679;hp=465aa21c7bccf3b7c5697bdae38e8178a165567f;hpb=fb1fb122a5971723f374cd737b7cc0aefd470af3;p=max%2Ftmk_keyboard.git diff --git a/tmk_core/common/command.c b/tmk_core/common/command.c index 465aa21c..e08f91e5 100644 --- a/tmk_core/common/command.c +++ b/tmk_core/common/command.c @@ -16,7 +16,7 @@ along with this program. If not, see . */ #include #include -#include +#include "wait.h" #include "keycode.h" #include "host.h" #include "keymap.h" @@ -57,9 +57,10 @@ static void command_console_help(void); #ifdef MOUSEKEY_ENABLE static bool mousekey_console(uint8_t code); static void mousekey_console_help(void); +static uint8_t numkey2num(uint8_t code); #endif -static uint8_t numkey2num(uint8_t code); + static void switch_default_layer(uint8_t layer); @@ -97,12 +98,14 @@ bool command_proc(uint8_t code) bool command_extra(uint8_t code) __attribute__ ((weak)); bool command_extra(uint8_t code) { + (void)code; return false; } bool command_console_extra(uint8_t code) __attribute__ ((weak)); bool command_console_extra(uint8_t code) { + (void)code; return false; } @@ -180,14 +183,22 @@ 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"); - sleep_led_toggle(); - led_set(host_keyboard_leds()); + 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 @@ -225,7 +236,7 @@ static bool command_common(uint8_t code) case KC_PAUSE: clear_keyboard(); print("\n\nbootloader... "); - _delay_ms(1000); + wait_ms(1000); bootloader_jump(); // not return break; case KC_D: @@ -285,6 +296,9 @@ static bool command_common(uint8_t code) #ifdef PROTOCOL_VUSB " VUSB" #endif +#ifdef PROTOCOL_CHIBIOS + " CHIBIOS" +#endif #ifdef BOOTMAGIC_ENABLE " BOOTMAGIC" #endif @@ -309,8 +323,13 @@ static bool command_common(uint8_t code) " " 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"); @@ -320,7 +339,7 @@ static bool command_common(uint8_t code) #ifdef NKRO_ENABLE print_val_hex8(keyboard_nkro); #endif - print_val_hex32(timer_count); + print_val_hex32(timer_read32()); #ifdef PROTOCOL_PJRC print_val_hex8(UDCON); @@ -340,10 +359,11 @@ static bool command_common(uint8_t code) case KC_N: clear_keyboard(); //Prevents stuck keys. keyboard_nkro = !keyboard_nkro; - if (keyboard_nkro) + if (keyboard_nkro) { print("NKRO: on\n"); - else + } else { print("NKRO: off\n"); + } break; #endif case KC_ESC: @@ -597,10 +617,11 @@ static bool mousekey_console(uint8_t code) print("?"); return false; } - if (mousekey_param) + if (mousekey_param) { xprintf("M%d> ", mousekey_param); - else + } else { print("M>" ); + } return true; } #endif @@ -609,6 +630,7 @@ static bool mousekey_console(uint8_t code) /*********************************************************** * Utilities ***********************************************************/ +#if MOUSEKEY_ENABLE static uint8_t numkey2num(uint8_t code) { switch (code) { @@ -625,6 +647,7 @@ static uint8_t numkey2num(uint8_t code) } return 0; } +#endif static void switch_default_layer(uint8_t layer) {