Merge remote-tracking branch 'origin/develop' into xap
This commit is contained in:
commit
f0a8d431f6
36 changed files with 935 additions and 2 deletions
5
keyboards/hhkb/ansi/32u2/rules.mk
Normal file
5
keyboards/hhkb/ansi/32u2/rules.mk
Normal file
|
@ -0,0 +1,5 @@
|
|||
# MCU name
|
||||
MCU = atmega32u2
|
||||
|
||||
CONSOLE_ENABLE = no # Console for debug
|
||||
COMMAND_ENABLE = no # Commands for debug and configuration
|
|
@ -78,6 +78,60 @@ static inline void KEY_SELECT(uint8_t ROW, uint8_t COL)
|
|||
|
||||
}
|
||||
|
||||
#elif defined(__AVR_ATmega32U2__)
|
||||
/*
|
||||
* For TMK HHKB alt controller(ATMega32U4)
|
||||
*
|
||||
* row: PB0-2
|
||||
* col: PB3-5,6
|
||||
* key: PD3(pull-uped)
|
||||
* prev: PB7
|
||||
* power: PD4(L:off/H:on)
|
||||
* row-ext: PC6,7 for HHKB JP(active low)
|
||||
*/
|
||||
static inline void KEY_ENABLE(void) { (PORTB &= ~(1<<6)); }
|
||||
static inline void KEY_UNABLE(void) { (PORTB |= (1<<6)); }
|
||||
static inline bool KEY_STATE(void) { return (PIND & (1<<3)); }
|
||||
static inline void KEY_PREV_ON(void) { (PORTB |= (1<<7)); }
|
||||
static inline void KEY_PREV_OFF(void) { (PORTB &= ~(1<<7)); }
|
||||
#ifdef HHKB_POWER_SAVING
|
||||
static inline void KEY_POWER_ON(void) {
|
||||
DDRB = 0xFF; PORTB = 0x40; // change pins output
|
||||
DDRD |= (1<<4); PORTD |= (1<<4); // MOS FET switch on
|
||||
/* Without this wait you will miss or get false key events. */
|
||||
_delay_ms(5); // wait for powering up
|
||||
}
|
||||
static inline void KEY_POWER_OFF(void) {
|
||||
/* input with pull-up consumes less than without it when pin is open. */
|
||||
DDRB = 0x00; PORTB = 0xFF; // change pins input with pull-up
|
||||
DDRD |= (1<<4); PORTD &= ~(1<<4); // MOS FET switch off
|
||||
}
|
||||
static inline bool KEY_POWER_STATE(void) { return PORTD & (1<<4); }
|
||||
#else
|
||||
static inline void KEY_POWER_ON(void) {}
|
||||
static inline void KEY_POWER_OFF(void) {}
|
||||
static inline bool KEY_POWER_STATE(void) { return true; }
|
||||
#endif
|
||||
static inline void KEY_INIT(void)
|
||||
{
|
||||
/* row,col,prev: output */
|
||||
DDRB = 0xFF;
|
||||
PORTB = 0x40; // unable
|
||||
/* key: input with pull-up */
|
||||
DDRD &= ~0x80;
|
||||
PORTD |= 0x80;
|
||||
|
||||
KEY_UNABLE();
|
||||
KEY_PREV_OFF();
|
||||
|
||||
KEY_POWER_OFF();
|
||||
}
|
||||
static inline void KEY_SELECT(uint8_t ROW, uint8_t COL)
|
||||
{
|
||||
PORTB = (PORTB & 0xC0) | (((COL) & 0x07)<<3) | ((ROW) & 0x07);
|
||||
|
||||
}
|
||||
|
||||
|
||||
#elif defined(__AVR_AT90USB1286__)
|
||||
/*
|
||||
|
|
|
@ -14,9 +14,9 @@ CONSOLE_ENABLE = yes # Console for debug
|
|||
COMMAND_ENABLE = yes # Commands for debug and configuration
|
||||
CUSTOM_MATRIX = yes # Custom matrix file for the HHKB
|
||||
NKRO_ENABLE = no # Enable N-Key Rollover
|
||||
# BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality
|
||||
BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality
|
||||
|
||||
# HHKB_RN42_ENABLE = yes # Enable support for hasu's BT alt controller -- code borrowed from tmk source tree.
|
||||
HHKB_RN42_ENABLE = no # Enable support for hasu's BT alt controller -- code borrowed from tmk source tree.
|
||||
|
||||
# Either uncomment the HHKB_RN42_ENABLE line above, or run make enabling the
|
||||
# feature. Be sure to clean any existing build before trying to enable rn42
|
||||
|
|
16
keyboards/ms_sculpt/config.h
Normal file
16
keyboards/ms_sculpt/config.h
Normal file
|
@ -0,0 +1,16 @@
|
|||
// Copyright 2022 Jean Bernard (@jn-bernard)
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#pragma once
|
||||
|
||||
/*
|
||||
* Feature disable options
|
||||
* These options are also useful to firmware size reduction.
|
||||
*/
|
||||
|
||||
#define BOOTMAGIC_LITE_ROW 4
|
||||
#define BOOTMAGIC_LITE_COLUMN 13
|
||||
|
||||
/* key matrix size */
|
||||
#define MATRIX_ROWS 8
|
||||
#define MATRIX_COLS 18
|
32
keyboards/ms_sculpt/info.json
Normal file
32
keyboards/ms_sculpt/info.json
Normal file
|
@ -0,0 +1,32 @@
|
|||
{
|
||||
"manufacturer": "Jean Bernard",
|
||||
"keyboard_name": "ms_sculpt",
|
||||
"maintainer": "jn-bernard",
|
||||
"bootloader": "stm32-dfu",
|
||||
"diode_direction": "COL2ROW",
|
||||
"features": {
|
||||
"bootmagic": true,
|
||||
"command": false,
|
||||
"console": false,
|
||||
"extrakey": false,
|
||||
"mousekey": false,
|
||||
"nkro": false
|
||||
},
|
||||
"matrix_pins": {
|
||||
"rows": ["B10", "B1", "B0", "A7", "A6", "A5", "A4", "A3"],
|
||||
"cols": ["A2","B8","A0","C15","C14","A14","A13","B7","B6","B5","B4","B3","A15","A10","A8","B15","B14","B12"],
|
||||
"unused": ["B13", "A1", "B9"]
|
||||
"ghost": true,
|
||||
"io_delay": 5
|
||||
},
|
||||
"processor": "STM32F401",
|
||||
"url": "",
|
||||
"usb": {
|
||||
"polling_interval": 1,
|
||||
"device_version": "1.0.0",
|
||||
"pid": "0x0000",
|
||||
"vid": "0xFEED"
|
||||
},
|
||||
"layouts": {
|
||||
}
|
||||
}
|
21
keyboards/ms_sculpt/keymaps/default/keymap.c
Normal file
21
keyboards/ms_sculpt/keymaps/default/keymap.c
Normal file
|
@ -0,0 +1,21 @@
|
|||
// Copyright 2022 Jean Bernard (@jn-bernard)
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include QMK_KEYBOARD_H
|
||||
|
||||
enum custom_layers {
|
||||
_BASE,
|
||||
};
|
||||
|
||||
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||
/* Base */
|
||||
[_BASE] = LAYOUT_iso( \
|
||||
/* 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 */
|
||||
KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_PSCREEN, KC_SLCK, KC_PAUSE, KC_CALC, \
|
||||
KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_DEL, KC_HOME, \
|
||||
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, KC_END, \
|
||||
KC_LSFT, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_NUHS, KC_ENT, KC_INS, KC_PGUP, \
|
||||
KC_LSFT, KC_NUBS, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, KC_PGDN, \
|
||||
KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_SPC, KC_RALT, KC_APP, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT \
|
||||
),
|
||||
};
|
27
keyboards/ms_sculpt/readme.md
Normal file
27
keyboards/ms_sculpt/readme.md
Normal file
|
@ -0,0 +1,27 @@
|
|||
# ms_sculpt
|
||||
|
||||
![ms_sculpt_with_cold_dry_joints](https://user-images.githubusercontent.com/105235786/168012266-4e235bf5-8d34-4731-ab17-2308a9d9a29e.jpg)
|
||||
|
||||
MS Sculpt Keyboard ISO-layout wired to STM32F401 / blackpill
|
||||
|
||||
* Keyboard Maintainer: [Jean Bernard](https://github.com/jn-bernard)
|
||||
* Hardware Supported: MS Sculpt Keyboard ISO-layout, STM32F401
|
||||
* Hardware Availability: Ebay
|
||||
|
||||
Make example for this keyboard (after setting up your build environment):
|
||||
|
||||
make ms_sculpt:default
|
||||
|
||||
Flashing example for this keyboard:
|
||||
|
||||
make ms_sculpt:default:flash
|
||||
|
||||
See the [build environment setup](https://docs.qmk.fm/#/getting_started_build_tools) and the [make instructions](https://docs.qmk.fm/#/getting_started_make_guide) for more information. Brand new to QMK? Start with our [Complete Newbs Guide](https://docs.qmk.fm/#/newbs).
|
||||
|
||||
## Bootloader
|
||||
|
||||
Enter the bootloader in 3 ways:
|
||||
|
||||
* **Bootmagic reset**: Hold down the key at (0,0) in the matrix (usually the top left key or Escape) and plug in the keyboard
|
||||
* **Physical reset button**: Briefly press the button on the back of the PCB - some may have pads you must short instead
|
||||
* **Keycode in layout**: Press the key mapped to `RESET` if it is available
|
3
keyboards/ms_sculpt/rules.mk
Normal file
3
keyboards/ms_sculpt/rules.mk
Normal file
|
@ -0,0 +1,3 @@
|
|||
# This file intentionally left blank
|
||||
DEBOUNCE_TYPE = sym_eager_pk
|
||||
DEBOUNCE = 3
|
25
keyboards/ms_sculpt/sculpt_iso.h
Normal file
25
keyboards/ms_sculpt/sculpt_iso.h
Normal file
|
@ -0,0 +1,25 @@
|
|||
// Copyright 2022 Jean Bernard (@jn-bernard)
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "quantum.h"
|
||||
|
||||
#define LAYOUT_iso( \
|
||||
k4D, k7C, k7B, k1B, k4B, k1A, k1F, k79, k77, k75, k78, k73, k13, k71, k31, k01, k23, \
|
||||
k7D, k0D, k0C, k2D, k1D, k7A, k7F, k09, k07, k05, k04, k15, k74, k08, k03, k21, \
|
||||
k0A, k0B, k1C, k2B, k2A, k2F, k19, k29, k27, k25, k24, k14, k17, k51, \
|
||||
k2C, k3D, k4C, k3B, k3A, k4A, k49, k39, k37, k35, k34, k45, k65, k33, k18, k11, \
|
||||
k5E, k6C, k5D, k5C, k5B, k5A, k6A, k69, k59, k57, k55, k44, k52, k63, k53, \
|
||||
k6H, k3F, k4G, k6B, k68, k46, k43, k60, k48, k64, k61 \
|
||||
) \
|
||||
{ \
|
||||
{KC_NO, k01, KC_NO, k03, k04, k05, KC_NO, k07, k08, k09, k0A, k0B, k0C, k0D, KC_NO, KC_NO, KC_NO, KC_NO}, \
|
||||
{KC_NO, k11, KC_NO, k13, k14, k15, KC_NO, k17, k18, k19, k1A, k1B, k1C, k1D, KC_NO, k1F, KC_NO, KC_NO}, \
|
||||
{KC_NO, k21, KC_NO, k23, k24, k25, KC_NO, k27, KC_NO, k29, k2A, k2B, k2C, k2D, KC_NO, k2F, KC_NO, KC_NO}, \
|
||||
{KC_NO, k31, KC_NO, k33, k34, k35, KC_NO, k37, KC_NO, k39, k3A, k3B, k6C, k3D, KC_NO, k3F, KC_NO, KC_NO}, \
|
||||
{KC_NO, KC_NO, KC_NO, k43, k44, k45, k46, KC_NO, k48, k49, k4A, k4B, k4C, k4D, KC_NO, KC_NO, k4G, KC_NO}, \
|
||||
{KC_NO, k51, k52, k53, k65, k55, KC_NO, k57, KC_NO, k59, k5A, k5B, k5C, k5D, k5E, KC_NO, KC_NO, KC_NO}, \
|
||||
{k60, k61, KC_NO, k63, k64, KC_NO, KC_NO, KC_NO, k68, k69, k6A, k6B, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, k6H}, \
|
||||
{KC_NO, k71, KC_NO, k73, k74, k75, KC_NO, k77, k78, k79, k7A, k7B, k7C, k7D, KC_NO, k7F, KC_NO, KC_NO} \
|
||||
}
|
3
keyboards/planck/keymaps/prog_qgmlwb/.gitignore
vendored
Normal file
3
keyboards/planck/keymaps/prog_qgmlwb/.gitignore
vendored
Normal file
|
@ -0,0 +1,3 @@
|
|||
build
|
||||
printout
|
||||
scripts
|
12
keyboards/planck/keymaps/prog_qgmlwb/config.h
Normal file
12
keyboards/planck/keymaps/prog_qgmlwb/config.h
Normal file
|
@ -0,0 +1,12 @@
|
|||
// Copyright 2022 David Kristoffersen (@davidkristoffersen)
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
#pragma once
|
||||
|
||||
#define ENABLE_COMPILE_KEYCODE
|
||||
|
||||
// Userspace defines
|
||||
// #define SPLIT_SPACE
|
||||
// #define NO_SPECIAL_SHIFT
|
||||
#define LAYER_EN QGMLWB_EN
|
||||
#define LAYER_NO QGMLWB_NO
|
4
keyboards/planck/keymaps/prog_qgmlwb/keymap.c
Normal file
4
keyboards/planck/keymaps/prog_qgmlwb/keymap.c
Normal file
|
@ -0,0 +1,4 @@
|
|||
// Copyright 2022 David Kristoffersen (@davidkristoffersen)
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
#include "src/layouts.h"
|
82
keyboards/planck/keymaps/prog_qgmlwb/readme.md
Normal file
82
keyboards/planck/keymaps/prog_qgmlwb/readme.md
Normal file
|
@ -0,0 +1,82 @@
|
|||
# PROG-QGMLWB
|
||||
|
||||
The prog-qgmlwb layout is a QMK firmware layout for the Planck keyboard.
|
||||
|
||||
For letter placement, the layout uses the optimized QGMLWB layout from the [Carpalx project](http://mkweb.bcgsc.ca/carpalx).
|
||||
|
||||
> The carpalx project introduces a quantitative model for typing effort and applies it to (a) evaluate QWERTY and popular alternatives, such as Dvorak and Colemak and (b) find the keyboard layouts that minimize typing effort for a given set of input documents.
|
||||
|
||||
Carpalx named "QGMLWB" as the fully optimized layout according to the English alphabet, with an effort reduction of approximately 44.4%.
|
||||
|
||||
The programming part of the name is inspired by the modified version of Dvorak, [Programmer Dvorak](http://programmer-dvorak.appspot.com), where the symbols have been adjusted logically for developers.
|
||||
|
||||
The final layout swaps some Dvorak symbols and combines them with the QGMLWB letters, giving it the name **prog-qgmlwb**.
|
||||
|
||||
The layout includes an English and Norwegian layer, whereas the Norwegian one only adds the three letters; æ, ø, and å.
|
||||
|
||||
## Typing layers
|
||||
|
||||
![Typing layers](https://i.imgur.com/QaHnqW8.png)
|
||||
|
||||
## Adjust layer
|
||||
|
||||
![Adjust layer](https://i.imgur.com/63I69P0.png)
|
||||
|
||||
## Usage
|
||||
|
||||
### Clone the QMK Firmware repo
|
||||
|
||||
```bash
|
||||
git clone --recurse-submodules https://github.com/qmk/qmk_firmware.git <path/name>
|
||||
```
|
||||
|
||||
### Move into this keymap
|
||||
|
||||
```bash
|
||||
cd <path/name>/keyboards/planck/keymaps/prog_qgmlwb
|
||||
```
|
||||
|
||||
### Initialize QMK the first time
|
||||
|
||||
Set default keyboard:
|
||||
|
||||
```bash
|
||||
qmk config user.keyboard=planck/<rev>
|
||||
```
|
||||
|
||||
Set default keymap:
|
||||
|
||||
```bash
|
||||
qmk config user.keymap=prog_qgmlwb
|
||||
```
|
||||
|
||||
Initialize libraries:
|
||||
|
||||
```bash
|
||||
qmk setup
|
||||
```
|
||||
|
||||
### Compile and flash the keyboard
|
||||
|
||||
```bash
|
||||
qmk compile
|
||||
qmk flash
|
||||
```
|
||||
|
||||
## QMK documentation
|
||||
|
||||
Found in the QMK docs: <https://docs.qmk.fm>
|
||||
|
||||
## Printing layout
|
||||
|
||||
This keymap uses macros such that [qmk configurator](https://config.qmk.fm) cannot match its behavior. The images was designed using [Figma](https://figma.com).
|
||||
|
||||
## Future additions
|
||||
|
||||
Features disabled due to the lack of storage space in the Planck PCB version 5:
|
||||
|
||||
- Audio
|
||||
- Plover mode
|
||||
- Use alt codes to fix missing characters in the english layout
|
||||
- Improve documentation of code and readme files
|
||||
- Reimplement right version of modifier keys through raise+space
|
6
keyboards/planck/keymaps/prog_qgmlwb/rules.mk
Normal file
6
keyboards/planck/keymaps/prog_qgmlwb/rules.mk
Normal file
|
@ -0,0 +1,6 @@
|
|||
# Compiler source files
|
||||
SRC += src/layouts.c
|
||||
|
||||
USER_NAME := davidkristoffersen
|
||||
|
||||
SIZE_OPTIMIZE = yes
|
23
keyboards/planck/keymaps/prog_qgmlwb/src/enums.h
Normal file
23
keyboards/planck/keymaps/prog_qgmlwb/src/enums.h
Normal file
|
@ -0,0 +1,23 @@
|
|||
// Copyright 2022 David Kristoffersen (@davidkristoffersen)
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
#pragma once
|
||||
|
||||
// Layouts enum
|
||||
enum keyboard_layouts {
|
||||
QGMLWB_NO,
|
||||
QGMLWB_EN,
|
||||
|
||||
QWERTY,
|
||||
COLEMAK,
|
||||
DVORAK,
|
||||
|
||||
NORMAL_LOWER,
|
||||
NORMAL_RAISE,
|
||||
|
||||
QGMLWB_LOWER,
|
||||
QGMLWB_RAISE,
|
||||
|
||||
ADJUST,
|
||||
NUMPAD,
|
||||
};
|
25
keyboards/planck/keymaps/prog_qgmlwb/src/layouts.c
Normal file
25
keyboards/planck/keymaps/prog_qgmlwb/src/layouts.c
Normal file
|
@ -0,0 +1,25 @@
|
|||
// Copyright 2022 David Kristoffersen (@davidkristoffersen)
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
#include "layouts.h"
|
||||
#ifdef LAYER_NO
|
||||
# include "sendstring_norwegian.h"
|
||||
#endif
|
||||
|
||||
KEYMAP keymaps [][MATRIX_ROWS][MATRIX_COLS] = {
|
||||
[QGMLWB_NO] = qgmlwb_no_map,
|
||||
[QGMLWB_EN] = qgmlwb_en_map,
|
||||
|
||||
[QWERTY] = qwerty_map,
|
||||
[COLEMAK] = colemak_map,
|
||||
[DVORAK] = dvorak_map,
|
||||
|
||||
[NORMAL_LOWER] = normal_lower_map,
|
||||
[NORMAL_RAISE] = normal_raise_map,
|
||||
|
||||
[QGMLWB_LOWER] = qgmlwb_lower_map,
|
||||
[QGMLWB_RAISE] = qgmlwb_raise_map,
|
||||
|
||||
[ADJUST] = adjust_map,
|
||||
[NUMPAD] = numpad_map,
|
||||
};
|
27
keyboards/planck/keymaps/prog_qgmlwb/src/layouts.h
Normal file
27
keyboards/planck/keymaps/prog_qgmlwb/src/layouts.h
Normal file
|
@ -0,0 +1,27 @@
|
|||
// Copyright 2022 David Kristoffersen (@davidkristoffersen)
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
#pragma once
|
||||
|
||||
#include QMK_KEYBOARD_H
|
||||
|
||||
#include "davidkristoffersen.h"
|
||||
#include "enums.h"
|
||||
|
||||
#include "normal.h"
|
||||
#include "qgmlwb.h"
|
||||
#include "special.h"
|
||||
|
||||
#define KEYMAP const uint16_t PROGMEM
|
||||
|
||||
// Layouts keycodes
|
||||
#define lower MO(NORMAL_LOWER)
|
||||
#define raise MO(NORMAL_RAISE)
|
||||
|
||||
#define QLower MO(QGMLWB_LOWER)
|
||||
#define QRaise MO(QGMLWB_RAISE)
|
||||
|
||||
#define adjust MO(ADJUST)
|
||||
#define numpad MO(NUMPAD)
|
||||
|
||||
extern KEYMAP keymaps [][MATRIX_ROWS][MATRIX_COLS];
|
96
keyboards/planck/keymaps/prog_qgmlwb/src/normal.h
Normal file
96
keyboards/planck/keymaps/prog_qgmlwb/src/normal.h
Normal file
|
@ -0,0 +1,96 @@
|
|||
// Copyright 2022 David Kristoffersen (@davidkristoffersen)
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "layouts.h"
|
||||
|
||||
/* Qwerty
|
||||
* ,-----------------------------------------------------------------------------------.
|
||||
* | Tab | Q | W | E | R | T | Y | U | I | O | P | Bksp |
|
||||
* |------+------+------+------+------+------+------+------+------+------+------+------|
|
||||
* | Esc | A | S | D | F | G | H | J | K | L | ;: |Return|
|
||||
* |------+------+------+------+------+------+------+------+------+------+------+------|
|
||||
* | Shift| Z | X | C | V | B | N | M | ,< | .> | /? | Shift|
|
||||
* |------+------+------+------+------+------+------+------+------+------+------+------|
|
||||
* | Ctrl | Alt |NumPad| GUI | Lower| Space| Space| Raise| Left | Down | Up | Right|
|
||||
* `-----------------------------------------------------------------------------------'
|
||||
*/
|
||||
#define qwerty_map LAYOUT_ortho_4x12(\
|
||||
KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC,\
|
||||
KC_ESC, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_ENT,\
|
||||
KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSHIFT,\
|
||||
KC_LCTL, KC_LALT, numpad, KC_LGUI, lower, KC_SPC, KC_SPC, raise, KC_LEFT, KC_DOWN, KC_UP, KC_RIGHT\
|
||||
)
|
||||
|
||||
/* Colemak
|
||||
* ,-----------------------------------------------------------------------------------.
|
||||
* | Tab | Q | W | F | P | G | J | L | U | Y | ; | Bksp |
|
||||
* |------+------+------+------+------+------+------+------+------+------+------+------|
|
||||
* | Esc | A | R | S | T | D | H | N | E | I | O |Return|
|
||||
* |------+------+------+------+------+------+------+------+------+------+------+------|
|
||||
* | Shift| Z | X | C | V | B | K | M | , | . | / | " |
|
||||
* |------+------+------+------+------+------+------+------+------+------+------+------|
|
||||
* | Ctrl | Alt |NumPad| GUI | Lower| Space| Space| Raise| Left | Down | Up | Right|
|
||||
* `-----------------------------------------------------------------------------------'
|
||||
*/
|
||||
#define colemak_map LAYOUT_ortho_4x12(\
|
||||
KC_TAB, KC_Q, KC_W, KC_F, KC_P, KC_G, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_BSPC,\
|
||||
KC_ESC, KC_A, KC_R, KC_S, KC_T, KC_D, KC_H, KC_N, KC_E, KC_I, KC_O, KC_ENT,\
|
||||
KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_K, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_QUOT,\
|
||||
KC_LCTL, KC_LALT, numpad, KC_LGUI, lower, KC_SPC, KC_SPC, raise, KC_LEFT, KC_DOWN, KC_UP, KC_RIGHT\
|
||||
)
|
||||
|
||||
/* Dvorak
|
||||
* ,-----------------------------------------------------------------------------------.
|
||||
* | Tab | " | , | . | P | Y | F | G | C | R | L | Bksp |
|
||||
* |------+------+------+------+------+------+------+------+------+------+------+------|
|
||||
* | Esc | A | O | E | U | I | D | H | T | N | S |Return|
|
||||
* |------+------+------+------+------+------+------+------+------+------+------+------|
|
||||
* | Shift| ; | Q | J | K | X | B | M | W | V | Z | \ |
|
||||
* |------+------+------+------+------+------+------+------+------+------+------+------|
|
||||
* | Ctrl | Alt |NumPad| GUI | Lower| Space| Space| Raise| Left | Down | Up | Right|
|
||||
* `-----------------------------------------------------------------------------------'
|
||||
*/
|
||||
#define dvorak_map LAYOUT_ortho_4x12(\
|
||||
KC_TAB, KC_QUOT, KC_COMM, KC_DOT, KC_P, KC_Y, KC_F, KC_G, KC_C, KC_R, KC_L, KC_BSPC,\
|
||||
KC_ESC, KC_A, KC_O, KC_E, KC_U, KC_I, KC_D, KC_H, KC_T, KC_N, KC_S, KC_ENT,\
|
||||
KC_LSFT, KC_SCLN, KC_Q, KC_J, KC_K, KC_X, KC_B, KC_M, KC_W, KC_V, KC_Z, KC_SLSH,\
|
||||
KC_LCTL, KC_LALT, numpad, KC_LGUI, lower, KC_SPC, KC_SPC, raise, KC_LEFT, KC_DOWN, KC_UP, KC_RIGHT\
|
||||
)
|
||||
|
||||
/* Lower - Normal
|
||||
* ,-----------------------------------------------------------------------------------.
|
||||
* | ~ | ! | @ | # | $ | % | ^ | & | * | ( | ) | Bksp |
|
||||
* |------+------+------+------+------+------+------+------+------+------+------+------|
|
||||
* | Del | F1 | F2 | F3 | F4 | F5 | F6 | _ | + | { | } | | |
|
||||
* |------+------+------+------+------+------+------+------+------+------+------+------|
|
||||
* | | F7 | F8 | F9 | F10 | F11 | F12 | End | Home | XXXX | XXXX | |
|
||||
* |------+------+------+------+------+------+------+------+------+------+------+------|
|
||||
* | | | | | | | | | Next | Vol- | Vol+ | Play |
|
||||
* `-----------------------------------------------------------------------------------'
|
||||
*/
|
||||
#define normal_lower_map LAYOUT_ortho_4x12(\
|
||||
KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_BSPC,\
|
||||
KC_DEL, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_PIPE,\
|
||||
_______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_END, KC_HOME, XXXXXXX, XXXXXXX, _______,\
|
||||
_______, _______, _______, _______, _______, _______, _______, adjust, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY\
|
||||
)
|
||||
|
||||
/* Raise - Normal
|
||||
* ,-----------------------------------------------------------------------------------.
|
||||
* | ` | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | Bksp |
|
||||
* |------+------+------+------+------+------+------+------+------+------+------+------|
|
||||
* | Del | F1 | F2 | F3 | F4 | F5 | F6 | - | = | [ | ] | \ |
|
||||
* |------+------+------+------+------+------+------+------+------+------+------+------|
|
||||
* | | F7 | F8 | F9 | F10 | F11 | F12 | # | \ | PgDn | PgUp | |
|
||||
* |------+------+------+------+------+------+------+------+------+------+------+------|
|
||||
* | | | | | | | | | Next | Vol- | Vol+ | Play |
|
||||
* `-----------------------------------------------------------------------------------'
|
||||
*/
|
||||
#define normal_raise_map LAYOUT_ortho_4x12(\
|
||||
KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC,\
|
||||
KC_DEL, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS,\
|
||||
_______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_HASH, KC_BSLS, KC_PGDN, KC_PGUP, _______,\
|
||||
_______, _______, _______, _______, adjust, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY\
|
||||
)
|
63
keyboards/planck/keymaps/prog_qgmlwb/src/qgmlwb.h
Normal file
63
keyboards/planck/keymaps/prog_qgmlwb/src/qgmlwb.h
Normal file
|
@ -0,0 +1,63 @@
|
|||
// Copyright 2022 David Kristoffersen (@davidkristoffersen)
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "layouts.h"
|
||||
|
||||
/* QGMLWB
|
||||
* ,-----------------------------------------------------------------------------------.
|
||||
* | Tab | Q | G | M | L | W | B | Y | U | V | '" | Bksp |
|
||||
* |------+------+------+------+------+------+------+------+------+------+------+------|
|
||||
* | Esc | D | S | T | N | R | I | A | E | O | H |Return|
|
||||
* |------+------+------+------+------+------+------+------+------+------+------+------|
|
||||
* | Shift| Z | X | C | F | J | K | P | ,; | .: | -_ | \| |
|
||||
* |------+------+------+------+------+------+------+------+------+------+------+------|
|
||||
* | Ctrl | Alt |NumPad| GUI | Lower|LSpace|RSpace| Raise| Left | Down | Up | Right|
|
||||
* `-----------------------------------------------------------------------------------'
|
||||
*/
|
||||
// English Layout
|
||||
#define qgmlwb_en_map LAYOUT_ortho_4x12(\
|
||||
KC_TAB, KC_Q, KC_G, KC_M, KC_L, KC_W, KC_B, KC_Y, KC_U, KC_V, KC_QUOT, KC_BSPC,\
|
||||
KC_ESC, KC_D, KC_S, KC_T, KC_N, KC_R, KC_I, KC_A, KC_E, KC_O, KC_H, KC_ENT,\
|
||||
KC_LSFT, KC_Z, KC_X, KC_C, KC_F, KC_J, KC_K, KC_P, KC_COMM, KC_DOT, KC_MINS, KC_BSLS,\
|
||||
KC_LCTL, KC_LALT, numpad, KC_LGUI, QLower, KC_LSPC, KC_RSPC, QRaise, KC_LEFT, KC_DOWN, KC_UP, KC_RIGHT\
|
||||
)
|
||||
// Norwegian Layout
|
||||
#define qgmlwb_no_map qgmlwb_en_map
|
||||
|
||||
/* Lower - QGMLWB
|
||||
* ,-----------------------------------------------------------------------------------.
|
||||
* | ! | % | [ | { | ( | < | > | ) | } | ] | & | |
|
||||
* |------+------+------+------+------+------+------+------+------+------+------+------|
|
||||
* | Del | Mute | XXXX | Refr | XXXX | XXXX | XXXX | = | + | * | / | ~ |
|
||||
* |------+------+------+------+------+------+------+------+------+------+------+------|
|
||||
* | | Sleep|ScrLck| Caps |NumLck|PrtScr| Ins | End | Home | Æ | Ø | Å |
|
||||
* |------+------+------+------+------+------+------+------+------+------+------+------|
|
||||
* | | | | | | | |Adjust| Bri- | Vol- | Vol+ | Bri+ |
|
||||
* `-----------------------------------------------------------------------------------'
|
||||
*/
|
||||
#define qgmlwb_lower_map LAYOUT_ortho_4x12(\
|
||||
KC_EXLM, KC_PERC, KC_LBRC, KC_LCBR, KC_LPRN, KC_LT, KC_GT, KC_RPRN, KC_RCBR, KC_RBRC, KC_AMPR, _______,\
|
||||
KC_DEL, KC_MUTE, XXXXXXX, KC_WREF, XXXXXXX, XXXXXXX, XXXXXXX, KC_EQL, KC_PLUS, KC_ASTR, KC_SLSH, KC_TILD,\
|
||||
_______, KC_SLEP, KC_SLCK, KC_CAPS, KC_NLCK, KC_PSCR, KC_INS, KC_END, KC_HOME, KC_AE, KC_OE, KC_AA,\
|
||||
_______, _______, _______, _______, _______, _______, _______, adjust, KC_BRID, KC_VOLD, KC_VOLU, KC_BRIU\
|
||||
)
|
||||
|
||||
/* Raise - QGMLWB
|
||||
* ,-----------------------------------------------------------------------------------.
|
||||
* | ? | 9 | 7 | 5 | 3 | 1 | 0 | 2 | 4 | 6 | 8 | |
|
||||
* |------+------+------+------+------+------+------+------+------+------+------+------|
|
||||
* | Del+ | F1 | F2 | F3 | F4 | F5 | F6 | # | @ | ^ | $ | ` |
|
||||
* |------+------+------+------+------+------+------+------+------+------+------+------|
|
||||
* |RShift| F7 | F8 | F9 | F10 | F11 | F12 | PgDn | PgUp | XXXX | XXXX | XXXX |
|
||||
* |------+------+------+------+------+------+------+------+------+------+------+------|
|
||||
* | RCtrl| RAlt | | |Adjust| | | | Prev | Stop | Play | Next |
|
||||
* `-----------------------------------------------------------------------------------'
|
||||
*/
|
||||
#define qgmlwb_raise_map LAYOUT_ortho_4x12(\
|
||||
KC_QUES, KC_9, KC_7, KC_5, KC_3, KC_1, KC_0, KC_2, KC_4, KC_6, KC_8, _______,\
|
||||
S(KC_DEL), KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_HASH, KC_AT, KC_CIRC, KC_DLR, KC_GRV,\
|
||||
_______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_PGDN, KC_PGUP, XXXXXXX, XXXXXXX, XXXXXXX,\
|
||||
_______, _______, _______, _______, adjust, _______, _______, _______, KC_MPRV, KC_MSTP, KC_MPLY, KC_MNXT\
|
||||
)
|
43
keyboards/planck/keymaps/prog_qgmlwb/src/special.h
Normal file
43
keyboards/planck/keymaps/prog_qgmlwb/src/special.h
Normal file
|
@ -0,0 +1,43 @@
|
|||
// Copyright 2022 David Kristoffersen (@davidkristoffersen)
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "layouts.h"
|
||||
|
||||
/* Adjust
|
||||
* v------------------------RGB CONTROL--------------------v
|
||||
* ,-----------------------------------------------------------------------------------.
|
||||
* | | Reset| Debug| RGB |RGBMod| Hue- | Hue+ | Sat- | Sat+ | Bri- | Bri+ | Del |
|
||||
* |------+------+------+------+------+------+------+------+------+------+------+------|
|
||||
* | | XXXX |MusMod|AudOff| AudOn|AgNorm|AgSwap|Dvorak|Colmak|Qwerty|QgmlEN|QgmlNO|
|
||||
* |------+------+------+------+------+------+------+------+------+------+------+------|
|
||||
* | |Voice-|Voice+|MusOff| MusOn|MIDIOf|MIDIOn|TermOf|TermOn| T0 | T1 | T2 |
|
||||
* |------+------+------+------+------+------+------+------+------+------+------+------|
|
||||
* | | | | | | | | XXXX | XXXX | XXXX | XXXX |
|
||||
* `-----------------------------------------------------------------------------------'
|
||||
*/
|
||||
#define adjust_map LAYOUT_ortho_4x12(\
|
||||
QK_RBT, QK_BOOT, DB_TOGG, RGB_TOG, RGB_MOD, RGB_HUD, RGB_HUI, RGB_SAD, RGB_SAI, RGB_VAD, RGB_VAI, KC_DEL,\
|
||||
QK_MAKE, XXXXXXX, MU_MOD, AU_OFF, AU_ON, AG_NORM, AG_SWAP, DF(DVORAK), DF(COLEMAK), DF(QWERTY), DF(QGMLWB_EN), DF(QGMLWB_NO),\
|
||||
_______, MUV_IN, MUV_DE, MU_OFF, MU_ON, MI_OFF, MI_ON, TERM_OFF, TERM_ON, KC_T0, KC_T1, KC_T2,\
|
||||
_______, _______, _______, _______, _______, _______, _______, _______, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX\
|
||||
)
|
||||
|
||||
/* Numpad
|
||||
* ,-----------------------------------------------------------------------------------.
|
||||
* | | XXXX | XXXX | XXXX | XXXX | XXXX | XXXX | 7 | 8 | 9 | / | |
|
||||
* |------+------+------+------+------+------+------+------+------+------+------+------|
|
||||
* | | XXXX | XXXX | XXXX | XXXX | XXXX | XXXX | 4 | 5 | 6 | * | |
|
||||
* |------+------+------+------+------+------+------+------+------+------+------+------|
|
||||
* | | XXXX | XXXX | XXXX | XXXX | XXXX | XXXX | 1 | 2 | 3 | - | XXXX |
|
||||
* |------+------+------+------+------+------+------+------+------+------+------+------|
|
||||
* | | | | | XXXX | | | 0 | , | . | + | XXXX |
|
||||
* `-----------------------------------------------------------------------------------'
|
||||
*/
|
||||
#define numpad_map LAYOUT_ortho_4x12(\
|
||||
_______, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_7, KC_8, KC_9, KC_KP_SLASH, _______,\
|
||||
_______, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_4, KC_5, KC_6, KC_KP_ASTERISK, _______,\
|
||||
_______, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_1, KC_2, KC_3, KC_KP_MINUS, XXXXXXX,\
|
||||
_______, _______, _______, _______, XXXXXXX, _______, _______, KC_0, KC_COMM, KC_DOT, KC_KP_PLUS, XXXXXXX\
|
||||
)
|
18
users/davidkristoffersen/davidkristoffersen.h
Normal file
18
users/davidkristoffersen/davidkristoffersen.h
Normal file
|
@ -0,0 +1,18 @@
|
|||
// Copyright 2022 David Kristoffersen (@davidkristoffersen)
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
#pragma once
|
||||
|
||||
#include QMK_KEYBOARD_H
|
||||
|
||||
#include "src/enums.h"
|
||||
|
||||
#ifdef LAYER_NO
|
||||
# include "macros/norwegian.h"
|
||||
#endif
|
||||
|
||||
#include "util/functions.h"
|
||||
|
||||
#include "hardware/split_space.h"
|
||||
|
||||
#include "macros/macros.h"
|
3
users/davidkristoffersen/hardware/readme.md
Normal file
3
users/davidkristoffersen/hardware/readme.md
Normal file
|
@ -0,0 +1,3 @@
|
|||
# Hardware
|
||||
|
||||
This directory contains hardware related macros.
|
23
users/davidkristoffersen/hardware/split_space.c
Normal file
23
users/davidkristoffersen/hardware/split_space.c
Normal file
|
@ -0,0 +1,23 @@
|
|||
// Copyright 2022 David Kristoffersen (@davidkristoffersen)
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
#include "split_space.h"
|
||||
|
||||
#ifdef SPLIT_SPACE
|
||||
void handle_split_space(uint16_t keycode) {
|
||||
// Disable modifiers when numpad is active
|
||||
if (IS_LAYER_ON(NUMPAD)) clear_oneshot_mods();
|
||||
|
||||
if (keycode == KC_LSPC) {
|
||||
// 2ng tap: Activate ctrl if shift is active
|
||||
if (get_oneshot_mods() & MOD_MASK_SHIFT) {
|
||||
clear_oneshot_mods();
|
||||
set_oneshot_mods(MOD_LCTL);
|
||||
}
|
||||
// 1st. tap: Activate shift if no modifier is active
|
||||
else {
|
||||
set_oneshot_mods(MOD_LSFT);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
16
users/davidkristoffersen/hardware/split_space.h
Normal file
16
users/davidkristoffersen/hardware/split_space.h
Normal file
|
@ -0,0 +1,16 @@
|
|||
// Copyright 2022 David Kristoffersen (@davidkristoffersen)
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "davidkristoffersen.h"
|
||||
|
||||
#define KC_RSPC KC_SPACE
|
||||
|
||||
#ifdef SPLIT_SPACE
|
||||
# define KC_LSPC LT(NUMPAD, KC_NO)
|
||||
#else
|
||||
# define KC_LSPC KC_SPACE
|
||||
#endif
|
||||
|
||||
void handle_split_space(uint16_t keycode);
|
36
users/davidkristoffersen/macros/debug.c
Normal file
36
users/davidkristoffersen/macros/debug.c
Normal file
|
@ -0,0 +1,36 @@
|
|||
// Copyright 2022 David Kristoffersen (@davidkristoffersen)
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
#include "macros.h"
|
||||
|
||||
// Replace key records with macros
|
||||
bool handle_test(uint16_t keycode) {
|
||||
switch (keycode) {
|
||||
case KC_T0: {
|
||||
// Test QK_MAKE command
|
||||
SEND_STRING("qmk compile -kb " QMK_KEYBOARD " -km " QMK_KEYMAP);
|
||||
break;
|
||||
}
|
||||
case KC_T1:
|
||||
// Test ascii characters
|
||||
SEND_STRING(" !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~");
|
||||
break;
|
||||
case KC_T2:
|
||||
#ifdef LAYER_NO
|
||||
// Test other characters
|
||||
tap_code16(NO_AE);
|
||||
tap_code16(NO_OE);
|
||||
tap_code16(NO_AA);
|
||||
tap_code16(S(NO_AE));
|
||||
tap_code16(S(NO_OE));
|
||||
tap_code16(S(NO_AA));
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
};
|
||||
|
||||
bool process_debug(uint16_t keycode, keyrecord_t* record) {
|
||||
HANDLE_FALSE(handle_test(keycode));
|
||||
return true;
|
||||
}
|
40
users/davidkristoffersen/macros/language.c
Normal file
40
users/davidkristoffersen/macros/language.c
Normal file
|
@ -0,0 +1,40 @@
|
|||
// Copyright 2022 David Kristoffersen (@davidkristoffersen)
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
#include "macros.h"
|
||||
|
||||
bool handle_language(uint16_t keycode) {
|
||||
#ifdef LAYER_NO
|
||||
// Handle conversion of English to Norwegian codes
|
||||
uint16_t org_keycode = keycode;
|
||||
keycode = get_norwegian_code(keycode);
|
||||
#endif
|
||||
|
||||
#ifndef NO_SPECIAL_SHIFT
|
||||
// Handle conversion of special shift codes
|
||||
if (get_mods() & MOD_MASK_SHIFT) {
|
||||
uint16_t shifted_key = get_special_shifted_code(keycode);
|
||||
if (shifted_key != keycode) {
|
||||
// Tap shifted key while shift is disabled
|
||||
unregister_code(KC_LSFT);
|
||||
tap_code16(shifted_key);
|
||||
register_code(KC_LSFT);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef LAYER_NO
|
||||
// Tap new language key
|
||||
if (keycode != org_keycode) {
|
||||
tap_code16(keycode);
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
|
||||
bool process_language(uint16_t keycode, keyrecord_t* record) {
|
||||
HANDLE_FALSE(handle_language(keycode));
|
||||
return true;
|
||||
}
|
16
users/davidkristoffersen/macros/macros.c
Normal file
16
users/davidkristoffersen/macros/macros.c
Normal file
|
@ -0,0 +1,16 @@
|
|||
// Copyright 2022 David Kristoffersen (@davidkristoffersen)
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
#include "macros.h"
|
||||
|
||||
// Prepend key records with macros
|
||||
bool process_record_user(uint16_t keycode, keyrecord_t* record) {
|
||||
if (record->event.pressed) {
|
||||
#ifdef SPLIT_SPACE
|
||||
handle_split_space(keycode, record);
|
||||
#endif
|
||||
HANDLE_FALSE(process_debug(keycode, record));
|
||||
HANDLE_FALSE(process_language(keycode, record));
|
||||
}
|
||||
return true;
|
||||
}
|
23
users/davidkristoffersen/macros/macros.h
Normal file
23
users/davidkristoffersen/macros/macros.h
Normal file
|
@ -0,0 +1,23 @@
|
|||
// Copyright 2022 David Kristoffersen (@davidkristoffersen)
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "davidkristoffersen.h"
|
||||
|
||||
enum keycodes {
|
||||
// Test keys
|
||||
KC_T0 = SAFE_RANGE,
|
||||
KC_T1,
|
||||
KC_T2,
|
||||
// Norwegian Æ, Ø, Å
|
||||
KC_AE,
|
||||
KC_OE,
|
||||
KC_AA
|
||||
};
|
||||
|
||||
bool process_debug(uint16_t keycode, keyrecord_t* record);
|
||||
bool process_language(uint16_t keycode, keyrecord_t* record);
|
||||
|
||||
// Prepend key records with macros
|
||||
bool process_record_user(uint16_t keycode, keyrecord_t* record);
|
19
users/davidkristoffersen/macros/norwegian.h
Normal file
19
users/davidkristoffersen/macros/norwegian.h
Normal file
|
@ -0,0 +1,19 @@
|
|||
// Copyright 2022 David Kristoffersen (@davidkristoffersen)
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "keymap_extras/keymap_norwegian.h"
|
||||
#include "davidkristoffersen.h"
|
||||
|
||||
// Better norwegian defines
|
||||
#undef NO_LESS
|
||||
#define NO_LESS KC_NUBS // <
|
||||
#undef NO_GRTR
|
||||
#define NO_GRTR S(NO_LESS) // >
|
||||
#undef NO_AE
|
||||
#define NO_AE KC_QUOT // Æ
|
||||
#undef NO_OE
|
||||
#define NO_OE KC_SCLN // Ø
|
||||
#undef NO_AA
|
||||
#define NO_AA KC_LBRC // Å
|
3
users/davidkristoffersen/macros/readme.md
Normal file
3
users/davidkristoffersen/macros/readme.md
Normal file
|
@ -0,0 +1,3 @@
|
|||
# Macros
|
||||
|
||||
This directory contains any type of dynamic and static macros.
|
8
users/davidkristoffersen/post_config.h
Normal file
8
users/davidkristoffersen/post_config.h
Normal file
|
@ -0,0 +1,8 @@
|
|||
// Copyright 2022 David Kristoffersen (@davidkristoffersen)
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef LAYER_EN
|
||||
# define LAYER_EN LAYER_DEFAULT
|
||||
#endif
|
3
users/davidkristoffersen/readme.md
Normal file
3
users/davidkristoffersen/readme.md
Normal file
|
@ -0,0 +1,3 @@
|
|||
# Overview
|
||||
|
||||
This userspace contains all the utility functions and macros related to my keymaps.
|
12
users/davidkristoffersen/rules.mk
Normal file
12
users/davidkristoffersen/rules.mk
Normal file
|
@ -0,0 +1,12 @@
|
|||
SRC += $(USER_PATH)/util/functions.c \
|
||||
$(USER_PATH)/hardware/split_space.c \
|
||||
$(USER_PATH)/macros/macros.c \
|
||||
$(USER_PATH)/macros/debug.c \
|
||||
$(USER_PATH)/macros/language.c
|
||||
|
||||
# Firmware size optimizations
|
||||
ifeq ($(strip $(SIZE_OPTIMIZE)), yes)
|
||||
CONSOLE_ENABLE := no # 1646: Console for debug
|
||||
AUDIO_ENABLE := no # 8682: Audio output on port C6
|
||||
LTO_ENABLE := yes # 2772: Link time optimization
|
||||
endif
|
111
users/davidkristoffersen/util/functions.c
Normal file
111
users/davidkristoffersen/util/functions.c
Normal file
|
@ -0,0 +1,111 @@
|
|||
// Copyright 2022 David Kristoffersen (@davidkristoffersen)
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
#include "functions.h"
|
||||
|
||||
#ifndef NO_SPECIAL_SHIFT
|
||||
// Code set to swap struct
|
||||
typedef struct code_set {
|
||||
uint16_t pre;
|
||||
uint16_t post;
|
||||
} code_set_t;
|
||||
|
||||
// Shift codes conversion struct
|
||||
typedef struct shift_code {
|
||||
int lang;
|
||||
int size;
|
||||
code_set_t* codes;
|
||||
} shift_code_t;
|
||||
|
||||
#ifdef LAYER_NO
|
||||
code_set_t NO_SHIFT_CODES [] = {
|
||||
{NO_QUOT, NO_DQUO},
|
||||
{NO_BSLS, NO_PIPE},
|
||||
};
|
||||
#endif
|
||||
|
||||
code_set_t EN_SHIFT_CODES [] = {
|
||||
{KC_COMM, KC_SCLN},
|
||||
{KC_DOT, KC_COLN},
|
||||
};
|
||||
|
||||
// Array of shift code conversions
|
||||
const shift_code_t SHIFT_CODES [] = {
|
||||
#ifdef LAYER_NO
|
||||
{.lang = LAYER_NO,
|
||||
.size = ARR_LEN(NO_SHIFT_CODES),
|
||||
.codes = NO_SHIFT_CODES},
|
||||
#endif
|
||||
{.lang = LAYER_EN,
|
||||
.size = ARR_LEN(EN_SHIFT_CODES),
|
||||
.codes = EN_SHIFT_CODES},
|
||||
};
|
||||
const int SHIFT_CODES_SIZE = ARR_LEN(SHIFT_CODES);
|
||||
#endif
|
||||
|
||||
#ifdef LAYER_NO
|
||||
// Array of English to Norwegian code translations
|
||||
const code_set_t EN2NO_CODES [] = {
|
||||
{KC_QUOT, NO_QUOT},
|
||||
{KC_MINS, NO_MINS},
|
||||
{KC_BSLS, NO_BSLS},
|
||||
{KC_LBRC, NO_LBRC},
|
||||
{KC_LCBR, NO_LCBR},
|
||||
{KC_LPRN, NO_LPRN},
|
||||
{KC_LT, NO_LESS},
|
||||
{KC_GT, NO_GRTR},
|
||||
{KC_RPRN, NO_RPRN},
|
||||
{KC_RCBR, NO_RCBR},
|
||||
{KC_RBRC, NO_RBRC},
|
||||
{KC_AMPR, NO_AMPR},
|
||||
{KC_EQL, NO_EQL},
|
||||
{KC_PLUS, NO_PLUS},
|
||||
{KC_ASTR, NO_ASTR},
|
||||
{KC_SLSH, NO_SLSH},
|
||||
{KC_TILD, NO_TILD},
|
||||
{KC_AE, NO_AE},
|
||||
{KC_OE, NO_OE},
|
||||
{KC_AA, NO_AA},
|
||||
{KC_QUES, NO_QUES},
|
||||
{KC_AT, NO_AT},
|
||||
{KC_CIRC, NO_CIRC},
|
||||
{KC_DLR, NO_DLR},
|
||||
{KC_GRV, NO_GRV}
|
||||
};
|
||||
const int EN2NO_CODES_SIZE = ARR_LEN(EN2NO_CODES);
|
||||
#endif
|
||||
|
||||
// Check if layer is an active default layer
|
||||
bool is_default_on(int layer) {
|
||||
return layer == LAYER_DEFAULT
|
||||
? true
|
||||
: layer_state_cmp(default_layer_state, layer);
|
||||
}
|
||||
|
||||
#ifndef NO_SPECIAL_SHIFT
|
||||
// Get special shifted code
|
||||
uint16_t get_special_shifted_code(uint16_t keycode) {
|
||||
for (int i = 0; i < SHIFT_CODES_SIZE; i++) {
|
||||
if (IS_DEFAULT_OFF(SHIFT_CODES[i].lang)) continue;
|
||||
for (int j = 0; j < SHIFT_CODES[i].size; j++) {
|
||||
if (keycode == SHIFT_CODES[i].codes[j].pre)
|
||||
return SHIFT_CODES[i].codes[j].post;
|
||||
}
|
||||
}
|
||||
return keycode;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef LAYER_NO
|
||||
// Get language specific code
|
||||
uint16_t get_norwegian_code(uint16_t keycode) {
|
||||
if (IS_DEFAULT_ON(LAYER_NO)) {
|
||||
for (int i = 0; i < EN2NO_CODES_SIZE; i++) {
|
||||
if (keycode == EN2NO_CODES[i].pre) {
|
||||
return EN2NO_CODES[i].post;
|
||||
}
|
||||
}
|
||||
}
|
||||
return keycode;
|
||||
}
|
||||
#endif
|
32
users/davidkristoffersen/util/functions.h
Normal file
32
users/davidkristoffersen/util/functions.h
Normal file
|
@ -0,0 +1,32 @@
|
|||
// Copyright 2022 David Kristoffersen (@davidkristoffersen)
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "davidkristoffersen.h"
|
||||
|
||||
// Default layer if none is specified
|
||||
#define LAYER_DEFAULT -1
|
||||
|
||||
// Check if layer is an active default layer
|
||||
#define IS_DEFAULT_ON(layer) is_default_on(layer)
|
||||
// Check if layer is an inactive default layer
|
||||
#define IS_DEFAULT_OFF(layer) !is_default_on(layer)
|
||||
|
||||
// Return false if test equal false
|
||||
#define HANDLE_FALSE(bool) if (!bool) return false;
|
||||
// Generic array lenght define
|
||||
#define ARR_LEN(arr) (sizeof(arr) / sizeof(arr)[0])
|
||||
// Printf-like functionality for send_string
|
||||
#define SEND_VAR(str, ...) \
|
||||
do { \
|
||||
char var[128]; \
|
||||
sprintf(var, str, __VA_ARGS__); \
|
||||
send_string(var); \
|
||||
} while(0)
|
||||
|
||||
// Get special shifted code
|
||||
uint16_t get_special_shifted_code(uint16_t keycode);
|
||||
|
||||
// Get language specific code
|
||||
uint16_t get_norwegian_code(uint16_t keycode);
|
3
users/davidkristoffersen/util/readme.md
Normal file
3
users/davidkristoffersen/util/readme.md
Normal file
|
@ -0,0 +1,3 @@
|
|||
# Utility
|
||||
|
||||
This directory contains utility functions meant to assist the other files of the userspace.
|
Loading…
Reference in a new issue