Author Topic: TMK keyboard firmware  (Read 823931 times)

0 Members and 2 Guests are viewing this topic.

Offline hasu

  • Thread Starter
  • Posts: 3472
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: TMK keyboard firmware
« Reply #300 on: Sun, 16 February 2014, 19:20:25 »
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.

1) Yes.
2) Tokyo Mushy Ki-bo-do, Truely Maccho Keyboard or anything. I didn't decide yet.
T: [Tokyo|The|Truely|...]
M: [Maccho|Massive|Minimalist|...]
K: [Keyboard|Kompany|Kogyo|...]
3) It will work on AVR controller with USB engine like: ATmega32u4, ATmega16u2, AT90USB*. Flash size more 32KB is recommended.
So you can use Teensy2.0 and Teensy2.0++.  Also Teensy1.0 and Teensy1.0++ probably.
4) It will depend on memory size. I think 16x16=256-key keyboard will work without problem.

Offline hydrospell

  • * Destiny Supporter
  • Posts: 272
  • Location: Singapore
  • some keyboard thing
    • octobrain
Re: TMK keyboard firmware
« Reply #301 on: Mon, 17 February 2014, 07:32:00 »
Truly Massive Kogyo ... I like.
⌨ Filco MJ2 MX Blues / M0116 Orange Alps / Homemade 60% MX Reds / M0110

Cherry MX art prints 20/50 still available!

Offline wuqe

  • Posts: 105
  • Location: WA, USA
Re: TMK keyboard firmware
« Reply #302 on: Mon, 17 February 2014, 09:03:39 »
True Media Keys? I know that was the draw for many Ergodox owners.

Offline Melvang

  • Exquisite Lord of Bumfluff
  • * Maker
  • Posts: 4398
  • Location: Waterloo, IA
  • Melvang's Desktop Customs
Re: TMK keyboard firmware
« Reply #303 on: Mon, 17 February 2014, 09:56:27 »
Is it possible to have a hard drive activity LED powered by the Teensy?  Or is it not able to read through the same USB for that?
OG Kishsaver, Razer Orbweaver clears and reds with blue LEDs, and Razer Naga Epic.   "Great minds crawl in the same sewer"  Uncle Rich

Offline clickclack123

  • Posts: 357
  • Location: Australia, Mate!
Re: TMK keyboard firmware
« Reply #304 on: Sat, 22 February 2014, 08:43:15 »
I have a question:

In my layout, I have an action function that prints a message to hid_listen.exe when I toggle layouts:
Code: [Select]
ACTION_FUNCTION(DUMBTHUMBS), // FN14 - activate/disable left hand for testing

<snip>

    else if (id == DUMBTHUMBS) {
        if (event.pressed) {
            if (layer_state & 1<<11) { // layer 11 is already on
                print("enabling left thumbs...\n");
                layer_off(11);
            } else {
                print("disabling left thumbs...\n");
                layer_on(11);
            }
        }
    }

Is there a way to have the same function, except only activated momentarily?

I know I can use ACTION_LAYER_MOMENTARY(11), but how can I print a message to hid_listen when using that?

Offline wuqe

  • Posts: 105
  • Location: WA, USA
Re: TMK keyboard firmware
« Reply #305 on: Sat, 22 February 2014, 09:26:44 »
Is there a way to have the same function, except only activated momentarily?

The key is the event.pressed flag; when it's not true, then the event is a key-up. Just disable the layer once you see an event from that key with event.pressed set to false.

Offline clickclack123

  • Posts: 357
  • Location: Australia, Mate!
Re: TMK keyboard firmware
« Reply #306 on: Sat, 22 February 2014, 11:18:05 »
Is there a way to have the same function, except only activated momentarily?

The key is the event.pressed flag; when it's not true, then the event is a key-up. Just disable the layer once you see an event from that key with event.pressed set to false.

Great, thanks, worked perfectly:
Code: [Select]
    else if (id == DUMBTHUMBSMOMENTARY) {
        if (event.pressed) {
            {
                print("disabling left thumbs momentarily...\n");
                layer_on(11);
            }
        } else {
                print("enabling left thumbs momentarily...\n");
                layer_off(11);
}
    }

That'll be good for having notifications of what layer is enabled using hid_listen. Thanks again wuqe!

Offline jgrade

  • Posts: 14
Re: TMK keyboard firmware
« Reply #307 on: Sat, 01 March 2014, 11:33:21 »
Hi,

I am assembling a tenkeyless keyboard with a matrix:




and now its time to program the controller. i have a Teensy 2.0 and was thinking of uploading the phantom teensy firmware.
Is it compatible with this type of keyboards? (i've tried it and had no luck)
What do you recommend?

Offline hasu

  • Thread Starter
  • Posts: 3472
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: TMK keyboard firmware
« Reply #308 on: Sat, 01 March 2014, 12:13:19 »
Maybe not compatible. You will need to write your own matrix.c. See matt3o's nice write up.
http://deskthority.net/workshop-f7/how-to-build-your-very-own-keyboard-firmware-t7177.html

Offline xSpartanCx

  • Posts: 104
Re: TMK keyboard firmware
« Reply #309 on: Sat, 01 March 2014, 12:42:23 »
I can't get the MXLOCK locking caps lock to work for my phantom. I use CAPS and it works like a normal caps lock, which isn't very effective for MXLOCK. I try LCAP, and it doesn't even turn caps lock on. I've added the #define LOCKING_SUPPORT_ENABLE and #define LOCKING_RESYNC_ENABLE to the top of config.h

Offline hasu

  • Thread Starter
  • Posts: 3472
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: TMK keyboard firmware
« Reply #310 on: Sat, 01 March 2014, 14:03:49 »
Hmm, it looks your configuration is right, it should work. Did you do 'make clean' after change config.h?

Offline jgrade

  • Posts: 14
Re: TMK keyboard firmware
« Reply #311 on: Sat, 01 March 2014, 17:38:02 »
Maybe not compatible. You will need to write your own matrix.c. See matt3o's nice write up.
http://deskthority.net/workshop-f7/how-to-build-your-very-own-keyboard-firmware-t7177.html

thanks hash!!! all is working now  :thumb:

Offline xSpartanCx

  • Posts: 104
Re: TMK keyboard firmware
« Reply #312 on: Sun, 02 March 2014, 20:07:34 »
Hmm, it looks your configuration is right, it should work. Did you do 'make clean' after change config.h?

Yes... It seems to me like it's not even recognizing the changes in my config.h. The LED brightness doesn't change, even when I set it as low as 20, either.
My config.h: http://pastebin.com/7hB9jatE <-- the define bootloader was an attempt to get a teensy program button to work, for some reason that doesn't work either.
My keymap_ansi.h: http://pastebin.com/N0wTL3wA

I'm using the command "make -f Makefile.lufa ansi clean" and then "make -f Makefile.lufa ansi"
« Last Edit: Sun, 02 March 2014, 20:20:27 by xSpartanCx »

Offline hasu

  • Thread Starter
  • Posts: 3472
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: TMK keyboard firmware
« Reply #313 on: Sun, 02 March 2014, 20:38:50 »
Are you sure you can program(flash) your controller correctly?

EDIT: I confirmed 'LOCKING_SUPPORT_ENABLE' works as expected on my HHKB.
I don't know about LED brightness, I don't have a Phantom. People of Phantom thread may help you.
« Last Edit: Sun, 02 March 2014, 20:56:38 by hasu »

Offline xSpartanCx

  • Posts: 104
Re: TMK keyboard firmware
« Reply #314 on: Sun, 02 March 2014, 21:27:49 »
I might not be? All I've been doing is putting the .hex file into the teensy programmer, which is how I think I'm supposed to do it.

Offline Melvang

  • Exquisite Lord of Bumfluff
  • * Maker
  • Posts: 4398
  • Location: Waterloo, IA
  • Melvang's Desktop Customs
Re: TMK keyboard firmware
« Reply #315 on: Sun, 02 March 2014, 23:07:45 »
Ok, I have a question here.  Fair warning I am a total programming nooblet.  While I realize it is a totally different hardware architecture and possibly software architecture, but how difficult would it be to port this over to work on a Teensy 3.0 or 3.1?
OG Kishsaver, Razer Orbweaver clears and reds with blue LEDs, and Razer Naga Epic.   "Great minds crawl in the same sewer"  Uncle Rich

Offline sean4star

  • Posts: 59
  • Location: Arlington, TX
Re: TMK keyboard firmware
« Reply #316 on: Mon, 03 March 2014, 10:43:58 »
I'm not getting NKRO to work.  Maybe there's something wrong in my makefile?  I downloaded a current copy of the source from Git this morning and recompiled.  I'm on Windows 7  and my makefile has this:

Code: [Select]
# Build Options
#   comment out to disable the options.
#
BOOTMAGIC_ENABLE = yes  # Virtual DIP switch configuration(+1000)
MOUSEKEY_ENABLE = yes   # Mouse keys(+4700)
EXTRAKEY_ENABLE = yes   # Audio control and System control(+450)
CONSOLE_ENABLE = yes    # Console for debug(+400)
COMMAND_ENABLE = yes    # Commands for debug and configuration
SLEEP_LED_ENABLE = yes  # Breathing sleep LED during USB suspend
NKRO_ENABLE = yes       # USB Nkey Rollover - not yet supported in LUFA

When I use these:
Code: [Select]
Tools for testing NKRO
----------------------
Browser App:
http://www.microsoft.com/appliedsciences/content/projects/KeyboardGhostingDemo.aspx
http://random.xem.us/rollover.html

I only get max of 6KRO.


Anything else I should be doing to fix this?

Offline Hzza

  • Posts: 377
  • Location: Windsor, UK
Re: TMK keyboard firmware
« Reply #317 on: Mon, 03 March 2014, 11:51:22 »
You have to press "magic key" and N, by default it should be both shifts. So you hold down both shifts, press N and release and you should have NKRO. Took me a while to figure that out too.

Offline sean4star

  • Posts: 59
  • Location: Arlington, TX
Re: TMK keyboard firmware
« Reply #318 on: Mon, 03 March 2014, 12:00:58 »
I see...that works!  I hadn't paid attention to the magic key commands before now.


So is this something that has to be selected each time my kb is turned on?  Whenever I unplug the kb and plug it back in the NKRO is off.  Is there a way to default it to on?  Or, is there a reason not to have it default to on?

Offline wuqe

  • Posts: 105
  • Location: WA, USA
Re: TMK keyboard firmware
« Reply #319 on: Mon, 03 March 2014, 14:52:52 »
You can turn it on by default in common/host.c (my commit: https://github.com/shayneholmes/tmk_keyboard/commit/b8375a0)

The main reason not to is that it breaks compatibility with some implementations, like your BIOS.

Offline hasu

  • Thread Starter
  • Posts: 3472
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: TMK keyboard firmware
« Reply #320 on: Mon, 03 March 2014, 17:32:57 »
Thanks guys.
I didn't find NKRO is not documented, I'll fix it some later. And filed the issue.

https://github.com/tmk/tmk_keyboard/issues/100
https://github.com/tmk/tmk_keyboard/wiki/FAQ#wiki-nkro-doesnt-work

Offline bcg

  • Posts: 112
Re: TMK keyboard firmware
« Reply #321 on: Mon, 03 March 2014, 23:04:13 »
Ok, I have a question here.  Fair warning I am a total programming nooblet.  While I realize it is a totally different hardware architecture and possibly software architecture, but how difficult would it be to port this over to work on a Teensy 3.0 or 3.1?

Probably not TOO difficult, but definitely tedious.  PJRC has already ported some of the Arduino libraries so the AVR to ARM must be at least somewhat feasible... but there are a lot of things in TMK firmware that are AVR specific so you would have to account for those.  The USB stack would be completely different too, Teensy 3.x doesn't have hardware USB AFAIK and the libraries that TMK uses probably won't work
:wq!

Offline Melvang

  • Exquisite Lord of Bumfluff
  • * Maker
  • Posts: 4398
  • Location: Waterloo, IA
  • Melvang's Desktop Customs
Re: TMK keyboard firmware
« Reply #322 on: Mon, 03 March 2014, 23:18:55 »
Ok, I have a question here.  Fair warning I am a total programming nooblet.  While I realize it is a totally different hardware architecture and possibly software architecture, but how difficult would it be to port this over to work on a Teensy 3.0 or 3.1?

Probably not TOO difficult, but definitely tedious.  PJRC has already ported some of the Arduino libraries so the AVR to ARM must be at least somewhat feasible... but there are a lot of things in TMK firmware that are AVR specific so you would have to account for those.  The USB stack would be completely different too, Teensy 3.x doesn't have hardware USB AFAIK and the libraries that TMK uses probably won't work

Gotcha thanks.  Couple other questions.
1.  With the pins on the 2.0 using the 32U4 chip is the number of pins on the board limited by the chip? 
2.  Would this firmware be compatible with the Teensy++ using the AT90USB1286 8 bit AVR 16 MHz chip? 
3.  Is the TMK firmware capable of outputting signal for HDD activity LED?
OG Kishsaver, Razer Orbweaver clears and reds with blue LEDs, and Razer Naga Epic.   "Great minds crawl in the same sewer"  Uncle Rich

Offline hasu

  • Thread Starter
  • Posts: 3472
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: TMK keyboard firmware
« Reply #323 on: Mon, 03 March 2014, 23:42:40 »
1. Circuit schematic or datasheet will answer you.. https://www.pjrc.com/teensy/schematic.html
2. YES
3. NO

EDIT: HaaTa's firmware supports Teensy3, look into if you are interested.
https://gitorious.org/kiibohd-controller
« Last Edit: Mon, 03 March 2014, 23:49:00 by hasu »

Offline Melvang

  • Exquisite Lord of Bumfluff
  • * Maker
  • Posts: 4398
  • Location: Waterloo, IA
  • Melvang's Desktop Customs
Re: TMK keyboard firmware
« Reply #324 on: Tue, 11 March 2014, 01:03:54 »
1. Circuit schematic or datasheet will answer you.. https://www.pjrc.com/teensy/schematic.html
2. YES
3. NO

EDIT: HaaTa's firmware supports Teensy3, look into if you are interested.
https://gitorious.org/kiibohd-controller

Thanks for that info there.  One more quick question. 

Is it possible for the Teensy 2.0 or the ++2.0 to due a keyboard matrix and USB pass through for one extra port to facilitate plugging in a mouse?

The reason I ask is because I have an AEK II that I want to mod into teensy powered but I want to keep all the original functionality of plugging the mouse into the keyboard and having it pass through to the PC.  Or would I need to add a USB hub inside the keyboard and just plug the Teensy into one port with the Mouse into the other port?
OG Kishsaver, Razer Orbweaver clears and reds with blue LEDs, and Razer Naga Epic.   "Great minds crawl in the same sewer"  Uncle Rich

Offline clickclack123

  • Posts: 357
  • Location: Australia, Mate!
Re: TMK keyboard firmware
« Reply #325 on: Tue, 11 March 2014, 19:28:50 »
Thanks for that info there.  One more quick question. 

Is it possible for the Teensy 2.0 or the ++2.0 to due a keyboard matrix and USB pass through for one extra port to facilitate plugging in a mouse?

The reason I ask is because I have an AEK II that I want to mod into teensy powered but I want to keep all the original functionality of plugging the mouse into the keyboard and having it pass through to the PC.  Or would I need to add a USB hub inside the keyboard and just plug the Teensy into one port with the Mouse into the other port?

I'd be very surprised if the teensy was capable of this. The hub is your best solution IMO.

Offline strict

  • TKL Zealot
  • Posts: 1921
  • Location: PA
Re: TMK keyboard firmware
« Reply #326 on: Tue, 11 March 2014, 21:58:54 »
Hi,

I am assembling a tenkeyless keyboard with a matrix:
Show Image


Show Image


and now its time to program the controller. i have a Teensy 2.0 and was thinking of uploading the phantom teensy firmware.
Is it compatible with this type of keyboards? (i've tried it and had no luck)
What do you recommend?

Are those ... futaba switches??

Realforce EK45 (Silenced)  |  Realforce 87UW (45g)  |  Realforce 87UWS (Variable)
Filco MJ2 TKL (Cherry Clears)  |  Phantom 87 (78g Gateron Clears)  |  Phantom 86 (67g Zealios)


Offline jacobolus

  • Posts: 3661
  • Location: San Francisco, CA
Re: TMK keyboard firmware
« Reply #327 on: Tue, 11 March 2014, 22:32:10 »
Is it possible for the Teensy 2.0 or the ++2.0 to due a keyboard matrix and USB pass through for one extra port to facilitate plugging in a mouse?
Just use the USB hub. You could probably figure out a way to get it to work otherwise, but it’s way more trouble than it’s worth.
« Last Edit: Tue, 11 March 2014, 22:34:34 by jacobolus »

Offline Melvang

  • Exquisite Lord of Bumfluff
  • * Maker
  • Posts: 4398
  • Location: Waterloo, IA
  • Melvang's Desktop Customs
Re: TMK keyboard firmware
« Reply #328 on: Tue, 11 March 2014, 22:36:24 »
Is it possible for the Teensy 2.0 or the ++2.0 to due a keyboard matrix and USB pass through for one extra port to facilitate plugging in a mouse?
Just use the USB hub. You could probably figure out a way to get it to work otherwise, but it’s way more trouble than it’s worth.

Yeah, that's what I was figuring.  Just take the hub out of whatever case it is in and take the plugs off the PCB and wire up to the pads.
OG Kishsaver, Razer Orbweaver clears and reds with blue LEDs, and Razer Naga Epic.   "Great minds crawl in the same sewer"  Uncle Rich

Offline plainbriny

  • Posts: 192
  • Location: Taiwan
Re: TMK keyboard firmware
« Reply #329 on: Wed, 26 March 2014, 01:13:35 »
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

Hi, along my attempt to make trackpoint working in my ergodox, I found in the firmware ported by cub, the Makefile missing a line
Code: [Select]
include $(TOP_DIR)/protocol.mk
After adding this line, lufa is now working, no boot problem as mentioned earlier.
However, I also disabled a lot of functions, like boot magic/console/command/nkro etc. Therefore I can not be sure whether the issue is completely resolved or not.
I will test further later, and report back.

UPDATE:
The issue may be caused by console, because when I comment console, it function normally. Don't know what to check next though, any pointer?
« Last Edit: Wed, 26 March 2014, 01:34:25 by plainbriny »

Offline hasu

  • Thread Starter
  • Posts: 3472
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: TMK keyboard firmware
« Reply #330 on: Wed, 26 March 2014, 19:18:09 »
Hmm, it is not what I expected, my guess was that keyboard itself has spec conformity problem. Mousekey and NKRO build option are not guitly? I don't know why Console causes the problem at this point. Anyway thank you for reporting back, it is helpful to narrow the problem

Offline metalliqaz

  • * Maker
  • Posts: 4951
  • Location: the Making Stuff subforum
  • Leopold fanboy
Re: TMK keyboard firmware
« Reply #331 on: Wed, 26 March 2014, 19:20:18 »
Hmm, it is not what I expected, my guess was that keyboard itself has spec conformity problem. Mousekey and NKRO build option are not guitly? I don't know why Console causes the problem at this point. Anyway thank you for reporting back, it is helpful to narrow the problem

His PC's firmware could be software that's out of spec, for all we know.

Offline plainbriny

  • Posts: 192
  • Location: Taiwan
Re: TMK keyboard firmware
« Reply #332 on: Wed, 26 March 2014, 20:06:40 »
Hmm, it is not what I expected, my guess was that keyboard itself has spec conformity problem. Mousekey and NKRO build option are not guitly? I don't know why Console causes the problem at this point. Anyway thank you for reporting back, it is helpful to narrow the problem

His PC's firmware could be software that's out of spec, for all we know.

I only comment out console, so NKRO and mousekey supports are included.

And it is true that perhaps the PC firmware caused all these strange behavior. However there's currently no updates for the firmware and I don't expect the manufacturer (asus) will provide fix for my keyboard.

Anyway, thanks for the great firmware and I really appreciate all your help.

Offline Melvang

  • Exquisite Lord of Bumfluff
  • * Maker
  • Posts: 4398
  • Location: Waterloo, IA
  • Melvang's Desktop Customs
Re: TMK keyboard firmware
« Reply #333 on: Mon, 31 March 2014, 23:18:00 »
When using this firmware to do a small 3x3 matrix what do I put into this section for the unused ports?  Currently I am using ports B5 B6 and F7 for cols 0, 1, and 2 respectively and pins D0, D1, and D2 for rows 0, 1, and 2 respectively?

More
Code: [Select]
/* Column pin configuration
 * col: 0   1   2
 * pin: B5  B6  F7  (Rev.A)
 */
static void  init_cols(void)
{
    // Input with pull-up(DDR:0, PORT:1)
    DDRF  &= ~(1<<7);
    PORTF |=  (1<<7);
    DDRE  &= ~(1<<0);
    PORTE |=  (1<<0);
    DDRD  &= ~(1<<0);
    PORTD |=  (1<<0);
    DDRC  &= ~(1<<7 | 1<<6);
    PORTC |=  (1<<7 | 1<<6);
    DDRB  &= ~(1<<6 | 1<<5);
    PORTB |=  (1<<6 | 1<< 5);
}

static matrix_row_t read_cols(void)
{
    return (PINF&(1<<0) ? 0 : (1<<0)) |
           (PINF&(1<<1) ? 0 : (1<<1)) |
           (PINE&(1<<6) ? 0 : (1<<2)) |
           (PINC&(1<<7) ? 0 : (1<<3)) |
           (PINC&(1<<6) ? 0 : (1<<4)) |
           (PINB&(1<<6) ? 0 : (1<<5)) |
           (PIND&(1<<4) ? 0 : (1<<6)) |
           (PINB&(1<<1) ? 0 : (1<<7)) |
           ((PINB&(1<<0) && PINB&(1<<7)) ? 0 : (1<<) |     // Rev.A and B
           (PINB&(1<<5) ? 0 : (1<<9)) |
           (PINB&(1<<4) ? 0 : (1<<10)) |
           (PIND&(1<<7) ? 0 : (1<<11)) |
           (PIND&(1<<6) ? 0 : (1<<12)) |
           (PINB&(1<<3) ? 0 : (1<<13));
}

Edit:

Ok I got past that part and now I am stuck at the part of building the actual keympa in keymap_common.h.  I am using Matt3o's tutorial found here  Here is a piece of the code I have now.

Code: [Select]
/* GH60 keymap definition macro
 * K2C, K31 and  K3C are extra keys for ISO
 */
#define KEYMAP( \
    K00, K01, K02, \
    K10, K11, K12, \
    K20, K21, K22, \
    ) { \
    { KC_##K00, KC_##K01, KC_##K02 }, \
    { KC_##K10, KC_##K11, KC_##K12 }, \
    { KC_##K20, KC_##K21, KC_##K22 }, \
   
}

/* ANSI valiant. No extra keys for ISO */
#define KEYMAP_ANSI( \
    K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, K0D, \
    K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K1D, \
    K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B,      K2D, \
    K30, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B,           K3D, \
    K40, K41, K42,           K45,                     K4A, K4B, K4C, K4D  \
) KEYMAP( \
    K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, K0D, \
    K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K1D, \
    K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, NO,  K2D, \
    K30, NO,  K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, NO,  K3D, \
    K40, K41, K42,           K45,                NO,  K4A, K4B, K4C, K4D  \
)


#define KEYMAP_HHKB( \
    K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, K0D, K49,\
    K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K1D, \
    K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B,      K2D, \
    K30, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B,      K3D, K3C, \
    K40, K41, K42,           K45,                     K4A, K4B, K4C, K4D  \
) KEYMAP( \
    K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, K0D, \
    K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K1D, \
    K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, NO,  K2D, \
    K30, NO,  K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K3C, K3D, \
    K40, K41, K42,           K45,                K49, K4A, K4B, K4C, K4D  \
)

#endif

I realize that this is probably childs play for you guys but this is my first real programming experience.  Just need to know what I need to do from here?  I am in the middle of the "Defining the matrix" section in Part 2.
« Last Edit: Tue, 01 April 2014, 00:42:51 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

Offline zeroni13

  • Posts: 97
  • Location: Oslo, Norway
Re: TMK keyboard firmware
« Reply #334 on: Wed, 02 April 2014, 00:50:57 »
I just got the teensy controller working with the TMK FW and I love how easy it is to use, but i came across a strange keycode. What does KC_MEDIA_SELECT do? I did not include it in my layout because I could not figure out what it was or did.
Phantom with Silver Vortex Case   Keychron Q6 Pro ISO Knob
                               

Offline jacobolus

  • Posts: 3661
  • Location: San Francisco, CA
Re: TMK keyboard firmware
« Reply #335 on: Wed, 02 April 2014, 05:10:15 »
I just got the teensy controller working with the TMK FW and I love how easy it is to use, but i came across a strange keycode. What does KC_MEDIA_SELECT do? I did not include it in my layout because I could not figure out what it was or did.
Pretty sure it’s for something like a TV remote, where you want to choose between the FM tuner, the DVD player, and the cable box.

Offline jacobolus

  • Posts: 3661
  • Location: San Francisco, CA
Re: TMK keyboard firmware
« Reply #336 on: Wed, 02 April 2014, 05:30:58 »
Melvang: I don’t understand what you’re trying to do and what you’re getting stuck on.

Offline zeroni13

  • Posts: 97
  • Location: Oslo, Norway
Re: TMK keyboard firmware
« Reply #337 on: Wed, 02 April 2014, 05:32:44 »
I just got the teensy controller working with the TMK FW and I love how easy it is to use, but i came across a strange keycode. What does KC_MEDIA_SELECT do? I did not include it in my layout because I could not figure out what it was or did.
Pretty sure it’s for something like a TV remote, where you want to choose between the FM tuner, the DVD player, and the cable box.
So it's totally useless on a computer then, thanks.
Phantom with Silver Vortex Case   Keychron Q6 Pro ISO Knob
                               

Offline jacobolus

  • Posts: 3661
  • Location: San Francisco, CA
Re: TMK keyboard firmware
« Reply #338 on: Wed, 02 April 2014, 06:16:45 »
So it's totally useless on a computer then, thanks.
Well, all of these keys depend on operating system / other software support. Some computers might interpret “media select” to do something useful?

Keep in mind, USB and similar specs were designed to meet lots of different use cases, so there’s lots of stuff in there that’s not used by every device / system.

Offline zeroni13

  • Posts: 97
  • Location: Oslo, Norway
Re: TMK keyboard firmware
« Reply #339 on: Wed, 02 April 2014, 06:36:22 »
Well, all of these keys depend on operating system / other software support. Some computers might interpret “media select” to do something useful?

Keep in mind, USB and similar specs were designed to meet lots of different use cases, so there’s lots of stuff in there that’s not used by every device / system.
Yeah, but I have no use for it then, I only use VOLD, VOLU, MUTE, MPLY, MSTP, MNXT and MPRV.

Anyway, does anyone know why  MS_U, MS_D, MS_L, MS_R, BTN1 and BTN2 doesn't work? I tried to map the mouse movements to WASD and the mouse buttons to Q and E trough the FN layer, but it doesn't work. Any help to get on this?
Phantom with Silver Vortex Case   Keychron Q6 Pro ISO Knob
                               

Offline plainbriny

  • Posts: 192
  • Location: Taiwan
Re: TMK keyboard firmware
« Reply #340 on: Wed, 02 April 2014, 06:57:25 »
Did you enable MOUSEKEY in your Makefile?
Code: [Select]
MOUSEKEY_ENABLE = yes # Mouse keys

Offline zeroni13

  • Posts: 97
  • Location: Oslo, Norway
Re: TMK keyboard firmware
« Reply #341 on: Thu, 03 April 2014, 01:17:52 »
Did you enable MOUSEKEY in your Makefile?
Code: [Select]
MOUSEKEY_ENABLE = yes # Mouse keys
It was enabled, but commented out, now it works! Thanks! =D
Phantom with Silver Vortex Case   Keychron Q6 Pro ISO Knob
                               

Offline clickclack123

  • Posts: 357
  • Location: Australia, Mate!
Re: TMK keyboard firmware
« Reply #342 on: Thu, 03 April 2014, 08:21:43 »
It was enabled, but commented out, now it works! Thanks! =D

How can it be enabled if it is commented out?  :-X

Offline metalliqaz

  • * Maker
  • Posts: 4951
  • Location: the Making Stuff subforum
  • Leopold fanboy
Re: TMK keyboard firmware
« Reply #343 on: Thu, 03 April 2014, 08:28:31 »
It was enabled, but commented out, now it works! Thanks! =D

How can it be enabled if it is commented out?  :-X

We all understand what he meant.

Offline sean4star

  • Posts: 59
  • Location: Arlington, TX
Re: TMK keyboard firmware
« Reply #344 on: Thu, 03 April 2014, 14:10:06 »
Can I get some help on the led and backlight code?  I have 3 main questions:

1. I don't understand what the difference is between |= and &= or what the ~ is doing.  Sorry, I'm a programming noob...
Code: [Select]
    if (usb_led & (1<<USB_LED_CAPS_LOCK)) {
        DDRD |= (1<<6);
        PORTD |= (1<<6);
    } else {
        DDRD |= (1<<6);
        PORTD &= ~(1<<6);
    }
And what is Hi-Z?  I was assuming output high and output low just mean 5V or 0V, right?


2. And I was only able to find 1 backlight example in the kmac project folder.
Code: [Select]
void backlight_set(uint8_t level)
{
    // Set as output.
    DDRB |= (1<<1) | (1<<2) | (1<<3) | (1<<4);
    DDRD |= (1<<7);

    // F-row
    if(level & (1<<0))
    {
        PORTB |= (1<<1);
    }
    else
    {
        PORTB &= ~(1<<1);
    }
    // WASD
    if(level & (1<<1))
    {
        PORTB &= ~(1<<4);
        PORTB &= ~(1<<2);
        PORTB &= ~(1<<3);
        PORTD &= ~(1<<7);
    }
    else
    {
        PORTB |= (1<<4);
        PORTB |= (1<<2);
        PORTB |= (1<<3);
        PORTD |= (1<<7);
    }
}

The syntax is obviously similar to the led code, but what does this do?
Code: [Select]
if(level & (1<<1))
How many "levels" are there?


3. And lastly, is it possible to use
Code: [Select]
backlight_toggle()as part of a user defined action function?  Does anything go in the parenthesis?


Thanks for all the help!

Offline metalliqaz

  • * Maker
  • Posts: 4951
  • Location: the Making Stuff subforum
  • Leopold fanboy
Re: TMK keyboard firmware
« Reply #345 on: Thu, 03 April 2014, 15:55:14 »
If you're not a programmer, you may want to look into an 'easier' option ...

Offline wuqe

  • Posts: 105
  • Location: WA, USA
Re: TMK keyboard firmware
« Reply #346 on: Thu, 03 April 2014, 16:59:31 »
Whew, that's a lot of questions! For starters, check out Bitwise operations in C on Wikipedia.

I'm not familiar with this part of TMK's codebase, so my help will have to stop here.

Offline clickclack123

  • Posts: 357
  • Location: Australia, Mate!
Re: TMK keyboard firmware
« Reply #347 on: Thu, 03 April 2014, 17:02:01 »
It was enabled, but commented out, now it works! Thanks! =D

How can it be enabled if it is commented out?  :-X

We all understand what he meant.

Yeah, I was just being a pedant. This is a geek forum, right?

Whew, that's a lot of questions! For starters, check out Bitwise operations in C on Wikipedia.

I'm not familiar with this part of TMK's codebase, so my help will have to stop here.

Haha I was linking to that myself, and got the message "Warning - while you were typing a new reply has been posted. You may wish to review your post."

I don't know if that will solve sean4star's problems, but it's a good start...

1. I don't understand what the difference is between |= and &= or what the ~ is doing.  Sorry, I'm a programming noob...
Code: [Select]
    if (usb_led & (1<<USB_LED_CAPS_LOCK)) {
        DDRD |= (1<<6);
        PORTD |= (1<<6);
    } else {
        DDRD |= (1<<6);
        PORTD &= ~(1<<6);
    }

Well I'm no expert either, but << is a bitwise left shift, so (1<<6) means take a binary 1 and shift it to the left 6 places, ie binary 1000000.

|= is a compound operator, basically a shortcut. | means OR. "DDRD |= (1<<6);" is the same as "DDRD = (DDRD | (1<<6));", which OR's each bit of DDRD with the corresponding bit of "(1<<6)".

DDRD is the direction for the pins on Port D, so "DDRD |= (1<<6);" makes sure that pin 6 on Port D is set as an output, then "PORTD |= (1<<6);" actually sets pin 6 on port D high, which lights the LED connected to pin 6 on port D.

~ means invert, so "PORTD &= ~(1<<6);" sets pin 6 on port D low, which will turn off the LED.

I'm not super confident with bitwise stuff myself, I mostly play around with java.
« Last Edit: Thu, 03 April 2014, 17:32:22 by clickclack123 »

Offline abjr

  • Posts: 171
  • Location: Connecticut
    • abjr.org
Re: TMK keyboard firmware
« Reply #348 on: Thu, 03 April 2014, 17:14:11 »
1. I don't understand what the difference is between |= and &= or what the ~ is doing.  Sorry, I'm a programming noob...

Try looking at this: http://en.wikipedia.org/wiki/Bitwise_operations_in_C
CM QFR | magicforce 68 (Gateron) | magicforce 68 (Outemu) | Acros 6311-K

Offline sean4star

  • Posts: 59
  • Location: Arlington, TX
Re: TMK keyboard firmware
« Reply #349 on: Thu, 03 April 2014, 17:19:24 »
Thanks guys!  Starting with your links I eventually found this:

https://en.wikipedia.org/wiki/Bit_manipulation
It has a pretty clear explanation of |= and &= in the last section.

And sorry about the big question dump.  It just felt like the questions all flowed together...I'll try a few things and post back here if I still have questions.