TMK_DIR = ../../tmk_core
https://github.com/tmk/tmk_keyboard#20150422Do you have any instruction on how to make a Fn layer toggle on and off, rather than only switching layers while a Fn key is pressed?Look at doc/keymap.md. All layer actions are documented there.
You'll have to write a 'host side protocol' module to add support for BT HID.I didn't understood why we will need a "host" side module. It wouldn't be one simple slave? (according to what I saw at the Bluetooth HID Lite (https://www.bluetooth.org/docman/handlers/DownloadDoc.ashx?doc_id=41207&vId=43270) documentation).
My firmware has a module using Bluegiga iWRAP4 for BT(and V-USB for USB), you can find this under protocol/iwrap/ directory. But it is very old code and not supported actively now. I don't know even whether it works with new updated firmware base. Though, I think it is still a good start point for BT module. Also LUFA 'host side protocol' module will be worth looking into. It is located on protocol/lufa/.Yup I saw both of these folders there. I'll have to buy this BlueGiga module to test it further - just waiting for the best day of my credit card. I were already planning to get one of these and the RN-42 anyway.
Do you have any instruction on how to make a Fn layer toggle on and off, rather than only switching layers while a Fn key is pressed?Thanks! Updated keymap document and my fist post with hoping this helps you and other.
I really like your FW!
As I’ve said before in the gh60 thread, that code is plain awesome and understandable. I really like your how you implement the keymap and how easy it is to make it fit your own needs.Looks great. Impressive keymap :) I'll look into it later.
I’ve already forked your repo here (https://github.com/femtoo/tmk_keyboard/tree/kbedit)and started toying around a bit ;D
Hi Hasu, thanks very much for this opportunity to learn more about your firmware
and thanks very much for sharing it!Quote from: hasu date=2013-04-03You'll have to write a 'host side protocol' module to add support for BT HID.I didn't understood why we will need a "host" side module. It wouldn't be one simple slave? (according to what I saw at the Bluetooth HID Lite (https://www.bluetooth.org/docman/handlers/DownloadDoc.ashx?doc_id=41207&vId=43270) documentation).Quote from: hasu date=2013-04-03My firmware has a module using Bluegiga iWRAP4 for BT(and V-USB for USB), you can find this under protocol/iwrap/ directory. But it is very old code and not supported actively now. I don't know even whether it works with new updated firmware base. Though, I think it is still a good start point for BT module. Also LUFA 'host side protocol' module will be worth looking into. It is located on protocol/lufa/.Yup I saw both of these folders there. I'll have to buy this BlueGiga module to test it further - just waiting for the best day of my credit card. I were already planning to get one of these and the RN-42 anyway.
#define KEYMAP_ISO( \
... first part ...(arguments)
} KEYMAP (\
... second part...(definition)
)
/* matrix size */
#define MATRIX_ROWS 9
#define MATRIX_COLS 8
Line 176 // Output low(DDR:1, PORT:0) to select
Line 177 // row: 0 1 2 3 4 5 6 7 8
Line 178 // pin: PD0, PD5, PD7, PF6, PD6, PD1, PD2, PC6, PF7
Line 178-215
near line 155+ all of Port B
what is portb ?
what is portb ?
Every pin with "PBx" (Port, B, Pin#)
What is your matrix size? 5x15? Pics'll be very helpful to know your configuration.
I think you can use PC0-5 safely.
Note that Teensy has LED on PD6, so you won't be able to use this pin for matrix scan.
OK. Now, I'd like to ask someone else to confirm whether the latest firmware(with my fix) works or not. Can someone check it?
I didn't know until very recently that macro functionality had been added. Holy crap is it amazing. I think I have everything set up the way I want it now. Some examples of things I have done and inspiration of things which you could do too:
type out emails, addresses, names, phone numbers and other common things
type out username, tab, password, enter
type volume up key a couple of times in a row for other people who like me are annoyed by the 1% increase in volume per click normally
open your music player normalized, eg "shortcut to open program, volume down*100, volume up *30" to always have it start at volume 30, no matter what the volume is set to before
This firmware now has everything that I want from one. Thank you hasu, sincerely.
(if there was one thing I would still like, it would be that macros are aware of the caps lock state of the OS to not make it type out my email in capitals if I have caps lock on. Cherry's firmware has this. I would imagine a simple extra if statement where the macro is defined and it has two macros defined, one if caps lock is OFF and one if it is ON where I would add a simple T(CAPS) at the beginning and at the end)
Edit: If I can understand it enough to use it, then so can everyone else.
static const uint16_t PROGMEM fn_actions[] = {
...
ACTION_MODS_KEY(MOD_LSFT, KC_LBRACKET),
};
I'm building a teensy based keyboard (6x16 matrix) so I started from the macway directory as a base and I'm a little confused on how to define a few of my keys. In my Fn layer (layer 1), I want to have keys that send normally shifted characters (/*{}-+:" etc). I can define my KEYMAP ok for the default layer, but how add a shifted key to my Fn layer? For example, I want to have the U key (normal qwerty) send a shifted left bracket { in the Fn layer.
Do I assign those as FN## keys in the KEYMAP and then do something like:Code: [Select]static const uint16_t PROGMEM fn_actions[] = {
...
ACTION_MODS_KEY(MOD_LSFT, KC_LBRACKET),
};
If that is the answer, I may end up running out of function keys...
/* Keypad */
#define KC_P1 KC_KP_1
#define KC_P2 KC_KP_2
#define KC_P3 KC_KP_3
#define KC_P4 KC_KP_4
#define KC_P5 KC_KP_5
#define KC_P6 KC_KP_6
#define KC_P7 KC_KP_7
#define KC_P8 KC_KP_8
#define KC_P9 KC_KP_9
#define KC_P0 KC_KP_0
#define KC_PDOT KC_KP_DOT
#define KC_PCMM KC_KP_COMMA
#define KC_PSLS KC_KP_SLASH
#define KC_PAST KC_KP_ASTERISK
#define KC_PMNS KC_KP_MINUS
#define KC_PPLS KC_KP_PLUS
#define KC_PEQL KC_KP_EQUAL
#define KC_PENT KC_KP_ENTER
This?
void led_set(uint8_t usb_led)
{
if (usb_led & (1<<USB_LED_CAPS_LOCK))
{
// Output high.
DDRB |= (1<<6);
DDRB |= (1<<6);
}
else
{
// Output low.
DDRB &= ~(1<<6);
DDRB &= ~(1<<6);
}
if (usb_led & (1<<USB_LED_SCROLL_LOCK))
{
// Output high.
DDRB &= ~(1<<7);
DDRB |= (1<<7);
}
else
{
// Output low.
DDRB &= ~(1<<7);
DDRB &= ~(1<<7);
}
}
It doesn't make much sense to me, as there are a couple of duplicate lines there, but it works.
I think I found another small bug
http://i.imgur.com/5lPPRFE.png
The default layout in 'keymap_iso.h' is not actually iso in the second layer. The first layer has the correct number of entries, but the second is a bit messed up. I first thought I had ghosting from a faulty diode. The same is true for' keymap_iso_150.h' by the way.
Edit: I get very dim leds until I change 'led.c' per a suggestion to:
void led_set(uint8_t usb_led)
{
if (usb_led & (1<<USB_LED_CAPS_LOCK))
{
// Output high.
DDRB |= (1<<6);
PORTB |= (1<<6);
}
else
{
// Output low.
DDRB &= ~(1<<6);
PORTB &= ~(1<<6);
}
if (usb_led & (1<<USB_LED_SCROLL_LOCK))
{
// Output high.
DDRB |= (1<<7);
PORTB |= (1<<7);
}
else
{
// Output low.
DDRB &= ~(1<<7);
PORTB &= ~(1<<7);
}
}
You are using the latest version that looks like this?
You are using the latest version that looks like this?
Your code snippet works as well, so I must have been using an old led.c
- for each row
- energize row
- wait 3-30 ms
- read columns
So I'm trying to understand the debouncing algorithm that's in most of the matrix.c files (they all seem pretty similar). It it's not too much trouble, could someone explain it in words? The cherry switch spec says the debounce time is ~5ms. It seems like most of the keyboards are doing something like this:Code: [Select]- for each row
- energize row
- wait 3-30 ms
- read columns
Shouldn't the wait time built in to the loops mean that there isn't really a need for the debounce code? I'm guessing it's necessary and I'm just missing something...
There was a discuss about debouncing a while back. Maybe uselful for you.
http://geekhack.org/index.php?topic=42385.0
My deboucing code is very simple and premitive, but it works :) I didn't care about debouncing method much, though, you will be able to find very elegant interesting algorithms and strategies on the net.
Hmmmm I am so lost trying to figure out how to configure this. There wouldn't happen to be a detailed walk thought on how to set this up anywhere would there?.
Anyways I guess the main thing I am trying to figure out is how to configure the matrix and and pin out for a teensy 2. I assume that I can use the common files to make a new keyboard setup or one of the other keyboards that are on there but i don't know how to change the number of rows and columns. This may take me longer then making the keyboard at this rate lol
static TeensyPin rows[MATRIX_ROWS] = {
TPIN(F,0), TPIN(F,1), TPIN(F,4), TPIN(F,5),
TPIN(F,6), TPIN(F,7),
};
static TeensyPin cols[MATRIX_COLS] = {
TPIN(B,0), TPIN(B,1), TPIN(B,2), TPIN(B,3),
TPIN(B,7), TPIN(D,2), TPIN(D,3), TPIN(C,6),
};
I'm working on a small TeensyPin class that encapsulates the direction, port, and pin registers for each pin. The idea would be that you can then define your rows and columns like this:Code: [Select]static TeensyPin rows[MATRIX_ROWS] = {
TPIN(F,0), TPIN(F,1), TPIN(F,4), TPIN(F,5),
TPIN(F,6), TPIN(F,7),
};
static TeensyPin cols[MATRIX_COLS] = {
TPIN(B,0), TPIN(B,1), TPIN(B,2), TPIN(B,3),
TPIN(B,7), TPIN(D,2), TPIN(D,3), TPIN(C,6),
};
and that's all the code changes that would be required in matrix.c for a basic teensy layout (obviously you still have to customize led.c and keymap.c for your layout). I'm hoping to have something working in the next week or so at which point you're welcome to look at it. It won't be the most efficient way to do things but I think it will be a lot easier to read. I don't think absolute efficiency matters that much and I have a better chance of understanding the code when I look at it next year and have forgotten everything I've learned about bit manipulation.
So I have my C++ TeensyPin class working (see prev post) and I'd like to see how much it slows things down. I'm using the gh60 directory as a test bed (my teensy is on a bread board so I don't have an actual keyboard to try anything with). Using arrays of variables to store the ports vs raw bit manipulation of the registers is much easier to read, but it's definitely slower.Could you share your code man?
So I have my C++ TeensyPin class working (see prev post) and I'd like to see how much it slows things down. I'm using the gh60 directory as a test bed (my teensy is on a bread board so I don't have an actual keyboard to try anything with). Using arrays of variables to store the ports vs raw bit manipulation of the registers is much easier to read, but it's definitely slower.
hasu - what's the best way to generate timing information? I added code in matrix_scan() that calls timer_read32() every 500'th call and prints the difference. Is that timer call returning a millisecond counter? Is there a better way to find the overall keyboard scan rate?
If it is a millisecond timer and my math is right (both BIG assumptions at this point), it looks like the normal gh60 code is calls matrix_scan() at ~3290 Hz and my modified version using arrays of column and row variables calls matrix_scan() at ~1710 Hz. Both of those seem really fast but maybe that's normal...
They may be both really fast on their own, but yours leaves less headroom for adding other features that eat CPU time.
Right. timer_read32() returns 32bit value in milli second. If you need finer granularity you can use other spare timer.
I think your code is fast enough to scan matrix and do debouncing.
Cheers! I'm eyeing off another board that's identical except for having headers for the usb port, might pick a 5 pack of those up for future builds and then wire up a proper USB connector.There are at least 4 I know of, all atmega32u4 based:
I'm hoping someone more knowledgeable might be able to help. I've purchased the micro-controller (http://www.ebay.com.au/itm/360552830045?ssPageName=STRK:MEWNX:IT&_trksid=p3984.m1497.l2649) below with the ATMEGA32U4 on board, can anyone advise whether I'll be able to use it with the TMK firmware? It supports the Arduino IDE if that's helps at all, hopefully I won't have any problems using it with Atmel's software.
Cheers! I'm eyeing off another board that's identical except for having headers for the usb port, might pick a 5 pack of those up for future builds and then wire up a proper USB connector.There are at least 4 I know of, all atmega32u4 based:
- The Official Arduino Micro (http://arduino.cc/en/Main/ArduinoBoardMicro)
- The Freeduino on ebay (http://www.ebay.com/itm/Freaduino-Micro-ATmega32u4-Arduino-Mirco-100-compatible-/111118862940?pt=LH_DefaultDomain_0&hash=item19df334a5c)
- The Unofficial Leonardo Pro Micro (it uses the Arduino Mini footprint) on ebay (http://www.ebay.com/itm/2PCS-Leonardo-Pro-Micro-ATmega32U4-Arduino-IDE-Bootloader-replace-Pro-Mini-328P-/200935818980?pt=LH_DefaultDomain_0&hash=item2ec8b546e4)
- The old EWS Breakout Board on ebay (http://www.ebay.com/itm/EWS-ATmega32U4-Breakout-Board-/251192714781?pt=LH_DefaultDomain_0&var=&hash=item3a7c40a61d) too.
I'm hoping someone more knowledgeable might be able to help. I've purchased the micro-controller (http://www.ebay.com.au/itm/360552830045?ssPageName=STRK:MEWNX:IT&_trksid=p3984.m1497.l2649) below with the ATMEGA32U4 on board, can anyone advise whether I'll be able to use it with the TMK firmware? It supports the Arduino IDE if that's helps at all, hopefully I won't have any problems using it with Atmel's software.
It will works with the firmware without problem. But you should note that Leonardo has LEDs on PD0 and PD1 while Teensy has PD6, these may has some affections on matrix scan. You had better avoid using those pin to sense matrix(using as input), however, I think you can use them for driving matrix line(as output).
And one thing to be warned, Leonardo bootloader is very tricky to work with... to be honest, it sucks from my experience.
TMK has no Arduino support so you cannot use it from Arduino IDE.
Deskthority has thread about alternatives to Teensy.
http://deskthority.net/workshop-f7/teensy-2-0-alternatives-atmega32u4-t4253.html
Here (http://www.mattairtech.com/index.php/development-boards/atmega32u4-usb-development-board-arduino-compatible.html) is the one I'm looking at, seems to be really customisable considering the price.
Could you share your code man?
I'm still working on my PCB and I couldn't touch any code yet ...
I've submitted a first cut at a sample simplified teensy firmware (based on gh60) at my fork of hasu's firmware. (https://github.com/TD22057/tmk_keyboard/tree/master/keyboard/teensy)My 5 cents:
The files of interest are the matrix.cpp (https://github.com/TD22057/tmk_keyboard/blob/master/keyboard/teensy/matrix.cpp) and TeensyPin.hpp (https://github.com/TD22057/tmk_keyboard/blob/master/keyboard/teensy/TeensyPin.hpp) files. The main idea is to make something that allows people to edit the row and column pin assignments in matrix.cpp and not touch anything else in that file (obviously you still have to edit keymap.c, maybe led.c, and the Makefile). In the original file, you would need to add your pin assignments and set/clear the correct bits in init_cols(), read_cols(), unselect_rows() and select_row().
This is still in the prototype stage so there may still be problems with it. Feel free to suggest improvements or name changes...
GOSH, so much stuff to do!!!
I need a day with 36 hours!!!
AHHHHHHHHHHHHHHHHHHHHHHhhhhh
My wife is calling me to bed ...
cya
Cheers for your help and all your hard work on the firmware! So if I'm understanding correctly I should be able to get rid of the Leonardo bootloader and write a more compatible one to the ATMEGA23U4?
Cheers for your help and all your hard work on the firmware! So if I'm understanding correctly I should be able to get rid of the Leonardo bootloader and write a more compatible one to the ATMEGA23U4?
Right. You can replace bootloader with ISP programmer hardware like AVRISP mkII. You can pick LUFA DFU or CDC bootloader for this pupose. But if you don't want to pay for AVRISP mkII it is important to get a board with good bootloader.
IMO,
- Teensy Loader is the easiest way for first timer. Good document/tutorial with picures is useful.
- Atmel stock bootloader is OK. No problem.
- LUFA bootloader is good. I've never had a problem with LUFA DFU bootloader.
- Leonardo bootloader is not what you want.
If you already have Teensy, Atmel stock or LUFA bootloader you dont need to replace it. Just use it. But I'm completely sure you're frustrated with Leonardo bootloader. If you use it just once you may be OK, though, You cannot bear with it for several times.
LUFA is actually only one option if you need to replace bootloader. Atmel stock bootloader and PJRC Teensy bootloader is closed sourcen and no binaries available.
Following is memo of the bootloaders.
### LUFA DFU/HID/CDC bootloader
Open source bootloaders offered by LUFA.
Size: 4KB
Tool: dfu-programmer(DFU), Atmel FLIP(DFU), avrdude(HID,CDC), hid_bootloader(HID)
- http://fourwalledcubicle.com/blog/2013/03/the-new-lufa-bootloader/
- https://github.com/abcminiuser/lufa/tree/master/Bootloaders
### Atmel DFU bootloader
This is a stock bootloader from Atmel and factory default for AVR USB chips.
0. No source and binary available.
1. FLIP - Atmel prorietary GUI/CUI tool
2. dfu-programmer - Open source tool
Size: 4KB
Tool: FLIP, dfu-programmer
- http://www.atmel.com/Images/doc7618.pdf
### PJRC Teensy bootloader - halfKay
Extreme user friendly bootloader. You can get this loader Only by buying Teensy from PJRC.
0. No specific driver is needed using HID standard class.
1. Nice GUI tool. CUI command is also available.
2. Amazingly small foot print it occupies only 512 Bytes.
3. Can't handle EEPROM.
4. Closed source. Not avaiable source and binary.
Size: 512B
Tool: PJRC TeensyLoader(open source)
- http://www.pjrc.com/teensy/loader.html
- http://www.pjrc.com/teensy/halfkay_protocol.html
### Arduino Leonardo - caterina
Bootloader accompany with Arduino Leonardo. Not useful without Arduino IDE.
0. Open source. Derived from LUFA CDC bootloader.
1. Work with Arduino IDE.
2. Needs some extra procedure to program.
Size: 4KB
Tool: Arduino IDE, avrdude
- https://github.com/arduino/Arduino/tree/master/hardware/arduino/bootloaders/caterina
I think you've misunderstood what my first commit is for - there is no matrix class, no I2C, and no multi-device encapsulation. I'm 1) learning how hasu's firmware works, and 2) trying to provide a way for people who aren't programmers to easily write the matrix scanning function. I'm going to add I2C support and encapsulate each device as much as possible but that's going to take longer (and I'll probably start a new thread to stop pseudo-hijacking this one...).Sorry, I should have read more of your code before posting my comments.
...512 Bytes only???
### PJRC Teensy bootloader - halfKay
...
2. Amazingly small foot print it occupies only 512 Bytes.
...
Thank you SO much for that hasu, I'm sure that took ages to type! I'm pretty interested in mucking around with micro-controllers so I might just pick up an ISP programmer to change the bootloader on this but I'll make sure I get models without the Arduino bootloader in future. Cheers!
For some reason, T(VOLU) refuses to register in macros. Is that because the media control keys are different and defined in a different way than the letters?
For some reason, T(VOLU) refuses to register in macros. Is that because the media control keys are different and defined in a different way than the letters?
This commit fixed this issue. Now media control and power keys are supported in macro.
Try latest version.
https://github.com/tmk/tmk_keyboard/commit/5b425731c5b662d107ba0f970a7ae7c7fe97d01b
Hmmm I wonder if there is a way to turn on an led based on what layer I'm on as it seems like it would be a nice thing that have the number row show the layer number
when compiling the gh60 hex for the actual gh60 to flash with atmel flip...
I use the Makefile for lufa right?
when compiling the gh60 hex for the actual gh60 to flash with atmel flip...
I use the Makefile for lufa right?
Both lufa and pjrc stack works well for gh60, though I recommend lufa from now on. I won't update pjrc stack code for new features.
Compiling process doesn't depend on what flash method you use.
Use Makefile.lufa.
IIRC, NKRO is only impemented for the PJRC USB code, not for LUFA (it could be done with LUFA, but I don't think it's been written yet).
Would any kind soul out there check my config.h (http://pastebin.com/ESPNyZ8K) and keymap.c (http://pastebin.com/XWYU7PBh) files to make sure I haven't screwed anything up? Used the latest versions from the GH60 folder and stripped out the stuff I don't need, I only ever code in Java so hopefully I haven't stuffed it.
Would any kind soul out there check my config.h (http://pastebin.com/ESPNyZ8K) and keymap.c (http://pastebin.com/XWYU7PBh) files to make sure I haven't screwed anything up? Used the latest versions from the GH60 folder and stripped out the stuff I don't need, I only ever code in Java so hopefully I haven't stuffed it.
For the keymap at least, I'd make sure it's in a straight grid. See how your letters shift to the left? Make them line up. Not sure if necessary but it's been how I've been doing it and it works haha.
It also appears you have an extra TRNS in the top two rows of your function layer
Oh wait, did you mean the extra spaces between the spacebar and mods etc? That shouldn't pose a problem, whitespaces are ignored by the compiler.
Ah cool, I totally missed that! Keymap.c (http://pastebin.com/XWYU7PBh) has been modified again to reflect the changes, also spaced it out a bit more clearly to illustrate the layout.
Wouldn't be surprised if top row supported split backspace.
OP in that thread hasn't been updated, JD is busy... split BS is there in rev B(final): http://geekhack.org/index.php?topic=34959.msg954327#msg954327
I'm not actually building a GH60, this is for a custom build that I'm working on. Isn't it just a matter of setting the number of rows and columns in the config.h file?
There's a whole lot more to getting a new design up and running than fiddling with the keymap.. Either you duplicate an existing matrix or you have to get the matrix details into matrix.c (which handles which pins are connected to which rows/columns) and also keymap.c:#define KEYMAP which maps the keymap into the matrix.
OHHHHH. *facepalm* Sorry man, I saw you used the GH60 file and thought you were building a GH60.
are you doing the lowpoly hardwiring method?
If so....
even though you can just solder the diode wires together for the rows. it is a lot easier and cleaner if you wrap the diodes around a piece of solid core wire like displayed in this wiki page...
http://wiki.geekhack.org/index.php?title=Hard-Wiring_How-To
It is of course all personal preference. I just found it easier for me.
I did it with alps switches not to long ago and it was a lot of fun.ummmmm i would say same amount of soldering as with a pcb as without you still need to solder the switches, diodes, controller unless it is built into the pcb. it is how ever more work then just dropping in parts and soldering like it would be on a pcb
I am sure you will get quickly realize why pcb's are preferred over hardwiring.
It is a lot of soldering :'(
with hard wiring I had to use helping hands a lot. it added quite a bit to the total time required.I was able to so it without helping hands in my build only thing that really slowed me down was stripping wire so it would only be exposed at the solder joint (more of an aesthetic choice then anything) that took a long time. I do think its far more time consuming in general then with a pcb unless you have to design the pcb have it made or made it yourself and then solder it all together that would still take more time then just hard wiring i think.
Is it somehow possible to ignore the OS' language settings?
I want German ISO as default and a toggled layer with British ISO
Any ideas?
keymap.c:79:89: error: macro "KEYMAP_ANSI" requires 66 arguments, but only 62 given
keymap.c:74: error: 'KEYMAP_ANSI' undeclared here (not in a function)
ESC, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSPC, PSCR \
TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC,BSLS, DEL \
LCTL, A, S, D, F, G, H, J, K, L, SCLN, QUOT, ENT, 6 \
LSFT, Z, X, C, V, B, N, M, COMM, DOT, SLSH, RSFT, UP, APP \
LWIN,LALT, SPC, CAPS, FN0, LEFT, DOWN, RGHT),
should be: ESC, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSPC, PSCR, \
TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC,BSLS, DEL, \
LCTL, A, S, D, F, G, H, J, K, L, SCLN, QUOT, ENT, 6, \
LSFT, Z, X, C, V, B, N, M, COMM, DOT, SLSH, RSFT, UP, APP, \
LWIN,LALT, SPC, CAPS, FN0, LEFT, DOWN, RGHT),
Lines 74-78 you are missing a trailing comma on the last key definition.Code: [Select]ESC, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSPC, PSCR \
should be:
TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC,BSLS, DEL \
LCTL, A, S, D, F, G, H, J, K, L, SCLN, QUOT, ENT, 6 \
LSFT, Z, X, C, V, B, N, M, COMM, DOT, SLSH, RSFT, UP, APP \
LWIN,LALT, SPC, CAPS, FN0, LEFT, DOWN, RGHT),Code: [Select]ESC, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSPC, PSCR, \
TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC,BSLS, DEL, \
LCTL, A, S, D, F, G, H, J, K, L, SCLN, QUOT, ENT, 6, \
LSFT, Z, X, C, V, B, N, M, COMM, DOT, SLSH, RSFT, UP, APP, \
LWIN,LALT, SPC, CAPS, FN0, LEFT, DOWN, RGHT),
Is there a base code simpler than the GH60 that I should be working off?
Is there a base code simpler than the GH60 that I should be working off?
1x1 matrix keyboard :) This may help.
https://github.com/tmk/tmk_keyboard/tree/onekey/keyboard/onekey
Any thoughts of supporting Ergo-Dox's?
Thanks Domo. That's not exactly what I'm looking for though. Let's say that my default keypad layer looks like this in keymap.c:
NLCK,PSLS,PAST,PMNS,
P7, P8, P9,
P4, P5, P6,PPLS,
P1, P2, P3,
P0 ,PDOT,PENT,
If num lock is off, and I use these keys, will the OS/firmware automatically use them for home/end, pgup/pgdn, del/ins without having to define a separate layer? Is that what the keypad specific keycodes are for?
#ifdef MATRIX_HAS_GHOST
static bool has_ghost_in_row(uint8_t row)
{
matrix_row_t matrix_row = matrix_get_row(row);
// No ghost exists when less than 2 keys are down on the row
if (((matrix_row - 1) & matrix_row) == 0)
return false;
// Ghost occurs when the row shares column line with other row
for (uint8_t i=0; i < MATRIX_ROWS; i++) {
if (i != row && (matrix_get_row(i) & matrix_row))
return true;
}
return false;
}
#endif
Thanks for all the help so far. I have a couple more questions though. What is the MATRIX_HAS_GHOST function (not sure if that's the right term)? I see it in the config.h and the matrix.c files for the different keyboard projects, so I looked it up in keyboard.c in the common directory. Some keyboard projects have this commented out in config.h, some don't. What does it do and how do I know if I need it?It checks ghost and blocks its phantom keys on the matrix. You don't need this option if your matrix is 'what we call' NKRO with full of diodes. Some of cheap mechanical boards and most of mebrane boards are not NKRO and they need this option.
My second question is about the available pins on the Teensy++ 2.0. Are there any other pins beside PE2 (ALE) that I shouldn't use for my matrix or LEDs? I know PD6 is connected to the onboard LED, which precludes it's use unless I want the light flashing.I think you are right. All other pins can be used except for those two.
I have 3 computers to play with, and a range of windows versions to choose from, so let me know if I can be of any help. I can confirm that the keyboard works fine on POST and in the BIOS/UEFI of all three, it just seems to be a problem with windows. I can even access the OS boot options via F8 (e.g. "Safe Mode"), but once windows has loaded, it ignores the input until the keyboard is rebooted.
Though my coding/debugging skills are EXTREMELY elementary, I'd be happy to help in any way I can.
EDIT: Rebuilding with the LUFA stack instead of PJRC has eliminated this problem.
if (get_layer()==1)
{
// Output high.
DDRB |= (1<<0);
PORTB |= (1<<0);
}
else
{
// Output low.
DDRB &= ~(1<<0);
PORTB &= ~(1<<0);
}
EDIT: Rebuilding with the LUFA stack instead of PJRC has eliminated this problem.
Does there exist a function that will return the number of the active layer? If such a function existed, let's call it get_layer(), couldn't I just add in led.c something like this to turn on an LED on PB0 when layer 1 is active?You can get current state of keymap layers from 'default_layer_state' and 'layer_state' in action_layer.h.
void led_set(uint8_t usb_led)
{
if (biton32(layer_state) == 2)
{
// Output high.
DDRB |= (1<<6);
PORTB |= (1<<6);
}
else
{
// Output low.
DDRB &= ~(1<<6);
PORTB &= ~(1<<6);
}
if (biton32(layer_state) == 1)
{
// Output high.
DDRB &= ~(1<<7);
PORTB |= (1<<7);
}
else
{
// Output low.
DDRB &= ~(1<<7);
PORTB &= ~(1<<7);
}
}
Is there any guide or help file on how to program macros? I have everything working except I am unsure on how to make macros work. I saw somewhere in this thread someone used MACRO(MD(KEY),D(KEY2),END) does this work? is there a way to have it type something without making each key a D(KEY)? Thanks
Modify message
[0] = ACTION_LAYER_TAP_KEY(2, KC_SCLN)
[0] = ACTION_LAYER_TAP_KEY(KC_LCTL, 2)
If you tap Fn0 it will toggle layer 2 on, another tap will toggle layer 2 off. But holding the key would register as holding the left Ctrl key. I think this would be useful since I rarely just tap Ctrl. I usually hold it while I press C or V or whatever. I guess it also depends on how long a press has to be to not be a tap...[0] = ACTION_MOD_TAP_KEY(KC_LCTL, KC_FN1)
[1] = ACTION_LAYER_TOGGLE(2)
There is any chance to support the new Kitten Paw controller for Filco 104 keys from bpiphany?Bpiphany did nice work again!
http://deskthority.net/wiki/Kitten_Paw
I've one and I can help with testing ;)
Code: [Select][0] = ACTION_LAYER_TAP_KEY(2, KC_SCLN)
So, with this code the Fn0 key registers the ( ; ) key if tapped and momentarily switches to layer 2 if held. I have 2 questions:
1. If you are pressing the shift key and then tap Fn0, will it register ( : )?
2. Could this be made to work the opposite way? For example, if you had something like:Code: [Select][0] = ACTION_LAYER_TAP_KEY(KC_LCTL, 2)
If you tap Fn0 it will toggle layer 2 on, another tap will toggle layer 2 off. But holding the key would register as holding the left Ctrl key. I think this would be useful since I rarely just tap Ctrl. I usually hold it while I press C or V or whatever. I guess it also depends on how long a press has to be to not be a tap...
I'm a complete newbie to code and programming. But I'm very interested in building my own custom keyboard. This firmware is awesome! Thanks for reading.
Edit: Reading more of the keymap.md...Looks like I could get the action I want from #2 above by using the ACTION_MODS_TAP_KEY?Code: [Select][0] = ACTION_MOD_TAP_KEY(KC_LCTL, KC_FN1)
[1] = ACTION_LAYER_TOGGLE(2)
Does this look right? Of course this takes up 2 Fn keys, but with 32 available I should be just fine.
This won't work. ACTION_MOD_TAP_KEY doen't accept KC_FN*, only normal keycodes are required.
All other keys should work except for Fn key. I'm not sure my code works that way but I'll fix if it doesn't work. Hmm, at a glance my code doesn't work for mouse keys?This won't work. ACTION_MOD_TAP_KEY doen't accept KC_FN*, only normal keycodes are required.
I'm assuming this is true for the other ACTION_* commands as well? No Fn keys? Do normal keycodes include modifiers, mousekeys, system/media keys? Or just the normal keys as documented in the keymap.md file section 1.1?
Also, I would like to use the Teensy++ 2.0, or maybe the smaller Teensy 2.0 depending on the final number of pins I need. Do I have to use the PJRC stack or can I use the LUFA stack? I don't fully understand the difference, but I did see you said you wouldn't be supporting the PJRC stack anymore.PJRC stack is still supproted at this time but LUFA is recommended.
#include "debug_config.h"
debug_config.enable = true; // enable debug print
debug_config.matrix = true; // enable matrix debug
debug_config.keyboard = false; // enable keyboard report debug
debug_config.mouse = false; // enable mouse report debug
[12] = ACTION_LAYER_TAP_KEY(2, KC_SLSH),
ACTION_MODS_KEY(MOD_LSFT, KC_SLSH)
[12] = ACTION_LAYER_TAP_KEY(2, MOD_LSFT | KC_SLSH),
or something similar... Does it make sense what I'm trying to do?static const uint16_t PROGMEM fn_actions[] = {
[12] = ACTION_LAYER_TAP_KEY(2, KC_SLSH), // layer 2 with tap / and ?
};
/*
* Fn action definition
*/
//change Fn12 to:
[12] = ACTION_LAYER_MOMENTARY(2) // not quite sure how to call the layer in the ACTION_FUNCTION_TAP - see below
//add this:
[13] = ACTION_FUNCTION_TAP(LAYER2_QMARK), // Function: Layer 2 with tap ?
// add everything below:
/* id for user defined functions */
enum function_id {
LAYER2_QMARK,
};
/*
* user defined action function
*/
void action_function(keyrecord_t *record, uint8_t id, uint8_t opt)
{
keyevent_t event = record->event;
tap_t tap = record->tap;
switch (id) {
case LAYER2_QMARK: // Layer 2 + tap '?'
if (event.pressed) {
if (tap.count == 0 || tap.interrupted) { // will this work with a press and hold, like for momentary layer switching?
host_add_key(KC_FN12); // Can I call a Fn key with this function? How else would I switch the layer on?
} else {
host_add_mods(MOD_BIT(KC_LSHIFT));
host_add_key(KC_SLSH);
host_send_keyboard_report();
host_del_mods(MOD_BIT(KC_LSHIFT));
host_del_key(KC_SLSH);
host_send_keyboard_report();
}
} else {
if (tap.count == 0 || tap.interrupted) {
host_del_key(KC_FN12);
}
}
break;
}
}
if (tap.count == 0 || tap.interrupted) {
momentary switch layer
} elseif (tap.count == 2 || tap.interrupted) {
toggle layer
} else {
register character
Yup, KC_APP is the key code you need to use.
#include "action_util.h"
#include "action_layer.h"
harifun07,Thanks for you reply. I found that my design would lost the code 00 00 00 00 00 00 00 00 some times, then the PC could not receive the button up code. I was wondering whether the usb lost my data but I didn't know.
No, I don't use any CRC check on my firmware. With "data miss" you mean that your keyboard misses key stroke? Or missing charactors on debug output?
I've found charactor drops of debug message print and put aside for long time. I'll work on this issue later but not soon, it is not critical.
If you get keystroke drops describe more detail.
hmm,I found that you told about low level USB packet, but I know you used usb 2.0 protocol.
I doubt USB stack is culprit. LUFA and Atmel hardware USB engine are reliable enough.
Atmega USB engine uses CRC in low level USB packet with confroming with USB spec.
If you need more help your codes and info/pics of your keyboard may be useful to us.
EDIT: With poor USB cable I had similar problems like key stuck and missing.
You may need to add this at the end of #include block.Code: [Select]#include "action_util.h"
Code: [Select]#include "action_layer.h"
/*
* Fn action definition
*/
//change Fn12 to:
[12] = ACTION_FUNCTION_TAP(LAYER2_QMARK), // Function: Layer 2 with tap ?
// add everything below:
/* id for user defined functions */
enum function_id {
LAYER2_QMARK,
};
/*
* user defined action function
*/
void action_function(keyrecord_t *record, uint8_t id, uint8_t opt)
{
keyevent_t event = record->event;
tap_t tap = record->tap;
switch (id) {
case LAYER2_QMARK: // Layer 2 + tap '?'
if (event.pressed) {
if (tap.count == 0 || tap.interrupted) {
layer_on(2);
} else {
add_mods(KC_LSHIFT); // Does this still need the MOD_BIT() coding?
add_key(KC_SLSH);
send_keyboard_report();
del_mods(KC_LSHIFT); // Does this still need the MOD_BIT() coding?
del_key(KC_SLSH);
send_keyboard_report();
}
} else {
if (tap.count == 0 || tap.interrupted) {
layer_off(2);
}
}
break;
}
}
So, add these to the #include block in my keymap.c file, correct?Right. Add them at *end* of block, or you may get minor errors during compiling.
Then I would just use FN12 in my keymap like normal, correct?You still need to use MOD_BIT() macro in add/del_mods(). It looks OK except for that.
What about the add_mods() code...Do I still need the mod_bit() or did I do this right? I'm not really sure what the mod_bit() does...
/* Column pin configuration
* col: 0 1 2 3 4 5 6 7 8 9
* pin: E1 C0 C1 C2 C3 E6 F0 F1 F2 F3
*/
static void init_cols(void)
{
// Input with pull-up(DDR:0, PORT:1)
DDRC &= ~(1<<0 | 1<<1 | 1<<2 | 1<<3);
PORTC |= (1<<0 | 1<<1 | 1<<2 | 1<<3);
DDRE &= ~(1<<1 | 1<<6);
PORTE |= (1<<1 | 1<<6);
DDRF &= ~(1<<0 | 1<<1 | 1<<2 | 1<<3);
PORTF |= (1<<0 | 1<<1 | 1<<2 | 1<<3);
}
static matrix_row_t read_cols(void)
{
return (PINE&(1<<1) ? 0 : (1<<0)) |
(PINC&(1<<0) ? 0 : (1<<1)) |
(PINC&(1<<1) ? 0 : (1<<2)) |
(PINC&(1<<2) ? 0 : (1<<3)) |
(PINC&(1<<3) ? 0 : (1<<4)) |
(PINE&(1<<6) ? 0 : (1<<5)) |
(PINF&(1<<0) ? 0 : (1<<6)) |
(PINF&(1<<1) ? 0 : (1<<7)) |
(PINF&(1<<2) ? 0 : (1<<8)) |
(PINF&(1<<3) ? 0 : (1<<9)) ;
}
/* Row pin configuration
* row: 0 1 2 3 4 5 6 7
* pin: C4 C5 C6 C7 F4 F5 F6 F7
*/
static void unselect_rows(void)
{
// Hi-Z(DDR:0, PORT:0) to unselect
DDRC &= ~0b11110000;
PORTC &= ~0b11110000;
DDRF &= ~0b11110000;
PORTF &= ~0b11110000;
}
static void select_row(uint8_t row)
{
// Output low(DDR:1, PORT:0) to select
switch (row) {
case 0:
DDRC |= (1<<4);
PORTC &= ~(1<<4);
break;
case 1:
DDRC |= (1<<5);
PORTC &= ~(1<<5);
break;
case 2:
DDRC |= (1<<6);
PORTC &= ~(1<<6);
break;
case 3:
DDRC |= (1<<7);
PORTC &= ~(1<<7);
break;
case 4:
DDRF |= (1<<4);
PORTF &= ~(1<<4);
break;
case 5:
DDRF |= (1<<5);
PORTF &= ~(1<<5);
break;
case 6:
DDRF |= (1<<6);
PORTF &= ~(1<<6);
break;
case 7:
DDRF |= (1<<7);
PORTF &= ~(1<<7);
break;
}
}
void led_set(uint8_t usb_led)
{
if (usb_led & (1<<USB_LED_CAPS_LOCK)) {
DDRD |= (1<<6);
PORTD |= (1<<6);
} else {
DDRD |= (1<<6);
PORTD &= ~(1<<6);
}
}
4) As for led, you are right. But I don't remember whether it works or not in my HHKB :)
case TAP3LAY1_T: // Layer 1 toggle on and tap T
if (tap.count != 3) {
add_key(KC_T);
send_keyboard_report();
del_key(KC_T);
send_keyboard_report();
} else {
layer_on(1);
}
break;
} else {
add_key(KC_BSPC);
send_keyboard_report();
del_key(KC_BSPC);
send_keyboard_report();
add_key(KC_BSPC);
send_keyboard_report();
del_key(KC_BSPC);
send_keyboard_report();
layer_on(1);
to get rid of the first two taps before the layers switch. So a single tap would give you "t", then another tap "tt" then a thrid tap and both "tt" delete and the layers switch. But first I need to fix whatever is causing it to register twice for each tap...
if (event.pressed) {
if (tap.count < 3) {
register_code(KC_T);
} else {
}
} else {
if (tap.count < 3) {
unregister_code(KC_T)
} else if (tap.count == 3) {
register_code(KC_BSPC);
unregister_code(KC_BSPC);
register_code(KC_BSPC);
unregister_code(KC_BSPC);
layer_invert(1);
}
}
I'm not sure this is useful actually for you, this may work on text editor but not on web browser. If you type 'ttt' to change layer then you will get two page history back.
case TAP3LAY1_T: // Layer 1 toggle on and tap T
if (event.pressed) {
if (tap.count != 3) {
register_code(KC_T);
unregister_code(KC_T);
} else if (tap.count == 3) {
register_code(KC_BSPC);
unregister_code(KC_BSPC);
register_code(KC_BSPC);
unregister_code(KC_BSPC);
layer_on(1);
}
}
break;
I have a minor problem...
I used PEQL in my keymap. The firmware builds just fine, but my computer doesn't register anything when I press that key. Any ideas? The key is in a secondary layer, but all the other tenkey codes (like PMNS, PCMM, P1, etc) work just fine. Thanks for any help!
static const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
/*
* GH60
*/
/* Keymap 0: Default Layer
*/
KEYMAP_ANSI(
ESC, 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, \
LCTL,LALT,NO, SPC, FN0, RGUI,APP, RCTL),
/* Overlay 1: Fn mode
*/
KEYMAP_ANSI(
GRV, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, TRNS, \
TRNS,TRNS, UP, TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,PSCR,PAUS,VOLU,VOLD,MUTE, \
TRNS,LEFT,DOWN,RGHT,TRNS,TRNS,TRNS,TRNS,TRNS,INS,HOME, PGUP, TRNS, \
TRNS,TRNS, MPRV,MPLY,MNXT,TRNS,TRNS,TRNS,DEL,END,PGDN, TRNS, \
TRNS,TRNS,NO, TRNS, FN0, TRNS,TRNS,TRNS)
};
static const uint8_t PROGMEM overlays[][MATRIX_ROWS][MATRIX_COLS] = {};
/*
* Fn action definition
*/
static const uint16_t PROGMEM fn_actions[] = {
[0] = ACTION_KEYMAP_MOMENTARY(1),
};
#endif
#define KEYMAPS_SIZE (sizeof(keymaps) / sizeof(keymaps[0]))
#define OVERLAYS_SIZE (sizeof(overlays) / sizeof(overlays[0]))
#define FN_ACTIONS_SIZE (sizeof(fn_actions) / sizeof(fn_actions[0]))
/* translates key to keycode */
uint8_t keymap_key_to_keycode(uint8_t layer, key_t key)
{
/* Overlay: 16-31(OVERLAY_BIT(0x10) | overlay_layer) */
if (layer & OVERLAY_BIT) {
layer &= OVERLAY_MASK;
if (layer < OVERLAYS_SIZE) {
return pgm_read_byte(&overlays[(layer)][(key.row)][(key.col)]);
} else {
// XXX: this may cuaes bootlaoder_jump incositent fail.
//debug("key_to_keycode: overlay "); debug_dec(layer); debug(" is invalid.\n");
return KC_TRANSPARENT;
}
}
/* Keymap: 0-15 */
else {
if (layer < KEYMAPS_SIZE) {
return pgm_read_byte(&keymaps[(layer)][(key.row)][(key.col)]);
} else {
// XXX: this may cuaes bootlaoder_jump incositent fail.
//debug("key_to_keycode: base "); debug_dec(layer); debug(" is invalid.\n");
// fall back to layer 0
return pgm_read_byte(&keymaps[0][(key.row)][(key.col)]);
}
}
}
/* translates Fn keycode to action */
action_t keymap_fn_to_action(uint8_t keycode)
{
action_t action;
if (FN_INDEX(keycode) < FN_ACTIONS_SIZE) {
action.code = pgm_read_word(&fn_actions[FN_INDEX(keycode)]);
} else {
action.code = ACTION_NO;
}
return action;
}
Sorry, but I know nothing about these things and just don't really get these topics.
@jorgenslee
Maybe No and no.
I don't know actually what conroller Poker2 has, whether it is programmable and whether its toolchain is available free to public.
case LAYER2_QMARK: // Layer 2 momentary with tap '?'
if (event.pressed) {
if (tap.count == 0 || tap.interrupted) {
layer_on(2);
} else {
add_mods(MOD_BIT(KC_LSFT));
add_key(KC_SLSH);
send_keyboard_report();
del_mods(MOD_BIT(KC_LSFT));
del_key(KC_SLSH);
send_keyboard_report();
}
} else {
if (tap.count == 0 || tap.interrupted) {
layer_off(2);
}
}
break;
/* inspect */
uint8_t has_anykey(void);
uint8_t has_anymod(void);
uint8_t get_first_key(void);
typedef union {
uint8_t raw[REPORT_SIZE];
struct {
uint8_t mods;
uint8_t reserved;
uint8_t keys[REPORT_KEYS];
};
#ifdef NKRO_ENABLE
struct {
uint8_t mods;
uint8_t bits[REPORT_BITS];
} nkro;
#endif
} __attribute__ ((packed)) report_keyboard_t;
/*
typedef struct {
uint8_t mods;
uint8_t reserved;
uint8_t keys[REPORT_KEYS];
} __attribute__ ((packed)) report_keyboard_t;
*/
typedef struct {
uint8_t buttons;
int8_t x;
int8_t y;
int8_t v;
int8_t h;
} __attribute__ ((packed)) report_mouse_t;
Also, a few misc questions:
1. What are weak mod keys?
2. What are oneshot keys?
3. What are the 3-5 mouse buttons? 1 and 2 are the left and right buttons, not sure about the rest.
Thanks for all the help!
struct {
uint8_t mods;
uint8_t reserved;
uint8_t keys[REPORT_KEYS];
};
0 |1 |2 |3 |4 |5 |6 |7
--------+--------+--------+--------+--------+--------+--------+--------
mods |reserved|keys[0] |keys[1] |keys[2] |keys[3] |keys[4] |keys[5]
0 |1 |2 |3 |4 |5 |6 |7
--------+--------+--------+--------+--------+--------+--------+--------
Lcontrol|Lshift |Lalt |Lgui |Rcontrol|Rshift |Ralt |Rgui
if ( keyboard_report->mods & (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) )
Also, a few misc questions:
1. What are weak mod keys?
2. What are oneshot keys?
3. What are the 3-5 mouse buttons? 1 and 2 are the left and right buttons, not sure about the rest.
const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
/* 0: qwerty */
KEYMAP_ANSI(
ESC, 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, \
LCTL,LALT,NO, SPC, FN0, RGUI,APP, RCTL),
/* Overlay 1: Fn mode
*/
KEYMAP_ANSI(
GRV, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, TRNS, \
TRNS,TRNS, UP, TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,PSCR,PAUS,VOLU,VOLD,MUTE, \
TRNS,LEFT,DOWN,RGHT,TRNS,TRNS,TRNS,TRNS,TRNS,INS,HOME, PGUP, TRNS, \
TRNS,TRNS, MPRV,MPLY,MNXT,TRNS,TRNS,TRNS,DEL,END,PGDN, TRNS, \
TRNS,TRNS,NO, TRNS, FN0, TRNS,TRNS,TRNS)
};
const uint16_t PROGMEM fn_actions[] = ACTION_LAYER_MOMENTARY(1);
Space(tap)/Layer5(hold) ~~~~~~~~~~~~~_______~~~~~~~~~~~~~
f(Layer0)/=(Layer5) ~~~~~~~~~~~~~~~____~~~~~~~~~~~~~~~
TAPPING_TERM |----------|
expected output: "="
got: " f"
2.Space(tap)/Layer5(hold) ~~~~~~~___~~~_________~~~~~___~~~
f(Layer0)/=(Layer5) ___~~~~~~~~~~~~_____~~~~~~~~~~~~~
TAPPING_TERM |----------|
expected output: "f = "
got: "f f "
3.t ~______~~~~~~~~~~~~~~~~~~~~~~~~~~
h ~~~~~~______~~~~~~~~~~~~~~~~~~~~~
i(tap)/ Layer8(hold) ~~~~~~~~~~~______~~~~~~~~~~~~~~~~
s(Layer0)/ { (layer5) ~~~~~~~~~~~~~~~~______~~~~~~~~~~~
Space(tap)/Layer5(hold) ~~~~~~~~~~~~~~~~~~~~~_______~~~~~
TAPPING_TERM |----------|
expected output: "this "
got: "thi{"
I have no idea what revision I am on but on my gh60 rev. a with your firmware I have ` instead of esc everytime I plug it in. I have just dealt with it and pressed fn + q to change it every time I plug in my keyboard assuming that was the default behavior.
I have no idea what revision I am on but on my gh60 rev. a with your firmware I have ` instead of esc everytime I plug it in. I have just dealt with it and pressed fn + q to change it every time I plug in my keyboard assuming that was the default behavior.
Did you try clear eeprom? You can do this with dfu-programmer, I think.
Or did you try boot magic configuration clear? I guess space+backspace or Fn+backspace, it depends on you configure.h.
EDIT: I guess your eeprom was wrongly programmed and it causes this problem, to solve you will need clear the eeprom with either ways.
1. run 'make dfu-ee'
2. plug in pressing space and backspace
IvanIvanovich,Thanks. I guess instead of telling me I had error, it was using keymap from another like Poker or something??? Weird.
I don't know why you got ` intead of esc clearly. But boot magic may causes those problem. Try disabling boot magic build option. And you have wrong fn_actions, note that it is array.
EDIT: In fact you cannot omit '{}', I mean.
Thanks for you help hasu!
My bug #3 has not been happening any more -- it must have been a problem with something I did the other day. Did not have that problem all day today.
I started working on rewriting action_tapping -- you're right, it's complicated. :) I'll see if I can get it to work. Do you have a way of doing automated tests or anything? If I get it to work for my use case it will be hard to know whether I broke other peoples' use cases..
You can see if SHIFT keys are pressed down byCode: [Select]if ( keyboard_report->mods & (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) )
Hi,Do you have anywhere where we can throw some cash your way as thanks for making this firmware available, Hasu?
You can see active layers on layer_state and default_layer_state of action_layer.h. To get real state of layers you need to see both.
uint32_t real_state = (layer_state | default_layer_state);
Each bit indicates state of a layer; bit0 has state of layer0, bit31 has layer31 and 0/1 means off/on.
Ah, it is you! I didn't find it on github :D
I've not got my hands on any NeXT keyboard yet, it looks attractive and inrigues me. Occasionally I can find them here but its price is steep.
Looking forward to your post about it. Anyway, great job!
FYI, you can access his non-ADB NeXT converter here.
https://github.com/tmk/tmk_keyboard/tree/master/converter/next_usb
hydrospell, thanks
it feels nice to get feedback on my work in particular if it is positive :D
and congrats on success of your project!
Hi,
You can see active layers on layer_state and default_layer_state of action_layer.h. To get real state of layers you need to see both.
uint32_t real_state = (layer_state | default_layer_state);
Each bit indicates state of a layer; bit0 has state of layer0, bit31 has layer31 and 0/1 means off/on.
Ah, it is you! I didn't find it on github :D
I've not got my hands on any NeXT keyboard yet, it looks attractive and inrigues me. Occasionally I can find them here but its price is steep.
Looking forward to your post about it. Anyway, great job!
FYI, you can access his non-ADB NeXT converter here.
https://github.com/tmk/tmk_keyboard/tree/master/converter/next_usb
enum internal_special_keycodes {
KC_FN0 = 0xC0,
KC_FN1,
:
:
KC_FN30,
KC_FN31, /* 0xDF */
V-USB is one of USB stack used in tmk_keyboard. tmk supports three USB stack LUFA, PJRC and V-USB. gh60 uses LUFA by default.
http://www.obdev.at/products/vusb/index.html
If you want to port the firmware to 38gt, you need to do theese
1) look into matrix circuit with multimeter unless it is open
2) wirte code in matrix.c
3) build with V-USB stack
Nice, it looks like usual V-USB circuit and I think tmk works for this without problem.
Next, you need to know matrix circuit, you can start with 1) as I previously posted.
I'm not sure what you need because I don't know your electronics knowledge and C programming skills.
Do you want to know about how tmk_keyboard works? If so I can help.
If you need to learn how matrix circuit works or C language you can teach yourself with great keyboard resources on the net.
All LED indicators defined in spec are supported. If you mean backlight, maybe answer is yes/no.
Wraul added backlight interface(common/backlight.h) to support KMAC some back. But I'm not sure it works for you. At least it does not support fancy illumination fucntions.
Thanks Hasu. I would assume that anything with a number in the pin designation can be used then?
Thanks Hasu. I would assume that anything with a number in the pin designation can be used then?
Not to jump queue, but I think the Teensy 2.0 controller can use up to 26 pins. This does count the pin used for the on-board LED, based on other comments it doesn't impact the usage of the controller to assign a row/column to that pin. Excludes Power, Ground, and E6.
1 F0
2 F1
3 F4
4 F5
5 F6
6 F7
7 B6
8 B5
9 B4
10 D7
11 D6
12 D4
13 D5
14 C7
15 C6 Lifted top pad on mine.
16 D3
17 D2
18 D1
19 D0
20 B7
21 B3
22 B2
23 B1
24 B0
Thanks Hasu. I would assume that anything with a number in the pin designation can be used then?
Not to jump queue, but I think the Teensy 2.0 controller can use up to 26 pins. This does count the pin used for the on-board LED, based on other comments it doesn't impact the usage of the controller to assign a row/column to that pin. Excludes Power, Ground, and E6.
I am probably wrong on this but I am only counting 24.
Counting from top left with USB port on left side on top I getCode: [Select]1 F0
2 F1
3 F4
4 F5
5 F6
6 F7
7 B6
8 B5
9 B4
10 D7
11 D6
12 D4
13 D5
14 C7
15 C6 Lifted top pad on mine.
16 D3
17 D2
18 D1
19 D0
20 B7
21 B3
22 B2
23 B1
24 B0
So looking at this I don't have enough pins even with including my lifted pad.
Also looking at PJRC's website it has 25 IO pins. I am guessing that would be E6.
And it looks like with this layout I am going to need every pin for the matrix. Well, looks like I am going to use my new teensy and just buy another one for when I get ready to wire up my Brushed Behemoth.
Edit: I apologize if these are noobie questions but I am still pretty new to electronics. I do understand some basics but not a lot of specifics especially with these controllers and such.
// Phantom ANSI 150
static const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
/* 0: qwerty */
KEYMAP_ANSI_150(\
ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, FN2, PSCR,NLCK,BRK, \
GRV, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSPC, INS, HOME,PGUP, \
TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC,BSLS, DEL, END, PGDN, \
CAPS, A, S, D, F, G, H, J, K, L, SCLN,QUOT, ENT, TRNS,TRNS,TRNS, \
LSFT, Z, X, C, V, B, N, M, COMM,DOT, SLSH, RSFT, TRNS, UP, TRNS, \
LCTL,LGUI,LALT, SPC, RALT,FN1,RCTL, LEFT,DOWN,RGHT),
/* 1: number keys */
KEYMAP_ANSI_150(\
TRNS, TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, PSCR,NLCK,BRK, \
TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, PSLS,PAST,PMNS, \
TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, P7, P8, P9, \
TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, TRNS, P4, P5, P6, \
TRNS, TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, TRNS, P1, P2, P3, \
TRNS,TRNS,TRNS, TRNS, TRNS,TRNS, TRNS, P0, PDOT,PPLS),
/* 2: media keys */
KEYMAP_ANSI_150(\
TRNS, TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, TRNS,TRNS,SLEP, \
TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, TRNS,TRNS,TRNS, \
TRNS,MPLY,MPRV,MNXT,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, TRNS,TRNS,TRNS, \
TRNS,MUTE,VOLD,VOLU,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, TRNS, TRNS,TRNS,TRNS, \
TRNS, TRNS,TRNS,CALC,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, TRNS, TRNS,TRNS,TRNS, \
TRNS,TRNS,TRNS, TRNS, TRNS,TRNS, TRNS, TRNS,TRNS,TRNS)
};
static const uint16_t PROGMEM fn_actions[] = {
[0] = ACTION_LAYER_MOMENTARY(1), // FN0
[1] = ACTION_LAYER_TAP_KEY(2, KC_RGUI), // FN1
[2] = ACTION_LAYER_TOGGLE(3) // FN2
};
Yes. In tmk you shall see columns as input, this is just from conventional reason. Note that 'column' and 'row' are just name and interchangeable each other if you change your point of view.
In your matrix you can read 19 columns as input but to retain that data you need to 32bit(uint32_t) variable and waste 13 bits space in vain. Instead, you can use 8bit(uint8_t) variable with treating your 6 'rows' as input, that is, 'column' in tmk. Confusing :)
Right, looks like lowpoly's M0110 mod uses 'rows' as input. Wait, lean your head 90deg. Voila, row is column now!
Would this matrix be possible with using a hand wired matrix on a Teensy 2.0? [...] It is 19 columns x 6 rows.
Would this matrix be possible with using a hand wired matrix on a Teensy 2.0? [...] It is 19 columns x 6 rows.
You know you don’t have to wire all the rows and columns in exactly straight lines, right? :)
You should be able to handle your layout with a 10x11 or 11x11 matrix, you just might have to make the rows and columns zig zag or skip a bit.
while true; do setxkbmap -layout de && sleep 1; done
I do not personally condone the use of this hack that I made nor do I take any responsibilities for any damages may arise from the use of the hack. Until I can find a nice solution that can work with my constant keyboard switching (along with their specific switches and their layouts) I am more or less going to have to tackle it in various ways. xmodmap seems to work wonders for both the two former keyboards but not so well for the DE ISO (yet).setxkbmap gb
However when I plug my phantom in it resets back to the default US X11 mapping. Its not a problem I saw with my Filco with HID liberation or any other keyboard.setxkbmap
is only ever temporary, instead I should have used# localectl set-x11-keymap
which creates a new file/etc/X11/xorg.conf.d/00-keyboard.conf
and now everything is permanent and fixed. YAY!
For example, if i wanted to select text from the cursor position to the end of the line, i might type shift+end. But I want to make (Fn+shift=caps_lock) AND (Fn+right_arrow=end). So, how do i make sure that Fn+shift+right_arrow=shift+end (with no caps lock)? Is the only solution to move caps lock to some other combo?
Thanks!
Hi hasu, first of all, thanks for your greatest ever firmware. I have been using it for a couple of months, and it is just amazing.
However, recently I upgraded my PC to a new one with UEFI. The problem is, if I use lufa, the computer behave strangely, either stuck in the "press del for setup" screen (I can enter the setup and the keyboard is working fine there), or when pass that screen sometimes, the linux kernel will report "CPU[123] not responding" and reboot. If I wait after computer booting complete, then plug the keyboard, everything works fine.
Therefore, I am now using pjrc stack and it works, no above mentioned problem. But I can't help to wonder what might be the problem and whether it can be fixed.
#include "keymap_common.h"
#define KEYMAP( \
K0A, K0B, K0C, K0D, \
K1A, K1B, K1C, K1D, \
K2A, K2B, K2C, K2D, \
K3A, K3B, K3C, K3D, \
K4A, K4B, K4C, K4D \
) { \
{ KC_##K0A, KC_##K0B, KC_##K0C, KC_##K0D }, \
{ KC_##K1A, KC_##K1B, KC_##K1C, KC_##K1D }, \
{ KC_##K2A, KC_##K2B, KC_##K2C, KC_##K2D }, \
{ KC_##K3A, KC_##K3B, KC_##K3C, KC_##K3D }, \
{ KC_##K4A, KC_##K4B, KC_##K4C, KC_##K4D }, \
}
#ifdef KEYMAP_SECTION_ENABLE
const uint8_t keymaps[][MATRIX_ROWS][MATRIX_COLS] __attribute__ ((section (".keymap.keymaps"))) = {
#else
const uint8_t keymaps[][MATRIX_ROWS][MATRIX_COLS] PROGMEM = {
#endif
[0] = KEYMAP(
NLCK,PSLS, PAST, PMNS, \
P7, P8, P9, PPLS, \
P4, P5, P6, NO, \
P1, P2, P3, ENT, \
P0, P0, PDOT, NO)
};
#ifdef KEYMAP_SECTION_ENABLE
const uint16_t fn_actions[] __attribute__ ((section (".keymap.fn_actions"))) = {
#else
const uint16_t fn_actions[] PROGMEM = {
#endif
};
#ifndef CONFIG_H
#define CONFIG_H
/* USB Device descriptor parameter */
#define VENDOR_ID 0xFEED
#define PRODUCT_ID 0x6060
#define DEVICE_VER 0x0001
#define MANUFACTURER geekhack
#define PRODUCT GHPAD
#define DESCRIPTION t.m.k. keyboard firmware for GHPAD
/* key matrix size */
#define MATRIX_ROWS 5
#define MATRIX_COLS 4
/* define if matrix has ghost */
//#define MATRIX_HAS_GHOST
/* Set 0 if debouncing isn't needed */
#define DEBOUNCE 5
/* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */
#define LOCKING_SUPPORT_ENABLE
/* Locking resynchronize hack */
#define LOCKING_RESYNC_ENABLE
/* key combination for command */
#define IS_COMMAND() ( \
keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) \
)
#endif
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.
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?
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.
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);
}
}
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
Hmm, it looks your configuration is right, it should work. Did you do 'make clean' after change config.h?
# 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
Tools for testing NKRO
----------------------
Browser App:
http://www.microsoft.com/appliedsciences/content/projects/KeyboardGhostingDemo.aspx
http://random.xem.us/rollover.html
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?
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
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?
Hi,
I am assembling a tenkeyless keyboard with a matrix:Show Image(http://i297.photobucket.com/albums/mm228/johnny88_bucket/2014-02-16110825.jpg)Show Image(http://i297.photobucket.com/albums/mm228/johnny88_bucket/2014-02-22202632.jpg)
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?
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.
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.
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
include $(TOP_DIR)/protocol.mk
After adding this line, lufa is now working, no boot problem as mentioned earlier.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
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.
/* 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));
}
/* 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 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.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.Well, all of these keys depend on operating system / other software support. Some computers might interpret “media select” to do something useful?
Well, all of these keys depend on operating system / other software support. Some computers might interpret “media select” to do something useful?Yeah, but I have no use for it then, I only use VOLD, VOLU, MUTE, MPLY, MSTP, MNXT and MPRV.
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.
MOUSEKEY_ENABLE = yes # Mouse keys
Did you enable MOUSEKEY in your Makefile?It was enabled, but commented out, now it works! Thanks! =DCode: [Select]MOUSEKEY_ENABLE = yes # Mouse keys
It was enabled, but commented out, now it works! Thanks! =D
It was enabled, but commented out, now it works! Thanks! =D
How can it be enabled if it is commented out? :-X
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?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);
}
}
if(level & (1<<1))
How many "levels" are there?backlight_toggle()
as part of a user defined action function? Does anything go in the parenthesis?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.
Whew, that's a lot of questions! For starters, check out Bitwise operations in C on Wikipedia (https://en.wikipedia.org/wiki/Bitwise_operations_in_C).
I'm not familiar with this part of TMK's codebase, so my help will have to stop here.
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);
}
1. I don't understand what the difference is between |= and &= or what the ~ is doing. Sorry, I'm a programming noob...
Thanks guys! Starting with your links I eventually found this:
https://en.wikipedia.org/wiki/Bit_manipulation (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.
bool keyboard_nkro = true;
in "host.c" and it worked, but i see now that I can enable it with Magic + N. What key is the Magic key? Is it something that is predefined or is it something that you define yourself? How do i use this Magic key?/* key combination for command */
#define IS_COMMAND() ( \
keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) \
)
#endif
keyboard_report->mods == (MOD_BIT(KC_HOME) | MOD_BIT(KC_PGUP)) \
The mods in that code snippet need to actually be mods, i.e. Ctrl, Alt, Shift, or Gui keys. Pick any combination. :)Wow, that actually makes much more sense now.
ACTION_MODS_TAP_KEY(MOD_RSFT, KC_GRV);
This will make the grave key (`) work as right shift.ACTION_MODS_TAP_KEY(MOD_RSFT | MOD_LSFT, KC_HOME);
To send both right and left shift when you hold HOME.So, in this code...Yeah, yeah, I know the comment's doesn't do anything. My first guess on how it worked was actually what you said, I just wanted to confirm it.
static const uint16_t PROGMEM fn_actions[] = {
ACTION_LAYER_MOMENTARY(3), // FN2
};
fn_actions[] is really just an array, and the first item is number zero. Even though you have a comment saying FN2, that first item is still FN0: the compiler doesn't even read that comment. If you move the actions around in the list, you need to update the comments accordingly, for your own sanity!
I've wired up a really tiny keyboard on a breadboard and am trying to see if I can have 4 layers with only 2 function keys. I'm not sure if I missed it in the documentation somewhere, but is it possible to do something like this?
none -> layer 0 (default)
Fn0 -> layer 1
Fn1 -> layer 2
Fn0 & Fn1 -> layer 3
Thanks.
Layer Layer bit
---------------------------------
L0 000x (default layer)
L1 001x
L2 01xx
L3 1xxx
0: off, 1: on, x: dont' care
|KeyA |KeyB
Layer |Down Up |Down Up
-------+--------------------+--------------------
L0 |L1_on N/A |L2_on N/A
L1 |N/A L1_off |L3_on N/A
L2 |L4_on N/A |N/A L2_off
L3 |N/A L1_off |N/A L3_off
L4 |N/A L4_off |N/A L2_off
Fn Press Relese Action
---------------------------------------------------------------
FN0 L1_on --- ACTION_LAYER_ON(1, ON_PRESS)
FN1 L2_on --- ACTION_LAYER_ON(2, ON_PRESS)
FN2 L3_on --- ACTION_LAYER_ON(3, ON_PRESS)
FN3 L4_on --- ACTION_LAYER_ON(4, ON_PRESS)
FN4 --- L1_off ACTION_LAYER_OFF(1, ON_RELESE)
FN5 --- L2_off ACTION_LAYER_OFF(2, ON_RELESE)
FN6 --- L3_off ACTION_LAYER_OFF(3, ON_RELESE)
FN7 --- L4_off ACTION_LAYER_OFF(4, ON_RELESE)
Keymap KeyA KeyB
----------------------------
KEYMAP_L0: FN0 FN1
KEYMAP_L1: FN4 FN2
KEYMAP_L2: FN3 FN5
KEYMAP_L3: FN4 FN6
KEYMAP_L4: FN7 FN5
Fn Press Relese Action
---------------------------------------------------------------
FN0 L1_on L1_off ACTION_LAYER_ON_OFF(1)
FN1 L2_on L2_off ACTION_LAYER_ON_OFF(2)
FN2 L3_on L3_off ACTION_LAYER_ON_OFF(3)
FN3 L4_on L4_off ACTION_LAYER_ON_OFF(4)
Keymap KeyA KeyB
----------------------------
KEYMAP_L0: FN0 FN1
KEYMAP_L1: FN0 FN2
KEYMAP_L2: FN3 FN1
KEYMAP_L3: FN0 FN2
KEYMAP_L4: FN3 FN1
|KeyA |KeyB
Layer |Down Up |Down Up
-------+--------------------+--------------------
L0 |to_L1 N/A |to_L2 N/A
L1 |N/A to_L0 |to_L3 N/A
L2 |to_L3 N/A |N/A to_L0
L3 |N/A to_L2 |N/A to_L1
Fn Press Relese Action
---------------------------------------------------------------
FN0 to_L1 ACTION_LAYER_SET(1, ON_PRESS)
FN1 to_L2 ACTION_LAYER_SET(2, ON_PRESS)
FN2 to_L3 ACTION_LAYER_SET(3, ON_PRESS)
FN3 --- to_L0 ACTION_LAYER_SET(0, ON_RELESE)
FN4 --- to_L1 ACTION_LAYER_SET(1, ON_RELESE)
FN5 --- to_L2 ACTION_LAYER_SET(2, ON_RELESE)
Keymap KeyA KeyB
----------------------------
KEYMAP_L0: FN0 FN1
KEYMAP_L1: FN3 FN2
KEYMAP_L2: FN2 FN3
KEYMAP_L3: FN5 FN4
|KeyA |KeyB
Layer |Down Up |Down Up
-------+--------------------+--------------------
L0 |to_L1 N/A |to_L2 N/A
L1 |N/A to_L0 |to_L3 N/A
L2 |to_L3 N/A |N/A to_L0
L3 |N/A to_L0 |N/A to_L0
Fn Press Relese Action
---------------------------------------------------------------
FN0 to_L1 to_L0 ACTION_LAYER_SET_CLEAR(1)
FN1 to_L2 to_L0 ACTION_LAYER_SET_CLEAR(2)
FN2 to_L3 to_L0 ACTION_LAYER_SET_CLEAR(3)
Keymap KeyA KeyB
----------------------------
KEYMAP_L0: FN0 FN1
KEYMAP_L1: FN0 FN2
KEYMAP_L2: FN2 FN1
KEYMAP_L3: FN2 FN2
So, in this code...
static const uint16_t PROGMEM fn_actions[] = {
ACTION_LAYER_MOMENTARY(3), // FN2
};
fn_actions[] is really just an array, and the first item is number zero. Even though you have a comment saying FN2, that first item is still FN0: the compiler doesn't even read that comment. If you move the actions around in the list, you need to update the comments accordingly, for your own sanity!
So, in this code...
static const uint16_t PROGMEM fn_actions[] = {
ACTION_LAYER_MOMENTARY(3), // FN2
};
fn_actions[] is really just an array, and the first item is number zero. Even though you have a comment saying FN2, that first item is still FN0: the compiler doesn't even read that comment. If you move the actions around in the list, you need to update the comments accordingly, for your own sanity!
Exactly.
Luckily we are using great GCC, so with taking advantage of its C language extenstion we can write like this instead of keeping comment updated.
static const uint16_t PROGMEM fn_actions[] = {
[2] = ACTION_LAYER_MOMENTARY(3),
};
MAY GCC BE WITH YOU
abjr, yes it is possible.
@@ -225,8 +253,7 @@ void action_function(keyrecord_t *record, uint8_t id, uint8_t opt)
// NOTE: cant use register_code to avoid conflicting with magic key bind
if (event.pressed) {
if (tap.count == 0 || tap.interrupted) {
- //add_mods(MOD_BIT(KC_LSHIFT));
- layer_on(1);
+ add_mods(MOD_BIT(KC_LSHIFT));
} else {
add_mods(MOD_BIT(KC_LSHIFT));
add_key(KC_9);
@@ -237,8 +264,7 @@ void action_function(keyrecord_t *record, uint8_t id, uint8_t opt)
}
} else {
if (tap.count == 0 || tap.interrupted) {
- //del_mods(MOD_BIT(KC_LSHIFT));
- layer_off(1);
+ del_mods(MOD_BIT(KC_LSHIFT));
}
}
break;
Thanks. That fixed it :)
Perhaps that should be fixed online?
case LSHIFT_LPAREN:
// LShft + tap '('
if (event.pressed) {
dprint("P: ");
if (record->tap.count > 0) {
if (record->tap.interrupted) {
dprint("tap interrupted\n");
record->tap.count = 0; // ad hoc: cancel tap
register_mods(MOD_BIT(KC_LSHIFT));
} else {
dprint("tap\n");
add_weak_mods(MOD_BIT(KC_LSHIFT));
send_keyboard_report();
register_code(KC_9);
}
} else {
dprint("no tap\n");
register_mods(MOD_BIT(KC_LSHIFT));
}
} else {
dprint("R: ");
if (record->tap.count > 0) {
dprint("tap\n");
del_weak_mods(MOD_BIT(KC_LSHIFT));
send_keyboard_report();
unregister_code(KC_9);
} else {
dprint("no tap\n");
unregister_mods(MOD_BIT(KC_LSHIFT));
}
}
break;
Dual role key can be two variants, one whose main role is 'key' and sub role is 'modifier' and vice versa. Tmk's dual role key implementation is optimized for the former and my personal typing habits so that I can place the function on Space, Semicolon and Slash key. Meanwhile you want the latter, unfortunately tmk deosn't offer enough configuration option for you at this time.
Hasu,
That "codelet" works well. Tapping the shift key produces a parentheses and holding sets shift. Writing capital letters works fine and the shift modifier is removed correctly. The only issue I found is - if I tap shift a few times then hold it I will get (((((((((, but that's not too big of a deal and I don't think it will happen in actual use. Thanks for the help :)
dprint("R: ");
if (record->tap.count > 0) {
dprint("tap\n");
* unregister_code(KC_9);
* del_weak_mods(MOD_BIT(KC_LSHIFT));
* send_keyboard_report();
} else {
You are right about general idea of dual role key. But its implementation and optimization can be varied greately. This codelet is optimzed for mod(main)/key(sub) and you'll be frustrated if it is place on alpha key area. You'll ofetn get 'mod' instead of 'key' despite your intention.Dual role key can be two variants, one whose main role is 'key' and sub role is 'modifier' and vice versa. Tmk's dual role key implementation is optimized for the former and my personal typing habits so that I can place the function on Space, Semicolon and Slash key. Meanwhile you want the latter, unfortunately tmk deosn't offer enough configuration option for you at this time.
Maybe I am confused but I don't see the big difference between the "two variants". Both produce a 'key' when tapped and a 'modifier' when held. Can the "Shift" key not be thought of as a main role "(" key that acts as "LSHIFT" when held? (Similar to the slash key producing a mod when held). Perhaps I don't understand how the main/sub role works and why shift cannot be thought of with a main role key, and sub role modifier.
Hopefully what I said makes some sense.
... TMK firmware ... ErgoDox ... thunderbolt hub ... sleep/wake ... dead keyboard ...
... Are you using LUFA or something else that's different between the two?...
Hasu,
That "codelet" works well. Tapping the shift key produces a parentheses and holding sets shift. Writing capital letters works fine and the shift modifier is removed correctly. The only issue I found is - if I tap shift a few times then hold it I will get (((((((((, but that's not too big of a deal and I don't think it will happen in actual use. Thanks for the help :)Dual role key can be two variants, one whose main role is 'key' and sub role is 'modifier' and vice versa. Tmk's dual role key implementation is optimized for the former and my personal typing habits so that I can place the function on Space, Semicolon and Slash key. Meanwhile you want the latter, unfortunately tmk deosn't offer enough configuration option for you at this time.
Maybe I am confused but I don't see the big difference between the "two variants". Both produce a 'key' when tapped and a 'modifier' when held. Can the "Shift" key not be thought of as a main role "(" key that acts as "LSHIFT" when held? (Similar to the slash key producing a mod when held). Perhaps I don't understand how the main/sub role works and why shift cannot be thought of with a main role key, and sub role modifier.
Hopefully what I said makes some sense.
How can I remove the tap-shift-( functionality completely and set the shift key to a standard LShift?
----- Command Help -----
c: enter console mode
d: toggle debug enable
x: toggle matrix debug
k: toggle keyboard debug
m: toggle mouse debug
v: print device version & info
t: print timer count
s: print status
e: print eeprom config
n: toggle NKRO
0/F10: switch to Layer0
1/F1: switch to Layer1
2/F2: switch to Layer2
3/F3: switch to Layer3
4/F4: switch to Layer4
PScr: power down/remote wake-up
Caps: Lock Keyboard(Child Proof)
Paus: jump to bootloader
----- Console Help -----
ESC/q: quit
m: mousekey
Enter Console Mode
C>
----- Mousekey Parameters Help -----
ESC/q: quit
1: select mk_delay(*10ms)
2: select mk_interval(ms)
3: select mk_max_speed
4: select mk_time_to_max
5: select mk_wheel_max_speed
6: select mk_wheel_time_to_max
p: print prameters
d: set default values
up: increase prameters(+1)
down: decrease prameters(-1)
pgup: increase prameters(+10)
pgdown: decrease prameters(-10)
speed = delta * max_speed * (repeat / time_to_max)
where delta: cursor=5, wheel=1
See http://en.wikipedia.org/wiki/Mouse_keys
Enter Mousekey Console
M0>
----- Mousekey Parameters -----
1: mk_delay(*10ms): 30
2: mk_interval(ms): 50
3: mk_max_speed: 10
4: mk_time_to_max: 20
5: mk_wheel_max_speed: 8
6: mk_wheel_time_to_max: 40
M0> ????
Quit Mousekey Console
C>
Quit Console Mode
/* key matrix size */
#define MATRIX_ROWS 9
#define MATRIX_COLS 13
static void init_cols(void)
{
// Input with pull-up(DDR:0, PORT:1)
DDRD &= ~(1<<1 | 1<<2 | 1<<3 | 1<<4 | 1<<5 | 1<<6 | 1<<7);
PORTD |= (1<<1 | 1<<2 | 1<<3 | 1<<4 | 1<<5 | 1<<6 | 1<<7);
DDRE &= ~(1<<0 | 1<<1);
PORTE |= (1<<0 | 1<<1);
DDRC &= ~(1<<0 | 1<<1 | 1<<2 | 1<<3 | 1<<4);
PORTC |= (1<<0 | 1<<1 | 1<<2 | 1<<3 | 1<<4);
}
static matrix_row_t read_cols(void)
{
return (PIND&(1<<1) ? 0 : (1<<0)) |
(PIND&(1<<2) ? 0 : (1<<1)) |
(PIND&(1<<3) ? 0 : (1<<2)) |
(PIND&(1<<4) ? 0 : (1<<3)) |
(PIND&(1<<5) ? 0 : (1<<4)) |
(PIND&(1<<7) ? 0 : (1<<5)) |
(PINE&(1<<0) ? 0 : (1<<6)) |
//((PINB&(1<<0) && PINB&(1<<7)) ? 0 : (1<<8)) | // Rev.A and B
(PINE&(1<<1) ? 0 : (1<<7)) |
(PINC&(1<<0) ? 0 : (1<<8)) |
(PINC&(1<<1) ? 0 : (1<<9)) |
(PINC&(1<<2) ? 0 : (1<<10)) |
(PINC&(1<<3) ? 0 : (1<<11)) |
(PINC&(1<<4) ? 0 : (1<<12));
}
/* Row pin configuration
* row: 0 1 2 3 4
* pin: D0 D1 D2 D3 D5
*/
static void unselect_rows(void)
{
// Hi-Z(DDR:0, PORT:0) to unselect
DDRB &= ~0b11111111;
PORTB &= ~0b11111111;
DDRD &= ~0b00000001;
PORTD &= ~0b00000001;
}
static void select_row(uint8_t row)
{
// Output low(DDR:1, PORT:0) to select
switch (row) {
case 0:
DDRB |= (1<<0);
PORTB &= ~(1<<0);
break;
case 1:
DDRB |= (1<<1);
PORTB &= ~(1<<1);
break;
case 2:
DDRB |= (1<<2);
PORTB &= ~(1<<2);
break;
case 3:
DDRB |= (1<<3);
PORTB &= ~(1<<3);
break;
case 4:
DDRB |= (1<<4);
PORTB &= ~(1<<4);
break;
case 5:
DDRB |= (1<<5);
PORTB &= ~(1<<5);
break;
case 6:
DDRB |= (1<<6);
PORTB &= ~(1<<6);
break;
case 7:
DDRB |= (1<<7);
PORTB &= ~(1<<7);
break;
case 8:
DDRD |= (1<<0);
PORTD &= ~(1<<0);
break;
}
}
void led_set(uint8_t usb_led)
{
if (usb_led & (1<<USB_LED_CAPS_LOCK)) {
// output low
DDRD |= (1<<6);
PORTD &= ~(1<<6);
} else {
// Hi-Z
DDRD &= ~(1<<6);
PORTD &= ~(1<<6);
}
}
#define KEYMAP( \
K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, \
K10, K11, K12, K13, K15, K16, K17, K18, K19, K1A, \
K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, \
K30, K31, K32, K34, K35, K36, K37, K38, K39, K3A, \
K40, K41, K42, K43, K44, K45, K46, K47, K49, K4A, \
K5B, K5C, \
K60, K61, K62, K63, K64, K65, K66, K67, K68, \
K70, K71, K72, K73, K74, K75, K76, K77, K78, \
K80, K81, K82, K83, K84, K85, K86, K87, K88, K89\
) { \
{ KC_##K00, KC_##K01, KC_##K02, KC_##K03, KC_##K04, KC_##K05, KC_##K06, KC_##K07, KC_##K08, KC_##K09, KC_##K0A }, \
{ KC_##K10, KC_##K11, KC_##K12, KC_##K13, KC_NO , KC_##K15, KC_##K16, KC_##K17, KC_##K18, KC_##K19, KC_##K1A }, \
{ KC_##K20, KC_##K21, KC_##K22, KC_##K23, KC_##K24, KC_##K25, KC_##K26, KC_##K27, KC_##K28, KC_##K29, KC_##K2A }, \
{ KC_##K30, KC_##K31, KC_##K32, KC_NO , KC_##K34, KC_##K35, KC_##K36, KC_##K37, KC_##K38, KC_##K39, KC_##K3A }, \
{ KC_##K40, KC_##K41, KC_##K42, KC_##K43, KC_##K44, KC_##K45, KC_##K46, KC_##K47, KC_NO , KC_##K49, KC_##K4A }, \
{ KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_##5B , KC_5C }, \
{ KC_##K60, KC_##K61, KC_##K62, KC_##K63, KC_##K64, KC_##K65, KC_##K66, KC_##K67, KC_##K68 }, \
{ KC_##K70, KC_##K71, KC_##K72, KC_##K73, KC_##K74, KC_##K75, KC_##K76, KC_##K77, KC_##K78 }, \
{ KC_##K80, KC_##K81, KC_##K82, KC_##K83, KC_##K84, KC_##K85, KC_##K86, KC_##K87, KC_##K88, KC_##K89 }, \
}
const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
/* 0: qwerty */
KEYMAP(KC_0, KC_EQL, KC_MINS, KC_GRV, KC_BSPC, KC_F1, KC_F2, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, \
KC_O, KC_P, KC_LBRC, KC_RBRC, KC_LGUI, KC_LALT, KC_7, KC_8, KC_9, KC_PMNS, \
KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_UP, KC_DOWN, KC_P4, KC_P5, KC_P6, KC_COMM, \
KC_COMM, KC_DOT, KC_SLSH, KC_BSLS, KC_LEFT, KC_RGHT, KC_P1, KC_P2, KC_P3, KC_PENT, KC_ENT, \
KC_M, KC_N, KC_B, KC_V, KC_C, KC_X, KC_Z, KC_SPC, KC_P0, KC_PDOT, \
KC_LSFT, KC_LCTL, \
KC_J, KC_H, KC_G, KC_F, KC_D, KC_S, KC_A, KC_CAPS, KC_DEL, \
KC_I, KC_U, KC_Y, KC_T, KC_R, KC_E, KC_W, KC_Q, KC_TAB, \
KC_9, KC_8, KC_7, KC_6, KC_5, KC_4, KC_3, KC_2, KC_1, KC_ESC),
};
const uint16_t PROGMEM fn_actions[] = {
};
-------- begin --------
sh: 1: avr-gcc: not found
make: *** [gccversion] Error 127
And it creates a dir named obj_gh60_lufa instead of a hex file
mkdir -p obj_gh60_lufa
Compiling C: keymap_poker.c
avr-gcc -c -mmcu=at90usb1287 -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 -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
keymap_poker.c:1:5: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘:’ token
In file included from /usr/lib/gcc/avr/4.7.2/include/stdint.h:3:0,
from keymap_common.h:20,
from keymap_poker.c:2:
/usr/lib/gcc/avr/4.7.2/../../../avr/include/stdint.h:159:1: error: unknown type name ‘int8_t’
/usr/lib/gcc/avr/4.7.2/../../../avr/include/stdint.h:213:1: error: unknown type name ‘int8_t’
In file included from keymap_common.h:26:0,
from keymap_poker.c:2:
../../common/report.h:141:5: error: unknown type name ‘int8_t’
../../common/report.h:142:5: error: unknown type name ‘int8_t’
../../common/report.h:143:5: error: unknown type name ‘int8_t’
../../common/report.h:144:5: error: unknown type name ‘int8_t’
In file included from keymap_common.h:28:0,
from keymap_poker.c:2:
../../common/print.h:75:25: error: unknown type name ‘int8_t’
In file included from keymap_poker.c:2:0:
keymap_common.h:49:53: warning: backslash and newline separated by space [enabled by default]
keymap_poker.c:14:72: error: macro "KEYMAP" passed 84 arguments, but takes just 82
keymap_poker.c:6:5: error: ‘KEYMAP’ undeclared here (not in a function)
make: *** [obj_gh60_lufa/keymap_poker.o] Error 1
Thanks for that! Got the compiler, it now compiles.
but...Code: [Select]mkdir -p obj_gh60_lufa
Compiling C: keymap_poker.c
avr-gcc -c -mmcu=at90usb1287 -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 -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
keymap_poker.c:1:5: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘:’ token
In file included from /usr/lib/gcc/avr/4.7.2/include/stdint.h:3:0,
from keymap_common.h:20,
from keymap_poker.c:2:
/usr/lib/gcc/avr/4.7.2/../../../avr/include/stdint.h:159:1: error: unknown type name ‘int8_t’
/usr/lib/gcc/avr/4.7.2/../../../avr/include/stdint.h:213:1: error: unknown type name ‘int8_t’
In file included from keymap_common.h:26:0,
from keymap_poker.c:2:
../../common/report.h:141:5: error: unknown type name ‘int8_t’
../../common/report.h:142:5: error: unknown type name ‘int8_t’
../../common/report.h:143:5: error: unknown type name ‘int8_t’
../../common/report.h:144:5: error: unknown type name ‘int8_t’
In file included from keymap_common.h:28:0,
from keymap_poker.c:2:
../../common/print.h:75:25: error: unknown type name ‘int8_t’
In file included from keymap_poker.c:2:0:
keymap_common.h:49:53: warning: backslash and newline separated by space [enabled by default]
keymap_poker.c:14:72: error: macro "KEYMAP" passed 84 arguments, but takes just 82
keymap_poker.c:6:5: error: ‘KEYMAP’ undeclared here (not in a function)
make: *** [obj_gh60_lufa/keymap_poker.o] Error 1
I don't know how to debug this unfortunately, I'm not a programmer. What does it mean?
• Baud rate 115,200
• 8 bits
• No Parity
• 1 stop bit
• Hardware flow control enabled
/* USART configuration
* asynchronous, 115200baud, 8-data bit, non parity, 1-stop bit, no flow control
*/
#define SERIAL_UART_BAUD 115200
#define SERIAL_UART_DATA UDR1
#define SERIAL_UART_UBRR ((F_CPU/(16UL*SERIAL_UART_BAUD))-1)
#define SERIAL_UART_RXD_VECT USART1_RX_vect
#define SERIAL_UART_TXD_READY (UCSR1A&(1<<UDRE1))
#define SERIAL_UART_INIT() do { \
UBRR1L = (uint8_t) SERIAL_UART_UBRR; /* baud rate */ \
UBRR1H = (uint8_t) (SERIAL_UART_UBRR>>8); /* baud rate */ \
UCSR1B = (1<<TXEN1); /* TX: enable */ \
UCSR1C = (0<<UPM11) | (0<<UPM10) | /* parity: none(00), even(01), odd(11) */ \
(0<<UCSZ12) | (1<<UCSZ11) | (1<<UCSZ10); /* data-8bit(011) */ \
sei(); \
} while(0)
I know that this UART code will work http://www.pjrc.com/teensy/uart.html, but I am not sure how to use Hasu's files.
ACTION_FUNCTION_TAP(CUSTOM_LAYER_TAP_TOGGLE),
case CUSTOM_LAYER_TAP_TOGGLE:
xprintf("\n\ntap.count: %d", record->tap.count);
xprintf("\n\nevent.pressed: %d", record->event.pressed);
if (record->tap.count > 0) {
if (record->event.pressed) {
print("\nlayer_invert");
layer_invert(1);
}
} else {
if (record->event.pressed) {
print("\nlayer_on");
layer_on(1);
} else {
print("\nlayer_off");
layer_off(1);
}
}
break;
ACTION_FUNCTION_TAP(CUSTOM_LAYER_TAP_TOGGLE, 1),
ACTION_FUNCTION_TAP(CUSTOM_LAYER_TAP_TOGGLE, 2),
case CUSTOM_LAYER_TAP_TOGGLE_1:
my_custom_function(1, record);
break;
case CUSTOM_LAYER_TAP_TOGGLE_2:
my_custom_function(2, record);
break;
Hello,
I'm looking for a way to control num lock state from tmk firmware. In detail I want some kind of action function to enable / disable num lock state. Something like.... "if I press 'k' switch to layer 4 and activate num lock".
Any idea?
I believe according to the USB HID protocol the numlock state is controlled by the computer OS. The keyboard just says "Hey I want to toggle numlock" and the computer then replies with if it is enabled or not. For instance I can run a command line program that changed the numlock state (and turns on/off the led) without physically pressing that button. It is the same deal with capslock and is why pressing the capslock key on my external keyboard turns on the led on my laptop (since the OS keeps them both synced together).
diff --git a/keymap_common.h b/keymap_common.h
index 3ad9b6a..1645eea 100644
--- a/keymap_common.h
+++ b/keymap_common.h
@@ -40,7 +40,7 @@ extern const uint16_t fn_actions[];
K10, K11, K12, K13, K14, K15, \
K20, K21, K22, K23, K24, K25, \
K30, K31, K32, K33, K34, K35, \
- K40, K41, K42, K43, K44, K45, \
+ K40, K41, K42, K43, K44, K45 \
) \
{ \
{ KC_##K00, KC_##K01, KC_##K02, KC_##K03, KC_##K04, KC_##K05}, \
diff --git a/keymap_poker.c b/keymap_poker.c
index 9c2e8ab..4a28c8e 100644
--- a/keymap_poker.c
+++ b/keymap_poker.c
@@ -7,7 +7,7 @@ const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
LCTL,Z, X, C, V, B, \
LALT,PAUS,CAPS, FN0, FN1, SPC),
KEYMAP(ESC, F1, F2, F3, F4, F5, \
- TRNS,TRNS, UP, TRNS,VOLU,PGUP. \
+ TRNS,TRNS, UP, TRNS,VOLU,PGUP, \
TRNS,LEFT,DOWN,RGHT,VOLD,PGDN, \
TRNS,TRNS, TRNS,TRNS,MUTE,DEL, \
TRNS,LGUI,TRNS,TRNS,TRNS,TRNS),
diff --git a/matrix.c b/matrix.c
index 50ef81e..927ef9a 100644
--- a/matrix.c
+++ b/matrix.c
@@ -154,7 +154,7 @@ static matrix_row_t read_cols(void)
(PINF&(1<<5) ? 0 : (1<<2)) |
(PINF&(1<<4) ? 0 : (1<<3)) |
(PINF&(1<<1) ? 0 : (1<<4)) |
- (PINF&(1<<0) ? 0 : (1<<5)) |
+ (PINF&(1<<0) ? 0 : (1<<5));
}
Certainly C is not the easiest lang but I'm pretty sure it is the first lang you should learn when you want to play with MCU(microcontroller unit) like AVR or Cortex. I think difficulty of learning C is that you need to know underlying hardware to some extent, while high-level lang like Python offers far better abstraction layer of underlying system and you can forget hardware. But device with MCU like keyboard is very small system comprised of few of simple peripherals and relatively comprehesible unlike huge modern computer system PC.
So I'd say, C on MCU is not so hard as on PC. Good luck!
I'm never a computer language savvy, just my humble opinion.
OK. I'm gonna dive in to the TMK firmware because I feel that it's time to do this already.
So... assuming I only use Windows 8 for spreadsheet and gaming, what do I have to do to get started with this?
OK. I'm gonna dive in to the TMK firmware because I feel that it's time to do this already.
So... assuming I only use Windows 8 for spreadsheet and gaming, what do I have to do to get started with this?
Start with this: http://deskthority.net/workshop-f7/how-to-build-your-very-own-keyboard-firmware-t7177.html
Thank you so much. That worked and i realize where i messed up at. Now this is built and working after only 8 hours.
edit: it seems the top key on each row activates the entire row. hmm not sure whats going on there guess its time to look over my code and wiring againShow Image(http://i.imgur.com/a4ShboTh.jpg)
A question about TMK firmware. Is it possible to remap ctrl+x to alt+x? The closest thing I've found is key action, which could assign strokes of modifiers and a key to one key. But what I want is assign strokes of a modifier and a key to strokes of another modifier and a key.
I really wish i could figure out how to do makefiles again since although i was able to compile my first keyboard i had problems compiling on my desktop but was able to do it on my laptop as i recall however now i cant seem to get either to work
WinAVR seems to have troubles with some later versions of windows. Google knows its solution.I really wish i could figure out how to do makefiles again since although i was able to compile my first keyboard i had problems compiling on my desktop but was able to do it on my laptop as i recall however now i cant seem to get either to work
MHV has no shell for some reason so you have to install shell with cygwin or msys/mingw. TMK needs shell to build firmware, I'd change Makefile to build without shell some future but it needs at this time.after hours of trying to get it to work on windows 8.1 and windows 7 i tired xp and installed winavr worked first try and my code worked first try lol
I think following setup will work on Windows, at least for me on Windows 7 64bit.
1. Install one of toolchains like WinAVR, MHV AVR Tools or Atmel AVR ToolChain
2. Install Cygwin or MSYS
3. Setup shell with path of toolchain
the dll fix didn't work for me i have tried it and i tried it again with the one from that site and still nothing
the dll fix didn't work for me i have tried it and i tried it again with the one from that site and still nothing
from your quoted command output....
make -f makefile
that is not the correct usage of the makefile... to compile the gh60 firmware you need to type..
for gh60
make KEYMAP=poker
or
make KEYMAP=plain
etc etc...
please see the readme.md from here
https://github.com/tmk/tmk_keyboard/tree/master/keyboard/gh60
the gh60 make usage is different from say the phantom
https://github.com/tmk/tmk_keyboard/tree/master/keyboard/phantom
for phantom
make -f Makefile.pjrc or make -f Makefile.lufa
are you opening a administrator cmd prompt? make clean?
sorry I know that I had this same issue and i thought it was because the makefile needed a keymap specified. when I get home I will look at my batch files I setup and post again with what I have in them.
no idea bro... here is what I have for my gh60_build.batYes I'm testing on the unedited files from a few of the keyboards and yes i replaced the dll in that folder even though i think my version should have the fixed dll with it based on the site you posted.
make clean
make KEYMAP=poker
edit:
Are you compiling the files without modification first to verify your build environment? try compiling the default gh60 files without editing them with the command above.
and did you overwrite the existing msys-1.0.dll in the utils\bin subdirectory of your WinAVR directory?
I also like the idea of using a bat file to run it lol
I also like the idea of using a bat file to run it lol
My batch file also has git sync and some other stuffs. :D
So I'm trying to run my Apple M0110 with the specified firmware and this is really confusing me.
I run:
make clean
make KEYMAP=hasu
then I program the resulting m0110_lufa.hex file to the teensy using the teensy loader app, then reboot the teensy. My understanding is that at this point it should function, but it doesn't.
Is it just an issue with my soldering, or did I miss something?
So I'm trying to run my Apple M0110 with the specified firmware and this is really confusing me.
I run:
make clean
make KEYMAP=hasu
then I program the resulting m0110_lufa.hex file to the teensy using the teensy loader app, then reboot the teensy. My understanding is that at this point it should function, but it doesn't.
Is it just an issue with my soldering, or did I miss something?
did you follow this?
https://github.com/tmk/tmk_keyboard/blob/master/converter/m0110_usb/README.md
So I'm trying to run my Apple M0110 with the specified firmware and this is really confusing me.
I run:
make clean
make KEYMAP=hasu
then I program the resulting m0110_lufa.hex file to the teensy using the teensy loader app, then reboot the teensy. My understanding is that at this point it should function, but it doesn't.
Is it just an issue with my soldering, or did I miss something?
There's a layout maker for the M0110 in the OP. Easy as pie, and outputs firmware.
If trying to do it yourself, can it be lufa? If it's a teensy, doesn't it need to be the pjrc make?
So I'm trying to run my Apple M0110 with the specified firmware and this is really confusing me.
I run:
make clean
make KEYMAP=hasu
then I program the resulting m0110_lufa.hex file to the teensy using the teensy loader app, then reboot the teensy. My understanding is that at this point it should function, but it doesn't.
Is it just an issue with my soldering, or did I miss something?
I remember my coverter worked several months ago at least.
Wrong connection or soldering can cause your problem. If you are not sure post clear detailed photos as possible in M0110 converter thread so that I and other people can check out.
http://geekhack.org/index.php?topic=24965.0
There's a layout maker for the M0110 in the OP. Easy as pie, and outputs firmware.
If trying to do it yourself, can it be lufa? If it's a teensy, doesn't it need to be the pjrc make?
That would make sense. I redid the firmware building process using the pjrc makefile. Still doesn't seem to work when I program it and reboot it, so I think it must be a soldering issue.
You built with option EXTRAKEY_ENABLE? To use audio and system control keys you need this build option.
What's your OS? Some os doesnt recognize some key codes. And where is regack's code repository?
How do you convert the firmware into a hex file that can be uploaded to the teensy?
How do you convert the firmware into a hex file that can be uploaded to the teensy?
you have to "compile" the sourcecode.
How do you convert the firmware into a hex file that can be uploaded to the teensy?
How do you convert the firmware into a hex file that can be uploaded to the teensy?
https://github.com/tmk/tmk_keyboard/blob/master/doc/build.md
...I'd like ESC on the default layer and I'd like to avoid using 2 modifiers for one character.
abjr, you can write your own 'Function Action' for that ESC behaviour. But documentation is very sparse and you will need to look into source codes. If you want to try start with seeing keyboard/hhkb/keymap_hasu.c which has a sample 'Function'.
https://github.com/tmk/tmk_keyboard/blob/master/doc/keymap.md#24-function-action
Exactly what microcontrollers will this work with? Earlier I read that it would only work with AVRs with built-in USB, but the previous thread about this firmware mentioned ATMega328 with v-usb. Would that work? How about a Mega2560?
/* Column pin configuration
* col: 0 1 2 3 4 5 6 7 8 9 10 11 12 13
* pin: F0 F1 E6 C7 C6 B6 D4 B1 B0 B5 B4 D7 D6 B3 (Rev.A)
* pin: B7 (Rev.B)
*/
static void init_cols(void)
{
// Input with pull-up(DDR:0, PORT:1)
DDRF &= ~(1<<7 | 1<<6 | 1<<5 | 1<<4 | 1<<1 | 1<<0);
PORTF |= (1<<7 | 1<<6 | 1<<5 | 1<<4 | 1<<1 | 1<<0);
DDRD &= ~(1<<7 | 1<<5 | 1<<4 | 1<<3);
PORTD |= (1<<7 | 1<<5 | 1<<4 | 1<<3);
DDRC &= ~(1<<6);
PORTC |= (1<<6);
DDRB &= ~(1<<6 | 1<< 5 | 1<<4);
PORTB |= (1<<6 | 1<< 5 | 1<<4);
}
static matrix_row_t read_cols(void)
{
return (PINC&(1<<6) ? 0 : (1<<0)) |
(PIND&(1<<5) ? 0 : (1<<1)) |
(PIND&(1<<3) ? 0 : (1<<2)) |
(PIND&(1<<4) ? 0 : (1<<3)) |
(PIND&(1<<7) ? 0 : (1<<4)) |
(PINB&(1<<4) ? 0 : (1<<5)) |
(PINB&(1<<5) ? 0 : (1<<6)) |
(PINB&(1<<6) ? 0 : (1<<7)) |
(PINF&(1<<7) ? 0 : (1<<8 )) |
(PINF&(1<<6) ? 0 : (1<<9)) |
(PINF&(1<<5) ? 0 : (1<<10)) |
(PINF&(1<<4) ? 0 : (1<<11)) |
(PINF&(1<<1) ? 0 : (1<<12)) |
(PINF&(1<<0) ? 0 : (1<<13));
}
/* Row pin configuration
* row: 0 1 2 3 4
* pin: D0 D1 D2 D3 D5
*/
static void unselect_rows(void)
{
// Hi-Z(DDR:0, PORT:0) to unselect
DDRD &= ~0b00000111;
PORTD &= ~0b00000111;
DDRB &= ~0b00000011;
PORTB &= ~0b00000011;
}
static void select_row(uint8_t row)
{
// Output low(DDR:1, PORT:0) to select
switch (row) {
case 0:
DDRD |= (1<<2);
PORTD &= ~(1<<2);
break;
case 1:
DDRD |= (1<<1);
PORTD &= ~(1<<1);
break;
case 2:
DDRD |= (1<<0);
PORTD &= ~(1<<0);
break;
case 3:
DDRB |= (1<<0);
PORTB &= ~(1<<0);
break;
case 4:
DDRB |= (1<<1);
PORTB &= ~(1<<1);
break;
}
}
#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, \
LCTL,A, S, D, F, G, H, J, K, L, SCLN,QUOT, ENT, \
LSFT,Z, X, C, V, B, N, M, COMM,DOT, SLSH, RSFT, \
LGUI,LALT, SPC, FN0, SPC, PAUS, FN1),
/* 1: FN 1 */
KEYMAP(
ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, DEL, \
TRNS,TRNS, UP, TRNS,TRNS,TRNS,TRNS,VOLU,VOLD,TRNS,PSCR,TRNS,INS,TRNS, \
TRNS,LEFT,DOWN,RGHT,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, TRNS, TRNS, \
TRNS,TRNS, TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, TRNS, \
CAPS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS),
/* 2: FN 2 */
KEYMAP(
ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, DEL, \
TRNS,TRNS, UP, TRNS,TRNS,TRNS,TRNS,VOLU,VOLD,TRNS,PSCR,TRNS,INS,TRNS, \
TRNS,LEFT,DOWN,RGHT,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, TRNS, TRNS, \
TRNS,TRNS, TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, TRNS, \
CAPS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS),
};
const uint16_t PROGMEM fn_actions[] = {
/* Poker Layout */
= ACTION_LAYER_MOMENTARY(6), // to Fn overlay
[1] = ACTION_LAYER_TOGGLE(4), // toggle arrow overlay
};
#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, \
LCTL,A, S, D, F, G, H, J, K, L, SCLN,QUOT, ENT, \
LSFT,Z, X, C, V, B, N, M, COMM,DOT, SLSH, RSFT, \
LGUI,LALT, SPC, FN0, SPC, PAUS, FN1),
/* 1: FN 1 */
KEYMAP(
ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, DEL, \
TRNS,TRNS, UP, TRNS,TRNS,TRNS,TRNS,VOLU,VOLD,TRNS,PSCR,TRNS,INS,TRNS, \
TRNS,LEFT,DOWN,RGHT,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, TRNS, TRNS, \
TRNS,TRNS, TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, TRNS, \
CAPS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS),
/* 2: FN 2 */
KEYMAP(
ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, DEL, \
TRNS,TRNS, UP, TRNS,TRNS,TRNS,TRNS,VOLU,VOLD,TRNS,PSCR,TRNS,INS,TRNS, \
TRNS,LEFT,DOWN,RGHT,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, TRNS, TRNS, \
TRNS,TRNS, TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, TRNS, \
CAPS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS),
};
const uint16_t PROGMEM fn_actions[] = {
/* Poker Layout */
= ACTION_LAYER_MOMENTARY(6), // to Fn overlay
[1] = ACTION_LAYER_TOGGLE(4), // toggle arrow overlay
};
debug_enable = true;
debug_matrix = true;
When you want to use PF4-PF7 as IO ports you have to disable JTAG function. Check datasheet and these codes.
https://github.com/tmk/tmk_keyboard/search?utf8=%E2%9C%93&q=JTD&type=Code
And add thse lines at matrix_init() to enable matrix debug print. See if your matrix works as what you expect.Code: [Select]debug_enable = true;
debug_matrix = true;
void matrix_init(void)
{
MCUCR |= (1<<JTD);
MCUCR |= (1<<JTD);
debug_enable = true;
debug_matrix = true;
// initialize row and col
unselect_rows();
init_cols();
// initialize matrix state: all keys off
for (uint8_t i=0; i < MATRIX_ROWS; i++) {
matrix = 0;
matrix_debouncing = 0;
}
}
CONSOLE_ENABLE = yes # Console for debug
COMMAND_ENABLE = yes # Commands for debug and configuration
r/c 01234567
00: 00000000
01: 00000000
02: 00000000
03: 00000000
04: 00000000
05: 00000000
06: 00000000
07: 00000000
r/c 01234567
00: 00000000
01: 00000000
02: 00000000
03: 00000000
04: 00000100
05: 00000000
06: 00000000
07: 00000000
r/c 0123457
00: 00000000
01: 00000000
02: 00000000
03: 00000000
04: 00000000
05: 00000000
06: 00000000
07: 00000000
Datasheet of ATMega32U4 has explanation of how to disable JTAG function. (26.5.1)
http://www.atmel.com/Images/doc7766.pdf
In the end you need those two lines in matrix_init(), you did right. Now you can use Port F as normal IO ports.
And TMK FAQ has an entry about this.
https://github.com/tmk/tmk_keyboard/wiki/FAQ#using-pf4-7-pins-of-usb-avr
I guess you have problems on your matrix wiring, matrix code or keymap code, perhaps all of them. At first you have to see how your matrix works you can see debug print of matrix array with 'hid_listen' command.
Check your Makefile has these two lines and which are not commented out.Code: [Select]CONSOLE_ENABLE = yes # Console for debug
COMMAND_ENABLE = yes # Commands for debug and configuration
And run PJRC's 'hid_listen' command on your Windows command prompt, you wil see current status of matrix array. This will be helpful to debug you matrix wiring and code. (PJRC is manufacturer of Teensy board. you can download the command there. https://www.pjrc.com/)Code: [Select]r/c 01234567
00: 00000000
01: 00000000
02: 00000000
03: 00000000
04: 00000000
05: 00000000
06: 00000000
07: 00000000
r/c 01234567
00: 00000000
01: 00000000
02: 00000000
03: 00000000
04: 00000100
05: 00000000
06: 00000000
07: 00000000
r/c 0123457
00: 00000000
01: 00000000
02: 00000000
03: 00000000
04: 00000000
05: 00000000
06: 00000000
07: 00000000
yes, this is right place.
Try this and give me feedback.
https://github.com/tmk/tmk_keyboard/commit/821c719e98f310938e2bb3f2ad3e6a726bd8b03e
I think this is what you want probably.
https://github.com/tmk/tmk_keyboard/blob/action_fix/doc/keymap.md#35-momentary-switching-with-modifiers
The feature works, but unfortunately it behaves like CTRL is pressed permamently once I press it. There doesn't seem to be a way to undo it when it gets that way either. I understand that there's a chance that this is because I slapped your code into cub's branch, but if you think it might actually be another issue please let me know. I'm going to investigate a bit on my own for now.It looks like modifier stuck problem. Do you place an action to unregister the CTRL on destination layer?
Hello, I see TMK Has support for Bpiphany's Kitten Paw, Could anyone convert or help me convert it so it works with the Ghost Squid aswell?
Kitten Paw FW: https://github.com/tmk/tmk_keyboard/tree/master/keyboard/kitten_paw
Schematics: http://deskthority.net/w/images/1/1b/Costar_Replacement_Controllers_Schematics.PNG
I'm clueless to where to start and I would really love using TMK on my QuickFire XT.
Thanks.
Hello, I see TMK Has support for Bpiphany's Kitten Paw, Could anyone convert or help me convert it so it works with the Ghost Squid aswell?
Kitten Paw FW: https://github.com/tmk/tmk_keyboard/tree/master/keyboard/kitten_paw
Schematics: http://deskthority.net/w/images/1/1b/Costar_Replacement_Controllers_Schematics.PNG
I'm clueless to where to start and I would really love using TMK on my QuickFire XT.
Thanks.
Hello, I see TMK Has support for Bpiphany's Kitten Paw, Could anyone convert or help me convert it so it works with the Ghost Squid aswell?
Kitten Paw FW: https://github.com/tmk/tmk_keyboard/tree/master/keyboard/kitten_paw
Schematics: http://deskthority.net/w/images/1/1b/Costar_Replacement_Controllers_Schematics.PNG
I'm clueless to where to start and I would really love using TMK on my QuickFire XT.
Thanks.
If I remember right then all costar boards share the same matrix. The controllers only differ in row/column selection. Which firmware are you currently using on your controller (link)? And what are your compile options?
For a quality tmk port you'll need the actual board and the controller to do the final testing.
Hello. We have the stock controller and the xt. Since we have not used the ghost squid yet we have no compile options. The compile options for the kitten paw should work in the port. As I see it the only thing that needs to be done is to correct the pinout.
Hello. We have the stock controller and the xt. Since we have not used the ghost squid yet we have no compile options. The compile options for the kitten paw should work in the port. As I see it the only thing that needs to be done is to correct the pinout.
Looks like it! The QuickFire XT seems to be a fullsize board like the filco. Doesn't bpiphany provide the firmware for the Ghost Squid controller?
I can't find the the controller "Ghost Squid" in bpiphany git repository that's why I'm asking which firmware bpiphany provides for these controllers.Wouldn't it be possible to port it just by looking at the pin difference in these schematics? http://deskthority.net/w/images/1/1b/Costar_Replacement_Controllers_Schematics.PNG
Edit: I can offer to port TMK firmware to the "Ghost Squid" controller for free if someone will send me the board with a ghost squid controller for the time of porting.
Wouldn't it be possible to port it just by looking at the pin difference in these schematics? http://deskthority.net/w/images/1/1b/Costar_Replacement_Controllers_Schematics.PNG
If not, and you need the controller for the job i would gladly send mine to you, but that kinda depends on where you are located at. I don't want to pay too much for shipping it back and forth.
Another option would be to try and help me port it because I have the controller.
Is this firmware compatible with the new Duck Eagle (or Viper)? It's a 60% and doesn't have all the same keys as the Lightsaber/Lightsaver, so I'm assuming the default configuration won't work for it at the very least.
#include "keymap_common.h"
const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
/* 0: qwerty */
KEYMAP_ANSI(
ESC, 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, FN1, \
LCTL,LGUI,LALT, SPC, FN2, RGUI,APP, RCTL),
/* 1: FN1 */
KEYMAP_ANSI(
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,UP, FN1, \
TRNS,TRNS,TRNS, TRNS, TRNS,LEFT,DOWN,RGHT),
/* 2: FN2 */
KEYMAP_ANSI(
GRV, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, DEL, \
TRNS,TRNS,VOLU,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, \
TRNS,TRNS,VOLD,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),
};
const uint16_t PROGMEM fn_actions[] = {
[1] = ACTION_LAYER_TOGGLE(1)
[2] = ACTION_LAYER_TOGGLE(2)
};
/* 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, K3E, \
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, K3D, K3E, \
K40, K41, K42, K45, NO, K4A, K4B, K4C, K4D \
)
#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, K2D, \
K30, K31, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K3C, K3D, \
K40, K41, K42, K45, 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_##K2D }, \
{ 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_NO, KC_NO, KC_##K45, KC_NO, KC_NO, KC_NO, KC_##K49, KC_##K4A, KC_##K4B, KC_##K4C, KC_##K4D } \
}
Hmm, I'm not sure what you are doing.
what is your keyobard actually?
which code are you working on, your own or existent project?
I might have miss out something when checking the keycode.c file, but cant seems to the keycode for pipe ( | ). Using it alot for work, had to keep on alternating with laptop keyboard. Anyone know the keycode for pipe?
I might have miss out something when checking the keycode.c file, but cant seems to the keycode for pipe ( | ). Using it alot for work, had to keep on alternating with laptop keyboard. Anyone know the keycode for pipe?
Well I'm not sure if you can make a single key pipe but the code for the backslash (\) key which is pipe when you hit shift is BSLS
I read on another build log that columns/rows greater than 16 in number are hard to implement on your firmware, is this true? I will likely have about 20 columns and 5 rows on my teensy ++ but would like to use your firmware.
Searched about it, didn't find anything: is it possible in TMK to assign to a key the CEDILLA ( Ç )?
/*
* Macro definition
*/
enum macro_id {
CEDILLA,
};
const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
{
keyevent_t event = record->event;
//uint8_t tap_count = record->tap_count;
switch (id) {
case CEDILLA:
return (event.pressed ?
MACRO( T(QUOT), W(100), T(C), END ) :
MACRO( END ) );
}
return MACRO_NONE;
}
const uint16_t PROGMEM fn_actions[] = {
[0] = ACTION_MACRO(CEDILLA),
};
GRV common/avr/eeconfig.c | 2 +-
common/command.c | 5 ++++
common/eeconfig.h | 58 ++++++++++++++++++++++++++++++++++++++++++
keyboard/phantom/Makefile.lufa | 16 +++++++++---
4 files changed, 77 insertions(+), 4 deletions(-)
diff --git a/common/avr/eeconfig.c b/common/avr/eeconfig.c
index 5bd47dc..8c8bbca 100644
--- a/common/avr/eeconfig.c
+++ b/common/avr/eeconfig.c
@@ -8,7 +8,7 @@ void eeconfig_init(void)
eeprom_write_word(EECONFIG_MAGIC, EECONFIG_MAGIC_NUMBER);
eeprom_write_byte(EECONFIG_DEBUG, 0);
eeprom_write_byte(EECONFIG_DEFAULT_LAYER, 0);
- eeprom_write_byte(EECONFIG_KEYMAP, 0);
+ eeprom_write_byte(EECONFIG_KEYMAP, EECONFIG_KEYMAP_DEFAULTS);
eeprom_write_byte(EECONFIG_MOUSEKEY_ACCEL, 0);
#ifdef BACKLIGHT_ENABLE
eeprom_write_byte(EECONFIG_BACKLIGHT, 0);
diff --git a/common/command.c b/common/command.c
index 1a507e3..6ab844e 100644
--- a/common/command.c
+++ b/common/command.c
@@ -125,6 +125,7 @@ static void command_common_help(void)
print("t: print timer count\n");
print("s: print status\n");
print("e: print eeprom config\n");
+ print("w: write eeprom config\n");
#ifdef NKRO_ENABLE
print("n: toggle NKRO\n");
#endif
@@ -191,6 +192,10 @@ static bool command_common(uint8_t code)
print_eeconfig();
break;
#endif
+ case KC_W:
+ eeconfig_init();
+ print("eeprom written\n");
+ break;
case KC_CAPSLOCK:
if (host_get_driver()) {
host_driver = host_get_driver();
diff --git a/common/eeconfig.h b/common/eeconfig.h
index 3cd1a17..41aa88b 100644
--- a/common/eeconfig.h
+++ b/common/eeconfig.h
@@ -49,6 +49,64 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define EECONFIG_KEYMAP_SWAP_BACKSLASH_BACKSPACE (1<<6)
#define EECONFIG_KEYMAP_NKRO (1<<7)
+/* keyconf bit defaults */
+#ifdef SWAP_CONTROL_CAPSLOCK
+#define SWAP_CONTROL_CAPSLOCK_DEFAULT EECONFIG_KEYMAP_SWAP_CONTROL_CAPSLOCK
+#else
+#define SWAP_CONTROL_CAPSLOCK_DEFAULT 0
+#endif
+
+#ifdef CAPSLOCK_TO_CONTROL
+#define CAPSLOCK_TO_CONTROL_DEFAULT EECONFIG_KEYMAP_CAPSLOCK_TO_CONTROL
+#else
+#define CAPSLOCK_TO_CONTROL_DEFAULT 0
+#endif
+
+#ifdef SWAP_LALT_LGUI
+#define SWAP_LALT_LGUI_DEFAULT EECONFIG_KEYMAP_SWAP_LALT_LGUI
+#else
+#define SWAP_LALT_LGUI_DEFAULT 0
+#endif
+
+#ifdef SWAP_RALT_RGUI
+#define SWAP_RALT_RGUI_DEFAULT EECONFIG_KEYMAP_SWAP_RALT_RGUI
+#else
+#define SWAP_RALT_RGUI_DEFAULT 0
+#endif
+
+#ifdef NO_GUI
+#define NO_GUI_DEFAULT EECONFIG_KEYMAP_NO_GUI
+#else
+#define NO_GUI_DEFAULT 0
+#endif
+
+#ifdef SWAP_GRAVE_ESC
+#define SWAP_GRAVE_ESC_DEFAULT EECONFIG_KEYMAP_SWAP_GRAVE_ESC
+#else
+#define SWAP_GRAVE_ESC_DEFAULT 0
+#endif
+
+#ifdef SWAP_BACKSLASH_BACKSPACE
+#define SWAP_BACKSLASH_BACKSPACE_DEFAULT EECONFIG_KEYMAP_SWAP_BACKSLASH_BACKSPACE
+#else
+#define SWAP_BACKSLASH_BACKSPACE_DEFAULT 0
+#endif
+
+#ifdef NKRO_ENABLE
+#define NKRO_ENABLE_DEFAULT EECONFIG_KEYMAP_NKRO
+#else
+#define NKRO_ENABLE_DEFAULT 0
+#endif
+
+#define EECONFIG_KEYMAP_DEFAULTS \
+ SWAP_CONTROL_CAPSLOCK_DEFAULT | \
+ CAPSLOCK_TO_CONTROL_DEFAULT | \
+ SWAP_LALT_LGUI_DEFAULT | \
+ SWAP_RALT_RGUI_DEFAULT | \
+ NO_GUI_DEFAULT | \
+ SWAP_GRAVE_ESC_DEFAULT | \
+ SWAP_BACKSLASH_BACKSPACE_DEFAULT | \
+ NKRO_ENABLE_DEFAULT
bool eeconfig_is_enabled(void);
diff --git a/keyboard/phantom/Makefile.lufa b/keyboard/phantom/Makefile.lufa
index 97756de..d77eb8d 100644
--- a/keyboard/phantom/Makefile.lufa
+++ b/keyboard/phantom/Makefile.lufa
@@ -101,10 +101,20 @@ 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
+COMMAND_ENABLE = yes # Commands for debug and configuration
+#SLEEP_LED_ENABLE = yes # Breathing sleep LED during USB suspend
+#
+# keyconf bit defaults
+#
+#SWAP_CONTROL_CAPSLOCK = yes
+#CAPSLOCK_TO_CONTROL = yes
+#SWAP_LALT_LGUI = yes
+#SWAP_RALT_RGUI = yes
+#NO_GUI = yes
+#SWAP_GRAVE_ESC = yes
+#SWAP_BACKSLASH_BACKSPACE = yes
+NKRO_ENABLE = yes # USB Nkey Rollover - supported ONLY in LUFA
# Boot Section Size in bytes
# Teensy halfKay 512
I added initial support for Masdrop Infinity which based on mbed(cortex-M) and is not full fucinton yet; mouse keys, media keys, NKRO and etc.
https://github.com/tmk/tmk_keyboard/tree/master/keyboard/infinity
I don't think many users are around here yet, but if you have it try this.
I added initial support for Masdrop Infinity which based on mbed(cortex-M) and is not full fucinton yet; mouse keys, media keys, NKRO and etc.
https://github.com/tmk/tmk_keyboard/tree/master/keyboard/infinity
I don't think many users are around here yet, but if you have it try this.
When I press LShift+RShift+B (I changed KC_PAUSE to KC_B in common/command.c file), keyboard stops to register any inputs for a few seconds, so I guess jump to bootloader is working.
When I press LShift+RShift+B (I changed KC_PAUSE to KC_B in common/command.c file), keyboard stops to register any inputs for a few seconds, so I guess jump to bootloader is working.
If you jump to bootloader by software keyboard stops registering key presses as long as you don't start application code again. If your keyboards just stops for a few seconds then you have to debug why and what is happening instead. If keyboard is at bootloader you'll see an Atmega device listed in your usb stack instead of a NerD TMK keyboard.
NerD 60 and 80 have ATMega32U4 controllers and were tested with Atmel DFU loader. All those details are in the Makefile. (This post was written with NerD 60 and tmk firmware)
@hasu, would you please merge my latest pull request for NerD project it fixes an important keymap issue.
ron@silence:~/Downloads/tmk_keyboard-master_20150125/keyboard/gh60$ make -f Makefile clean
ron@silence:~/Downloads/tmk_keyboard-master_20150125/keyboard/gh60$ make -f Makefile
...
Size after:
text data bss dec hex filename
23634 56 178 23868 5d3c gh60_lufa.elf
-------- end --------
ron@silence:~/Downloads/tmk_keyboard-master_20150125/keyboard/gh60$ make -f Makefile.pjrc clean
ron@silence:~/Downloads/tmk_keyboard-master_20150125/keyboard/gh60$ make -f Makefile.pjrc
...
../../protocol/pjrc/main.c: In function ‘main’:
../../protocol/pjrc/main.c:60:5: warning: implicit declaration of function ‘sleep_led_init’ [-Wimplicit-function-declaration]
sleep_led_init();
^
../../protocol/pjrc/main.c:64:13: error: too many arguments to function ‘suspend_power_down’
suspend_power_down(WDTO_120MS);
^
In file included from ../../protocol/pjrc/main.c:36:0:
../../common/suspend.h:9:6: note: declared here
void suspend_power_down(void);
^
make: *** [obj_gh60_pjrc/protocol/pjrc/main.o] Error 1
1) In tmk_keyboard/protocol/pjrc/main.c change suspend_power_down(WDTO_120MS); to suspend_power_down();
OR
2) In tmk_keyboard/common/suspend.h: change void suspend_power_down(void); to void suspend_power_down(uint8_t wdto);
In tmk_keyboard/common/avr/suspend.c rewrite the suspend_power_down() function to:
void suspend_power_down(uint8_t wdto)
{
power_down(wdto);
}
Can you please say what are values of your fuse and lock bits?
And can you explain how can I debug TMK software?
Quick question ... Does TMK/Teensy support 104-key?
samwisekoi and abjr,
Fixed the error in master branch with method #1.
Thanks for your reporting and fix.
Quick question ... Does TMK/Teensy support 104-key?
Technically yes, but the electrical layout is not going to match the physical row and column layout. There just is not enough pins. Though you should be able to use a Teensy 2.0++ version for extra pins and work just fine. For example a full size layout will be 22 columns and 6 rows which is 28 pins plus 4 for 3 lock LEDs. The standard Teensy does not have that many pins, but if you are creative with the electrical layout you can go 10x11 matrix for a total of 110 switches possible.
I'm messing with layers and I'm obtaining weird behaviour:
First things first: My keymap (https://github.com/vpont/tmk_keyboard/blob/master/keyboard/pegasus_hoof/keymap.h)
As you see I have three layers defined:
Layer 1 is activated by pressing Fn0
Layer 2 is activated by pressing Fn0 + RgtCtl
It works fine but i.e. when I press Fn0 + RgtCtl + Esc I get the calculator and then I release all three keys and press Esc again the calculator opens up again, when I should be back in Layer 0.
What's wrong?
Thanks!
Yeah, it happened to me as well.
If you release FN0 first, then RCTL, a key release for FN1 is never generated, because there is no FN1 in the first layer.
Yeah, it happened to me as well.
If you release FN0 first, then RCTL, a key release for FN1 is never generated, because there is no FN1 in the first layer.
Thanks for confirming, looks like we did hit a bug then, didn't we?
Shouldn't all keys that don't belong to a layer after layer change be released?
araif, I think it depneds on your hardware design. Doing a wild guess, maybe you need PWM?
another question is this, I have a trackpoint module that is connected to PD5 for clock and PD4 for data, I'm copying code from onekey and using busywait method, what I see is that the keyboard that is controlled from the same teensy lags really hard for various keys, they are recognized only if I fire multiple events holding a key, maybe the problem is the ps2 events from the mouse spamming the interrupts or something, I was trying also to use the ps2 interrupt version with no success, how can I fix this, is more info needed to debug this on your side? thanks
Send me your keyboard if you want me to debug :)
At first you have to find exactly where your problem are located on, you'll be able to use debug print of timer for this purpose.
/* Column pin configuration
* col: 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
* pin: F0 F1 F4 F5 F6 F7 B6 B5 B4 D7 B0 B1 B2 B3 B7
*/
/* Row pin configuration
* row: 0 1 2 3 4
* pin: D1 D0 D2 D3 C6
*/
#ifdef PS2_USE_BUSYWAIT
# define PS2_CLOCK_PORT PORTD
# define PS2_CLOCK_PIN PIND
# define PS2_CLOCK_DDR DDRD
# define PS2_CLOCK_BIT 5
# define PS2_DATA_PORT PORTD
# define PS2_DATA_PIN PIND
# define PS2_DATA_DDR DDRD
# define PS2_DATA_BIT 4
#endif
5680d ps2_mouse raw: [08|00 00]
5691d ps2_mouse raw: [08|00 00]
5703d ps2_mouse raw: [08|00 00]
5714d ps2_mouse raw: [08|00 00]
5725d ps2_mouse raw: [08|00 00]
5737d ps2_mouse raw: [08|0000]
5748d ps2_mouse raw: [08|00 00]
5760d ps2_mouse raw: [08|00 00]
I don't think it doesn't work with ps2_interrupt.c but I didn't try it myself.
You'll need to place proper interrupt configuration on PD5 with editting PS2_INT_INIT of config.h.
I use INT1 interrupt on PD1 while you are using PD5 which has different interrupt PCINT5, you need different intialized code for that.
I don't use PS/2 mouse or TrackPoint long time so I don't remmeber it is normal. You have to source code and see whether it is just a info message or error message.
Did you already see my PM?QuoteI don't think it doesn't work with ps2_interrupt.c but I didn't try it myself.
You'll need to place proper interrupt configuration on PD5 with editting PS2_INT_INIT of config.h.
I use INT1 interrupt on PD1 while you are using PD5 which has different interrupt PCINT5, you need different intialized code for that.
/* PS/2 mouse interrupt version */
#ifdef PS2_USE_INT
/* uses INT1 for clock line(ATMega32U4) */
#define PS2_CLOCK_PORT PORTD
#define PS2_CLOCK_PIN PIND
#define PS2_CLOCK_DDR DDRD
#define PS2_CLOCK_BIT 5
#define PS2_DATA_PORT PORTD
#define PS2_DATA_PIN PIND
#define PS2_DATA_DDR DDRD
#define PS2_DATA_BIT 4
#define PS2_INT_INIT() do { \
EICRA |= ((1<<ISC11) | \
(0<<ISC10)); \
} while (0)
#define PS2_INT_ON() do { \
EIMSK |= (1<<PCINT5); \
} while (0)
#define PS2_INT_OFF() do { \
EIMSK &= ~(1<<PCINT5); \
} while (0)
#define PS2_INT_VECT INT1_vect
#endif
5680d ps2_mouse raw: [08|00 00]
5691d ps2_mouse raw: [08|00 00]
5703d ps2_mouse raw: [08|00 00]
5714d ps2_mouse raw: [08|00 00]
5725d ps2_mouse raw: [08|00 00]
5737d ps2_mouse raw: [08|0000]
5748d ps2_mouse raw: [08|00 00]
5760d ps2_mouse raw: [08|00 00]
static void init_cols(void)
{
DDRF &= ~(1<<7 | 1<<6 | 1<<5 | 1<<4 | 1<<1 | 1<<0);
PORTF |= (1<<7 | 1<<6 | 1<<5 | 1<<4 | 1<<1 | 1<<0);
DDRB &= ~(1<<6 | 1<<5 | 1<<4);
PORTB |= (1<<6 | 1<<5 | 1<<4);
DDRD &= ~(1<<7 | 1<<3 | 1<<2);
PORTD |= (1<<7 | 1<<3 | 1<<2);
DDRC &= ~(1<<7 | 1<<6);
PORTC |= (1<<7 | 1<<6);
}
static matrix_row_t read_cols(void)
{
return (PINF&(1<<0) ? 0 : (1<<0)) |
(PINF&(1<<1) ? 0 : (1<<1)) |
(PINF&(1<<4) ? 0 : (1<<2)) |
(PINF&(1<<5) ? 0 : (1<<3)) |
(PINF&(1<<6) ? 0 : (1<<4)) |
(PINF&(1<<7) ? 0 : (1<<5)) |
(PINB&(1<<6) ? 0 : (1<<6)) |
(PINB&(1<<5) ? 0 : (1<<7)) |
(PINB&(1<<4) ? 0 : (1<<8)) |
(PIND&(1<<7) ? 0 : (1<<9)) |
(PIND&(1<<2) ? 0 : (1<<10)) |
(PIND&(1<<3) ? 0 : (1<<11)) |
(PINC&(1<<6) ? 0 : (1<<12)) |
(PINC&(1<<7) ? 0 : (1<<13));
}
static void unselect_rows(void)
{
DDRB &= ~0b10001111;
PORTB &= ~0b10001111;
}
static void select_row(uint8_t row)
{
switch (row) {
case 0:
DDRB |= (1<<0);
PORTB &= ~(1<<0);
break;
case 1:
DDRB |= (1<<1);
PORTB &= ~(1<<1);
break;
case 2:
DDRB |= (1<<2);
PORTB &= ~(1<<2);
break;
case 3:
DDRB |= (1<<3);
PORTB &= ~(1<<3);
break;
case 4:
DDRB |= (1<<7);
PORTB &= ~(1<<7);
break;
}
}
#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, K3D, \
K40, K41, K42, K46, K49, K4A, K4B, 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_NO, KC_##K3D }, \
{ KC_##K40, KC_##K41, KC_##K42, KC_NO, KC_NO, KC_NO, KC_##K46, KC_NO, KC_NO, KC_##K49, KC_##K4A, KC_##K4B, KC_NO, KC_##K4D } \
}
#include "keymap_common.h"
const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
/* 0: qwerty */
KEYMAP(ESC, 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,ENT, \
CAPS,A, S, D, F, G, H, J, K, L, SCLN,QUOT,BSLS, \
LSFT,Z, X, C, V, B, N, M, COMM,DOT, SLSH,RSFT,DEL, \
LCTL,LGUI,LALT, SPC, RALT,RGUI,APP, RCTL),
};
const uint16_t PROGMEM fn_actions[] = {};
Also changed the boot section size in the Makefile to match the Teensy halfKay (512 bytes).
Also changed the boot section size in the Makefile to match the Teensy halfKay (512 bytes).
In a quick "review" those code bits look fine to me.
I would start by leaving the boot section as it was, with the LUFA bootloader (OPT_DEFS += -DBOOTLOADER_SIZE=4096).
Finished soldering my keyboard yesterday, flashed the firmware on it today (Teensy2) with gh60 (before changing the matrix), it would fire random media keys at it's own will (calculator, browser, email, mute my sound etc).
After I changed the required parts in matrix.c it doesn't do anything at all.
I tried using PJRC's hid_listen, it finds the device but it doesn't print out anything at all.
Are there any other debug steps I could take, or could any of you help me? I'm on IRC (same username).
Im 100% illiterate when it comes to coding and I wondering how I could have pwm control for a single pin for leds. I also looked at the led.c file of multiple builds but can't figure out why some have "DDR", "PORT", "|". or "&" there are too many variations I don't understand.
I would like it to just be toggleable. Thanks in advance.
p3lim,
Ive never seen that message actually(is it on windows8?) but it just smells like very Windows driver cache problem. Just try another ports, removing driver of keyboard completely or using new VIDID pair.
Im 100% illiterate when it comes to coding and I wondering how I could have pwm control for a single pin for leds. I also looked at the led.c file of multiple builds but can't figure out why some have "DDR", "PORT", "|". or "&" there are too many variations I don't understand.
I would like it to just be toggleable. Thanks in advance.
Post your schematic to let us know how you connect the LEDs.
and forget PWM for a while, looks like you need to learn some things to use it. At first learn how you can turn on a LED solid.Im 100% illiterate when it comes to coding and I wondering how I could have pwm control for a single pin for leds. I also looked at the led.c file of multiple builds but can't figure out why some have "DDR", "PORT", "|". or "&" there are too many variations I don't understand.
I would like it to just be toggleable. Thanks in advance.
I don't know how you can control the 50ish LEDs with one PWM pin. You have idea or reference of design?
Quick question ... Does TMK/Teensy support 104-key?
Technically yes, but the electrical layout is not going to match the physical row and column layout. There just is not enough pins. Though you should be able to use a Teensy 2.0++ version for extra pins and work just fine. For example a full size layout will be 22 columns and 6 rows which is 28 pins plus 4 for 3 lock LEDs. The standard Teensy does not have that many pins, but if you are creative with the electrical layout you can go 10x11 matrix for a total of 110 switches possible.
ok, I've never handwired a board before so that's slightly intimidating, but I think I understand what you mean and feel like I can probably do it with a bit of stumbling.
So when I make the keymap for TMK, I will have to write it out as it is logically- and TMK will work with the 10x11 matrix. I imagine it will be a bit painful writing it out like that without getting confused, but that's ok.
I added initial support for Masdrop Infinity which based on mbed(cortex-M) and is not full fucinton yet; mouse keys, media keys, NKRO and etc.
https://github.com/tmk/tmk_keyboard/tree/master/keyboard/infinity
I don't think many users are around here yet, but if you have it try this.
Is it possible to add a repeating action as a function?
As an example: if key A is held, send the A key every 50ms.
make KEYMAP=redscarf VERBOSE=1
sudo make dfu
Is it possible to add a repeating action as a function?
As an example: if key A is held, send the A key every 50ms.
If he does add this functionality, I would recommend actually implementing it like this.
If a key is held for more than 500ms, then start repeating the key every 50ms (or whatever configurable value).
This will reduce the illusion of debounce if people don't press and release quickly. This is how most keyboards handle that...
I'm not much interested in developing gaming functions, but in assisting people having difficultiy with normal keyboard.
That said, OS repeating config seems to do fairly good job in both Mac and Windows.
Repeating in firmware will be a bit of a work with referencing timer. It is difficult or impossible to implement in keymap file at this time.Is it possible to add a repeating action as a function?
As an example: if key A is held, send the A key every 50ms.
If he does add this functionality, I would recommend actually implementing it like this.
If a key is held for more than 500ms, then start repeating the key every 50ms (or whatever configurable value).
This will reduce the illusion of debounce if people don't press and release quickly. This is how most keyboards handle that...
Is it possible to add a repeating action as a function?
As an example: if key A is held, send the A key every 50ms.
If he does add this functionality, I would recommend actually implementing it like this.
If a key is held for more than 500ms, then start repeating the key every 50ms (or whatever configurable value).
This will reduce the illusion of debounce if people don't press and release quickly. This is how most keyboards handle that...
I'll implement those functions for cortex controller finally in some point of future, but I don't know when.Ok, awesome. I'm going to try out the current firmware this week.
I'll implement those functions for cortex controller finally in some point of future, but I don't know when.Ok, awesome. I'm going to try out the current firmware this week.
admiralvorian,
build process seems to be OK. Did default keymap works for you?
You better do 'make clean' if you have trouble in built frimware.
https://github.com/tmk/tmk_keyboard/wiki/FAQ-Build#do-make-clean-before-make
Also check this if you are on windows
https://github.com/tmk/tmk_keyboard/wiki/FAQ-Build#edit-configuration-but-not-change
(And make sure your numlock status, note that '1' on pad may work as 'End'.)
admiralvorian,
build process seems to be OK. Did default keymap works for you?
You better do 'make clean' if you have trouble in built frimware.
https://github.com/tmk/tmk_keyboard/wiki/FAQ-Build#do-make-clean-before-make
Also check this if you are on windows
https://github.com/tmk/tmk_keyboard/wiki/FAQ-Build#edit-configuration-but-not-change
(And make sure your numlock status, note that '1' on pad may work as 'End'.)
Thank you hasu! I do 'make clean' between every compile, I'm doing this on ubuntu 14.04.1. I even removed the entire directory and re-cloned from github.
I will let you guys know if I find out what's happening.
#KEYMAP_IN_EEPROM_ENABLE = yes # Read keymap from eeprom
In file included from matrix.c:3:0:
../../mbed-sdk/libraries/mbed/hal/gpio_api.h:19:20: fatal error: device.h: No such file or directory
#include "device.h"
^
compilation terminated.
mbed-infinity/cmsis_nvic.c:31:24: fatal error: cmsis_nvic.h: No such file or directory
#include "cmsis_nvic.h"
^
compilation terminated.
main.cpp:1:20: fatal error: MK20D5.h: No such file or directory
#include "MK20D5.h"
^
compilation terminated.
make: *** [build/matrix.o] Error 1
make: *** [build/mbed-infinity/cmsis_nvic.o] Error 1
make: *** [build/main.o] Error 1
mbed-infinity/system_MK20D5.c:43:20: fatal error: MK20D5.h: No such file or directory
#include "MK20D5.h"
^
compilation terminated.
make: *** [build/mbed-infinity/system_MK20D5.o] Error 1
In file included from ../../mbed-sdk/libraries/mbed/api/mbed.h:21:0,
from ../../mbed-sdk/libraries/USBDevice/USBDevice/USBHAL.h:22,
from mbed-infinity/USBHAL_KL25Z.cpp:21:
../../mbed-sdk/libraries/mbed/api/platform.h:21:20: fatal error: device.h: No such file or directory
#include "device.h"
^
compilation terminated.
make: *** [build/mbed-infinity/USBHAL_KL25Z.o] Error 1
dfu-util 0.8
Copyright 2005-2009 Weston Schmidt, Harald Welte and OpenMoko Inc.
Copyright 2010-2014 Tormod Volden and Stefan Schmidt
This program is Free Software and has ABSOLUTELY NO WARRANTY
Please report bugs to dfu-util@lists.gnumonks.org
dfu-util: Invalid DFU suffix signature
dfu-util: A valid DFU suffix will be required in a future dfu-util release!!!
Opening DFU capable USB device...
ID 1c11:b007
Run-time device DFU version 0110
Claiming USB DFU Interface...
Setting Alternate Setting #0 ...
Determining device status: state = dfuIDLE, status = 0
dfuIDLE, continuing
DFU mode device DFU version 0110
Device returned transfer size 1024
Copying data from PC to DFU device
Download [=========================] 100% 12684 bytes
Download done.
state(7) = dfuMANIFEST, status(0) = No error condition is present
dfu-util: unable to read DFU status after completion
- $(OBJDIR)/mbed-infinity/cmsis_nvic.o \
- $(OBJDIR)/mbed-infinity/system_MK20D5.o \
- $(OBJDIR)/mbed-infinity/USBHAL_KL25Z.o \
+ $(OBJDIR)/libraries/mbed/targets/cmsis/TARGET_Freescale/TARGET_K20XX/TARGET_K20D50M/cmsis_nvic.o \
+ $(OBJDIR)/libraries/mbed/targets/cmsis/TARGET_Freescale/TARGET_K20XX/TARGET_K20D50M/system_MK20D5.o \
+ $(OBJDIR)/libraries/USBDevice/USBDevice/USBHAL_KL25Z.o \
Hey there Hasu! I am currently in the planning phase of making a 2 cherry MX key controller for the game osu. Is there a way for me to add reactive LED backlighting to the keys and a breath light that changes color based on the keypresses per minute? Keep in mind I am pretty much a noob at both the hardware and software side of things so I may be a bit dense...
mkdir test
cd test
git clone https://github.com/tmk/tmk_keyboard.git
cd tmk_keyboard
git submodule init
git submodule update
git clone https://github.com/mbedmicro/mbed.git mbed-sdk
cd mbed-sdk
git checkout 2f63fa7d78a264b
cd ../keyboard/infinity
make
sudo make program
l_b,
Infinity goes into DFU mode if firmware is built incorrectly or work wrong.
I'd ask some,
0. your Infinity is 'prototype' or 'production' model?
those two models have different matrix, define 'INFINITY_PROTOTYPE' in config.h for prototype
1. fimware you compiled with 2f63fa7d78a264b before worked for your Infinity?
I confirmed it works for me with my prototype model just before this was written.
2. my prebuild binary works? https://geekhack.org/index.php?topic=41989.msg1677235#msg1677235
This is built for production model.
3. Infinity official firmware works?
4. what version is your dfu-tool?
5. show me output of dfu-tool or make program
This is likely your problem, the latest version of dfu-tool requires some integrity check or sth.
leon@lola:~$ sudo /usr/bin/dfu-util -D Downloads/infinity_spacefn.bin
dfu-util 0.5
(C) 2005-2008 by Weston Schmidt, Harald Welte and OpenMoko Inc.
(C) 2010-2011 Tormod Volden (DfuSe support)
This program is Free Software and has ABSOLUTELY NO WARRANTY
dfu-util does currently only support DFU version 1.0
Opening DFU USB device... ID 1c11:b007
Run-time device DFU version 0110
Found DFU: [1c11:b007] devnum=0, cfg=1, intf=0, alt=0, name="UNDEFINED"
Claiming USB DFU Interface...
Setting Alternate Setting #0 ...
Determining device status: state = dfuIDLE, status = 0
dfuIDLE, continuing
DFU mode device DFU version 0110
Device returned transfer size 1024
No valid DFU suffix signature
Warning: File has no DFU suffix
bytes_per_hash=253
Copying data from PC to DFU device
Starting download: [##################################################] finished!
state(7) = dfuMANIFEST, status(0) = No error condition is present
unable to read DFU status
leon@lola:~$ sudo /home/leon/.linuxbrew/bin/dfu-util -D Downloads/infinity_spacefn.bin
dfu-util 0.8
Copyright 2005-2009 Weston Schmidt, Harald Welte and OpenMoko Inc.
Copyright 2010-2014 Tormod Volden and Stefan Schmidt
This program is Free Software and has ABSOLUTELY NO WARRANTY
Please report bugs to dfu-util@lists.gnumonks.org
dfu-util: Invalid DFU suffix signature
dfu-util: A valid DFU suffix will be required in a future dfu-util release!!!
Opening DFU capable USB device...
ID 1c11:b007
Run-time device DFU version 0110
Claiming USB DFU Interface...
Setting Alternate Setting #0 ...
Determining device status: state = dfuIDLE, status = 0
dfuIDLE, continuing
DFU mode device DFU version 0110
Device returned transfer size 1024
Copying data from PC to DFU device
Download [=========================] 100% 12676 bytes
Download done.
state(7) = dfuMANIFEST, status(0) = No error condition is present
dfu-util: unable to read DFU status after completion
leon@lola:~$ sudo /home/leon/.linuxbrew/bin/dfu-util -D src/tmk_keyboard/keyboard/infinity/kiibohd.dfu.bin
dfu-util 0.8
Copyright 2005-2009 Weston Schmidt, Harald Welte and OpenMoko Inc.
Copyright 2010-2014 Tormod Volden and Stefan Schmidt
This program is Free Software and has ABSOLUTELY NO WARRANTY
Please report bugs to dfu-util@lists.gnumonks.org
dfu-util: Invalid DFU suffix signature
dfu-util: A valid DFU suffix will be required in a future dfu-util release!!!
Opening DFU capable USB device...
ID 1c11:b007
Run-time device DFU version 0110
Claiming USB DFU Interface...
Setting Alternate Setting #0 ...
Determining device status: state = dfuIDLE, status = 0
dfuIDLE, continuing
DFU mode device DFU version 0110
Device returned transfer size 1024
Copying data from PC to DFU device
Download [=========================] 100% 23452 bytes
Download done.
state(7) = dfuMANIFEST, status(0) = No error condition is present
dfu-util: unable to read DFU status after completion
$ make program
dfu-util -D ./build/infinity.bin
dfu-util 0.5
(C) 2005-2008 by Weston Schmidt, Harald Welte and OpenMoko Inc.
(C) 2010-2011 Tormod Volden (DfuSe support)
This program is Free Software and has ABSOLUTELY NO WARRANTY
dfu-util does currently only support DFU version 1.0
Opening DFU USB device... ID 1c11:b007
Run-time device DFU version 0110
Found DFU: [1c11:b007] devnum=0, cfg=1, intf=0, alt=0, name="UNDEFINED"
Claiming USB DFU Interface...
Setting Alternate Setting #0 ...
Determining device status: state = dfuIDLE, status = 0
dfuIDLE, continuing
DFU mode device DFU version 0110
Device returned transfer size 1024
No valid DFU suffix signature
Warning: File has no DFU suffix
bytes_per_hash=252
Copying data from PC to DFU device
Starting download: [##################################################] finished!
state(7) = dfuMANIFEST, status(0) = No error condition is present
unable to read DFU status
avrdude -p m32u4 -c usbtiny -v -v -v -U flash:w:e:\gamer_lufa.hex:i
avrdude: Version 6.1, compiled on Mar 13 2014 at 00:09:49
Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
Copyright (c) 2007-2014 Joerg Wunsch
System wide configuration file is "E:\Eletr¶nica, Arduino e afins\avrdude-6.1-mingw32\avrdude.conf"
Using Port : usb
Using Programmer : usbtiny
avrdude: usbdev_open(): Found USBtinyISP, bus:device: bus-0:\\.\libusb0-0001--0x1781-0x0c9f
AVR Part : ATmega32U4
Chip Erase delay : 9000 us
PAGEL : PD7
BS2 : PA0
RESET disposition : dedicated
RETRY pulse : SCK
serial program mode : yes
parallel program mode : yes
Timeout : 200
StabDelay : 100
CmdexeDelay : 25
SyncLoops : 32
ByteDelay : 0
PollIndex : 3
PollValue : 0x53
Memory Detail :
Block Poll Page Polled
Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack
----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
eeprom 65 20 4 0 no 1024 4 0 9000 9000 0x00 0x00
Block Poll Page Polled
Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack
----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
flash 65 6 128 0 yes 32768 128 256 4500 4500 0x00 0x00
Block Poll Page Polled
Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack
----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
lfuse 0 0 0 0 no 1 0 0 9000 9000 0x00 0x00
Block Poll Page Polled
Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack
----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
hfuse 0 0 0 0 no 1 0 0 9000 9000 0x00 0x00
Block Poll Page Polled
Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack
----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
efuse 0 0 0 0 no 1 0 0 9000 9000 0x00 0x00
Block Poll Page Polled
Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack
----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
lock 0 0 0 0 no 1 0 0 9000 9000 0x00 0x00
Block Poll Page Polled
Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack
----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
calibration 0 0 0 0 no 1 0 0 0 0 0x00 0x00
Block Poll Page Polled
Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack
----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
signature 0 0 0 0 no 3 0 0 0 0 0x00 0x00
Programmer Type : USBtiny
Description : USBtiny simple USB programmer, http://www.ladyada.net/make/usbtinyisp/
avrdude: programmer operation not supported
avrdude: Using SCK period of 10 usec
CMD: [ac 53 00 00] [00 00 00 00]
CMD: [ac 53 00 00] [00 00 00 00]
avrdude: initialization failed, rc=-1
Double check connections and try again, or use -F to override
this check.
avrdude done. Thank you.
avrdude: Version 6.1, compiled on Mar 13 2014 at 00:09:49
Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
Copyright (c) 2007-2014 Joerg Wunsch
System wide configuration file is "E:\Eletr¶nica, Arduino e afins\avrdude-6.1-mingw32\avrdude.conf"
Using Port : usb
Using Programmer : usbtiny
avrdude: usbdev_open(): Found USBtinyISP, bus:device: bus-0:\\.\libusb0-0001--0x1781-0x0c9f
AVR Part : ATmega32U4
Chip Erase delay : 9000 us
PAGEL : PD7
BS2 : PA0
RESET disposition : dedicated
RETRY pulse : SCK
serial program mode : yes
parallel program mode : yes
Timeout : 200
StabDelay : 100
CmdexeDelay : 25
SyncLoops : 32
ByteDelay : 0
PollIndex : 3
PollValue : 0x53
Memory Detail :
Block Poll Page Polled
Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack
----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
eeprom 65 20 4 0 no 1024 4 0 9000 9000 0x00 0x00
Block Poll Page Polled
Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack
----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
flash 65 6 128 0 yes 32768 128 256 4500 4500 0x00 0x00
Block Poll Page Polled
Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack
----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
lfuse 0 0 0 0 no 1 0 0 9000 9000 0x00 0x00
Block Poll Page Polled
Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack
----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
hfuse 0 0 0 0 no 1 0 0 9000 9000 0x00 0x00
Block Poll Page Polled
Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack
----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
efuse 0 0 0 0 no 1 0 0 9000 9000 0x00 0x00
Block Poll Page Polled
Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack
----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
lock 0 0 0 0 no 1 0 0 9000 9000 0x00 0x00
Block Poll Page Polled
Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack
----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
calibration 0 0 0 0 no 1 0 0 0 0 0x00 0x00
Block Poll Page Polled
Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack
----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
signature 0 0 0 0 no 3 0 0 0 0 0x00 0x00
Programmer Type : USBtiny
Description : USBtiny simple USB programmer, http://www.ladyada.net/make/usbtinyisp/
avrdude: programmer operation not supported
avrdude: Using SCK period of 10 usec
CMD: [ac 53 00 00] [00 00 00 00]
CMD: [ac 53 00 00] [00 00 00 00]
avrdude: initialization failed, rc=-1
avrdude: AVR device initialized and ready to accept instructions
avrdude: Device signature = 0x1e0000
avrdude: Expected signature for ATmega32U4 is 1E 95 87
avrdude: NOTE: "flash" memory has been specified, an erase cycle will be performed
To disable this feature, specify the -D option.
avrdude done. Thank you.
VinnyCordeiro,
I think you have to check your connection related to ISP pins and power. You can post your circuit diagram so that we can double check for you.
And post pics of you keyboard! People really love to see custom keyboard works and you'll get more attentions and helps in the end.
Last but not least, why are you using ISP&avrdude instead of USB bootloader?
Nice work.
So your ICSP problem was resolved and you can flash firmware now, right?
Mar 24 20:54:25 lola kernel: [279889.727369] usb 3-7: new full-speed USB device number 36 using xhci_hcd
Mar 24 20:54:25 lola kernel: [279889.855929] usb 3-7: unable to read config index 0 descriptor/start: -71
Mar 24 20:54:25 lola kernel: [279889.855931] usb 3-7: can't read configurations, error -71
Mar 24 20:54:25 lola kernel: [279889.967283] usb 3-7: new full-speed USB device number 37 using xhci_hcd
Mar 24 20:54:25 lola kernel: [279890.095861] usb 3-7: unable to read config index 0 descriptor/start: -71
Mar 24 20:54:25 lola kernel: [279890.095863] usb 3-7: can't read configurations, error -71
Mar 24 20:54:26 lola kernel: [279890.207183] usb 3-7: new full-speed USB device number 38 using xhci_hcd
Mar 24 20:54:26 lola kernel: [279890.223558] usb 3-7: device descriptor read/all, error -71
Mar 24 20:54:26 lola kernel: [279890.335175] usb 3-7: new full-speed USB device number 39 using xhci_hcd
Mar 24 20:54:26 lola kernel: [279890.351509] usb 3-7: device descriptor read/all, error -71
Mar 24 20:54:26 lola kernel: [279890.351545] usb usb3-port7: unable to enumerate USB device
I don't think floting pin is problem they are internally pull-uped but not sure. Teensy++ has 1286 not 1287, but again not sure this causes the madness. BTW, what is tml?
Would something like implementing the media keys be doable for me (little c / embedded experience, but familiar with programming) for the infinity / mbed stack?
I added initial support for Masdrop Infinity which based on mbed(cortex-M) and is not full fucinton yet; mouse keys, media keys, NKRO and etc.
https://github.com/tmk/tmk_keyboard/tree/master/keyboard/infinity
I don't think many users are around here yet, but if you have it try this.
Yeah, official firmware works fine with usb3. (But isn't as nice as tmk :))
If you're open for it I would be willing to donate a little sum for the project because I enjoy it very much.
Would something like implementing the media keys be doable for me (little c / embedded experience, but familiar with programming) for the infinity / mbed stack?
Thanks for the encouragement. I'm always open for that :D Buy me a beer, it is powerful driver for my project :pYeah, sure. Send me your PayPal address (or something) and I'll buy you a couple of round :thumb:
[28] = ACTION_MODS_ONESHOT(MOD_LSFT),
Is there a way to have a dedicated ~ key?
const uint16_t PROGMEM fn_actions[] = {
[0] = ACTION_MODS_KEY( MOD_LSFT, KC_GRV ), // ~
}
What do these keycodes do?
KC_APP
KC_PCMM
KC_MAIL, KC_CALC, KC_MYCM for application launch
KC_WSCH, KC_WHOM, KC_WBAK, KC_WFWD, KC_WSTP, KC_WREF, KC_WFAV for web browser operation
Thank you!Is there a way to have a dedicated ~ key?
Wouldn't this do it?Code: [Select]const uint16_t PROGMEM fn_actions[] = {
[0] = ACTION_MODS_KEY( MOD_LSFT, KC_GRV ), // ~
}
https://github.com/tmk/tmk_keyboard/blob/master/doc/keycode.txt
KC_APP = Right menu key (the key to the right of RWin on most keyboards)
KC_PCMM = Numpad comma key
KC_MAIL, KC_CALC, KC_MYCM = Starts mail, calc, explorer app
KC_WSCH, KC_WHOM, KC_WBAK, KC_WFWD, KC_WSTP, KC_WREF, KC_WFAV = Web navigation shortcuts: search, home, back, forward, stop, refresh and favorites (bookmarks)
KC_APP = Right menu key (the key to the right of RWin on most keyboards)
KC_PCMM = Numpad comma key
KC_MAIL, KC_CALC, KC_MYCM = Starts mail, calc, explorer app
KC_WSCH, KC_WHOM, KC_WBAK, KC_WFWD, KC_WSTP, KC_WREF, KC_WFAV = Web navigation shortcuts: search, home, back, forward, stop, refresh and favorites (bookmarks)
If KC_APP is that lower right menu key then what is KC_MENU? Also, what is the difference between KC_F1 and KC_FN1? Thank you!
make -f Makefile
Hello,
While executingCode: [Select]make -f Makefile
I get the errorShow Image(http://i.imgur.com/j0EEKWf.png)
May I ask what may cause this and how to fix it?
I have both the Winavr and Teensyloader installed.
Thanks!
Here is a zip of my code in case anyone can help out:
https://drive.google.com/file/d/0ByOSi5aaJltDNkpfTlZ0TDFKRms/view?usp=sharing
Hello,
While executingCode: [Select]make -f Makefile
I get the errorShow Image(http://i.imgur.com/j0EEKWf.png)
May I ask what may cause this and how to fix it?
I have both the Winavr and Teensyloader installed.
Thanks!
Here is a zip of my code in case anyone can help out:
https://drive.google.com/file/d/0ByOSi5aaJltDNkpfTlZ0TDFKRms/view?usp=sharing
You need to have make installed. What platform are you on? If windows you can download the package here: http://gnuwin32.sourceforge.net/packages/make.htm. Installation instructions are further down the page. Try it and come back if you have trouble.
The ATmega32U4 was recognized by Windows 7, which proved 2 things: even being my first time soldering an SMD component, my 20+ years of experience in electronics proved useful :cool:; and that the microcontrollers I bought at AliExpress weren't fake.
I believe WinAVR includes make command already.
neverused, read WinAVR document for installation and follow it. I think you don't set Path yet.
This one: http://www.aliexpress.com/item/5pcs-lot-ATMEGA32U4-AU-ATMEGA32U4-ATMEL-TQFP-44-IC-8-bit-Microcontroller-with-16-32K-Bytes/1877422430.html and now it's $5 cheaper than when I bought.The ATmega32U4 was recognized by Windows 7, which proved 2 things: even being my first time soldering an SMD component, my 20+ years of experience in electronics proved useful :cool:; and that the microcontrollers I bought at AliExpress weren't fake.
Nice to hear. I've procrastinated to place a order on small vendor in China, but it it time now.
To get the MCU from trusty sources at proper price is getting more and more difficult recently :(
Which seller did you use?
Just throwing this out there, has anyone tried/had any luck compiling the TMK firmware for a Teensy 3.1? I've got a box of them doing nothing, so I figured I'd see if I can put them to use.
hasu, I didn't get a mail from geekhack there was an update so I didn't realize you already fixed the problem! I tried it out: the flashing went fine. The light that indicated dfu mode goes out.
However the keyboard after that won't work. I get these in my dmesg:Code: [Select]Mar 24 20:54:25 lola kernel: [279889.727369] usb 3-7: new full-speed USB device number 36 using xhci_hcd
Mar 24 20:54:25 lola kernel: [279889.855929] usb 3-7: unable to read config index 0 descriptor/start: -71
Mar 24 20:54:25 lola kernel: [279889.855931] usb 3-7: can't read configurations, error -71
Mar 24 20:54:25 lola kernel: [279889.967283] usb 3-7: new full-speed USB device number 37 using xhci_hcd
Mar 24 20:54:25 lola kernel: [279890.095861] usb 3-7: unable to read config index 0 descriptor/start: -71
Mar 24 20:54:25 lola kernel: [279890.095863] usb 3-7: can't read configurations, error -71
Mar 24 20:54:26 lola kernel: [279890.207183] usb 3-7: new full-speed USB device number 38 using xhci_hcd
Mar 24 20:54:26 lola kernel: [279890.223558] usb 3-7: device descriptor read/all, error -71
Mar 24 20:54:26 lola kernel: [279890.335175] usb 3-7: new full-speed USB device number 39 using xhci_hcd
Mar 24 20:54:26 lola kernel: [279890.351509] usb 3-7: device descriptor read/all, error -71
Mar 24 20:54:26 lola kernel: [279890.351545] usb usb3-port7: unable to enumerate USB device
TMK works on ARM Cortex-M now, actually it runs on Infinity and NXP LPC board at least.
See keyboard/inifinity/ and tmk_core/tool/mbed/ directory. Not mature and clean enough but it works.
TMK uses mbed.org SDK to support Cortex-M, so it will be easy to port MCU mbed.org supports theoretically. Teensy3.1 uses same family controller as Infinity and recently mbed.org added support of Teensy3.1. I think porting to Teensy is not so hard if you are familiar with mbed SDK.
Apr 24 22:34:03 lola kernel: [ 130.501061] usb 3-7: new full-speed USB device number 8 using xhci_hcd
Apr 24 22:34:03 lola kernel: [ 130.629611] usb 3-7: unable to read config index 0 descriptor/start: -71
Apr 24 22:34:03 lola kernel: [ 130.629613] usb 3-7: can't read configurations, error -71
Apr 24 22:34:03 lola kernel: [ 130.741050] usb 3-7: new full-speed USB device number 9 using xhci_hcd
Apr 24 22:34:03 lola kernel: [ 130.869761] usb 3-7: unable to read config index 0 descriptor/start: -71
Apr 24 22:34:03 lola kernel: [ 130.869764] usb 3-7: can't read configurations, error -71
Apr 24 22:34:03 lola kernel: [ 130.981113] usb 3-7: new full-speed USB device number 10 using xhci_hcd
Apr 24 22:34:03 lola kernel: [ 130.997964] usb 3-7: unable to read config index 0 descriptor/all
Apr 24 22:34:03 lola kernel: [ 130.997967] usb 3-7: can't read configurations, error -71
Apr 24 22:34:04 lola kernel: [ 131.165138] usb 3-7: new full-speed USB device number 11 using xhci_hcd
Apr 24 22:34:04 lola kernel: [ 131.181429] usb 3-7: device descriptor read/all, error -71
Apr 24 22:34:04 lola kernel: [ 131.181460] usb usb3-port7: unable to enumerate USB device
I can't figure out what I'm doing here... I've tried to adapt this firmware to my project, and I had a C programmer try to assist me, and we've gotten nowhere, this is really damn confusing, I have the primary and 1 function layer. It just does nothing after it's flashed. I'm using an Atmega32U4. Can someone put this into something that would actually work since I clearly have no idea what I'm doing, and I've spent weeks on this.
I can't figure out what I'm doing here... I've tried to adapt this firmware to my project, and I had a C programmer try to assist me, and we've gotten nowhere, this is really damn confusing, I have the primary and 1 function layer. It just does nothing after it's flashed. I'm using an Atmega32U4. Can someone put this into something that would actually work since I clearly have no idea what I'm doing, and I've spent weeks on this.
What does your matrix.c look like? It took a bit for me to grok what was going on there, but once I did I was able to get my keyboard working, and when I had it wrong a plain teensy with nothing connected would show keys held down. You have to modify all 4 functions correctly or it won't scan and reset the pins properly.
/*
matrix pins:
col: 7 0 1 5 8 4 9 10 11 6 2 3
pin: B3 B4 B5 B6 B7 C7 D0 D1 D2 D3 D6 D7
*/
static void init_cols(void)
{
// Input with pull-up(DDR:0, PORT:1)
DDRB &= ~(1<<3 | 1<<4 | 1<<5 | 1<<6 | 1<<7);
PORTB |= (1<<3 | 1<<4 | 1<<5 | 1<<6 | 1<<7);
DDRC &= ~(1<<7);
PORTC |= (1<<7);
DDRD &= ~(1<<0 | 1<<1 | 1<<2 | 1<<3 | 1<<6 | 1<<7);
PORTD |= (1<<0 | 1<<1 | 1<<2 | 1<<3 | 1<<6 | 1<<7);
}
static matrix_row_t read_cols(void)
{
return (PINB&(1<<3) ? 0 : (1<< 7)) |
(PINB&(1<<4) ? 0 : (1<< 0)) |
(PINB&(1<<5) ? 0 : (1<< 1)) |
(PINB&(1<<6) ? 0 : (1<< 5)) |
(PINB&(1<<7) ? 0 : (1<< 8)) |
(PINC&(1<<7) ? 0 : (1<< 4)) |
(PIND&(1<<0) ? 0 : (1<< 9)) |
(PIND&(1<<1) ? 0 : (1<<10)) |
(PIND&(1<<2) ? 0 : (1<<11)) |
(PIND&(1<<3) ? 0 : (1<< 6)) |
(PIND&(1<<6) ? 0 : (1<< 2)) |
(PIND&(1<<7) ? 0 : (1<< 3));
}
/*
Row pin configuration
row: 0 1 2 3 4
pin: D5 C6 E2 B0 E6
*/
static void unselect_rows(void)
{
// Hi-Z(DDR:0, PORT:0) to unselect
DDRB &= ~0b00000001;
PORTB &= ~0b00000001;
DDRC &= ~0b01000000;
PORTC &= ~0b01000000;
DDRD &= ~0b00100000;
PORTD &= ~0b00100000;
DDRE &= ~0b01000100;
PORTE &= ~0b01000100;
}
static void select_row(uint8_t row)
{
// Output low(DDR:1, PORT:0) to select
switch (row) {
case 0:
DDRD |= (1<<5);
PORTD &= ~(1<<5);
break;
case 1:
DDRC |= (1<<6);
PORTC &= ~(1<<6);
break;
case 2:
DDRE |= (1<<2);
PORTE &= ~(1<<2);
break;
case 3:
DDRB |= (1<<0);
PORTB &= ~(1<<0);
break;
case 4:
DDRE |= (1<<6);
PORTE &= ~(1<<6);
break;
}
}
Has any one built their firmware from a Raspberry Pi? I am unfamiliar with Linux, so I do not know how to differentiate amongst distros or how that
would affect the ability to build the Makefile.
Can anyone assist with this?
Thank you.
5tgb 5tgb 5tgb 5tgb 5tgb 5tgb 5ptlgm5tg5tgggggggggg5tg5tgplm5tgplm5tg5tg5tgplm5tg5tgplm5tg5tg5tg5tg5tg5tgplmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm5tg5tg5tg5tg5tg5tg5tg5tg5tg5tg5tg5tg5tg5tg5tg5tgplmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmplmplmplm5tg5tggggg5tg5tg5tg5tg5tg5tg5tg5tg5tg5tg5tg5tg5tg5tgg5tgv 5tgv 5tgv 5tgv 5tgv 5tgv 5tgv 5tgv 5tgv 5tgv 5tgv 5tgv 5tgv 5tgv 5tgv 5tgv 5tgv 5tgv 5tgv 5tgv 5tgv 5tgv 5tgv 5tgv 5tgv 5tgv 5tgv 5tgv 5tgv 5tgv 5tgv 5tgv 5tgv 5tgv 5tgv 5tgv 5tgv 5tgv 5tgv 5tgv 5tgv 5tgv 5tgv 5tgv 5tgv
static void init_cols(void)
{
// Input with pull-up(DDR:0, PORT:1)
DDRF &= ~0b11110011;
PORTF |= ~0b11110011;
DDRB &= ~(1<<6 | 1<<5);
PORTB |= (1<<6 | 1<<5);
}
Always fix the first error first.is the "usr/bin/sh: dfu-programmer: command not found" not the first error?
Always fix the first error first.is the "usr/bin/sh: dfu-programmer: command not found" not the first error?
Wow thanks. K2E was defined twice. How could you see that?
I fixed that but still get a similar result.
#include <avr/io.h>
#include "stdint.h"
#include "led.h"
void led_set(uint8_t usb_led)
{
if (usb_led & (1<<USB_LED_CAPS_LOCK)) {
// output low
DDRC |= (1<<7);
PORTC &= ~(1<<7);
} else {
// Hi-Z
DDRC &= ~(1<<7);
PORTC &= ~(1<<7);
}
}
index ba93fc8..91276a3 100644
--- a/common/action_macro.c
+++ b/common/action_macro.c
@@ -35,6 +35,11 @@ void action_macro_play(const macro_t *macro_p)
uint8_t interval = 0;
if (!macro_p) return;
+
+ uint8_t old_mods = get_mods();
+ clear_mods();
+ send_keyboard_report();
+
while (true) {
switch (MACRO_READ()) {
case KEY_DOWN:
@@ -74,6 +79,8 @@ void action_macro_play(const macro_t *macro_p)
break;
case END:
default:
+ add_mods(old_mods);
+ send_keyboard_report();
return;
}
// interval
Are the media keys OS X friendly (if say iTunes is in the background)? I am thinking to build for ps2avrGB boards
Ok, so this is looking like I am having an issue with Spotify (https://community.spotify.com/t5/Help-Desktop-Linux-Mac-and/Next-Previous-media-keys-don-t-work-on-3rd-Party-Keyboard-Play/m-p/593026). Can you check to see if Prev/Next keys work in Spotify?Are the media keys OS X friendly (if say iTunes is in the background)? I am thinking to build for ps2avrGB boards
I use volume up, down and mute, and play/pause, next track and previous track on OSX with no issues.
Any modifiers held when pressing a macro key will be used in that macro, which of course breaks my macros.
Is there any proper way of handling modifiers in macros? Was kind of hoping that they would have no effect in macros unless explicitly set.
Edit:
This change in common/action_macro.c allowed this to work properly:Code: [Select]index ba93fc8..91276a3 100644
--- a/common/action_macro.c
+++ b/common/action_macro.c
@@ -35,6 +35,11 @@ void action_macro_play(const macro_t *macro_p)
uint8_t interval = 0;
if (!macro_p) return;
+
+ uint8_t old_mods = get_mods();
+ clear_mods();
+ send_keyboard_report();
+
while (true) {
switch (MACRO_READ()) {
case KEY_DOWN:
@@ -74,6 +79,8 @@ void action_macro_play(const macro_t *macro_p)
break;
case END:
default:
+ add_mods(old_mods);
+ send_keyboard_report();
return;
}
// interval
What is Spotify in fact? Is it a web app or native app?
At his Project Zeta post (https://geekhack.org/index.php?topic=71161.0), metalliqaz made an interesting use of a 4-to-16 demultiplexer to expand the number of outputs of the ATmega32U4. Is it possible to adapt this idea on TMK (the original code isn't open, unfortunately)?
I didn't studied TMK code deeply, just enough to make my proof-of-concept keyboard work, so I don't know if the demux use will be difficult or not (I know how to code, but I quit serious programming for almost 10 years now, for professional reasons). 74HC154 accepts HIGH signal inputs and gives LOW signal outputs, as a matter of fact.
You cannot do like this in macro currently at least, you have to change core code like you did. TMK macro is ad hoc and not full fledged, I'll have to improve macro syntax and function apparently.
Or you will be able to realize this with 'action functions' without changing core code.
Your patch looks reasonable for your need :thumb:Any modifiers held when pressing a macro key will be used in that macro, which of course breaks my macros.
Is there any proper way of handling modifiers in macros? Was kind of hoping that they would have no effect in macros unless explicitly set.
Edit:
This change in common/action_macro.c allowed this to work properly:
Could I override the function "action_macro_play" in my code without modifying the core? I don't know enough about C yet to answer this myself.
You can copy common/action_macro.c to your project directory and edit it to override core file. If same named file are in project directory it is used in preference to core file in build process.Could I override the function "action_macro_play" in my code without modifying the core? I don't know enough about C yet to answer this myself.
Create 'common' directory in project directory and place the file into the 'common' directory.
This is not clean but it works for me.
Update 2: Changed the PS2_DATA_BIT value to 0 in config.h and got it working. The README.md in ps2_usb is not in sync with the actual code.
KEYMAP_IN_EEPROM_ENABLE = yes # Read keymap from eeprom
const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
{
switch (id) {
case HELLO:
return (record->event.pressed ?
MACRO( D(LSFT), T(H), U(LSFT), T(E), T(L), T(L), T(O), END ) :
MACRO( U(LSFT), END ) );
Updating goal targets....
Considering target file `all'.
File `all' does not exist.
Considering target file `begin'.
File `begin' does not exist.
Finished prerequisites of target file `begin'.
Must remake target `begin'.
Creating temporary batch file C:\Users\~~\AppData\Local\Temp\make6088-1.bat
CreateProcess(C:\Users\~~\AppData\Local\Temp\make6088-1.bat,C:\Users\~~\AppData\Local\Temp\make6088-1.bat,...)
Putting child 0x01cd9380 (begin) PID 30156216 on the chain.
Live child 0x01cd9380 (begin) PID 30156216
ECHO is off.
I have a 17x5 TKL matrix. It's all working as expected, thanks to hasu for the firmware and this community. I'm have one issue and I'm not sure if it's hardware related or something I missed in the firmware. 3 keys in my 16th column cause one of the adjacent keys in the 17th column to register. When I press home, end, and down like this:I had a similar issue and it was due unwanted solder jumpers shorting 3 pins of my microcontroller (I directly soldered it on the board). Take a closer look on your solder joints, use a multimeter to confirm shorts and correct them.
home = home + page up
end = end + page up
down = down + right
i think it's the diodes but I'm not sure and thought to check here first.
Thanks.
Hey hasu, I see that you have a Serialmouse project ongoing. I Have a Trackball from kensington that goes on the same interface as the old Macintosh M0100 mouse. Do you think that your Serialmouse_USB would work for that?
It seems like Kairyu 's firmware for Redscarf has backlight function. You mgith want to check it.Thank you, hasu.
https://github.com/kairyu/tmk_keyboard_custom/tree/master/keyboard/RedScarfIII
I think you are right.The questions are for a keyboard I am designing, I don't think that will be a problem. :))
But I don't know about the keyboard, who designed and whether its design is open or not.
Probably you have to look into pics of PCB of the keyboard to know its design.
[0] = KEYMAP_JCK(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, DEL, \
ESC, A, S, D, F, G, H, J, K, L, SCLN, QUOT, ENT, MPLY, \
LSFT, Z, X, C, V, B, N, M, COMM, DOT, SLSH, RSFT, VOLD, VOLU, \
LCTL, LALT, LGUI, SPC, FN1, LEFT, DOWN, UP, RGHT),
// JCK: Semi-Standard layout
#define KEYMAP_JCK( \
K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, K0E, \
K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K1D, K1E, \
K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, K2D, K2E, \
K30, K31, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3C, K3D, K3E, \
K40, K41, K43, K46, K4A, K4B, K4C, K4D, K4E \
) { \
{ 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_NO, KC_##K0E }, \
{ 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_##K1E }, \
{ 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_NO, KC_##K2D, KC_##K2E }, \
{ KC_##K30, KC_##K31, KC_##K32, KC_##K33, KC_##K34, KC_##K35, KC_##K36, KC_##K37, KC_##K38, KC_##K39, KC_##K3A, KC_NO, KC_##K3C, KC_##K3D, KC_##K3E }, \
{ KC_##K40, KC_##K41, KC_NO, KC_##K43, KC_NO, KC_NO, KC_##K46, KC_NO, KC_NO, KC_NO, KC_##K4A, KC_##K4B, KC_##K4C, KC_##K4D, KC_##K4E } \
}
No difference essentially. In tmk keymap is an array of byte(uint8_t) in the end, KEYMAP macros are just useful to define the keymap array intuitively in concise form, not necessarily essential. You can define the array directly without macro if you want.
Yes.
When you read/search/exploere unknown codes of large project it is very useful to setup code reference system like tag jump or GNU GLOBAL with your editor. You may like to make reference of codes incuding AVR Lib, this helped me a lot while coding for AVR.
main() is located in tmk_core/protocol/lufa/lufa.c. To be honest, TMK code is not well organized and is still just copy of my current working code, so it is not your fault :D
Probably you need to know a bit of AVR Lib, C preprocessor, GCC extension and GNU Make as well as basic C langueage syntax. You don't have to read through, just refer to or search them when you cannot understand it with C knowledge in your brain.
http://www.nongnu.org/avr-libc/user-manual/modules.html
https://gcc.gnu.org/onlinedocs/cpp/
https://gcc.gnu.org/onlinedocs/gcc/C-Extensions.html
http://www.gnu.org/software/make/manual/make.html
S:\Keyboard\tmk_keyboard-master\keyboard\gh60>make
/usr/bin/sh: dfu-programmer: command not found
/usr/bin/sh: dfu-programmer: command not found
-------- 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.
mkdir -p obj_at90usb1287
Compiling C: keymap_poker.c
avr-gcc -c -mmcu=atmega32u4 -gdwarf-2 -DF_CPU=16000000UL -DINTERRUPT_CONTROL_END
POINT -DBOOTLOADER_SIZE=4096 -DF_USB=16000000UL -DARCH=ARCH_AVR8 -DUSB_DEVICE_ON
LY -DUSE_FLASH_DESCRIPTORS -DUSE_STATIC_OPTIONS="(USB_DEVICE_OPT_FULLSPEED | USB
_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)" -DFIXED_CONTROL_ENDPOINT_SIZE=8 -DFIXED_N
UM_CONFIGURATIONS=1 -DPROTOCOL_LUFA -DBOOTMAGIC_ENABLE -DMOUSEKEY_ENABLE -DMOUSE
_ENABLE -DEXTRAKEY_ENABLE -DCONSOLE_ENABLE -DCOMMAND_ENABLE -DVERSION=unknown -O
s -funsigned-char -funsigned-bitfields -ffunction-sections -fdata-sections -fno-
inline-small-functions -fpack-struct -fshort-enums -fno-strict-aliasing -Wall -W
strict-prototypes -Wa,-adhlns=obj_at90usb1287/keymap_poker.lst -I. -I../../tmk_c
ore -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_at90usb128
7_keymap_poker.o.d keymap_poker.c -o obj_at90usb1287/keymap_poker.o
keymap_poker.c:10: error: expected '}' before '{' token
make: *** [obj_at90usb1287/keymap_poker.o] Error 1
HHKB connector lines:
JP Pro2 Pro Function Description TMK pin usage
--------------------------------------------------------------------------------------------
1 Vcc(5V) 5V
1 1 2 Vcc(5V) 5V
2 2 3 Vcc(5V) 5V
3 3 4 TP1684 ~KEY: Low(0) when key is pressed PD7 input(with pullup)
4 4 5 TP1684 HYS: High(1) when key is pressed PB7 output
5 5 6 HC4051 A(bit0)\ PB0 output
6 6 7 HC4051 B(bit1) > select row 0-7 PB1 output
7 7 8 HC4051 C(bit2)/ PB2 output
8 8 9 LS145 A(bit0)\ PB3 output
9 9 10 LS145 B(bit1) > select column 0-7 PB4 output
10 10 11 LS145 C(bit2)/ PB5 output
11 11 12 LS145 ~D(enable) Low(0) enables selected column PB6 output
12 12 13 GND GND
13 13 14 GND GND
15 GND
14 HC4051(Z2) ~Enable of Z2 row0-7 PC6
15 HC4051(Z3) ~Enable of Z3 row8-15 PC7
NOTE: Probably HYS changes threshold for upstroke and makes hysteresis in the result.
NOTE: HYS should be given High(1) when previous KEY state is Low(0).
NOTE: 1KOhm didn't work as pullup resistor on KEY. AVR internal pullup or 10KOhm resistor was OK.
NOTE: JP has two HC4051(Z2,Z3) and line 5, 6 and 7 are connected to both of them.
Thanks for the quick reply. Lufa library is only supported for native USB MCUs?Yep. Although it would be better to say that LUFA library only supports native USB chips ;)
I see, thank for clarifying everything. Probably buying an arduino micro is the fastest alternative for me right now.Yep. Or a teensy.
I am in the process of building a custom keyboard and I have an arduino clone with the atmega328p MCU lying around. I tried compiling firmware for it using the Makefile.vusb from the HHKB project. The matric.c file is including lufa.h which is then including lufa/Drivers/USB/Core/USBMode.h and then I get the error message "The currently selected device or architecture is not supported under the USB component of the library" and then a bunch of other errors. Is there a straightforward way to compile keyboard software for my MCU? Excuse me for my ignorance.
My HHKB controller project has no support for 328/168p series anymore.Thanks for the explanation! I didn't mean any disrespect when I said it's broken, sorry! I think TMK is a fine piece of software, thanks for maintaining it :thumb:
I just fixed and added V-USB build process for ps2_usb and onekey project. You can see onekey if you are still interested.
Are there any other reference examples with multiple PWMs? Could I just fake it by adding in a backlight toggle to the matrix_scan function? (How often does that function run? Is it run at a specific fixed frequency?)
I don't know much about PWM itself and how difficult to implement multiple PWMs, you can find many Arduino projects or something to learn on the net.
matrix_scan() is called from while loop of main() actually, so not consistently periodic run.
I think you need to use timer interrupt if you want eaxact frequency or you are going to use software PWM.
I don't know much about PWM itself and how difficult to implement multiple PWMs, you can find many Arduino projects or something to learn on the net.
matrix_scan() is called from while loop of main() actually, so not consistently periodic run.
I think you need to use timer interrupt if you want eaxact frequency or you are going to use software PWM.
Ok. I'll try to dig into the Planck code (and the MCU datasheet) a little deeper and report back.
Though... I just had a thought. I probably only need 1 PWM. Having 4 PWMs and trying to drive all 4 LED banks separately (one bank on at a time) would mean that I'd be capped at a 25% duty cycle. I wonder how full-sized keyboards handle that current draw.
The plank PCB isn't drawing more than 500ma. It has current limiting resistors on each LED. It draws about 3.5ma per LED (with white LED's). Total of about 168ma. Unless you want some incredibly bright output you can easily stay under 500ma.
Probably you can add your code in common/action_layer.c. All layer change actions should be occured in static void default_layer_state_set(uint32_t state). See this PR. https://github.com/tmk/tmk_keyboard/pull/198ok so I think I got that working using his fork of tmk and building off that. Now I have another question I want to have a key that when tapped will toggle a layer but when pressed will do numlock and I'm wondering if that is possible. I seem to be able to get tap for key press and hold for momentary layer switching but couldn't see how to do what i wanted.
Or also you can define action_function() that changes layer and handles indicator at the same time in your keymap file.
It is probably possible but not supported by default. You can define your own action in action_function(), though how to define is not well documented(or at all) and you'll have to read and look into core code.any suggestions on what to change or look at in action.c? I have tried changing some of the code with little result I couldn't even break the ACTION_LAYER_TAP_KEY I have set up when commenting out or changing parts of the code that i thought may have been related lol.
You can find various action definitions in core/common/action.c.
https://github.com/tmk/tmk_keyboard/blob/master/tmk_core/common/action.c
How did you change action.c? You can post here.I use a batch file that does make clean and make -f makefile to compile it. As for what I edited was stuff under "case ACT_LAYER_TAP:" I was commenting things out and messing with stuff and recompiling and if I didn't notice any effect I would undo it so I don't really know what i changed but i thought I should have at least broken it if I was messing with the right things
Did you try 'make clean' yet?
MCU = at90usb1286
F_CPU = 16000000
ARCH = AVR8
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
NKRO_ENABLE = yes # USB Nkey Rollover - not yet supported in LUFA
PS2_USE_INT = yes # uses external interrupt for falling edge of PS/2 clock pin
include $(TOP_DIR)/protocol.mk
include $(TOP_DIR)/protocol/pjrc.mk
include $(TOP_DIR)/common.mk
include $(TOP_DIR)/rules.mk
Are you sure your M speaks Code Set 2? My PS/2 converter supports only CS2 while his supports all CS1, 2 and 3.
If your keyboard is terminal type it speaks CS3. You can use my terminal converter instead of PS/2.
Ahh. I wasn't sure how much current I should be drawing per LED (other than <= 20mA). When I get my LEDs in, I'll play around with my current limiting power supply and find the optimal brightness.
D:\Programming\Shared Projects\tmk_keyboard\keyboard\ZusDox>make -f makefile
The system cannot find the path specified.
The system cannot find the path specified.
ECHO is off.
-------- 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.
-f was unexpected at this time.
make: *** [sizebefore] Error 255
I'm getting this error when I try to compile the tmk firmware:If you run make in the same directory where the makefile is, the -f parameter is unnecessary, make always assumes that a run without parameter indicates that the makefile is in the current directory.QuoteD:\Programming\Shared Projects\tmk_keyboard\keyboard\ZusDox>make -f makefile
The system cannot find the path specified.
The system cannot find the path specified.
ECHO is off.
-------- 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.
-f was unexpected at this time.
make: *** [sizebefore] Error 255
Any clues as to what '-f was unexpected at this time' means? And why I'm getting "make: *** [sizebefore] Error 255"
I get the feeling it has something to do with winavr or windows rather than my code... I got the exact same error when I tried make -f makefile in the hhkb directory. I also googled a lot but came up with no helpful solutions.
I'll try a fresh install of WinAVR on a different machine tomorrow, but if anyone knows what's going on there I'd really appreciate the help!
Are you sure your M speaks Code Set 2? My PS/2 converter supports only CS2 while his supports all CS1, 2 and 3.
If your keyboard is terminal type it speaks CS3. You can use my terminal converter instead of PS/2.
As for the Error 255, it means that make couldn't find a command for a particular rule. By your quote I assume you are running on Windows. I suggest you to install Cygwin (http://cygwin.com/), it makes easier to install GNU programs on Windows.Thank you. It worked like a charm! I now have half a working keyboard. Time to solder up the other half!
:thumb:As for the Error 255, it means that make couldn't find a command for a particular rule. By your quote I assume you are running on Windows. I suggest you to install Cygwin (http://cygwin.com/), it makes easier to install GNU programs on Windows.Thank you. It worked like a charm! I now have half a working keyboard. Time to solder up the other half!
I didn't see this in the docs, but is there a way to change the timing threshold for tapping?
/* period of tapping(ms) */
#ifndef TAPPING_TERM
#define TAPPING_TERM 200
#endif
/* tap count needed for toggling a feature */
#ifndef TAPPING_TOGGLE
#define TAPPING_TOGGLE 5
#endif
I didn't see this in the docs, but is there a way to change the timing threshold for tapping?
Look in common/action_tapping.hCode: [Select]/* period of tapping(ms) */
#ifndef TAPPING_TERM
#define TAPPING_TERM 200
#endif
/* tap count needed for toggling a feature */
#ifndef TAPPING_TOGGLE
#define TAPPING_TOGGLE 5
#endif
I have a question, not directly related to programming the microcontroller, but I need your experience. Is there a chance that the atmega32u4(of arduino micro) on my newly made keyboard ,gets overheated so it stops working?
After finishing the build today (and flashing of a gh60 code modification), it worked for 4 hours straight, and then it stopped working. I was getting some kernel messages about the device not accepting address(76 and 78 etc) and continuous connects and disconnects of the device. After leaving the keyboard in front of a fan to cool, and now using it with a fan on it, it's working fine. Mind, the temperature in my room was at 35°C a couple of hours ago. The mictocontroller is glued with hot silicon glue on the plastic case, but in my understanding, it is supposed to help conduct the heat to the case except for keeping it steady.
I have a question, not directly related to programming the microcontroller, but I need your experience. Is there a chance that the atmega32u4(of arduino micro) on my newly made keyboard ,gets overheated so it stops working?
After finishing the build today (and flashing of a gh60 code modification), it worked for 4 hours straight, and then it stopped working. I was getting some kernel messages about the device not accepting address(76 and 78 etc) and continuous connects and disconnects of the device. After leaving the keyboard in front of a fan to cool, and now using it with a fan on it, it's working fine. Mind, the temperature in my room was at 35°C a couple of hours ago. The mictocontroller is glued with hot silicon glue on the plastic case, but in my understanding, it is supposed to help conduct the heat to the case except for keeping it steady.
Was this previously working without issue before you reflashed it?
I have a question, not directly related to programming the microcontroller, but I need your experience. Is there a chance that the atmega32u4(of arduino micro) on my newly made keyboard ,gets overheated so it stops working?
After finishing the build today (and flashing of a gh60 code modification), it worked for 4 hours straight, and then it stopped working. I was getting some kernel messages about the device not accepting address(76 and 78 etc) and continuous connects and disconnects of the device. After leaving the keyboard in front of a fan to cool, and now using it with a fan on it, it's working fine. Mind, the temperature in my room was at 35°C a couple of hours ago. The mictocontroller is glued with hot silicon glue on the plastic case, but in my understanding, it is supposed to help conduct the heat to the case except for keeping it steady.
Was this previously working without issue before you reflashed it?
I did not reflash the firmware. It just stopped responding and worked again without me touching anything. It has now been working again for 3 hours without any issues.
Let's say I've got the spacebar set up with ACTION_LAYER_TAP_KEY(4, KC_SPC), and I leave TAPPING_TERM at its default 200ms. So as a modifier it enables Layer 4, and as a normal key it sends the scancode for Space.
I had expected that pressing it would enable Layer 4 immediately--so that if I held down the spacebar, then 100 milliseconds later pressed the Layer 4 key for F1 (number row 1 key, in my case), it would recognize it as a function action and not a normal keypress. But after some testing, it looks like the spacebar doesn't actually trigger Layer 4 until the 200ms period has occurred.
So if I want to press F1, I have to hold down the spacebar for TAPPING_TERM before pressing the 1 key. So instead of sending the scancode for F1, the keyboard sends the scancodes for 1[space].
This creates a minor issue sometimes if I go too fast while trying to enter SpaceFn key combinations. But as I thought through this, I realized that this is really the only way to do it, because when we type our fingers don't always wait for the previous key to deactuate before actuating the next key (this is the whole premise behind NKRO).
I have a question, not directly related to programming the microcontroller, but I need your experience. Is there a chance that the atmega32u4(of arduino micro) on my newly made keyboard ,gets overheated so it stops working?
After finishing the build today (and flashing of a gh60 code modification), it worked for 4 hours straight, and then it stopped working. I was getting some kernel messages about the device not accepting address(76 and 78 etc) and continuous connects and disconnects of the device. After leaving the keyboard in front of a fan to cool, and now using it with a fan on it, it's working fine. Mind, the temperature in my room was at 35°C a couple of hours ago. The mictocontroller is glued with hot silicon glue on the plastic case, but in my understanding, it is supposed to help conduct the heat to the case except for keeping it steady.
Changing TAPPING_TERM parameter on the fly without compile would be useful when you find your value by trial and error. But I think at most several compile processes are needed to decide your proper value.
For gaming purpose you may want to change layer and use ACTION_LAYER_MOMENTARY() instead of ACTION_LAYER_TAP_KEY(). Even using small value doesn't resolve the tapping limitation essentially for gaming in particular.
I may implement these actions in next refactroing of keymap module but not sure.
The real pain with reflashing firmwares is that you need another keyboard to do it, because once you put the board in bootloader mode, you can't type the shell commands. I don't keep a spare keyboard here at home. I work around this by SSH'ing from my laptop, so not a huge deal but still kind of a pain.
sleep 10; <flashing command>
which will wait for 10 seconds and then execute the flashing command without any keyboard assistance.
I have a question, not directly related to programming the microcontroller, but I need your experience. Is there a chance that the atmega32u4(of arduino micro) on my newly made keyboard ,gets overheated so it stops working?
After finishing the build today (and flashing of a gh60 code modification), it worked for 4 hours straight, and then it stopped working. I was getting some kernel messages about the device not accepting address(76 and 78 etc) and continuous connects and disconnects of the device. After leaving the keyboard in front of a fan to cool, and now using it with a fan on it, it's working fine. Mind, the temperature in my room was at 35°C a couple of hours ago. The mictocontroller is glued with hot silicon glue on the plastic case, but in my understanding, it is supposed to help conduct the heat to the case except for keeping it steady.
Was this previously working without issue before you reflashed it?
I did not reflash the firmware. It just stopped responding and worked again without me touching anything. It has now been working again for 3 hours without any issues.
Okay, sorry, I misunderstood. So you just finished building a new keyboard running on an Arduino Micro, which you've hot-glued to the case? If you've got the chip covered in hot glue that's your issue. Plastic doesn't conduct heat away. You should have that chip uncovered and facing out. Feel free to hot-glue the chip the other way, that shouldn't be an issue. But keep that chip facing the open air (whatever little there may be inside your keyboard.
I have a question, not directly related to programming the microcontroller, but I need your experience. Is there a chance that the atmega32u4(of arduino micro) on my newly made keyboard ,gets overheated so it stops working?
After finishing the build today (and flashing of a gh60 code modification), it worked for 4 hours straight, and then it stopped working. I was getting some kernel messages about the device not accepting address(76 and 78 etc) and continuous connects and disconnects of the device. After leaving the keyboard in front of a fan to cool, and now using it with a fan on it, it's working fine. Mind, the temperature in my room was at 35°C a couple of hours ago. The mictocontroller is glued with hot silicon glue on the plastic case, but in my understanding, it is supposed to help conduct the heat to the case except for keeping it steady.
Was this previously working without issue before you reflashed it?
I did not reflash the firmware. It just stopped responding and worked again without me touching anything. It has now been working again for 3 hours without any issues.
Okay, sorry, I misunderstood. So you just finished building a new keyboard running on an Arduino Micro, which you've hot-glued to the case? If you've got the chip covered in hot glue that's your issue. Plastic doesn't conduct heat away. You should have that chip uncovered and facing out. Feel free to hot-glue the chip the other way, that shouldn't be an issue. But keep that chip facing the open air (whatever little there may be inside your keyboard.
The chip may be making contact with the hot glue, it is hard for me to verify unless i take the whole keyboard apart right now, Still, while the hot glue is in contact with the case, by touch I don't feel irregular heat at the spot. I recompiled and flashed the firmware now, if issues come up again, I'll probably try replacing the glue.
Just added KMAC happy support, made a pull request, and i need someone to test if it still works properly for the tkl models.
BTW, I'll later create a wiki page and organize links to project using TMK by others. I'm doing refactoring of my codes and I basically won't merge projects contributed by others to my repository anymore. I'd want project owners to maintain their project on their own repository now. Of course, pull requests to core library part are welcomed as they were.
https://github.com/tmk/tmk_keyboard/issues/173Just added KMAC happy support, made a pull request, and i need someone to test if it still works properly for the tkl models.
Hey there! I recently built my own 60% keyboard. Your code works excellently, even though I managed to screw up config stuff a few times :p. I have one issue and it's a strange one. My comma key does not work. I've checked to ensure the switch works electrically. And the config seems to be correct in my c files. When I debug the matrix there's nothing showing up. Any ideas why this one key wouldn't be working?
Thanks again!
Thanks for the support.
BTW, I'll later create a wiki page and organize links to project using TMK by others. I'm doing refactoring of my codes and I basically won't merge projects contributed by others to my repository anymore. I'd want project owners to maintain their project on their own repository now. Of course, pull requests to core library part are welcomed as they were.
https://github.com/tmk/tmk_keyboard/issues/173Just added KMAC happy support, made a pull request, and i need someone to test if it still works properly for the tkl models.
Do you think that this is a good idea? I know its hard to maintain everything yourself, but creating a bunch of subprojects with different owners will kill some layouts, like for instance if a owner decides to go afk.
My opinion:
I like the idea to have everything as it is now, instead making contributors to your project, giving frequent contributors, whos opinions you trust write acess.
Keeping everything as it is+ contributors will increase the sense of community that everyone can chip in.
Hey there! I recently built my own 60% keyboard. Your code works excellently, even though I managed to screw up config stuff a few times :p. I have one issue and it's a strange one. My comma key does not work. I've checked to ensure the switch works electrically. And the config seems to be correct in my c files. When I debug the matrix there's nothing showing up. Any ideas why this one key wouldn't be working?
Thanks again!
Did you handwire it or is it your own pcb. please post all information you think might be of help like pictures of the wires/pcb(top and bottom) link to code etc.
hehe its the diode, its turned upside downMr. Upside-down :P first the plate and now diode
hehe its the diode, its turned upside downMr. Upside-down :P first the plate and now diode
hehe its the diode, its turned upside downMr. Upside-down :P first the plate and now diode
im trying to figure out a funny anode side on the cathod side joke, but im drawing blanks!
hehe its the diode, its turned upside downMr. Upside-down :P first the plate and now diode
im trying to figure out a funny anode side on the cathod side joke, but im drawing blanks!
You're f**king kidding me.... I checked EVERYTHING except for the diode fuuuuuuuuuuuu
Thank you guys for your help!
Hi hasu
I noticed today that mbed has come to Teensy 3.1 at long last
https://developer.mbed.org/platforms/teensy-3-1/
Seems like some people are having issues but works fine for me:
https://developer.mbed.org/forum/bugs-suggestions/topic/4671/?page=2
Do you think the mbed port of TMK could be made to work with this? If so, what steps do you think that I would need to do to test this? I'm not very familiar with mbed... if it is as simple as updating to the latest version of their abstraction libraries I can definitely give that a short. I'd prefer to use Teensy 3.1 for my next project if possible
(BTW - I made some gluecode for using your firmware with bpiphany's costar controllers... I know TMK is already ported to a couple of his boards but this code should be usable for all of them - https://github.com/bgould/costar_tmk_keyboard)
Hey everyone, I have been playing with hasu's controller in my hhkb and it's been awesome. I can make the keys do anything I want, except for one thing:
Is there a way to use a function key in a macro? For example:
I define FN5 to be a toggle to layer 4. I want to create a macro that taps FN5, and then does CTRL+SPACE right after.
What I have found is that nothing happens in the part of the macro that taps FN5, while the CTRL+SPACE part works fine.
Does anyone know how to do what I'm describing?
Hey everyone, I have been playing with hasu's controller in my hhkb and it's been awesome. I can make the keys do anything I want, except for one thing:
Is there a way to use a function key in a macro? For example:
I define FN5 to be a toggle to layer 4. I want to create a macro that taps FN5, and then does CTRL+SPACE right after.
What I have found is that nothing happens in the part of the macro that taps FN5, while the CTRL+SPACE part works fine.
Does anyone know how to do what I'm describing?
Quick question does tmk detect when a computer is turned off and go into a power saving mode that turns off things like the backlight? I'm wondering because I used that forked tmk with layer indicator LEDs and noticed the layer indicator stays on and I can even change layers to turn it on hand off with the computer off which is something I didn't expect lol.
You can't use FN key in your macro definition and you cannot define what you want with current TMK macro unfortunately.
You'll have to define 'action_function()' to realize it but documentation is sparse as always.
https://github.com/tmk/tmk_keyboard/blob/master/doc/keymap.md#24-function-actionHey everyone, I have been playing with hasu's controller in my hhkb and it's been awesome. I can make the keys do anything I want, except for one thing:
Is there a way to use a function key in a macro? For example:
I define FN5 to be a toggle to layer 4. I want to create a macro that taps FN5, and then does CTRL+SPACE right after.
What I have found is that nothing happens in the part of the macro that taps FN5, while the CTRL+SPACE part works fine.
Does anyone know how to do what I'm describing?
...I'm wondering because I used that forked tmk with layer indicator LEDs...
...I'm wondering because I used that forked tmk with layer indicator LEDs...
I haven't been able to find a way to handle layer indicator LEDs but would love one on my current build. Can you point me to this fork?
@hasu is there any plan to implement this type of functionality? It seems like it would be appreciated by many.
Probably you can add your code in common/action_layer.c. All layer change actions should be occured in static void default_layer_state_set(uint32_t state). See this PR. https://github.com/tmk/tmk_keyboard/pull/198
Or also you can define action_function() that changes layer and handles indicator at the same time in your keymap file.
Is there a way to change mouse key behavior? I prefer to have the cursor move at constant speed when holding down the key, and move faster when double or triple tap on the key.
I think you can base on infinity project codes to start your project. Because Inifinity is not supported in mbed I had to overwrite some mbed codes and create linker script for Infinity myself. Those files located in keyboard/infinity/mbed-infinity/ directory and you can ignore them if Teensy 3.1 is supported in mbed. You will be able to use mbed's linker script and wont' need to change any mbed code.
I don't think I can explain it enough here, feel free to ask :D
...I'm wondering because I used that forked tmk with layer indicator LEDs...
I haven't been able to find a way to handle layer indicator LEDs but would love one on my current build. Can you point me to this fork?
@hasu is there any plan to implement this type of functionality? It seems like it would be appreciated by many.
hasu pointed me to the fork a page or so back
but here is a direct link to the fork https://github.com/jonhiggs/tmk_keyboard and the link below kind of tells you how to do it with this forked tmk build
Probably you can add your code in common/action_layer.c. All layer change actions should be occured in static void default_layer_state_set(uint32_t state). See this PR. https://github.com/tmk/tmk_keyboard/pull/198
Or also you can define action_function() that changes layer and handles indicator at the same time in your keymap file.
#endif
default:
break;
}
}
/*
* Utilities for actions.
*/
#endif
default:
break;
}
#ifndef NO_ACTION_LAYER
// if this event is a layer action, update the leds
switch (action.kind.id) {
case ACT_LAYER:
#ifndef NO_ACTION_TAPPING
case ACT_LAYER_TAP:
case ACT_LAYER_TAP_EXT:
#endif
led_set(host_keyboard_leds());
break;
default:
break;
}
#endif
}
/*
* Utilities for actions.
*/
if (layer_state & (1<<3)) { // layer 3 is active
// turn LED on here
} else {
// turn LED off here
}
if (biton32(layer_state) == 4) { // layer 4 is the highest active layer
// turn LED on here
} else {
// turn LED off here
}
Awesome, I'll have to try that out too when I get a chance. Thanks for the code examples....I'm wondering because I used that forked tmk with layer indicator LEDs...
I haven't been able to find a way to handle layer indicator LEDs but would love one on my current build. Can you point me to this fork?
@hasu is there any plan to implement this type of functionality? It seems like it would be appreciated by many.
hasu pointed me to the fork a page or so back
but here is a direct link to the fork https://github.com/jonhiggs/tmk_keyboard and the link below kind of tells you how to do it with this forked tmk build
Probably you can add your code in common/action_layer.c. All layer change actions should be occured in static void default_layer_state_set(uint32_t state). See this PR. https://github.com/tmk/tmk_keyboard/pull/198
Or also you can define action_function() that changes layer and handles indicator at the same time in your keymap file.
FWIW, here's what I did to get LED layer indicators working on tmk.MoreEdit tmk_core/common/action.c and find this section:Code: [Select]#endif
default:
break;
}
}
/*
* Utilities for actions.
*/
Place this piece of code in there so it ends up like this:Code: [Select]#endif
default:
break;
}
#ifndef NO_ACTION_LAYER
// if this event is a layer action, update the leds
switch (action.kind.id) {
case ACT_LAYER:
#ifndef NO_ACTION_TAPPING
case ACT_LAYER_TAP:
case ACT_LAYER_TAP_EXT:
#endif
led_set(host_keyboard_leds());
break;
default:
break;
}
#endif
}
/*
* Utilities for actions.
*/
Then you can edit led_set function in led.c for your board and use checks like these to decide which LEDs to turn on.
Don't forget to #include action_layer.h in led.c as well.Code: [Select]
if (layer_state & (1<<3)) { // layer 3 is active
// turn LED on here
} else {
// turn LED off here
}
if (biton32(layer_state) == 4) { // layer 4 is the highest active layer
// turn LED on here
} else {
// turn LED off here
}
This solution is not as neat as Jon Higgs', but it allows access to both usb_led and layer_state vars in led.c, to change status LEDs depending on which layers are active.
../../tmk_core/protocol/lufa/lufa.c: warning: implicit declaration of function clock_prescale_set
../../tmk_core/protocol/lufa/lufa.c: error: clock_div_1 undeclared
static void setup_mcu(void)
{
/* Disable watchdog if enabled by bootloader/fuses */
MCUSR &= ~(1 << WDRF);
wdt_disable();
/* Disable clock division */
clock_prescale_set(clock_div_1);
}
Just downloaded the latest TMK .zip from GitHub, have programmed a keymap file for the alps64 board ... when when I say to 'make' it, I get these errors:Code: [Select]../../tmk_core/protocol/lufa/lufa.c: warning: implicit declaration of function clock_prescale_set
../../tmk_core/protocol/lufa/lufa.c: error: clock_div_1 undeclared
and looking at lufa.c, I find this sequence:Code: [Select]static void setup_mcu(void)
{
/* Disable watchdog if enabled by bootloader/fuses */
MCUSR &= ~(1 << WDRF);
wdt_disable();
/* Disable clock division */
clock_prescale_set(clock_div_1);
}
Which is the only place that clock_div_1 shows up at all ... and I think I'm at a loss at this point.
edit: Going into another directory (kmac in this case) and issuing : make -f Makefile.lufa produces files, not errors. But both of the other keymap files in the alps64 directory yield the same error about setup_mcu.
DoubleEdit: if I arbitrarily set the MCU in the makefile to be the ever popular 32u4, it compiles fine.
But that's not what's on this board, I assume, so ...?
Thank you for sharing! This config works great! BTW I am also a Vim user ;DIs there a way to change mouse key behavior? I prefer to have the cursor move at constant speed when holding down the key, and move faster when double or triple tap on the key.
For sure you can change the mousekey constants in your config.h file by adding some #defines to override this constants:
https://github.com/tmk/tmk_keyboard/blob/master/tmk_core/common/mousekey.h#L25-L52
As far as the behavior you're describing, you probably could acheive something like that with an action fuction but it would most likely take a bit of effort to get working just right.
These are the mousekey constants that I use these days and I think they give decent results for both speed and precision:
/* faster mousekeys than the default */
#define MOUSEKEY_MOVE_DELTA 3
#define MOUSEKEY_WHEEL_DELTA 1
#define MOUSEKEY_DELAY 0
#define MOUSEKEY_INTERVAL 20
#define MOUSEKEY_MAX_SPEED 10
#define MOUSEKEY_TIME_TO_MAX 20
#define MOUSEKEY_WHEEL_MAX_SPEED 16
#define MOUSEKEY_WHEEL_TIME_TO_MAX 40
../../tmk_core/tool/mbed/common.mk:28: *** Not Supported. Stop.
AKmalamute, it seems like your AVR libc is too old to build firmware for the controller. Try update to the latest one.
It hasn't updated since 2010.
Is Boot Magic supposed to work on the Infinity? When I comment out BOOTMAGIC_ENABLE = yes, I get the following error while running make clean:Not supported atm.Code: [Select]../../tmk_core/tool/mbed/common.mk:28: *** Not Supported. Stop.
Any ideas?
And you may be able to use keycodes KC_MS_ACCEL0,1,2. Those keys provides fixed speed of mouse cursor during they are hold down. This is not exactly what you want though.Thank you for sharing! This config works great! BTW I am also a Vim user ;DIs there a way to change mouse key behavior? I prefer to have the cursor move at constant speed when holding down the key, and move faster when double or triple tap on the key.
For sure you can change the mousekey constants in your config.h file by adding some #defines to override this constants:
https://github.com/tmk/tmk_keyboard/blob/master/tmk_core/common/mousekey.h#L25-L52
As far as the behavior you're describing, you probably could acheive something like that with an action fuction but it would most likely take a bit of effort to get working just right.
These are the mousekey constants that I use these days and I think they give decent results for both speed and precision:
/* faster mousekeys than the default */
#define MOUSEKEY_MOVE_DELTA 3
#define MOUSEKEY_WHEEL_DELTA 1
#define MOUSEKEY_DELAY 0
#define MOUSEKEY_INTERVAL 20
#define MOUSEKEY_MAX_SPEED 10
#define MOUSEKEY_TIME_TO_MAX 20
#define MOUSEKEY_WHEEL_MAX_SPEED 16
#define MOUSEKEY_WHEEL_TIME_TO_MAX 40
Is Boot Magic supposed to work on the Infinity? When I comment out BOOTMAGIC_ENABLE = yes, I get the following error while running make clean:Not supported atm.Code: [Select]../../tmk_core/tool/mbed/common.mk:28: *** Not Supported. Stop.
Any ideas?
Cortex/mbed port is still on preliminary stage, media keys, mouse keys and etc. ain't supported also.
But I hope I can take time to implement those functions before so long. Or if someone can contribute it would be great.
Next step was a buncha reboots because I've never attached a 32u2 to my system and every time I'd plug my ergodox back in, none of the keys would do anything sensible. Got ahold of a open-source libUSB .inf generator, and ... tried to use teensy.exe. Oops.
I'm going to bed so it'll be a day before we can talk about what I screwed up, but I've defined three FN keys, all on the default layer. One is supposed to go to the next layer with F-keys, navigation, etc. One is a dual-function Fn0 / enter key ... the last has some more experimental stuff like mouse controls.
The mouse controls layer is determined to be default. I don't have a way to switch out because it's not supposed to come up except as a momentary switch off a key in the actual default layer. But the few TRNS keys are going to the letter row, so I get a few numbers about that's close to it.
Grr ... why did I start doing this, again?
keymap_poker.c:13:55: error: macro "KEYMAP" passed 45 arguments, but takes just 44
keymap_poker.c:10: error: expected '}' before 'KEYMAP'
make: *** [obj_gh60_lufa/keymap_poker.o] Error 1
#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, ENT,
FN1, LSFT, Z, X, C, V, B, N, M, COMM, DOT, LSFT,
LCTL, LALT, PAUSE, FN2, SPC, FN1, COPY, PASTE, UNDO)
/* 1: FN 1 */
KEYMAP(TRNS, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, DEL,
TRNS, VOLUP, VOLDOWN, MUTE, TRNS, LBRC, RBRC, BSLS, MINS, EQL, TRNS,
TRNS, TRNS, TRNS, TRNS, TRNS, GRAVE, SCLN, QUOT, SLSH, HOME, PGUP, TRNS,
TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, END, PGDN, TRNS,)
/* 2: FN 2 */
KEYMAP(TRNS, F1, F2, F3, F4, F5, F6, F7, F8, F9, F0, TRNS,
TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS,
TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, UP, TRNS,
TRNS, LGUI, TRNS, TRNS, TRNS, TRNS, LEFT, DOWN, RGHT)
};
const uint16_t PROGMEM fn_actions[] = {
- = ACTION_LAYER_MOMENTARY(1),
};
/* 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, \
K10, K11, K12, K13, K14, K15, K16, K18, K19, K1A, K1B, \
K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, \
K30, K31, K32, K34, K35, K38, K39, K3A, K3B \
) { \
{ 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_##K10, KC_##K11, KC_##K12, KC_##K13, KC_##K14, KC_##K15, KC_##K16, KC_NO, KC_##K18, KC_##K19, KC_##K1A, KC_##K1B }, \
{ 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_##K30, KC_##K31, KC_##K32, KC_NO, KC_##K34, KC_##K35, KC_NO, KC_NO, KC_##K38, KC_##K39, KC_##K3A, KC_##K3B }, \
}