Author Topic: TMK keyboard firmware  (Read 624407 times)

0 Members and 2 Guests are viewing this topic.

Offline Alectardy98

  • Posts: 16
  • Location: United States
  • Pre Dental
Re: TMK keyboard firmware
« Reply #2000 on: Tue, 05 January 2021, 17:30:31 »
I was able to make it work, but it might not be the cleanest. I am new to coding

Code: [Select]
bool my_led_status = 1;

hook_layer_change(uint32_t layer_state)
{
    if (my_led_status);

        if (layer_state & (1L<<1)) {
            // LED is off, so let's turn it on
            led_set(host_keyboard_leds() | (1<<USB_LED_NUM_LOCK));
            my_led_status = 1;
        } else {
            // LED is on, so let's turn it off
            led_set(host_keyboard_leds() & ~(1<<USB_LED_NUM_LOCK));
            my_led_status = 0;
           
     }
   
}


hook_keyboard_leds_change(uint8_t led_status)
{
    if (my_led_status)
            {
                // LED is off, so let's turn it on
                led_set(host_keyboard_leds() | (1<<USB_LED_NUM_LOCK));
                my_led_status = 1;
            }
            else
            {
                // LED is on, so let's turn it off
                led_set(host_keyboard_leds() & ~(1<<USB_LED_NUM_LOCK));
                my_led_status = 0;
            }
        }
   
hook_late_init(void)
{
if (my_led_status)

    {
        led_set(host_keyboard_leds() & ~(1<<USB_LED_NUM_LOCK));
        my_led_status = 0;
    }
}

Offline hasu

  • Thread Starter
  • Posts: 3256
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: TMK keyboard firmware
« Reply #2001 on: Tue, 05 January 2021, 21:04:04 »
Looks good enough.
I think you don't need 'hook_late_init'.

Code: [Select]
#include "host.h"
#include "led.h"
bool my_led_status = 0;

void hook_layer_change(uint32_t layer_state)
{
    if (layer_state & (1L<<1)) {
        // LED is off, so let's turn it on
        led_set(host_keyboard_leds() | (1<<USB_LED_NUM_LOCK));
        my_led_status = 1;
    } else {
        // LED is on, so let's turn it off
        led_set(host_keyboard_leds() & ~(1<<USB_LED_NUM_LOCK));
        my_led_status = 0;
    }
}


void hook_keyboard_leds_change(uint8_t led_status)
{
    if (my_led_status)
    {
        // LED is off, so let's turn it on
        led_set(host_keyboard_leds() | (1<<USB_LED_NUM_LOCK));
        my_led_status = 1;
    }
    else
    {
        // LED is on, so let's turn it off
        led_set(host_keyboard_leds() & ~(1<<USB_LED_NUM_LOCK));
        my_led_status = 0;
    }
}

If you care about initial state of indicators refer this issue.
https://github.com/tmk/tmk_keyboard/issues/665

Offline hasu

  • Thread Starter
  • Posts: 3256
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: TMK keyboard firmware
« Reply #2002 on: Fri, 29 January 2021, 08:07:05 »
casualdehid,
T0 and Lt0 doesn't work as you expected.
These actions are confusing and make no sense for users. I'll look into them to improve the TOGGLE behaviour but it will take some time.

You can use ACTION_LAYER_SET_CLEAR(0) instead of T0, this aciton disables all layers except for layer 0 at once.
https://github.com/tmk/tmk_keyboard/blob/master/tmk_core/doc/keymap.md#229-set-layer

But the action is not supported well in Keymap Editor yet, you have to edit the action with 'Code Edit' tab.
Check the action on Layer 3.
https://bit.ly/2MeJZZg

There is no alternative to Lt0 at this time.


OK. Lets start discussing that layer switching.
I'd like to check if layer switch problem on your keymap is specific to 'power key'.
Share your keymap URL using 'URL Shortener' button on Keymap editor or you can just attach hex file here.
I filmed my issue:
(Attachment Link)


Offline casualdehid

  • Posts: 31
  • Location: Hungary
Re: TMK keyboard firmware
« Reply #2003 on: Mon, 01 February 2021, 16:15:40 »
For now, I'm using Power On as an improvised Fn layer 2 button (5x to toggle, press and hold for switch), and Esc as ESC+Layer 1 on hold on my M0118.
M0116, Model M, AEK II

Offline casualdehid

  • Posts: 31
  • Location: Hungary
Re: TMK keyboard firmware
« Reply #2004 on: Tue, 02 February 2021, 07:08:53 »
For now, I'm using Power On as an improvised Fn layer 2 button (5x to toggle, press and hold for switch), and Esc as ESC+Layer 1 on hold on my M0118.
Hi there
I've been using my M0118 since yesterday, and decided on two different firmwares for the two keyboards (M0118 and AEKII). However, I noticed that I have problems with multifunction buttons (action_layer_tap_key specifically) being slow for key combinations. For example: I have LT3/grave on my escape, and when I want to hit F5, i have to switch to layer 3 to do so. And it's a key combination i press frequently and very fast, I usually get 05 into my code instead of F5, because it won't switch in time, because I'm not holding it down for enough time. Is there a way to turn on "0 delay" on key combinations in the firmware? I think a few people would have problems with this, because for them it'd switch layers when they only wanted a key combination on the current layer, without switching. Maybe I'm askint a bit too much with this question. Sorry guys in advance.
M0116, Model M, AEK II

Offline hasu

  • Thread Starter
  • Posts: 3256
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: TMK keyboard firmware
« Reply #2005 on: Wed, 03 February 2021, 08:24:16 »
This has no "0 delay" support. With that configuration you won't be able to type '05' quickly.

You can change behavior of 'tap key' with TAPPING_TERM somewhat, btw.
https://github.com/tmk/tmk_keyboard/wiki/FAQ-Keymap#tap-keydual-role-key-doesnt-work-for-me

Offline casualdehid

  • Posts: 31
  • Location: Hungary
Re: TMK keyboard firmware
« Reply #2006 on: Wed, 03 February 2021, 12:01:53 »
This has no "0 delay" support. With that configuration you won't be able to type '05' quickly.

You can change behavior of 'tap key' with TAPPING_TERM somewhat, btw.
https://github.com/tmk/tmk_keyboard/wiki/FAQ-Keymap#tap-keydual-role-key-doesnt-work-for-me

I have the exact opposite problem, it outputs 05 instead of F5  :))
But this will definietly help on my problems.
Thanks again!
M0116, Model M, AEK II

Offline PancakeMSTR

  • Posts: 488
Re: TMK keyboard firmware
« Reply #2007 on: Fri, 23 April 2021, 10:25:02 »
I'm working on converting my Northgate Omnikey, and  it has this really weird ">/<"  key,  which as far as I can tell does NOT send the Non-US-BackSlash code, but instead seems to be the macro "Shift+," hardwired/hardcoded into the keyboard. I.e., pressing the button effectively presses "shift+," really fast.

I'd love to find some way to get this key to behave like the windows key if possible, specifically I could use help writing a TMK function that would send the LGUI code if "Shift" and "," are pressed within really quick succession of each other, or something.

If anyone can help, please let me know. Thanks.
   

Offline mfritsche

  • Posts: 1
Re: TMK keyboard firmware
« Reply #2008 on: Fri, 30 April 2021, 09:44:18 »
EDIT: Never mind, found the answer two postings above  :blank:

Hi,

is there an equivalent of IGNORE_MOD_TAP_INTERRUPT (QMK) in TMK?

I have configured home row mods, but without that setting, those are do not work well as I am not very disciplined with the order my fingers lift of the keys.

« Last Edit: Fri, 30 April 2021, 09:46:54 by mfritsche »

Offline hasu

  • Thread Starter
  • Posts: 3256
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: TMK keyboard firmware
« Reply #2009 on: Fri, 30 April 2021, 22:22:09 »
I don't think you can discriminate between the ">/<" key and Shift+"," typed by you. Or very difficult if possible.

You will have to see how the keyboad sends scan codes for the key closely first.

I'm working on converting my Northgate Omnikey, and  it has this really weird ">/<"  key,  which as far as I can tell does NOT send the Non-US-BackSlash code, but instead seems to be the macro "Shift+," hardwired/hardcoded into the keyboard. I.e., pressing the button effectively presses "shift+," really fast.

I'd love to find some way to get this key to behave like the windows key if possible, specifically I could use help writing a TMK function that would send the LGUI code if "Shift" and "," are pressed within really quick succession of each other, or something.

If anyone can help, please let me know. Thanks.


Offline PancakeMSTR

  • Posts: 488
Re: TMK keyboard firmware
« Reply #2010 on: Thu, 06 May 2021, 17:18:20 »
I don't think you can discriminate between the ">/<" key and Shift+"," typed by you. Or very difficult if possible.

You will have to see how the keyboad sends scan codes for the key closely first.

I'm working on converting my Northgate Omnikey, and  it has this really weird ">/<"  key,  which as far as I can tell does NOT send the Non-US-BackSlash code, but instead seems to be the macro "Shift+," hardwired/hardcoded into the keyboard. I.e., pressing the button effectively presses "shift+," really fast.

I'd love to find some way to get this key to behave like the windows key if possible, specifically I could use help writing a TMK function that would send the LGUI code if "Shift" and "," are pressed within really quick succession of each other, or something.

If anyone can help, please let me know. Thanks.

I'm pretty much positive it's just sending 'Shift + <' really fast, but I did try to use HID listen to see the codes. I couldn't get it to work, it seems to recognize when I plug the keyboard in, but nothing comes though when I actually press keys. If you have a suggestion, I definitely would like to try HID listen again.
   

Offline hasu

  • Thread Starter
  • Posts: 3256
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: TMK keyboard firmware
« Reply #2011 on: Thu, 06 May 2021, 17:58:20 »
which version of firmware are you using?
And what is your converter hardware?

I'm assuming that the keyboard speaks PS/2 protocol,  you can use IBMPC converter firmware.

Offline PancakeMSTR

  • Posts: 488
Re: TMK keyboard firmware
« Reply #2012 on: Fri, 07 May 2021, 11:04:05 »
I'm using ps2_usb, although I will give IBMPC a try, looks interesting. I'm not sure which firmware I'm using or how to check, not anything recent, though. I'll update to the latest from your repo.