qmk

Unnamed repository; edit this file 'description' to name the repository.
git clone git://git.z3bra.org/qmk.git
Log | Files | Refs | Submodules | LICENSE

commit c4679ed32e43fb46bf780f85e61db4bb474a1fcf
parent 1534e7f2c2eae8c6c91975443427d378d68ded92
Author: z3bra <dev@z3bra.org>
Date:   Sat, 31 Aug 2019 23:23:56 +0200

Reach numbers from symbol layer

Diffstat:
keyboards/planck/keymaps/z3bra/config.h | 35+++++------------------------------
keyboards/planck/keymaps/z3bra/keymap.c | 270++++++++++++++------------------------------------------------------------------
keyboards/planck/keymaps/z3bra/keymap_afnor.h | 6+++---
keyboards/planck/keymaps/z3bra/readme.md | 2--
keyboards/planck/keymaps/z3bra/rules.mk | 3---
5 files changed, 53 insertions(+), 263 deletions(-)

diff --git a/keyboards/planck/keymaps/z3bra/config.h b/keyboards/planck/keymaps/z3bra/config.h @@ -1,39 +1,14 @@ #pragma once -#ifdef AUDIO_ENABLE - #define STARTUP_SONG SONG(PLANCK_SOUND) - // #define STARTUP_SONG SONG(NO_SOUND) - #define DEFAULT_LAYER_SONGS { SONG(QWERTY_SOUND), \ - SONG(COLEMAK_SOUND), \ +#define DEFAULT_LAYER_SONGS { SONG(QWERTY_SOUND), \ + SONG(COLEMAK_SOUND), \ SONG(DVORAK_SOUND) \ } -#endif -/* - * MIDI options - */ - -/* Prevent use of disabled MIDI features in the keymap */ -//#define MIDI_ENABLE_STRICT 1 - -/* enable basic MIDI features: - - MIDI notes can be sent when in Music mode is on -*/ +#define STARTUP_SONG SONG(PLANCK_SOUND) #define MIDI_BASIC - -/* enable advanced MIDI features: - - MIDI notes can be added to the keymap - - Octave shift and transpose - - Virtual sustain, portamento, and modulation wheel - - etc. -*/ -//#define MIDI_ADVANCED - -/* override number of MIDI tone keycodes (each octave adds 12 keycodes and allocates 12 bytes) */ -//#define MIDI_TONE_KEYCODE_OCTAVES 2 - -// Most tactile encoders have detents every 4 stages -#define ENCODER_RESOLUTION 4 +#define AUDIO_CLICKY +#define TAPPING_TOGGLE 2 diff --git a/keyboards/planck/keymaps/z3bra/keymap.c b/keyboards/planck/keymaps/z3bra/keymap.c @@ -18,278 +18,98 @@ #include "muse.h" #include "keymap_afnor.h" +#define PASTE S(KC_INSERT) +#define ADJUST MO(_ADJUST) +#define RAISE LT(_RAISE, KC_ENTER) +#define SYMBOL LT(_SYMBOL, KC_SPACE) +#define LT_SLSH LT(_ARROW, FR_SLSH) + +#define MT_LCXC MT(MOD_LCTL, KC_ESC) +#define MT_RSEN MT(MOD_RSFT, KC_ENT) + enum planck_layers { _AZERTY, - _LOWER, + _SYMBOL, _RAISE, _ARROW, _ADJUST, - _META, -}; - -enum planck_keycodes { - LOWER = SAFE_RANGE, /* hacking */ - RAISE, /* symbols */ - ARROW, /* arrows */ }; extern keymap_config_t keymap_config; const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { - - /* - * azerty (see also https://norme-azerty.fr) - * + * azerty (afnor) + * ------ * tab a z e r t y u i o p - * ctl q s d f g h j k l m / * sft w x c v b n . , : ; sft - * ⇌ < gui alt ⇑ spc spc ⇓ alt hyp app ent + * ⇑ gui alt bsp ⇓ ⇓ ret agr gui ___ ⇑ */ [_AZERTY] = LAYOUT_planck_grid( - KC_TAB, FR_A, FR_Z, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, FR_MINS, - C(KC_ESC), FR_Q, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, FR_M, FR_SLSH, - KC_LSFT, FR_W, KC_X, KC_C, KC_V, KC_B, KC_N, FR_DOT, FR_COMM, FR_COLN, FR_SCLN, KC_RSFT, - ARROW, FR_LESS, KC_LGUI, KC_LALT, LOWER, KC_SPC, KC_SPC, RAISE, KC_RALT, KC_HYPR, KC_APP, KC_ENT + KC_TAB , FR_A, FR_Z, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, FR_MINS, + MT_LCXC, FR_Q, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, FR_M, LT_SLSH, + KC_LSFT, FR_W, KC_X, KC_C, KC_V, KC_B, KC_N, FR_DOT , FR_COMM, FR_COLN, FR_SCLN, KC_RSFT, + ADJUST , KC_LCTL, KC_LGUI, KC_LALT, KC_BSPC, SYMBOL , SYMBOL , KC_ENT , KC_ALGR, KC_RGUI, PASTE , ADJUST ), - /* * lower (symbol) * ----- - * @ à é è ê ( ) ‘ ’ « » ' - * ___ 1 2 3 4 5 6 7 8 9 0 + - * ___ XXX XXX XXX XXX XXX XXX XXX XXX * ^ ___ - * ___ ___ ___ ___ ___ del del ⇑ ___ ___ ___ ___ + * @ à é è ê ( ) ' " ` % ___ + * ___ + ^ $ & [ ] * _ | ~ \ + * ___ < > ç #  { } ? ! … = ⇌ + * ___ ___ ___ ___ del ⇑ ⇑ ___ ___ ___ ___ ___ */ -[_RAISE] = LAYOUT_planck_grid( - FR_AT, FR_AGRV, FR_EACU, FR_EGRV, FR_ECIR, FR_LPRN, FR_RPRN, FR_LAPO, FR_RAPO, FR_LGMT, FR_RGMT, FR_APOS, - _______, FR_1, FR_2, FR_3, FR_4, FR_5, FR_6, FR_7, FR_8, FR_9, FR_0, FR_PLUS, - _______, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, FR_ASTR, FR_CIRC, _______, - _______, _______, _______, _______, _______, KC_DEL, KC_DEL, _______, _______, _______, _______, _______ +[_SYMBOL] = LAYOUT_planck_grid( + FR_AT , FR_AGRV, FR_EACU, FR_EGRV, FR_ECIR, FR_LPRN, FR_RPRN, FR_APOS, FR_QUOT, FR_GRV , FR_PERC, _______, + _______, FR_PLUS, FR_CIRC, FR_DLR , FR_AMP , FR_LBRC, FR_RBRC, FR_ASTR, FR_UNDS, FR_PIPE, FR_TILD, FR_BSLS, + _______, FR_LESS, FR_GRTR, FR_CCED, FR_HASH, FR_LCBR, FR_RCBR, FR_QUES, FR_EXLM, FR_ELPS, FR_EQL , _______, + _______, _______, _______, _______, KC_DEL , RAISE , RAISE , _______, _______, _______, _______, _______ ), /* - * lower (hacking) + * raise (numbers) * ----- * ___ 1 2 3 4 5 6 7 8 9 0 ___ - * ___ _ @ % * & | ' " # ` ___ - * ___ srq = + ^ $ ~ - * ___ ___ ___ ___ ⇓ bsp bsp ___ ___ ___ ___ ___ + * ___ XXX XXX XXX XXX XXX XXX 4 5 6 ___ ___ + * ___ XXX XXX XXX XXX XXX XXX 1 2 3 ___ ___ + * ___ ___ ___ ___ ___ ___ ___ 0 : . ___ ___ */ -[_LOWER] = LAYOUT_planck_grid( - _______, FR_1, FR_2, FR_3, FR_4, FR_5, FR_6, FR_7, FR_8, FR_9, FR_0, _______, - _______, FR_UNDS, FR_AT, FR_PERC, FR_ASTR, FR_AMP, FR_PIPE, FR_APOS, FR_QUOT, FR_HASH, FR_GRV, _______, - _______, KC_SYSREQ, FR_EQL, FR_PLUS, FR_CIRC, FR_DLR, FR_TILD, _______, _______, _______, _______, _______, - _______, _______, _______, _______, _______, KC_BSPC, KC_BSPC, _______, _______, _______, _______, _______ +[_RAISE] = LAYOUT_planck_grid( + _______, FR_1 , FR_2 , FR_3 , FR_4 , FR_5 , FR_6 , FR_7 , FR_8 , FR_9 , FR_0 , _______, + _______, FR_A , KC_B , KC_C , KC_D , KC_E , KC_F , FR_4 , FR_5 , FR_6 , _______, _______, + _______, _______, _______, _______, _______, _______, _______, FR_1 , FR_2 , FR_3 , _______, _______, + _______, _______, _______, _______, _______, _______, _______, FR_0 , FR_0 , FR_DOT , _______, _______ ), + /* * navigate * -------- - * ___ XXX XXX XXX XXX XXX hom pdn pup end XXX XXX - * ___ XXX XXX XXX XXX XXX ← ↓ ↑ → XXX XXX + * ___ XXX XXX XXX XXX XXX ⇱ ⇟ ⇞ ⇲ XXX XXX + * ___ XXX XXX XXX XXX XXX ← ↓ ↑ → XXX ⇌ * ___ XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX ___ - * ⇌ ___ ___ ___ ___ ins ins ___ ___ ___ ___ ___ + * ___ ___ ___ ___ ___ ___ ___ ___ ___ ___ ___ ___ */ [_ARROW] = LAYOUT_planck_grid( _______, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_HOME, KC_PGDN, KC_PGUP, KC_END, XXXXXXX, XXXXXXX, - _______, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, XXXXXXX, XXXXXXX, + _______, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, XXXXXXX, _______, _______, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, _______, - _______, _______, _______, _______, _______, KC_INS, KC_INS, _______, _______, _______, _______, _______ + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ ), - - - - /* - * adjust (lower + raise) + * adjust * ------ - * ___ F1 F2 F3 F4 F5 F6 XXX XXX XXX XXX vup - * ___ F7 F8 F9 F10 F11 F12 XXX prv ply nxt vdn - * ___ XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX ___ - * ___ ___ ___ ___ ⇑ ___ ___ ⇓ ___ ___ ___ ___ */ [_ADJUST] = LAYOUT_planck_grid( - _______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_VOLU, - _______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, XXXXXXX, KC_MPRV, KC_MPLY, KC_MNXT, KC_VOLD, - _______, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, _______, - _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ -), - - - -/* - * meta (navig + raise) - * ---- - * ___ F1 F2 F3 F4 F5 F6 XXX XXX XXX XXX vup - * ___ F7 F8 F9 F10 F11 F12 XXX prv ply nxt vdn - * ___ XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX ___ - * ___ ___ ___ ___ ⇑ ___ ___ ⇓ ___ ___ ___ ___ - */ -[_META] = LAYOUT_planck_grid( - _______, RESET, DEBUG, RGB_TOG, RGB_MOD, RGB_HUI, RGB_HUD, RGB_SAI, RGB_SAD, RGB_VAI, RGB_VAD, XXXXXXX, - _______, XXXXXXX, MU_MOD, AU_ON, AU_OFF, AG_NORM, AG_SWAP, TERM_ON, TERM_OFF, XXXXXXX, XXXXXXX, XXXXXXX, - _______, XXXXXXX, MUV_DE, MUV_IN, MU_ON, MU_OFF, MI_ON, MI_OFF, XXXXXXX, XXXXXXX, XXXXXXX, _______, - _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ -), - -/* - * -[_BLANK] = LAYOUT_planck_grid( - _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, - _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, - _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + RESET , KC_F1 , KC_F2 , KC_F3 , KC_F4 , KC_F5 , KC_F6 , KC_F7 , KC_F8 , KC_F9 , KC_F10 , KC_VOLU, + _______, KC_F11 , KC_F12 , KC_F13 , KC_F14 , KC_F15 , KC_F16 , KC_F17 , KC_F18 , KC_F19 , KC_F20 , KC_VOLD, + _______, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, MU_TOG, CK_TOGG, AU_TOG, XXXXXXX, XXXXXXX, XXXXXXX, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ ), - */ - - - -}; - - -uint32_t -layer_state_set_user(uint32_t state) { - state = update_tri_layer_state(state, _LOWER, _RAISE, _ADJUST); - state = update_tri_layer_state(state, _ARROW, _RAISE, _META); - return state; -} - - -#if 0 -/* - * Macros used to register tap-dance callbacks automatically - * TDREG_VAR and TDREG_VAR are used internally, so the interface - * really only consist of the TDREG() macro. - * - * TDREG() takes 3 arguments: - * - function name - * - keycode when held - * - keycode when tapped - * - * The macro will then declare 2 functions: NAME_end() and NAME_rst() - * that should be passed as functions pointers to the - * ACTION_TAP_DANCE_FN_ADVANCED() function to register them. - * - * The tap-dance is a better mod-tap that can register any keycode when - * tapped or held. This means that you can send modifiers + keys when - * tapped (which is not possible with mod-tap). - */ -#define TDREG_VAR(a) a##_st -#define TDREG_END(a) a##_end -#define TDREG_RST(a) a##_rst -#define TDREG(name,hold,tap) int TDREG_VAR(name); \ - void TDREG_END(name)(qk_tap_dance_state_t *st, void *u) { cb_tapdance(st,&TDREG_VAR(name),hold,tap,0); } \ - void TDREG_RST(name)(qk_tap_dance_state_t *st, void *u) { cb_tapdance(st,&TDREG_VAR(name),hold,tap,1); } - -#define TD_LCXC TD(LCXC) -#define TD_RCLF TD(RCLF) -#define TD_LSPO TD(LSPO) -#define TD_RSPC TD(RSPC) -#define TD_LGSO TD(LGSO) -#define TD_RGSC TD(RGSC) -#define TD_LACO TD(LACO) -#define TD_RACC TD(RACC) -#define TD_LHLT TD(LHLT) -#define TD_RHGT TD(RHGT) - -static int cur_dance(qk_tap_dance_state_t *); -static void cb_tapdance(qk_tap_dance_state_t *, int *, uint16_t, uint16_t, int); - -/* - * Declare tap-dace functions for all modifiers: - * - * TDREG(function_name, keycode_held, keycode_tapped) - * - * For example: left/right Control keys are modifiers when help, and - * send respectively ESCAPE and LSFT(KC_0) when tapped. You'll reference - * them on your layer as TD(LCTL) and TD(RCTL) - * - * enum tdkeys { - * LCTL, - * RCTL - * }; - * - * TDREG(left_ctl, KC_CTL, KC_ESC) - * TDREG(rght_ctl, KC_CTL, LSFT(KC_0)) - * - * qk_tap_dance_action_t tap_dance_actions[] = { - * [LCTL] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, left_ctl_end, left_ctl_rst), - * [RCTL] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, rght_ctl_end, rght_ctl_rst), - * }; - */ - -// mod-tap for any key, sending any combo -enum dancekeys { - LCXC, RCLF, - LSPO, RSPC, - LGSO, RGSC, - LACO, RACC, - LHLT, RHGT, -}; - -enum dancemoves { - SINGLE_TAP = 0, - SINGLE_HOLD, - DOUBLE_TAP -}; - - -qk_tap_dance_action_t tap_dance_actions[] = { - [LCXC] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, lcxc_end, lcxc_rst), - [RCLF] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, rclf_end, rclf_rst), - [LSPO] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, lspo_end, lspo_rst), - [RSPC] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, rspc_end, rspc_rst), - [LGSO] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, lgso_end, lgso_rst), - [RGSC] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, rgsc_end, rgsc_rst), - [LACO] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, laco_end, laco_rst), - [RACC] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, racc_end, racc_rst), - [LHLT] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, lhlt_end, lhlt_rst), - [RHGT] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, rhgt_end, rhgt_rst), }; - -int -cur_dance(qk_tap_dance_state_t *state) { - switch (state->count) { - case 1: - if (state->interrupted || !state->pressed) - return SINGLE_TAP; - - return SINGLE_HOLD; - break; /* NOTREACHED */ - case 2: - if (!state->pressed) - return DOUBLE_TAP; - break; - } - return -1; -} - -void -cb_tapdance(qk_tap_dance_state_t *st, int *dance, uint16_t hold, uint16_t tap, int reset) -{ - *dance = cur_dance(st); - if (reset) { - switch(*dance) { - case DOUBLE_TAP: /* FALLTHROUGH */ - case SINGLE_TAP: unregister_code16(tap); break; - case SINGLE_HOLD: unregister_code16(hold); break; - } - return; - } - - switch(*dance) { - case SINGLE_TAP: register_code16(tap); break; - case SINGLE_HOLD: register_code16(hold); break; - case DOUBLE_TAP: - tap_code16(tap); - register_code16(tap); - break; - } -} -#endif diff --git a/keyboards/planck/keymaps/z3bra/keymap_afnor.h b/keyboards/planck/keymaps/z3bra/keymap_afnor.h @@ -62,7 +62,7 @@ #define FR_8 LSFT(KC_8) #define FR_9 LSFT(KC_9) #define FR_0 LSFT(KC_0) -#define FR_QUOT LSFT(FR_RPRN) +#define FR_QUOT LSFT(FR_APOS) #define FR_UMLT LSFT(FR_CIRC) #define FR_DASH LSFT(FR_MINS) @@ -78,8 +78,8 @@ // Alt Gr-ed characters #define FR_GRV ALGR(FR_EGRV) -#define FR_AMP ALGR(FR_EACU) -#define FR_UNDS ALGR(FR_LAPO) +#define FR_AMP ALGR(FR_ECIR) +#define FR_UNDS ALGR(FR_RAPO) #define FR_LBRC ALGR(FR_LPRN) #define FR_RBRC ALGR(FR_RPRN) #define FR_EURO ALGR(KC_E) diff --git a/keyboards/planck/keymaps/z3bra/readme.md b/keyboards/planck/keymaps/z3bra/readme.md @@ -1,2 +0,0 @@ -# The Default Planck Layout - diff --git a/keyboards/planck/keymaps/z3bra/rules.mk b/keyboards/planck/keymaps/z3bra/rules.mk @@ -1,4 +1 @@ SRC += muse.c - -ALLOW_WARNINGS=yes -TAP_DANCE_ENABLE = yes