How to build your very own keyboard firmware

User avatar
Mal-2

09 Mar 2015, 19:31

nowai wrote: But for some reason my desktop pc completely refuses to boot with the keyboard attached when its flashed with the normal Makefile (with and without nkro). It froze at the BIOS selection screen and unfroze the moment I detached the keyboard.
Any idea whats going on here?
I've had similar issues with other hardware, and putting the trouble item(s) behind a powered hub seemed to do the trick. I suspect it was just an ill-timed request for USB power (or a data link) causing the issue. The hub isolates this, since the hardware is already powered and does not need to send any such requests.

That said, sometimes the hub itself has been such an offender, especially when two identical hubs were attached. Unplugging either one solved the problem.

vick0011

10 Mar 2015, 05:17

I cant understand how to make file .hex!! Can u tell me how to do that sir? ( Sr bad English ). Thank you. :D

ROFLmonster

10 Mar 2015, 07:25

vick0011 wrote: I cant understand how to make file .hex!! Can u tell me how to do that sir? ( Sr bad English ). Thank you. :D
If on Windows, get a program called Cygwin. It's has a c compiler in it. Run the program, type in 'cd ' without quotes, drag the folder you have your Makefile file in, release it in the Cygwin window, and press enter.
You're now in the same directory your Makefile is. Now just just type in 'make -f Makefile' without quotes, and you should start compiling and at the end you'll have a .hex file in that folder.

If there are any errors, see what they are and fix what's needed. If you need any more help or can't figure it out ask here.

vick0011

10 Mar 2015, 16:49

I'm starting build my own Keyboard. But i dont have the Plate, Case ( Im learning http://deskthority.net/workshop-f7/buil ... t5761.html). I'm worry... because when i make my keyboard and then it's not working... Im very very noob C, teensy 2.0,..... i will try my best. ( Sr for bad English ). Hope u help me!

vick0011

10 Mar 2015, 18:36

ROFLmonster wrote:
vick0011 wrote: I cant understand how to make file .hex!! Can u tell me how to do that sir? ( Sr bad English ). Thank you. :D
If on Windows, get a program called Cygwin. It's has a c compiler in it. Run the program, type in 'cd ' without quotes, drag the folder you have your Makefile file in, release it in the Cygwin window, and press enter.
You're now in the same directory your Makefile is. Now just just type in 'make -f Makefile' without quotes, and you should start compiling and at the end you'll have a .hex file in that folder.

If there are any errors, see what they are and fix what's needed. If you need any more help or can't figure it out ask here.
Cant u give some example ? Sr because i cant understand.... ( I guest i need write all code on Cygwin? and at the end type "make -f Makefile"? Right? And then Where is the Makefile.hex saved? ) Thank you.

ROFLmonster

10 Mar 2015, 19:20

After you have Cygwin open, you need to navigate to the place where the file 'Makefile' is. For example 'D:/Documents/gh60/Makefile'. To do that you need to type 'cd cygdrive/d/documents/gh60' and enter.
then you write 'make -f Makefile' and enter.
If it's successful you'll have gh60_lufa.hex in the same folder.

Ninhalem

10 Mar 2015, 21:19

Is there a better implementation of the LED API yet? I saw on the #174 issue for poor LED API implementation that Kairyu has an experimental ledmap feature, but I can't make heads or tails out of the code and how to implement the code either in the led.h file or as an action in the keymap file.

What I would like to do is be able to turn on a certain LED when I hit a certain FN switch.

vick0011

11 Mar 2015, 00:35

ROFLmonster wrote: After you have Cygwin open, you need to navigate to the place where the file 'Makefile' is. For example 'D:/Documents/gh60/Makefile'. To do that you need to type 'cd cygdrive/d/documents/gh60' and enter.
then you write 'make -f Makefile' and enter.
If it's successful you'll have gh60_lufa.hex in the same folder.
Sr for stupid, but i got this...
Image

User avatar
Halvar

11 Mar 2015, 01:59

You need a space after "cd" . Then you need to press <enter> after /gh60 so the cd command is executed.

make -f Makefile

belongs in a line of its own. Makefile is one word.

Maybe you can find a tutorial on how the command line works somewhere, it might make sense to read some basics about that.

Ninhalem

11 Mar 2015, 03:05

Your code for running the make operation should be this:

Code: Select all

$ cd /cygdrive/c/Users/minhthu/Desktop/tmk_keyboard-master/keyboard/gh60
$ make -f Makefile
The code should run after that and output whatever the name of the file was initially in the Makefile. In the default case for the gh60 folder, the file will be named gh60_lufa.hex unless you changed that parameter.

vick0011

11 Mar 2015, 07:15

Thank you, all you guys are the best people i ever seen before. So 1 more think, i'm following Matt30 to build my own Firmware, but i cant understand that i need to write all code into Makefile or just fix files on gh60 then make the .hex? ( Sr for noob English )

ROFLmonster

11 Mar 2015, 07:44

vick0011 wrote: Thank you, all you guys are the best people i ever seen before. So 1 more think, i'm following Matt30 to build my own Firmware, but i cant understand that i need to write all code into Makefile or just fix files on gh60 then make the .hex? ( Sr for noob English )
You only need to edit the config.h file, matrix.c, keymap_common.h and keymap_poker.c. You don't touch the Makefile.
Just follow the guide, it's pretty straight forward.

Edit: several fixes.

vick0011

11 Mar 2015, 13:31

ROFLmonster wrote:
vick0011 wrote: Thank you, all you guys are the best people i ever seen before. So 1 more think, i'm following Matt30 to build my own Firmware, but i cant understand that i need to write all code into Makefile or just fix files on gh60 then make the .hex? ( Sr for noob English )
You only need to edit the config.h file, matrix.c, keymap_common.h and keymap_poker.c. You don't touch the Makefile.
Just follow the guide, it's pretty straight forward.

Edit: several fixes.
Thank you very very very much bro.... i will update my own keyboard soon. :D

User avatar
NumberMunchers

13 Mar 2015, 02:04

I have made a custom keypad and all of the connections are good. I have confirmed them with my multimeter/Diode tester/continuity tester. All of the key switches and circuits are good. The rows and coulombs are connected to the correct pins on the Teensy 2.0.

The problem I am having is that only the first two keys in each row work. The rest of the keys in the row will not activate and are not registering when pressed.

Here is the layout

-----------col1---col2-----col3---col4------col5
row1----LCRTL---C--------V------F1--------RSHIFT
row2------------------------UP
row3-------------LEFT---DOWN--RIGHT----SPACE
row4-------------------------------------------DELETE

LCRTL, C, UP, LEFT, DOWN and DELETE work just as they should but the others do not register any input. Its as if the circuit stops at after the second diode.

Anyone ever seen this?

User avatar
Muirium
µ

13 Mar 2015, 02:30

You did wire them up in parallel rather than series, right? I think I saw someone do it he wrong way before and it would show up like this.

User avatar
NumberMunchers

13 Mar 2015, 02:53

I did wire them in a series...Crud. Thank you. I am going to solder up some wires to make it parallel.

User avatar
NumberMunchers

13 Mar 2015, 03:41

Muirium that was the problem. Thank you so much for the help. This was my first project and well it is now success thanks to the whole board!! Thank you to everyone!! Especially OP

Kaibz

14 Mar 2015, 01:30

I'm with you Ninhalem, i have three leds on my keyboard and i want to have each layer (FN) to light the leds when activated, and i'm still experimenting with it.
What i have so far is not great but i think it can be done, i'll share my code once (if) it works.

ROFLmonster

14 Mar 2015, 17:57

You can do what I did that every FN key just calls a custom function with ACTION_FUNCTION(). For a single LED it's sorta overkill, but it's pretty simple to use. Just remember that it's all need to be done in the keymap file. Check out pages 4-5 if you want practical examples.

Edit:
@Kaibz: Oh you mean that when a layer is activated then you want some indicator. Not sure how to do that, but I'm looking forward to seeing what you have in mind.

weldawadyathink

24 Mar 2015, 01:09

Hello, I am a new user here.

I have used this guide to make a teensy++ controller for an IBM Model M. I am having some compilation errors that I cannot figure out.
Here is the pastebin of the entire compilation: http://pastebin.com/ewdfZi2K

Here is the important warning messages:
Spoiler:
keymap_poker.c:6:5: warning: excess elements in array initializer [enabled by default]
KEYMAP(
^
keymap_poker.c:6:5: warning: (near initialization for ‘keymaps[0][0]’) [enabled by default]
keymap_poker.c:6:5: warning: excess elements in array initializer [enabled by default]
keymap_poker.c:6:5: warning: (near initialization for ‘keymaps[0][1]’) [enabled by default]
keymap_poker.c:6:5: warning: excess elements in array initializer [enabled by default]
keymap_poker.c:6:5: warning: (near initialization for ‘keymaps[0][1]’) [enabled by default]
keymap_poker.c:6:5: warning: excess elements in array initializer [enabled by default]
keymap_poker.c:6:5: warning: (near initialization for ‘keymaps[0][1]’) [enabled by default]
keymap_poker.c:6:5: warning: excess elements in array initializer [enabled by default]
keymap_poker.c:6:5: warning: (near initialization for ‘keymaps[0][1]’) [enabled by default]
keymap_poker.c:6:5: warning: excess elements in array initializer [enabled by default]
keymap_poker.c:6:5: warning: (near initialization for ‘keymaps[0][1]’) [enabled by default]
keymap_poker.c:6:5: warning: excess elements in array initializer [enabled by default]
keymap_poker.c:6:5: warning: (near initialization for ‘keymaps[0][2]’) [enabled by default]
keymap_poker.c:6:5: warning: excess elements in array initializer [enabled by default]
keymap_poker.c:6:5: warning: (near initialization for ‘keymaps[0][2]’) [enabled by default]
keymap_poker.c:6:5: warning: excess elements in array initializer [enabled by default]
keymap_poker.c:6:5: warning: (near initialization for ‘keymaps[0][2]’) [enabled by default]
keymap_poker.c:6:5: warning: excess elements in array initializer [enabled by default]
keymap_poker.c:6:5: warning: (near initialization for ‘keymaps[0][2]’) [enabled by default]
keymap_poker.c:6:5: warning: excess elements in array initializer [enabled by default]
keymap_poker.c:6:5: warning: (near initialization for ‘keymaps[0][2]’) [enabled by default]
keymap_poker.c:6:5: warning: excess elements in array initializer [enabled by default]
keymap_poker.c:6:5: warning: (near initialization for ‘keymaps[0][3]’) [enabled by default]
keymap_poker.c:6:5: warning: excess elements in array initializer [enabled by default]
keymap_poker.c:6:5: warning: (near initialization for ‘keymaps[0][3]’) [enabled by default]
keymap_poker.c:6:5: warning: excess elements in array initializer [enabled by default]
keymap_poker.c:6:5: warning: (near initialization for ‘keymaps[0][3]’) [enabled by default]
keymap_poker.c:6:5: warning: excess elements in array initializer [enabled by default]
keymap_poker.c:6:5: warning: (near initialization for ‘keymaps[0][3]’) [enabled by default]
keymap_poker.c:6:5: warning: excess elements in array initializer [enabled by default]
keymap_poker.c:6:5: warning: (near initialization for ‘keymaps[0][4]’) [enabled by default]
keymap_poker.c:6:5: warning: excess elements in array initializer [enabled by default]
keymap_poker.c:6:5: warning: (near initialization for ‘keymaps[0][4]’) [enabled by default]
keymap_poker.c:6:5: warning: excess elements in array initializer [enabled by default]
keymap_poker.c:6:5: warning: (near initialization for ‘keymaps[0][4]’) [enabled by default]
keymap_poker.c:6:5: warning: excess elements in array initializer [enabled by default]
keymap_poker.c:6:5: warning: (near initialization for ‘keymaps[0][4]’) [enabled by default]
keymap_poker.c:6:5: warning: excess elements in array initializer [enabled by default]
keymap_poker.c:6:5: warning: (near initialization for ‘keymaps[0][4]’) [enabled by default]
keymap_poker.c:6:5: warning: excess elements in array initializer [enabled by default]
keymap_poker.c:6:5: warning: (near initialization for ‘keymaps[0][5]’) [enabled by default]
keymap_poker.c:6:5: warning: excess elements in array initializer [enabled by default]
keymap_poker.c:6:5: warning: (near initialization for ‘keymaps[0][5]’) [enabled by default]
keymap_poker.c:6:5: warning: excess elements in array initializer [enabled by default]
keymap_poker.c:6:5: warning: (near initialization for ‘keymaps[0][5]’) [enabled by default]
keymap_poker.c:6:5: warning: excess elements in array initializer [enabled by default]
keymap_poker.c:6:5: warning: (near initialization for ‘keymaps[0][5]’) [enabled by default]
Here is a google drive folder of all the files in the /gh60 directory: https://drive.google.com/folderview?id= ... sp=sharing

I appreciate any help.

User avatar
insomniac_lemon

24 Mar 2015, 08:51

Is it possible to do very few key Fn logic?

I'm playing with the idea of different Fn layers, yet I want most keys using plain Fn(0). Specifically, I want a toggle layer to be used on certain keys you might not use in everyday situations, Fn1 by doing Fn+alt.

What I was wondering if there was a way to do a special case when Fn1 was enabled and you pressed Fn and another key? Example: Fn+t is tab.... In Fn1 I want Fn+t to be Alt+tab.

Probably what I want would be a temporary Fn layer boost? So:
Holding the Fn key= fn0
Fn+alt= toggle fn1
Holding Fn key while in fn1 = fn2

If that is achievable, how would I go about doing it?

ROFLmonster

24 Mar 2015, 20:15

weldawadyathink wrote: Hello, I am a new user here.

I have used this guide to make a teensy++ controller for an IBM Model M. I am having some compilation errors that I cannot figure out.
Here is the pastebin of the entire compilation: http://pastebin.com/ewdfZi2K

Here is the important warning messages:
Spoiler:
keymap_poker.c:6:5: warning: excess elements in array initializer [enabled by default]
KEYMAP(
^
keymap_poker.c:6:5: warning: (near initialization for ‘keymaps[0][0]’) [enabled by default]
keymap_poker.c:6:5: warning: excess elements in array initializer [enabled by default]
keymap_poker.c:6:5: warning: (near initialization for ‘keymaps[0][1]’) [enabled by default]
keymap_poker.c:6:5: warning: excess elements in array initializer [enabled by default]
keymap_poker.c:6:5: warning: (near initialization for ‘keymaps[0][1]’) [enabled by default]
keymap_poker.c:6:5: warning: excess elements in array initializer [enabled by default]
keymap_poker.c:6:5: warning: (near initialization for ‘keymaps[0][1]’) [enabled by default]
keymap_poker.c:6:5: warning: excess elements in array initializer [enabled by default]
keymap_poker.c:6:5: warning: (near initialization for ‘keymaps[0][1]’) [enabled by default]
keymap_poker.c:6:5: warning: excess elements in array initializer [enabled by default]
keymap_poker.c:6:5: warning: (near initialization for ‘keymaps[0][1]’) [enabled by default]
keymap_poker.c:6:5: warning: excess elements in array initializer [enabled by default]
keymap_poker.c:6:5: warning: (near initialization for ‘keymaps[0][2]’) [enabled by default]
keymap_poker.c:6:5: warning: excess elements in array initializer [enabled by default]
keymap_poker.c:6:5: warning: (near initialization for ‘keymaps[0][2]’) [enabled by default]
keymap_poker.c:6:5: warning: excess elements in array initializer [enabled by default]
keymap_poker.c:6:5: warning: (near initialization for ‘keymaps[0][2]’) [enabled by default]
keymap_poker.c:6:5: warning: excess elements in array initializer [enabled by default]
keymap_poker.c:6:5: warning: (near initialization for ‘keymaps[0][2]’) [enabled by default]
keymap_poker.c:6:5: warning: excess elements in array initializer [enabled by default]
keymap_poker.c:6:5: warning: (near initialization for ‘keymaps[0][2]’) [enabled by default]
keymap_poker.c:6:5: warning: excess elements in array initializer [enabled by default]
keymap_poker.c:6:5: warning: (near initialization for ‘keymaps[0][3]’) [enabled by default]
keymap_poker.c:6:5: warning: excess elements in array initializer [enabled by default]
keymap_poker.c:6:5: warning: (near initialization for ‘keymaps[0][3]’) [enabled by default]
keymap_poker.c:6:5: warning: excess elements in array initializer [enabled by default]
keymap_poker.c:6:5: warning: (near initialization for ‘keymaps[0][3]’) [enabled by default]
keymap_poker.c:6:5: warning: excess elements in array initializer [enabled by default]
keymap_poker.c:6:5: warning: (near initialization for ‘keymaps[0][3]’) [enabled by default]
keymap_poker.c:6:5: warning: excess elements in array initializer [enabled by default]
keymap_poker.c:6:5: warning: (near initialization for ‘keymaps[0][4]’) [enabled by default]
keymap_poker.c:6:5: warning: excess elements in array initializer [enabled by default]
keymap_poker.c:6:5: warning: (near initialization for ‘keymaps[0][4]’) [enabled by default]
keymap_poker.c:6:5: warning: excess elements in array initializer [enabled by default]
keymap_poker.c:6:5: warning: (near initialization for ‘keymaps[0][4]’) [enabled by default]
keymap_poker.c:6:5: warning: excess elements in array initializer [enabled by default]
keymap_poker.c:6:5: warning: (near initialization for ‘keymaps[0][4]’) [enabled by default]
keymap_poker.c:6:5: warning: excess elements in array initializer [enabled by default]
keymap_poker.c:6:5: warning: (near initialization for ‘keymaps[0][4]’) [enabled by default]
keymap_poker.c:6:5: warning: excess elements in array initializer [enabled by default]
keymap_poker.c:6:5: warning: (near initialization for ‘keymaps[0][5]’) [enabled by default]
keymap_poker.c:6:5: warning: excess elements in array initializer [enabled by default]
keymap_poker.c:6:5: warning: (near initialization for ‘keymaps[0][5]’) [enabled by default]
keymap_poker.c:6:5: warning: excess elements in array initializer [enabled by default]
keymap_poker.c:6:5: warning: (near initialization for ‘keymaps[0][5]’) [enabled by default]
keymap_poker.c:6:5: warning: excess elements in array initializer [enabled by default]
keymap_poker.c:6:5: warning: (near initialization for ‘keymaps[0][5]’) [enabled by default]
Here is a google drive folder of all the files in the /gh60 directory: https://drive.google.com/folderview?id= ... sp=sharing

I appreciate any help.
I compared it with mine and in keymap_poker.c at around line 12 you have:

Code: Select all

...RGHT, P0,         PDOT        ),
That comma shouldn't be there unless you have an FN layer after it, so try removing it.

weldawadyathink

24 Mar 2015, 23:48

ROFLmonster wrote:
weldawadyathink wrote: snip
I compared it with mine and in keymap_poker.c at around line 12 you have:

Code: Select all

...RGHT, P0,         PDOT        ),
That comma shouldn't be there unless you have an FN layer after it, so try removing it.
I removed that comma, but that doesnt seem to have fixed the warning messages. The firmware did compile successfully, so I tried flashing it (using make -f Makefile teensy), but it has some problems. The key layout is all wonky and half of the keys don't do anything. Also after about a minute, it will continuously type v, forcing me to unplug it. I will try looking through my code when I have some time later. I appreciate the help.

ROFLmonster

25 Mar 2015, 07:41

Try looking at your wiring, but if it compiled you're on the right track. I remember I had problems where the num lock led was set to a pin I was using, so check that out in led.c.

If not that it's somewhere in matrix.c probably.

seankeyboard

25 Mar 2015, 23:53

Not sure if anyone can help me but I have this issue that if I have the teensy plugged in while booting windows7, windows fails to boot.

SkySorcerer

27 Mar 2015, 00:48

Greetings, everyone. I really hope you can help me with this. I have followed the guide, and I'm sure it's some stupid error on my config files but I just can't see it. The first block shows the errors, and the other two my actual code. I can't understand the argument restriction for KEYMAP_ANSI. How can I override that? My keyboard will have 58 keys. If you have a minute, can you point what I'm doing wrong? Thanks in advance.

Code: Select all

keymap_common.h:46:1: error: parameter name missing
 ) { \
 ^
keymap_poker.c:10:56: error: macro "KEYMAP_ANSI" requires 61 arguments, but only 58 given
         LCTL,LALT,           SPC,             RALT,RCTL),
                                                        ^
keymap_poker.c:5:9: error: ‘KEYMAP_ANSI’ undeclared here (not in a function)
         KEYMAP_ANSI(
         ^
keymap_poker.c:18:37: error: macro "KEYMAP_ANSI" requires 61 arguments, but only 58 given
         TRNS, TRNS, TRNS, TRNS, TRNS),
                                     ^
make: *** [obj_gh60_lufa/keymap_poker.o] Error 1

Code: Select all

#include "keymap_common.h"

const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
        /* 0: qwerty */
        KEYMAP_ANSI(
        GRV, 1,  2,  3,  4,  5,  6,  7,  8,   9,   0,   MINS, EQL, BSPC, \
        TAB, Q,  W,  E,  R,  T,  Y,  U,  I,   O,   P,   LBRC, RBRC,BSLS, \
        FN0, A,  S,  D,  F,  G,  H,  J,  K,   L,   SCLN,QUOT,ENT,  \
        LSFT,Z,  X,  C,  V,  B,  N,  M,  COMM,DOT, SLSH,RSFT, \
        LCTL,LALT,           SPC,             RALT,RCTL),

        /* 1: FN 1 */
        KEYMAP_ANSI(
        ESC,  F1,   F2,   F3,   F4,   F5,   F6,   F7,   F8,   F9,   F10,  F11,  F12,  TRNS, \
        TRNS, TRNS, UP,   TRNS, TRNS, TRNS, TRNS, INS,  HOME, PGUP, TRNS, TRNS, TRNS, TRNS, \
        TRNS, LEFT, DOWN, RGHT, TRNS, TRNS, TRNS, DEL,  END,  PGDN, TRNS, TRNS, TRNS,  \
        TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS,  \
        TRNS, TRNS, TRNS, TRNS, TRNS),
};
const uint16_t PROGMEM fn_actions[] = {
  [0] = ACTION_LAYER_MOMENTARY(1),
};

Code: Select all

/*
Copyright 2012,2013 Jun Wako <wakojun@gmail.com>

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef KEYMAP_COMMON_H
#define KEYMAP_COMMON_H

#include <stdint.h>
#include <stdbool.h>
#include <avr/pgmspace.h>
#include "keycode.h"
#include "action.h"
#include "action_macro.h"
#include "report.h"
#include "host.h"
#include "print.h"
#include "debug.h"
#include "keymap.h"


extern const uint8_t keymaps[][MATRIX_ROWS][MATRIX_COLS];
extern const uint16_t fn_actions[];


/* GH60 keymap definition macro
 * K2C, K31 and  K3C are extra keys for ISO
 */
#define KEYMAP( \
    K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, \
    K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, \
    K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, K2C, \
    K30, K31, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K3C, \
    K40, K41,                K45,                     K4A, K4B, K4C, \
) { \
    { KC_##K00, KC_##K01, KC_##K02, KC_##K03, KC_##K04, KC_##K05, KC_##K06, KC_##K07, KC_##K08, KC_##K09, KC_##K0A, KC_##K0B, KC_##K0C }, \
    { KC_##K10, KC_##K11, KC_##K12, KC_##K13, KC_##K14, KC_##K15, KC_##K16, KC_##K17, KC_##K18, KC_##K19, KC_##K1A, KC_##K1B, KC_##K1C }, \
    { KC_##K20, KC_##K21, KC_##K22, KC_##K23, KC_##K24, KC_##K25, KC_##K26, KC_##K27, KC_##K28, KC_##K29, KC_##K2A, KC_##K2B, KC_##K2C }, \
    { KC_##K30, KC_##K31, KC_##K32, KC_##K33, KC_##K34, KC_##K35, KC_##K36, KC_##K37, KC_##K38, KC_##K39, KC_##K3A, KC_##K3B, KC_##K3C }, \
    { KC_##K40, KC_##K41, KC_NO,    KC_NO,    KC_NO,    KC_##K45, KC_NO,    KC_NO,    KC_NO,    KC_NO,    KC_##K4A, KC_##K4B, KC_##K4C }  \

}

/* 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


User avatar
Halvar

27 Mar 2015, 09:50

@SkySorcerer:

1) Check the commas. If you have a list of "things" separated by commas, you can't have a comma after the last "thing" in the list. In this case, arguments to the KEYMAP macro and keymaps in the keymaps[][][] array.

2) Since your KEYMAP_ANSI macro has 61 arguments, you need to give it 61 arguments when you call it. If you have only 58 keys on your keyboard, you could just submit some arbitrary keycodes for the places in the matrix that your keyboard doesn't have, or, better, define a new macro KEYMAP_YOURBOARD that fits your board, i.e., copy the definition of KEYBOARD or KEYBOARD_ANSI, rename it and edit it to fit your board.

@seankeyboard: I think maybe you should post the problem in hasu's thread about the TMK software with a more detailed description of what happens and what you tried. Does it hang in the BIOS or during the Windows startup phase? What exactlly happens? Does it work if you plug it in when Windows is already running? I probably won't be able to help you even with this info, but maybe someone else can.

User avatar
Bhuyakasha

27 Mar 2015, 16:03

Not sure if this is the best place to post this, but I have a Teensy 3.1, could someone point me in the direction of some tutorial or documentation on that?

In particular I'm unsure how to rewrite the code for the readout of the pins:

Code: Select all

static void  init_cols(void)
{
    // Input with pull-up(DDR:0, PORT:1)
    DDRF  &= ~(1<<7);
    PORTF |=  (1<<7);
    DDRB  &= ~(1<<6 | 1<<5 | 1<<4 );
    PORTB |=  (1<<6 | 1<<5 | 1<<4);
}
This would be the code for pins F7, B4, B5, B6 on the teensy 2.0.
The Teensy 3.1 however has different pinnames, so how would I rewrite this code for say pins 0,1,2,3?

Maybe something like this?

Code: Select all

static void  init_cols(void)
{
    // Input with pull-up(DDR:0, PORT:1)
    DDR  &= ~(1<<0);
    PORT |=  (1<<0);
    DDR  &= ~(1<<1 | 1<<2 | 1<<3 );
    PORT |=  (1<<1 | 1<<2 | 1<<3);
}

User avatar
scottc

27 Mar 2015, 16:09

Teensy 3.1 has an ARM processor so isn't compatible with TMK (to my knowledge).

User avatar
Bhuyakasha

27 Mar 2015, 17:02

Hm, alright that's something I didn't know about.. Do you know of any firmware that would work on the Teensy 3.1?

EDIT: I found something, https://geekhack.org/index.php?topic=65628.0, https://github.com/kiibohd/controller

Post Reply

Return to “Workshop”