]> git.donarmstrong.com Git - qmk_firmware.git/commitdiff
Merge pull request #737 from pondrejk/patch-1
authorJack Humbert <jack.humb@gmail.com>
Thu, 8 Sep 2016 21:50:24 +0000 (17:50 -0400)
committerGitHub <noreply@github.com>
Thu, 8 Sep 2016 21:50:24 +0000 (17:50 -0400)
fixed typo in Linux install instructions

30 files changed:
keyboards/ergodox/keymaps/romanzolotarev-norman-osx/readme.md
keyboards/planck/keymaps/cbbrowne/config.h
keyboards/planck/keymaps/cbbrowne/keymap.c
keyboards/planck/keymaps/cbbrowne/readme.md
keyboards/planck/keymaps/pvc/Makefile
keyboards/planck/keymaps/pvc/config.h
keyboards/planck/keymaps/pvc/keymap.c
keyboards/planck/keymaps/tong92/Makefile [new file with mode: 0644]
keyboards/planck/keymaps/tong92/keymap.c [new file with mode: 0644]
keyboards/planck/keymaps/tong92/readme.md [new file with mode: 0644]
quantum/keycode_config.h
quantum/keymap.h
quantum/quantum.c
tmk_core/common/action_util.c
tmk_core/common/avr/xprintf.h
tmk_core/common/bootmagic.c
tmk_core/common/command.c
tmk_core/common/host.c
tmk_core/common/host.h
tmk_core/common/keyboard.c
tmk_core/common/magic.c
tmk_core/common/mbed/xprintf.cpp
tmk_core/common/mbed/xprintf.h
tmk_core/common/print.h
tmk_core/protocol/chibios/usb_main.c
tmk_core/protocol/lufa/descriptor.h
tmk_core/protocol/lufa/lufa.c
tmk_core/protocol/pjrc/usb.c
tmk_core/protocol/pjrc/usb_keyboard.c
tmk_core/readme.md

index a86061285af289900654ed6e46ff6d01e3daebb8..4fa1814fb163770000f1a134c4591c746d4b18ac 100644 (file)
@@ -20,7 +20,7 @@ It is `CTL_T(KC_ESC)` and it works this way:
 
 ## How to activate N-rollover
 
-- Hold left `SHIFT` and right `SHIRT` and then tap `N`.
+- Hold left `SHIFT` and right `SHIFT` and then tap `N`.
 
 ## How to make and flash on OS X
 
index 2d3df59bd2f6af51644937fdc44235881e702a29..58cd2cc5bc54f118983ffe03902059ea1e0ef813 100644 (file)
@@ -9,6 +9,11 @@
 #define randmul 181
 #define randmod 167
 
+/* Filler to make layering a bit clearer *
+ * borrowed from basic keymap            */
+
+#define _______ KC_TRNS
+
 #endif
 
 
index 70eaefb7beacc446bf341605da644e2345e3cd6c..898f6f0e0afef6f222d56ac09802b9d5f4b901d2 100644 (file)
@@ -1,6 +1,6 @@
 #include "planck.h"
 #ifdef BACKLIGHT_ENABLE
-  #include "backlight.h"
+#include "backlight.h"
 #endif
 #include "config.h"
 #include "quantum.h"
@@ -84,21 +84,22 @@ enum macro_id {
 const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
 [_QW] = { /* Qwerty */
   {KC_ESC,  KC_Q,    KC_W,    KC_E,    KC_R,    KC_T,    KC_Y,    KC_U,    KC_I,    KC_O,    KC_P,    KC_BSPC},
-  {KC_LCTL, KC_A,    KC_S,    KC_D,    KC_F,    KC_G,    KC_H,    KC_J,    KC_K,    KC_L,    KC_SCLN, KC_ENT},
+  {KC_LCTL, KC_A,    KC_S,    KC_D,    KC_F,    KC_G,    KC_H,    KC_J,    KC_K,    KC_L,    KC_SCLN, MT(MOD_RSFT, KC_ENT)},
   {KC_LSFT, KC_Z,    KC_X,    KC_C,    KC_V,    KC_B,    KC_N,    KC_M,    KC_COMM, KC_DOT,  KC_SLSH, KC_QUOT },
   {KC_TAB,  M(M_LED), KC_LALT, KC_LGUI, MO(_LW), KC_SPC,  KC_SPC,  MO(_RS), KC_LEFT, KC_DOWN, KC_UP,   KC_RGHT}
+  /* Note that KC_SPC is recorded TWICE, so that either matrix position can activate it */
 },
 [_RS] = { /* RAISE */
   {KC_GRV,  KC_1,    KC_2,    KC_3,    KC_4,    KC_5,    KC_6,    KC_7,    KC_8,    KC_9,    KC_0,    KC_BSPC},
-  {KC_TRNS, KC_F1,   KC_F2,   KC_F3,   KC_F4,   KC_F5,   KC_F6,   KC_MINS, KC_EQL,  KC_LBRC, KC_RBRC, KC_BSLS},
-  {KC_TRNS, KC_F7,   KC_F8,   KC_F9,   KC_F10,  KC_F11,  KC_F12,  DF(_QW), DF(_KP), DF(_KP), RESET,   KC_TRNS},
-  {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY}
+  {_______, KC_F1,   KC_F2,   KC_F3,   KC_F4,   KC_F5,   KC_F6,   KC_MINS, KC_EQL,  KC_LBRC, KC_RBRC, KC_BSLS},
+  {_______, KC_F7,   KC_F8,   KC_F9,   KC_F10,  KC_F11,  KC_F12,  DF(_QW), DF(_KP), DF(_KP), RESET,   _______},
+  {_______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY}
 },
 [_LW] = { /* LOWER */
   {KC_TILD, KC_EXLM, KC_AT,   KC_HASH, KC_DLR,  KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_BSPC},
-  {KC_TRNS, KC_F1,   KC_F2,   KC_F3,   KC_F4,   KC_F5,   KC_F6,   KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_PIPE},
-  {KC_TRNS, KC_F7,   KC_F8,   KC_F9,   KC_F10,  KC_F11,  KC_F12,  DF(_QW), DF(_KP), DF(_KP), RESET,   KC_TRNS},
-  {KC_TRNS, DF(_KP), KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY}
+  {_______, KC_F1,   KC_F2,   KC_F3,   KC_F4,   KC_F5,   KC_F6,   KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_PIPE},
+  {_______, KC_F7,   KC_F8,   KC_F9,   KC_F10,  KC_F11,  KC_F12,  DF(_QW), DF(_KP), DF(_KP), RESET,   _______},
+  {_______, DF(_KP), _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY}
 },
 [_KP] = { /* Key Pad */
   {KC_ESC,  M(M_USERNAME),    M(M_VERSION),   KC_F10,   KC_F11,  KC_F12,   KC_PGUP, KC_KP_ENTER, KC_7, KC_8, KC_9, KC_BSPC},
@@ -108,6 +109,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
 }
 };
 
+/* What is fn_actions actually used for??? */
 const uint16_t PROGMEM fn_actions[] = {
 };
 
index c676dd2c1c54fc1b745d2246c0a93792bed337b4..51979f6300b792714573232be2faae8c6fe300cc 100644 (file)
@@ -7,16 +7,10 @@ Christopher Browne
 This was originally based on the default keyboard map, but I have been
 doing sundry experimentation:
 
-1. Experiments
+1. Useful Experiments
 ----------------------------------------
 
- * To figure things out about the toolset
- * I'm an Emacs guy, so will be needing a fair bit of tuning
  * It made sense to mess around some with keyboard maps.
-   - I tried added Workman alongside Dvorak and Colemak
-     - Boy, oh boy, these don't help!!!
-     - I have done 30 years of learning of Emacs key mappings, and
-       these alternative keyboards massively mess me up
    - I added a keypad, originally based on keymaps/numpad.c, but
      mighty substantially revised, as that one seems to be rotated 90
      degrees from usual conventions for number pads
@@ -30,6 +24,7 @@ doing sundry experimentation:
    - Key [2][2] aka "a" uses a random number generator to select a digit 0-9 at random
    - Key [3][2] aka "z" uses a random number generator to select a letter a-z at random
    - Key [1][3] aka "e" spits out the keymap version number
+ * Minor use of Space Cadet Shift; my SHIFT key has switched to KC_LSP0, so that when I just hit SHIFT, I get a left parens: ( which is great for Lisping.  I don't have a Right Shift, so I don't get an autoclose; I think I'll live with that until a Planck successor with more lines of keys :-)
 
 2. Some code structure ideas
 ---------------------------------------------------
@@ -62,3 +57,24 @@ doing sundry experimentation:
      and shift ESC off the first column so KC_LCTL and KC_LALT can
      be on the first column.
    * I needed to swap ' and ENTER
+   * I tried added Workman alongside Dvorak and Colemak
+     - Boy, oh boy, these don't help!!!
+     - I have done 30 years of learning of Emacs key mappings, and
+       these alternative keyboards massively mess me up
+
+4. TODO
+---------------------------------------------------------
+
+  * I use tmux quite a lot; the mollat keymap seems to have some
+    interesting helpers.  It might be interesting to add a "tmux
+    layer," or to have a few keys in a layer oriented towards that
+  * The mollat tmux layer also suggests some thoughts about Emacs
+    helpers.
+  * I do not presently have anything that handles X11 screen
+    switching, as with Control-Alt-various
+  * I ought to probably look into KC_LEAD, to have some key combos
+    that do not need to be concurrent
+  * The jeebak keymap seems to have some neat ideas:
+    - Number layer which is aggressive about having numbers in several places
+    - Touch layer seems interesting
+  * Trying out sgoodwin's "hold Enter down to get Shift"
\ No newline at end of file
index 0b2f060de409b8c1e27f6a6e9cf127bcbb6df43f..b2ff961fa5e218ef18cdfa3be565eef2f2e367d1 100644 (file)
@@ -1,12 +1,12 @@
 
 # Build Options
-#   change to "no" to disable the options, or define them in the Makefile in 
+#   change to "no" to disable the options, or define them in the Makefile in
 #   the appropriate keymap folder that will get included automatically
 #
-BOOTMAGIC_ENABLE = yes # Virtual DIP switch configuration(+1000)
+BOOTMAGIC_ENABLE = no  # Virtual DIP switch configuration(+1000)
 MOUSEKEY_ENABLE  = yes # Mouse keys(+4700)
 EXTRAKEY_ENABLE  = yes # Audio control and System control(+450)
-CONSOLE_ENABLE   = no  # Console for debug(+400)
+CONSOLE_ENABLE   = yes # Console for debug(+400)
 COMMAND_ENABLE   = yes # Commands for debug and configuration
 NKRO_ENABLE      = yes # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
 BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality
index 1113372b0aee5f3a29f67605c02fb80a12b56ba1..1004c8b99f54f8a2f2683dcee9ddfbcbe041b7c8 100644 (file)
@@ -68,10 +68,18 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
 /* disable debug print */
-//#define NO_DEBUG
+#ifndef NO_DEBUG
+#  define NO_DEBUG
+#endif
 
 /* disable print */
-//#define NO_PRINT
+// #ifndef NO_PRINT
+// #  define NO_PRINT
+// #endif
+
+/* Only print user print statements */
+#define USER_PRINT
+
 
 /* disable action features */
 //#define NO_ACTION_LAYER
index 8ff40f377cbb2a93022cbd10f1c98dfe05ae17bb..23aedfc998575d4de070600f48f585e0fbad7c2a 100644 (file)
@@ -83,6 +83,7 @@ enum keyboard_macros {
 #define SC_ACLS             LALT(KC_F4)
 #define SC_CCLS             LCTL(KC_F4)
 
+#define TG_NKRO             MAGIC_TOGGLE_NKRO
 #define OS_SHFT             KC_FN0
 
 #define _______             KC_TRNS
@@ -206,7 +207,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
 [LAYER_ADJUST] = {
   { XXXXXXX, M_BRTOG, M_BSPDU, M_BSPDD, M_BDFLT, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, MU_TOG , AU_TOG  },
   { XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX },
-  { XXXXXXX, M_QWRTY, XXXXXXX, XXXXXXX, M_BACKL, RESET  , XXXXXXX, M_MOUSE, XXXXXXX, XXXXXXX, MUV_IN , XXXXXXX },
+  { XXXXXXX, M_QWRTY, XXXXXXX, XXXXXXX, M_BACKL, RESET  , TG_NKRO, M_MOUSE, XXXXXXX, XXXXXXX, MUV_IN , XXXXXXX },
   { XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, M_UPPER, XXXXXXX, XXXXXXX, M_LOWER, XXXXXXX, TMPO_DN, MUV_DE , TMPO_UP }
 },
 
@@ -236,7 +237,7 @@ void persistant_default_layer_set(uint16_t default_layer)
 }
 
 const uint16_t PROGMEM fn_actions[] = {
-    [0] = ACTION_MODS_ONESHOT(MOD_LSFT),
+    [0] = ACTION_MODS_ONESHOT(MOD_RSFT),
 };
 
 const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
diff --git a/keyboards/planck/keymaps/tong92/Makefile b/keyboards/planck/keymaps/tong92/Makefile
new file mode 100644 (file)
index 0000000..e6608e7
--- /dev/null
@@ -0,0 +1,62 @@
+#----------------------------------------------------------------------------
+# On command line:
+#
+# make all = Make software.
+#
+# make clean = Clean out built project files.
+#
+# make coff = Convert ELF to AVR COFF.
+#
+# make extcoff = Convert ELF to AVR Extended COFF.
+#
+# make program = Download the hex file to the device.
+#                Please customize your programmer settings(PROGRAM_CMD)
+#
+# make teensy = Download the hex file to the device, using teensy_loader_cli.
+#               (must have teensy_loader_cli installed).
+#
+# make dfu = Download the hex file to the device, using dfu-programmer (must
+#            have dfu-programmer installed).
+#
+# make flip = Download the hex file to the device, using Atmel FLIP (must
+#             have Atmel FLIP installed).
+#
+# make dfu-ee = Download the eeprom file to the device, using dfu-programmer
+#               (must have dfu-programmer installed).
+#
+# make flip-ee = Download the eeprom file to the device, using Atmel FLIP
+#                (must have Atmel FLIP installed).
+#
+# make debug = Start either simulavr or avarice as specified for debugging,
+#              with avr-gdb or avr-insight as the front end for debugging.
+#
+# make filename.s = Just compile filename.c into the assembler code only.
+#
+# make filename.i = Create a preprocessed source file for use in submitting
+#                   bug reports to the GCC project.
+#
+# To rebuild project do "make clean" then "make all".
+#----------------------------------------------------------------------------
+# Build Options
+#   change to "no" to disable the options, or define them in the makefile.mk in 
+#   the appropriate keymap folder that will get included automatically
+#
+BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000)
+MOUSEKEY_ENABLE  = yes # Mouse keys(+4700)
+EXTRAKEY_ENABLE  = no # Audio control and System control(+450)
+CONSOLE_ENABLE   = no  # Console for debug(+400)
+COMMAND_ENABLE   = yes # Commands for debug and configuration
+NKRO_ENABLE      = no # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
+BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality
+MIDI_ENABLE      = no  # MIDI controls
+AUDIO_ENABLE     = no # Audio output on port C6
+UNICODE_ENABLE   = no  # Unicode
+BLUETOOTH_ENABLE = no  # Enable Bluetooth with the Adafruit EZ-Key HID
+RGBLIGHT_ENABLE  = no  # Enable WS2812 RGB underlight.  Do not enable this with audio at the same time.
+
+# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE
+SLEEP_LED_ENABLE = no  # Breathing sleep LED during USB suspend
+
+ifndef QUANTUM_DIR
+       include ../../../../Makefile
+endif
\ No newline at end of file
diff --git a/keyboards/planck/keymaps/tong92/keymap.c b/keyboards/planck/keymaps/tong92/keymap.c
new file mode 100644 (file)
index 0000000..2be28fb
--- /dev/null
@@ -0,0 +1,146 @@
+//Author: tong92 <tong92power@gmail.com>
+
+#include "planck.h"
+#ifdef BACKLIGHT_ENABLE
+  #include "backlight.h"
+#endif
+
+// Fillers to make layering more clear
+#define _______ KC_TRNS
+#define XXXXXXX KC_NO
+#define LOWER M(1)
+#define RAISE M(2)
+#define GO_DEFT M(99)
+#
+
+//MIT Layout
+const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
+/* 0: Qwerty layer (Default)
+* ,-----------------------------------------------------------------------.
+* |Tab  | q   | w   | e   | r   | t   | y   | u   | i   | o   | p   | BS  |
+* |-----------------------------------------------------------------------|
+* |Ctrl | a   | s   | d   | f   | g   | h   | j   | k   | l   | ;   |enter|
+* |-----------------------------------------------------------------------|
+* |Shift| z   | x   | c   | v   | b   | n   | m   |  ,  |  .  |  /  |Shift|
+* |-----------------------------------------------------------------------|
+* | Fn  |Ctrl | Win | Alt |Lower|   Space   |Upper|  '  |  [  |  ]  | Alt |
+* `-----------------------------------------------------------------------'
+*/
+[0] ={
+{KC_TAB, KC_Q,   KC_W,   KC_E,   KC_R, KC_T,  KC_Y,  KC_U, KC_I,   KC_O,   KC_P,   KC_BSPC},
+{KC_LCTL,KC_A,   KC_S,   KC_D,   KC_F, KC_G,  KC_H,  KC_J, KC_K,   KC_L,   KC_SCLN,KC_ENT },
+{KC_LSFT,KC_Z,   KC_X,   KC_C,   KC_V, KC_B,  KC_N,  KC_M, KC_COMM,KC_DOT, KC_SLSH,KC_RSFT},
+{MO(4),  KC_RCTL,KC_LGUI,KC_LALT,LOWER,KC_SPC,KC_SPC,RAISE,KC_QUOT,KC_LBRC,KC_RBRC,KC_RALT}
+},
+/* 1: Lower layer
+* ,-----------------------------------------------------------------------.
+* |  `  |  1  |  2  |  3  |  4  |  5  |  6  |  7  |  8  |  9  |  0  | BS  |
+* |-----------------------------------------------------------------------|
+* |     | F1  | F2  | F3  | F4  | F5  | F6  |  -  |  +  |  [  |  ]  |  \  |
+* |-----------------------------------------------------------------------|
+* |     | F7  | F8  | F9  | F10 | F11 | F12 |     | HOME| PgUp|  UP | PgDo|
+* |-----------------------------------------------------------------------|
+* |     |     |     |     |     |   SPACE   |mouse| END | LEFT| DOWN|RIGHT|
+* `-----------------------------------------------------------------------'
+*/
+[1] ={
+{KC_GRV, KC_1,   KC_2,   KC_3,   KC_4,   KC_5,  KC_6,  KC_7,   KC_8,   KC_9,   KC_0,   KC_BSPC },
+{_______,KC_F1,  KC_F2,  KC_F3,  KC_F4,  KC_F5, KC_F6, KC_MINS,KC_PLUS,KC_LBRC,KC_RBRC,KC_BSLS },
+{_______,KC_F7,  KC_F8,  KC_F9,  KC_F10, KC_F11,KC_F12,_______,KC_HOME,KC_PGUP,KC_UP  ,KC_PGDN },
+{XXXXXXX,_______,_______,_______,_______,KC_SPC,KC_SPC,_______,KC_END, KC_LEFT,KC_DOWN,KC_RIGHT}
+},
+/* 2: Upper layer
+* ,-----------------------------------------------------------------------.
+* |  ~  |  !  |  @  |  #  |  $  |  %  |  ^  |  &  |  *  |  (  |  )  | BS  |
+* |-----------------------------------------------------------------------|
+* |     | F1  | F2  | F3  | F4  | F5  | F6  |  _  |  =  |  {  |  }  |  |  |
+* |-----------------------------------------------------------------------|
+* |     | F7  | F8  | F9  | F10 | F11 | F12 |     | HOME| PgUp|  UP | PgDo|
+* |-----------------------------------------------------------------------|
+* |     |     |     |     |mouse|   SPACE   |     | END | LEFT| DOWN|RIGHT|
+* `-----------------------------------------------------------------------'
+*/
+[2] ={
+{KC_TILD,KC_EXLM,KC_AT,  KC_HASH,KC_DLR, KC_PERC,KC_CIRC,KC_AMPR,KC_ASTR,KC_LPRN,KC_RPRN,KC_BSPC },
+{_______,KC_F1,  KC_F2,  KC_F3,  KC_F4,  KC_F5,  KC_F6,  KC_UNDS,KC_EQL, KC_LCBR,KC_RCBR,KC_PIPE },
+{_______,KC_F7,  KC_F8,  KC_F9,  KC_F10, KC_F11, KC_F12, _______,KC_HOME,KC_PGUP,KC_UP  ,KC_PGDN },
+{XXXXXXX,_______,_______,_______,_______,KC_SPC, KC_SPC, _______,KC_END, KC_LEFT,KC_DOWN,KC_RIGHT}
+},
+/* 4: fn layer (Window shortcuts)
+* ,-----------------------------------------------------------------------.
+* | ESC |WinOf|WinUp|     |     |Sh+Ca|     | PgUp| UP  | PgDo|PrtSc| DEL |
+* |-----------------------------------------------------------------------|
+* |     |WinLe|WinDo|WinRi|     |Al+Ca|CapsL| LEFT| DOWN|RIGHT|     |     |
+* |-----------------------------------------------------------------------|
+* |     |WinLW|WinRW|     |     |Ct+Ca|ScroL| HOME|     | END |     |     |
+* |-----------------------------------------------------------------------|
+* |     |DeskL|DeskR|DeskX|Task | ChangeLang|     |     |     |     | LED |
+* `-----------------------------------------------------------------------'
+*/
+[4] ={
+{KC_ESC ,LALT(KC_F4)        ,LGUI(KC_UP)         ,XXXXXXX          ,XXXXXXX    ,S(KC_CAPS)   ,XXXXXXX,KC_PGUP,KC_UP,KC_PGDN,KC_PSCR,KC_DELT},
+{_______,LGUI(KC_LEFT)      ,LGUI(KC_DOWN)       ,LGUI(KC_RIGHT)   ,XXXXXXX    ,LALT(KC_CAPS),KC_CAPS,KC_LEFT,KC_DOWN,KC_RIGHT,XXXXXXX,XXXXXXX},
+{_______,LGUI(LSFT(KC_LEFT)),LGUI(LSFT(KC_RIGHT)),XXXXXXX          ,XXXXXXX    ,LCTL(KC_CAPS),KC_SLCK,KC_HOME,XXXXXXX,KC_END,XXXXXXX,XXXXXXX},
+{KC_TRNS,LGUI(LCTL(KC_LEFT)),LGUI(LCTL(KC_RIGHT)),LGUI(LCTL(KC_F4)),LCTL(LALT(KC_DELT)),LGUI(KC_SPC),LGUI(KC_SPC),XXXXXXX,XXXXXXX,XXXXXXX,XXXXXXX,M(0)}
+},
+/* 10: mouse layer
+* ,-----------------------------------------------------------------------.
+* |     |     |     |Mo_Up|     |     |     |M_WhL|M_WhU|M_WhR|     |RESET|
+* |-----------------------------------------------------------------------|
+* |     |     |Mo_Le|Mo_Do|Mo_Ri|     |     |M_Bt1|M_WhD|M_Bt2|     |     |
+* |-----------------------------------------------------------------------|
+* |     |     |     |     |     |     |     |M_AC0|M_AC1|M_AC2|     |     |
+* |-----------------------------------------------------------------------|
+* |     |     |     |     |     |  GO_DEFT  |     |     |     |     |     |
+* `-----------------------------------------------------------------------'
+*/
+[10] ={
+{XXXXXXX,XXXXXXX,XXXXXXX,KC_MS_U,XXXXXXX,XXXXXXX,XXXXXXX,KC_WH_L,KC_WH_U,KC_WH_R,XXXXXXX,RESET},
+{XXXXXXX,XXXXXXX,KC_MS_L,KC_MS_D,KC_MS_R,XXXXXXX,XXXXXXX,KC_BTN1,KC_WH_D,KC_BTN2,XXXXXXX,XXXXXXX},
+{XXXXXXX,XXXXXXX,XXXXXXX,XXXXXXX,XXXXXXX,XXXXXXX,XXXXXXX,KC_ACL0,KC_ACL1,KC_ACL2,XXXXXXX,XXXXXXX},
+{XXXXXXX,XXXXXXX,XXXXXXX,XXXXXXX,XXXXXXX,GO_DEFT,GO_DEFT,XXXXXXX,XXXXXXX,XXXXXXX,XXXXXXX,XXXXXXX}
+}
+
+}; 
+//Layout END
+
+const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
+{
+      switch(id) {
+        case 0:
+            if (record->event.pressed) {
+                #ifdef BACKLIGHT_ENABLE
+                    backlight_step();
+                #endif
+            }
+        break;
+        case 1:
+          if (record->event.pressed) {
+            layer_on(1);
+            update_tri_layer(1, 2, 10);
+          } else {
+            layer_off(1);
+            update_tri_layer(1, 2, 10);
+          }
+          break;
+        case 2:
+          if (record->event.pressed) {
+            layer_on(2);
+            update_tri_layer(1, 2, 10);
+          } else {
+            layer_off(2);
+            update_tri_layer(1, 2, 10);
+          }
+          break;
+        case 99:
+            if (record->event.pressed) {
+                layer_off(10);
+                layer_off(1);
+                layer_off(2);
+                layer_on(0);
+                update_tri_layer(0 ,1 ,2);
+            }
+        break;
+      }
+    return MACRO_NONE;
+};
\ No newline at end of file
diff --git a/keyboards/planck/keymaps/tong92/readme.md b/keyboards/planck/keymaps/tong92/readme.md
new file mode 100644 (file)
index 0000000..328d005
--- /dev/null
@@ -0,0 +1,66 @@
+# The Tong92 Layout
+- MIT Layout
+- my keymap for WIndow User
+- Lower && Upper Hold -> Mouse Layer
+- Mouse Layer : space -> Default Layer
+- No Audio
+
+## 1. Default Layer - Qwerty 
+
+    ,-----------------------------------------------------------------------.
+    |Tab  | q   | w   | e   | r   | t   | y   | u   | i   | o   | p   | BS  |
+    |-----------------------------------------------------------------------|
+    |Ctrl | a   | s   | d   | f   | g   | h   | j   | k   | l   | ;   |enter|
+    |-----------------------------------------------------------------------|
+    |Shift| z   | x   | c   | v   | b   | n   | m   |  ,  |  .  |  /  |Shift|
+    |-----------------------------------------------------------------------|
+    | Fn  |Ctrl | Win | Alt |Lower|   Space   |Upper|  '  |  [  |  ]  | Alt |
+    `-----------------------------------------------------------------------'
+
+## 2. Lower Layer
+
+    ,-----------------------------------------------------------------------.
+    |  `  |  1  |  2  |  3  |  4  |  5  |  6  |  7  |  8  |  9  |  0  | BS  |
+    |-----------------------------------------------------------------------|
+    |     | F1  | F2  | F3  | F4  | F5  | F6  |  -  |  +  |  [  |  ]  |  \  |
+    |-----------------------------------------------------------------------|
+    |     | F7  | F8  | F9  | F10 | F11 | F12 |     | HOME| PgUp|  UP | PgDo|
+    |-----------------------------------------------------------------------|
+    |     |     |     |     |     |   SPACE   |mouse| END | LEFT| DOWN|RIGHT|
+    `-----------------------------------------------------------------------'
+
+## 3. Upper Layer
+
+    ,-----------------------------------------------------------------------.
+    |  ~  |  !  |  @  |  #  |  $  |  %  |  ^  |  &  |  *  |  (  |  )  | BS  |
+    |-----------------------------------------------------------------------|
+    |     | F1  | F2  | F3  | F4  | F5  | F6  |  _  |  =  |  {  |  }  |  |  |
+    |-----------------------------------------------------------------------|
+    |     | F7  | F8  | F9  | F10 | F11 | F12 |     | HOME| PgUp|  UP | PgDo|
+    |-----------------------------------------------------------------------|
+    |     |     |     |     |mouse|   SPACE   |     | END | LEFT| DOWN|RIGHT|
+    `-----------------------------------------------------------------------'
+
+## 4. Fn Layer -  Window Shortcuts
+
+    ,-----------------------------------------------------------------------.
+    | ESC |WinOf|WinUp|     |     |Sh+Ca|     | PgUp| UP  | PgDo|PrtSc| DEL |
+    |-----------------------------------------------------------------------|
+    |     |WinLe|WinDo|WinRi|     |Al+Ca|CapsL| LEFT| DOWN|RIGHT|     |     |
+    |-----------------------------------------------------------------------|
+    |     |WinLW|WinRW|     |     |Ct+Ca|ScroL| HOME|     | END |     |     |
+    |-----------------------------------------------------------------------|
+    |     |DeskL|DeskR|DeskX|Task | ChangeLang|     |     |     |     | LED |
+    `-----------------------------------------------------------------------'
+
+## 5. Mouse Layer
+
+    ,-----------------------------------------------------------------------.
+    |     |     |     |Mo_Up|     |     |     |M_WhL|M_WhU|M_WhR|     |RESET|
+    |-----------------------------------------------------------------------|
+    |     |     |Mo_Le|Mo_Do|Mo_Ri|     |     |M_Bt1|M_WhD|M_Bt2|     |     |
+    |-----------------------------------------------------------------------|
+    |     |     |     |     |     |     |     |M_AC0|M_AC1|M_AC2|     |     |
+    |-----------------------------------------------------------------------|
+    |     |     |     |     |     |GO_DEFAULT |     |     |     |     |     |
+    `-----------------------------------------------------------------------'
\ No newline at end of file
index 6216eefc9015acfc886526c2d23c262ace69d628..c15b0d32f870d8928d84b82877e12c86b0659a68 100644 (file)
@@ -1,6 +1,9 @@
 #include "eeconfig.h"
 #include "keycode.h"
 
+#ifndef KEYCODE_CONFIG_H
+#define KEYCODE_CONFIG_H
+
 uint16_t keycode_config(uint16_t keycode);
 
 /* NOTE: Not portable. Bit field order depends on implementation */
@@ -19,3 +22,5 @@ typedef union {
 } keymap_config_t;
 
 extern keymap_config_t keymap_config;
+
+#endif /* KEYCODE_CONFIG_H */
index f2d94d75c3d13da4c04ea9d563256b9de4b9319f..98ddfd0c533e4bda998e879e271fb1f41e141999 100644 (file)
@@ -111,6 +111,7 @@ enum quantum_keycodes {
     MAGIC_UNSWAP_BACKSLASH_BACKSPACE,
     MAGIC_UNHOST_NKRO,
     MAGIC_UNSWAP_ALT_GUI,
+    MAGIC_TOGGLE_NKRO,
 
     // Leader key
 #ifndef DISABLE_LEADER
index e3a20f43e01cf6bf345caa79354054f0c1431212..a16bd5443c5fc941bc4c9371a6b960ddffd62f10 100644 (file)
@@ -199,7 +199,7 @@ bool process_record_quantum(keyrecord_t *record) {
          return false;
       break;
        #endif
-    case MAGIC_SWAP_CONTROL_CAPSLOCK ... MAGIC_UNSWAP_ALT_GUI:
+    case MAGIC_SWAP_CONTROL_CAPSLOCK ... MAGIC_TOGGLE_NKRO:
       if (record->event.pressed) {
         // MAGIC actions (BOOTMAGIC without the boot)
         if (!eeconfig_is_enabled()) {
@@ -207,48 +207,73 @@ bool process_record_quantum(keyrecord_t *record) {
         }
         /* keymap config */
         keymap_config.raw = eeconfig_read_keymap();
-        if (keycode == MAGIC_SWAP_CONTROL_CAPSLOCK) {
-            keymap_config.swap_control_capslock = 1;
-        } else if (keycode == MAGIC_CAPSLOCK_TO_CONTROL) {
-            keymap_config.capslock_to_control = 1;
-        } else if (keycode == MAGIC_SWAP_LALT_LGUI) {
-            keymap_config.swap_lalt_lgui = 1;
-        } else if (keycode == MAGIC_SWAP_RALT_RGUI) {
-            keymap_config.swap_ralt_rgui = 1;
-        } else if (keycode == MAGIC_NO_GUI) {
-            keymap_config.no_gui = 1;
-        } else if (keycode == MAGIC_SWAP_GRAVE_ESC) {
-            keymap_config.swap_grave_esc = 1;
-        } else if (keycode == MAGIC_SWAP_BACKSLASH_BACKSPACE) {
-            keymap_config.swap_backslash_backspace = 1;
-        } else if (keycode == MAGIC_HOST_NKRO) {
-            keymap_config.nkro = 1;
-        } else if (keycode == MAGIC_SWAP_ALT_GUI) {
-            keymap_config.swap_lalt_lgui = 1;
-            keymap_config.swap_ralt_rgui = 1;
-        }
-        /* UNs */
-        else if (keycode == MAGIC_UNSWAP_CONTROL_CAPSLOCK) {
-            keymap_config.swap_control_capslock = 0;
-        } else if (keycode == MAGIC_UNCAPSLOCK_TO_CONTROL) {
-            keymap_config.capslock_to_control = 0;
-        } else if (keycode == MAGIC_UNSWAP_LALT_LGUI) {
-            keymap_config.swap_lalt_lgui = 0;
-        } else if (keycode == MAGIC_UNSWAP_RALT_RGUI) {
-            keymap_config.swap_ralt_rgui = 0;
-        } else if (keycode == MAGIC_UNNO_GUI) {
-            keymap_config.no_gui = 0;
-        } else if (keycode == MAGIC_UNSWAP_GRAVE_ESC) {
-            keymap_config.swap_grave_esc = 0;
-        } else if (keycode == MAGIC_UNSWAP_BACKSLASH_BACKSPACE) {
-            keymap_config.swap_backslash_backspace = 0;
-        } else if (keycode == MAGIC_UNHOST_NKRO) {
-            keymap_config.nkro = 0;
-        } else if (keycode == MAGIC_UNSWAP_ALT_GUI) {
-            keymap_config.swap_lalt_lgui = 0;
-            keymap_config.swap_ralt_rgui = 0;
+        switch (keycode)
+        {
+          case MAGIC_SWAP_CONTROL_CAPSLOCK:
+            keymap_config.swap_control_capslock = true;
+            break;
+          case MAGIC_CAPSLOCK_TO_CONTROL:
+            keymap_config.capslock_to_control = true;
+            break;
+          case MAGIC_SWAP_LALT_LGUI:
+            keymap_config.swap_lalt_lgui = true;
+            break;
+          case MAGIC_SWAP_RALT_RGUI:
+            keymap_config.swap_ralt_rgui = true;
+            break;
+          case MAGIC_NO_GUI:
+            keymap_config.no_gui = true;
+            break;
+          case MAGIC_SWAP_GRAVE_ESC:
+            keymap_config.swap_grave_esc = true;
+            break;
+          case MAGIC_SWAP_BACKSLASH_BACKSPACE:
+            keymap_config.swap_backslash_backspace = true;
+            break;
+          case MAGIC_HOST_NKRO:
+            keymap_config.nkro = true;
+            break;
+          case MAGIC_SWAP_ALT_GUI:
+            keymap_config.swap_lalt_lgui = true;
+            keymap_config.swap_ralt_rgui = true;
+            break;
+          case MAGIC_UNSWAP_CONTROL_CAPSLOCK:
+            keymap_config.swap_control_capslock = false;
+            break;
+          case MAGIC_UNCAPSLOCK_TO_CONTROL:
+            keymap_config.capslock_to_control = false;
+            break;
+          case MAGIC_UNSWAP_LALT_LGUI:
+            keymap_config.swap_lalt_lgui = false;
+            break;
+          case MAGIC_UNSWAP_RALT_RGUI:
+            keymap_config.swap_ralt_rgui = false;
+            break;
+          case MAGIC_UNNO_GUI:
+            keymap_config.no_gui = false;
+            break;
+          case MAGIC_UNSWAP_GRAVE_ESC:
+            keymap_config.swap_grave_esc = false;
+            break;
+          case MAGIC_UNSWAP_BACKSLASH_BACKSPACE:
+            keymap_config.swap_backslash_backspace = false;
+            break;
+          case MAGIC_UNHOST_NKRO:
+            keymap_config.nkro = false;
+            break;
+          case MAGIC_UNSWAP_ALT_GUI:
+            keymap_config.swap_lalt_lgui = false;
+            keymap_config.swap_ralt_rgui = false;
+            break;
+          case MAGIC_TOGGLE_NKRO:
+            keymap_config.nkro = !keymap_config.nkro;
+            break;
+          default:
+            break;
         }
         eeconfig_update_keymap(keymap_config.raw);
+        clear_keyboard(); // clear to prevent stuck keys
+
         return false;
       }
       break;
@@ -271,7 +296,7 @@ bool process_record_quantum(keyrecord_t *record) {
         unregister_mods(MOD_BIT(KC_LSFT));
       }
       return false;
-      break;
+      // break;
     }
 
     case KC_RSPC: {
@@ -293,7 +318,7 @@ bool process_record_quantum(keyrecord_t *record) {
         unregister_mods(MOD_BIT(KC_RSFT));
       }
       return false;
-      break;
+      // break;
     }
     default: {
       shift_interrupted[0] = true;
index 61ff202befa510b9d08f3604f7fad50c607c11b7..cb4b2526484e59fc31191ca10286176533e30585 100644 (file)
@@ -20,6 +20,10 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 #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++)
             ;
index e53c0dd8e0df1ba0823ca761601ae63f34d88b64..08d9f93a0c1cc9a1c671ea456d3e9dd7bf6b1ac1 100644 (file)
@@ -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
index 6730a2a4aab44372c0357e3ff9e85c6846fb6cfa..2c6bcbae56fccafae40a627ce0e47ceb4fcce37c 100644 (file)
@@ -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); }
index 476fc6fe3c59cce819c0bfbeebbb0ace19bcdb6e..54d6117fd1907472d61cf06cdf3b024638edeec4 100644 (file)
@@ -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");
index 11a05c2ddd74bba6f1af7db8e6550939f463a44b..e12b6221656f53173e13e3a4f2a14465b863470b 100644 (file)
@@ -22,11 +22,6 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 #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;
index 9814b10d2d0855b9aeea6d6e4cdcd31794051bcf..aeabba7107133090dcc1699044e45d7d5335272d 100644 (file)
@@ -28,10 +28,6 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 extern "C" {
 #endif
 
-#ifdef NKRO_ENABLE
-extern bool keyboard_nkro;
-#endif
-
 extern uint8_t keyboard_idle;
 extern uint8_t keyboard_protocol;
 
index c46a701b3bfd1dae174b2915e4ce60b3b9eedca4..371d93f3e59b755130b5afdb7fc8428e879d8bf9 100644 (file)
@@ -57,6 +57,8 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 #   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
 }
 
index 194e4cc0266cd67317a3a02367c1a392f5718570..49617a3d103f0d7f0dd30bd787445dd3ae3dab9f 100644 (file)
@@ -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);
index 3647ece7513318feec06e7656db39734bfdc1181..b1aac2c99d1e2e1248c6b1f4285e9ffa39a9d14a 100644 (file)
@@ -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 */
index 26bc529e5be547b7b0f09ddcca67ab1ffe252976..1e7a48c06dbe8c638dc4dd3456ef0bb3f40e601f 100644 (file)
@@ -7,7 +7,7 @@
 extern "C" {
 #endif
 
-int xprintf(const char *format, ...);
+int __xprintf(const char *format, ...);
 
 #ifdef __cplusplus
 }
index a1352527fce5a9f9a472669efe39f60dbf454f11..8836c0fc7cb38652ec94d1ab3979bf6c0142815a 100644 (file)
 
 #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
index e2c9d9bf1415ad0fe9d946fb1d5116744938aa2f..d0c72c46c7c6fc6f85f3827901e8361a8400e589 100644 (file)
 #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
index 316650a7b134f5e440b8370b07939a8160ee6f4d..c6c94e3618404db4e4ec887ede39a1b44972f319 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * Copyright 2012,2013 Jun Wako <wakojun@gmail.com>
  * 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
index 9b201374a2518e24c9155f240fffc59134f07214..01c0e45b0b010a5ee3a68996fefd2e68e41b74a5 100644 (file)
 #include "descriptor.h"
 #include "lufa.h"
 
+#ifdef NKRO_ENABLE
+  #include "keycode_config.h"
+
+  extern keymap_config_t keymap_config;
+#endif
+
+
 #ifdef AUDIO_ENABLE
     #include <audio.h>
 #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);
 
index 1e6ba8719a2a124ef687e63916bc30dd037df120..09efbe076268beb5b09ca941292049dd348a98c2 100644 (file)
@@ -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
 #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();
index 4b87b5d7b5b1644e199d8e56512138f570cdc339..05f4797340df3a63d81bb51d4fafa1fa936aeab1 100644 (file)
 #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
index f460d0ed44aaf7079b2ae47273fe9f36f09c8b43..3242328516ca97fbbbe2cffbc8c2788cea2ca281 100644 (file)
@@ -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