Author Topic: TMK keyboard firmware  (Read 459968 times)

0 Members and 1 Guest are viewing this topic.

Offline yakitysax

  • Posts: 51
Re: TMK keyboard firmware
« Reply #250 on: Thu, 09 January 2014, 02:15:09 »
Hi,
You can see active layers on layer_state and default_layer_state of action_layer.h. To get real state of layers you need to see both.

    uint32_t real_state = (layer_state | default_layer_state);

Each bit indicates state of a layer; bit0 has state of layer0, bit31 has layer31 and 0/1 means off/on.


Ah, it is you! I didn't find it on github :D
I've not got my hands on any NeXT keyboard yet, it looks attractive and inrigues me. Occasionally I can find them here but its price is steep.
Looking forward to your post about it. Anyway, great job!

FYI, you can access his non-ADB NeXT converter here.
https://github.com/tmk/tmk_keyboard/tree/master/converter/next_usb
Do you have anywhere where we can throw some cash your way as thanks for making this firmware available, Hasu?

Offline hydrospell

  • * Destiny Supporter
  • Posts: 272
  • Location: Singapore
  • some keyboard thing
    • octobrain
Re: TMK keyboard firmware
« Reply #251 on: Fri, 10 January 2014, 02:39:13 »
hydrospell, thanks
it feels nice to get feedback on my work in particular if it is positive :D

and congrats on success of your project!

thank YOU! :)
I'll do a proper write-up with nice pictures once I'm done with the busy period at work, and I will post the link for you here.
⌨ Filco MJ2 MX Blues / M0116 Orange Alps / Homemade 60% MX Reds / M0110

Cherry MX art prints 20/50 still available!

Offline bcg

  • Posts: 112
Re: TMK keyboard firmware
« Reply #252 on: Fri, 10 January 2014, 14:41:15 »
Hi,
You can see active layers on layer_state and default_layer_state of action_layer.h. To get real state of layers you need to see both.

    uint32_t real_state = (layer_state | default_layer_state);

Each bit indicates state of a layer; bit0 has state of layer0, bit31 has layer31 and 0/1 means off/on.


Ah, it is you! I didn't find it on github :D
I've not got my hands on any NeXT keyboard yet, it looks attractive and inrigues me. Occasionally I can find them here but its price is steep.
Looking forward to your post about it. Anyway, great job!

FYI, you can access his non-ADB NeXT converter here.
https://github.com/tmk/tmk_keyboard/tree/master/converter/next_usb

Thanks for the encouragement, I really appreciate the compliment.  Your firmware makes it really easy to focus on the keyboard-specific details so this was a fun and educational project.

NeXT keyboards seem really expensive but I think they may hold value over time well as collectors items... NeXT was a truly innovative system and the popularity of Steve Jobs should help the collectible appeal I think.

My next project will probably be to implement the XT protocol and build a converter for my Model F XT.  Soarer's converter works well but I want mousekeys :)
:wq!

Offline sean4star

  • Posts: 59
  • Location: Arlington, TX
Re: TMK keyboard firmware
« Reply #253 on: Sat, 11 January 2014, 12:15:10 »
How would I add more Fn keys?  I see the keycode.h file defines FN_MAX as KC_FN31.  But the file also defines the name and location of the keys:

Code: [Select]
enum internal_special_keycodes {
    KC_FN0              = 0xC0,
    KC_FN1,
      :
      :
    KC_FN30,
    KC_FN31,            /* 0xDF */

Looks like you are using 0x00 through 0xFF.  What would I need to do to expand this?  Is it as simple as adding more to the end?


You may be asking, why would I need more than 32 Fn keys?!?  Well, 32 isn't very much if you are creating custom keys and changing the shift layer of your number keys AND using layers AND using dual function keys!  Sounds crazy and maybe it is, but I set myself a design goal of compacting an entire 104 keyboard into 2 tenkey number pads!!  I have it working with the 32 Fn keys, but was hoping to also add in mouse and media keys, which will put me over the 32 Fn max.

Offline hasu

  • Thread Starter
  • Posts: 2823
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: TMK keyboard firmware
« Reply #254 on: Sat, 11 January 2014, 21:32:42 »
yakitysax, sometime I'll make some converters and controllers and get my beer expenses from its sales. Beer makes my fingers smooth, it is essential for coding :D

sean4star, to expand Fn more than 32 is very difficult, keycode is 8bit code and most of codes out of 0-0xFF are already used. It looks like 0xBB-BF and 0xE8-EF only can be used. With them you will able to add 13 extra Fn keys theoretically, but to implement may not be so easy actually. You can get only 13 extras at most and not sure those are enough for you.

Instead of extra Fn keys I can sugest two routes to circumvent your problem.
1. design your own action
Add useful action code and action implementation yourself in action_code.h or action.c.

2. use 'actioncode map' instead of keymap(keycode map)
Action code is 16bit code and can indicate all of key actions with its 16bit. So you don't have to use any Fn key to indicate special actions like keymap does. Its downside is that it needs twice memory space due to 16bit vs 8bit code.

In both way no documentation exists :)
TMK products:HHKB Alt  ⌨ConvertersAlps64FC660C AltFC980C Alt

Offline jacobolus

  • Posts: 3634
  • Location: San Francisco, CA
Re: TMK keyboard firmware
« Reply #255 on: Sun, 12 January 2014, 04:10:24 »
sean4star: Youíre starting to hit some fundamental limitations with the current design. [Note, I think hasuís work is wonderful and amazing and Iím not trying to diminish it!] Ideally, the whole project could be re-architected a bit to support a more generic explicit state machine, with some kind of declarative way to define states and transitions. The current code limits flexibility w/r/t chording/layers/macros/other fancy tricks in a number of ways, because it was designed with particular use cases and modes of operation in mind, and I can imagine several interesting features that donít quite fit the mold.

As one example, I was successfully able to add a bunch of keys which would type Alt + 4 numpad digits, for typing accented letters on windows, so that my parents could plug a teensy-upgraded Apple M0116 into any windows computer and have an easy means of typing words in spanish without needing to change the windows keyboard layout or adapt their typing to each different computer they might plug it in to. I had enough function keys to do this using tmk keyboard firmware, because I only needed to support 2 FN layers + 8 special characters [w/ some ugly big conditional blocks in my macro definitions for detecting the shift key]. But if I had wanted to do something similar and support a large number of special characters [e.g. the greek alphabet + some useful math symbols, or something], then the same method would never scale that far.

Anyhow, I think ultimately Iím going to have to make some firmware from scratch built around a bit more abstracted model [partly just want to do this as a learning exercise], but I think Iíll try to write it for ARM for e.g. a Teensy 3.0/3.1. And it probably wonít happen for at least a few months, since I have other code to write, and work on physical keyboard prototyping to do in the mean time.

Offline codyeatworld

  • * Destiny Supporter
  • Posts: 939
  • Location: Bay Area, California
    • [CTRL]ALT
Re: TMK keyboard firmware
« Reply #256 on: Sun, 12 January 2014, 09:28:45 »
V-USB is one of USB stack used in tmk_keyboard. tmk supports three USB stack LUFA, PJRC and V-USB. gh60 uses LUFA by default.
http://www.obdev.at/products/vusb/index.html

If you want to port the firmware to 38gt, you need to do theese
1) look into matrix circuit with multimeter unless it is open
2) wirte code in matrix.c
3) build with V-USB stack

I found the pin map, but I'm not really sure where to go from here: https://mediacru.sh/ioFxNWxH2oED.png




Offline hasu

  • Thread Starter
  • Posts: 2823
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: TMK keyboard firmware
« Reply #257 on: Sun, 12 January 2014, 10:11:33 »
Nice, it looks like usual V-USB circuit and I think tmk works for this without problem.
Next, you need to know matrix circuit, you can start with 1) as I previously posted.

I'm not sure what you need because I don't know your electronics knowledge and C programming skills.
Do you want to know about how tmk_keyboard works? If so I can help.
If you need to learn how matrix circuit works or C language you can teach yourself with great keyboard resources on the net.
TMK products:HHKB Alt  ⌨ConvertersAlps64FC660C AltFC980C Alt

Offline codyeatworld

  • * Destiny Supporter
  • Posts: 939
  • Location: Bay Area, California
    • [CTRL]ALT
Re: TMK keyboard firmware
« Reply #258 on: Sun, 12 January 2014, 10:29:11 »
Nice, it looks like usual V-USB circuit and I think tmk works for this without problem.
Next, you need to know matrix circuit, you can start with 1) as I previously posted.

I'm not sure what you need because I don't know your electronics knowledge and C programming skills.
Do you want to know about how tmk_keyboard works? If so I can help.
If you need to learn how matrix circuit works or C language you can teach yourself with great keyboard resources on the net.

Basically what would be the first step in writing code in matrix.c, I don't really understand this file yet.

I have very basic knowledge in electronics, but I've been programing for over a year in Ruby. I can catch on pretty quick usually :D
I'm not positive how the matrix works so I'm gonna look into that more later on.




Offline Hzza

  • Posts: 377
  • Location: Windsor, UK
Re: TMK keyboard firmware
« Reply #259 on: Mon, 13 January 2014, 02:45:31 »

Offline hasu

  • Thread Starter
  • Posts: 2823
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: TMK keyboard firmware
« Reply #260 on: Mon, 13 January 2014, 21:22:02 »
Yes, that is nice tutorial by matt3o, very helpful.

To learn about keyboard matrix this will be useful as well.
http://www.dribin.org/dave/keyboard/one_html/

And komar also has good blog post, he is GH60 designer as you know.
http://blog.komar.be/how-to-make-a-keyboard-the-matrix/
TMK products:HHKB Alt  ⌨ConvertersAlps64FC660C AltFC980C Alt

Offline codyeatworld

  • * Destiny Supporter
  • Posts: 939
  • Location: Bay Area, California
    • [CTRL]ALT
Re: TMK keyboard firmware
« Reply #261 on: Mon, 13 January 2014, 21:41:30 »
Yeah the matt3o tutorial is very helpful, just what I needed, and I'll check out the matrix links.
 
I have a couple 38gts incoming, I will give this a shot soon.

Does tmk support full led?




Offline hasu

  • Thread Starter
  • Posts: 2823
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: TMK keyboard firmware
« Reply #262 on: Mon, 13 January 2014, 22:59:30 »
All LED indicators defined in spec are supported. If you mean backlight, maybe answer is yes/no.
Wraul added backlight interface(common/backlight.h) to support KMAC some back. But I'm not sure it works for you. At least it does not support fancy illumination fucntions.

TMK products:HHKB Alt  ⌨ConvertersAlps64FC660C AltFC980C Alt

Offline codyeatworld

  • * Destiny Supporter
  • Posts: 939
  • Location: Bay Area, California
    • [CTRL]ALT
Re: TMK keyboard firmware
« Reply #263 on: Tue, 14 January 2014, 12:46:43 »
All LED indicators defined in spec are supported. If you mean backlight, maybe answer is yes/no.
Wraul added backlight interface(common/backlight.h) to support KMAC some back. But I'm not sure it works for you. At least it does not support fancy illumination fucntions.



The 38gt with aikon uses the dipswitch under the pcb to turn on/off the leds for every key.

I don't really care for fancy led functions, I would just want to light up every key. It looks like I could modify the KMAC backlight.h to light up all the keys though.




Offline Melvang

  • Exquisite Lord of Bumfluff
  • * Maker
  • Posts: 4388
  • Location: Waterloo, IA
  • Melvang's Desktop Customs
Re: TMK keyboard firmware
« Reply #264 on: Tue, 21 January 2014, 11:29:13 »
Would this matrix be possible with using a hand wired matrix on a Teensy 2.0?  Or would I need the ++ edition for extra pins?  I have one pad on my Teensy for this with a lifted pad and don't feel comftorable to attempt to repair that so I am down one pin on the Teensy.  The missing pad is on pin C6.  If I can still make this work what pins would the rows and columns hook up to?

It is 19 columns x 6 rows.
51827-0
OG Kishsaver, Razer Orbweaver clears and reds with blue LEDs, and Razer Naga Epic.   "Great minds crawl in the same sewer"  Uncle Rich
Order Form for MDC Mouse Pad
Contact Form for questions

IBM F Revival Services Now with VIDEO

Offline hasu

  • Thread Starter
  • Posts: 2823
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: TMK keyboard firmware
« Reply #265 on: Tue, 21 January 2014, 11:51:53 »
I don't remember how many ports Teensy2.0 has.
Just simple math; if your Teensy still has 25(19+6) ports you can use it.

You can use any available IO ports for the purpose and matrix wiring totally depends on how you write code for matrix scan.
TMK products:HHKB Alt  ⌨ConvertersAlps64FC660C AltFC980C Alt

Offline Melvang

  • Exquisite Lord of Bumfluff
  • * Maker
  • Posts: 4388
  • Location: Waterloo, IA
  • Melvang's Desktop Customs
Re: TMK keyboard firmware
« Reply #266 on: Tue, 21 January 2014, 11:54:06 »
Thanks Hasu.  I would assume that anything with a number in the pin designation can be used then?
OG Kishsaver, Razer Orbweaver clears and reds with blue LEDs, and Razer Naga Epic.   "Great minds crawl in the same sewer"  Uncle Rich
Order Form for MDC Mouse Pad
Contact Form for questions

IBM F Revival Services Now with VIDEO

Offline Tarzan

  • formerly known as Greystoke
  • * Maker
  • Posts: 1303
  • Location: US: Virginia
Re: TMK keyboard firmware
« Reply #267 on: Tue, 21 January 2014, 12:00:11 »
Thanks Hasu.  I would assume that anything with a number in the pin designation can be used then?

Not to jump queue, but I think the Teensy 2.0 controller can use up to 26 pins.  This does count the pin used for the on-board LED, based on other comments it doesn't impact the usage of the controller to assign a row/column to that pin.  Excludes Power, Ground, and E6.

Offline Melvang

  • Exquisite Lord of Bumfluff
  • * Maker
  • Posts: 4388
  • Location: Waterloo, IA
  • Melvang's Desktop Customs
Re: TMK keyboard firmware
« Reply #268 on: Tue, 21 January 2014, 12:29:18 »
Thanks Hasu.  I would assume that anything with a number in the pin designation can be used then?

Not to jump queue, but I think the Teensy 2.0 controller can use up to 26 pins.  This does count the pin used for the on-board LED, based on other comments it doesn't impact the usage of the controller to assign a row/column to that pin.  Excludes Power, Ground, and E6.

I am probably wrong on this but I am only counting 24.

Counting from top left with USB port on left side on top I get

Code: [Select]
1 F0
2 F1
3 F4
4 F5
5 F6
6 F7
7 B6
8 B5
9 B4
10 D7
11 D6
12 D4
13 D5
14 C7
15 C6 Lifted top pad on mine.
16 D3
17 D2
18 D1
19 D0
20 B7
21 B3
22 B2
23 B1
24 B0

So looking at this I don't have enough pins even with including my lifted pad. 

Also looking at PJRC's website it has 25 IO pins.  I am guessing that would be E6. 

And it looks like with this layout I am going to need every pin for the matrix.  Well, looks like I am going to use my new teensy and just buy another one for when I get ready to wire up my Brushed Behemoth.

Edit:  I apologize if these are noobie questions but I am still pretty new to electronics.  I do understand some basics but not a lot of specifics especially with these controllers and such.
« Last Edit: Tue, 21 January 2014, 12:35:39 by Melvang »
OG Kishsaver, Razer Orbweaver clears and reds with blue LEDs, and Razer Naga Epic.   "Great minds crawl in the same sewer"  Uncle Rich
Order Form for MDC Mouse Pad
Contact Form for questions

IBM F Revival Services Now with VIDEO

Offline Tarzan

  • formerly known as Greystoke
  • * Maker
  • Posts: 1303
  • Location: US: Virginia
Re: TMK keyboard firmware
« Reply #269 on: Tue, 21 January 2014, 12:51:09 »
Thanks Hasu.  I would assume that anything with a number in the pin designation can be used then?

Not to jump queue, but I think the Teensy 2.0 controller can use up to 26 pins.  This does count the pin used for the on-board LED, based on other comments it doesn't impact the usage of the controller to assign a row/column to that pin.  Excludes Power, Ground, and E6.

I am probably wrong on this but I am only counting 24.

Counting from top left with USB port on left side on top I get

Code: [Select]
1 F0
2 F1
3 F4
4 F5
5 F6
6 F7
7 B6
8 B5
9 B4
10 D7
11 D6
12 D4
13 D5
14 C7
15 C6 Lifted top pad on mine.
16 D3
17 D2
18 D1
19 D0
20 B7
21 B3
22 B2
23 B1
24 B0

So looking at this I don't have enough pins even with including my lifted pad. 

Also looking at PJRC's website it has 25 IO pins.  I am guessing that would be E6. 

And it looks like with this layout I am going to need every pin for the matrix.  Well, looks like I am going to use my new teensy and just buy another one for when I get ready to wire up my Brushed Behemoth.

Edit:  I apologize if these are noobie questions but I am still pretty new to electronics.  I do understand some basics but not a lot of specifics especially with these controllers and such.

I stand corrected!  I think I was adding in the Reset pin to get my previous total.   ;D

I've got two Teensy++ controllers for just this situation, as I found it pretty complicated to hard-wire a full 104-key keyboard to fit a Teensy 2.0.  I guess it can be done, but it involved a lot of double runs, and even then I couldn't include F8.  Not that I ever used it, mind...   :))

Offline Melvang

  • Exquisite Lord of Bumfluff
  • * Maker
  • Posts: 4388
  • Location: Waterloo, IA
  • Melvang's Desktop Customs
Re: TMK keyboard firmware
« Reply #270 on: Tue, 21 January 2014, 13:07:43 »
Now my question is this.  When using the TMK firmware does it use the rows or columns as an input?  Trying to figure out which way I need to point my diodes.

Looking at the 10th picture here it would appear that the black band would go toward the row and uses the columns as an output from the teensy and the rows as the input. 

Comments or suggestions?
OG Kishsaver, Razer Orbweaver clears and reds with blue LEDs, and Razer Naga Epic.   "Great minds crawl in the same sewer"  Uncle Rich
Order Form for MDC Mouse Pad
Contact Form for questions

IBM F Revival Services Now with VIDEO

Offline hydrospell

  • * Destiny Supporter
  • Posts: 272
  • Location: Singapore
  • some keyboard thing
    • octobrain
Re: TMK keyboard firmware
« Reply #271 on: Tue, 21 January 2014, 15:15:12 »
Think the columns are the inputs. I copied matt3os wiring in the brown fox build, loaded the /keyboards/gh60 code and it worked.
⌨ Filco MJ2 MX Blues / M0116 Orange Alps / Homemade 60% MX Reds / M0110

Cherry MX art prints 20/50 still available!

Offline hasu

  • Thread Starter
  • Posts: 2823
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: TMK keyboard firmware
« Reply #272 on: Tue, 21 January 2014, 18:30:59 »
Yes. In tmk you shall see columns as input, this is just from conventional reason. Note that 'column' and 'row' are just name and interchangeable each other if you change your point of view.

In your matrix you can read 19 columns as input but to retain that data you need to 32bit(uint32_t) variable and waste 13 bits space in vain. Instead, you can use 8bit(uint8_t) variable with treating your 6 'rows' as input, that is, 'column' in tmk. Confusing :)

Right, looks like lowpoly's M0110 mod uses 'rows' as input. Wait, lean your head 90deg. Voila, row is column now!
TMK products:HHKB Alt  ⌨ConvertersAlps64FC660C AltFC980C Alt

Offline nebo

  • Posts: 417
  • Location: Seattle, WA
Re: TMK keyboard firmware
« Reply #273 on: Fri, 24 January 2014, 00:35:40 »
I might not be understanding layers correctly, but this all looks right to me. What I'm expecting to happen is when I hit 'F12', the navigation cluster becomes a numpad but I can't figure out why it doesn't. I tried it as layer 2 since I assumed they started at 0 but I guess not.

Code: [Select]
// Phantom ANSI 150
static const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
    /* 0: qwerty */
    KEYMAP_ANSI_150(\
        ESC,      F1,  F2,  F3,  F4,  F5,  F6,  F7,  F8,  F9,  F10, F11, FN2,       PSCR,NLCK,BRK,  \
        GRV, 1,   2,   3,   4,   5,   6,   7,   8,   9,   0,   MINS,EQL, BSPC,      INS, HOME,PGUP, \
        TAB, Q,   W,   E,   R,   T,   Y,   U,   I,   O,   P,   LBRC,RBRC,BSLS,      DEL, END, PGDN, \
        CAPS, A,   S,   D,   F,   G,   H,   J,   K,   L,   SCLN,QUOT,     ENT,       TRNS,TRNS,TRNS, \
        LSFT,     Z,   X,   C,   V,   B,   N,   M,   COMM,DOT, SLSH,     RSFT,      TRNS, UP, TRNS, \
        LCTL,LGUI,LALT,               SPC,                     RALT,FN1,RCTL,       LEFT,DOWN,RGHT),
/* 1: number keys */
    KEYMAP_ANSI_150(\
        TRNS,     TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,     PSCR,NLCK,BRK,  \
        TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,     PSLS,PAST,PMNS, \
        TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,     P7,   P8,  P9,  \
        TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,     TRNS,     P4,   P5,  P6,  \
        TRNS,     TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,     TRNS,     P1,   P2,  P3,  \
        TRNS,TRNS,TRNS,               TRNS,                    TRNS,TRNS, TRNS,    P0,  PDOT,PPLS),
    /* 2: media keys */
    KEYMAP_ANSI_150(\
        TRNS,     TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,      TRNS,TRNS,SLEP, \
        TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,      TRNS,TRNS,TRNS, \
        TRNS,MPLY,MPRV,MNXT,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,      TRNS,TRNS,TRNS, \
        TRNS,MUTE,VOLD,VOLU,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,     TRNS,      TRNS,TRNS,TRNS, \
        TRNS,     TRNS,TRNS,CALC,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,     TRNS,      TRNS,TRNS,TRNS, \
        TRNS,TRNS,TRNS,               TRNS,                   TRNS,TRNS, TRNS,      TRNS,TRNS,TRNS)
};
static const uint16_t PROGMEM fn_actions[] = {
        [0] = ACTION_LAYER_MOMENTARY(1),                  // FN0
        [1] = ACTION_LAYER_TAP_KEY(2, KC_RGUI),           // FN1
        [2] = ACTION_LAYER_TOGGLE(3)                      // FN2
};


Offline hasu

  • Thread Starter
  • Posts: 2823
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: TMK keyboard firmware
« Reply #274 on: Fri, 24 January 2014, 06:16:23 »
Your numpad layer is placed at layer[1]. But You define FN2 as toggle non exist layer[3] instead of 1.

Replace 3 with 1 in your FN2 definition.
TMK products:HHKB Alt  ⌨ConvertersAlps64FC660C AltFC980C Alt

Offline jeffgran

  • Posts: 126
  • Location: Denver
Re: TMK keyboard firmware
« Reply #275 on: Fri, 24 January 2014, 12:50:15 »
Yes. In tmk you shall see columns as input, this is just from conventional reason. Note that 'column' and 'row' are just name and interchangeable each other if you change your point of view.

In your matrix you can read 19 columns as input but to retain that data you need to 32bit(uint32_t) variable and waste 13 bits space in vain. Instead, you can use 8bit(uint8_t) variable with treating your 6 'rows' as input, that is, 'column' in tmk. Confusing :)

Right, looks like lowpoly's M0110 mod uses 'rows' as input. Wait, lean your head 90deg. Voila, row is column now!

LOL :)

Offline sean4star

  • Posts: 59
  • Location: Arlington, TX
Re: TMK keyboard firmware
« Reply #276 on: Fri, 24 January 2014, 13:57:18 »
Which IBM keyboards are supported with the existing converters?  And which converter should be used?

For example, I am the proud new owner of a Model M #1390120.  And I have an XT Model F (out of an IBM 5155 Portable PC system) on the way as well.  I don't know much about scan code sets, so I couldn't tell you which one's are used.  Which converters would I use for these?  And are there instuctions on how to set them up?

Offline nebo

  • Posts: 417
  • Location: Seattle, WA
Re: TMK keyboard firmware
« Reply #277 on: Fri, 24 January 2014, 14:19:47 »
Ok, one more question. I can't seem to find where (I assumed it be in common/) that the led's are bound to a key. My end goal is to have it so that pressing a key that switches layers causes a led to be switched on for when the non-default layer is selected.

Offline hasu

  • Thread Starter
  • Posts: 2823
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: TMK keyboard firmware
« Reply #278 on: Fri, 24 January 2014, 21:06:25 »
sean4star, I don't know which scan code set #1390120 uses. You can use ps2_usb for scan code set 2 or terminal_usb for set 3. Unfortunately tmk_keyboard does not support XT(set 1) atm.

nebo, leds are bound for system status indicators(Capslock, Numlock and ...) by defaut and what you want is not supported. You can write your own function in keymap to control your led, but not documented enough and you need to read lot of dirty cocde to understand.
https://github.com/tmk/tmk_keyboard/blob/master/doc/keymap.md#24-function-action
TMK products:HHKB Alt  ⌨ConvertersAlps64FC660C AltFC980C Alt

Offline sean4star

  • Posts: 59
  • Location: Arlington, TX
Re: TMK keyboard firmware
« Reply #279 on: Sat, 25 January 2014, 01:27:57 »
Are there any plans to add XT (scan code set 1) support in the future?  What all is involved in developing the code for a converter?

Offline jacobolus

  • Posts: 3634
  • Location: San Francisco, CA
Re: TMK keyboard firmware
« Reply #280 on: Sat, 25 January 2014, 01:57:02 »
Would this matrix be possible with using a hand wired matrix on a Teensy 2.0?  [...] It is 19 columns x 6 rows.

You know you donít have to wire all the rows and columns in exactly straight lines, right? :)

You should be able to handle your layout with a 10x11 or 11x11 matrix, you just might have to make the rows and columns zig zag or skip a bit.

Offline hasu

  • Thread Starter
  • Posts: 2823
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: TMK keyboard firmware
« Reply #281 on: Sat, 25 January 2014, 03:09:24 »
I don't have any XT keyboard and no plan myself at the momemnt. But I think bcg may have a plan for his future project.
http://geekhack.org/index.php?topic=41989.msg1188141#msg1188141
TMK products:HHKB Alt  ⌨ConvertersAlps64FC660C AltFC980C Alt

Offline Melvang

  • Exquisite Lord of Bumfluff
  • * Maker
  • Posts: 4388
  • Location: Waterloo, IA
  • Melvang's Desktop Customs
Re: TMK keyboard firmware
« Reply #282 on: Sat, 25 January 2014, 17:26:05 »
Would this matrix be possible with using a hand wired matrix on a Teensy 2.0?  [...] It is 19 columns x 6 rows.

You know you donít have to wire all the rows and columns in exactly straight lines, right? :)

You should be able to handle your layout with a 10x11 or 11x11 matrix, you just might have to make the rows and columns zig zag or skip a bit.

True but with this being my first hand matrix with an odd layout which will require a custom firmware I want to keep he matrix as simple as possible.  With what I have been reading I can do the matrix as is with a Teensy 2.0.  But I just have to use my new one instead of the used one due to pulling a pad when I pulled the old one.
OG Kishsaver, Razer Orbweaver clears and reds with blue LEDs, and Razer Naga Epic.   "Great minds crawl in the same sewer"  Uncle Rich
Order Form for MDC Mouse Pad
Contact Form for questions

IBM F Revival Services Now with VIDEO

Offline gropingmantis

  • Posts: 77
  • Location: United Kingdom
Re: TMK keyboard firmware
« Reply #283 on: Sat, 01 February 2014, 03:05:20 »
Having an issue with my phantom at the moment. When I plug it into my computer (arch linux, X11, dwm) it kills my kbmap which means that ~# and |\ (uk iso layout) dont work until i reset my kbmap. Is there a way to make the board identify as uk iso or is this an issue with my setup?

Offline hasu

  • Thread Starter
  • Posts: 2823
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: TMK keyboard firmware
« Reply #284 on: Sat, 01 February 2014, 06:50:38 »
What is kbmap? How do you reset you kbmap?
Show your keymap.c, it may help.

hmm, I'm not sure what your problem is, honestly. Can anyone help him?
TMK products:HHKB Alt  ⌨ConvertersAlps64FC660C AltFC980C Alt

Offline tuxsavvy

  • Posts: 441
  • 白HHKBの魔法使い
Re: TMK keyboard firmware
« Reply #285 on: Sat, 01 February 2014, 08:45:32 »
I don't think gropingmantis was referring to kbmap. With the information provided it sounds like gropingmantis is referring to something specifically within the X environment, it could be xmodmap, xkbmap or something like that.

Though at the same time gropingmantis needs to be more specific on the issue. If it was exactly as I mentioned above then it has nothing to do with the keyboard firmware but rather the mapping used on the computer. I have had encountered similar situations before but I have not really found the root cause of it all. In my cases I have keyboards with varying layouts (big-ass enter, JIS and DE ISO) and am also running archlinux.

Big-ass enter keyboard was the most easiest to setup, setting up JIS was a little harder but xmodmap and having to issue the command a few times ensured that the map would stay up a little longer. The problem by then was really xmodmap when it seems to lack certain keys it will randomly map mod on its own (mod keys that is). The real issue was (and still is getting DE ISO) to work. My archlinux was more or less setup on ANSI keyboard hence it assumes keyboards being in use are ANSI or ANSI related. This poses some issues which I have mixed results.

If gropingmantis was previously using a layout that was not set/defined at start, the system may automatically assume a specific layout to be used. For now a really dirty hack I would suggest (which only seems to work under X11 environment) is to use setxkbmap tool. Here are some potential pointers for getting it to work: https://wiki.archlinux.org/index.php/Keyboard_Configuration_in_Xorg

I have personally taken a different approach (until I can find a more better way somehow) into trying to rectify the issue and for now a very ugly hack seems to be doing the trick for DE ISO:
Code: [Select]
while true; do setxkbmap -layout de && sleep 1; doneI do not personally condone the use of this hack that I made nor do I take any responsibilities for any damages may arise from the use of the hack. Until I can find a nice solution that can work with my constant keyboard switching (along with their specific switches and their layouts) I am more or less going to have to tackle it in various ways. xmodmap seems to work wonders for both the two former keyboards but not so well for the DE ISO (yet).

Also I tend to think that there is no easy way for Xorg to know which keyboard with exactly which layout is plugged in, especially this is true with PS/2 or DIN connector type keyboards. They do not have an ID and are labelled as "AT Translated Set 2 keyboard" via xinput tool.

HHKB Pro JP Type-S | Northgate Omnikey 101 | APC/"Clicker" F-21 (GOG3YL) | Cherry G80-5000 HAMDE

僕の日本語が下手です。我的中文也一樣爛。

Offline gropingmantis

  • Posts: 77
  • Location: United Kingdom
Re: TMK keyboard firmware
« Reply #286 on: Sat, 01 February 2014, 12:56:17 »
tuxsavy is corrct. In my xinitrc I have the line
Code: [Select]
setxkbmap gbHowever when I plug my phantom in it resets back to the default US X11 mapping. Its not a problem I saw with my Filco with HID liberation or any other keyboard.
Nothing comes up in dmesg when I plug it in either and all the keys work fine they are just mapped incorrectly. I will say that this issue is not present every time but most times. Also it is only in X that the keymap is reset. In a standard terminal $KEYMAP is not altered.
« Last Edit: Sat, 01 February 2014, 12:57:58 by gropingmantis »

Offline tuxsavvy

  • Posts: 441
  • 白HHKBの魔法使い
Re: TMK keyboard firmware
« Reply #287 on: Mon, 03 February 2014, 22:35:44 »
In some ways I need to know more information about your other boards (including your Filco). If they are all ANSI layout it would be reset to correct keyboard map. However, in some ways I tend to want to think that setxkbmap is a temporary means of telling X your layout is X over say Y or even Z.

A possible dirty hack would be to write your own Xorg.conf file specifically implying to use GB ISO layout instead of ANSI. I think the issue might be related to the fact that writing Xorg.conf has been somewhat deprecated for the "plug-and-play" ideals. Then again the settings might be set in when Xorg is told to use a config file specified by the user rather than leaving say udev, hal or whatever to detect and "assume" the layout. Heck even Xorg itself.

Then again writing your own Xorg.conf file I guess would restrict to maybe a keyboard. I am not sure how it would work with one having multiple keyboards with multiple layouts, even worse is if one having multiple keyboard and their specific layouts but are all connected via PS/2, DIN, etc (anything but USB). That would be even more of a nightmare to "segment" out individual non-USB keyboards whom all share the same ID as "AT Translated Set 2 keyboard". Some PS/2 to USB adapters would show different ID but again if same USB adapters were to be used they would produce the same ID.
HHKB Pro JP Type-S | Northgate Omnikey 101 | APC/"Clicker" F-21 (GOG3YL) | Cherry G80-5000 HAMDE

僕の日本語が下手です。我的中文也一樣爛。

Offline gropingmantis

  • Posts: 77
  • Location: United Kingdom
Re: TMK keyboard firmware
« Reply #288 on: Wed, 05 February 2014, 02:05:18 »
All my keyboards are UK ISO and they all connect over USB. I had the aforementioned Filco with HID Liberation using TMK. An IBM Model M with a Teensy Converter running Soarer's. And two wireless Logitech boards that share a unifying receiver. The Phantom is the only board that displays this behaviour so my conclusion is that it is something to do with the firmware/teensy setup somehow as TMK+HID Lib works and Soarers+Teensy works.

Offline hasu

  • Thread Starter
  • Posts: 2823
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: TMK keyboard firmware
« Reply #289 on: Wed, 05 February 2014, 14:57:30 »
Your X11 recognizes Phantom as US layout for some reason. But how?
Other window manager has same problem? How about Windows and Mac?

Just my wild guess is that  X11 sees Phantom VID/PID and decides layout. Just change VID/PID then build and test its firmware.
TMK products:HHKB Alt  ⌨ConvertersAlps64FC660C AltFC980C Alt

Offline gropingmantis

  • Posts: 77
  • Location: United Kingdom
Re: TMK keyboard firmware
« Reply #290 on: Thu, 06 February 2014, 02:18:42 »
Ah ha I've fixed it! It was not hasu's wonderful firmware but my own X settings.
Code: [Select]
setxkbmapis only ever temporary, instead I should have used
Code: [Select]
# localectl set-x11-keymapwhich creates a new file
Code: [Select]
/etc/X11/xorg.conf.d/00-keyboard.confand now everything is permanent and fixed. YAY!

Offline wuqe

  • Posts: 105
  • Location: WA, USA
Re: TMK keyboard firmware
« Reply #291 on: Thu, 06 February 2014, 09:00:40 »
Yay indeed! Thanks for the update; the internet is smarter now. :)

Offline wcass

  • Posts: 498
  • Location: Fort Lauderdale, FL, USA
Re: TMK keyboard firmware
« Reply #292 on: Mon, 10 February 2014, 21:44:37 »
Let's say that i have two keys that both have alternate functions associated with them. If i need to make a chord that uses both keys but from different layers - is there a way to define which keys come from which layers?

For example, if i wanted to select text from the cursor position to the end of the line, i might type shift+end. But I want to make (Fn+shift=caps_lock) AND (Fn+right_arrow=end).  So, how do i make sure that Fn+shift+right_arrow=shift+end (with no caps lock)? Is the only solution to move caps lock to some other combo?

Thanks!

Offline AKmalamute

  • HHKB Scrub
  • Posts: 826
  • Location: Western WA, USA
Re: TMK keyboard firmware
« Reply #293 on: Mon, 10 February 2014, 23:18:41 »
For example, if i wanted to select text from the cursor position to the end of the line, i might type shift+end. But I want to make (Fn+shift=caps_lock) AND (Fn+right_arrow=end).  So, how do i make sure that Fn+shift+right_arrow=shift+end (with no caps lock)? Is the only solution to move caps lock to some other combo?
Thanks!

 I haven't played with this firmware, so I'm mostly speaking from 1st-hand experience of my HHKB-lite2, which has a function layer, but ...

 No, you can't call keystrokes from two separate layers at the same time. You can have a key be "transparent" so it will fall through to the next  not-transparent definition (recalling that description from Massdrop's firmware creator, but I can visualize it, again, because of my own keyboard) but that means that "This is the shift key" regardless of which layer is being called elsewhere.

HHKB-lite2, Dvorak user

Offline hasu

  • Thread Starter
  • Posts: 2823
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: TMK keyboard firmware
« Reply #294 on: Tue, 11 February 2014, 00:19:21 »
wcass,
Seems like you can use "dual-role key"(TAP_KEY in tmk) to have both Shift and Caps on that layer.
But I'd say moving Caps is a reasonable solution.
TMK products:HHKB Alt  ⌨ConvertersAlps64FC660C AltFC980C Alt

Offline plainbriny

  • Posts: 187
  • Location: Taiwan
Re: TMK keyboard firmware
« Reply #295 on: Tue, 11 February 2014, 07:50:44 »
Hi hasu, first of all, thanks for your greatest ever firmware. I have been using it for a couple of months, and it is just amazing.

However, recently I upgraded my PC to a new one with UEFI. The problem is, if I use lufa, the computer behave strangely, either stuck in the "press del for setup" screen (I can enter the setup and the keyboard is working fine there), or when pass that screen sometimes, the linux kernel will report "CPU[123] not responding" and reboot. If I wait after computer booting complete, then plug the keyboard, everything works fine.

Therefore, I am now using pjrc stack and it works, no above mentioned problem. But I can't help to wonder what might be the problem and whether it can be fixed.

Offline hasu

  • Thread Starter
  • Posts: 2823
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: TMK keyboard firmware
« Reply #296 on: Tue, 11 February 2014, 14:38:07 »
Thank you for your feedback.
I filed the issue on github. Maybe it is HID spec compliance problem.
Unfortunately I can't fix this in a short time, I'll work on it later when I have a mcuh time.
https://github.com/tmk/tmk_keyboard/issues/93
TMK products:HHKB Alt  ⌨ConvertersAlps64FC660C AltFC980C Alt

Offline domoaligato

  • * Exquisite Elder
  • Posts: 1660
  • Location: USA
  • All your base are belong to us!
    • All your base are belong to us!
Re: TMK keyboard firmware
« Reply #297 on: Fri, 14 February 2014, 22:51:56 »
Hi hasu, first of all, thanks for your greatest ever firmware. I have been using it for a couple of months, and it is just amazing.

However, recently I upgraded my PC to a new one with UEFI. The problem is, if I use lufa, the computer behave strangely, either stuck in the "press del for setup" screen (I can enter the setup and the keyboard is working fine there), or when pass that screen sometimes, the linux kernel will report "CPU[123] not responding" and reboot. If I wait after computer booting complete, then plug the keyboard, everything works fine.

Therefore, I am now using pjrc stack and it works, no above mentioned problem. But I can't help to wonder what might be the problem and whether it can be fixed.


have you tired to see if you might have a bios update to install?

Offline Hubbert

  • Posts: 52
Re: TMK keyboard firmware
« Reply #298 on: Sat, 15 February 2014, 12:03:09 »
I've been away for a while.  I browsed the documentation, and have a few basic questions before diving in:

1) Are all Hasu's converters & controllers packaged under the "TMK" umbrella?
2) What is the meaning of "TMK"?
3) Are the hardware requirements documented, e.g., which versions of Teensy work?

Thanks!

PS:
4) What are the limitations on the matrix size?  Ideally, I'd like to use one controller to control a 104-key keyboard and an external 10-key together.
« Last Edit: Sat, 15 February 2014, 12:27:31 by Hubbert »
Current: ThinkPad, Modified Model M, Customozed Unicomp on order.
Occasional: Acer (rubber with sharp edged keycaps)
Storage: Kinesis Advantage (Cherry brown), PC Concepts split keyboard (ALPS white)
Scorpius M10 (Cherry blue)

Offline phatdood9

  • Posts: 162
  • Location: sf bay area, ca
Re: TMK keyboard firmware
« Reply #299 on: Sun, 16 February 2014, 18:41:13 »
Can someone spot any error in this?

Somehow my bottom row doesn't seem to be working. I don't think its a hardware issue.

Is there any sort of debug logger I can use?

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

#define KEYMAP( \
    K0A, K0B, K0C, K0D, \
    K1A, K1B, K1C, K1D, \
    K2A, K2B, K2C, K2D, \
    K3A, K3B, K3C, K3D, \
    K4A, K4B, K4C, K4D \
) { \
    { KC_##K0A, KC_##K0B, KC_##K0C, KC_##K0D }, \
    { KC_##K1A, KC_##K1B, KC_##K1C, KC_##K1D }, \
    { KC_##K2A, KC_##K2B, KC_##K2C, KC_##K2D }, \
    { KC_##K3A, KC_##K3B, KC_##K3C, KC_##K3D }, \
    { KC_##K4A, KC_##K4B, KC_##K4C, KC_##K4D }, \
}

#ifdef KEYMAP_SECTION_ENABLE
const uint8_t keymaps[][MATRIX_ROWS][MATRIX_COLS] __attribute__ ((section (".keymap.keymaps"))) = {
#else
const uint8_t keymaps[][MATRIX_ROWS][MATRIX_COLS] PROGMEM = {
#endif
    [0] = KEYMAP(
        NLCK,PSLS, PAST, PMNS, \
        P7,  P8,   P9,   PPLS, \
        P4,  P5,   P6,   NO,   \
        P1,  P2,   P3,   ENT,  \
        P0,  P0,   PDOT, NO)
};

#ifdef KEYMAP_SECTION_ENABLE
const uint16_t fn_actions[] __attribute__ ((section (".keymap.fn_actions"))) = {
#else
const uint16_t fn_actions[] PROGMEM = {
#endif
};

config.h
Code: [Select]
#ifndef CONFIG_H
#define CONFIG_H


/* USB Device descriptor parameter */
#define VENDOR_ID       0xFEED
#define PRODUCT_ID      0x6060
#define DEVICE_VER      0x0001
#define MANUFACTURER    geekhack
#define PRODUCT         GHPAD
#define DESCRIPTION     t.m.k. keyboard firmware for GHPAD

/* key matrix size */
#define MATRIX_ROWS 5
#define MATRIX_COLS 4

/* define if matrix has ghost */
//#define MATRIX_HAS_GHOST

/* Set 0 if debouncing isn't needed */
#define DEBOUNCE    5

/* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */
#define LOCKING_SUPPORT_ENABLE
/* Locking resynchronize hack */
#define LOCKING_RESYNC_ENABLE

/* key combination for command */
#define IS_COMMAND() ( \
    keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) \
)


#endif