TMK keyboard firmware collection

User avatar
snacksthecat
✶✶✶✶

05 Jun 2019, 22:10

Unfortunately disabling bootmagic didn't work. I'll keep playing around with different things.

The pcb is an Alps plate spring pcb that I designed (using your kicad libraries btw). It's really not at all comparable to GH60. I just used that project as a starting point.

User avatar
hasu

05 Jun 2019, 23:00

Ah, then post schematic of your pcb so that we can check your matrix scan code.

And, what is your exact MCU part number or source?
Did you fiddle with MCU fuse setting with ISP programmer, perhaps?

User avatar
Muirium
µ

27 Sep 2019, 19:00

So, I've had a Caps Lock macro on my shoulder today. Having gotten it working again on Xwhatsit earlier, I decided to give my HHKB a go. Sure, Fn + Tab = Caps Lock, I know, but I really like Shift + Shift = Caps Lock the best. I hadn't tried this sooner because I don't really understand macros in TMK, and I also know Hasu uses Shift + Shift as the magic key combo for entering bootloader mode etc. But, hey, I've always got that reset button on the back! So here's my attempt today in Unimap.

Screenshot 2019-09-27 at 5.51.38 pm.png
Screenshot 2019-09-27 at 5.51.38 pm.png (281.74 KiB) Viewed 3185 times

I'm using the same trick Hasu showed me for my Command + Esc = Command + Tilde "macro". Namely: borrow another layer. In layer 5, both shifts are remapped to Caps Lock, like I did on my Kishsaver and AT in Xwhatsit's GUI. No timed macro cunningness here, but it works anyway. Well, with one downside.

To enter the HHKB's bootloader, you can either pull off the DIP switch port cover and press the red reset button, *or* press Shift + Shift + Fn + P (namely Shift + Shift + Pause/Break) to do it entirely on the keyboard. This trick has lost me that capability. I tried mapping P to Pause/Break in Layer 5 but that doesn't trigger it, and loses me the rather more useful ability to type capital P while holding Shift!

I wonder, is there a better way to achieve this? I don't want to have to mess in code, and all too likely break compatibility with Unimap. But I do like playing with my HHKB's Hasu-powered programmability often enough that the Magic key combo is plenty handy in its own right.

User avatar
Muirium
µ

27 Sep 2019, 19:18

Oh, actually, I think I've got it! Check this out:

Screenshot 2019-09-27 at 6.10.42 pm.png
Screenshot 2019-09-27 at 6.10.42 pm.png (286.9 KiB) Viewed 3177 times

I realised the problem I made for myself was I'd disabled Hasu's "Magic key" by swapping it out to Caps Lock. But! The only time I use his Magic key is when I'm pressing Pause/Break to enter the bootloader. And! Break is on Layer 1. So how about I just made sure those two Shifts were real Shift keys on Layer 1?

See, I read enough of TMK's documentation to know how "transparent" keys work. Any given layer overwrites the one below. My special layer shifting (and Shift destroying) Shift keys are down on Layer 0. If I overwrite them with normal Shifts up on Layer 1, all subsequent layers inherit those, until Layer 5, which is where Caps Lock looms, far away until it's called for.

So, as long as I press Fn + Shift + Shift + P in that order, Fn first!, I can enter the bootloader all posh style, without having to pull the DIP switch cover off. Very nice! Got to love this programmability. Powerful enough you can make yourself new problems and fix those too!

John Doe

06 Feb 2020, 08:15

Hi, guys, need your help here.

When I tried to compile for .hex file from the source code for a vintage kbd, error info was showed like this:

Code: Select all

In file included from keymap_mario.c:1:
keymap_common.h:50:37: error: 'KC_12' undeclared here (not in a function); did you mean 'KC_F12'?
   50 |     { KC_NO,    KC_##K11, KC_##K12, KC_##K13, KC_##K14, KC_##K15, KC_##K16, KC_##K17 }, \
      |                                     ^~~
keymap_common.h:79:3: note: in expansion of macro 'KEYMAP'
   79 | ) KEYMAP( \
      |   ^~~~~~
keymap_mario.c:23:5: note: in expansion of macro 'KEYMAP_N'
   23 |     KEYMAP_N( \
      |     ^~~~~~~~


And keymap_common.h file was defined like this:

Code: Select all

#ifndef KEYMAP_COMMON_H
#define KEYMAP_COMMON_H

#include <stdint.h>
#include <stdbool.h>
#include "keycode.h"
#include "action.h"
#include "action_macro.h"
#include "report.h"
#include "host.h"
#include "print.h"
#include "debug.h"
#include "keymap.h"


#define KEYMAP( \
    K00, K01, K02, K03, K04, K05, K06, K07, \
    K08, K09, K0A, K0B, K0C, K0D, K0E, K0F, \
         K11, K12, K13, K14, K15, K16, K17, \
    K18, K19, K1A, K1B, K1C, K1D, K1E, K1F, \
    K20, K21, K22, K23, K24, K25, K26, K27, \
    K28, K29, K2A, K2B, K2C, K2D, K2E, K2F, \
    K30,                          K36, K37, \
    K38, K39, K3A, K3B, K3C, K3D, K3E, K3F, \
    K40, K41, K42, K43, K44, K45, K46, K47, \
    K48, K49, K4A, K4B, K4C, K4D, K4E, K4F, \
    K60, K61, K62, K63, K64, K65, K66, K67, \
    K68, K69, K6A, K6B, K6C, K6D, K6E, K6F, \
    K70, K71, K72, K73, K74, K75, K76, K77, \
    K78, K79, K7A, K7B,           K7E, K7F  \
) { \
    { KC_##K00, KC_##K01, KC_##K02, KC_##K03, KC_##K04, KC_##K05, KC_##K06, KC_##K07 }, \
    { KC_##K08, KC_##K09, KC_##K0A, KC_##K0B, KC_##K0C, KC_##K0D, KC_##K0E, KC_##K0F }, \
    { KC_NO,    KC_##K11, KC_##K12, KC_##K13, KC_##K14, KC_##K15, KC_##K16, KC_##K17 }, \
    { KC_##K18, KC_##K19, KC_##K1A, KC_##K1B, KC_##K1C, KC_##K1D, KC_##K1E, KC_##K1F }, \
    { KC_##K20, KC_##K21, KC_##K22, KC_##K23, KC_##K24, KC_##K25, KC_##K26, KC_##K27 }, \
    { KC_##K28, KC_##K29, KC_##K2A, KC_##K2B, KC_##K2C, KC_##K2D, KC_##K2E, KC_##K2F }, \
    { KC_##K30, KC_NO,    KC_NO,    KC_NO,    KC_NO,    KC_NO,    KC_##K36, KC_##K37 }, \
    { KC_##K38, KC_##K39, KC_##K3A, KC_##K3B, KC_##K3C, KC_##K3D, KC_##K3E, KC_##K3F }, \
    { KC_##K40, KC_##K41, KC_##K42, KC_##K43, KC_##K44, KC_##K45, KC_##K46, KC_##K47 }, \
    { KC_##K48, KC_##K49, KC_##K4A, KC_##K4B, KC_##K4C, KC_##K4D, KC_##K4E, KC_##K4F }, \
    { KC_##K60, KC_##K61, KC_##K62, KC_##K63, KC_##K64, KC_##K65, KC_##K66, KC_##K67 }, \
    { KC_##K68, KC_##K69, KC_##K6A, KC_##K6B, KC_##K6C, KC_##K6D, KC_##K6E, KC_##K6F }, \
    { KC_##K70, KC_##K71, KC_##K72, KC_##K73, KC_##K74, KC_##K75, KC_##K76, KC_##K77 }, \
    { KC_##K78, KC_##K79, KC_##K7A, KC_##K7B, KC_NO,    KC_NO,    KC_##K7E, KC_##K7F }  \
}

#define KEYMAP_N( \
    K00, K01, K02, K03, K04, K05, K06, K07, \
    K08, K09, K0A, K0B, K0C, K0D, K0E, K0F, \
         K11, K12, K13,      K15, K16, K17, \
    K18, K19, K1A, K1B, K1C, K1D, K1E, K1F, \
    K20, K21, K22, K23, K24, K25, K26, K27, \
    K28, K29, K2A, K2B, K2C, K2D, K2E, K2F, \
    K30,                          K36, K37, \
    K38, K39, K3A, K3B, K3C, K3D, K3E, K3F, \
    K40, K41, K42, K43, K44, K45, K46, K47, \
    K48, K49, K4A, K4B, K4C, K4D, K4E, K4F, \
    K60, K61, K62, K63, K64, K65, K66, K67, \
    K68, K69, K6A, K6B, K6C, K6D, K6E, K6F, \
    K70, K71, K72, K73, K74, K75, K76, K77, \
    K78, K79, K7A, K7B,           K7E, K7F  \
) KEYMAP( \
    K00, K01, K02, K03, K04, K05, K06, K07, \
    K08, K09, K0A, K0B, K0C, K0D, K0E, K0F, \
         K11, K12, K13, NO,  K15, K16, K17, \
    K18, K19, K1A, K1B, K1C, K1D, K1E, K1F, \
    K20, K21, K22, K23, K24, K25, K26, K27, \
    K28, K29, K2A, K2B, K2C, K2D, K2E, K2F, \
    K30,                          K36, K37, \
    K38, K39, K3A, K3B, K3C, K3D, K3E, K3F, \
    K40, K41, K42, K43, K44, K45, K46, K47, \
    K48, K49, K4A, K4B, K4C, K4D, K4E, K4F, \
    K60, K61, K62, K63, K64, K65, K66, K67, \
    K68, K69, K6A, K6B, K6C, K6D, K6E, K6F, \
    K70, K71, K72, K73, K74, K75, K76, K77, \
    K78, K79, K7A, K7B,           K7E, K7F  \
)

#endif


The keymap_mario.c file was here, and the specific keys will be changed then if compiling without error, just for test now.

Code: Select all

#include "keymap_common.h"

const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
    KEYMAP_N( \
        1,   1,  1,  1,  1,  1,  1,  1,   \
        9,   2,  3,  4,  5,  6,  7,  8,   \
             1,  9,  12,     1,  1,  1,   \
        8,   1,  2,  3,  4,  5,  6,  7,    \
        1,   9,  0,  1,  1,  1,  1,  1,   \
        1,   1,  1,  2,  3,  1,  1,  1,  \
        1,                       1,  1,   \
        I,   Q,  W,  E,  R,  T,  Y,  U,   \
        1,   O,  P,  1,  1,  1,  2,   2,   \
        K,   A,  S,  D,  F,  G,  H,  J,     \
        3,   L,  2,  3,  3,  2,  1,   1,  \
        1,   7,  4,  5,  6,  1,  1,   1,  \
        2,   Z,  X,  C,  V,  B,  N,  M,     \
        1,   2,  1,  2,          2,   3 \
)const action_t PROGMEM fn_actions[] = {};



Using Macos Catalina10.15.2 system environment, Xcode for coding, maybe no business with the error tho.

THANKS in advance.
Last edited by John Doe on 09 Feb 2020, 07:21, edited 3 times in total.

John Doe

06 Feb 2020, 08:55

Oh, I made a big mistake for the keymap_mario.c. No way for the row 3 and col 4 with a 12.
Can't believe my stupidness.
Solved now.

Edit:
another problem appeared:
When flashing the .hex file to the teensy2.0 with teensy loader, it seems failed. Then I tried original blink_fast_Teensy2.hex as a test, no issue appeared and the LED start blinking normally. Then I flashed soarer's hex file lot of times, some of them flashed successfully but more failed. I guess a possible reason may has connection with the .hex size (blink_fast_Teensy2.hex 7kb, soarer.hex 40, and my .hex file 62kb, all under MacOS)? Or what other potential causes?

Any help will be appreciated.

John Doe

06 Feb 2020, 14:57

Need to throw more money to get teensy2.0++ as more test?

John Doe

11 Feb 2020, 10:38

Sorry for fuss, I got a teensy2.0++ and make it worked finally. But a new phenomenon appeared, thats when I press ctrl + alphabet characteristic, like I press a-z while holding the alt key, it shows like this:

Code: Select all

å∫ç∂´ƒ©˙ˆ∆˚¬µ˜øπœ®ß†¨√∑≈¥Ω
still MacOS system, anybody could give a help? Thanks.

Findecanor

11 Feb 2020, 11:29

Isn't that what is supposed to happen on Mac when you hold Alt/Option and press an alphabetic key?

John Doe

11 Feb 2020, 11:47

Findecanor wrote:
11 Feb 2020, 11:29
Isn't that what is supposed to happen on Mac when you hold Alt/Option and press an alphabetic key?
Sorry, I just change to MacOS from windows for few days, not familiar with it yet. Is there a way to switch them to like alt+a = select all status?Thanks.

John Doe

17 Mar 2020, 11:39

hey, guys, confused about features of tmk, so better post it here.

I have had experience in using tmk to make 3rd-party controllers for vintage keyboards, and begin to realize a question, emm, or perhaps couldn't be called question at all. It's like I have to wire the pins of the board, like teensy, to every col&row of the matrix respectively, which means there'll have to be lots of leads. Further, keyboard PCB normally has 1/2/3 decoders to reduce wires connected with original controller, replacement of teensy controllers ignored them sadly. So what i concerned is if there're ways/features in the whole project to reuse the original decoders as much as possible and reduce the leads just like the original controller does?

Soarer's firmware uses muxstrobe to achieve it, so maybe it's good trick to grab it in the open source project.

User avatar
hasu

18 Mar 2020, 06:50

You can use the decorders of course, it would be easy to write code to use them if you can track traces of the pcb and find datasheet of the decorders.

But I can't say about how to implement universal feature supports various decorders used on every keyobard but it would be certainly helpful to other users if you can work on this instead of write code just for your specific decoders. I can help you.

User avatar
Muirium
µ

09 May 2020, 18:48

Now I know macros are a thing in TMK, if you build from source. But, anyone got a crafty idea how to do them using Unimap alone? I’m not talking about the general case, but rather specifically: typing grave accented vowels using the Control key on the Mac and iPad. I’m after this:

Control + E >> Alt + backtick, then E = è
Shift + Control + E >> Alt + backtick, then Shift + E = È

(I might use some other trigger besides bare Control, on the off chance I wind up needing it in Terminal. But that’s the pattern I’m looking for, for grave accent vowels.)

Kbdfr may be smirking, but I’m looking for a little mòr on the vowel front from my HHKB. Just grave accents, as they’re for Gaelic, which uses them plentifully and exclusively: no other accents, just strac gu mòr. The dead key dance is a little tedious when you need it more than once or twice a line.

John Doe

25 May 2021, 17:20

Heya, hasu and guys. Have to ask for help here.

I wanna to add one P00 key on my pingmaster so that I expect to get result like: I press the key, then output double 0, easy, right?
But when I really tried this, it outputs nothing. I dont know if my understanding of the P00 key is wrong or somewhere I set up incorrectly.

Any help will be appreciated, thanks lot.
keymap_p00.png
keymap_p00.png (48.33 KiB) Viewed 536 times

User avatar
hasu

25 May 2021, 17:38

what is OS you are using? Did you try other OS if you have any?
And firstly you want to check if the OS supports the 'KP_00' key(USB HID usage 0xB0, or 176 in decimal).


And debug log on 'hid_listen' would be helpful in most cases.
Press both shifts and K to see keyboard report the converter sends to system.

https://github.com/tmk/tmk_keyboard/wiki#debug

User avatar
raoulduke-esq

25 May 2021, 18:00

I had to implement a macro in code to get 000 on mine because macOS does not do 000 natively.

John Doe

25 May 2021, 18:38

thanks, guys.

I tried win64 ultimate, Ubuntu16 and macos catalina(10.15.6), nothing happened. I tried to set the key to A and it did output A so the pcb is okay.

And the hid_listen reported this, could help?
(UX9BC$YOQV}4`G`SEX25EC.png
(UX9BC$YOQV}4`G`SEX25EC.png (15.14 KiB) Viewed 505 times

User avatar
hasu

25 May 2021, 19:21

I checked source code and confirmed that these key codes(0xB0-DD) including KP_00 and KP_000 are not supported at this time.
https://github.com/tmk/tmk_keyboard/blo ... #L357-L402

You can't send the KP_00 with current firmware in the end. I may change this in future release but not sure.

I think KP_00 is not supported and not useful on Windows probably. My Ubuntu setup recognizes the key itself but doesn't register any character by default.

With this patch you can send the key to test if you can build firmware yourself.

Code: Select all

diff --git a/tmk_core/common/keycode.h b/tmk_core/common/keycode.h
index 7ed711a4..e5773ac4 100644
--- a/tmk_core/common/keycode.h
+++ b/tmk_core/common/keycode.h
@@ -27,6 +27,7 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 #define IS_ANY(code)             (KC_A         <= (code) && (code) <= 0xFF)
 
 // Use original HID usages on B0-DD instead of TMK specific codes
+#define USE_ORIGINAL_HID_USAGE
 #ifndef USE_ORIGINAL_HID_USAGE
 #define IS_KEY(code)             (KC_A         <= (code) && (code) <= KC_EXSEL)
 #else

John Doe

26 May 2021, 06:56

thanks, hasu. You helped alot, I'll check how it'll go.

John Doe

10 Jun 2021, 13:27

Hey, me again.

I have added the P00 thru using the Macro feature.

Code: Select all

const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
{
    switch (id) {
        case P00:
            return (record->event.pressed ?
                    MACRO(T(P0), T(P0), END ) :
                    MACRO_NONE );
    }
    return MACRO_NONE;
}
But now I face another question: my expectation is the key could output consistently when holding the key and stop that until key released. But seems the key of current setting is it only output once when you press the key down without releasing, and output again until you press again.
Within each macro, the following commands can be used:

I() change interval of stroke.
D() press key
U() release key
T() type key(press and release)
W() wait
SM() store modifier state
RM() restore modifier state
CM() clear modifier state
I didn't find other functions that could help yet, did I miss sth or it's just how the macro keys work? Noticed in the Key Action section at least some modifiers could be "hold" like I mentioned above. So I'm a little bit confused.

Thanks in advance. :)

User avatar
hasu

11 Jun 2021, 02:57

You can't run a MACRO repeatedly in current implementation at least.

This will be what you can do for similar behaviour.

Code: Select all

            return (record->event.pressed ?
                    MACRO(T(P0), D(P0), END ) :
                    MACRO(U(P0), END));

John Doe

11 Jun 2021, 06:18

hasu wrote:
11 Jun 2021, 02:57
You can't run a MACRO repeatedly in current implementation at least.

This will be what you can do for similar behaviour.

Code: Select all

            return (record->event.pressed ?
                    MACRO(T(P0), D(P0), END ) :
                    MACRO(U(P0), END));
I have replaced code block with this one, not exact what I want but pretty enough. Appreciated alot Hasu.

Post Reply

Return to “Workshop”