TMK keyboard firmware collection

User avatar
hasu

16 Nov 2016, 01:30

yes, write code to meet your need.

User avatar
kekstee

25 Nov 2016, 10:46

I did improve the LED support a bit for myself, but I'm wondering if there is a decent way to detect wether the computer is powered down or not.

My first guess was adding hooks to common/avr/suspend.c, which has some problems in its current state:
  • switching backlight and layer LEDs off on suspend does not always work when I suspend my OS
  • it won't work if I shut down the machine
Is there a better place to perform this or what kind of problem am I looking at here?

User avatar
Phenix
-p

08 Mar 2017, 20:47

can someone please share an F122 keymap? I am atm really stuck in connecting mine (Soarer converter is no option, as I use an usb hubm which doesnt work out at all)

User avatar
Phenix
-p

08 Mar 2017, 21:29

I missed to add: pin-mapping is still with Soarers, atm looking into changing pins in the makefile(not successfull so far)

User avatar
hasu

31 May 2017, 03:51

Now fixed Modifier/Layer key stuck problem finally.
https://github.com/tmk/tmk_keyboard/tre ... e#20170530

See this wiki entry. https://github.com/tmk/tmk_keyboard/wik ... ayer-stuck If you need old keymap behaviour for some reason define NO_TRACK_KEY_PRESS in your config.h. This is virtually equivalent to QMK's PREVENT_STUCK_MODIFIERS. https://github.com/qmk/qmk_firmware/pull/182

With this fix the biggest limitaiotn of TMK keymap were removed. Modifier and layer switch keys cannot be stuck virtually even if you want to have very strange keymap :D You have to compile to get this fix worked, keymap editor is not updated yet.

Report if you have any problem with this fix.

User avatar
Mr.Bean

03 Jun 2017, 17:48

Is there a way to toggle layers like ACTION_LAYER_TAP_KEY?

Let's say my F1 toggles layer 1 after 3x taps, but on single tap it acts as normal key.

Basically ACTION_LAYER_TAP_TOGGLE(1, KC_F1) with second parameter.
Last edited by Mr.Bean on 03 Jun 2017, 22:00, edited 2 times in total.

User avatar
hasu

03 Jun 2017, 20:33

No. You have to write your own code in action_function in your keymap.

You can find code of the action you refer 'ACTION_LAYER_TAP_TOGGLE' with searching action_code.h and action.c.
https://github.com/tmk/tmk_keyboard/blo ... ode.h#L277
https://github.com/tmk/tmk_keyboard/blo ... #L264-L275


You code would look like this. I'm not sure it is useful to toggle a layer after restering three F1 though.

Code: Select all

void action_function(keyrecord_t *record, uint8_t id, uint8_t opt)
{
    switch (id) {
        case F1_TOGGLE:
            /* tap toggle */
            if (event.pressed) {
                if (tap_count < 3) {
                    register_code(KC_F1);
                }  
            } else {
                if (tap_count < 3) {
                    unregister_code(KC_F1);
                }
                if (tap_count <= 3) {
                    layer_invert(1);
                }  
            }
            break;
    }
}

User avatar
Mr.Bean

04 Jun 2017, 00:59

Thanks, I will look in to it.

Zarugal

28 Aug 2017, 21:27


User avatar
hasu

28 Aug 2017, 23:05

Zarugal wrote: I'm working on a handwired build and I am currently trying to define the keymap. I have 17 columns and therefore am over the scope of hexadecimal, so how do I define the 17th Column? If I use K10/K11 I overrun the column into the next row.

Here's a demonstration of the conflict below in case I am unclear.

Code: Select all

K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0a, K0b, K0c, K0d, K0e, K0f, K??
K10, K11, K12
K20, K21
If I use K10 on the top row, my second row will no longer work, so what do I use?
Use K1G :D

Zarugal

28 Aug 2017, 23:09

Thanks for the help! But would it be K0G on the top row, and then K1G underneath it on the second?

User avatar
hasu

28 Aug 2017, 23:31

Zarugal wrote: Thanks for the help! But would it be K0G on the top row, and then K1G underneath it on the second?
ah, youre rite.

Zarugal

30 Aug 2017, 14:14

Ah cool, just wanted to check! Thank you!

SpacemanToby

28 Sep 2017, 20:46

Hey Hasu,

I'm using your code and a teensy 2.0 to convert an electric typewriter into a keyboard (posted about it here keyboards-f2/converting-an-old-typewrit ... 17317.html). Anyway, I have an issue where it appears to work just fine on my macbook pro at home, but as soon as I try use it on my windows machine at work, keys just fire over and over again. It's usually the same column over and over, but sometime I can make it type other random keys. Anyway, I guess I'm just looking for some guidance on if this sounds like a hardware or a software issue. I've spent most of my debugging efforts on hardware (soldering, resoldering, insulating, etc...). Any insight into what the issue might be is appreciated.

User avatar
hasu

29 Sep 2017, 02:52

SpacemanToby wrote: Hey Hasu,

I'm using your code and a teensy 2.0 to convert an electric typewriter into a keyboard (posted about it here keyboards-f2/converting-an-old-typewrit ... 17317.html). Anyway, I have an issue where it appears to work just fine on my macbook pro at home, but as soon as I try use it on my windows machine at work, keys just fire over and over again. It's usually the same column over and over, but sometime I can make it type other random keys. Anyway, I guess I'm just looking for some guidance on if this sounds like a hardware or a software issue. I've spent most of my debugging efforts on hardware (soldering, resoldering, insulating, etc...). Any insight into what the issue might be is appreciated.
It souds problem is likely to be hardware rather than firmware or OS. I guess you changed something on its wiring during commuting. Bring your macbook to office and try both side by side.

SpacemanToby

29 Sep 2017, 04:34

Unfortunately, I've tried both right next to each other. I'm actually typing this response using the keyboard on a different laptop I have running windows 10. That's ok, I guess this will just be a non work keyboard. Maybe my next one will work better. Thanks for the awesome firmware code.

SpacemanToby

03 Oct 2017, 03:10

I've done a little more debugging. It mostly prints the same column over and over again, 7yhb. I started desoldering that column, even desoldered the row on the seven key, but it still prints those keys, even ones with no wires attached at all. I'm not sure what would cause this.

User avatar
hasu

04 Oct 2017, 02:43

then, try removing wire from mcu pin of the column next. If it still fires the '7yhb' you should check your codes.

SpacemanToby

04 Oct 2017, 04:35

I just wired that column to a different pin on the teensy and updated my code. It finally seems to be working now. Thanks for your help.

User avatar
snufflecat

25 Apr 2018, 17:06

Hi Hasu, hope you don't mind me asking here in stead. I can't stand GH's forum-design and layout.

OK, so:

- I've flashed my Teensy 2.0 with the correct HEX-file (I think)
- Solder joints on the Teensy are good
- Resistor is in place where it should be
- Wires going from the cable to the Teensy are correct (I've triple-checked)
- The Teensy loader software detects the chip

Still - no action.

- One chip on my Apple Extended II got really warm after a while.
- The keyboard is family number M3501 with Norwegian/Scandinavian layout.
- I did not do any changes to the config files (I can't figure it out anyway), just compiled the hex fil with "make -f Makefile.teensy"

Please see the attached image for photo of my solder joints.

Any help or tips what so ever are greatly appreciated.
IMG_2929.JPG
IMG_2929.JPG (1.36 MiB) Viewed 10558 times

User avatar
hasu

25 Apr 2018, 23:48

You problem is likey to be your wiring as many poeple had.
I can't say soldering job in the pic is good I think you are very new to these things. Your will find someone with skill to ask help in your family(dad or son?), classmates or colleagues.

User avatar
snufflecat

26 Apr 2018, 09:00

hasu wrote: You problem is likey to be your wiring as many poeple had.
I can't say soldering job in the pic is good I think you are very new to these things. Your will find someone with skill to ask help in your family(dad or son?), classmates or colleagues.
And here I was, thinking I did an OK job. :p Thank you! I will have someone skilled help me and see if that helps.

Edit:
I got help and now have much better connections. Now my mouse cursor jumps around at random intervals, but I was able to run the "hid_listen.mac" and keep getting the following message(s):

Code: Select all

Scan: addr:1, reg3:FFE2
Scan: addr:2, reg3:FFE2
Scan: addr:3, reg3:FFE2
Scan: addr:4, reg3:FFE2
Scan: addr:5, reg3:FFE2
Scan: addr:6, reg3:FFE2
Scan: addr:7, reg3:FFE2
Scan: addr:8, reg3:FFE2
Scan: addr:9, reg3:FFE2
Scan: addr:10, reg3:FFE2
Scan: addr:11, reg3:FFE2
Scan: addr:12, reg3:FFE2
Scan: addr:13, reg3:FFE2
Scan: addr:14, reg3:FFE2
Scan: addr:15, reg3:FFE2
debug enabled.
adb_host_kbd_recv: ERROR(-30)

User avatar
snufflecat

28 Apr 2018, 16:30

Sorry, but I have to shamelessly bump this thread in hopes of having someone skilled explain to me what I'm doing wrong. :)

User avatar
hasu

29 Apr 2018, 00:41

Error -30 usually indicates that your wiring is wrong unless your keyboard is in bad shape.
Check your pullup resistor value(1K-10K should be ok) and wire connections.

Are you sure that wire connections from keyboard is correct?
If your give power and ground connection properly the keyboard LEDs blink at startup.

User avatar
snufflecat

30 Apr 2018, 15:28

hasu wrote: Error -30 usually indicates that your wiring is wrong unless your keyboard is in bad shape.
Check your pullup resistor value(1K-10K should be ok) and wire connections.

Are you sure that wire connections from keyboard is correct?
If your give power and ground connection properly the keyboard LEDs blink at startup.
Thank you Hasu. Here are some pictures of what I discovered this morning, and what I might suspect is the reason for my errors:
One of the wires going from the cable to the Teensy melted. I have no idea why I didn't notice this before.
One of the wires going from the cable to the Teensy melted. I have no idea why I didn't notice this before.
IMG_3031.JPG (1.47 MiB) Viewed 10454 times
A tiny drop of solder on the Teensy. This is because of my very bad skills with soldering.
A tiny drop of solder on the Teensy. This is because of my very bad skills with soldering.
IMG_3032.JPG (1.1 MiB) Viewed 10454 times
:oops:

User avatar
snufflecat

02 May 2018, 09:17

By the way: Here's a mockup of how I thought I was supposed to wire it up, if it's of any interest. Could it be that I messed this up as well?
Spoiler:
Screen Shot 2018-04-25 at 15.43.08.png
Screen Shot 2018-04-25 at 15.43.08.png (416.18 KiB) Viewed 10424 times

User avatar
snacksthecat
✶✶✶✶

13 May 2018, 00:23

I got this sweet leaf spring keyboard from IdleThock a while back.
Spoiler:
Image
I built this little converter for it and flashed it with the TMK PS2 converter with JIS keymap.
Spoiler:
Image
The keymap is a bit too complex and unfamiliar for me so I'd like to dumb it down to my level. I'd like to remap a bunch of the keys to be more like an ANSI keyboard that I'm used to. Just wondering if anyone has suggestions on the best way to get started. I'm wondering if I should start from the JIS keymap and modify it, start from standard keymap and modify it, or just start from scratch.

Sorry if this is a dumb question! I've used TMK for a handwire before with really nice results but never tinkered with the converter.

User avatar
hasu

16 May 2018, 05:24

@snacksthecat
many unfamiliar keys... :D
You can see ps/2 scan codes with 'hid_listen' if some keys on the keyboard are not supported by the converter.
Let me know the scan codes I'll be able to add support for unsupported keys.

You don't have to define specific keymap template for this keyboard, you can use unimap_plain.c to support most of keys.

User avatar
snacksthecat
✶✶✶✶

08 Oct 2018, 01:20

Question about lock LEDs. I feel bad for even asking because I've figured this out before but I've been messing with this for a couple hours now and I'm left scratching my head.

Could anyone tell me what I should fix in my LED code to get caps lock to work? I know it depends on my wiring so I can trace that if needed. I just figured there are only a couple of different possibilities to try.

Code: Select all

void led_set(uint8_t usb_led)
{
    if (usb_led & (1<<USB_LED_CAPS_LOCK)) {
        // output low
        DDRD |= (1<<4);
        PORTD &= ~(1<<4);
    } else {
        // Hi-Z
        DDRD &= ~(1<<4);
        PORTD &= ~(1<<4);
    }
}
Thanks!

User avatar
hasu

08 Oct 2018, 03:19

It will work if the LED is placed on PD4 properly.
Yes, you have to post your wiring on pic or schematic preferably if you need more help.

EDIT: did you setup ps/2 converter with your Fujitsu leafspring keyboard? it would be helpful to know how the specific keys works if you can show us your keymap file.

Post Reply

Return to “Workshop”