This post has been de-listed
It is no longer included in search results and normal feeds (front page, hot posts, subreddit posts, etc). It remains visible only via the author's post history.
Hi all,
I have a redox keyboard and I'm trying to setup QMK. I have basic functionality working, but I'm trying to achieve the following :
- Use a key to act as a layer modifier on hold, and use the same key to toggle to a new layer when tapped.
- I'd like to send the "c" keycode when a tap a key, and send the "รง" keycode when I hold the same key. I've tried adding this function to keymap.c
#define TAPPING_TERM 200
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
switch (keycode) {
case FOO:
if (record->tap.count && record->event.pressed) {
tap_code16(FR_CCED);
} else if (record->event.pressed) {
tap_code16(FR_C);
}
return false;
}
return true;
}
When I hit "c", I get the letter as expected, but nothing happens when I hold the same key.
What am I doing wrong?
Thanks
EDIT : Got it working! Thanks for everyone's help.
1) I used tapping toggle (TT) to get QMK to change layer whilst holding a key, and toggle to a layer when tapping the same key. To get this to work properly, I had to set "#define TAPPING_TOGGLE 1" in config.h because the default value is 5 taps to toggle to another layer, and set KC_TRNS in the same key location on the toggle destination layer as the original layer, so that tapping the same key brings you back to the original one correctly.
2) Followed the example code here : https://getreuer.info/posts/keyboards/triggers/index.html#tap-vs.-long-press
#define CUST_TAP_MOD_C LT(0, FR_C)
static bool process_tap_or_long_press_key(
keyrecord_t* record, uint16_t long_press_keycode) {
if (record->tap.count == 0) { // Key is being held.
if (record->event.pressed) {
tap_code16(long_press_keycode);
}
return false; // Skip default handling.
}
return true; // Continue default handling.
}
bool process_record_user(uint16_t keycode, keyrecord_t* record) {
switch (keycode) {
case CUST_TAP_MOD_C: // C on tap, รง on hold
return process_tap_or_long_press_key(record, FR_CCED);
}
return true;
}
Subreddit
Post Details
- Posted
- 2 years ago
- Reddit URL
- View post on reddit.com
- External URL
- reddit.com/r/ErgoMechKey...