From 13f3c73386da9b15b255b014f5da81cd51613ca1 Mon Sep 17 00:00:00 2001 From: Fred Sundvik Date: Sun, 4 Sep 2016 23:26:49 +0300 Subject: Fix the ldflags.txt and obj.txt checks There was a minor typo, which caused the files to not be generated and therefore the elf files were always linked. --- tmk_core/rules.mk | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'tmk_core') diff --git a/tmk_core/rules.mk b/tmk_core/rules.mk index 79fc7119a..e4c8aecb2 100644 --- a/tmk_core/rules.mk +++ b/tmk_core/rules.mk @@ -332,11 +332,13 @@ $1/compiler.txt: $1/force $$(CC) --version | cmp -s - $$@ || $$(CC) --version > $$@ endef +.PRECIOUS: $(MASTER_OUTPUT)/obj.txt $(MASTER_OUTPUT)/obj.txt: $(MASTER_OUTPUT)/force - echo '$(OBJ)' | cmp -s - $$@ || echo '$(OBJ)' > $$@ + echo '$(OBJ)' | cmp -s - $@ || echo '$(OBJ)' > $@ +.PRECIOUS: $(MASTER_OUTPUT)/ldflags.txt $(MASTER_OUTPUT)/ldflags.txt: $(MASTER_OUTPUT)/force - echo '$(LDFLAGS)' | cmp -s - $$@ || echo '$(LDFLAGS)' > $$@ + echo '$(LDFLAGS)' | cmp -s - $@ || echo '$(LDFLAGS)' > $@ # We have to use static rules for the .d files for some reason -- cgit v1.2.3-24-g4f1b From 16e706214fad14856603fb439dc830c47ef83527 Mon Sep 17 00:00:00 2001 From: IBNobody Date: Tue, 6 Sep 2016 14:59:12 -0500 Subject: Change NKRO size fron 16 bytes to 32 bytes. --- tmk_core/protocol/lufa/descriptor.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'tmk_core') diff --git a/tmk_core/protocol/lufa/descriptor.h b/tmk_core/protocol/lufa/descriptor.h index 316650a7b..c6c94e361 100644 --- a/tmk_core/protocol/lufa/descriptor.h +++ b/tmk_core/protocol/lufa/descriptor.h @@ -1,4 +1,4 @@ -/* +/* * Copyright 2012,2013 Jun Wako * This file is based on: * LUFA-120219/Demos/Device/Lowlevel/KeyboardMouse @@ -129,13 +129,13 @@ typedef struct # define MOUSE_INTERFACE (KEYBOARD_INTERFACE + 1) #else # define MOUSE_INTERFACE KEYBOARD_INTERFACE -#endif +#endif #ifdef EXTRAKEY_ENABLE # define EXTRAKEY_INTERFACE (MOUSE_INTERFACE + 1) #else # define EXTRAKEY_INTERFACE MOUSE_INTERFACE -#endif +#endif #ifdef CONSOLE_ENABLE # define CONSOLE_INTERFACE (EXTRAKEY_INTERFACE + 1) @@ -171,7 +171,7 @@ typedef struct #define KEYBOARD_IN_EPNUM 1 #ifdef MOUSE_ENABLE -# define MOUSE_IN_EPNUM (KEYBOARD_IN_EPNUM + 1) +# define MOUSE_IN_EPNUM (KEYBOARD_IN_EPNUM + 1) #else # define MOUSE_IN_EPNUM KEYBOARD_IN_EPNUM #endif @@ -179,7 +179,7 @@ typedef struct #ifdef EXTRAKEY_ENABLE # define EXTRAKEY_IN_EPNUM (MOUSE_IN_EPNUM + 1) #else -# define EXTRAKEY_IN_EPNUM MOUSE_IN_EPNUM +# define EXTRAKEY_IN_EPNUM MOUSE_IN_EPNUM #endif #ifdef CONSOLE_ENABLE @@ -226,7 +226,7 @@ typedef struct #define MOUSE_EPSIZE 8 #define EXTRAKEY_EPSIZE 8 #define CONSOLE_EPSIZE 32 -#define NKRO_EPSIZE 16 +#define NKRO_EPSIZE 32 #define MIDI_STREAM_EPSIZE 64 #define CDC_NOTIFICATION_EPSIZE 8 #define CDC_EPSIZE 16 -- cgit v1.2.3-24-g4f1b From 558f3ec1eb325caf706efc15e2fab26121aba442 Mon Sep 17 00:00:00 2001 From: IBNobody Date: Tue, 6 Sep 2016 23:19:01 -0500 Subject: Use keyboard config for nkro (#7) * removing nkro references - wip * changed NKRO to be defined by keymap_config --- tmk_core/common/action_util.c | 10 +++++++--- tmk_core/common/bootmagic.c | 4 ---- tmk_core/common/command.c | 6 +++--- tmk_core/common/host.c | 5 ----- tmk_core/common/host.h | 4 ---- tmk_core/common/keyboard.c | 4 +++- tmk_core/common/magic.c | 4 ---- tmk_core/protocol/chibios/usb_main.c | 19 +++++++++++-------- tmk_core/protocol/lufa/lufa.c | 9 ++++++++- tmk_core/protocol/pjrc/usb.c | 18 ++++++++++++------ tmk_core/protocol/pjrc/usb_keyboard.c | 8 +++++++- tmk_core/readme.md | 2 +- 12 files changed, 52 insertions(+), 41 deletions(-) (limited to 'tmk_core') diff --git a/tmk_core/common/action_util.c b/tmk_core/common/action_util.c index 61ff202be..cb4b25264 100644 --- a/tmk_core/common/action_util.c +++ b/tmk_core/common/action_util.c @@ -20,6 +20,10 @@ along with this program. If not, see . #include "action_util.h" #include "action_layer.h" #include "timer.h" +#include "keycode_config.h" + +extern keymap_config_t keymap_config; + static inline void add_key_byte(uint8_t code); static inline void del_key_byte(uint8_t code); @@ -139,7 +143,7 @@ void send_keyboard_report(void) { void add_key(uint8_t key) { #ifdef NKRO_ENABLE - if (keyboard_protocol && keyboard_nkro) { + if (keyboard_protocol && keymap_config.nkro) { add_key_bit(key); return; } @@ -150,7 +154,7 @@ void add_key(uint8_t key) void del_key(uint8_t key) { #ifdef NKRO_ENABLE - if (keyboard_protocol && keyboard_nkro) { + if (keyboard_protocol && keymap_config.nkro) { del_key_bit(key); return; } @@ -231,7 +235,7 @@ uint8_t has_anymod(void) uint8_t get_first_key(void) { #ifdef NKRO_ENABLE - if (keyboard_protocol && keyboard_nkro) { + if (keyboard_protocol && keymap_config.nkro) { uint8_t i = 0; for (; i < KEYBOARD_REPORT_BITS && !keyboard_report->nkro.bits[i]; i++) ; diff --git a/tmk_core/common/bootmagic.c b/tmk_core/common/bootmagic.c index 6730a2a4a..2c6bcbae5 100644 --- a/tmk_core/common/bootmagic.c +++ b/tmk_core/common/bootmagic.c @@ -83,10 +83,6 @@ void bootmagic(void) } eeconfig_update_keymap(keymap_config.raw); -#ifdef NKRO_ENABLE - keyboard_nkro = keymap_config.nkro; -#endif - /* default layer */ uint8_t default_layer = 0; if (bootmagic_scan_keycode(BOOTMAGIC_KEY_DEFAULT_LAYER_0)) { default_layer |= (1<<0); } diff --git a/tmk_core/common/command.c b/tmk_core/common/command.c index 476fc6fe3..54d6117fd 100644 --- a/tmk_core/common/command.c +++ b/tmk_core/common/command.c @@ -238,7 +238,7 @@ static void print_status(void) print_val_hex8(keyboard_protocol); print_val_hex8(keyboard_idle); #ifdef NKRO_ENABLE - print_val_hex8(keyboard_nkro); + print_val_hex8(keymap_config.nkro); #endif print_val_hex32(timer_read32()); @@ -435,8 +435,8 @@ static bool command_common(uint8_t code) // NKRO toggle case MAGIC_KC(MAGIC_KEY_NKRO): clear_keyboard(); // clear to prevent stuck keys - keyboard_nkro = !keyboard_nkro; - if (keyboard_nkro) { + keymap_config.nkro = !keymap_config.nkro; + if (keymap_config.nkro) { print("NKRO: on\n"); } else { print("NKRO: off\n"); diff --git a/tmk_core/common/host.c b/tmk_core/common/host.c index 11a05c2dd..e12b62216 100644 --- a/tmk_core/common/host.c +++ b/tmk_core/common/host.c @@ -22,11 +22,6 @@ along with this program. If not, see . #include "util.h" #include "debug.h" - -#ifdef NKRO_ENABLE -bool keyboard_nkro = true; -#endif - static host_driver_t *driver; static uint16_t last_system_report = 0; static uint16_t last_consumer_report = 0; diff --git a/tmk_core/common/host.h b/tmk_core/common/host.h index 9814b10d2..aeabba710 100644 --- a/tmk_core/common/host.h +++ b/tmk_core/common/host.h @@ -28,10 +28,6 @@ along with this program. If not, see . extern "C" { #endif -#ifdef NKRO_ENABLE -extern bool keyboard_nkro; -#endif - extern uint8_t keyboard_idle; extern uint8_t keyboard_protocol; diff --git a/tmk_core/common/keyboard.c b/tmk_core/common/keyboard.c index c46a701b3..371d93f3e 100644 --- a/tmk_core/common/keyboard.c +++ b/tmk_core/common/keyboard.c @@ -57,6 +57,8 @@ along with this program. If not, see . # include "visualizer/visualizer.h" #endif + + #ifdef MATRIX_HAS_GHOST static bool has_ghost_in_row(uint8_t row) { @@ -106,7 +108,7 @@ void keyboard_init(void) { rgblight_init(); #endif #if defined(NKRO_ENABLE) && defined(FORCE_NKRO) - keyboard_nkro = true; + keymap_config.nkro = 1; #endif } diff --git a/tmk_core/common/magic.c b/tmk_core/common/magic.c index 194e4cc02..49617a3d1 100644 --- a/tmk_core/common/magic.c +++ b/tmk_core/common/magic.c @@ -27,10 +27,6 @@ void magic(void) /* keymap config */ keymap_config.raw = eeconfig_read_keymap(); -#ifdef NKRO_ENABLE - keyboard_nkro = keymap_config.nkro; -#endif - uint8_t default_layer = 0; default_layer = eeconfig_read_default_layer(); default_layer_set((uint32_t)default_layer); diff --git a/tmk_core/protocol/chibios/usb_main.c b/tmk_core/protocol/chibios/usb_main.c index e2c9d9bf1..d0c72c46c 100644 --- a/tmk_core/protocol/chibios/usb_main.c +++ b/tmk_core/protocol/chibios/usb_main.c @@ -28,6 +28,12 @@ #include "led.h" #endif +#ifdef NKRO_ENABLE + #include "keycode_config.h" + + extern keymap_config_t keymap_config; +#endif + /* --------------------------------------------------------- * Global interface variables and declarations * --------------------------------------------------------- @@ -39,9 +45,6 @@ uint16_t keyboard_led_stats __attribute__((aligned(2))) = 0; volatile uint16_t keyboard_idle_count = 0; static virtual_timer_t keyboard_idle_timer; static void keyboard_idle_timer_cb(void *arg); -#ifdef NKRO_ENABLE -extern bool keyboard_nkro; -#endif /* NKRO_ENABLE */ report_keyboard_t keyboard_report_sent = {{0}}; #ifdef MOUSE_ENABLE @@ -943,8 +946,8 @@ static bool usb_request_hook_cb(USBDriver *usbp) { if((usbp->setup[4] == KBD_INTERFACE) && (usbp->setup[5] == 0)) { /* wIndex */ keyboard_protocol = ((usbp->setup[2]) != 0x00); /* LSB(wValue) */ #ifdef NKRO_ENABLE - keyboard_nkro = !!keyboard_protocol; - if(!keyboard_nkro && keyboard_idle) { + keymap_config.nkro = !!keyboard_protocol; + if(!keymap_config.nkro && keyboard_idle) { #else /* NKRO_ENABLE */ if(keyboard_idle) { #endif /* NKRO_ENABLE */ @@ -962,7 +965,7 @@ static bool usb_request_hook_cb(USBDriver *usbp) { keyboard_idle = usbp->setup[3]; /* MSB(wValue) */ /* arm the timer */ #ifdef NKRO_ENABLE - if(!keyboard_nkro && keyboard_idle) { + if(!keymap_config.nkro && keyboard_idle) { #else /* NKRO_ENABLE */ if(keyboard_idle) { #endif /* NKRO_ENABLE */ @@ -1089,7 +1092,7 @@ static void keyboard_idle_timer_cb(void *arg) { } #ifdef NKRO_ENABLE - if(!keyboard_nkro && keyboard_idle) { + if(!keymap_config.nkro && keyboard_idle) { #else /* NKRO_ENABLE */ if(keyboard_idle) { #endif /* NKRO_ENABLE */ @@ -1122,7 +1125,7 @@ void send_keyboard(report_keyboard_t *report) { osalSysUnlock(); #ifdef NKRO_ENABLE - if(keyboard_nkro) { /* NKRO protocol */ + if(keymap_config.nkro) { /* NKRO protocol */ /* need to wait until the previous packet has made it through */ /* can rewrite this using the synchronous API, then would wait * until *after* the packet has been transmitted. I think diff --git a/tmk_core/protocol/lufa/lufa.c b/tmk_core/protocol/lufa/lufa.c index 9b201374a..01c0e45b0 100644 --- a/tmk_core/protocol/lufa/lufa.c +++ b/tmk_core/protocol/lufa/lufa.c @@ -52,6 +52,13 @@ #include "descriptor.h" #include "lufa.h" +#ifdef NKRO_ENABLE + #include "keycode_config.h" + + extern keymap_config_t keymap_config; +#endif + + #ifdef AUDIO_ENABLE #include #endif @@ -502,7 +509,7 @@ static void send_keyboard(report_keyboard_t *report) /* Select the Keyboard Report Endpoint */ #ifdef NKRO_ENABLE - if (keyboard_protocol && keyboard_nkro) { + if (keyboard_protocol && keymap_config.nkro) { /* Report protocol - NKRO */ Endpoint_SelectEndpoint(NKRO_IN_EPNUM); diff --git a/tmk_core/protocol/pjrc/usb.c b/tmk_core/protocol/pjrc/usb.c index 1e6ba8719..09efbe076 100644 --- a/tmk_core/protocol/pjrc/usb.c +++ b/tmk_core/protocol/pjrc/usb.c @@ -1,17 +1,17 @@ /* USB Keyboard Plus Debug Channel Example for Teensy USB Development Board * http://www.pjrc.com/teensy/usb_keyboard.html * Copyright (c) 2009 PJRC.COM, LLC - * + * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: - * + * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. - * + * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE @@ -41,6 +41,12 @@ #include "action.h" #include "action_util.h" +#ifdef NKRO_ENABLE + #include "keycode_config.h" + + extern keymap_config_t keymap_config; +#endif + /************************************************************************** * @@ -694,7 +700,7 @@ ISR(USB_GEN_vect) } /* TODO: should keep IDLE rate on each keyboard interface */ #ifdef NKRO_ENABLE - if (!keyboard_nkro && keyboard_idle && (++div4 & 3) == 0) { + if (!keymap_config.nkro && keyboard_idle && (++div4 & 3) == 0) { #else if (keyboard_idle && (++div4 & 3) == 0) { #endif @@ -881,7 +887,7 @@ ISR(USB_COM_vect) #endif if (bmRequestType == 0x00 && wValue == DEVICE_REMOTE_WAKEUP) { if (bRequest == SET_FEATURE) { - remote_wakeup = true; + remote_wakeup = true; } else { remote_wakeup = false; } @@ -932,7 +938,7 @@ ISR(USB_COM_vect) if (bRequest == HID_SET_PROTOCOL) { keyboard_protocol = wValue; #ifdef NKRO_ENABLE - keyboard_nkro = !!keyboard_protocol; + keymap_config.nkro = !!keyboard_protocol; #endif clear_keyboard(); //usb_wait_in_ready(); diff --git a/tmk_core/protocol/pjrc/usb_keyboard.c b/tmk_core/protocol/pjrc/usb_keyboard.c index 4b87b5d7b..05f479734 100644 --- a/tmk_core/protocol/pjrc/usb_keyboard.c +++ b/tmk_core/protocol/pjrc/usb_keyboard.c @@ -30,6 +30,12 @@ #include "util.h" #include "host.h" +#ifdef NKRO_ENABLE + #include "keycode_config.h" + + extern keymap_config_t keymap_config; +#endif + // protocol setting from the host. We use exactly the same report // either way, so this variable only stores the setting since we @@ -56,7 +62,7 @@ int8_t usb_keyboard_send_report(report_keyboard_t *report) int8_t result = 0; #ifdef NKRO_ENABLE - if (keyboard_nkro) + if (keymap_config.nkro) result = send_report(report, KBD2_ENDPOINT, 0, KBD2_SIZE); else #endif diff --git a/tmk_core/readme.md b/tmk_core/readme.md index f460d0ed4..324232851 100644 --- a/tmk_core/readme.md +++ b/tmk_core/readme.md @@ -23,7 +23,7 @@ These features can be used in your keyboard. * Mouse key - Mouse control with keyboard * System Control Key - Power Down, Sleep, Wake Up and USB Remote Wake up * Media Control Key - Volume Down/Up, Mute, Next/Prev track, Play, Stop and etc -* USB NKRO - 120 keys(+ 8 modifiers) simultaneously +* USB NKRO - 240 keys(+ 8 modifiers) simultaneously * PS/2 mouse support - PS/2 mouse(TrackPoint) as composite device * Keyboard protocols - PS/2, ADB, M0110, Sun and other old keyboard protocols * User Function - Customizable function of key with writing code -- cgit v1.2.3-24-g4f1b From fe2aed0d1c8d1535c160755b76186972071aed02 Mon Sep 17 00:00:00 2001 From: IBNobody Date: Wed, 7 Sep 2016 23:50:58 -0500 Subject: Added User Print - A "light" console out option (#8) User print disables the normal print messages in the body of QMK/TMK code and is meant as a lightweight alternative to NOPRINT. Use it when you only want to do a spot of debugging but lack flash resources for allowing all of the codebase to print (and store their wasteful strings). --- tmk_core/common/avr/xprintf.h | 6 +- tmk_core/common/mbed/xprintf.cpp | 2 +- tmk_core/common/mbed/xprintf.h | 2 +- tmk_core/common/print.h | 168 ++++++++++++++++++++++++++++++++++----- 4 files changed, 155 insertions(+), 23 deletions(-) (limited to 'tmk_core') diff --git a/tmk_core/common/avr/xprintf.h b/tmk_core/common/avr/xprintf.h index e53c0dd8e..08d9f93a0 100644 --- a/tmk_core/common/avr/xprintf.h +++ b/tmk_core/common/avr/xprintf.h @@ -56,8 +56,8 @@ void xitoa(long value, char radix, char width); #define xfprintf(func, format, ...) __xfprintf(func, PSTR(format), ##__VA_ARGS__) void __xprintf(const char *format_p, ...); /* Send formatted string to the registered device */ -void __xsprintf(char*, const char *format_p, ...); /* Put formatted string to the memory */ -void __xfprintf(void(*func)(uint8_t), const char *format_p, ...); /* Send formatted string to the specified device */ +// void __xsprintf(char*, const char *format_p, ...); /* Put formatted string to the memory */ +// void __xfprintf(void(*func)(uint8_t), const char *format_p, ...); /* Send formatted string to the specified device */ /* Format string is placed in the ROM. The format flags is similar to printf(). @@ -88,7 +88,7 @@ void __xfprintf(void(*func)(uint8_t), const char *format_p, ...); /* Send format /*-----------------------------------------------------------------------------*/ char xatoi(char **str, long *ret); -/* Get value of the numeral string. +/* Get value of the numeral string. str Pointer to pointer to source string diff --git a/tmk_core/common/mbed/xprintf.cpp b/tmk_core/common/mbed/xprintf.cpp index 3647ece75..b1aac2c99 100644 --- a/tmk_core/common/mbed/xprintf.cpp +++ b/tmk_core/common/mbed/xprintf.cpp @@ -7,7 +7,7 @@ #define STRING_STACK_LIMIT 120 //TODO -int xprintf(const char* format, ...) { return 0; } +int __xprintf(const char* format, ...) { return 0; } #if 0 /* mbed Serial */ diff --git a/tmk_core/common/mbed/xprintf.h b/tmk_core/common/mbed/xprintf.h index 26bc529e5..1e7a48c06 100644 --- a/tmk_core/common/mbed/xprintf.h +++ b/tmk_core/common/mbed/xprintf.h @@ -7,7 +7,7 @@ extern "C" { #endif -int xprintf(const char *format, ...); +int __xprintf(const char *format, ...); #ifdef __cplusplus } diff --git a/tmk_core/common/print.h b/tmk_core/common/print.h index a1352527f..8836c0fc7 100644 --- a/tmk_core/common/print.h +++ b/tmk_core/common/print.h @@ -36,40 +36,140 @@ #ifndef NO_PRINT +#if defined(__AVR__) /* __AVR__ */ -#if defined(__AVR__) +# include "avr/xprintf.h" -#include "avr/xprintf.h" -#define print(s) xputs(PSTR(s)) -#define println(s) xputs(PSTR(s "\r\n")) +# ifdef USER_PRINT /* USER_PRINT */ -#ifdef __cplusplus +// Remove normal print defines +# define print(s) +# define println(s) +# undef xprintf +# define xprintf(fmt, ...) + +// Create user print defines +# define uprint(s) xputs(PSTR(s)) +# define uprintln(s) xputs(PSTR(s "\r\n")) +# define uprintf(fmt, ...) __xprintf(PSTR(fmt), ##__VA_ARGS__) + +# else /* NORMAL PRINT */ + +// Create user & normal print defines +# define print(s) xputs(PSTR(s)) +# define println(s) xputs(PSTR(s "\r\n")) +# define uprint(s) print(s) +# define uprintln(s) println(s) +# define uprintf(fmt, ...) xprintf(fmt, ...) + +# endif /* USER_PRINT / NORMAL PRINT */ + +# ifdef __cplusplus extern "C" -#endif +# endif + /* function pointer of sendchar to be used by print utility */ void print_set_sendchar(int8_t (*print_sendchar_func)(uint8_t)); -#elif defined(PROTOCOL_CHIBIOS) /* __AVR__ */ +#elif defined(PROTOCOL_CHIBIOS) /* PROTOCOL_CHIBIOS */ + +# include "chibios/printf.h" + +# ifdef USER_PRINT /* USER_PRINT */ + +// Remove normal print defines +# define print(s) +# define println(s) +# define xprintf(fmt, ...) + +// Create user print defines +# define uprint(s) printf(s) +# define uprintln(s) printf(s "\r\n") +# define uprintf printf + +# else /* NORMAL PRINT */ + +// Create user & normal print defines +# define print(s) printf(s) +# define println(s) printf(s "\r\n") +# define xprintf printf +# define uprint(s) printf(s) +# define uprintln(s) printf(s "\r\n") +# define uprintf printf -#include "chibios/printf.h" +# endif /* USER_PRINT / NORMAL PRINT */ -#define print(s) printf(s) -#define println(s) printf(s "\r\n") -#define xprintf printf +#elif defined(__arm__) /* __arm__ */ -#elif defined(__arm__) /* __AVR__ */ +# include "mbed/xprintf.h" -#include "mbed/xprintf.h" +# ifdef USER_PRINT /* USER_PRINT */ -#define print(s) xprintf(s) -#define println(s) xprintf(s "\r\n") +// Remove normal print defines +# define print(s) +# define println(s) +# define xprintf(fmt, ...) + +// Create user print defines +# define uprintf(fmt, ...) __xprintf(fmt, ...) +# define uprint(s) xprintf(s) +# define uprintln(s) xprintf(s "\r\n") + +# else /* NORMAL PRINT */ + +// Create user & normal print defines +# define xprintf(fmt, ...) __xprintf(fmt, ...) +# define print(s) xprintf(s) +# define println(s) xprintf(s "\r\n") +# define uprint(s) print(s) +# define uprintln(s) println(s) +# define uprintf(fmt, ...) xprintf(fmt, ...) + +# endif /* USER_PRINT / NORMAL PRINT */ /* TODO: to select output destinations: UART/USBSerial */ -#define print_set_sendchar(func) +# define print_set_sendchar(func) + +#endif /* __AVR__ / PROTOCOL_CHIBIOS / __arm__ */ + +// User print disables the normal print messages in the body of QMK/TMK code and +// is meant as a lightweight alternative to NOPRINT. Use it when you only want to do +// a spot of debugging but lack flash resources for allowing all of the codebase to +// print (and store their wasteful strings). +// +// !!! DO NOT USE USER PRINT CALLS IN THE BODY OF QMK/TMK !!! +// +#ifdef USER_PRINT -#endif /* __AVR__ */ +// Disable normal print +#define print_dec(data) +#define print_decs(data) +#define print_hex4(data) +#define print_hex8(data) +#define print_hex16(data) +#define print_hex32(data) +#define print_bin4(data) +#define print_bin8(data) +#define print_bin16(data) +#define print_bin32(data) +#define print_bin_reverse8(data) +#define print_bin_reverse16(data) +#define print_bin_reverse32(data) +#define print_val_dec(v) +#define print_val_decs(v) +#define print_val_hex8(v) +#define print_val_hex16(v) +#define print_val_hex32(v) +#define print_val_bin8(v) +#define print_val_bin16(v) +#define print_val_bin32(v) +#define print_val_bin_reverse8(v) +#define print_val_bin_reverse16(v) +#define print_val_bin_reverse32(v) +#else /* NORMAL_PRINT */ +//Enable normal print /* decimal */ #define print_dec(i) xprintf("%u", i) #define print_decs(i) xprintf("%d", i) @@ -99,6 +199,39 @@ void print_set_sendchar(int8_t (*print_sendchar_func)(uint8_t)); #define print_val_bin_reverse16(v) xprintf(#v ": %016b\n", bitrev16(v)) #define print_val_bin_reverse32(v) xprintf(#v ": %032lb\n", bitrev32(v)) +#endif /* USER_PRINT / NORMAL_PRINT */ + +// User Print + +/* decimal */ +#define uprint_dec(i) uprintf("%u", i) +#define uprint_decs(i) uprintf("%d", i) +/* hex */ +#define uprint_hex4(i) uprintf("%X", i) +#define uprint_hex8(i) uprintf("%02X", i) +#define uprint_hex16(i) uprintf("%04X", i) +#define uprint_hex32(i) uprintf("%08lX", i) +/* binary */ +#define uprint_bin4(i) uprintf("%04b", i) +#define uprint_bin8(i) uprintf("%08b", i) +#define uprint_bin16(i) uprintf("%016b", i) +#define uprint_bin32(i) uprintf("%032lb", i) +#define uprint_bin_reverse8(i) uprintf("%08b", bitrev(i)) +#define uprint_bin_reverse16(i) uprintf("%016b", bitrev16(i)) +#define uprint_bin_reverse32(i) uprintf("%032lb", bitrev32(i)) +/* print value utility */ +#define uprint_val_dec(v) uprintf(#v ": %u\n", v) +#define uprint_val_decs(v) uprintf(#v ": %d\n", v) +#define uprint_val_hex8(v) uprintf(#v ": %X\n", v) +#define uprint_val_hex16(v) uprintf(#v ": %02X\n", v) +#define uprint_val_hex32(v) uprintf(#v ": %04lX\n", v) +#define uprint_val_bin8(v) uprintf(#v ": %08b\n", v) +#define uprint_val_bin16(v) uprintf(#v ": %016b\n", v) +#define uprint_val_bin32(v) uprintf(#v ": %032lb\n", v) +#define uprint_val_bin_reverse8(v) uprintf(#v ": %08b\n", bitrev(v)) +#define uprint_val_bin_reverse16(v) uprintf(#v ": %016b\n", bitrev16(v)) +#define uprint_val_bin_reverse32(v) uprintf(#v ": %032lb\n", bitrev32(v)) + #else /* NO_PRINT */ #define xprintf(fmt, ...) @@ -143,5 +276,4 @@ void print_set_sendchar(int8_t (*print_sendchar_func)(uint8_t)); #define pbin_reverse(data) print_bin_reverse8(data) #define pbin_reverse16(data) print_bin_reverse16(data) - #endif -- cgit v1.2.3-24-g4f1b From e25ae23287a687468f4b32ffec9613fd4326610f Mon Sep 17 00:00:00 2001 From: shela Date: Sat, 10 Sep 2016 23:47:33 +0900 Subject: fix number of NKRO keys 32byte report = 1byte modifiers + 31byte keys 31byte * 8bit * 1key/bit = 248keys --- tmk_core/readme.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tmk_core') diff --git a/tmk_core/readme.md b/tmk_core/readme.md index 324232851..5f135617c 100644 --- a/tmk_core/readme.md +++ b/tmk_core/readme.md @@ -23,7 +23,7 @@ These features can be used in your keyboard. * Mouse key - Mouse control with keyboard * System Control Key - Power Down, Sleep, Wake Up and USB Remote Wake up * Media Control Key - Volume Down/Up, Mute, Next/Prev track, Play, Stop and etc -* USB NKRO - 240 keys(+ 8 modifiers) simultaneously +* USB NKRO - 248 keys(+ 8 modifiers) simultaneously * PS/2 mouse support - PS/2 mouse(TrackPoint) as composite device * Keyboard protocols - PS/2, ADB, M0110, Sun and other old keyboard protocols * User Function - Customizable function of key with writing code -- cgit v1.2.3-24-g4f1b From cb1ac2a3edf637a3e2ecb53f0627212d1f5abb08 Mon Sep 17 00:00:00 2001 From: IBNobody Date: Mon, 12 Sep 2016 20:20:31 -0500 Subject: Fixed NO_PRINT / USER_PRINT conflict warning. --- tmk_core/common/command.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'tmk_core') diff --git a/tmk_core/common/command.c b/tmk_core/common/command.c index 54d6117fd..fc5aad5c1 100644 --- a/tmk_core/common/command.c +++ b/tmk_core/common/command.c @@ -261,7 +261,10 @@ static void print_status(void) #ifdef BOOTMAGIC_ENABLE static void print_eeconfig(void) { -#ifndef NO_PRINT + +// Print these variables if NO_PRINT or USER_PRINT are not defined. +#if !defined(NO_PRINT) && !defined(USER_PRINT) + print("default_layer: "); print_dec(eeconfig_read_default_layer()); print("\n"); debug_config_t dc; @@ -571,7 +574,8 @@ static uint8_t mousekey_param = 0; static void mousekey_param_print(void) { -#ifndef NO_PRINT +// Print these variables if NO_PRINT or USER_PRINT are not defined. +#if !defined(NO_PRINT) && !defined(USER_PRINT) print("\n\t- Values -\n"); print("1: delay(*10ms): "); pdec(mk_delay); print("\n"); print("2: interval(ms): "); pdec(mk_interval); print("\n"); -- cgit v1.2.3-24-g4f1b From d4309990472895bbbe82f7ba22ed33c16f928778 Mon Sep 17 00:00:00 2001 From: Didier Loiseau Date: Fri, 23 Sep 2016 00:55:15 +0200 Subject: Fix issue #772 Meh and Hyper not working --- tmk_core/common/action.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'tmk_core') diff --git a/tmk_core/common/action.c b/tmk_core/common/action.c index 08ef22eb9..d485b46c7 100644 --- a/tmk_core/common/action.c +++ b/tmk_core/common/action.c @@ -155,9 +155,10 @@ void process_action(keyrecord_t *record, action_t action) action.key.mods<<4; if (event.pressed) { if (mods) { - if (IS_MOD(action.key.code)) { + if (IS_MOD(action.key.code) || action.key.code == KC_NO) { // e.g. LSFT(KC_LGUI): we don't want the LSFT to be weak as it would make it useless. - // this also makes LSFT(KC_LGUI) behave exactly the same as LGUI(KC_LSFT) + // This also makes LSFT(KC_LGUI) behave exactly the same as LGUI(KC_LSFT). + // Same applies for some keys like KC_MEH which are declared as MEH(KC_NO). add_mods(mods); } else { add_weak_mods(mods); @@ -168,7 +169,7 @@ void process_action(keyrecord_t *record, action_t action) } else { unregister_code(action.key.code); if (mods) { - if (IS_MOD(action.key.code)) { + if (IS_MOD(action.key.code) || action.key.code == KC_NO) { del_mods(mods); } else { del_weak_mods(mods); -- cgit v1.2.3-24-g4f1b From 78767bf2084a1d63edd0957e09048d34ef448380 Mon Sep 17 00:00:00 2001 From: IBNobody Date: Wed, 28 Sep 2016 20:26:41 -0500 Subject: Fix #770, Fix #779 --- tmk_core/common/avr/bootloader.c | 8 ++++---- tmk_core/common/command.c | 3 --- 2 files changed, 4 insertions(+), 7 deletions(-) (limited to 'tmk_core') diff --git a/tmk_core/common/avr/bootloader.c b/tmk_core/common/avr/bootloader.c index fb9bf2d1c..ad547b985 100644 --- a/tmk_core/common/avr/bootloader.c +++ b/tmk_core/common/avr/bootloader.c @@ -38,7 +38,7 @@ * | | | | * = = = = * | | 32KB-4KB | | 128KB-8KB - * 0x6000 +---------------+ 0x1FC00 +---------------+ + * 0x7000 +---------------+ 0x1E000 +---------------+ * | Bootloader | 4KB | Bootloader | 8KB * 0x7FFF +---------------+ 0x1FFFF +---------------+ * @@ -64,8 +64,8 @@ #define BOOTLOADER_START (FLASH_SIZE - BOOTLOADER_SIZE) -/* - * Entering the Bootloader via Software +/* + * Entering the Bootloader via Software * http://www.fourwalledcubicle.com/files/LUFA/Doc/120730/html/_page__software_bootloader_start.html */ #define BOOTLOADER_RESET_KEY 0xB007B007 @@ -137,7 +137,7 @@ void bootloader_jump_after_watchdog_reset(void) #if 0 /* Jumping To The Bootloader * http://www.pjrc.com/teensy/jump_to_bootloader.html - * + * * This method doen't work when using LUFA. idk why. * - needs to initialize more regisers or interrupt setting? */ diff --git a/tmk_core/common/command.c b/tmk_core/common/command.c index fc5aad5c1..f3e1bf623 100644 --- a/tmk_core/common/command.c +++ b/tmk_core/common/command.c @@ -384,9 +384,6 @@ static bool command_common(uint8_t code) debug_mouse = true; } else { print("\ndebug: off\n"); - debug_matrix = false; - debug_keyboard = false; - debug_mouse = false; } break; -- cgit v1.2.3-24-g4f1b