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 1534e7f2c2eae8c6c91975443427d378d68ded92
parent 3895b4b86867c6323f4e595b9726d02158bca612
Author: z3bra <contact@z3bra.org>
Date:   Wed, 17 Jul 2019 08:15:28 +0200

z3bra: submit first planck keymap

Diffstat:
keyboards/planck/keymaps/z3bra/config.h | 39+++++++++++++++++++++++++++++++++++++++
keyboards/planck/keymaps/z3bra/keymap.c | 295+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
keyboards/planck/keymaps/z3bra/keymap_afnor.h | 95+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
keyboards/planck/keymaps/z3bra/readme.md | 2++
keyboards/planck/keymaps/z3bra/rules.mk | 4++++
5 files changed, 435 insertions(+), 0 deletions(-)

diff --git a/keyboards/planck/keymaps/z3bra/config.h b/keyboards/planck/keymaps/z3bra/config.h @@ -0,0 +1,39 @@ +#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), \ + 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 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 + diff --git a/keyboards/planck/keymaps/z3bra/keymap.c b/keyboards/planck/keymaps/z3bra/keymap.c @@ -0,0 +1,295 @@ +/* Copyright 2015-2017 Jack Humbert + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#include QMK_KEYBOARD_H +#include "muse.h" +#include "keymap_afnor.h" + +enum planck_layers { + _AZERTY, + _LOWER, + _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) + * + * 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 + */ +[_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 +), + + +/* + * lower (symbol) + * ----- + * @ à é è ê ( ) ‘ ’ « » ' + * ___ 1 2 3 4 5 6 7 8 9 0 + + * ___ XXX XXX XXX XXX XXX XXX XXX XXX * ^ ___ + * ___ ___ ___ ___ ___ 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, _______, _______, _______, _______, _______ +), + + +/* + * lower (hacking) + * ----- + * ___ 1 2 3 4 5 6 7 8 9 0 ___ + * ___ _ @ % * & | ' " # ` ___ + * ___ srq = + ^ $ ~ + * ___ ___ ___ ___ ⇓ bsp bsp ___ ___ ___ ___ ___ + */ +[_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, _______, _______, _______, _______, _______ +), + +/* + * 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 ___ + * ⇌ ___ ___ ___ ___ 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, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, _______, + _______, _______, _______, _______, _______, KC_INS, KC_INS, _______, _______, _______, _______, _______ +), + + + + + + +/* + * adjust (lower + 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 ___ + * ___ ___ ___ ___ ⇑ ___ ___ ⇓ ___ ___ ___ ___ + */ +[_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( + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ +), + */ + + + +}; + + +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 @@ -0,0 +1,95 @@ +/* Copyright 2015-2016 Jack Humbert + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ +#ifndef KEYMAP_AFNOR_H +#define KEYMAP_AFNOR_H + +#include "keymap.h" + +// Normal characters +#define FR_AT KC_GRV +#define FR_AGRV KC_1 +#define FR_EACU KC_2 +#define FR_EGRV KC_3 +#define FR_ECIR KC_4 +#define FR_LPRN KC_5 +#define FR_RPRN KC_6 +#define FR_LAPO KC_7 +#define FR_RAPO KC_8 +#define FR_LGMT KC_9 +#define FR_RGMT KC_0 +#define FR_APOS KC_MINS +#define FR_CIRC KC_EQL + +#define FR_A KC_Q +#define FR_Z KC_W +#define FR_MINS KC_LBRC +#define FR_PLUS KC_RBRC + +#define FR_Q KC_A +#define FR_M KC_SCLN +#define FR_SLSH KC_QUOT +#define FR_ASTR KC_NUHS + +#define FR_LESS KC_NUBS +#define FR_W KC_Z +#define FR_DOT KC_M +#define FR_COMM KC_COMM +#define FR_COLN KC_DOT +#define FR_SCLN KC_SLSH + +// Shifted characters +#define FR_HASH LSFT(FR_AT) +#define FR_1 LSFT(KC_1) +#define FR_2 LSFT(KC_2) +#define FR_3 LSFT(KC_3) +#define FR_4 LSFT(KC_4) +#define FR_5 LSFT(KC_5) +#define FR_6 LSFT(KC_6) +#define FR_7 LSFT(KC_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_UMLT LSFT(FR_CIRC) + +#define FR_DASH LSFT(FR_MINS) +#define FR_PMNS LSFT(FR_PLUS) +#define FR_BSLS LSFT(FR_SLSH) +#define FR_MULT LSFT(FR_ASTR) + +#define FR_GRTR LSFT(FR_LESS) +#define FR_QUES LSFT(FR_DOT) +#define FR_EXLM LSFT(FR_COMM) +#define FR_ELPS LSFT(FR_COLN) +#define FR_EQL LSFT(FR_SCLN) + +// Alt Gr-ed characters +#define FR_GRV ALGR(FR_EGRV) +#define FR_AMP ALGR(FR_EACU) +#define FR_UNDS ALGR(FR_LAPO) +#define FR_LBRC ALGR(FR_LPRN) +#define FR_RBRC ALGR(FR_RPRN) +#define FR_EURO ALGR(KC_E) +#define FR_LCBR ALGR(KC_T) +#define FR_RCBR ALGR(KC_Y) +#define FR_PERC ALGR(KC_P) +#define FR_DLR ALGR(KC_D) +#define FR_BULT ALGR(KC_F) +#define FR_PIPE ALGR(KC_L) +#define FR_TILD ALGR(KC_N) +#define FR_CCED ALGR(KC_C) + +#endif diff --git a/keyboards/planck/keymaps/z3bra/readme.md b/keyboards/planck/keymaps/z3bra/readme.md @@ -0,0 +1,2 @@ +# The Default Planck Layout + diff --git a/keyboards/planck/keymaps/z3bra/rules.mk b/keyboards/planck/keymaps/z3bra/rules.mk @@ -0,0 +1,4 @@ +SRC += muse.c + +ALLOW_WARNINGS=yes +TAP_DANCE_ENABLE = yes