Author Topic: TMK keyboard firmware  (Read 554380 times)

0 Members and 1 Guest are viewing this topic.

Offline U47

  • Posts: 80
  • Location: YEG
Re: TMK keyboard firmware
« Reply #850 on: Sun, 16 August 2015, 12:48:36 »
Is it still
https://www.sparkfun.com/products/11286
+
https://www.circuitsathome.com/products-page/arduino-shields/usb-host-shield-2-0-for-arduino-assembled/

for the best possible combination, or is there a better one?

I think a Teensy is a better (and cheaper) way to go. Arduinos are a ripoff.

Offline a-c

  • Posts: 196
  • Location: USA

Offline njbair

  • Posts: 2825
  • Location: Cleveland, Ohio
  • I love the Powerglove. It's so bad.
    • nickbair.net
Re: TMK keyboard firmware
« Reply #852 on: Sun, 16 August 2015, 14:02:13 »
Hi everyone

I'm looking for the most-solid 60% PCB to use with tmk_keyboard, leds not needed, a flat front-surface should be nice (for 5mm plates)

I was going to get a Nerd60, but I read that the bootloader is not compatible with dfu-util on default, I was considering a winkeyless.kr PCB, but I'm not sure where compatibility is at

Long story short, I would appreciate some buying advice (currently using the infinity PCB, it's ARM, not solid for several reasons, both electronical and physical, another massdrop fiasco, that's why I'm looking for something solid, a proven AVR PCB without any production issues would be great)

You and me both, man. There's always the option to program a very basic 60% single-layer layout, then use hasu's USB to USB converter. I just bought one from hasu last week (just arrived in U.S. customs on Friday), and I think I'm going to configure all my Fn keys and layering via the converter.

If hasu doesn't have any converters in stock, you can build your own with an Arduino and a USB host shield.

I changed my mind, this is MUCH MUCH better than what I was looking for :)

1) There was a hole inside me from my arduino times, as I didn't build anything really useful
2) I was looking for a way to get feedback from the keyboard, maybe from a rgb led, or a speaker

(1)+(2) is possible with this arduino+shield idea, so this is what I will be doing

Thank you for pointing me in the right direction :)

Is it still
https://www.sparkfun.com/products/11286
+
https://www.circuitsathome.com/products-page/arduino-shields/usb-host-shield-2-0-for-arduino-assembled/

for the best possible combination, or is there a better one?

If you dig through the USB-USB converter thread you'll see some folks have used Arduino clones, as well as a few different USB host shields, but clone boards don't have the best reputation, and you of all people, having bought several Infinities, can appreciate the value of knowing the components you're buying are made to spec. So if you're not buying one of hasu's ready-made converters (I think he's out of stock right now), then I would definitely recommend the official board and shield.

EDIT: I might make a full-size Arduino/shield version as well--use it on my desk and keep hasu's bite-sized one in my bag. I like the idea of using LEDs as state indicators for layers and such.
« Last Edit: Sun, 16 August 2015, 14:04:34 by njbair »

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 njbair

  • Posts: 2825
  • Location: Cleveland, Ohio
  • I love the Powerglove. It's so bad.
    • nickbair.net
Re: TMK keyboard firmware
« Reply #853 on: Sun, 16 August 2015, 14:08:50 »
This is a genius device, I remember looking for it some months ago, it didn't exist back then, it could have prevented me from seeking custom keyboards and layouts :)

However, currently I'm trying to build this: http://www.keyboard-layout-editor.com/#/gists/56cebe0eff4d8931c305 - so one way or another I'm going to get a 60% PCB, might as well get one that natively supports tmk_keyboard out of the box

Asked the winkeyless.kr guys recently, they seem to have new 60% PCB's, but since they use the ps2toavr framework, I'm unsure whether their pcb is practically compatible with tmk_keyboard

(Edit: I will buy that USBtoUSB converter anyway, just in case, If It's in stock, it would be nice to have around :)
(Edit 2: winkeyless.kr pcb's are not compatible as I'm told)
(Edit 3: would appreciate Nerd bootloader advice too, it seems simpler to just get a nerd and solve the bootloader challenge)

You've got so much invested in the Infinity board, maybe you can modify the PCBs and use the Enabler for the arrow keys and non-standard layout bits.

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: 3122
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: TMK keyboard firmware
« Reply #854 on: Sun, 16 August 2015, 20:32:18 »

As someone with a strong programming background but no experience with ARM, where should I start reading if I want to help with mbed support?

First you will have to learn mbed sdk cuz tmk uses it to make firmware available on many platforms as possible.

I started with reading docs on mbed.org and sdk source. Also I often had to check mcu reference manual to understand peripheral functions.

In tmk repository you can locate files supports mbed under core/common/mbed and core/protocol/mbed. Those files includes many empty functions as placeholder and should be implemented to support missing features.

TMK products:HHKB Alt  ⌨ConvertersAlps64FC660C AltFC980C Alt

Offline hasu

  • Thread Starter
  • Posts: 3122
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: TMK keyboard firmware
« Reply #855 on: Sun, 16 August 2015, 20:42:02 »
As someone with a strong programming background but no experience with ARM, where should I start reading if I want to help with mbed support?

I would say jump in the pool, but mbed is a mess right now (it won't compile on a Mac at the moment).

I'm kinda in the same boat. Feel I could help out, but I just don't have the patience to spend nights getting a dev environment working.
I think GCC 4.9 is needed to compile tmk with mbed for some reason.

Are you using 4.9? I don't know about how homebrew works but it seems to me like PX4 has some configurations for 4.6, 4.7, 4.8, 4.9 and 4.8 is installed by default.
https://github.com/PX4/homebrew-px4?files=1
TMK products:HHKB Alt  ⌨ConvertersAlps64FC660C AltFC980C Alt

Offline KHAANNN

  • Posts: 1642
Re: TMK keyboard firmware
« Reply #856 on: Mon, 17 August 2015, 01:27:26 »
This is a genius device, I remember looking for it some months ago, it didn't exist back then, it could have prevented me from seeking custom keyboards and layouts :)

However, currently I'm trying to build this: http://www.keyboard-layout-editor.com/#/gists/56cebe0eff4d8931c305 - so one way or another I'm going to get a 60% PCB, might as well get one that natively supports tmk_keyboard out of the box

Asked the winkeyless.kr guys recently, they seem to have new 60% PCB's, but since they use the ps2toavr framework, I'm unsure whether their pcb is practically compatible with tmk_keyboard

(Edit: I will buy that USBtoUSB converter anyway, just in case, If It's in stock, it would be nice to have around :)
(Edit 2: winkeyless.kr pcb's are not compatible as I'm told)
(Edit 3: would appreciate Nerd bootloader advice too, it seems simpler to just get a nerd and solve the bootloader challenge)

You've got so much invested in the Infinity board, maybe you can modify the PCBs and use the Enabler for the arrow keys and non-standard layout bits.

Indeed It could be useful to extend an 60% PCB to something 60%+, but I just add my non-standard switches to existing spaces on the PCB's by drilling

As someone with a strong programming background but no experience with ARM, where should I start reading if I want to help with mbed support?

I would say jump in the pool, but mbed is a mess right now (it won't compile on a Mac at the moment).

I'm kinda in the same boat. Feel I could help out, but I just don't have the patience to spend nights getting a dev environment working.
I think GCC 4.9 is needed to compile tmk with mbed for some reason.

Are you using 4.9? I don't know about how homebrew works but it seems to me like PX4 has some configurations for 4.6, 4.7, 4.8, 4.9 and 4.8 is installed by default.
https://github.com/PX4/homebrew-px4?files=1

I tried all OSX pre-compiled binaries, none of them work, I think someone needs to notify launchpad of this issue, since their objective is to make arm development easier (my perception), they should release a fixed binary for osx, similar to what they did for ubuntu/mbed
Endgame | 1.25 Cmd for GMK Sets Please | Or Just 1.25 Blanks Like The Good Old Days

Offline U47

  • Posts: 80
  • Location: YEG
Re: TMK keyboard firmware
« Reply #857 on: Mon, 17 August 2015, 23:05:53 »
As someone with a strong programming background but no experience with ARM, where should I start reading if I want to help with mbed support?

I would say jump in the pool, but mbed is a mess right now (it won't compile on a Mac at the moment).

I'm kinda in the same boat. Feel I could help out, but I just don't have the patience to spend nights getting a dev environment working.
I think GCC 4.9 is needed to compile tmk with mbed for some reason.

Are you using 4.9? I don't know about how homebrew works but it seems to me like PX4 has some configurations for 4.6, 4.7, 4.8, 4.9 and 4.8 is installed by default.
https://github.com/PX4/homebrew-px4?files=1

I've tried both 4.8 and 4.9. No luck. When I have some free time, I'll delve further, but I don't think there's an easy solution at the moment.

Seems others have just fired up Linux VPSs and compiled from there. I'm almost at that point.

Offline KHAANNN

  • Posts: 1642
Re: TMK keyboard firmware
« Reply #858 on: Tue, 18 August 2015, 02:36:02 »
I recently came across this PCB: https://mechanicalkeyboards.com/shop/index.php?l=product_detail&p=1352 (exciting)

It's very similar to the winkeyless.kr PCB's, I don't know what the difference is

I'm guessing this is also incompatible with tmk_keyboard?

the winkeyless.kr PCB's use atmega32a instead of the usual atmega32u4 - that's their source of incompatibility it seems
Endgame | 1.25 Cmd for GMK Sets Please | Or Just 1.25 Blanks Like The Good Old Days

Offline flabbergast

  • Posts: 234
  • Location: UK
Re: TMK keyboard firmware
« Reply #859 on: Tue, 18 August 2015, 02:47:44 »
I recently came across this PCB: https://mechanicalkeyboards.com/shop/index.php?l=product_detail&p=1352 (exciting)

It's very similar to the winkeyless.kr PCB's, I don't know what the difference is

I'm guessing this is also incompatible with tmk_keyboard?

the winkeyless.kr PCB's use atmega32a instead of the usual atmega32u4 - that's their source of incompatibility it seems
SPRiT's PCBs also use atmega32a + vusb library (no native USB support in the controller, it is bit-banged). SPRiT's and winkeyless PCBs are pretty much the same, the only difference is that winkeyless has support for bottom-side RGB LEDs and strips, while SPRiT's has no bottom-side LED support.

They both run more-less the same firmware (ps2avrU - or ps2avrGB for the RGB stuff) and use the same flash configurator for layouts. This is the only firmware I know of that runs on these boards. There are some sources on github, but I don't know if those are updated by any of the korean guys, so they may be out of date.

Offline KHAANNN

  • Posts: 1642
Re: TMK keyboard firmware
« Reply #860 on: Tue, 18 August 2015, 03:34:21 »
I recently came across this PCB: https://mechanicalkeyboards.com/shop/index.php?l=product_detail&p=1352 (exciting)

It's very similar to the winkeyless.kr PCB's, I don't know what the difference is

I'm guessing this is also incompatible with tmk_keyboard?

the winkeyless.kr PCB's use atmega32a instead of the usual atmega32u4 - that's their source of incompatibility it seems
SPRiT's PCBs also use atmega32a + vusb library (no native USB support in the controller, it is bit-banged). SPRiT's and winkeyless PCBs are pretty much the same, the only difference is that winkeyless has support for bottom-side RGB LEDs and strips, while SPRiT's has no bottom-side LED support.

They both run more-less the same firmware (ps2avrU - or ps2avrGB for the RGB stuff) and use the same flash configurator for layouts. This is the only firmware I know of that runs on these boards. There are some sources on github, but I don't know if those are updated by any of the korean guys, so they may be out of date.

That's extremely informative, thank you

I'm mainly considering them to sit behind the USB+USB converter method of tmk, but just wanted to ask whether there is work done to adapt them natively to tmk_keyboard
Endgame | 1.25 Cmd for GMK Sets Please | Or Just 1.25 Blanks Like The Good Old Days

Offline flabbergast

  • Posts: 234
  • Location: UK
Re: TMK keyboard firmware
« Reply #861 on: Tue, 18 August 2015, 03:42:54 »
I'm mainly considering them to sit behind the USB+USB converter method of tmk, but just wanted to ask whether there is work done to adapt them natively to tmk_keyboard
There is some vusb support in TMK, but AFAIK hasu is not working on that anymore, and it was originally intended for a couple of small boards (ps2_usb and onekey).

(Plug: I have a spare atmega32u4 based Chinese 60% PCB: https://geekhack.org/index.php?topic=73453 )

Offline a-c

  • Posts: 196
  • Location: USA
Re: TMK keyboard firmware
« Reply #862 on: Tue, 18 August 2015, 13:03:17 »
I recently came across this PCB: https://mechanicalkeyboards.com/shop/index.php?l=product_detail&p=1352 (exciting)

It's very similar to the winkeyless.kr PCB's, I don't know what the difference is

I'm guessing this is also incompatible with tmk_keyboard?

the winkeyless.kr PCB's use atmega32a instead of the usual atmega32u4 - that's their source of incompatibility it seems
SPRiT's PCBs also use atmega32a + vusb library (no native USB support in the controller, it is bit-banged). SPRiT's and winkeyless PCBs are pretty much the same, the only difference is that winkeyless has support for bottom-side RGB LEDs and strips, while SPRiT's has no bottom-side LED support.

They both run more-less the same firmware (ps2avrU - or ps2avrGB for the RGB stuff) and use the same flash configurator for layouts. This is the only firmware I know of that runs on these boards. There are some sources on github, but I don't know if those are updated by any of the korean guys, so they may be out of date.

That's extremely informative, thank you

I'm mainly considering them to sit behind the USB+USB converter method of tmk, but just wanted to ask whether there is work done to adapt them natively to tmk_keyboard

These boards also do PS2. PS2 is easier to interface with than USB. No need for a USB Host shield.
http://playground.arduino.cc/Main/PS2Keyboard

Offline KHAANNN

  • Posts: 1642
Re: TMK keyboard firmware
« Reply #863 on: Tue, 18 August 2015, 13:39:14 »
These boards also do PS2. PS2 is easier to interface with than USB. No need for a USB Host shield.
http://playground.arduino.cc/Main/PS2Keyboard

Interesting, how do they output PS2, do you utilise connections of the existing USB connection in this case, or manually wire an arduino to the keyboard?

In any case, a USB shield seems simpler (USB to USB board of hasu is obviously much much simpler, but it's out of stock as njbair mentioned, If anyone is selling one, I'm interested (very interested))

Endgame | 1.25 Cmd for GMK Sets Please | Or Just 1.25 Blanks Like The Good Old Days

Offline njbair

  • Posts: 2825
  • Location: Cleveland, Ohio
  • I love the Powerglove. It's so bad.
    • nickbair.net
Re: TMK keyboard firmware
« Reply #864 on: Tue, 18 August 2015, 14:15:12 »
These boards also do PS2. PS2 is easier to interface with than USB. No need for a USB Host shield.
http://playground.arduino.cc/Main/PS2Keyboard

Interesting, how do they output PS2, do you utilise connections of the existing USB connection in this case, or manually wire an arduino to the keyboard?

In any case, a USB shield seems simpler (USB to USB board of hasu is obviously much much simpler, but it's out of stock as njbair mentioned, If anyone is selling one, I'm interested (very interested))

Now I'm curious, hasu also makes a PS/2 to USB converter. I wonder if that would work with a USB keyboard and one of these:


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 a-c

  • Posts: 196
  • Location: USA
Re: TMK keyboard firmware
« Reply #865 on: Tue, 18 August 2015, 14:59:30 »
Pinout for those USB to PS2 adapters
USB -> PS2
1 -> +5
2 -> data
3 -> clock
4 -> gnd

Hasu has it all figure out already. You just need a Teensy2.0

https://github.com/tmk/tmk_keyboard/tree/master/converter/ps2_usb

Offline KHAANNN

  • Posts: 1642
Re: TMK keyboard firmware
« Reply #866 on: Wed, 19 August 2015, 05:29:46 »
Pinout for those USB to PS2 adapters
USB -> PS2
1 -> +5
2 -> data
3 -> clock
4 -> gnd

Hasu has it all figure out already. You just need a Teensy2.0

https://github.com/tmk/tmk_keyboard/tree/master/converter/ps2_usb

So, is it possible to, get a FaceW PCB, put it in PS2 Mode

Connect it via USB to the USB-PS2 - connect the PS2 to a Teensy 2.0, and use Teensy 2.0 with tmk_keyboard to re-write the PS2/NKRO output to NKRO again?
(I'm assuming the USB to PS2 adapter is mostly aesthetical in this case, making it practical to connect the USB to Teensy)

It's extremely hoopy (Edit: or the exact opposite, as it seems)

I have a WASD V2 that supposedly works in PS2 mode, I also have a Teensy that I bought and never used, if this works, I would like to try it, would really appreciate some guidance at this point

It seems awfully simple from: https://github.com/tmk/tmk_keyboard/tree/master/converter/ps2_usb - I just don't know which PS2 pins are Clock, Data, VCC and GND and where to put the optional pull up resistor - but I have the components at hand like I mentioned, and I'm very eager to try it out

Edit: Found the PS2 pins ... :) - At this point the only question is how to apply the pull up resistor
Edit 2: Compiled the ps2 to usb converter at osx, no issues there, got the .hex, what is the AVR way to push it too Teensy 2.0 by the way? (dfu-util/dfu-programmer?)
Edit 3: Found pretty much all the information I need at this point, going to start experimenting soon (pull up resistors to Data and Clock: https://geekhack.org/index.php?topic=17458.0 )
« Last Edit: Wed, 19 August 2015, 07:08:57 by KHAANNN »
Endgame | 1.25 Cmd for GMK Sets Please | Or Just 1.25 Blanks Like The Good Old Days

Offline VinnyCordeiro

  • Posts: 432
Re: TMK keyboard firmware
« Reply #867 on: Wed, 19 August 2015, 08:07:29 »
Edit: Found the PS2 pins ... :) - At this point the only question is how to apply the pull up resistor
Connect a resistor between the line you want to pull-up and Vcc. Simply that. Just need to know the value, but something between 1k and 10k ohms should be enough.

Offline flabbergast

  • Posts: 234
  • Location: UK
Re: TMK keyboard firmware
« Reply #868 on: Wed, 19 August 2015, 08:50:54 »
Edit 2: Compiled the ps2 to usb converter at osx, no issues there, got the .hex, what is the AVR way to push it too Teensy 2.0 by the way? (dfu-util/dfu-programmer?)
Teensys have a special bootloader written by Paul. There's a command-line utility for uploading: https://www.pjrc.com/teensy/loader_cli.html or also a GUI: https://www.pjrc.com/teensy/loader.html

Offline KHAANNN

  • Posts: 1642
Re: TMK keyboard firmware
« Reply #869 on: Wed, 19 August 2015, 09:05:13 »
Edit 2: Compiled the ps2 to usb converter at osx, no issues there, got the .hex, what is the AVR way to push it too Teensy 2.0 by the way? (dfu-util/dfu-programmer?)
Teensys have a special bootloader written by Paul. There's a command-line utility for uploading: https://www.pjrc.com/teensy/loader_cli.html or also a GUI: https://www.pjrc.com/teensy/loader.html

Thanks for the pull-up info Vinny, I'm thinking of using a 5K resistor

Off topic, the Teensy pulls 0.03A alone by the way (the infinity PCB was 0.01A, as a minor comparison)

Anyway, thanks so so much flabbergast - I managed to hex with with the cli tool you linked

At this point I only know that it pulls 0.03A, going to wire things soon
Endgame | 1.25 Cmd for GMK Sets Please | Or Just 1.25 Blanks Like The Good Old Days

Offline mrflow3r

  • Posts: 158
  • Location: Vancouver
    • T
Re: TMK keyboard firmware
« Reply #870 on: Wed, 19 August 2015, 09:46:52 »

As someone with a strong programming background but no experience with ARM, where should I start reading if I want to help with mbed support?

First you will have to learn mbed sdk cuz tmk uses it to make firmware available on many platforms as possible.

I started with reading docs on mbed.org and sdk source. Also I often had to check mcu reference manual to understand peripheral functions.

In tmk repository you can locate files supports mbed under core/common/mbed and core/protocol/mbed. Those files includes many empty functions as placeholder and should be implemented to support missing features.



Hasu, may I ask which mbed board you like the most? I am pretty sure you have mentioned it somewhere in the forum, but it's hard to search for it!
 

Offline flabbergast

  • Posts: 234
  • Location: UK
Re: TMK keyboard firmware
« Reply #871 on: Wed, 19 August 2015, 09:56:44 »
Off topic, the Teensy pulls 0.03A alone by the way (the infinity PCB was 0.01A, as a minor comparison)
30mA sounds too much, these AVR chips should normally run on about 15mA. This can be lowered by turning off some unneeded features (ADC, SPI, I2C, ...) The biggest hogs are of course USB and the 16MHz clock, which can't be turned off if you're using USB... But generally speaking I am running a couple of wireless sensors with atmegas which last about half a year on a coin cell battery (of course the mega sleeps most of the time :)

Offline KHAANNN

  • Posts: 1642
Re: TMK keyboard firmware
« Reply #872 on: Wed, 19 August 2015, 10:16:22 »
Off topic, the Teensy pulls 0.03A alone by the way (the infinity PCB was 0.01A, as a minor comparison)
30mA sounds too much, these AVR chips should normally run on about 15mA. This can be lowered by turning off some unneeded features (ADC, SPI, I2C, ...) The biggest hogs are of course USB and the 16MHz clock, which can't be turned off if you're using USB... But generally speaking I am running a couple of wireless sensors with atmegas which last about half a year on a coin cell battery (of course the mega sleeps most of the time :)

I have a hunch it might be the PS2 method that's pulling too much ma, because it was initially around 0.01A before the new .hex

Going to test the other methods now: https://github.com/tmk/tmk_keyboard/tree/master/converter/ps2_usb

PS2_USE_BUSYWAIT is default, PS2_USE_INT is recommended, PS2_USE_USART seems native (+ recommended in the Makefile)

I think I'm going to go with the USART, although I have no idea how these methods practically differ, whether any of these methods is capable of errors etc.
Endgame | 1.25 Cmd for GMK Sets Please | Or Just 1.25 Blanks Like The Good Old Days

Offline a-c

  • Posts: 196
  • Location: USA
Re: TMK keyboard firmware
« Reply #873 on: Wed, 19 August 2015, 11:31:17 »
BUSYWAIT is high CPU usage. It is constantly checking to see if there is incoming data. The interrupt method or UART will use built in hardware triggers so the chip is mostly idle when nothing is incoming.

Offline KHAANNN

  • Posts: 1642
Re: TMK keyboard firmware
« Reply #874 on: Wed, 19 August 2015, 17:41:44 »
My experiments failed miserably

I couldn't make it work with the WASD V2

On idle, the Teensy pulls 20ma, when connected to the WASD V2 with the adapter njbair posted, it pulls 170-180ma

I have no idea how to continue from here



My initial mistake was to connect the clock to VCC, as the labelling is extremely misleading, corrected that now, but nothing changed (The WASD V2 functions in USB mode - so it's not one of the things I fried)

Used the USART mode, made sure to clean and re-make, verified the connections from here: https://en.wikipedia.org/wiki/PS/2_port - used 4.7K pull-up resistors

Edit: After getting a good nights sleep, I have a hunch I made a male/female confusion, I probably need to mirror my PS/2 connections ...
Edit 2: Correctly wired, it works great :)
Edit 3: Definitely a great way to add NKRO and programmability to keyboards like WASD V2, or any PS/2 for that matter :) - 0.02/0.03A when correctly wired by the way, power usage doesn't change much with the PS/2 mode
« Last Edit: Thu, 20 August 2015, 03:19:11 by KHAANNN »
Endgame | 1.25 Cmd for GMK Sets Please | Or Just 1.25 Blanks Like The Good Old Days

Offline adevriesc

  • Posts: 35
Re: TMK keyboard firmware
« Reply #875 on: Wed, 19 August 2015, 19:51:02 »
How do you connect LEDs to a Teensy and associate them with the state of a Caps Lock/Num Lock key? I haven't been able to find explicit information on the process anywhere.

Offline a-c

  • Posts: 196
  • Location: USA
Re: TMK keyboard firmware
« Reply #876 on: Wed, 19 August 2015, 20:57:12 »
How do you connect LEDs to a Teensy and associate them with the state of a Caps Lock/Num Lock key? I haven't been able to find explicit information on the process anywhere.

https://github.com/tmk/tmk_keyboard/blob/master/keyboard/phantom/led.c
Look at the led.c in each of the different keyboards. They do it in different ways.

Offline flabbergast

  • Posts: 234
  • Location: UK
Re: TMK keyboard firmware
« Reply #877 on: Thu, 20 August 2015, 02:22:35 »
How do you connect LEDs to a Teensy and associate them with the state of a Caps Lock/Num Lock key? I haven't been able to find explicit information on the process anywhere.

https://github.com/tmk/tmk_keyboard/blob/master/keyboard/phantom/led.c
Look at the led.c in each of the different keyboards. They do it in different ways.
On the hardware side, you want <Teensy pin> --- <resistor> --- LED --- ground.
(you can do Vcc instead of Ground, or swap the LED and the resistor). For instance, Phantom's led.c assumes that the Caps Lock LED is connected like this with <Teensy pin> being B6. Taking that ping HIGH will light up the led, taking it LOW (or HI-Z) will switch the led off.

Offline nephiel

  • Posts: 129
  • Location: Spain
Re: TMK keyboard firmware
« Reply #878 on: Thu, 20 August 2015, 07:50:18 »
You can also use the Teensy built-in LED on PD6 for testing, it's active high IIRC.
Stop wasting space! Chop your spacebar into bits!
NPH60: a custom 60% w/TrackPoint & split spacebar

Offline AKmalamute

  • HHKB Scrub
  • Posts: 827
  • Location: Western WA, USA
Re: TMK keyboard firmware
« Reply #879 on: Thu, 20 August 2015, 23:25:44 »
Can you post your keymap.c/keymap.h file?

Yeah;  now that I'm at a computer, and in particular my computer has been upgraded & reassembled, here you go:
http://pastebin.com/cewgDXka  That's the keymap file, where I'm surely making some silly mistake,
http://pastebin.com/84FjhZxB  And the keymap.h file I haven't needed to do anything with.

 Poked my head in IRC, but nobody familiar with TMK was around. I've looked it over and compared to the presumably working hasu keymap and I can't see why the wrong 'layer' is selected as default. Anyone want to make any suggestions?

 How does the firmware know what 'layer' is default? It's by what order they're written in, right? Should I just shove a "make (0) default again" action key on the bottom layer?

 ...Can somebody remind me of how to do that?

EDIT: I may not be quite as dumb as I feel. Aquakeys test says the left gui key is being held down. Also the right control is more or less being held down (hitting my working keyboard's r-ctrl untoggles the held-down color) and another, rather odd choice, the ] key shows it gets tapped every time I plug the ALPS board in.

 So while the soldering job looks fine, I'd say there are a couple damaged keyswitches in there, and one of them is my FN0 button.

Dang.
« Last Edit: Fri, 21 August 2015, 00:05:45 by AKmalamute »

HHKB-lite2, Dvorak user

Offline hasu

  • Thread Starter
  • Posts: 3122
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: TMK keyboard firmware
« Reply #880 on: Fri, 21 August 2015, 01:38:42 »
Hmm, OK.
Then we really need a C++ wizrd with GCC toolchain savvy now :D

After some google searches I got my next random guess :)
From my understandings GCC provides 'libstdc++' as standard library while LLVM clang is developing 'libc++'. TMK can be compiled normally with GCC and libstdc++ on Linux. I guess GCC uses libc++ unintentionally for some reason on Mac and TMK/mbed code are not compatible to libc++.

Do you have libc++ somewhere on you Mac? What if it is uninstalled?
I think Homebrew or Xcode may install the library.

I don't have certain knowledge of GCC and C++, this may be completely wrong.

https://gcc.gnu.org/libstdc++/
http://libcxx.llvm.org/
https://github.com/Homebrew/homebrew/blob/master/share/doc/homebrew/C%2B%2B-Standard-Libraries.md


As someone with a strong programming background but no experience with ARM, where should I start reading if I want to help with mbed support?

I would say jump in the pool, but mbed is a mess right now (it won't compile on a Mac at the moment).

I'm kinda in the same boat. Feel I could help out, but I just don't have the patience to spend nights getting a dev environment working.
I think GCC 4.9 is needed to compile tmk with mbed for some reason.

Are you using 4.9? I don't know about how homebrew works but it seems to me like PX4 has some configurations for 4.6, 4.7, 4.8, 4.9 and 4.8 is installed by default.
https://github.com/PX4/homebrew-px4?files=1

I've tried both 4.8 and 4.9. No luck. When I have some free time, I'll delve further, but I don't think there's an easy solution at the moment.

Seems others have just fired up Linux VPSs and compiled from there. I'm almost at that point.




As someone with a strong programming background but no experience with ARM, where should I start reading if I want to help with mbed support?

I would say jump in the pool, but mbed is a mess right now (it won't compile on a Mac at the moment).

I'm kinda in the same boat. Feel I could help out, but I just don't have the patience to spend nights getting a dev environment working.
I think GCC 4.9 is needed to compile tmk with mbed for some reason.

Are you using 4.9? I don't know about how homebrew works but it seems to me like PX4 has some configurations for 4.6, 4.7, 4.8, 4.9 and 4.8 is installed by default.
https://github.com/PX4/homebrew-px4?files=1

I tried all OSX pre-compiled binaries, none of them work, I think someone needs to notify launchpad of this issue, since their objective is to make arm development easier (my perception), they should release a fixed binary for osx, similar to what they did for ubuntu/mbed

TMK products:HHKB Alt  ⌨ConvertersAlps64FC660C AltFC980C Alt

Offline hasu

  • Thread Starter
  • Posts: 3122
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: TMK keyboard firmware
« Reply #881 on: Fri, 21 August 2015, 02:09:36 »

As someone with a strong programming background but no experience with ARM, where should I start reading if I want to help with mbed support?

First you will have to learn mbed sdk cuz tmk uses it to make firmware available on many platforms as possible.

I started with reading docs on mbed.org and sdk source. Also I often had to check mcu reference manual to understand peripheral functions.

In tmk repository you can locate files supports mbed under core/common/mbed and core/protocol/mbed. Those files includes many empty functions as placeholder and should be implemented to support missing features.



Hasu, may I ask which mbed board you like the most? I am pretty sure you have mentioned it somewhere in the forum, but it's hard to search for it!

I like NXP controllers and respect their effort and work on mbed.org. But I don't know about other vendor's controllers enough for comparison.

I don't like Freescale's coding work of mbed SDK but their FDRM boards are attractive due to OpenSDA. With loading OpenSDA app you can use the board as  Segger J-Link lite compatible debugger.
https://segger.com/opensda.html

Just FYI, Cortex boards I currently have:
https://developer.mbed.org/platforms/TG-LPC11U35-501/
https://developer.mbed.org/platforms/mbed-HRM1017/
FRDM-KL05Z
STM32F3discovery

To be honest I don't have much experience on Cortex. You may want to check this thread, instead.
http://deskthority.net/workshop-f7/alternative-controller-experiments-t8735.html
« Last Edit: Fri, 21 August 2015, 02:11:16 by hasu »
TMK products:HHKB Alt  ⌨ConvertersAlps64FC660C AltFC980C Alt

Offline njbair

  • Posts: 2825
  • Location: Cleveland, Ohio
  • I love the Powerglove. It's so bad.
    • nickbair.net
Re: TMK keyboard firmware
« Reply #882 on: Fri, 21 August 2015, 08:18:27 »
I'm just going to post about an issue I had while configuring a layout, in the hopes that I might save someone else some grief down the road.

Basically, I wanted to make a function layer to switch between some different keyboard layouts (QWERTY, Dvorak, etc.). I chose the Menu key because I never use it. So Menu+Q for QWERTY, Menu+D for Dvorak, Menu+G for my gaming layout, etc. To do this, I had to create a special Fn layer, and by default I used NO for all keys besides Q, D, and G. But when I flashed the firmware, the layout switching didn't work. What's more, the entire keyboard stopped working. I had to unplug it and plug it back in to get it to work. I tried using different keys for Fn, but they all had the same result.

Eventually, I realized that when I configured my switching layer, I set the Fn key to NO. So basically the keyboard was switching to the Fn layer, but never un-switching because the Fn key had been remapped.

So the moral of the story is, always use TRNS for Fn keys.

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 mrflow3r

  • Posts: 158
  • Location: Vancouver
    • T
Re: TMK keyboard firmware
« Reply #883 on: Fri, 21 August 2015, 11:55:58 »

As someone with a strong programming background but no experience with ARM, where should I start reading if I want to help with mbed support?

First you will have to learn mbed sdk cuz tmk uses it to make firmware available on many platforms as possible.

I started with reading docs on mbed.org and sdk source. Also I often had to check mcu reference manual to understand peripheral functions.

In tmk repository you can locate files supports mbed under core/common/mbed and core/protocol/mbed. Those files includes many empty functions as placeholder and should be implemented to support missing features.



Hasu, may I ask which mbed board you like the most? I am pretty sure you have mentioned it somewhere in the forum, but it's hard to search for it!

I like NXP controllers and respect their effort and work on mbed.org. But I don't know about other vendor's controllers enough for comparison.

I don't like Freescale's coding work of mbed SDK but their FDRM boards are attractive due to OpenSDA. With loading OpenSDA app you can use the board as  Segger J-Link lite compatible debugger.
https://segger.com/opensda.html

Just FYI, Cortex boards I currently have:
https://developer.mbed.org/platforms/TG-LPC11U35-501/
https://developer.mbed.org/platforms/mbed-HRM1017/
FRDM-KL05Z
STM32F3discovery

To be honest I don't have much experience on Cortex. You may want to check this thread, instead.
http://deskthority.net/workshop-f7/alternative-controller-experiments-t8735.html
Thanks for the answers Hasu, these great looking little boards. I guess I will just get a few NXP based Mbeds to play with. Freecsale seems to have a really good community of developers, but it looks like it's mostly ARM/embedded linux stuff.

Curious, why did you pick Mbed, say over Teensy? Thanks and I appreciate all the great work you have done and support to this community.
 

Offline nalui333

  • Posts: 10
Re: TMK keyboard firmware
« Reply #884 on: Sat, 05 September 2015, 08:57:30 »
Hi folks, a little help if you could, i setup a 64 key (32keys each hand) split keyboard. I got one half of the keyboard working with easy avr firmware but could not get the other half working with the exception of one or two keys. I've checked and triple checked the connections and they all seem to be fine. So i decided to go the tmk route since i could dig into the code.

Now after compiling the firmware and loading with the teensy loader none of the keys in any of the halves output anything when pressed. My desktop is linux if that matters. I'm not using leds so i dropped them from the pinout I'm using the gh60 as a base per matt3o directions

files are at the links below
matrix.c :                    http://pastebin.com/Mz7VyrkQ
config.h :                    http://pastebin.com/yMJuJfAs
keymap_common.c : http://pastebin.com/qhmJZHM8
keymap_common.h : http://pastebin.com/tEAuA8Nz
keymap_poker.c        http://pastebin.com/bG7QPv36

Update:
letf hand schematic is as follows : http://ibin.co/2Ec5qvQgqrHp
right hand schematic is as follows : http://ibin.co/2Ec6ZsucNLTZ

I'm using a simple short cable between both halves no port expanders. I'm using a teensy 2 as the controller.
Any and all help is appreciated.
« Last Edit: Sat, 05 September 2015, 10:18:24 by nalui333 »

Offline hasu

  • Thread Starter
  • Posts: 3122
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: TMK keyboard firmware
« Reply #885 on: Sat, 05 September 2015, 09:17:51 »
you can post schematic or pics of your keyboard wiring to get more precise help.
without knowing keyboard hardware anyone won't be able to check if source codes are really correct or not.
TMK products:HHKB Alt  ⌨ConvertersAlps64FC660C AltFC980C Alt

Offline a-c

  • Posts: 196
  • Location: USA
Re: TMK keyboard firmware
« Reply #886 on: Sat, 05 September 2015, 10:26:32 »
Hi folks, a little help if you could, i setup a 64 key (32keys each hand) split keyboard. I got one half of the keyboard working with easy avr firmware but could not get the other half working with the exception of one or two keys. I've checked and triple checked the connections and they all seem to be fine. So i decided to go the tmk route since i could dig into the code.

Now after compiling the firmware and loading with the teensy loader none of the keys in any of the halves output anything when pressed. My desktop is linux if that matters. I'm not using leds so i dropped them from the pinout I'm using the gh60 as a base per matt3o directions

files are at the links below
matrix.c :                    http://pastebin.com/Mz7VyrkQ
config.h :                    http://pastebin.com/yMJuJfAs
keymap_common.c : http://pastebin.com/qhmJZHM8
keymap_common.h : http://pastebin.com/tEAuA8Nz
keymap_poker.c        http://pastebin.com/bG7QPv36

Update:
letf hand schematic is as follows : http://ibin.co/2Ec5qvQgqrHp
right hand schematic is as follows : http://ibin.co/2Ec6ZsucNLTZ

I'm using a simple short cable between both halves no port expanders. I'm using a teensy 2 as the controller.
Any and all help is appreciated.

Because of the direction you have your diodes installed what you call rows are columns in TMK, and columns are rows.

Offline nalui333

  • Posts: 10
Re: TMK keyboard firmware
« Reply #887 on: Sat, 05 September 2015, 11:43:10 »
Thanks will make changes and see..

quick question does that mean i have to change the keymap array sequence?

Update 09/19/2015
for future reference or for any newb that stumbles on this if you don't want to resolder you can make your keymap_common.h look something like this....

 KEYMAP( \
       K01,   K02,   K03,  \
K10,   K11,   K12,   K13,        \
K20,   K21,   K22,   K23,   K24, \
K30,   K31,   K32,   K33,   K34, \
K40,   K41,   K42,   K43,   K44, \
K50,   K51,   K52,   K53,   K54, \
K60,   K61,   K62,   K63,   K64, \
K70,   K71,   K72,   K73,   K74, \
K80,   K81,   K82,   K83,   K84, \
K90,   K91,   K92,   K93,   K94, \
KA0,   KA1,   KA2,   KA3,   KA4, \
KB0,   KB1,   KB2,   KB3,   KB4, \
KC0,   KC1,   KC2,   KC3,        \
       KD1,   KD2,   KD3    ){ \
    {  KC_NO,    KC_##K01,  KC_##K02,  KC_##K03,  KC_NO }, \
    {  KC_##K10, KC_##K11,  KC_##K12,  KC_##K13,  KC_NO }, \
    {  KC_##K20, KC_##K21,  KC_##K22,  KC_##K23,  KC_##K24 }, \
    {  KC_##K30, KC_##K31,  KC_##K32,  KC_##K33,  KC_##K34 }, \
    {  KC_##K40, KC_##K41,  KC_##K42,  KC_##K43,  KC_##K44 }, \
    {  KC_##K50, KC_##K51,  KC_##K52,  KC_##K53,  KC_##K54 }, \
    {  KC_##K60, KC_##K61,  KC_##K62,  KC_##K63,  KC_##K64 }, \
    {  KC_##K70, KC_##K71,  KC_##K72,  KC_##K73,  KC_##K74 }, \
    {  KC_##K80, KC_##K81,  KC_##K82,  KC_##K83,  KC_##K84 }, \
    {  KC_##K90, KC_##K91,  KC_##K92,  KC_##K93,  KC_##K94 }, \
    {  KC_##KA0, KC_##K31,  KC_##K32,  KC_##K33,  KC_##K34 }, \
    {  KC_##KB0, KC_##K31,  KC_##K32,  KC_##K33,  KC_##K34 }, \
    {  KC_##KC0, KC_##K31,  KC_##K32,  KC_##K33,  KC_NO }, \
    {  KC_NO,    KC_##K31,  KC_##K32,  KC_##K33,  KC_NO } \

 and change your keymap_poker.c to look something like this

    KEYMAP(   
      INS,  QUOT, RCTL, \
0,    SCLN, O,    SLSH,      \   
9,    Y,    I,    DOT,  FN1, \
8,    U,    E,    COMM, RSFT, \
7,    L,    N,    M,    RALT, \
6,    J,    H,    K,    ENT, \
EQL,  END,  TAB,  RGUI, BSPC, \
MINS, HOME, ESC,  LGUI, DELETE, \
5,    G,    D,    B,    SPC, \
4,    P,    T,    V,    LALT, \
3,    F,    S,    C,    LSFT, \
2,    W,    R,    X,    FN1, \
1,    Q,    A,    Z,  \
      CAPS, BSLS, LCTL),

......and so on....

Update:

I made the above changes and got some output as opposed to before with no output.

Though at this time, there's a lot of gibberish and the left hand still doesn't work. 

Update 9/08:

All of the left side works well now (there was a bad switch), 3 out of 5 keys in the right half print something but they print a mirror of what's in the left side, the journey continues.

Update 09/19:

seems my choice of cables and choice of connectors between my left and right halves were making it difficult for the (left) non teensy side) to not get the signal. will have to ghetto-ize the prototype for it to work.

Thanks and appreciations to all who helped.
« Last Edit: Sat, 19 September 2015, 15:55:39 by nalui333 »

Offline Eszett

  • Posts: 493
  • Supporting the communities Geekhack & Deskthority
Re: TMK keyboard firmware
« Reply #888 on: Mon, 07 September 2015, 03:12:14 »
Is TMK firmware by default strobing cols or rows?

Offline hasu

  • Thread Starter
  • Posts: 3122
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: TMK keyboard firmware
« Reply #889 on: Mon, 07 September 2015, 14:22:41 »
I'd say it depends on hardware but as for gh60 it is rows.
In TMK it is natual to strobe rows and sense cols but row and col are just names not matter.
TMK products:HHKB Alt  ⌨ConvertersAlps64FC660C AltFC980C Alt

Offline Eszett

  • Posts: 493
  • Supporting the communities Geekhack & Deskthority
Re: TMK keyboard firmware
« Reply #890 on: Tue, 08 September 2015, 04:27:02 »
I'd say it depends on hardware but as for gh60 it is rows.
In TMK it is natual to strobe rows and sense cols but row and col are just names not matter.

Domo arigatou, hasu! Yes, they are names, only polarity matters. When I use a Teensy2.0 which senses/polls/reads with pull-up resistors (HIGH), then the polarity of strobes is LOW. That means the current flows like this

col(sensing with pull-up resistor) >> diode(+) >> diode(-) >> switch >> row(strobing LOW) 

is that correct?

Offline hasu

  • Thread Starter
  • Posts: 3122
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: TMK keyboard firmware
« Reply #891 on: Tue, 08 September 2015, 04:42:50 »
Correct.
TMK products:HHKB Alt  ⌨ConvertersAlps64FC660C AltFC980C Alt

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 #892 on: Tue, 08 September 2015, 23:07:58 »
I modified onekey to work with my 1% test board tonight with the intention of having it send LGUI+Tab (mac app switch key combo.) It works great except that when I hold the switch down TMK seems to send key-down+key-up codes every half second or so rather than sending key-down when pressed and key-up when released. Here's my keymap code:

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

const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
    /* 0: qwerty
     * ,---.
     * |FN0|
     * `---`
     */
    KEYMAP(FN0),
};

const uint16_t PROGMEM fn_actions[] = {
    [0] = ACTION_MODS_KEY(MOD_LGUI, KC_TAB)
};

Is this expected behavior for that code? If so how can I have it send key down/up events rather than repeatedly pressing the key?

Offline hasu

  • Thread Starter
  • Posts: 3122
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: TMK keyboard firmware
« Reply #893 on: Tue, 08 September 2015, 23:34:07 »
TMK firmware itself has no reapeating feature like most of modern USB keyboards. I think what you saw is OS auto key repeating.
So it is expected behaviour.
TMK products:HHKB Alt  ⌨ConvertersAlps64FC660C AltFC980C Alt

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 #894 on: Tue, 08 September 2015, 23:55:53 »
TMK firmware itself has no reapeating feature like most of modern USB keyboards. I think what you saw is OS auto key repeating.
So it is expected behaviour.

Ah, I see why that is. I see the same behavior when I hold cmd-tab on the keyboard. I should have realized this, the behavior I actually want is this:

  • Press key down
  • TMK sends key-down for LGUI + Tab
  • TMK sends key-up for Tab but not LGUI
  • Release key
  • TMK sends key-up for LGUI

Is such a thing possible in TMK currently?

Offline hasu

  • Thread Starter
  • Posts: 3122
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: TMK keyboard firmware
« Reply #895 on: Wed, 09 September 2015, 00:21:36 »
It is possible with macro or function. But you need to be patient to learn it without documentations. You will have to read many codes to know how it works.

See my Alt+Tab macro, it is not exactly what you described but similar.
https://github.com/tmk/tmk_keyboard/blob/master/keyboard/hhkb/keymap_hasu.c#L233-L236
TMK products:HHKB Alt  ⌨ConvertersAlps64FC660C AltFC980C Alt

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 #896 on: Wed, 09 September 2015, 08:23:13 »
It is possible with macro or function. But you need to be patient to learn it without documentations. You will have to read many codes to know how it works.

See my Alt+Tab macro, it is not exactly what you described but similar.
https://github.com/tmk/tmk_keyboard/blob/master/keyboard/hhkb/keymap_hasu.c#L233-L236

Thanks for the pointer. I have this working but it doesn't behave the way I expect. When I have this code:

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

Pressing the key down behaves as I expect, LGUI is pressed down and a tab is typed. However, LGUI is not released when I let go of the key. If I press the key multiple times tab is sent multiple times, but LGUI is never released. I get the same behavior when I try this MACRO():

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

Am I doing something wrong here? If I understand correctly the first MACRO() should be run when the key is pressed, and the second when the key is released, right? Why isn't U(LGUI) releasing the key?

Offline hasu

  • Thread Starter
  • Posts: 3122
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: TMK keyboard firmware
« Reply #897 on: Wed, 09 September 2015, 16:23:19 »
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);
                 }
TMK products:HHKB Alt  ⌨ConvertersAlps64FC660C AltFC980C Alt

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 #898 on: Thu, 10 September 2015, 17:16:19 »
I applied the patch but nothing changed, even after a "make clean && make && make dfu". I tried running hid_listen but while it finds the device after I plug it in it doesn't output any messages.

Offline hasu

  • Thread Starter
  • Posts: 3122
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: TMK keyboard firmware
« Reply #899 on: Thu, 10 September 2015, 18:43:31 »
It works for me. This is output of xev on Xorg.
Your problem may be different but I can't come up with.

Code: [Select]
KeyPress event, serial 37, synthetic NO, window 0x4a00001,
    root 0x246, subw 0x0, time 4186601381, (-316,206), root:(395,738),
    state 0x10, keycode 133 (keysym 0xffeb, Super_L), same_screen YES,
    XLookupString gives 0 bytes:
    XmbLookupString gives 0 bytes:
    XFilterEvent returns: False

KeyPress event, serial 37, synthetic NO, window 0x4a00001,
    root 0x246, subw 0x0, time 4186601389, (-316,206), root:(395,738),
    state 0x50, keycode 23 (keysym 0xff09, Tab), same_screen YES,
    XLookupString gives 1 bytes: (09) " "
    XmbLookupString gives 1 bytes: (09) "       "
    XFilterEvent returns: False

KeyRelease event, serial 37, synthetic NO, window 0x4a00001,
    root 0x246, subw 0x0, time 4186601397, (-316,206), root:(395,738),
    state 0x50, keycode 23 (keysym 0xff09, Tab), same_screen YES,
    XLookupString gives 1 bytes: (09) " "
    XFilterEvent returns: False

KeyRelease event, serial 37, synthetic NO, window 0x4a00001,
    root 0x246, subw 0x0, time 4186601437, (-316,206), root:(395,738),
    state 0x50, keycode 133 (keysym 0xffeb, Super_L), same_screen YES,
    XLookupString gives 0 bytes:
    XFilterEvent returns: False
TMK products:HHKB Alt  ⌨ConvertersAlps64FC660C AltFC980C Alt