Author Topic: TMK keyboard firmware  (Read 819844 times)

0 Members and 1 Guest are viewing this topic.

Offline p3lim

  • Posts: 106
  • Location: Norway
Re: TMK keyboard firmware
« Reply #900 on: Fri, 11 September 2015, 07:44:08 »
Not sure if it's related to your issue, but I had to modify action_macro.c to disable modifiers while playing a macro.

Code: [Select]
diff --git a/common/action_macro.c b/common/action_macro.c
index ba93fc8..1fdda1a 100644
--- a/common/action_macro.c
+++ b/common/action_macro.c
@@ -35,6 +35,12 @@ void action_macro_play(const macro_t *macro_p)
     uint8_t interval = 0;
 
     if (!macro_p) return;
+
+    // store and depress any modifiers before running the macro
+    uint8_t old_mods = get_mods();
+    clear_mods();
+    send_keyboard_report();
+
     while (true) {
         switch (MACRO_READ()) {
             case KEY_DOWN:
@@ -74,6 +80,9 @@ void action_macro_play(const macro_t *macro_p)
                 break;
             case END:
             default:
+                // restore previous modifiers when the macro has finished playing
+                add_mods(old_mods);
+                send_keyboard_report();
                 return;
         }
         // interval

Offline skullydazed

  • * Vendor
  • Posts: 307
  • Location: Bay Area, CA
  • Had to turn PM's off. Email info@clueboard.co!
    • Clueboard
Re: TMK keyboard firmware
« Reply #901 on: Fri, 11 September 2015, 10:27:55 »
Not sure if it's related to your issue, but I had to modify action_macro.c to disable modifiers while playing a macro.

Code: [Select]
diff --git a/common/action_macro.c b/common/action_macro.c
index ba93fc8..1fdda1a 100644
--- a/common/action_macro.c
+++ b/common/action_macro.c
@@ -35,6 +35,12 @@ void action_macro_play(const macro_t *macro_p)
     uint8_t interval = 0;
 
     if (!macro_p) return;
+
+    // store and depress any modifiers before running the macro
+    uint8_t old_mods = get_mods();
+    clear_mods();
+    send_keyboard_report();
+
     while (true) {
         switch (MACRO_READ()) {
             case KEY_DOWN:
@@ -74,6 +80,9 @@ void action_macro_play(const macro_t *macro_p)
                 break;
             case END:
             default:
+                // restore previous modifiers when the macro has finished playing
+                add_mods(old_mods);
+                send_keyboard_report();
                 return;
         }
         // interval

Thank you! This works perfectly for me when I define this macro:

Code: [Select]
        case CMD_TAB:
            return (record->event.pressed ?
                    MACRO(D(LGUI), T(TAB), U(LGUI), END) :
                    MACRO(END));

It still does not work when using this macro:

Code: [Select]
        case CMD_TAB:
            return (record->event.pressed ?
                    MACRO(D(LGUI), T(TAB), END) :
                    MACRO(U(LGUI), END));

I dug into the code a bit and it seems like weak_real_mods isn't getting cleared properly somewhere, my added logging shows that pretty clearly:

Code: [Select]
action_macro_play: KEY_DOWN(E3)
action_macro_play: real_mods: 00)
action_macro_play: weak_real_mods: 00)
action_macro_play: KEY_DOWN(2B)
action_macro_play: real_mods: 00)
action_macro_play: weak_real_mods: 08)
action_macro_play: KEY_UP(2B)
action_macro_play: real_mods: 00)
action_macro_play: weak_real_mods: 08)
action_macro_play: KEY_UP(E3)
action_macro_play: real_mods: 00)
action_macro_play: weak_real_mods: 08)
action_macro_play: END
action_macro_play: Unknown macro: 00
action_macro_play: END
action_macro_play: Unknown macro: 00

Those are all the lines hid_listen prints when I press the key a single time.

Another curiosity is that it seems like the first macro doesn't end until the second macro has run and ended? Could that be coming into play at all?

Offline nephiel

  • Posts: 129
  • Location: Spain
Re: TMK keyboard firmware
« Reply #902 on: Fri, 11 September 2015, 13:00:33 »
I'm trying to set up Shift Parenthesis using dual role keys.

I set up Left Shift as a FN key and use ACTION_MODS_TAP_KEY to send LShift when held and '(' when tapped.
But '(' is typed as Shift + 9, so I have to use ACTION_MODS_KEY to add a Shift modifier to the 9 key.
That leaves me with:
Code: [Select]
[4] = ACTION_MODS_TAP_KEY(MOD_LSFT, ACTION_MODS_KEY(MOD_LSFT, KC_9)),     // Tap for '(', hold for LShift
This works as Shift when holding, and tap works, but produces '9' instead of '('.

So, ACTION_MODS_KEY isn't working here, and I can't figure out why. Any clues?
Stop wasting space! Chop your spacebar into bits!
NPH60: a custom 60% w/TrackPoint & split spacebar

Offline U47

  • Posts: 99
  • Location: YEG
Re: TMK keyboard firmware
« Reply #903 on: Fri, 11 September 2015, 14:11:55 »
Similarly, I'm looking to make a dual-role key out of the standard Caps Lock position which would also take a modifier.

Tap: BKSP
Shift-tap: DEL
Hold: L_CTRL

I'm not sure you can combine Actions the way you're attempting. Maybe Hasu can shed some light for us?


I'm trying to set up Shift Parenthesis using dual role keys.

I set up Left Shift as a FN key and use ACTION_MODS_TAP_KEY to send LShift when held and '(' when tapped.
But '(' is typed as Shift + 9, so I have to use ACTION_MODS_KEY to add a Shift modifier to the 9 key.
That leaves me with:
Code: [Select]
[4] = ACTION_MODS_TAP_KEY(MOD_LSFT, ACTION_MODS_KEY(MOD_LSFT, KC_9)),     // Tap for '(', hold for LShift
This works as Shift when holding, and tap works, but produces '9' instead of '('.

So, ACTION_MODS_KEY isn't working here, and I can't figure out why. Any clues?

Offline njbair

  • Posts: 2825
  • Location: Cleveland, Ohio
  • I love the Powerglove. It's so bad.
    • nickbair.net
Re: TMK keyboard firmware
« Reply #904 on: Fri, 11 September 2015, 14:21:57 »
Hey, not sure if I should post this somewhere else, but I just had to burn the alps64 firmware using FLIP in Windows, and I ran into a snag.

All the TMK docs mention setting the Device Selection dialog to ATmega32U4, but the alps64 board actually has the ATmega32U2 chip. I couldn't figure out what I was doing wrong until I got out my loupe and looked at the markings on the chip itself. Once I changed the device to ATmega32U2, the burn went perfectly.

Hopefully this helps someone else in the future!

Alpine Winter GB | My Personal TMK Firmware Repo
IBM Rubber Band "Floss" Mod | Click Modding Alps 101 | Flame-Polishing Cherry MX Stems
Review: hasu's USB to USB converter
My boards:
More
AEKII 60% | Alps64 HHKB | Ducky Shine 3, MX Blues | IBM Model M #1391401, Nov. 1990 | IBM SSK #1391472, Nov. 1987, screw modded, rubber-band modded | Noppoo EC108-Pro, 45g | Infinity 60% v2 Hacker, Matias Quiet Pros | Infinity 60% v2 Standard, MX Browns | Cherry G80-1800LPCEU-2, MX Blacks | Cherry G80-1813 (Dolch), MX Blues | Unicomp M-122, ANSI-modded | Unicomp M-122 (Unsaver mod in progress) | 2x Unitek K-258, White Alps | Apple boards (IIGS, AEKII) | Varmilo VA87MR, Gateron Blacks | Filco Zero TKL, Fukka White Alps | Planck, Gateron Browns | Monarch, click-modded Cream Alps

Offline hasu

  • Thread Starter
  • Posts: 3471
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: TMK keyboard firmware
« Reply #905 on: Fri, 11 September 2015, 14:58:47 »
You can't define ACTION like that. ACTION cannot be placed in another ACTION.

You can define complex behaviour with action_function(). See this.
https://github.com/tmk/tmk_keyboard/blob/master/keyboard/hhkb/keymap_hasu.c#L254-L280


I'm trying to set up Shift Parenthesis using dual role keys.

I set up Left Shift as a FN key and use ACTION_MODS_TAP_KEY to send LShift when held and '(' when tapped.
But '(' is typed as Shift + 9, so I have to use ACTION_MODS_KEY to add a Shift modifier to the 9 key.
That leaves me with:
Code: [Select]
[4] = ACTION_MODS_TAP_KEY(MOD_LSFT, ACTION_MODS_KEY(MOD_LSFT, KC_9)),     // Tap for '(', hold for LShift
This works as Shift when holding, and tap works, but produces '9' instead of '('.

So, ACTION_MODS_KEY isn't working here, and I can't figure out why. Any clues?

Offline hasu

  • Thread Starter
  • Posts: 3471
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: TMK keyboard firmware
« Reply #906 on: Fri, 11 September 2015, 15:31:40 »
Ah, I'll fix doc later :D
If you don't mind using command line I'd recommend 'make flip' or 'make dfu' so that you don't need to care chip name.

Hey, not sure if I should post this somewhere else, but I just had to burn the alps64 firmware using FLIP in Windows, and I ran into a snag.

All the TMK docs mention setting the Device Selection dialog to ATmega32U4, but the alps64 board actually has the ATmega32U2 chip. I couldn't figure out what I was doing wrong until I got out my loupe and looked at the markings on the chip itself. Once I changed the device to ATmega32U2, the burn went perfectly.

Hopefully this helps someone else in the future!


Offline njbair

  • Posts: 2825
  • Location: Cleveland, Ohio
  • I love the Powerglove. It's so bad.
    • nickbair.net
Re: TMK keyboard firmware
« Reply #907 on: Fri, 11 September 2015, 15:33:12 »
Ah, I'll fix doc later :D
If you don't mind using command line I'd recommend 'make flip' or 'make dfu' so that you don't need to care chip name.

Hey, not sure if I should post this somewhere else, but I just had to burn the alps64 firmware using FLIP in Windows, and I ran into a snag.

All the TMK docs mention setting the Device Selection dialog to ATmega32U4, but the alps64 board actually has the ATmega32U2 chip. I couldn't figure out what I was doing wrong until I got out my loupe and looked at the markings on the chip itself. Once I changed the device to ATmega32U2, the burn went perfectly.

Hopefully this helps someone else in the future!

I haven't personally had much luck getting a build environment working in Windows. So I use a Debian VM to build the firmware, then SCP it to my desktop temp folder and flash it from there using FLIP GUI.

Alpine Winter GB | My Personal TMK Firmware Repo
IBM Rubber Band "Floss" Mod | Click Modding Alps 101 | Flame-Polishing Cherry MX Stems
Review: hasu's USB to USB converter
My boards:
More
AEKII 60% | Alps64 HHKB | Ducky Shine 3, MX Blues | IBM Model M #1391401, Nov. 1990 | IBM SSK #1391472, Nov. 1987, screw modded, rubber-band modded | Noppoo EC108-Pro, 45g | Infinity 60% v2 Hacker, Matias Quiet Pros | Infinity 60% v2 Standard, MX Browns | Cherry G80-1800LPCEU-2, MX Blacks | Cherry G80-1813 (Dolch), MX Blues | Unicomp M-122, ANSI-modded | Unicomp M-122 (Unsaver mod in progress) | 2x Unitek K-258, White Alps | Apple boards (IIGS, AEKII) | Varmilo VA87MR, Gateron Blacks | Filco Zero TKL, Fukka White Alps | Planck, Gateron Browns | Monarch, click-modded Cream Alps

Offline nephiel

  • Posts: 129
  • Location: Spain
Re: TMK keyboard firmware
« Reply #908 on: Fri, 11 September 2015, 16:30:08 »
I'm trying to set up Shift Parenthesis using dual role keys.

I set up Left Shift as a FN key and use ACTION_MODS_TAP_KEY to send LShift when held and '(' when tapped.
But '(' is typed as Shift + 9, so I have to use ACTION_MODS_KEY to add a Shift modifier to the 9 key.
That leaves me with:
Code: [Select]
[4] = ACTION_MODS_TAP_KEY(MOD_LSFT, ACTION_MODS_KEY(MOD_LSFT, KC_9)),     // Tap for '(', hold for LShift
This works as Shift when holding, and tap works, but produces '9' instead of '('.

So, ACTION_MODS_KEY isn't working here, and I can't figure out why. Any clues?
You can't define ACTION like that. ACTION cannot be placed in another ACTION.

You can define complex behaviour with action_function(). See this.
https://github.com/tmk/tmk_keyboard/blob/master/keyboard/hhkb/keymap_hasu.c#L254-L280
Looking at action_code.h, these ACTIONs are #defines, and most of them are nested. I see it doesn't work, but I don't really understand why...

Anyway, thanks! I got Shift parentheses to work using action_function, and also Control brackets [] and Alt curly brackets {}.
The code is up on my fork in Github: https://github.com/Nephiel/tmk_keyboard/commit/0903bc12f8fcc4050f3e61dee23fcccb94f917a9
Note my board layout is Spanish and parentheses are Shift+8/9 instead of Shift+9/0.

Similarly, I'm looking to make a dual-role key out of the standard Caps Lock position which would also take a modifier.

Tap: BKSP
Shift-tap: DEL
Hold: L_CTRL
This is a bit different. You can do tap=BKSP and hold=LCTRL with ACTION_MODS_TAP_KEY(MOD_LCTL, KC_BKSP). But for shift-tap=DEL you would need another layer, and if you want to use Shift to activate that layer, you'll need to apply a shift mod to all the other keys in that layer so Shift still works normally for them. I'm not sure how to do that.

Another option is to write a custom action_function() like Hasu said.
« Last Edit: Fri, 11 September 2015, 17:28:59 by nephiel »
Stop wasting space! Chop your spacebar into bits!
NPH60: a custom 60% w/TrackPoint & split spacebar

Offline skullydazed

  • * Vendor
  • Posts: 307
  • Location: Bay Area, CA
  • Had to turn PM's off. Email info@clueboard.co!
    • Clueboard
Re: TMK keyboard firmware
« Reply #909 on: Fri, 11 September 2015, 19:53:59 »
I don't remember whether this behaviour is intentional or not, probably bug.
Try this patch. I'll push it into the repository later.

Code: [Select]
diff --git a/tmk_core/common/action_macro.c b/tmk_core/common/action_macro.c
index ba93fc8..ffaf125 100644
--- a/tmk_core/common/action_macro.c
+++ b/tmk_core/common/action_macro.c
@@ -42,6 +42,7 @@ void action_macro_play(const macro_t *macro_p)
                 dprintf("KEY_DOWN(%02X)\n", macro);
                 if (IS_MOD(macro)) {
                     add_weak_mods(MOD_BIT(macro));
+                    send_keyboard_report();
                 } else {
                     register_code(macro);
                 }
@@ -51,6 +52,7 @@ void action_macro_play(const macro_t *macro_p)
                 dprintf("KEY_UP(%02X)\n", macro);
                 if (IS_MOD(macro)) {
                     del_weak_mods(MOD_BIT(macro));
+                    send_keyboard_report();
                 } else {
                     unregister_code(macro);
                 }

I took a look with fresh eyes and it turns out I was missing the second send_keyboard_report() in your patch. I added that and my MACRO() is working exactly as expected, thanks! As a bonus I got to dive into that code and learn a bit about how it all works.

Offline U47

  • Posts: 99
  • Location: YEG
Re: TMK keyboard firmware
« Reply #910 on: Fri, 11 September 2015, 20:47:47 »
Quote from: hasu

[quote author=U47 link=topic=41989.msg1862625#msg1862625 date=1441998715
Similarly, I'm looking to make a dual-role key out of the standard Caps Lock position which would also take a modifier.

Tap: BKSP
Shift-tap: DEL
Hold: L_CTRL
This is a bit different. You can do tap=BKSP and hold=LCTRL with ACTION_MODS_TAP_KEY(MOD_LCTL, KC_BKSP). But for shift-tap=DEL you would need another layer, and if you want to use Shift to activate that layer, you'll need to apply a shift mod to all the other keys in that layer so Shift still works normally for them. I'm not sure how to do that.

Another option is to write a custom action_function() like Hasu said.

Yeah, I think using Shift is the gotcha. I'm just used to this combination since this is how I've had Karabiner set to work. I don't think a custom action would be too onerous, or I can add it to SpaceFN instead.

Offline hasu

  • Thread Starter
  • Posts: 3471
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: TMK keyboard firmware
« Reply #911 on: Fri, 11 September 2015, 21:36:08 »
Great. I'll push this fix to my repository.

I don't remember whether this behaviour is intentional or not, probably bug.
Try this patch. I'll push it into the repository later.

Code: [Select]
diff --git a/tmk_core/common/action_macro.c b/tmk_core/common/action_macro.c
index ba93fc8..ffaf125 100644
--- a/tmk_core/common/action_macro.c
+++ b/tmk_core/common/action_macro.c
@@ -42,6 +42,7 @@ void action_macro_play(const macro_t *macro_p)
                 dprintf("KEY_DOWN(%02X)\n", macro);
                 if (IS_MOD(macro)) {
                     add_weak_mods(MOD_BIT(macro));
+                    send_keyboard_report();
                 } else {
                     register_code(macro);
                 }
@@ -51,6 +52,7 @@ void action_macro_play(const macro_t *macro_p)
                 dprintf("KEY_UP(%02X)\n", macro);
                 if (IS_MOD(macro)) {
                     del_weak_mods(MOD_BIT(macro));
+                    send_keyboard_report();
                 } else {
                     unregister_code(macro);
                 }

I took a look with fresh eyes and it turns out I was missing the second send_keyboard_report() in your patch. I added that and my MACRO() is working exactly as expected, thanks! As a bonus I got to dive into that code and learn a bit about how it all works.


Offline nephiel

  • Posts: 129
  • Location: Spain
Re: TMK keyboard firmware
« Reply #912 on: Sat, 12 September 2015, 04:24:03 »
Quote from: hasu

[quote author=U47 link=topic=41989.msg1862625#msg1862625 date=1441998715
Similarly, I'm looking to make a dual-role key out of the standard Caps Lock position which would also take a modifier.

Tap: BKSP
Shift-tap: DEL
Hold: L_CTRL
This is a bit different. You can do tap=BKSP and hold=LCTRL with ACTION_MODS_TAP_KEY(MOD_LCTL, KC_BKSP). But for shift-tap=DEL you would need another layer, and if you want to use Shift to activate that layer, you'll need to apply a shift mod to all the other keys in that layer so Shift still works normally for them. I'm not sure how to do that.

Another option is to write a custom action_function() like Hasu said.

Yeah, I think using Shift is the gotcha. I'm just used to this combination since this is how I've had Karabiner set to work. I don't think a custom action would be too onerous, or I can add it to SpaceFN instead.
Wouldn't this work? https://github.com/tmk/tmk_keyboard/blob/master/doc/keymap.md#35-momentary-switching-with-modifiers
Have a momentary layer with DEL on CapsLock and set Shift on the default layer as a FN key to switch to it while setting MOD_LSHIFT.
Stop wasting space! Chop your spacebar into bits!
NPH60: a custom 60% w/TrackPoint & split spacebar

Offline TheGlow

  • Posts: 48
Re: TMK keyboard firmware
« Reply #913 on: Tue, 15 September 2015, 09:54:03 »
I hate to be that guy, but what do I need to get started on using TMK and compiling my own hex?
I have a FrostyFlake V2 and it seems Easy AVR Usb keyboard hexes are causing odd behavior.
As I type, 2-3 characters later it will repeat a char I already typed, like "sample" > samsple. Sometimes 1 word can 2 doubles in it.
I tried debouncing up to 50-75 and sometimes till get it, but then I cant spam spacebar and backspace.
Bphipanie's stock is good so Im wondering if TMK would be good.

Again, where should I start? I doubt theres a converted from Easy AVR .dat to use in TMK, is there?

Offline flabbergast

  • Posts: 234
  • Location: UK
Re: TMK keyboard firmware
« Reply #914 on: Tue, 15 September 2015, 10:42:33 »
AFAIK there is no "converter".

However bphiphany has forked TMK and added his controllers, so I'd start with his sources: https://github.com/BathroomEpiphanies/tmk_keyboard

For general instructions how to go about compiling TMK, matt3o's guide is generally a good start.

Offline NiceAndCreamy

  • Posts: 13
  • Location: US - PA
Re: TMK keyboard firmware
« Reply #915 on: Tue, 15 September 2015, 17:09:49 »
First time doing this custom keyboard stuff and I seem to be having an issue. I believe i have my hex file all setup and programmed to the teensy but whenever its plugged in I see another keyboard in device manager for a second and then it automatically disconnects. I can get it to say "installing keyboard" if I change the product id in config.h but the keyboard continues to disconnect.

Offline hasu

  • Thread Starter
  • Posts: 3471
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: TMK keyboard firmware
« Reply #916 on: Sat, 19 September 2015, 21:23:29 »
Fixed control of LEDs for NeXT keyboard converter(Non ADB) after a long since the last time.
https://github.com/tmk/tmk_keyboard/commit/9b99f8f8649c25b5efa92c9fd49b7f4c0ce60a76

Try it if you are  interested.
https://github.com/tmk/tmk_keyboard/tree/master/converter/next_usb




The codes were contributed from bcg (bgould@github) long since, Thanks!

Offline torusJKL

  • Posts: 7
Re: TMK keyboard firmware
« Reply #917 on: Tue, 29 September 2015, 02:18:16 »
Hi everyone

I finally finished my ErgoDox and very much like the tmk firmware and all the features it provides.

I'm trying to do a layer for special characters.
Like shown in this neo layer 3 pdf.

The layer is activated using
Code: [Select]
[4] = ACTION_LAYER_MOMENTARY(4),
The keys would be arranged the following way
Code: [Select]
   /* Keymap 4: Special chars Layer
     *
     * all special characters on one layer
     *
     * ,--------------------------------------------------.           ,--------------------------------------------------.
     * |  Esc   |   1  |   2  |   3  |   4  |   5  |      |           |      |   6  |   7  |   8  |   9  |   0  |        |
     * |--------+------+------+------+------+-------------|           |------+------+------+------+------+------+--------|
     * |  Tab   |      |   _  |   [  |   ]  |   ^  | BKSP |           |      |   !  |   <  |   >  |   =  |   &  |        |
     * |--------+------+------+------+------+------|      |           |      |------+------+------+------+------+--------|
     * |  Del   |   \  |   /  |   {  |   }  |   *  |------|           |------|   ?  |   (  |   )  |   -  |   :  |   @    |
     * |--------+------+------+------+------+------|      |           |      |------+------+------+------+------+--------|
     * |        |   #  |   $  |   |  |   ~  |      | RET  |           |  L4  |   +  |   %  |   "  |   '  |   ;  |        |
     * `--------+------+------+------+------+-------------'           `-------------+------+------+------+------+--------'
     *   | Prnt |  F1  |  F2  |  F3  |  F4  |                                       |  F9  |  F10 |  F11 | F12  |      |
     *   `----------------------------------'                                       `----------------------------------'
     *                                        ,-------------.       ,-------------.
     *                                        |  F5  |  F6  |       |  F7  |  F8  |
     *                                 ,------|------|------|       |------+------+------.
     *                                 |      |      | LAlt |       | RCtrl|      |      |
     *                                 | LSft |  L4  |------|       |------| RAlt | Space|
     *                                 |      |      | LGui |       | RGui |      |      |
     *                                 `--------------------'       `--------------------'
     */


I'm using functions to press SHIFT and a second button like KC_LBRC in order to get {.
Code: [Select]
[26] = ACTION_MODS_KEY(MOD_LSFT, KC_LBRC),
In the end my keymap uses too many of functions
Code: [Select]
    KEYMAP(
        // left hand
        ESC,    1,   2,   3,   4,   5,TRNS,
        TAB, TRNS,FN34,LBRC,RBRC,FN16,BSPC,
        TRNS,BSLS,SLSH,FN26,FN27,FN18,
        TRNS,FN13,FN14,FN28,FN29,TRNS,ENT,
        PSCR,  F1,  F2,  F3,  F4,
                                        F5,  F6,
                                           LALT,
                                 LSFT, FN4,LGUI,
        // right hand
             TRNS,   6,   7,   8,   9,   0,TRNS,
             TRNS,FN11,FN24,FN23, EQL,FN17,TRNS,
                  FN25,FN19,FN10,MINS,FN32,FN12,
              FN4,FN33,FN15,FN35,QUOT,SCLN,TRNS,
                         F9, F10, F11, F12,TRNS,
           F7, F8,
        RCTRL,
        RGUI,RALT,SPC
    ),

With all the other functions I already use I passed the allowed 32 functions (currently 34) and thus I can't compile the firmware anymore.


Is there a better way to get characters that are on the shift key?
Maybe 1 macro for the whole layout that checks which key was pressed and with this one using the same function on all the shift keys?

Thanks!
« Last Edit: Tue, 29 September 2015, 02:22:28 by torusJKL »

Offline nomaded

  • Posts: 197
  • Location: Andover, MA
Re: TMK keyboard firmware
« Reply #918 on: Tue, 29 September 2015, 11:52:21 »
I have an example keymap.h file at https://geekhack.org/index.php?topic=48106.msg1826237#msg1826237. That config doesn't use more than 32 functions, but it should show you how do use more than 32 functions. It's based on cub-uanic current release on github.
Dvorak
ErgoDox fullhand (MX Clears) w/Nuclear Green Data SA || Infinity ErgoDox (Zealios 78g tactile) w/SA Retro || Atreus62 (MX Clears) w/Chocolatier || TECK 209 (MX Browns) || TouchStream ST
Kensington Slimblade Trackball || Logitech Cordless Optical Trackman || Apple Magic Trackpad
Current Dvorak-based ErgoDox layout || Current Dvorak-based TECK layout

Offline torusJKL

  • Posts: 7
Re: TMK keyboard firmware
« Reply #919 on: Wed, 30 September 2015, 00:05:53 »
I have an example keymap.h file at https://geekhack.org/index.php?topic=48106.msg1826237#msg1826237. That config doesn't use more than 32 functions, but it should show you how do use more than 32 functions. It's based on cub-uanic current release on github.

Thanks!
I will try to do the 32 Fn keys per layer.
What do you mean with the following sentence?
Code: [Select]
* This overrides the keymap_fn_to_action() function found at the end of
 * keymap.c with an #if defined.

Could you post that line for keymap.c?


I have another question regarding your CUSTOM_KEY solution.
Code: [Select]
    keyevent_t event = record->event;

    if (id == CUSTOM_KEY) {
        uint8_t layer = biton32(layer_state);
        uint8_t col = event.key.col;
        uint8_t row = event.key.row;
        uint8_t handled = 0;
Is it possible to record nkeys from the key event?

For example if I wanted to use shift + a to get @ instead of A.
(I could use shift to change the layer but than OS key combinations with shift would not work anymore)

Offline U47

  • Posts: 99
  • Location: YEG
Re: TMK keyboard firmware
« Reply #920 on: Wed, 30 September 2015, 00:44:48 »
Anyone out there who has a board given any thought to cobbling together SGI protocol support? I have a couple of SGI Bigfoot boards, one of which has SGI's proprietary interface and protocol. Could be an interesting project...

Offline nomaded

  • Posts: 197
  • Location: Andover, MA
Re: TMK keyboard firmware
« Reply #921 on: Fri, 02 October 2015, 01:57:27 »
What do you mean with the following sentence?
Code: [Select]
* This overrides the keymap_fn_to_action() function found at the end of
 * keymap.c with an #if defined.

Could you post that line for keymap.c?

Since this is based on cub-uanic's ErgoDox port of the TMK firmware, I'll reference his code from github. If you look at https://github.com/cub-uanic/tmk_keyboard/blob/cub_layout/keyboard/ergodox/keymap.c#L221, that is the start of cub-uanic's #if defined statement for his own layout that supports more than 32 FN actions. The #else that follows defines the default keymap_fn_to_action() function that has the 32 FN action limitation.

If you look at https://github.com/cub-uanic/tmk_keyboard/blob/cub_layout/keyboard/ergodox/keymap_cub.h#L558, this is the beginning of how he defines a separate set of FN actions for each layer. Here's his Layer 0 FN actions, his Layer 4 FN actions, his Layer 7 FN actions, and his Layer 9 FN actions.

In the other thread with my referenced code, I kept my modified version of cub-uanic's code in the keymap.h file, but commented out because that particular layout didn't need more than 32 FN actions. I don't actually run that layout; it was more of an example how to toggle capslock by hitting both shift keys at the same time.

Quote
I have another question regarding your CUSTOM_KEY solution.
Code: [Select]
    keyevent_t event = record->event;

    if (id == CUSTOM_KEY) {
        uint8_t layer = biton32(layer_state);
        uint8_t col = event.key.col;
        uint8_t row = event.key.row;
        uint8_t handled = 0;
Is it possible to record nkeys from the key event?

For example if I wanted to use shift + a to get @ instead of A.
(I could use shift to change the layer but than OS key combinations with shift would not work anymore)

A key event is always just one key that you've either pressed or released. So if you wanted to do something based on having more than one key pressed, you could adapt what I wrote for "2 shifts -> capslock". You just need to figure out when the 2 keys are pressed, and then "add_key(KEYCODE);\nsend_keyboard_report();" for the key press, and "del_key(KEYCODE);\nsend_keyboard_report();" for the key release. This is cub-uanic's custom action, which is a bit more straight forward.
Dvorak
ErgoDox fullhand (MX Clears) w/Nuclear Green Data SA || Infinity ErgoDox (Zealios 78g tactile) w/SA Retro || Atreus62 (MX Clears) w/Chocolatier || TECK 209 (MX Browns) || TouchStream ST
Kensington Slimblade Trackball || Logitech Cordless Optical Trackman || Apple Magic Trackpad
Current Dvorak-based ErgoDox layout || Current Dvorak-based TECK layout

Offline TheGlow

  • Posts: 48
Re: TMK keyboard firmware
« Reply #922 on: Fri, 02 October 2015, 11:40:23 »
I just tried compiling for the Frosty Flake v2 without any changes and I'm getting an error.
I don't have any coding background and just trying to get a hang of it as I have that odd error when using an Easy AVR USB Hex.
I just wanted to rule out hardware issue vs easy avr and figured a blank stock TMK should be a decent test and I can't seem to get this to go.

http://pastebin.com/xpiUHgtM
Here is the output.

To make sure I'm reading correctly, "warning"s would be the error stopping it? As it does seem to advance for a bit after the matrix.c shows some warnings.
Lufa.c is where it looks like it has a heart attack.

Edit: I noticed I was using the tmk_keyboard-master.zip bpiphany had posted, size was 29,096KB vs the one hosted here 29,043KB.
I tried this, same error just looks the warnings are 1 digit higher. *shrug*
http://pastebin.com/kn2vETe7
« Last Edit: Fri, 02 October 2015, 12:20:02 by TheGlow »

Offline flabbergast

  • Posts: 234
  • Location: UK
Re: TMK keyboard firmware
« Reply #923 on: Fri, 02 October 2015, 12:47:41 »
Hi - I just tried it (well - the current master branch from github) here (on OS X though), and it does compile. The warnings are there, mostly the same as yours - you can safely ignore them. The error is weird (the one reported on line 575), and to me it indicates that something's wrong with your avr-gcc installation. (I may be wrong though.) That constant, clock_div_1 is supposed to be defined in avr-libc; and also if you have a look at tmk_core/protocol/lufa/LUFA-git/LUFA/DoxygenPages/MigrationInformation.txt, it has a note in there about this.

If you're using WinAVR, that's really old. I would recommend either upgrading to a more recent avr-gcc, or (even better) do it in a virtual machine/linux.

More recent avr-gcc for windows: start with cygwin or msys, and then http://andybrown.me.uk/2015/03/08/avr-gcc-492/

Offline TheGlow

  • Posts: 48
Re: TMK keyboard firmware
« Reply #924 on: Fri, 02 October 2015, 13:33:03 »
Yea, using WinAVR which I learned is old the hard way.
It wiped my environment variables path.
Tried to ping something and got not recognized error and panicked for a second.

Also it didnt actually export a .hex file otherwise I would have flashed for science.

Ill try cygwin/msys, both downloading now,  and see whats up.
Thanx.

Edit: Cygwin was taking forever and nearing 5gb. msys was only 150mb.
I put in avr-gcc and was able to compile it. Should I be concerned it took about 3-4 minutes as opposed to WinAVR being seconds? Although it fails.
Easy AVR also does it in seconds.

Also I thought # would comment out a line. I tried editing the manufacturer line in config.h ,
"#define PRODUCT         CM Storm QFR-Deez Nuts"
Device manager shows, manu = Standard Keyboard
Description,
#define DESCRIPTION     t.m.k. keyboard firmware for CM Storm QFR,  show as HID Keyboard Device.

If I remove the #, then I get an error.
« Last Edit: Fri, 02 October 2015, 15:53:17 by TheGlow »

Offline nomaded

  • Posts: 197
  • Location: Andover, MA
Re: TMK keyboard firmware
« Reply #925 on: Sat, 03 October 2015, 02:50:06 »
Also I thought # would comment out a line. I tried editing the manufacturer line in config.h ,
"#define PRODUCT         CM Storm QFR-Deez Nuts"
Device manager shows, manu = Standard Keyboard
Description,
#define DESCRIPTION     t.m.k. keyboard firmware for CM Storm QFR,  show as HID Keyboard Device.

If I remove the #, then I get an error.

In C/C++, lines that start with # are not comments. Comments are bracketed with /* ... */, or start with // (for C++).

In this case, #define is defining a constant that can be referenced and used in other parts of the code.
Dvorak
ErgoDox fullhand (MX Clears) w/Nuclear Green Data SA || Infinity ErgoDox (Zealios 78g tactile) w/SA Retro || Atreus62 (MX Clears) w/Chocolatier || TECK 209 (MX Browns) || TouchStream ST
Kensington Slimblade Trackball || Logitech Cordless Optical Trackman || Apple Magic Trackpad
Current Dvorak-based ErgoDox layout || Current Dvorak-based TECK layout

Offline flabbergast

  • Posts: 234
  • Location: UK
Re: TMK keyboard firmware
« Reply #926 on: Sat, 03 October 2015, 02:53:48 »
Sizes: full cygwin is a beast, you don't need all that stuff; there should be a way to select a "base" installation, plus "development tools". But msys should be fine as well.

Times: it should definitely not take 3-4 minutes to compile, but something like 10 seconds on modern computers (and most of *that* time might be locating, reading and writing files ;)

Commenting: '#' in C does not mean a comment, but a special type of "command" (which is actually not a C command, it is processed by the C preprocessor). Commenting in C (plus plus) is done by 'double slash':
Code: [Select]
// this is a comment
or more traditionally by
Code: [Select]
/* this is a comment */

EDIT: yea, got owned again.

Offline RavenII

  • Posts: 191
Re: TMK keyboard firmware
« Reply #927 on: Sat, 03 October 2015, 19:12:07 »
I'm using http://www.enjoyclick.org/tkg/# to make a keymap for my KC60...it is my understanding that with TMK you can have the ESC key double as ~ when you hit shift....but the TMG tool doesn't supply that in his help. What would be the edit that I'd need to make to the keymap.c file afterwards?

Offline hasu

  • Thread Starter
  • Posts: 3471
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: TMK keyboard firmware
« Reply #928 on: Sat, 03 October 2015, 19:27:53 »
You may get help from him here. I don't know how his TKG works actually.
https://github.com/kairyu/tkg

BTW, ESC/~ is possible but not easy with TMK, you will have to write C code. I think you can find the code somewhere but I can't remember.

Offline VinnyCordeiro

  • Posts: 432
Re: TMK keyboard firmware
« Reply #929 on: Sat, 03 October 2015, 19:43:21 »
I'm using http://www.enjoyclick.org/tkg/# to make a keymap for my KC60...it is my understanding that with TMK you can have the ESC key double as ~ when you hit shift....but the TMG tool doesn't supply that in his help. What would be the edit that I'd need to make to the keymap.c file afterwards?

It is easier to do that with layers, instead of shift. That's what almost everyone do.

Offline njbair

  • Posts: 2825
  • Location: Cleveland, Ohio
  • I love the Powerglove. It's so bad.
    • nickbair.net
Re: TMK keyboard firmware
« Reply #930 on: Sat, 03 October 2015, 19:45:24 »
You may get help from him here. I don't know how his TKG works actually.
https://github.com/kairyu/tkg

BTW, ESC/~ is possible but not easy with TMK, you will have to write C code. I think you can find the code somewhere but I can't remember.

It's worth pointing out that Fn+Esc would be very easy to map to `/~, but since Shift is already a modifier it makes it hard to use it as a function/macro trigger.

Alpine Winter GB | My Personal TMK Firmware Repo
IBM Rubber Band "Floss" Mod | Click Modding Alps 101 | Flame-Polishing Cherry MX Stems
Review: hasu's USB to USB converter
My boards:
More
AEKII 60% | Alps64 HHKB | Ducky Shine 3, MX Blues | IBM Model M #1391401, Nov. 1990 | IBM SSK #1391472, Nov. 1987, screw modded, rubber-band modded | Noppoo EC108-Pro, 45g | Infinity 60% v2 Hacker, Matias Quiet Pros | Infinity 60% v2 Standard, MX Browns | Cherry G80-1800LPCEU-2, MX Blacks | Cherry G80-1813 (Dolch), MX Blues | Unicomp M-122, ANSI-modded | Unicomp M-122 (Unsaver mod in progress) | 2x Unitek K-258, White Alps | Apple boards (IIGS, AEKII) | Varmilo VA87MR, Gateron Blacks | Filco Zero TKL, Fukka White Alps | Planck, Gateron Browns | Monarch, click-modded Cream Alps

Offline RavenII

  • Posts: 191
Re: TMK keyboard firmware
« Reply #931 on: Sat, 03 October 2015, 23:18:52 »
One more thing, the Magic key combos...are they meant to print anything out in a text editor? I'm trying them, but don't see any output or anything....

Offline hasu

  • Thread Starter
  • Posts: 3471
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: TMK keyboard firmware
« Reply #932 on: Sat, 03 October 2015, 23:25:34 »

Offline RavenII

  • Posts: 191
Re: TMK keyboard firmware
« Reply #933 on: Sat, 03 October 2015, 23:26:41 »
Not with text editor. Check README and a FAQ entry.

https://github.com/tmk/tmk_keyboard/blob/master/README.md#debugging
https://github.com/tmk/tmk_keyboard/wiki/FAQ#debug-console

Gotcha, I thought this was for the bootmagic only, I didn't realize it applied to both, thanks hasu!

Offline p3lim

  • Posts: 106
  • Location: Norway
Re: TMK keyboard firmware
« Reply #934 on: Sun, 04 October 2015, 07:28:30 »
You may get help from him here. I don't know how his TKG works actually.
https://github.com/kairyu/tkg

BTW, ESC/~ is possible but not easy with TMK, you will have to write C code. I think you can find the code somewhere but I can't remember.

You may get help from him here. I don't know how his TKG works actually.
https://github.com/kairyu/tkg

BTW, ESC/~ is possible but not easy with TMK, you will have to write C code. I think you can find the code somewhere but I can't remember.

It's worth pointing out that Fn+Esc would be very easy to map to `/~, but since Shift is already a modifier it makes it hard to use it as a function/macro trigger.

Here's how I implemented my Escape+~/` key
https://github.com/p3lim/keyboard_firmware/commit/fd799c12b69a5ab5addd1d4c03380a1b8ef8e9dc

Offline torusJKL

  • Posts: 7
Re: TMK keyboard firmware
« Reply #935 on: Sun, 04 October 2015, 12:18:22 »
Is there a better way to get characters that are on the shift key?

I found the solution jack introduced with extended keymaps very nicely done.
https://github.com/jackhumbert/tmk_keyboard/commit/708f95a472327e25355b28899fbd13d89f6925f5
https://github.com/jackhumbert/tmk_keyboard/commit/5c45ba947c760cbb28e67d6eabb887fb56cdb170

As a end-user it make the usage of the shift key as easy as using S(KC_Q) and there is no need to use any of the 32 available actions.

Unfortunately I didn't manage to make it work with cub-uanic's ErgoDox port of the TMK firmware. :-(

Offline torusJKL

  • Posts: 7
Re: TMK keyboard firmware
« Reply #936 on: Sun, 04 October 2015, 13:36:22 »
Since this is based on cub-uanic's ErgoDox port of the TMK firmware, I'll reference his code from github. If you look at https://github.com/cub-uanic/tmk_keyboard/blob/cub_layout/keyboard/ergodox/keymap.c#L221, that is the start of cub-uanic's #if defined statement for his own layout that supports more than 32 FN actions. The #else that follows defines the default keymap_fn_to_action() function that has the 32 FN action limitation.

Thanks! That was the missing piece.
I got it to work with my layout.

Offline MrRooks

  • * Destiny Supporter
  • Posts: 209
  • Location: The burbs
  • Always be knolling
Re: TMK keyboard firmware
« Reply #937 on: Mon, 05 October 2015, 12:12:22 »
Hello, so this may be a waste of time but I figured I would ask. Maybe someone can point me in the right direction.

A user on here built the matrix files to support the Octagon 75% board on TMK. That's great but there is still one problem. Even though there are binds to turn each RGB LED on/off individually there is only full on or full off. While it would be nice to be able to fully control that he mentioned that the RGB LEDs aren't hooked up to PWM ports on the controller leaving software PWM or changing the voltage as options. Seeing as I don't care about cycling colors or anything can someone point me to the files I might need to tinker with in order to mess with the voltage(at my own risk of course)?

Any help is appreciated. Thanks!

Offline flabbergast

  • Posts: 234
  • Location: UK
Re: TMK keyboard firmware
« Reply #938 on: Mon, 05 October 2015, 12:32:21 »
There's no way to change the voltage to anything other than VCC (i.e. 5V) and ground (0V) on these AVRs (changing the output voltage would a digital-to-analog-converter (DAC)). The only way to regulate brightness is "software PWM". An example of that is actually in TMK itself, for "suspend LED breathing". Have a look at tmk_core/common/sleep_led.c.

Offline MrRooks

  • * Destiny Supporter
  • Posts: 209
  • Location: The burbs
  • Always be knolling
Re: TMK keyboard firmware
« Reply #939 on: Mon, 05 October 2015, 12:48:48 »
There's no way to change the voltage to anything other than VCC (i.e. 5V) and ground (0V) on these AVRs (changing the output voltage would a digital-to-analog-converter (DAC)). The only way to regulate brightness is "software PWM". An example of that is actually in TMK itself, for "suspend LED breathing". Have a look at tmk_core/common/sleep_led.c.

Thank you!

Offline TheGlow

  • Posts: 48
Re: TMK keyboard firmware
« Reply #940 on: Mon, 05 October 2015, 13:28:33 »
Sizes: full cygwin is a beast, you don't need all that stuff; there should be a way to select a "base" installation, plus "development tools". But msys should be fine as well.

Times: it should definitely not take 3-4 minutes to compile, but something like 10 seconds on modern computers (and most of *that* time might be locating, reading and writing files ;)

Commenting: '#' in C does not mean a comment, but a special type of "command" (which is actually not a C command, it is processed by the C preprocessor). Commenting in C (plus plus) is done by 'double slash':
Code: [Select]
// this is a comment
or more traditionally by
Code: [Select]
/* this is a comment */

EDIT: yea, got owned again.
Many thanks. I know enough to shamble my way through some things.
I'll try to compile again after a reboot perhaps. I don't have much running but I would expect an i7 with 16gb memory meet the recommended specs.
Just odd the others were faster and this msys clearly not same speed.
Rebooted, about 1 min, 3 seconds now. A bit better.

I've been on the bare build all day and its seeming pretty good. Just a few extra spaces on occasion but i think that just might be user error.

Edit: heres why I thought that. In the linked how to, he clearly states # is to comment out.
http://deskthority.net/workshop-f7/how-to-build-your-very-own-keyboard-firmware-t7177.html
« Last Edit: Mon, 05 October 2015, 14:48:22 by TheGlow »

Offline hasu

  • Thread Starter
  • Posts: 3471
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: TMK keyboard firmware
« Reply #941 on: Tue, 06 October 2015, 01:56:14 »
BTW, ESC/~ is possible but not easy with TMK, you will have to write C code. I think you can find the code somewhere but I can't remember.

I read FC660 and Poker manual and found the ESC/~ can be defined with ACTION_LAYER_MODS.

Code: [Select]
#include "keymap_common.h"


/* Leopold FC660
 * https://elitekeyboards.com/products.php?sub=leopold,compact&pid=fc660c
 * Shift + Esc = ~
 * Fn    + Esc = `
 *
 * Votex Poker II
 * https://adprice.fedorapeople.org/poker2_manual.pdf
 * Fn         + Esc = `
 * Fn + Shift + Esc = ~
 */
const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
    /* 0: qwerty */
    [0] = KEYMAP( \
        ESC, 1,   2,   3,   4,   5,   6,   7,   8,   9,   0,   MINS,EQL, NUHS,BSPC, \
        TAB, Q,   W,   E,   R,   T,   Y,   U,   I,   O,   P,   LBRC,RBRC,BSLS, \
        LCTL,A,   S,   D,   F,   G,   H,   J,   K,   L,   SCLN,QUOT,ENT,  \
        FN0, NUBS,Z,   X,   C,   V,   B,   N,   M,   COMM,DOT, SLSH,RSFT,ESC, \
        LCTL,LGUI,LALT,          SPC,                     RALT,FN1, RGUI,RCTL),
    [1] = KEYMAP( \
        GRV, TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, \
        TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,\
        TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, \
        TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, \
        TRNS,TRNS,TRNS,          TRNS,                    TRNS,TRNS,TRNS,TRNS),
    [2] = KEYMAP( \
        GRV, F1,  F2,  F3,  F4,  F5,  F6,  F7,  F8,  F9,  F10, F11, F12, TRNS,TRNS, \
        TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,\
        TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, \
        TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, \
        TRNS,TRNS,TRNS,          TRNS,                    TRNS,TRNS,TRNS,TRNS),
};

const uint16_t PROGMEM fn_actions[] = {
    // https://github.com/tmk/tmk_keyboard/blob/master/doc/keymap.md#35-momentary-switching-with-modifiers
    [0] = ACTION_LAYER_MODS(1, MOD_LSFT),
    [1] = ACTION_LAYER_MOMENTARY(2),
};


https://github.com/tmk/tmk_keyboard/wiki/FAQ-Keymap#esc-and--on-a-key

Offline hasu

  • Thread Starter
  • Posts: 3471
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: TMK keyboard firmware
« Reply #942 on: Tue, 06 October 2015, 02:09:21 »
Is there a better way to get characters that are on the shift key?

I found the solution jack introduced with extended keymaps very nicely done.
https://github.com/jackhumbert/tmk_keyboard/commit/708f95a472327e25355b28899fbd13d89f6925f5
https://github.com/jackhumbert/tmk_keyboard/commit/5c45ba947c760cbb28e67d6eabb887fb56cdb170

As a end-user it make the usage of the shift key as easy as using S(KC_Q) and there is no need to use any of the 32 available actions.

Unfortunately I didn't manage to make it work with cub-uanic's ErgoDox port of the TMK firmware. :-(

I wrote some code for keymapping with 16bit codes, with this remove 32 FN limitation and you can define user defined action like S(Q) above.

https://github.com/tmk/tmk_keyboard/pull/251

This is a mapping example where s() modifies a key with Shift.
https://github.com/tmk/tmk_keyboard/blob/actionmap/keyboard/alps64/actionmap_hasu.c#L144
Code: [Select]
    /* 40% */
    [5] = ACTIONMAP_AEK( \
        TRNS,1,   2,   3,   4,   5,   6,   7,   8,   9,   0,   TRNS,TRNS,TRNS, \
        TRNS,s(1),s(2),s(3),s(4),s(5),s(6),s(7),s(8),s(9),s(0),TRNS,TRNS,TRNS, \
        TRNS,1,   2,   3,   4,   5,   6,   7,   8,   9,   0,   TRNS,TRNS, \
        TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, \
        TRNS,TRNS,TRNS,          TRNS,                         TRNS,TRNS,TRNS),

s() is defined in common/actionmap.h but you can define your actions in your own keymap file.
https://github.com/tmk/tmk_keyboard/blob/actionmap/tmk_core/common/actionmap.h#L32-L35
Code: [Select]
/* Modified key */
#define AC_c(kc)                ACTION_MODS_KEY(MOD_LCTL, KC_##kc)
#define AC_s(kc)                ACTION_MODS_KEY(MOD_LSFT, KC_##kc)
#define AC_a(kc)                ACTION_MODS_KEY(MOD_LALT, KC_##kc)
#define AC_g(kc)                ACTION_MODS_KEY(MOD_LSFT, KC_##kc)
« Last Edit: Tue, 06 October 2015, 14:14:09 by hasu »

Offline RavenII

  • Posts: 191
Re: TMK keyboard firmware
« Reply #943 on: Tue, 06 October 2015, 12:35:37 »
Where I would find how to make shift when held, up arrow when tapped?

Offline hasu

  • Thread Starter
  • Posts: 3471
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: TMK keyboard firmware
« Reply #944 on: Tue, 06 October 2015, 12:40:29 »
See this.

https://github.com/tmk/tmk_keyboard/blob/master/doc/keymap.md#213-modifier-with-tap-keydual-role

EDIT: Added FAQ entry: Arrow on Right Modifier keys with Dual-Role
https://github.com/tmk/tmk_keyboard/wiki/FAQ-Keymap#arrow-on-right-modifier-keys-with-dual-role

Code: [Select]
#include "keymap_common.h"


/* Arrow keys on right modifier keys with TMK dual role feature
 *
 *  https://github.com/tmk/tmk_keyboard/blob/master/doc/keymap.md#213-modifier-with-tap-keydual-role
 *  https://en.wikipedia.org/wiki/Modifier_key#Dual-role_keys
 */
const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
    /* 0: qwerty */
    [0] = KEYMAP( \
        ESC, 1,   2,   3,   4,   5,   6,   7,   8,   9,   0,   MINS,EQL, NUHS,BSPC, \
        TAB, Q,   W,   E,   R,   T,   Y,   U,   I,   O,   P,   LBRC,RBRC,BSLS, \
        LCTL,A,   S,   D,   F,   G,   H,   J,   K,   L,   SCLN,QUOT,ENT,  \
        LSFT,NUBS,Z,   X,   C,   V,   B,   N,   M,   COMM,DOT, SLSH,FN0, ESC, \
        FN4, LGUI,LALT,          SPC,                     APP, FN2, FN1, FN3),
    [1] = KEYMAP( \
        GRV, F1,  F2,  F3,  F4,  F5,  F6,  F7,  F8,  F9,  F10, F11, F12, TRNS,TRNS, \
        TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,\
        TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, \
        TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,FN5, TRNS, \
        TRNS,TRNS,TRNS,          TRNS,                    TRNS,FN7, FN6, FN8),
};

const uint16_t PROGMEM fn_actions[] = {
    [0] = ACTION_MODS_TAP_KEY(MOD_RSFT, KC_UP),
    [1] = ACTION_MODS_TAP_KEY(MOD_RGUI, KC_DOWN),
    [2] = ACTION_MODS_TAP_KEY(MOD_RALT, KC_LEFT),
    [3] = ACTION_MODS_TAP_KEY(MOD_RCTL, KC_RIGHT),
    [4] = ACTION_LAYER_MOMENTARY(1),
    [5] = ACTION_MODS_TAP_KEY(MOD_RSFT, KC_PGUP),
    [6] = ACTION_MODS_TAP_KEY(MOD_RGUI, KC_PGDN),
    [7] = ACTION_MODS_TAP_KEY(MOD_RALT, KC_HOME),
    [8] = ACTION_MODS_TAP_KEY(MOD_RCTL, KC_END),
};
« Last Edit: Tue, 06 October 2015, 14:12:09 by hasu »

Offline RavenII

  • Posts: 191
Re: TMK keyboard firmware
« Reply #945 on: Tue, 06 October 2015, 13:57:39 »
See this.

https://github.com/tmk/tmk_keyboard/blob/master/doc/keymap.md#213-modifier-with-tap-keydual-role

Dude....I....I love you. I love all you guys that do all this stuff with the firmware....amazing. Amazing work. You and Metalliqaz...

Offline TheGlow

  • Posts: 48
Re: TMK keyboard firmware
« Reply #946 on: Tue, 06 October 2015, 14:54:50 »
Thank you gentlemen! I have compiled it successfully and appears to be doing what I at least wanted it to originally.
I just had some questions. So far to enter bootmode is lshift+rshift+pause. Where would I change that as I didnt see that anywhere.
Config.h had "#define IS_COMMAND() ( \
    keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) \"
But no mention of pause.

Some questions from the makefile.lufa,
How does the command menu work?  I dont have it commented out but not sure where I'd bind this to activate. I assume similar to Metalliqaz' where I run in a notepad and follow allong.
Also Mouse keys(+4700), what does the 4700 signify? If there a way to speed up how long the cursor picks up speed and max speed?

How do I work with LEDs? The quickfire-r has the one F9/WinLock LED stuck on. Was wondering how to disable outright and/or have it come on with a specific layer only.

Lastly, how difficult is it to make a macro for something like filling out forms? like type location, tabx5, enter a name, tabx8, etc.

Offline hasu

  • Thread Starter
  • Posts: 3471
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: TMK keyboard firmware
« Reply #947 on: Tue, 06 October 2015, 15:31:42 »
As for the command see tmk_core/common/command.c. Or you can use KC_BTLD or KC_BOOTLOADER in keymap.
To start bootloader there are two methods: magic command(Pause) and the BOOTLOADER in keymap.
EDIT: ah, three. third mothod is boot magic command(B).

Use hid_listen to see output from commands and debug prints.

It is just my memo, but it means that the option increases around 4700 bytes in firmware, iirc.

Tune tmk_core/common/mousekey.c to change parameter.

Write code yourself to control your LED.
« Last Edit: Tue, 06 October 2015, 15:36:04 by hasu »

Offline TheGlow

  • Posts: 48
Re: TMK keyboard firmware
« Reply #948 on: Thu, 08 October 2015, 07:59:07 »
Thank you sir.
Forgive me again as I don't know anything about programming really but the command.c looks like it has that area about Mousekey console.
This isn't configured similar to metalliqaz' where it will print to a text file and you interact with it on the fly?
I see i could use both shifts for magic and pause will give bootloader and 0,1,2,3 changed my default layer but others like caps for Lock_enable, v=version  didnt do anything I could see.


Offline hasu

  • Thread Starter
  • Posts: 3471
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: TMK keyboard firmware
« Reply #949 on: Thu, 08 October 2015, 09:03:09 »
Ah, I didn't remember that. You can change mouse key parameter using it hopefully.

As I said, use 'hid_listen' tool to see output from magic command. Not text editor.
The Lock command is disabled by default.