From a400681ccf56b41a4badece43f73939329a1fe47 Mon Sep 17 00:00:00 2001 From: farfalleflickan <6597735+farfalleflickan@users.noreply.github.com> Date: Thu, 22 Jul 2021 08:57:35 +0200 Subject: [Keyboard] Updated keyboard & keymaps (#12667) Co-authored-by: pastapojken <6597735+pastapojken@users.noreply.github.com> --- keyboards/nack/config.h | 12 +- keyboards/nack/info.json | 4 +- keyboards/nack/keymaps/default/keymap.c | 42 ++--- keyboards/nack/keymaps/farfalleflickan/keymap.c | 203 +++++++++++++++++++++++ keyboards/nack/keymaps/farfalleflickan/keymap.h | 116 +++++++++++++ keyboards/nack/keymaps/farfalleflickan/readme.md | 1 + keyboards/nack/keymaps/pastapojken/keymap.c | 199 ---------------------- keyboards/nack/keymaps/pastapojken/keymap.h | 122 -------------- keyboards/nack/keymaps/pastapojken/readme.md | 1 - keyboards/nack/mcuconf.h | 1 - keyboards/nack/nack.c | 2 +- keyboards/nack/nack.h | 2 +- keyboards/nack/readme.md | 4 +- keyboards/nack/rules.mk | 2 +- 14 files changed, 352 insertions(+), 359 deletions(-) create mode 100644 keyboards/nack/keymaps/farfalleflickan/keymap.c create mode 100644 keyboards/nack/keymaps/farfalleflickan/keymap.h create mode 100644 keyboards/nack/keymaps/farfalleflickan/readme.md delete mode 100644 keyboards/nack/keymaps/pastapojken/keymap.c delete mode 100644 keyboards/nack/keymaps/pastapojken/keymap.h delete mode 100644 keyboards/nack/keymaps/pastapojken/readme.md (limited to 'keyboards') diff --git a/keyboards/nack/config.h b/keyboards/nack/config.h index e442a13336..26fe7edf2c 100644 --- a/keyboards/nack/config.h +++ b/keyboards/nack/config.h @@ -1,5 +1,5 @@ /* -Copyright 2020 pastapojken +Copyright 2020 farfalleflickan 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 @@ -21,7 +21,7 @@ along with this program. If not, see . #define VENDOR_ID 0xDA12 #define PRODUCT_ID 0x6060 #define DEVICE_VER 0x0001 -#define MANUFACTURER pastapojken +#define MANUFACTURER farfalleflickan #define PRODUCT nack keyboard #define MATRIX_ROWS 4 @@ -48,12 +48,8 @@ along with this program. If not, see . #endif #ifdef AUDIO_ENABLE - #define STARTUP_SONG SONG(NO_SOUND) #define AUDIO_PIN A5 #define AUDIO_PIN_ALT A4 - #define AUDIO_PIN_ALT_AS_NEGATIVE - /* - * Basically, change this section once pull request 6165 has been merged - * https://github.com/qmk/qmk_firmware/pull/6165 - */ + #define STARTUP_SONG SONG(NO_SOUND) + #define AUDIO_DAC_SAMPLE_MAX 4095U #endif diff --git a/keyboards/nack/info.json b/keyboards/nack/info.json index 780017f6cc..47942c4f19 100644 --- a/keyboards/nack/info.json +++ b/keyboards/nack/info.json @@ -1,7 +1,7 @@ { "keyboard_name": "nack", - "url": "https://github.com/pastapojken/nack", - "maintainer": "pastapojken", + "url": "https://github.com/farfalleflickan/nack", + "maintainer": "farfalleflickan", "width": 13, "height": 4, "layouts": { diff --git a/keyboards/nack/keymaps/default/keymap.c b/keyboards/nack/keymaps/default/keymap.c index 4c3e3dacbd..9a76fbbddb 100644 --- a/keyboards/nack/keymaps/default/keymap.c +++ b/keyboards/nack/keymaps/default/keymap.c @@ -1,4 +1,4 @@ -/* Copyright 2020 pastapojken +/* Copyright 2020 farfalleflickan * * 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 @@ -25,41 +25,41 @@ enum layer_names { const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [BASE] = LAYOUT( /* __________________________________________________________________________________________________________________________________________________________________________ - | \ \ \ \ \ \ \ \ \ \ \ \ \ \ */ -// | |----TAB-----|---Q--------|-----W------|-----E------|-----R------|----T-------|-----Y------|-----U------|----I-------|------O-----|----P-------|----Å-------|--( ¨^~ )---| + | \ \ \ \ \ \ \ \ \ \ \ \ \ \ */ +// | |----TAB-----|---Q--------|-----W------|-----E------|-----R------|----T-------|-----Y------|-----U------|----I-------|------O-----|----P-------|----Å-------|--( ¨^~ )---| KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, -// | |----ESC-----|---A--------|---S--------|----D-------|-----F------|-----G------|-----H------|-----J------|-----K------|-----L------|-----Ö------|-----Ä------|--( '* )----| +// | |----ESC-----|---A--------|---S--------|----D-------|-----F------|-----G------|-----H------|-----J------|-----K------|-----L------|-----Ö------|-----Ä------|--( '* )----| KC_ESC, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_NUHS, -// | |---SHIFT----|---Z--------|---X--------|----C-------|-----V------|-----B------|-----N------|------M-----|---( ,; )---|---( .: )---|---( -_ )---|----UP------|-BACKSPACE--| +// | |---SHIFT----|---Z--------|---X--------|----C-------|-----V------|-----B------|-----N------|------M-----|---( ,; )---|---( .: )---|---( -_ )---|----UP------|-BACKSPACE--| KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_UP, KC_BSPC, -// | |---CTRL-----|---ALT------|---META-----|----FN_1----|----------SPACE----------|----FN_2----|----AltGr---|--( <>| )---|---ENETER---|-LEFT-------|---DOWN-----|--RIGHT-----| - KC_LCTL, KC_LALT, KC_LGUI, TT(NUM), KC_SPC, KC_NO, TT(FN), KC_RALT, KC_NUBS, KC_ENT, KC_LEFT, KC_DOWN, KC_RIGHT -// \|____________|____________|____________|____________|____________|____________|____________|____________|____________|____________|____________|____________|____________| +// | |---CTRL-----|---ALT------|---META-----|----FN_1----|----------SPACE----------|----FN_2----|----AltGr---|--( <>| )---|---ENETER---|-LEFT-------|---DOWN-----|--RIGHT-----| + KC_LCTL, KC_LALT, KC_LGUI, MO(NUM), KC_SPC, KC_NO, MO(FN), KC_RALT, KC_NUBS, KC_ENT, KC_LEFT, KC_DOWN, KC_RIGHT +// \|____________|____________|____________|____________|____________|____________|____________|____________|____________|____________|____________|____________|____________| ), [NUM] = LAYOUT( /* __________________________________________________________________________________________________________________________________________________________________________ - | \ \ \ \ \ \ \ \ \ \ \ \ \ \ */ + | \ \ \ \ \ \ \ \ \ \ \ \ \ \ */ // | |---TAB------|---( 1! )---|--( 2"@ )---|--( 3#£ )---|---( 4¤$ )--|--( 5%€ )---|---( 6& )---|--( 7/{ )---|--( 8([ )---|--( 9)] )---|--( 0=} )---|---( +?\ )--|---( ´` )---| _______, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, -// | |----ESC-----|-----F1-----|-----F2-----|----F3------|----F4------|----F5------|-----F6-----|-----F7------|----F8-----|-----F9-----|-----F10----|----F11-----|----F12-----| +// | |----ESC-----|-----F1-----|-----F2-----|----F3------|----F4------|----F5------|-----F6-----|-----F7------|----F8-----|-----F9-----|-----F10----|----F11-----|----F12-----| _______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, -// | |---SHIFT----|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------| +// | |---SHIFT----|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------| _______, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, -// | |---CTRL-----|---ALT------|---META-----|---FN_1-----|------------|------------|----FN_2----|--AltGr-----|---( §½ )---|------------|------------|------------|------------| - _______, _______, _______, TT(FN), KC_NO, KC_NO, TO(BASE), _______, KC_GRV, KC_NO, KC_NO, KC_NO, KC_NO -// \|____________|____________|____________|____________|____________|____________|____________|____________|____________|____________|____________|____________|____________| +// | |---CTRL-----|---ALT------|---META-----|---FN_1-----|------------|------------|----FN_2----|--AltGr-----|---( §½ )---|------------|------------|------------|------------| + _______, _______, _______, MO(FN), KC_NO, KC_NO, TO(BASE), _______, KC_GRV, KC_NO, KC_NO, KC_NO, KC_NO +// \|____________|____________|____________|____________|____________|____________|____________|____________|____________|____________|____________|____________|____________| ), [FN] = LAYOUT( /* __________________________________________________________________________________________________________________________________________________________________________ - | \ \ \ \ \ \ \ \ \ \ \ \ \ \ */ -// | |-RGB TOGGLE-|-CHANGE RGB-|-RGB HUE UP-|-RGB SAT UP-|------------|------------|------------|------------|------------|------------|------------|------------|-RESET KBD--| + | \ \ \ \ \ \ \ \ \ \ \ \ \ \ */ +// | |-RGB TOGGLE-|-CHANGE RGB-|-RGB HUE UP-|-RGB SAT UP-|------------|------------|------------|------------|------------|------------|------------|------------|-RESET KBD--| RGB_TOG, RGB_MOD, RGB_HUI, RGB_SAI, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, -// | |------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------| +// | |------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------| MU_TOG, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, -// | |------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|-RGB LIGHT +|------------| +// | |------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|-RGB LIGHT +|------------| KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, RGB_VAI, KC_NO, -// | |------------|------------|------------|---FN_1-----|------------|------------|----FN_2----|------------|------------|------------|------------|-RGB LIGHT -|------------| - KC_NO, KC_NO, KC_NO, TT(NUM), KC_NO, KC_NO, TO(BASE), KC_NO, KC_NO, KC_NO, KC_NO, RGB_VAD, KC_NO -// \|____________|____________|____________|____________|____________|____________|____________|____________|____________|____________|____________|____________|____________| +// | |------------|------------|------------|---FN_1-----|------------|------------|----FN_2----|------------|------------|------------|------------|-RGB LIGHT -|------------| + KC_NO, KC_NO, KC_NO, MO(NUM), KC_NO, KC_NO, TO(BASE), KC_NO, KC_NO, KC_NO, KC_NO, RGB_VAD, KC_NO +// \|____________|____________|____________|____________|____________|____________|____________|____________|____________|____________|____________|____________|____________| ) }; diff --git a/keyboards/nack/keymaps/farfalleflickan/keymap.c b/keyboards/nack/keymaps/farfalleflickan/keymap.c new file mode 100644 index 0000000000..6e447bee1d --- /dev/null +++ b/keyboards/nack/keymaps/farfalleflickan/keymap.c @@ -0,0 +1,203 @@ +/* Copyright 2020 farfalleflickan + * + * 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 . + */ +#include QMK_KEYBOARD_H +#include "keymap.h" + +#define ____ _______ + +// Defines names for use in layer keycodes and the keymap +enum layer_names { + BASE, + NOGUI, + NUM, + FN +}; + +// Defines the keycodes used by our macros in process_record_user +enum custom_keycodes { + CK_LSFT = SAFE_RANGE, // Shift + CK_RALT, // AltGr + CK_BSPC_DEL, // Backspace or Del (if pressed with CK_LSFT or CK_RALT) + KK_RESET +}; + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [BASE] = LAYOUT( +/* __________________________________________________________________________________________________________________________________________________________________________ + | \ \ \ \ \ \ \ \ \ \ \ \ \ \ */ +// | |----TAB-----|---Q--------|-----W------|-----E------|-----R------|----T-------|-----Y------|-----U------|----I-------|------O-----|----P-------|----Å-------|--( ¨^~ )---| + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, +// | |----ESC-----|---A--------|---S--------|----D-------|-----F------|-----G------|-----H------|-----J------|-----K------|-----L------|-----Ö------|-----Ä------|--( '* )----| + KC_ESC, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_NUHS, +// | |---SHIFT----|---Z--------|---X--------|----C-------|-----V------|-----B------|-----N------|------M-----|---( ,; )---|---( .: )---|---( -_ )---|----UP------|-BACKSPACE--| + CK_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_UP, CK_BSPC_DEL, +// | |---CTRL-----|---ALT------|---META-----|----FN_1----|----------SPACE----------|----FN_2----|----AltGr---|--( <>| )---|---ENTER----|-LEFT-------|---DOWN-----|--RIGHT-----| + KC_LCTL, KC_LALT, KC_LGUI, MO(NUM), KC_SPC, KC_NO, MO(FN), CK_RALT, KC_NUBS, KC_ENT, KC_LEFT, KC_DOWN, KC_RIGHT +// \|____________|____________|____________|____________|____________|____________|____________|____________|____________|____________|____________|____________|____________| + ), + [NOGUI] = LAYOUT( +/* __________________________________________________________________________________________________________________________________________________________________________ + | \ \ \ \ \ \ \ \ \ \ \ \ \ \ */ +// | |----TAB-----|---Q--------|-----W------|-----E------|-----R------|----T-------|-----Y------|-----U------|----I-------|------O-----|----P-------|----Å-------|--( ¨^~ )---| + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, +// | |----ESC-----|---A--------|---S--------|----D-------|-----F------|-----G------|-----H------|-----J------|-----K------|-----L------|-----Ö------|-----Ä------|--( '* )----| + KC_ESC, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_NUHS, +// | |---SHIFT----|---Z--------|---X--------|----C-------|-----V------|-----B------|-----N------|------M-----|---( ,; )---|---( .: )---|---( -_ )---|----UP------|-BACKSPACE--| + CK_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_UP, CK_BSPC_DEL, +// | |---CTRL-----|---ALT------|---META-----|----FN_1----|----------SPACE----------|----FN_2----|----AltGr---|--( <>| )---|---ENTER----|-LEFT-------|---DOWN-----|--RIGHT-----| + KC_LCTL, KC_LALT, KC_NO, MO(NUM), KC_SPC, KC_NO, TO(BASE), CK_RALT, KC_NUBS, KC_ENT, KC_LEFT, KC_DOWN, KC_RIGHT +// \|____________|____________|____________|____________|____________|____________|____________|____________|____________|____________|____________|____________|____________| + ), + [NUM] = LAYOUT( +/* __________________________________________________________________________________________________________________________________________________________________________ + | \ \ \ \ \ \ \ \ \ \ \ \ \ \ */ +// | |---TAB------|---( 1! )---|--( 2"@ )---|--( 3#£ )---|---( 4¤$ )--|--( 5%€ )---|---( 6& )---|--( 7/{ )---|--( 8([ )---|--( 9)] )---|--( 0=} )---|---( +?\ )--|---( ´` )---| + ____, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, +// | |----ESC-----|-----F1-----|-----F2-----|----F3------|----F4------|----F5------|-----F6-----|-----F7------|----F8-----|-----F9-----|-----F10----|----F11-----|----F12-----| + ____, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, +// | |---SHIFT----|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------| + ____, KC_P0, KC_P1, KC_P2, KC_P3, KC_P4, KC_P5, KC_P6, KC_P7, KC_P8, KC_P9, KC_PGUP, KC_NO, +// | |---CTRL-----|---ALT------|---META-----|---FN_1-----|------------|------------|----FN_2----|--AltGr-----|---( §½ )---|------------|------------|------------|------------| + ____, ____, ____, TO(BASE), KC_NO, KC_NO, MO(FN), ____, KC_GRV, KC_PDOT, KC_HOME, KC_PGDOWN, KC_END +// \|____________|____________|____________|____________|____________|____________|____________|____________|____________|____________|____________|____________|____________| + ), + [FN] = LAYOUT( +/* __________________________________________________________________________________________________________________________________________________________________________ + | \ \ \ \ \ \ \ \ \ \ \ \ \ \ */ +// | |-RGB TOGGLE-|-CHANGE RGB-|-RGB HUE UP-|-RGB SAT UP-|------------|------------|------------|------------|------------|------------|------------|------------|-RESET KBD--| + RGB_TOG, RGB_MOD, RGB_HUI, RGB_SAI, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KK_RESET, +// | |------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------| + MU_TOG, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, +// | |------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|-RGB LIGHT +|------------| + KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, RGB_VAI, KC_NO, +// | |------------|------------|------------|---FN_1-----|------------|------------|----FN_2----|------------|------------|------------|------------|-RGB LIGHT -|------------| + KC_NO, KC_NO, KC_NO, TO(BASE), KC_NO, KC_NO, TO(BASE), TO(NOGUI), KC_NO, KC_NO, KC_NO, RGB_VAD, KC_NO +// \|____________|____________|____________|____________|____________|____________|____________|____________|____________|____________|____________|____________|____________| + ) +}; + +// Interrupt bools +bool lshift = false, ralt = false; + +// Number of items that are saved in prev_kcs +uint8_t prev_indx = 0; +// Used to save the last 6 actual keycodes +uint16_t prev_kcs[6] = {0, 0, 0, 0, 0, 0}; + +/* +Used to add a keycode to a prev_kcs to remember it. +When full the last code gets discarded and replaced by +the new one. +*/ +void add_to_prev(uint16_t kc){ + for (int i=0; i0; i--){ + prev_kcs[i] = prev_kcs[i-1]; + } + prev_kcs[0] = kc; + } else { + prev_kcs[prev_indx] = kc; + prev_indx++; + } +} + +/* +Unregisters all codes saved in prev_kcs and resets prev_indx. +gets called on multiple occasions mainly when shift is released +and when frankenkeycodes are pressed. Prevents output of +wrong characters when really specific key combinations +that would never occur during normal usage are pressed. +*/ +void unreg_prev(void){ + if (prev_indx == 0) + return; + for (int i=0; ievent.pressed) { + unregister_code(KC_LSFT); + register_code(KC_LSFT); + lshift = true; + } else { + unreg_prev(); + unregister_code(KC_LSFT); + lshift = false; + } + return false; + break; + case CK_RALT: + if(record->event.pressed) { + unregister_code(KC_RALT); + register_code(KC_RALT); + ralt = true; + } else { + unreg_prev(); + unregister_code(KC_RALT); + ralt = false; + } + return false; + break; + case CK_BSPC_DEL: + if (ralt==true) { + RALT_NO(KC_BSPC,KC_DEL); + } else { + SHIFT_NO(KC_BSPC,KC_DEL); + } + break; + case KK_RESET: // Basically, turn off RGB before resetting + if (record->event.pressed) { + key_timer = timer_read32(); + #ifdef RGB_MATRIX_ENABLE + rgb_matrix_disable_noeeprom(); + #endif + } else { + if (timer_elapsed32(key_timer) >= 20) { + reset_keyboard(); + } + } + break; + default: + if(record->event.pressed) { + timer_timeout_keymap(); + if (lshift) + register_code(KC_LSFT); + else + unregister_code(KC_LSFT); + + if (ralt) + register_code(KC_ALGR); + else + unregister_code(KC_ALGR); + } + break; + } + return true; +} + +__attribute__((weak)) +void timer_timeout_keymap(void){ +} diff --git a/keyboards/nack/keymaps/farfalleflickan/keymap.h b/keyboards/nack/keymaps/farfalleflickan/keymap.h new file mode 100644 index 0000000000..212f45ffdb --- /dev/null +++ b/keyboards/nack/keymaps/farfalleflickan/keymap.h @@ -0,0 +1,116 @@ +/* Copyright 2020 farfalleflickan + * + * 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 . + */ + +#pragma once +#include "quantum.h" + +void add_to_prev(uint16_t kc); +void unreg_prev(void); +void timer_timeout_keymap(void); +bool process_record_user(uint16_t keycode, keyrecord_t *record); + +// Normal shift status +#define SHIFT_NORM(kc1, kc2) \ +if (record->event.pressed) { \ + timer_timeout_keymap(); \ + if (lshift) { \ + register_code(KC_LSFT); \ + unregister_code(kc2); \ + register_code(kc2); \ + add_to_prev(kc2); \ + } else { \ + unregister_code(KC_LSFT); \ + unregister_code(kc1); \ + register_code(kc1); \ + } \ +} else { \ + unregister_code(kc1); \ + unregister_code(kc2); \ +} \ +return false; + +// Always shifted +#define SHIFT_ALL(kc1, kc2) \ +if (record->event.pressed) { \ + timer_timeout_keymap(); \ + register_code(KC_LSFT); \ + if (lshift) { \ + unregister_code(kc2); \ + register_code(kc2); \ + add_to_prev(kc2); \ + } else { \ + unregister_code(kc1); \ + register_code(kc1); \ + add_to_prev(kc1); \ + } \ +} else { \ + unregister_code(kc1); \ + unregister_code(kc2); \ + unreg_prev(); \ + if (lshift) \ + register_code(KC_LSFT); \ + else \ + unregister_code(KC_LSFT); \ +} \ +return false; + +// Never shifted +#define SHIFT_NO(kc1, kc2) \ +if (record->event.pressed) { \ + timer_timeout_keymap(); \ + unregister_code(KC_LSFT); \ + if (lshift) { \ + unregister_code(kc2); \ + register_code(kc2); \ + add_to_prev(kc2); \ + } else { \ + unregister_code(kc1); \ + register_code(kc1); \ + } \ +} else { \ + unregister_code(kc1); \ + unregister_code(kc2); \ + unreg_prev(); \ + if (lshift) \ + register_code(KC_LSFT); \ + else \ + unregister_code(KC_LSFT); \ +} \ +return false; + +//Never RALT +#define RALT_NO(kc1, kc2) \ +if (record->event.pressed) { \ + timer_timeout_keymap(); \ + unregister_code(KC_RALT); \ + if (ralt) { \ + unregister_code(kc2); \ + register_code(kc2); \ + add_to_prev(kc2); \ + } else { \ + unregister_code(kc1); \ + register_code(kc1); \ + } \ +} else { \ + unregister_code(kc1); \ + unregister_code(kc2); \ + unreg_prev(); \ + if (ralt) \ + register_code(KC_RALT); \ + else \ + unregister_code(KC_RALT); \ +} \ +return false; diff --git a/keyboards/nack/keymaps/farfalleflickan/readme.md b/keyboards/nack/keymaps/farfalleflickan/readme.md new file mode 100644 index 0000000000..fbe5c6f5e3 --- /dev/null +++ b/keyboards/nack/keymaps/farfalleflickan/readme.md @@ -0,0 +1 @@ +# farfalleflickan's keymap for nack diff --git a/keyboards/nack/keymaps/pastapojken/keymap.c b/keyboards/nack/keymaps/pastapojken/keymap.c deleted file mode 100644 index 3bbcc4b368..0000000000 --- a/keyboards/nack/keymaps/pastapojken/keymap.c +++ /dev/null @@ -1,199 +0,0 @@ -/* Copyright 2020 pastapojken - * - * 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 . - */ -#include QMK_KEYBOARD_H -#include "keymap.h" - -#define ____ _______ - -// Defines names for use in layer keycodes and the keymap -enum layer_names { - BASE, - NUM, - FN -}; - -// Defines the keycodes used by our macros in process_record_user -enum custom_keycodes { - CK_LSFT = SAFE_RANGE, // Shift - CK_RALT, // AltGr - CK_BSPC_DEL, // Backspace or Del (if pressed with CK_LSFT or CK_RALT) - CK_UP_PGUP, // Up or PgUp (if pressed with CK_LSFT or CK_RALT) - CK_DOWN_PGDOWN, // Down or PgDown (if pressed with CK_LSFT or CK_RALT) - CK_LEFT_HOME, // Left or Home (if pressed with CK_LSFT or CK_RALT) - CK_RIGHT_END, // Right or End (if pressed with CK_LSFT or CK_RALT) - KK_RESET -}; - -const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { - [BASE] = LAYOUT( -/* __________________________________________________________________________________________________________________________________________________________________________ - | \ \ \ \ \ \ \ \ \ \ \ \ \ \ */ -// | |----TAB-----|---Q--------|-----W------|-----E------|-----R------|----T-------|-----Y------|-----U------|----I-------|------O-----|----P-------|----Å-------|--( ¨^~ )---| - KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, -// | |----ESC-----|---A--------|---S--------|----D-------|-----F------|-----G------|-----H------|-----J------|-----K------|-----L------|-----Ö------|-----Ä------|--( '* )----| - KC_ESC, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_NUHS, -// | |---SHIFT----|---Z--------|---X--------|----C-------|-----V------|-----B------|-----N------|------M-----|---( ,; )---|---( .: )---|---( -_ )---|----UP------|-BACKSPACE--| - CK_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, CK_UP_PGUP, CK_BSPC_DEL, -// | |---CTRL-----|---ALT------|---META-----|----FN_1----|----------SPACE----------|----FN_2----|----AltGr---|--( <>| )---|---ENETER---|-LEFT-------|---DOWN-----|--RIGHT-----| - KC_LCTL, KC_LALT, KC_LGUI, TT(NUM), KC_SPC, KC_NO, TT(FN), CK_RALT, KC_NUBS, KC_ENT, CK_LEFT_HOME,CK_DOWN_PGDOWN,CK_RIGHT_END -// \|____________|____________|____________|____________|____________|____________|____________|____________|____________|____________|____________|____________|____________| - ), - [NUM] = LAYOUT( -/* __________________________________________________________________________________________________________________________________________________________________________ - | \ \ \ \ \ \ \ \ \ \ \ \ \ \ */ -// | |---TAB------|---( 1! )---|--( 2"@ )---|--( 3#£ )---|---( 4¤$ )--|--( 5%€ )---|---( 6& )---|--( 7/{ )---|--( 8([ )---|--( 9)] )---|--( 0=} )---|---( +?\ )--|---( ´` )---| - ____, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, -// | |----ESC-----|-----F1-----|-----F2-----|----F3------|----F4------|----F5------|-----F6-----|-----F7------|----F8-----|-----F9-----|-----F10----|----F11-----|----F12-----| - ____, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, -// | |---SHIFT----|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------| - ____, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, -// | |---CTRL-----|---ALT------|---META-----|---FN_1-----|------------|------------|----FN_2----|--AltGr-----|---( §½ )---|------------|------------|------------|------------| - ____, ____, ____, TT(FN), KC_NO, KC_NO, TO(BASE), ____, KC_GRV, KC_NO, KC_NO, KC_NO, KC_NO -// \|____________|____________|____________|____________|____________|____________|____________|____________|____________|____________|____________|____________|____________| - ), - [FN] = LAYOUT( -/* __________________________________________________________________________________________________________________________________________________________________________ - | \ \ \ \ \ \ \ \ \ \ \ \ \ \ */ -// | |-RGB TOGGLE-|-CHANGE RGB-|-RGB HUE UP-|-RGB SAT UP-|------------|------------|------------|------------|------------|------------|------------|------------|-RESET KBD--| - RGB_TOG, RGB_MOD, RGB_HUI, RGB_SAI, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KK_RESET, -// | |------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------| - MU_TOG, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, -// | |------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|-RGB LIGHT +|------------| - KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, RGB_VAI, KC_NO, -// | |------------|------------|------------|---FN_1-----|------------|------------|----FN_2----|------------|------------|------------|------------|-RGB LIGHT -|------------| - KC_NO, KC_NO, KC_NO, TT(NUM), KC_NO, KC_NO, TO(BASE), KC_NO, KC_NO, KC_NO, KC_NO, RGB_VAD, KC_NO -// \|____________|____________|____________|____________|____________|____________|____________|____________|____________|____________|____________|____________|____________| - ) -}; - -// Interrupt bools -bool lshift = false, ralt = false; - -// Number of items that are saved in prev_kcs -uint8_t prev_indx = 0; -// Used to save the last 6 actual keycodes -uint16_t prev_kcs[6] = {0, 0, 0, 0, 0, 0}; - -/* -Used to add a keycode to a prev_kcs to remember it. -When full the last code gets discarded and replaced by -the new one. -*/ -void add_to_prev(uint16_t kc){ - for (int i=0; i0; i--){ - prev_kcs[i] = prev_kcs[i-1]; - } - prev_kcs[0] = kc; - } else { - prev_kcs[prev_indx] = kc; - prev_indx++; - } -} - -/* -Unregisters all codes saved in prev_kcs and resets prev_indx. -gets called on multiple occasions mainly when shift is released -and when frankenkeycodes are pressed. Prevents output of -wrong characters when really specific key combinations -that would never occur during normal usage are pressed. -*/ -void unreg_prev(void){ - if (prev_indx == 0) - return; - for (int i=0; ievent.pressed) { - unregister_code(KC_LSFT); - register_code(KC_LSFT); - lshift = true; - } else { - unreg_prev(); - unregister_code(KC_LSFT); - lshift = false; - } - return false; - case CK_RALT: - if(record->event.pressed) { - unregister_code(KC_RALT); - register_code(KC_RALT); - ralt = true; - } else { - unreg_prev(); - unregister_code(KC_RALT); - ralt = false; - } - return false; - case CK_BSPC_DEL: - RALT_NO(KC_BSPC,KC_DEL); - break; - case CK_UP_PGUP: - RALT_NO(KC_UP,KC_PGUP); - break; - case CK_DOWN_PGDOWN: - RALT_NO(KC_DOWN,KC_PGDOWN); - break; - case CK_LEFT_HOME: - RALT_NO(KC_LEFT,KC_HOME); - break; - case CK_RIGHT_END: - RALT_NO(KC_RIGHT,KC_END); - break; - case KK_RESET: // Basically, turn off RGB before resetting - if (record->event.pressed) { - key_timer = timer_read32(); - #ifdef RGB_MATRIX_ENABLE - rgb_matrix_disable_noeeprom(); - #endif - } else { - if (timer_elapsed32(key_timer) >= 20) { - reset_keyboard(); - } - } - break; - default: - if(record->event.pressed) { - timer_timeout_keymap(); - if (lshift) - register_code(KC_LSFT); - else - unregister_code(KC_LSFT); - - if (ralt) - register_code(KC_ALGR); - else - unregister_code(KC_ALGR); - } - break; - } - return true; -} - -__attribute__((weak)) -void timer_timeout_keymap(void){ -} diff --git a/keyboards/nack/keymaps/pastapojken/keymap.h b/keyboards/nack/keymaps/pastapojken/keymap.h deleted file mode 100644 index aaeed70706..0000000000 --- a/keyboards/nack/keymaps/pastapojken/keymap.h +++ /dev/null @@ -1,122 +0,0 @@ -/* Copyright 2020 pastapojken - * - * 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 . - */ - -#pragma once -#include "quantum.h" - -#define TAPPING_TOGGLE 2 - -#ifdef AUDIO_ENABLE - #define STARTUP_SONG SONG(NO_SOUND) -#endif - -void add_to_prev(uint16_t kc); -void unreg_prev(void); -void timer_timeout_keymap(void); -bool process_record_user(uint16_t keycode, keyrecord_t *record); - -// Normal shift status -#define SHIFT_NORM(kc1, kc2) \ -if (record->event.pressed) { \ - timer_timeout_keymap(); \ - if (lshift) { \ - register_code(KC_LSFT); \ - unregister_code(kc2); \ - register_code(kc2); \ - add_to_prev(kc2); \ - } else { \ - unregister_code(KC_LSFT); \ - unregister_code(kc1); \ - register_code(kc1); \ - } \ -} else { \ - unregister_code(kc1); \ - unregister_code(kc2); \ -} \ -return false; - -// Always shifted -#define SHIFT_ALL(kc1, kc2) \ -if (record->event.pressed) { \ - timer_timeout_keymap(); \ - register_code(KC_LSFT); \ - if (lshift) { \ - unregister_code(kc2); \ - register_code(kc2); \ - add_to_prev(kc2); \ - } else { \ - unregister_code(kc1); \ - register_code(kc1); \ - add_to_prev(kc1); \ - } \ -} else { \ - unregister_code(kc1); \ - unregister_code(kc2); \ - unreg_prev(); \ - if (lshift) \ - register_code(KC_LSFT); \ - else \ - unregister_code(KC_LSFT); \ -} \ -return false; - -// Never shifted -#define SHIFT_NO(kc1, kc2) \ -if (record->event.pressed) { \ - timer_timeout_keymap(); \ - unregister_code(KC_LSFT); \ - if (lshift) { \ - unregister_code(kc2); \ - register_code(kc2); \ - add_to_prev(kc2); \ - } else { \ - unregister_code(kc1); \ - register_code(kc1); \ - } \ -} else { \ - unregister_code(kc1); \ - unregister_code(kc2); \ - unreg_prev(); \ - if (lshift) \ - register_code(KC_LSFT); \ - else \ - unregister_code(KC_LSFT); \ -} \ -return false; - -//Never RALT -#define RALT_NO(kc1, kc2) \ -if (record->event.pressed) { \ - timer_timeout_keymap(); \ - unregister_code(KC_RALT); \ - if (ralt) { \ - unregister_code(kc2); \ - register_code(kc2); \ - add_to_prev(kc2); \ - } else { \ - unregister_code(kc1); \ - register_code(kc1); \ - } \ -} else { \ - unregister_code(kc1); \ - unregister_code(kc2); \ - unreg_prev(); \ - if (ralt) \ - register_code(KC_RALT); \ - else \ - unregister_code(KC_RALT); \ -} \ -return false; diff --git a/keyboards/nack/keymaps/pastapojken/readme.md b/keyboards/nack/keymaps/pastapojken/readme.md deleted file mode 100644 index 73e1e2add9..0000000000 --- a/keyboards/nack/keymaps/pastapojken/readme.md +++ /dev/null @@ -1 +0,0 @@ -# pastapojken's keymap for nack diff --git a/keyboards/nack/mcuconf.h b/keyboards/nack/mcuconf.h index d2251dbaef..4b714b9d52 100644 --- a/keyboards/nack/mcuconf.h +++ b/keyboards/nack/mcuconf.h @@ -28,4 +28,3 @@ #undef STM32_SPI_USE_SPI2 #define STM32_SPI_USE_SPI2 FALSE - diff --git a/keyboards/nack/nack.c b/keyboards/nack/nack.c index 185a96fdad..8433e551c4 100644 --- a/keyboards/nack/nack.c +++ b/keyboards/nack/nack.c @@ -1,4 +1,4 @@ -/* Copyright 2020 pastapojken +/* Copyright 2020 farfalleflickan * * 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 diff --git a/keyboards/nack/nack.h b/keyboards/nack/nack.h index 30e310a486..6680e992ee 100644 --- a/keyboards/nack/nack.h +++ b/keyboards/nack/nack.h @@ -1,4 +1,4 @@ -/* Copyright 2020 pastapojken +/* Copyright 2020 farfalleflickan * * 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 diff --git a/keyboards/nack/readme.md b/keyboards/nack/readme.md index 6a1adeaf7b..b654020c4f 100644 --- a/keyboards/nack/readme.md +++ b/keyboards/nack/readme.md @@ -4,9 +4,9 @@ A ISO-friendly ortholinear keyboard, 13x4 keys. See [screenshots](https://imgur.com/a/PPO18Lc). -* Keyboard Maintainer: [pastapojken](https://github.com/pastapojken) +* Keyboard Maintainer: [farfalleflickan](https://github.com/farfalleflickan) * Hardware Supported: nack PCB -* Hardware Availability: [github repo](https://github.com/pastapojken/nack) +* Hardware Availability: [github repo](https://github.com/farfalleflickan/nack) Make example for this keyboard (after setting up your build environment): diff --git a/keyboards/nack/rules.mk b/keyboards/nack/rules.mk index 35e9440695..f8b7d4d39b 100644 --- a/keyboards/nack/rules.mk +++ b/keyboards/nack/rules.mk @@ -24,5 +24,5 @@ AUDIO_ENABLE = yes # Audio output RGB_MATRIX_ENABLE = yes RGB_MATRIX_DRIVER = WS2812 WS2812_DRIVER = spi -AUDIO_DRIVER = dac_additive # How to drive the 2 speakers +AUDIO_DRIVER = dac_basic # How to drive the 2 speakers UNICODE_ENABLE = yes # Unicode support -- cgit v1.2.3