1
0
Fork 0

Compare commits

..

3 commits

Author SHA1 Message Date
4d863ed6c5 Arreglar layout 2022-04-03 12:20:19 -03:00
26db839319 Cambiar settings modtap 2022-04-03 12:19:51 -03:00
d2639547d8 Revert "Revert "Revert "Callum based"""
This reverts commit 76f68a57e0.
2022-03-31 18:59:57 -03:00
5 changed files with 36 additions and 182 deletions

View file

@ -44,6 +44,11 @@
/* Locking resynchronize hack */ /* Locking resynchronize hack */
//#define LOCKING_RESYNC_ENABLE //#define LOCKING_RESYNC_ENABLE
#undef TAPPING_TERM
#define TAPPING_TERM 200
#define IGNORE_MOD_TAP_INTERRUPT
#define PERMISSIVE_HOLD
/* /*
* Feature disable options * Feature disable options
* These options are also useful to firmware size reduction. * These options are also useful to firmware size reduction.

View file

@ -1,9 +1,28 @@
// this is the style you want to emulate.
// This is the canonical layout file for the Quantum project. If you want to add another keyboard,
#include QMK_KEYBOARD_H #include QMK_KEYBOARD_H
#include "oneshot.h" #undef S
#undef A
#undef C
#undef G
#define LA_SYM MO(SYM) #define S LSFT_T
#define LA_NAV MO(NAV) #define A LALT_T
#define C LCTL_T
#define G LGUI_T
#define R RALT_T
#define RALT_A RALT_T(KC_A)
#define ALT_S LALT_T(KC_S)
#define CTL_D LCTL_T(KC_D)
#define GUI_F LGUI_T(KC_F)
#define GUI_J LGUI_T(KC_J)
#define CTL_K LCTL_T(KC_K)
#define ALT_L LALT_T(KC_L)
#define RALT_SCLN RALT_T(KC_SCLN)
#define MUTE LGUI(KC_C) #define MUTE LGUI(KC_C)
@ -14,102 +33,39 @@ enum layers {
NUM, NUM,
}; };
enum keycodes { #define LA_SYM MO(SYM)
// Custom oneshot mod implementation with no timers. #define LA_NAV MO(NAV)
OS_SHFT = SAFE_RANGE,
OS_CTRL,
OS_ALT,
OS_CMD,
OS_RALT,
};
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[DEF] = LAYOU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E,KC_AT, KC_SLSH,KC_PERC,XXXXXXX,XXXXXXX,KC_AMPR,KC_BSLS,RALT(KC_SLSH),KC_QUES,KC_EXLM,
XXXXXXX,XXXXXXX,XXXXXXX,_______,_______,XXXXXXX,XXXXXXX,_______,_______,XXXXXXX,XXXXXXX,XXXXXXX XXXXXXX,XXXXXXX,XXXXXXX,_______,_______,XXXXXXX,XXXXXXX,_______,_______,XXXXXXX,XXXXXXX,XXXXXXX
), ),
[NAV] = LAYOUT( [NAV] = LAYOUT(
KC_TAB, XXXXXXX,KC_VOLU,KC_VOLD,MUTE, RESET, KC_CAPS,XXXXXXX,XXXXXXX,XXXXXXX, KC_TAB, XXXXXXX,KC_VOLU,KC_VOLD,MUTE, XXXXXXX,KC_CAPS,XXXXXXX,XXXXXXX,RESET,
OS_SHFT,OS_ALT, OS_CTRL,OS_CMD, KC_BSPC, KC_LEFT,KC_DOWN,KC_UP, KC_RGHT,XXXXXXX, S(KC_NO),A(KC_NO),C(KC_NO),G(KC_NO),KC_BSPC, KC_LEFT,KC_DOWN,KC_UP, KC_RGHT,XXXXXXX,
XXXXXXX,XXXXXXX,OS_RALT,XXXXXXX,KC_PSCR,XXXXXXX,XXXXXXX,XXXXXXX,KC_PGDN,KC_PGUP,XXXXXXX,KC_ENT, XXXXXXX,XXXXXXX,XXXXXXX,XXXXXXX,KC_PSCR,XXXXXXX,XXXXXXX,XXXXXXX,KC_PGDN,KC_PGUP,XXXXXXX,KC_ENT,
XXXXXXX,XXXXXXX,XXXXXXX,_______,_______,XXXXXXX,XXXXXXX,_______,_______,XXXXXXX,XXXXXXX,XXXXXXX XXXXXXX,XXXXXXX,XXXXXXX,_______,_______,XXXXXXX,XXXXXXX,_______,_______,XXXXXXX,XXXXXXX,XXXXXXX
), ),
[NUM] = LAYOUT( [NUM] = LAYOUT(
KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0,
OS_SHFT,OS_ALT, OS_CTRL,OS_CMD, KC_F11, KC_F12, OS_CMD, OS_CTRL,OS_ALT, OS_SHFT, S(KC_NO),A(KC_NO),C(KC_NO),G(KC_NO),R(KC_F11), R(KC_F12),G(KC_NO),C(KC_NO),A(KC_NO),S(KC_NO),
KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, XXXXXXX,XXXXXXX,KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, XXXXXXX,XXXXXXX,KC_F6, KC_F7, KC_F8, KC_F9, KC_F10,
XXXXXXX,XXXXXXX,XXXXXXX,_______,_______,XXXXXXX,XXXXXXX,_______,_______,XXXXXXX,XXXXXXX,XXXXXXX XXXXXXX,XXXXXXX,XXXXXXX,_______,_______,XXXXXXX,XXXXXXX,_______,_______,XXXXXXX,XXXXXXX,XXXXXXX
) )
}; };
bool is_oneshot_cancel_key(uint16_t keycode) {
switch (keycode) {
case LA_SYM:
case LA_NAV:
return true;
default:
return false;
}
}
bool is_oneshot_ignored_key(uint16_t keycode) {
switch (keycode) {
case LA_SYM:
case LA_NAV:
case KC_LSFT:
case OS_SHFT:
case OS_CTRL:
case OS_ALT:
case OS_RALT:
case OS_CMD:
return true;
default:
return false;
}
}
oneshot_state os_shft_state = os_up_unqueued;
oneshot_state os_ctrl_state = os_up_unqueued;
oneshot_state os_alt_state = os_up_unqueued;
oneshot_state os_cmd_state = os_up_unqueued;
oneshot_state os_ralt_state = os_up_unqueued;
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
update_oneshot(
&os_shft_state, KC_LSFT, OS_SHFT,
keycode, record
);
update_oneshot(
&os_ctrl_state, KC_LCTL, OS_CTRL,
keycode, record
);
update_oneshot(
&os_alt_state, KC_LALT, OS_ALT,
keycode, record
);
update_oneshot(
&os_cmd_state, KC_LCMD, OS_CMD,
keycode, record
);
update_oneshot(
&os_ralt_state, KC_RALT, OS_RALT,
keycode, record
);
return true;
}
layer_state_t layer_state_set_user(layer_state_t state) { layer_state_t layer_state_set_user(layer_state_t state) {
return update_tri_layer_state(state, SYM, NAV, NUM); return update_tri_layer_state(state, SYM, NAV, NUM);
} }

View file

@ -1,72 +0,0 @@
#include "oneshot.h"
// https://github.com/daliusd/qmk_firmware/blob/daliusd-redox/keyboards/ferris/keymaps/daliusd/oneshot.c
void update_oneshot(
oneshot_state *state,
uint16_t mod,
uint16_t trigger,
uint16_t keycode,
keyrecord_t *record
) {
if (keycode == trigger) {
if (record->event.pressed) {
// Trigger keydown
if (*state == os_up_unqueued) {
register_code(mod);
}
*state = os_down_unused;
} else {
// Trigger keyup
switch (*state) {
case os_down_unused:
// If we didn't use the mod while trigger was held, queue it.
*state = os_up_queued;
break;
case os_down_used:
// If we did use the mod while trigger was held, unregister it.
*state = os_up_unqueued;
unregister_code(mod);
break;
default:
break;
}
}
} else {
if (record->event.pressed) {
if (is_oneshot_cancel_key(keycode) && *state != os_up_unqueued) {
// Cancel oneshot on designated cancel keydown.
*state = os_up_unqueued;
unregister_code(mod);
}
if (!is_oneshot_ignored_key(keycode)) {
switch (*state) {
case os_down_unused:
*state = os_down_used;
break;
case os_up_used:
*state = os_up_unqueued;
unregister_code(mod);
break;
case os_up_queued:
*state = os_up_used;
break;
default:
break;
}
}
} else {
if (!is_oneshot_ignored_key(keycode)) {
// On non-ignored keyup, consider the oneshot used.
switch (*state) {
case os_up_used:
*state = os_up_unqueued;
unregister_code(mod);
break;
default:
break;
}
}
}
}
}

View file

@ -1,32 +0,0 @@
#pragma once
#include QMK_KEYBOARD_H
// Represents the four states a oneshot key can be in
typedef enum {
os_up_unqueued,
os_up_queued,
os_up_used,
os_down_unused,
os_down_used,
} oneshot_state;
// Custom oneshot mod implementation that doesn't rely on timers. If a mod is
// used while it is held it will be unregistered on keyup as normal, otherwise
// it will be queued and only released after the next non-mod keyup.
void update_oneshot(
oneshot_state *state,
uint16_t mod,
uint16_t trigger,
uint16_t keycode,
keyrecord_t *record
);
// To be implemented by the consumer. Defines keys to cancel oneshot mods.
bool is_oneshot_cancel_key(uint16_t keycode);
// To be implemented by the consumer. Defines keys to ignore when determining
// whether a oneshot mod has been used. Setting this to modifiers and layer
// change keys allows stacking multiple oneshot modifiers, and carrying them
// between layers.
bool is_oneshot_ignored_key(uint16_t keycode);

View file

@ -1,3 +0,0 @@
RGBLIGHT_ENABLE = no
SRC += oneshot.c