[Keymap] Add dlip Layout to Chouchou keyboard

This commit is contained in:
Dane Lipscombe 2023-09-15 15:23:55 +10:00
parent d91857d5bb
commit 50c47ad4be
14 changed files with 1829 additions and 0 deletions

View File

@ -0,0 +1,19 @@
// Copyright 2023 Dane Lipscombe (@dlip)
// SPDX-License-Identifier: GPL-2.0-or-later
#pragma once
#define TAIPO_TAP_TIMEOUT 150
#define ONESHOT_TIMEOUT 1000
#define FORCE_NKRO
// Joystick Button Count
#define JOYSTICK_BUTTON_COUNT 32
// Joystick Axes Count
#define JOYSTICK_AXIS_COUNT 6
// Joystick Axes Resolution
#define JOYSTICK_AXIS_RESOLUTION 8

View File

@ -0,0 +1,48 @@
// Copyright 2023 Dane Lipscombe (@dlip)
// SPDX-License-Identifier: GPL-2.0-or-later
#include QMK_KEYBOARD_H
#include "dlip.h"
enum my_layers {
_TAIPO,
_GAMING,
_GAMEPAD,
_GAMING2,
};
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[_TAIPO] = LAYOUT_split_2x4_2(
TP_TLP, TP_TLR, TP_TLM, TP_TLI, TP_TRI, TP_TRM, TP_TRR, TP_TRP,
TP_BLP, TP_BLR, TP_BLM, TP_BLI, TP_BRI, TP_BRM, TP_BRR, TP_BRP,
TP_LIT, TP_LOT, TP_ROT, TP_RIT
),
[_GAMING] = LAYOUT_split_2x4_2(
KC_TAB, KC_Q, KC_W, KC_E, KC_U, KC_I, KC_O, KC_P,
KC_LSFT, KC_A, KC_S, KC_D, KC_J, KC_K, KC_L, KC_SCLN,
MO(_GAMING2), KC_SPC, KC_ENTER, KC_ESC
),
[_GAMEPAD] = LAYOUT_split_2x4_2(
XXXXXXX, GP_BCK, GP_DPU, GP_STA, GP_X, GP_Y, GP_RB, GP_LB,
GP_HOM, GP_DPL, GP_DPD, GP_DPR, GP_A, GP_B, GP_RT, GP_LT,
MO(_GAMING2), GP_DPU, GP_LSB, GP_RSB
),
[_GAMING2] = LAYOUT_split_2x4_2(
TO(_TAIPO), KC_ESC, KC_UP, KC_ENTER, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
KC_BSPC, KC_LEFT, KC_DOWN, KC_RIGHT, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX
),
};
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
if (IS_LAYER_ON(_TAIPO)) {
return taipo_process_record_user(keycode, record);
} else if (IS_LAYER_ON(_GAMEPAD)) {
return gamepad_process_record_user(keycode, record);
} else {
return true;
}
};
void matrix_scan_user(void) {
taipo_matrix_scan_user();
}

View File

@ -0,0 +1,6 @@
TAIPO_ENABLE = yes
# Enable Joystick
JOYSTICK_ENABLE = yes
JOYSTICK_DRIVER = digital

View File

@ -9,6 +9,8 @@ Chouchou (Japanese for butterfly) is a minimalist unibody keyboard designed to b
Make example for this keyboard (after setting up your build environment):
Note: The default layout is mainly for testing. You can change 'default' to 'dlip' for a fully featured layout.
make chouchou:default
Flashing example for this keyboard:

View File

@ -0,0 +1,59 @@
// Copyright 2023 Dane Lipscombe (@dlip)
// SPDX-License-Identifier: GPL-2.0-or-later
#pragma once
enum custom_keycodes {
TP_TLP = QK_USER,
TP_TLR,
TP_TLM,
TP_TLI,
TP_BLP,
TP_BLR,
TP_BLM,
TP_BLI,
TP_LIT,
TP_LOT,
TP_TRP,
TP_TRR,
TP_TRM,
TP_TRI,
TP_BRP,
TP_BRR,
TP_BRM,
TP_BRI,
TP_RIT,
TP_ROT,
KC_LAYER0,
KC_LAYER1,
KC_LAYER2,
KC_LAYER3,
KC_MOD_GA,
KC_MOD_GC,
KC_MOD_GS,
KC_MOD_AC,
KC_MOD_AS,
KC_MOD_RS,
KC_MOD_CS,
KC_MOD_GAC,
KC_MOD_GAS,
KC_MOD_GCS,
KC_MOD_ACS,
KC_MOD_GACS,
GP_DPU,
GP_DPD,
GP_DPL,
GP_DPR,
GP_X,
GP_A,
GP_B,
GP_Y,
GP_LB,
GP_LT,
GP_LSB,
GP_RB,
GP_RT,
GP_RSB,
GP_STA,
GP_BCK,
GP_HOM
};

10
users/dlip/dlip.h Normal file
View File

@ -0,0 +1,10 @@
#pragma once
#include QMK_KEYBOARD_H
#include "custom_keycodes.h"
#ifdef JOYSTICK_ENABLE
# include "gamepad.h"
#endif
#ifdef TAIPO_ENABLE
# include "taipo.h"
#endif

178
users/dlip/gamepad.c Normal file
View File

@ -0,0 +1,178 @@
// Copyright 2023 Dane Lipscombe (@dlip)
// SPDX-License-Identifier: GPL-2.0-or-later
// Code forked from https://github.com/brentaro/QMK_HID_Gamepad_with_SOCD
#include QMK_KEYBOARD_H
#include "custom_keycodes.h"
#include "joystick.h"
// Joystick Config
joystick_config_t joystick_axes[JOYSTICK_AXIS_COUNT] = {
JOYSTICK_AXIS_VIRTUAL, JOYSTICK_AXIS_VIRTUAL, JOYSTICK_AXIS_VIRTUAL, JOYSTICK_AXIS_VIRTUAL, JOYSTICK_AXIS_VIRTUAL, JOYSTICK_AXIS_VIRTUAL,
};
bool DPU_STATE = false;
bool DPD_STATE = false;
bool DPL_STATE = false;
bool DPR_STATE = false;
bool gamepad_process_record_user(uint16_t keycode, keyrecord_t *record) {
switch (keycode) {
case GP_DPU:
if (record->event.pressed) {
DPU_STATE = true;
if (DPD_STATE) {
unregister_joystick_button(16);
} else {
register_joystick_button(18);
}
} else {
DPU_STATE = false;
unregister_joystick_button(18);
if (DPD_STATE) {
register_joystick_button(16);
}
}
return false;
case GP_DPD:
if (record->event.pressed) {
DPD_STATE = true;
if (DPU_STATE) {
unregister_joystick_button(18);
} else {
register_joystick_button(16);
}
} else {
DPD_STATE = false;
unregister_joystick_button(16);
if (DPU_STATE) {
register_joystick_button(18);
}
}
return false;
case GP_DPL:
if (record->event.pressed) {
DPL_STATE = true;
if (DPR_STATE) {
unregister_joystick_button(17);
} else {
register_joystick_button(15);
}
} else {
DPL_STATE = false;
unregister_joystick_button(15);
if (DPR_STATE) {
register_joystick_button(17);
}
}
return false;
case GP_DPR:
if (record->event.pressed) {
DPR_STATE = true;
if (DPL_STATE) {
unregister_joystick_button(15);
} else {
register_joystick_button(17);
}
} else {
DPR_STATE = false;
unregister_joystick_button(17);
if (DPL_STATE) {
register_joystick_button(15);
}
}
return false;
case GP_X:
if (record->event.pressed) {
register_joystick_button(0);
} else {
unregister_joystick_button(0);
}
return false;
case GP_A:
if (record->event.pressed) {
register_joystick_button(1);
} else {
unregister_joystick_button(1);
}
return false;
case GP_B:
if (record->event.pressed) {
register_joystick_button(2);
} else {
unregister_joystick_button(2);
}
return false;
case GP_Y:
if (record->event.pressed) {
register_joystick_button(3);
} else {
unregister_joystick_button(3);
}
return false;
case GP_LB:
if (record->event.pressed) {
register_joystick_button(4);
} else {
unregister_joystick_button(4);
}
return false;
case GP_RB:
if (record->event.pressed) {
register_joystick_button(5);
} else {
unregister_joystick_button(5);
}
return false;
case GP_LT:
if (record->event.pressed) {
register_joystick_button(6);
} else {
unregister_joystick_button(6);
}
return false;
case GP_RT:
if (record->event.pressed) {
register_joystick_button(7);
} else {
unregister_joystick_button(7);
}
return false;
case GP_BCK:
if (record->event.pressed) {
register_joystick_button(8);
} else {
unregister_joystick_button(8);
}
return false;
case GP_STA:
if (record->event.pressed) {
register_joystick_button(9);
} else {
unregister_joystick_button(9);
}
return false;
case GP_LSB:
if (record->event.pressed) {
register_joystick_button(10);
} else {
unregister_joystick_button(10);
}
return false;
case GP_RSB:
if (record->event.pressed) {
register_joystick_button(11);
} else {
unregister_joystick_button(11);
}
return false;
case GP_HOM:
if (record->event.pressed) {
register_joystick_button(12);
} else {
unregister_joystick_button(12);
}
return false;
default:
return true;
}
}

6
users/dlip/gamepad.h Normal file
View File

@ -0,0 +1,6 @@
// Copyright 2023 Dane Lipscombe (@dlip)
// SPDX-License-Identifier: GPL-2.0-or-later
#pragma once
bool gamepad_process_record_user(uint16_t keycode, keyrecord_t *record);

67
users/dlip/gamepad.md Normal file
View File

@ -0,0 +1,67 @@
# dlip's Gamepad
Gamepad config for use in fighting games. Forked from https://github.com/brentaro/QMK_HID_Gamepad_with_SOCD
## Usage in keymap
- Add to `config.h`
```c
// Joystick Button Count
#define JOYSTICK_BUTTON_COUNT 32
// Joystick Axes Count
#define JOYSTICK_AXIS_COUNT 6
// Joystick Axes Resolution
#define JOYSTICK_AXIS_RESOLUTION 8
```
- Add to `rules.mk`
```
# Enable Joystick
JOYSTICK_ENABLE = yes
JOYSTICK_DRIVER = digital
```
Add to `keymap.c`:
- Include `gamepad.h`
```c
#include "users/dlip/gamepad.h"
```
- Add `_GAMEPAD` to your layers eg.
```c
enum layers {
_BASE
_GAMEPAD,
};
```
- Add layer to your `keymaps` with `GP_*` key mappings eg.
```c
[_GAMEPAD] = LAYOUT_split_2x4_2(
XXXXXXX, GP_BCK, GP_DPU, GP_STA, GP_X, GP_Y, GP_RB, GP_LB,
GP_HOM, GP_DPL, GP_DPD, GP_DPR, GP_A, GP_B, GP_RT, GP_LT,
XXXXXXX, GP_DPU, GP_LSB, GP_RSB
),
```
- Add a layer switch key to your base layer eg. `TO(_GAMEPAD)`
- Add taipo calls in `process_record_user` eg.
```c
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
if (IS_LAYER_ON(_GAMEPAD)) {
return gamepad_process_record_user(keycode, record);
} else {
return true;
}
};
```

4
users/dlip/readme.md Normal file
View File

@ -0,0 +1,4 @@
# dlip's Userspace
- [taipo.h](taipo.h) [Taipo](https://inkeys.wiki/en/keymaps/taipo) layout implementation. [Docs](taipo.md)
- [gamepad.h](gamepad.h) PC gamepad. [Docs](gamepad.md)

8
users/dlip/rules.mk Normal file
View File

@ -0,0 +1,8 @@
ifeq ($(strip $(JOYSTICK_ENABLE)), yes)
SRC += $(USER_PATH)/gamepad.c
endif
ifeq ($(strip $(TAIPO_ENABLE)), yes)
SRC += $(USER_PATH)/taipo.c
OPT_DEFS += -DTAIPO_ENABLE
endif

1210
users/dlip/taipo.c Normal file

File diff suppressed because it is too large Load Diff

7
users/dlip/taipo.h Normal file
View File

@ -0,0 +1,7 @@
// Copyright 2023 Dane Lipscombe (@dlip)
// SPDX-License-Identifier: GPL-2.0-or-later
#pragma once
bool taipo_process_record_user(uint16_t keycode, keyrecord_t* record);
void taipo_matrix_scan_user(void);

205
users/dlip/taipo.md Normal file
View File

@ -0,0 +1,205 @@
# dlip's Taipo Layout Implementation
QMK implementation of the [Taipo](https://inkeys.wiki/en/keymaps/taipo) layout.
## Features
- Supports modifier holds: If you hold the modifier it becomes a hold rather than a one shot key, this allows you to press keys on the other side or use the mouse eg. shift + click
- Multiple modifier combos: Rather than having to press each separetely eg. ctrl, then alt, you can combine the combo into a single keypress.
## Modifications
- Inner and outer thumbs are flipped since I find space to be more natural on the outer thumb
- Uses extra keybindings which use both thumb keys together
- Fn layer key switched to 'insert'
- Adds alternate mappings for ''' and ';' since my ring and pinkie fingers don't get along
## Layout
The input is the combo you would press from the perspective of the right hand (left hand is mirrored). Output is the result when you press the combo by itself, while outer/inner is the result when combined with the inner/outer thumb keys, and both is for both thumb keys together.
```
Input Output Outer Inner Both
#--- r R > Print Screen
----
-#-- s S } Brightness Up
----
--#- n N ] Brightness Down
----
---# i I ) Play/Pause
----
---- a A < Next Track
#---
---- o O { Volume Up
-#--
---- t T [ Volume Down
--#-
---- e E ( Previous Track
---#
---- c C 1 F1
-#-#
---- u U 2 F2
-##-
---- q Q 3 F3
#-#-
---- l L 4 F4
##--
--## y Y 5 F5
----
-#-# f F 6 F6
----
-##- p P 7 F7
----
#-#- z Z 8 F8
----
##-- b B 9 F9
----
---- h H 0 F10
--##
---- d D @ F11
#--#
#--# g G # F12
----
#--- x X ^ Cut
--#-
---# k K + Copy
-#--
-#-- v V * Paste
---#
--#- j J = Undo
#---
#--- m M $
---#
---# w W &
#---
-#-- / \ |
--#-
--#- - _ %
-#--
---# ? !
--#-
--#- , . ~
---#
#--- ; :
-#--
---- ; :
###-
-#-- ' " `
#---
###- ' " `
----
-### Tab Del Ins
----
---- Enter Esc AltGr
-###
#--- Gui Right PgUp Layer 3
#---
-#-- Alt Up Home Layer 2
-#--
--#- Ctrl Down End Layer 1
--#-
---# Shift Left PgDn Layer 0
---#
```
## Usage in keymap
Add to `rules.mk`
```c
USER_NAME := dlip
TAIPO_ENABLE = yes
```
Add to `config.h`
- TAIPO_TAP_TIMEOUT: The length of time in ms you need to press and release a key to be considered a tap, this mostly affects oneshot mods since they only activate on a tap
- ONESHOT_TIMEOUT: The length of time in ms you have to press a key after a oneshot mod before it deactivates
```c
#define TAIPO_TAP_TIMEOUT 150
#define ONESHOT_TIMEOUT 500
```
Add to `keymap.c`:
- Include `dlip.h`
```c
#include "dlip.h"
```
- Add `_TAIPO` to your layers eg.
```c
enum layers {
_BASE
_TAIPO,
};
```
- Add layer to your `keymaps` with `TP_*` key mappings eg.
```c
[_TAIPO] = LAYOUT_split_2x4_2(
TP_TLP, TP_TLR, TP_TLM, TP_TLI, TP_TRI, TP_TRM, TP_TRR, TP_TRP,
TP_BLP, TP_BLR, TP_BLM, TP_BLI, TP_BRI, TP_BRM, TP_BRR, TP_BRP,
TP_LIT, TP_LOT, TP_ROT, TP_RIT
),
```
- Add a layer switch key to your base layer eg. `TO(_TAIPO)`
- Add taipo calls in `process_record_user` and `matrix_scan_user` eg.
```c
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
if (IS_LAYER_ON(_TAIPO)) {
return taipo_process_record_user(keycode, record);
} else {
return true;
}
};
void matrix_scan_user(void) {
taipo_matrix_scan_user();
}
```