How to build your very own keyboard firmware
-
- Main keyboard: Das Keyboard
- Main mouse: Deathadder
- Favorite switch: blue
- DT Pro Member: -
Hey I was wondering what should I do if the keyboard randomly presses keys / sometimes pressing a key activates more than one key. I was able to get the matrix coded correctly and such because I tested each pin out to see if the matrix was correct.
Its just sometimes when moving around the teensy, that this problem is happening. I'm planning on finishing soldering up and making the wires nice and clean sometime next week. I'm assuming the problem would go away when I secure the teensy and cover the components.
Its just sometimes when moving around the teensy, that this problem is happening. I'm planning on finishing soldering up and making the wires nice and clean sometime next week. I'm assuming the problem would go away when I secure the teensy and cover the components.
-
- Main keyboard: K65 RGB
- Main mouse: Zalman FPS
- Favorite switch: MX RED
- DT Pro Member: -
So I tried to build my own code for an ergo board, and after screwing up a ton of times I'm down to this error which seems related to compiling the debug module, which I had nothing to do with. The error is this: http://imgur.com/1BqHPNW
-
- Main keyboard: PurePro
- Main mouse: Razer Ouroboros
- DT Pro Member: -
I'm making a 2*4 keyboard out of a QWERKEY sampler and I'm stuck with the same error as yours.turtlobenzene wrote: ↑So I tried to build my own code for an ergo board, and after screwing up a ton of times I'm down to this error which seems related to compiling the debug module, which I had nothing to do with. The error is this: http://imgur.com/1BqHPNW
If I find out the cause I'll write it down, but hope somebody else knows the reason.
- hasu
- Location: Japan
- Main keyboard: HHKB
- Main mouse: HHKB
- Favorite switch: Topre
- DT Pro Member: -
See this for that compile error of debug.c.
https://github.com/tmk/tmk_keyboard/issues/143
You will need to use one of those workarounds for a while until this issue will be finally fixed some later.
https://github.com/tmk/tmk_keyboard/issues/143
You will need to use one of those workarounds for a while until this issue will be finally fixed some later.
-
- Location: Kentucky, USA
- Main keyboard: ErgoDox
- Main mouse: Roccat Kova+
- Favorite switch: Cherry MX Blue
- DT Pro Member: -
Regarding the LED's, what would I need to modify in either the Master\Keyboard\gh60\led or Master\Common\led files to get an LED to be lit when either layer 0, layer 1, or layer 2 is active? I understand that those 3 different LED's go to 3 separate ports on the Teensy controller, but I am confused as to what I need to put in the led file at for the board to illuminate an LED corresponding to which layer is active.
Should the USB_LED_CAPS_LOCK be changed to a key map reference or is there a reference to the layer from the keymap_poker.c file in the tutorial?
Thanks for any help.
Nin
Code: Select all
if (usb_led & (1<<USB_LED_CAPS_LOCK))
Should the USB_LED_CAPS_LOCK be changed to a key map reference or is there a reference to the layer from the keymap_poker.c file in the tutorial?
Thanks for any help.
Nin
-
- Main keyboard: Ducky Zero
- Main mouse: ROCCAT LUA
- Favorite switch: Green
- DT Pro Member: -
Hey, so I tried to compile my edited layout for a numpad, and I've got a few errors.
I compared the code to the original, and I still can't fix it. I'm using cygwin64 on Windows, and I can compile the original Makefile, just not mine.
Here's the error I'm getting:
http://i.imgur.com/HEk089x.png
And here's the code I've changed on pastebin:
http://pastebin.com/NTUDWtWh
I compared the code to the original, and I still can't fix it. I'm using cygwin64 on Windows, and I can compile the original Makefile, just not mine.
Here's the error I'm getting:
http://i.imgur.com/HEk089x.png
And here's the code I've changed on pastebin:
http://pastebin.com/NTUDWtWh
-
- Main keyboard: Ducky Zero
- Main mouse: ROCCAT LUA
- Favorite switch: Green
- DT Pro Member: -
@hasu: I tried without it, and for everything that's not a number (i.e. ESC, SLASH..) it generates an 'undefined' error. For example I put 'ESC' instead of KC_ESCAPE' and it threw up an error. For the rest I wanted to have a 'real' numpad input.
@scottc: Fixed, still error.
http://pastebin.com/ZQ4YCpvY
Thanks for your quick response.
I tried with MHV AVR Tool but it doesn't even start to compile. I also can't seem to change directory. :/ 'cd d:\' does nothing.
Edit: Just noticed that it fixed a couple of errors regarding the initialization of 'keymaps', but there's something wrong with with the array still, in line 49 of the latest pastebin:
Edit2: Found this thread on GH:
geekhack.org/index.php?topic=63467.0
With the same problem as mine. I'll try building it in an Arch VM I have from a while ago, but it'll probably be tomorrow... Meanwhile of you have any suggestion, feel free to help.
@scottc: Fixed, still error.
http://pastebin.com/ZQ4YCpvY
Thanks for your quick response.
I tried with MHV AVR Tool but it doesn't even start to compile. I also can't seem to change directory. :/ 'cd d:\' does nothing.
Edit: Just noticed that it fixed a couple of errors regarding the initialization of 'keymaps', but there's something wrong with with the array still, in line 49 of the latest pastebin:
Code: Select all
keymap_common.h:46:1: error: parameter name missing
) { \
^
geekhack.org/index.php?topic=63467.0
With the same problem as mine. I'll try building it in an Arch VM I have from a while ago, but it'll probably be tomorrow... Meanwhile of you have any suggestion, feel free to help.
-
- Main keyboard: Ducky Zero
- Main mouse: ROCCAT LUA
- Favorite switch: Green
- DT Pro Member: -
So I booted up my Arch VM, and it says 'avr-gcc: command not found', seems like I don't have the dev tools installed.
I'm not that into Linux, can anyone provide me with some directions on how to install them? I have 'avrdude' installed, the C libraries, avr-gcc, but still command not found.
Edit: Scratch that. avr-gcc is not even installed. When trying to install with pacman it returns error 404 on all the mirrors..
I'm not that into Linux, can anyone provide me with some directions on how to install them? I have 'avrdude' installed, the C libraries, avr-gcc, but still command not found.
Edit: Scratch that. avr-gcc is not even installed. When trying to install with pacman it returns error 404 on all the mirrors..
- scottc
- ☃
- Location: Remote locations in Europe
- Main keyboard: GH60-HASRO 62g Nixies, HHKB Pro1 HS, Novatouch
- Main mouse: Steelseries Rival 300
- Favorite switch: Nixdorf 'Soft Touch' MX Black
- DT Pro Member: -
Do a pacman package list update to fix that. I haven't used Arch in years, but I think that it's something like `pacman -u`. Check the manpage. Oh, and I'd strongly recommend against Arch if you're not familiar with Linux...
-
- Main keyboard: Ducky Zero
- Main mouse: ROCCAT LUA
- Favorite switch: Green
- DT Pro Member: -
I installed it a while ago to just mess with it, to learn and whatnot.
Anyway, updated, installed avr-gcc, and still the same error(s):
So it's not a problem with Windows after all. I'm definitely missing something here.
Edit: Attached the file in next post.
I've attached the zipped library to a GH thread:
https://geekhack.org/index.php?topic=67579.0
If you want to take a look yourself.
Anyway, updated, installed avr-gcc, and still the same error(s):
Code: Select all
In file included from keymap_poker.c:1:0:
keymap_common.h:46:1: error: parameter name missing
) KEYMAP{ \
^
keymap_poker.c:4:6: warning: implicit declaration of function 'KEYMAP' [-Wimplicit-function-declaration]
KEYMAP(KC_ESCAPE,KC_KP_SLASH,KC_KP_ASTERISK,KC_KP_MINUS, \
^
keymap_poker.c:9:1: warning: missing braces around initializer [-Wmissing-braces]
};
^
keymap_poker.c:9:1: warning: (near initialization for 'keymaps[0]') [-Wmissing-braces]
keymap_poker.c:9:1: error: initializer element is not constant
keymap_poker.c:9:1: error: (near initialization for 'keymaps[0][0][0]')
../../rules.mk:541: recipe for target 'obj_gh60_lufa/keymap_poker.o' failed
make: *** [obj_gh60_lufa/keymap_poker.o] Error 1
Edit: Attached the file in next post.
I've attached the zipped library to a GH thread:
https://geekhack.org/index.php?topic=67579.0
If you want to take a look yourself.
Last edited by ROFLmonster on 11 Jan 2015, 15:25, edited 1 time in total.
- scottc
- ☃
- Location: Remote locations in Europe
- Main keyboard: GH60-HASRO 62g Nixies, HHKB Pro1 HS, Novatouch
- Main mouse: Steelseries Rival 300
- Favorite switch: Nixdorf 'Soft Touch' MX Black
- DT Pro Member: -
Your first problems are in keymap_common.h. Another trailing comma in the KEYMAP macro definition, then you try to use KEYMAP in its own macro definition. Even after fixing these, I'm getting loads of errors about KC_##K00 etc being undefined, so you've made some more mistakes out there too.
FYI: If you're going to ask for help on Deskthority, it might be an idea to at least attach the file here...
FYI: If you're going to ask for help on Deskthority, it might be an idea to at least attach the file here...
-
- Main keyboard: Ducky Zero
- Main mouse: ROCCAT LUA
- Favorite switch: Green
- DT Pro Member: -
Sorry, I missed the upload attachment button at first, and used the quick reply since.
Uploaded it for future reference.
If you mean the one on line 45 (right after K42, it's fixed.)
What could be wrong about KC_##K00.., though? It's exactly like in OP. I filled the gaps according to my wiring with KC_NO and everything.
Uploaded it for future reference.
If you mean the one on line 45 (right after K42, it's fixed.)
What could be wrong about KC_##K00.., though? It's exactly like in OP. I filled the gaps according to my wiring with KC_NO and everything.
- Attachments
-
- retropad.rar
- (5.87 MiB) Downloaded 238 times
- scottc
- ☃
- Location: Remote locations in Europe
- Main keyboard: GH60-HASRO 62g Nixies, HHKB Pro1 HS, Novatouch
- Main mouse: Steelseries Rival 300
- Favorite switch: Nixdorf 'Soft Touch' MX Black
- DT Pro Member: -
I've just uploaded my changes. It's probably easier than trying to communicate what I did. The changes were made in the definition of the KEYMAP macro in keymap_common.h.
By the way: I have no real experience with Hasu's firmware (I just compiled my own once, using this guide, and it was about a year ago) so I don't know specifics offhand and can't help with those, I just know how to program in C.
By the way: I have no real experience with Hasu's firmware (I just compiled my own once, using this guide, and it was about a year ago) so I don't know specifics offhand and can't help with those, I just know how to program in C.
- Attachments
-
- retropad.tgz
- (9.99 MiB) Downloaded 290 times
-
- Main keyboard: Ducky Zero
- Main mouse: ROCCAT LUA
- Favorite switch: Green
- DT Pro Member: -
So I thought about what you said that I try to define KEYMAP inside itself, so I deleted lines 46-52 inside 'keymap_common.h', and it compiled. Not only that, but it also works on the teensy.
Problem is I get totally different inputs from what I intended. (i.e. 3 gives me ENTER, 5 gives me 8..)
But it seems like it's still not right if the errors are that big.
And I can't seem to find any differences between yours and my own?..
EDIT:
So someone on GH replied to me. It was the 'KC_' prefix after all. I thought it didn't matter, and this is probably why my first 'solution' didn't work.
It all works now, only the bottom row is flipped which is easily fixable.
Thanks for your help! Damn commas.
Problem is I get totally different inputs from what I intended. (i.e. 3 gives me ENTER, 5 gives me 8..)
But it seems like it's still not right if the errors are that big.
And I can't seem to find any differences between yours and my own?..
EDIT:
So someone on GH replied to me. It was the 'KC_' prefix after all. I thought it didn't matter, and this is probably why my first 'solution' didn't work.
It all works now, only the bottom row is flipped which is easily fixable.
Thanks for your help! Damn commas.
- scottc
- ☃
- Location: Remote locations in Europe
- Main keyboard: GH60-HASRO 62g Nixies, HHKB Pro1 HS, Novatouch
- Main mouse: Steelseries Rival 300
- Favorite switch: Nixdorf 'Soft Touch' MX Black
- DT Pro Member: -
Hah, I just noticed that too when comparing it to my own keymap. Those gcc errors are terrible but they did actually say what was wrong the whole time.
-
- Main keyboard: Ducky Zero
- Main mouse: ROCCAT LUA
- Favorite switch: Green
- DT Pro Member: -
Last question.
If I want to use a Pro Micro like in this thread:
http://deskthority.net/workshop-f7/how- ... t8448.html
I don't need to change a thing in the program, right? Can I flash it as is? Assuming I used the right physical pins, the atmega reads them as if it was on a teensy, right?
Because for example pin 16, how do I write it in the code? It's not as straight forwards as PINF/PORTF.
If I want to use a Pro Micro like in this thread:
http://deskthority.net/workshop-f7/how- ... t8448.html
I don't need to change a thing in the program, right? Can I flash it as is? Assuming I used the right physical pins, the atmega reads them as if it was on a teensy, right?
Because for example pin 16, how do I write it in the code? It's not as straight forwards as PINF/PORTF.
- scottc
- ☃
- Location: Remote locations in Europe
- Main keyboard: GH60-HASRO 62g Nixies, HHKB Pro1 HS, Novatouch
- Main mouse: Steelseries Rival 300
- Favorite switch: Nixdorf 'Soft Touch' MX Black
- DT Pro Member: -
The code stays the same, but you'll have to figure out which ports to use based on the diagrams in the thread that you linked.
-
- Main keyboard: Ducky Zero
- Main mouse: ROCCAT LUA
- Favorite switch: Green
- DT Pro Member: -
Figured as much. Thanks!
It also makes me wonder, if the chip sees the same pins, why change it in the pcb..?
It also makes me wonder, if the chip sees the same pins, why change it in the pcb..?
- scottc
- ☃
- Location: Remote locations in Europe
- Main keyboard: GH60-HASRO 62g Nixies, HHKB Pro1 HS, Novatouch
- Main mouse: Steelseries Rival 300
- Favorite switch: Nixdorf 'Soft Touch' MX Black
- DT Pro Member: -
Well the ordering of the exposed pins is pretty arbitrary. Neither the Arduino nor the Teensy way is the "right" way, they both have their different use cases. For the Pro Micro, bear in mind that the Arduino is aimed at a more beginner level, so ports are probably labelled numerically so that in the code, you can just do things like port(1).
- copter
- Last Man Standing
- Location: Helsinki, Finland
- Main keyboard: Filco Majestouch 2 TKL, CM Rapid-I
- Main mouse: SS Rival 100, Corsair M45
- Favorite switch: MX Brown
- DT Pro Member: 0089
Thanks from this great guide. I just started my project and ordered some Teensy controllers for this purposes. Anyway while waiting for them, I'm a bit eager to get started and I have some Arduino controllers lying around that I could use.
I have matrix that requires 21 pins (15 cols, 5 rows), so I cannot use Arduino Micro R3, which otherwise would be a good fit. So I though that I would use Arduino Mega 2560 R3, which has the same ATMEGA8U2 as Leonardo and Micro R3, so it supports USB HID. And it has more than enough pins. Sure it's not that compact, but at least I could test that all works out and then just swap to Teensy when they arrive maybe end of next week.
I put to Makefile:
But, when I try to compile I get this error:
If I set
Then all works out, so it seems that LUFA doesn't support ATmega2560. Does anyone have any workaround etc regarding this, or do I just simply need to wait for my Teensy controllers to arrive?
I have matrix that requires 21 pins (15 cols, 5 rows), so I cannot use Arduino Micro R3, which otherwise would be a good fit. So I though that I would use Arduino Mega 2560 R3, which has the same ATMEGA8U2 as Leonardo and Micro R3, so it supports USB HID. And it has more than enough pins. Sure it's not that compact, but at least I could test that all works out and then just swap to Teensy when they arrive maybe end of next week.
I put to Makefile:
Code: Select all
TARGET = gh60_lufa
MCU = atmega2560
Code: Select all
../../protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/USBMode.h:262:7: error: #error USB_DEVICE_ONLY is not available for the currently selected microcontroller model.
#error USB_DEVICE_ONLY is not available for the currently selected microcontroller model.
Code: Select all
MCU = atmega32u4
or
MCU = at90usb1287
-
- Main keyboard: Poker II
- Favorite switch: Cherry MX Clear
- DT Pro Member: -
Can someone please make the hex file for me? I'm trying to mod the firmware for a Planck keyboard, 4 rows and 12 col grid, with a Teensy 2.0, but I keep getting
, and I haven't been able to figure it out.
Code: Select all
0 [main] sh 1416 sync_with_child: child 3888(0x164) died before initialization with status code 0xC0000142
628 [main] sh 1416 sync_with_child: *** child state waiting for longjmp
/usr/bin/sh: fork: Resource temporarily unavailable
0 [main] sh 6488 sync_with_child: child 2144(0x164) died before initialization with status code 0xC0000142
1095 [main] sh 6488 sync_with_child: *** child state waiting for longjmp
/usr/bin/sh: fork: Resource temporarily unavailable
-------- begin --------
avr-gcc (WinAVR 20100110) 4.3.3
Copyright (C) 2008 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.
0 [main] sh 6376 sync_with_child: child 7488(0x15C) died before initialization with status code 0xC0000142
1187 [main] sh 6376 sync_with_child: *** child state waiting for longjmp
/usr/bin/sh: fork: Resource temporarily unavailable
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= -Os -funsigned-char -funsigned-bitfields -ffunction-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../.. -I../../protocol/lufa -I../../protocol/lufa/LUFA-120730 -I../../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
make: *** [obj_gh60_lufa/keymap_poker.o] Error -1073741502
- Attachments
-
- tmk_keyboard.zip
- (5.98 MiB) Downloaded 242 times
- Muirium
- µ
- Location: Edinburgh, Scotland
- Main keyboard: HHKB Type-S with Bluetooth by Hasu
- Main mouse: Apple Magic Mouse
- Favorite switch: Gotta Try 'Em All
- DT Pro Member: µ
I'm clumsy with code, too. That's why I use Soarer's:
http://deskthority.net/workshop-f7/soar ... t6767.html
http://deskthority.net/workshop-f7/soar ... t6767.html
- aaron
- Location: Germany (Karlsruhe)
- Main keyboard: Noppoo Choc Mini
- Main mouse: Roccat Kova[+], CST
- Favorite switch: MX-Brown mit O-Rings
- DT Pro Member: -
- Contact:
Sure. I don't double check the pins for the Teensy 2.0 (I use a other controller), but it should be fine. For the planck, I use the pcarrier/tmk_keyboard configuration ( https://github.com/pcarrier/tmk_keyboar ... p_planck.c )pepers wrote: ↑Can someone please make the hex file for me? I'm trying to mod the firmware for a Planck keyboard, 4 rows and 12 col grid, with a Teensy 2.0, but I keep getting (error)
- Attachments
-
- planck_firmware.tar.gz
- (17.33 KiB) Downloaded 242 times
- Halvar
- Location: Baden, DE
- Main keyboard: IBM Model M SSK / Filco MT 2
- Favorite switch: Beam & buckling spring, Monterey, MX Brown
- DT Pro Member: 0051
@pepers: are you using Windows 8.1? I had the same problem until I applied a patch to WinAVR:
http://www.avrfreaks.net/forum/windows- ... tion-error
http://www.avrfreaks.net/forum/windows- ... tion-error
-
- Main keyboard: Poker II
- Favorite switch: Cherry MX Clear
- DT Pro Member: -
That worked, thank you so much!!! I was on windows 8.1Halvar wrote: ↑@pepers: are you using Windows 8.1? I had the same problem until I applied a patch to WinAVR:
http://www.avrfreaks.net/forum/windows- ... tion-error
-
- Main keyboard: Ducky Zero
- Main mouse: ROCCAT LUA
- Favorite switch: Green
- DT Pro Member: -
Hey again,
I wanted to make matters a bit more interesting, but I need your help.
I want to have an RGB LED strip backlight, specifically the WS2812B.
Now I can easily program it using various libraries like this one:https://github.com/cpldcpu/light_ws2812 ... ws2812_AVR
But I can't seem to find a way to incorporate it into the keyboard firmware.
Basically what I want (the most simple solution, IMO) is when there's a certain key stroke (lets say FN0) it calls a function which turns on the strip like void 'backlight_on_fn0();' for example, but I can't seem to do it.
I looked into the lightpad files and it seems to use conditions, but I couldn't recreate it making a 2x2 key matrix with FN0, FN1, FN2 and FN3, it just doesn't do anything.
I've seen some projects use that kind of backlight, but I can't seem to figure out how. If anyone would point me to the right direction I'd really appreciate it. In the meanwhile I'll keep one trying.
Edit: So I've managed to run the function by editing the existing ones in the lightpad firmware, but I still don't get the idea behind it..
I wanted to make matters a bit more interesting, but I need your help.
I want to have an RGB LED strip backlight, specifically the WS2812B.
Now I can easily program it using various libraries like this one:https://github.com/cpldcpu/light_ws2812 ... ws2812_AVR
But I can't seem to find a way to incorporate it into the keyboard firmware.
Basically what I want (the most simple solution, IMO) is when there's a certain key stroke (lets say FN0) it calls a function which turns on the strip like void 'backlight_on_fn0();' for example, but I can't seem to do it.
I looked into the lightpad files and it seems to use conditions, but I couldn't recreate it making a 2x2 key matrix with FN0, FN1, FN2 and FN3, it just doesn't do anything.
I've seen some projects use that kind of backlight, but I can't seem to figure out how. If anyone would point me to the right direction I'd really appreciate it. In the meanwhile I'll keep one trying.
Edit: So I've managed to run the function by editing the existing ones in the lightpad firmware, but I still don't get the idea behind it..