How to build your very own keyboard firmware

cramcomplex

14 May 2016, 03:10

Hey guys, having the following error when compiling and if you guys don't mind, I need a new set of eyes looking at the code.

Getting an error of:

Code: Select all

keymap_poker.c:18:73: error: macro "KEYMAP" passed 81 arguments, but just takes 66
keymap_poker.c:12: error: "KEYMAP" undeclared here <not in a function>
I commented out my FN Matrix and it compiled fine...so I'm thinking that's where the problem lies...any help is appreciated.

Here's my keymap_common.h

Code: Select all

/*
Copyright 2012,2013 Jun Wako <wakojun@gmail.com>
*/
#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[];

#define 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, K2C, \
    K30, K31, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K3C, K3D, \
    K40, K41, K42, K43,           K46,      K48, K49, K4A, K4B, K4C, K4D \
) { \
    { 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_##K0D }, \
    { 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_##K1D }, \
    { 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_NO }, \
    { 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_##K3D }, \
    { KC_##K40, KC_##K41, KC_##K42, KC_##K43, KC_NO,    KC_NO,    KC_##K46, KC_NO,    KC_##K48, KC_##K49, KC_##K4A, KC_##K4B, KC_##K4C, KC_##K4D }  \
}
#endif
here is my keymap_poker.c

Code: Select all

#include "keymap_common.h"

const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
	/* 0: qwerty */
	KEYMAP(
		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,  \
		CAPS, A,    S,    D,    F,    G,    H,    J,    K,    L,    SCLN, QUOT, ENT,         \
		LSFT, Z,    X,    C,    V,    B,    N,    M,    COMM, DOT,  SLSH, RSFT, UP, MS_R,    \
		LCTL, FN0,  LGUI, LALT,             SPC,        RALT, RGUI, RCTL, LEFT, DOWN, RGHT),
	/* 1: FN 0 */
	KEYMAP(
		ESC, F1,  F2,  F3,  F4,  F5,  F6,  F7,   F8,  F9,  F10, F11, F12, PSCR, \
		TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, \
		TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, \
		TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, \
		TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, TRNS,TRNS,TRNS,TRNS,PGUP,TRNS, \
		TRNS,TRNS,TRNS,TRNS,          TRNS,      TRNS,TRNS,TRNS,TRNS,PGDN,TRNS),
};
const uint16_t PROGMEM fn_actions[] = {
	[0] = ACTION_LAYER_MOMENTARY(1),
};

User avatar
flabbergast

14 May 2016, 09:16

The error

Code: Select all

keymap_poker.c:18:73: error: macro "KEYMAP" passed 81 arguments, but just takes 66
means exactly what it says - you have too many parameters inside the "KEYMAP(....)" in your keymap_poker.c. You have there one extra line of "keys".

cramcomplex

14 May 2016, 13:59

flabbergast wrote: The error

Code: Select all

keymap_poker.c:18:73: error: macro "KEYMAP" passed 81 arguments, but just takes 66
means exactly what it says - you have too many parameters inside the "KEYMAP(....)" in your keymap_poker.c. You have there one extra line of "keys".
OMG...thank you so much for that! I realized I had an entire row or TRNS! Appreciate the help! :oops:

Clockwork

19 May 2016, 02:41

I'm trying to use a teensy 3.2 as a micro controller, and I'm confused about how I should be referring to ports. The 3.2 only has numbered ports, no ports that use a number and a letter (aside from the analog ports). When I use DDR, PORT or PIN should I even append a letter? I've done a lot of googling and can't find anything about it.

Any help would be hugely appreciated

Edit: I'm dumb, disregard this.

User avatar
solkoseryl

19 May 2016, 18:04

Hello friends,

I'm working on a project to PCize the keyboard of my childhood — the old Soviet Izot Magnetic Reed Switch terminal monster. The one I was luckily found is not exactly the same, but the switches are the good old ones though. It was always been my dream, and several years ago I've joined the keyboard community because I couldn't forget that heavy thucking beasts which was capable of bearing the mobs of students without a single failure.

For some reasons, I've decided to create the new Teensy-based PCB for this keyboard.

I've accurately measured the switches and the case, created the KiCad PCB drawings, sent them to the manufacturer and ordered other needable parts. And now it's about time to create the firmware.

Thanks to Matt3o's neat lessons, I mostly understand the path I should follow, but one thing still holds me. I've got a bunch of the extremely old-fashioned key legend combinations. And following symbol pairs are sharing the same keys: 2 and ", 6 and &, 7 and ', 8 and (, 9 and ), ; and +, : and *. Also, there are @ and ^ at non-shifted positions. The problem is that guys just don't fit the USB keyboard standard, but maybe there IS any way to implement this layout using TMK?

As far as I've got, I could use Fn keys. But what I don't understand is how to assign the different meanings for these keys at the normal and shifted positions? Is it possible after all? If TMK can't, then maybe another firmware exists to help me to realise this task?

Thank you in advance for the answers!

And here is the layout itself, the troublesome keys are marked with red outlines:
keyboard-layout_trouble-keys.jpg
keyboard-layout_trouble-keys.jpg (137.07 KiB) Viewed 7796 times

User avatar
Halvar

19 May 2016, 19:26

By the logic of how PC keyboards work, the proper way to do this would be to make a fitting keymap for your PC operating system. In a keymap you can freely define what every key does, alone or when pressed in conjunction with modifiers. There are free keyboard layouting tools for all major OSs. I'd recommend this unless you are a sysadmin who works on a huge number of machines every day...

The keyboard only sends scancodes to the PC, and there's a scancode for every key that standard PC keyboards have.

If you insist you want to do it in the keyboard, there are macros as workarounds supported by TMK. This means that if the user for example presses shift and then 6, the keyboard would instead send the combination of keypresses that are needed to reach the ampersand & on the keyboard layout that the user's OS is set to. On first sight, this may not sound too bad, but it has some annoying disadvantages. First of all, the macros in the keyboard would be dependent on the keymap that is set in the OS, which is basically the other way around of how it should work. Then there's the problem with modifiers when more than one key is pressed at the same time. Say you press down the @ key on your board, the macro changes this into sending Shift + 2 because that's how you'd get @ on the keymap in your OS. Then, while still having @ pressed, you press another key, say "s". The OS will interpret that as "S" becaus without you really doing it, the shift key is still pressed from the @ macro.

You can do it in TMK, but it's always a bad hack.

User avatar
tentator

19 May 2016, 23:34

Guys, quick question: is it possible to remap a shift+key to something different with the TMK?
What I mean is if I have, say key Q assigned at some position that key will than automatically send all the codes included the ones with modifiers like shift, alt, etc, right? it's not possible to configure TMK to send q when pressed unmodified and send Esc insted when pressed with shift (instead of the expected Q).
Well it's more difficult to explain than to mean.. ghgh..

tent:wq

miguel

20 May 2016, 19:10

Hey, I created my own keyboard for the first time (10 keyless), but am having trouble with the very last step of the coding. I cant seem to run the Makefile, I always get an error saying "avr-gcc.exe- Application error 'The application was unable to start correctly (0xc0000142). Click OK to close the application.'"

Help..!!

*EDIT*
I am running windows 10 pro 64 bit, if that matters, and am using a teensy 2.0

User avatar
Halvar

20 May 2016, 19:52

You're using WinAVR, right? IIRC, this is a well known problem with WinAVR and newer versions of Windows. I'm on my phone, so I can't really search too much right now, but googling the error message should lead you to a patch fast.

User avatar
Halvar

20 May 2016, 21:28


User avatar
Ray

20 May 2016, 22:12

tentator wrote: Guys, quick question: is it possible to remap a shift+key to something different with the TMK?
What I mean is if I have, say key Q assigned at some position that key will than automatically send all the codes included the ones with modifiers like shift, alt, etc, right? it's not possible to configure TMK to send q when pressed unmodified and send Esc insted when pressed with shift (instead of the expected Q).
Well it's more difficult to explain than to mean.. ghgh..

tent:wq
One way to do that would be make your "Shift" key switch layers and on that layer have a lot of FNxx'es, most of them being shifted keypresses, but Q something else. You might run out of FNxx'es though.
There's also a not so well documented way, where you don't have the standard TMK keymap, but something that can contain more complex stuff than regular keys. I think this is experimental at the moment. If you are interested, we could look into that, since I had similar wishes for my layouts in the past.

User avatar
tentator

20 May 2016, 22:25

uhm.. that idea with separate layer seems a bit strange but might work.. do you know otherwise where to find something about that other non documented way?
you see, I'd like to study something for my next 40% project where I'd like to have more flexibility on keys by also changing SHIFT+key behaviour etc..

User avatar
Ray

20 May 2016, 23:08

it is called actionmap instead of keymap. Actions use 16bit while keys use 8bit. It will not be less strange; see
https://github.com/tmk/tmk_keyboard/issues/180
https://geekhack.org/index.php?topic=41 ... msg1885526
for "examples".

So far I tried to get along with the 32 available FNs, but actionmaps would give me more freedom / less restrictions of my layouts. I did avoid it though, since I didn't want to wrap my mind around it.

Edit: Or solve your problem in software, not firmware. That's probably the easier way if you don't use your board on a lot of computers/OSes.

miguel

21 May 2016, 05:47

flabbergast wrote: I like to go vanilla with installations, so:

1) Installed cygwin (one package to select on top of the 'recommended' installation is make; I also installed git). This is really an installer. After installation, the "Cygwin64 Terminal" icon drops one into a familiar shell (oh the relief...)

2) Downloaded avr-gcc. That's a zip, so just unpack it somewhere (I used d:\avr-gcc). Add d:\avr-gcc\bin to PATH (google. it's in 'advanced system settings' -> 'environment variables')

After this {EDIT: probably a reboot}, I just downloaded and unpacked tmk_keyboard, go into cygwin shell, cd to tmk_keyboard_master/keyboard/gh60 and run make. Compiles fine.

However Jack Humbert seems to recommend the inferno tools.
I used Jack Humbert's suggestion, and my file seems to begun to have compiled. However, now i receive a different error, it says :

failed
make: *** [obj_gh60_lufa/keymap_poker.o] Error 1

above it there are a whole bunch of lines telling me that many of my keys are undeclared

User avatar
Eszett

21 May 2016, 07:16

@Halvar, you mentioned two disadvantages of using TMK to serve solkoseryl's intentions:
First of all, the macros in the keyboard would be dependent on the keymap that is set in the OS ... Then there's the problem with modifiers when more than one key is pressed at the same time. Say you press down the @ key on your board, the macro changes this into sending Shift + 2 because that's how you'd get @ on the keymap in your OS.
I'm not sure, but using TMK-macros with pasting Unicode-letters would avoid both disadvantages, isn't it?

User avatar
flabbergast

21 May 2016, 09:03

miguel wrote: failed
make: *** [obj_gh60_lufa/keymap_poker.o] Error 1

above it there are a whole bunch of lines telling me that many of my keys are undeclared
This is not the actual error, just a message that the compilation failed. The actual problem is printed above this message. If you want someone here to try to help you, you need to give us the full compilation output; the best way is to use pastebin.

User avatar
Ray

21 May 2016, 09:39

Eszett wrote: I'm not sure, but using TMK-macros with pasting Unicode-letters would avoid both disadvantages, isn't it?
Is there an OS independent way of pasting unicode-letters?

miguel

22 May 2016, 05:18

Here is the error message I get when I try to compile(Big shoutout to everyone here for helping me out and being so friendly, and apologies to everyone for being a beginner):

Code: Select all

C:\Users\Miguel\Desktop\tmk_keyboard-master\keyboard\gh60>make -f Makefile

-------- begin --------
avr-gcc (GCC) 4.8.2 20131010 (prerelease)
Copyright (C) 2013 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.


mkdir -p obj_gh60_lufa
Compiling C: keymap_poker.c
avr-gcc -c -mmcu=atmega32u4 -gdwarf-2 -DF_CPU=16000000UL -DINTERRUPT_CONTROL_ENDPOINT -DBOOTLOADER_SIZE=4096 -DF_USB=16000000UL -DARCH=ARCH_AVR8 -DUSB_DEVICE_ONLY -DUSE_FLASH_DESCRIPTORS -DUSE_STATIC_OPTIONS="(USB_DEVICE_OPT_FULLSPEED | USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)" -DFIXED_CONTROL_ENDPOINT_SIZE=8  -DFIXED_NUM_CONFIGURATIONS=1 -DPROTOCOL_LUFA -DBOOTMAGIC_ENABLE -DMOUSEKEY_ENABLE -DMOUSE_ENABLE -DEXTRAKEY_ENABLE -DCONSOLE_ENABLE -DCOMMAND_ENABLE -DNKRO_ENABLE -DVERSION=unknown -Os -funsigned-char -funsigned-bitfields -ffunction-sections -fdata-sections -fno-inline-small-functions -fpack-struct -fshort-enums -fno-strict-aliasing -Wall -Wstrict-prototypes -Wa,-adhlns=obj_gh60_lufa/keymap_poker.lst -I. -I../../tmk_core -I../../tmk_core/protocol/lufa -I../../tmk_core/protocol/lufa/LUFA-git -I../../tmk_core/common -std=gnu99 -include config.h -MMD -MP -MF .dep/obj_gh60_lufa_keymap_poker.o.d  keymap_poker.c -o obj_gh60_lufa/keymap_poker.o
In file included from keymap_poker.c:1:0:
keymap_common.h:47:1: error: parameter name missing
 ) { \
 ^
keymap_poker.c:5:5: warning: implicit declaration of function 'KEYMAP' [-Wimplicit-function-declaration]
     KEYMAP(ESC,  F1,   F2,   F3,   F4,   F5,   F6,   F7,   F8,   F9,   F9,    F10,  F11,   F12,  PSCR ,  Q,  PAUS,  \
     ^
keymap_poker.c:5:12: error: 'ESC' undeclared here (not in a function)
     KEYMAP(ESC,  F1,   F2,   F3,   F4,   F5,   F6,   F7,   F8,   F9,   F9,    F10,  F11,   F12,  PSCR ,  Q,  PAUS,  \
            ^
keymap_poker.c:5:18: error: 'F1' undeclared here (not in a function)
     KEYMAP(ESC,  F1,   F2,   F3,   F4,   F5,   F6,   F7,   F8,   F9,   F9,    F10,  F11,   F12,  PSCR ,  Q,  PAUS,  \
                  ^
keymap_poker.c:5:24: error: 'F2' undeclared here (not in a function)
     KEYMAP(ESC,  F1,   F2,   F3,   F4,   F5,   F6,   F7,   F8,   F9,   F9,    F10,  F11,   F12,  PSCR ,  Q,  PAUS,  \
                        ^
keymap_poker.c:5:30: error: 'F3' undeclared here (not in a function)
     KEYMAP(ESC,  F1,   F2,   F3,   F4,   F5,   F6,   F7,   F8,   F9,   F9,    F10,  F11,   F12,  PSCR ,  Q,  PAUS,  \
                              ^
keymap_poker.c:5:36: error: 'F4' undeclared here (not in a function)
     KEYMAP(ESC,  F1,   F2,   F3,   F4,   F5,   F6,   F7,   F8,   F9,   F9,    F10,  F11,   F12,  PSCR ,  Q,  PAUS,  \
                                    ^
keymap_poker.c:5:42: error: 'F5' undeclared here (not in a function)
     KEYMAP(ESC,  F1,   F2,   F3,   F4,   F5,   F6,   F7,   F8,   F9,   F9,    F10,  F11,   F12,  PSCR ,  Q,  PAUS,  \
                                          ^
keymap_poker.c:5:48: error: 'F6' undeclared here (not in a function)
     KEYMAP(ESC,  F1,   F2,   F3,   F4,   F5,   F6,   F7,   F8,   F9,   F9,    F10,  F11,   F12,  PSCR ,  Q,  PAUS,  \
                                                ^
keymap_poker.c:5:54: error: 'F7' undeclared here (not in a function)
     KEYMAP(ESC,  F1,   F2,   F3,   F4,   F5,   F6,   F7,   F8,   F9,   F9,    F10,  F11,   F12,  PSCR ,  Q,  PAUS,  \
                                                      ^
keymap_poker.c:5:60: error: 'F8' undeclared here (not in a function)
     KEYMAP(ESC,  F1,   F2,   F3,   F4,   F5,   F6,   F7,   F8,   F9,   F9,    F10,  F11,   F12,  PSCR ,  Q,  PAUS,  \
                                                            ^
keymap_poker.c:5:66: error: 'F9' undeclared here (not in a function)
     KEYMAP(ESC,  F1,   F2,   F3,   F4,   F5,   F6,   F7,   F8,   F9,   F9,    F10,  F11,   F12,  PSCR ,  Q,  PAUS,  \
                                                                  ^
keymap_poker.c:5:79: error: 'F10' undeclared here (not in a function)
     KEYMAP(ESC,  F1,   F2,   F3,   F4,   F5,   F6,   F7,   F8,   F9,   F9,    F10,  F11,   F12,  PSCR ,  Q,  PAUS,  \
                                                                               ^
keymap_poker.c:5:85: error: 'F11' undeclared here (not in a function)
     KEYMAP(ESC,  F1,   F2,   F3,   F4,   F5,   F6,   F7,   F8,   F9,   F9,    F10,  F11,   F12,  PSCR ,  Q,  PAUS,  \
                                                                                     ^
keymap_poker.c:5:92: error: 'F12' undeclared here (not in a function)
     KEYMAP(ESC,  F1,   F2,   F3,   F4,   F5,   F6,   F7,   F8,   F9,   F9,    F10,  F11,   F12,  PSCR ,  Q,  PAUS,  \
                                                                                            ^
keymap_poker.c:5:98: error: 'PSCR' undeclared here (not in a function)
     KEYMAP(ESC,  F1,   F2,   F3,   F4,   F5,   F6,   F7,   F8,   F9,   F9,    F10,  F11,   F12,  PSCR ,  Q,  PAUS,  \
                                                                                                  ^
keymap_poker.c:5:106: error: 'Q' undeclared here (not in a function)
     KEYMAP(ESC,  F1,   F2,   F3,   F4,   F5,   F6,   F7,   F8,   F9,   F9,    F10,  F11,   F12,  PSCR ,  Q,  PAUS,  \
                                                                                                          ^
keymap_poker.c:5:110: error: 'PAUS' undeclared here (not in a function)
     KEYMAP(ESC,  F1,   F2,   F3,   F4,   F5,   F6,   F7,   F8,   F9,   F9,    F10,  F11,   F12,  PSCR ,  Q,  PAUS,  \
                                                                                                              ^
keymap_poker.c:6:13: error: 'MUTE' undeclared here (not in a function)
             MUTE,     1,     2,  3,  4,   5,  6,   7,   8,   9,   0,  MINS,  EQL,  BSPC,  INST, HOME, PGUP, \
             ^
keymap_poker.c:6:71: error: 'MINS' undeclared here (not in a function)
             MUTE,     1,     2,  3,  4,   5,  6,   7,   8,   9,   0,  MINS,  EQL,  BSPC,  INST, HOME, PGUP, \
                                                                       ^
keymap_poker.c:6:78: error: 'EQL' undeclared here (not in a function)
             MUTE,     1,     2,  3,  4,   5,  6,   7,   8,   9,   0,  MINS,  EQL,  BSPC,  INST, HOME, PGUP, \
                                                                              ^
keymap_poker.c:6:84: error: 'BSPC' undeclared here (not in a function)
             MUTE,     1,     2,  3,  4,   5,  6,   7,   8,   9,   0,  MINS,  EQL,  BSPC,  INST, HOME, PGUP, \
                                                                                    ^
keymap_poker.c:6:91: error: 'INST' undeclared here (not in a function)
             MUTE,     1,     2,  3,  4,   5,  6,   7,   8,   9,   0,  MINS,  EQL,  BSPC,  INST, HOME, PGUP, \
                                                                                           ^
keymap_poker.c:6:97: error: 'HOME' undeclared here (not in a function)
             MUTE,     1,     2,  3,  4,   5,  6,   7,   8,   9,   0,  MINS,  EQL,  BSPC,  INST, HOME, PGUP, \
                                                                                                 ^
keymap_poker.c:6:103: error: 'PGUP' undeclared here (not in a function)
             MUTE,     1,     2,  3,  4,   5,  6,   7,   8,   9,   0,  MINS,  EQL,  BSPC,  INST, HOME, PGUP, \
                                                                                                       ^
keymap_poker.c:7:12: error: 'TAB' undeclared here (not in a function)
            TAB,  Q,   W,   E,   R,   T,   Y,   U,   I,   O,   P,   LBRC,RBRC,BSLS,  DEL, END,  PGDN,   \
            ^
keymap_poker.c:7:23: error: 'W' undeclared here (not in a function)
            TAB,  Q,   W,   E,   R,   T,   Y,   U,   I,   O,   P,   LBRC,RBRC,BSLS,  DEL, END,  PGDN,   \
                       ^
keymap_poker.c:7:28: error: 'E' undeclared here (not in a function)
            TAB,  Q,   W,   E,   R,   T,   Y,   U,   I,   O,   P,   LBRC,RBRC,BSLS,  DEL, END,  PGDN,   \
                            ^
keymap_poker.c:7:33: error: 'R' undeclared here (not in a function)
            TAB,  Q,   W,   E,   R,   T,   Y,   U,   I,   O,   P,   LBRC,RBRC,BSLS,  DEL, END,  PGDN,   \
                                 ^
keymap_poker.c:7:38: error: 'T' undeclared here (not in a function)
            TAB,  Q,   W,   E,   R,   T,   Y,   U,   I,   O,   P,   LBRC,RBRC,BSLS,  DEL, END,  PGDN,   \
                                      ^
keymap_poker.c:7:43: error: 'Y' undeclared here (not in a function)
            TAB,  Q,   W,   E,   R,   T,   Y,   U,   I,   O,   P,   LBRC,RBRC,BSLS,  DEL, END,  PGDN,   \
                                           ^
keymap_poker.c:7:48: error: 'U' undeclared here (not in a function)
            TAB,  Q,   W,   E,   R,   T,   Y,   U,   I,   O,   P,   LBRC,RBRC,BSLS,  DEL, END,  PGDN,   \
                                                ^
keymap_poker.c:7:53: error: 'I' undeclared here (not in a function)
            TAB,  Q,   W,   E,   R,   T,   Y,   U,   I,   O,   P,   LBRC,RBRC,BSLS,  DEL, END,  PGDN,   \
                                                     ^
keymap_poker.c:7:58: error: 'O' undeclared here (not in a function)
            TAB,  Q,   W,   E,   R,   T,   Y,   U,   I,   O,   P,   LBRC,RBRC,BSLS,  DEL, END,  PGDN,   \
                                                          ^
keymap_poker.c:7:63: error: 'P' undeclared here (not in a function)
            TAB,  Q,   W,   E,   R,   T,   Y,   U,   I,   O,   P,   LBRC,RBRC,BSLS,  DEL, END,  PGDN,   \
                                                               ^
keymap_poker.c:7:68: error: 'LBRC' undeclared here (not in a function)
            TAB,  Q,   W,   E,   R,   T,   Y,   U,   I,   O,   P,   LBRC,RBRC,BSLS,  DEL, END,  PGDN,   \
                                                                    ^
keymap_poker.c:7:73: error: 'RBRC' undeclared here (not in a function)
            TAB,  Q,   W,   E,   R,   T,   Y,   U,   I,   O,   P,   LBRC,RBRC,BSLS,  DEL, END,  PGDN,   \
                                                                         ^
keymap_poker.c:7:78: error: 'BSLS' undeclared here (not in a function)
            TAB,  Q,   W,   E,   R,   T,   Y,   U,   I,   O,   P,   LBRC,RBRC,BSLS,  DEL, END,  PGDN,   \
                                                                              ^
keymap_poker.c:7:85: error: 'DEL' undeclared here (not in a function)
            TAB,  Q,   W,   E,   R,   T,   Y,   U,   I,   O,   P,   LBRC,RBRC,BSLS,  DEL, END,  PGDN,   \
                                                                                     ^
keymap_poker.c:7:96: error: 'PGDN' undeclared here (not in a function)
            TAB,  Q,   W,   E,   R,   T,   Y,   U,   I,   O,   P,   LBRC,RBRC,BSLS,  DEL, END,  PGDN,   \
                                                                                                ^
keymap_poker.c:8:12: error: 'LCTL' undeclared here (not in a function)
            LCTL, A,   S,   D,   F,   G,   H,   J,   K,   L,   SCLN,QUOT,ENT,            \
            ^
keymap_poker.c:8:18: error: 'A' undeclared here (not in a function)
            LCTL, A,   S,   D,   F,   G,   H,   J,   K,   L,   SCLN,QUOT,ENT,            \
                  ^
keymap_poker.c:8:23: error: 'S' undeclared here (not in a function)
            LCTL, A,   S,   D,   F,   G,   H,   J,   K,   L,   SCLN,QUOT,ENT,            \
                       ^
keymap_poker.c:8:28: error: 'D' undeclared here (not in a function)
            LCTL, A,   S,   D,   F,   G,   H,   J,   K,   L,   SCLN,QUOT,ENT,            \
                            ^
keymap_poker.c:8:33: error: 'F' undeclared here (not in a function)
            LCTL, A,   S,   D,   F,   G,   H,   J,   K,   L,   SCLN,QUOT,ENT,            \
                                 ^
keymap_poker.c:8:38: error: 'G' undeclared here (not in a function)
            LCTL, A,   S,   D,   F,   G,   H,   J,   K,   L,   SCLN,QUOT,ENT,            \
                                      ^
keymap_poker.c:8:43: error: 'H' undeclared here (not in a function)
            LCTL, A,   S,   D,   F,   G,   H,   J,   K,   L,   SCLN,QUOT,ENT,            \
                                           ^
keymap_poker.c:8:48: error: 'J' undeclared here (not in a function)
            LCTL, A,   S,   D,   F,   G,   H,   J,   K,   L,   SCLN,QUOT,ENT,            \
                                                ^
keymap_poker.c:8:53: error: 'K' undeclared here (not in a function)
            LCTL, A,   S,   D,   F,   G,   H,   J,   K,   L,   SCLN,QUOT,ENT,            \
                                                     ^
keymap_poker.c:8:58: error: 'L' undeclared here (not in a function)
            LCTL, A,   S,   D,   F,   G,   H,   J,   K,   L,   SCLN,QUOT,ENT,            \
                                                          ^
keymap_poker.c:8:63: error: 'SCLN' undeclared here (not in a function)
            LCTL, A,   S,   D,   F,   G,   H,   J,   K,   L,   SCLN,QUOT,ENT,            \
                                                               ^
keymap_poker.c:8:68: error: 'QUOT' undeclared here (not in a function)
            LCTL, A,   S,   D,   F,   G,   H,   J,   K,   L,   SCLN,QUOT,ENT,            \
                                                                    ^
keymap_poker.c:8:73: error: 'ENT' undeclared here (not in a function)
            LCTL, A,   S,   D,   F,   G,   H,   J,   K,   L,   SCLN,QUOT,ENT,            \
                                                                         ^
keymap_poker.c:9:12: error: 'LSFT' undeclared here (not in a function)
            LSFT, Z,   X,   C,   V,   B,   N,   M,   COMM,DOT, SLSH,RSFT,  UP,      \
            ^
keymap_poker.c:9:18: error: 'Z' undeclared here (not in a function)
            LSFT, Z,   X,   C,   V,   B,   N,   M,   COMM,DOT, SLSH,RSFT,  UP,      \
                  ^
keymap_poker.c:9:23: error: 'X' undeclared here (not in a function)
            LSFT, Z,   X,   C,   V,   B,   N,   M,   COMM,DOT, SLSH,RSFT,  UP,      \
                       ^
keymap_poker.c:9:28: error: 'C' undeclared here (not in a function)
            LSFT, Z,   X,   C,   V,   B,   N,   M,   COMM,DOT, SLSH,RSFT,  UP,      \
                            ^
keymap_poker.c:9:33: error: 'V' undeclared here (not in a function)
            LSFT, Z,   X,   C,   V,   B,   N,   M,   COMM,DOT, SLSH,RSFT,  UP,      \
                                 ^
keymap_poker.c:9:38: error: 'B' undeclared here (not in a function)
            LSFT, Z,   X,   C,   V,   B,   N,   M,   COMM,DOT, SLSH,RSFT,  UP,      \
                                      ^
keymap_poker.c:9:43: error: 'N' undeclared here (not in a function)
            LSFT, Z,   X,   C,   V,   B,   N,   M,   COMM,DOT, SLSH,RSFT,  UP,      \
                                           ^
keymap_poker.c:9:48: error: 'M' undeclared here (not in a function)
            LSFT, Z,   X,   C,   V,   B,   N,   M,   COMM,DOT, SLSH,RSFT,  UP,      \
                                                ^
keymap_poker.c:9:53: error: 'COMM' undeclared here (not in a function)
            LSFT, Z,   X,   C,   V,   B,   N,   M,   COMM,DOT, SLSH,RSFT,  UP,      \
                                                     ^
keymap_poker.c:9:58: error: 'DOT' undeclared here (not in a function)
            LSFT, Z,   X,   C,   V,   B,   N,   M,   COMM,DOT, SLSH,RSFT,  UP,      \
                                                          ^
keymap_poker.c:9:63: error: 'SLSH' undeclared here (not in a function)
            LSFT, Z,   X,   C,   V,   B,   N,   M,   COMM,DOT, SLSH,RSFT,  UP,      \
                                                               ^
keymap_poker.c:9:68: error: 'RSFT' undeclared here (not in a function)
            LSFT, Z,   X,   C,   V,   B,   N,   M,   COMM,DOT, SLSH,RSFT,  UP,      \
                                                                    ^
keymap_poker.c:9:75: error: 'UP' undeclared here (not in a function)
            LSFT, Z,   X,   C,   V,   B,   N,   M,   COMM,DOT, SLSH,RSFT,  UP,      \
                                                                           ^
keymap_poker.c:10:19: error: 'WIN' undeclared here (not in a function)
            LCTL,  WIN,  LALT,            SPC,                     RALT,  WIN, PAUS, RCTL, LEFT, DOWN, RGHT),
                   ^
keymap_poker.c:10:25: error: 'LALT' undeclared here (not in a function)
            LCTL,  WIN,  LALT,            SPC,                     RALT,  WIN, PAUS, RCTL, LEFT, DOWN, RGHT),
                         ^
keymap_poker.c:10:42: error: 'SPC' undeclared here (not in a function)
            LCTL,  WIN,  LALT,            SPC,                     RALT,  WIN, PAUS, RCTL, LEFT, DOWN, RGHT),
                                          ^
keymap_poker.c:10:67: error: 'RALT' undeclared here (not in a function)
            LCTL,  WIN,  LALT,            SPC,                     RALT,  WIN, PAUS, RCTL, LEFT, DOWN, RGHT),
                                                                   ^
keymap_poker.c:10:85: error: 'RCTL' undeclared here (not in a function)
            LCTL,  WIN,  LALT,            SPC,                     RALT,  WIN, PAUS, RCTL, LEFT, DOWN, RGHT),
                                                                                     ^
keymap_poker.c:10:91: error: 'LEFT' undeclared here (not in a function)
            LCTL,  WIN,  LALT,            SPC,                     RALT,  WIN, PAUS, RCTL, LEFT, DOWN, RGHT),
                                                                                           ^
keymap_poker.c:10:97: error: 'DOWN' undeclared here (not in a function)
            LCTL,  WIN,  LALT,            SPC,                     RALT,  WIN, PAUS, RCTL, LEFT, DOWN, RGHT),
                                                                                                 ^
keymap_poker.c:10:103: error: 'RGHT' undeclared here (not in a function)
            LCTL,  WIN,  LALT,            SPC,                     RALT,  WIN, PAUS, RCTL, LEFT, DOWN, RGHT),
                                                                                                       ^
../../tmk_core/rules.mk:550: recipe for target 'obj_gh60_lufa/keymap_poker.o' failed
make: *** [obj_gh60_lufa/keymap_poker.o] Error 1

Last edited by miguel on 23 May 2016, 04:10, edited 1 time in total.

User avatar
Ray

22 May 2016, 10:34

Thank you for posting one problem in two places..
see here workshop-f7/tmk-code-help-please-t12646.html#p308935

User avatar
Eszett

22 May 2016, 11:06

Ray wrote:
Eszett wrote: I'm not sure, but using TMK-macros with pasting Unicode-letters would avoid both disadvantages, isn't it?
Is there an OS independent way of pasting unicode-letters?
Practically, I don't think so. But in case your company runs Windows on all workplaces, then you could at least use your keyboard with 30+ Windows PCs. With a custom keymap, you would be limited to one workplace. So ... better limited to an OS, than limited to one workplace, isnt it?

miguel

22 May 2016, 18:48

Sorry Ray, and everyone else. Should I delete my post here then? Apologies again for being such a noob.

huupie2

15 Jun 2016, 13:03

Thanks for this guide! Got my handwired planck sort of running now. I only have a problem with my FN keys. The keys i've assigned FN1 somehow output a 'g'. Is this common? Does anyone know how to fix it?

This is the layout I was trying (nowhere near anything i'd be able to use, just for the sake of trying the keyboard)

Code: Select all

 #include "keymap_common.h"

const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
/* 0: qwerty */
KEYMAP (ESC, Q, W, E, R, T, Y, U, I, O, P, BSPC, \
       TAB, A, S, D, F, G, H, J, K, L, SCLN, QUOT, \
	   LSFT, Z, X, C, V, B, N, M, COMM, DOT, SLSH, RSFT, \
	   LCTL, LALT, Q, PAUS, FN1, SPC, FN1, LEFT, DOWN, UP, RIGHT),

/* 1: FN 1 */
KEYMAP (TRNS, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, PSCR, \
       TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, \
	   TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, \
	   TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, MUTE, VOLD, VOLU, TRNS),
};

const uint16_t PROGMEM fn_actions[] = {
[0] = ACTION_LAYER_MOMENTARY(1)
}; 
I also don't know what to type in the keymap file for certain keys like the ~ key and a play/pause button, is there a page or something that contains all symbols?

User avatar
flabbergast

15 Jun 2016, 13:11

You should use FN0 (not FN1) - the number corresponds to the number in the brackets in fn_actions.
For the possible keycodes, see this post.
Note that you can't type e.g. tilde (~) directly on most layouts, simply because there is no such key. For the computer to produce a tilde, it needs to think that what was pressed is 'shift' and backtick (`) (on US layout). So to directly output a tilde, you'll need a macro that presses shift and `.

huupie2

15 Jun 2016, 14:05

Thanks a bunch, have the layers how i want them now, but get this message when trying to compile:

Code: Select all

 mkdir -p obj_gh60_lufa
Compiling C: keymap_poker.c
avr-gcc -c -mmcu=atmega32u4 -gdwarf-2 -DF_CPU=16000000UL -DINTERRUPT_CONTROL_ENDPOINT -DBOOTLOADER_SIZE=4096 -DF_USB=16000000UL -DARCH=ARCH_AVR8 -DUSB_DEVICE_ONLY -DUSE_FLASH_DESCRIPTORS -DUSE_STATIC_OPTIONS="(USB_DEVICE_OPT_FULLSPEED | USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)" -DFIXED_CONTROL_ENDPOINT_SIZE=8  -DFIXED_NUM_CONFIGURATIONS=1 -DPROTOCOL_LUFA -DBOOTMAGIC_ENABLE -DMOUSEKEY_ENABLE -DMOUSE_ENABLE -DEXTRAKEY_ENABLE -DCONSOLE_ENABLE -DCOMMAND_ENABLE -DVERSION=unknown -Os -funsigned-char -funsigned-bitfields -ffunction-sections -fdata-sections -fno-inline-small-functions -fpack-struct -fshort-enums -fno-strict-aliasing -Wall -Wstrict-prototypes -Wa,-adhlns=obj_gh60_lufa/keymap_poker.lst -I. -I../../tmk_core -I../../tmk_core/protocol/lufa -I../../tmk_core/protocol/lufa/LUFA-git -I../../tmk_core/common -std=gnu99 -include config.h -MMD -MP -MF .dep/obj_gh60_lufa_keymap_poker.o.d  keymap_poker.c -o obj_gh60_lufa/keymap_poker.o
keymap_poker.c:24: error: subscripted value is neither array nor pointer
make: *** [obj_gh60_lufa/keymap_poker.o] Error 1
This is the mapping:

Code: Select all

 #include "keymap_common.h"

const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
/* 0: qwerty */
KEYMAP (ESC, Q, W, E, R, T, Y, U, I, O, P, BSPC, \
       TAB, A, S, D, F, G, H, J, K, L, SCLN, QUOT, \
	   LSFT, Z, X, C, V, B, N, M, COMM, DOT, SLSH, RSFT, \
	   LCTL, LALT, ENT, PAUS, FN0, SPC, FN1, LEFT, DOWN, UP, RIGHT),

/* 1: FN 1 */
KEYMAP (F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, \
       TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, \
	   TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, \
	   TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, MUTE, VOLD, VOLU, MPLY),
/* 2: FN 2 */
KEYMAP (TRNS,  1, 2, 3, 4, 5, 6, 7, 8, 9, 0, TRNS, \
       TRNS, BTN1, BTN2, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, \
	   TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, \
	   TRNS, TRNS, TRNS, GRV, TRNS, TRNS, TRNS, TRNS, VOLD, VOLU, TRNS),
	   };

const uint16_t PROGMEM fn_actions[] = {
[0] = ACTION_LAYER_TOGGLE(1)
[1] = ACTION_LAYER_TOGGLE(2)
};
Can you find the mistake I made?

User avatar
Halvar

15 Jun 2016, 14:36

Which line is keymap_poker.c:24?

I'm not sure, but I think what you might need is a comma after

[0] = ACTION_LAYER_TOGGLE(1)

huupie2

15 Jun 2016, 15:28

Yay that was it! Thanks for your help!

User avatar
Hypersphere

15 Jun 2016, 19:14

@matt3o: Thanks for creating this excellent tutorial and forum for keyboard firmware.

I wanted to add a cautionary note about winavr. I learned the hard way to take care when installing this. When I installed winavr, without thinking, I accepted its offer to modify my path. It overwrote my path, leaving only the path to itself. Luckily, I was able to restore my path by using regedit -- this process becomes much more difficult if you have rebooted your machine more than once after the install. It appears that winavr was last updated in 2010.

My own preference is to use linux to do things like compiling code, using either a dedicated linux machine or a linux VM. However, for things like flashing a chip, I have found that Atmel FLIP in Windows works nicely.

Salt

16 Jun 2016, 19:40

Is there a list of all special commands? I need to add characthers such as '-', 'å', 'ä', 'ö' but the compiler wont recognize them? Is their some kind of wiki or something I could use to check up all these?

User avatar
matt3o
-[°_°]-

16 Jun 2016, 19:49

Hypersphere wrote: @matt3o: Thanks for creating this excellent tutorial and forum for keyboard firmware.

[snip]

I highly recommend using a virtual machine with a barebone linux

User avatar
Hypersphere

16 Jun 2016, 21:31

matt3o wrote:
Hypersphere wrote: @matt3o: Thanks for creating this excellent tutorial and forum for keyboard firmware.

[snip]

I highly recommend using a virtual machine with a barebone linux
Yes, excellent idea. In my case, I have a dedicated linux machine available as well, although if your primary computer is OS X or Windows, it can be handy to have a linux VM on the same machine.

Post Reply

Return to “Workshop”