Skip to content

Commit

Permalink
Better structure. (getreuer#3)
Browse files Browse the repository at this point in the history
  • Loading branch information
fride authored Jun 15, 2023
1 parent f0f9521 commit d0d8d84
Show file tree
Hide file tree
Showing 11 changed files with 330 additions and 545 deletions.
34 changes: 33 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,4 +59,36 @@ COMB( CMB_BSLS, KC_BSLS, KC_R, KC_O)
```
///
```COMB( CMB_AT, KC_AT, OS_LSFT, KC_V)
COMB( CMB_UNDS, KC_UNDS, OS_LSFT, KC_M)
COMB( CMB_LBRC, KC_LBRC, OS_LSFT, KC_L)
COMB( CMB_RBRC, KC_RBRC, OS_LSFT, KC_C)
COMB( CMB_CIRC, KC_CIRC, OS_LSFT, KC_P)
COMB( CMB_EXLM, KC_EXLM, OS_LSFT, KC_B)
COMB( CMB_LT, KC_LT, OS_LSFT, MAGIC)
COMB( CMB_GT, KC_GT, OS_LSFT, KC_U)
COMB( CMB_EQL, KC_EQL, OS_LSFT, KC_O)
COMB( CMB_AMPR, KC_AMPR, OS_LSFT, KC_QUOT)
COMB( CMB_BSLS, KC_BSLS, OS_LSFT, KC_S)
COMB( CMB_SLSH, KC_SLSH, OS_LSFT, KC_T)
COMB( CMB_LCBR, KC_LCBR, OS_LSFT, KC_R)
COMB( CMB_RCBR, KC_RCBR, OS_LSFT, KC_D)
COMB( CMB_ASTR, KC_ASTR, OS_LSFT, KC_Y)
COMB( CMB_QUES, KC_QUES, OS_LSFT, KC_F)
COMB( CMB_LPRN, KC_LPRN, OS_LSFT, KC_N)
COMB( CMB_RPRN, KC_RPRN, OS_LSFT, KC_E)
COMB( CMB_MINS, KC_MINS, OS_LSFT, KC_A)
COMB( CMB_COLN, KC_COLN, OS_LSFT, KC_I)
COMB( CMB_HASH, KC_HASH, OS_LSFT, KC_X)
COMB( CMB_DLR, KC_DLR, OS_LSFT, KC_K)
COMB( CMB_PIPE, KC_PIPE, OS_LSFT, KC_J)
COMB( CMB_TILD, KC_TILD, OS_LSFT, KC_G)
COMB( CMB_GRV, KC_GRV, OS_LSFT, KC_W)
COMB( CMB_PLUS, KC_PLUS, OS_LSFT, KC_Z)
COMB( CMB_PERC, KC_PERC, OS_LSFT, KC_H)
COMB( CMB_DQUO, KC_DQUO, OS_LSFT, KC_COMM)
COMB( CMB_QUOT, KC_QUOT, OS_LSFT, KC_DOT)
COMB( CMB_SCLN, KC_SCLN, OS_LSFT, KC_UNDS)
16 changes: 0 additions & 16 deletions src/keymaps/ferris/combos.def

This file was deleted.

168 changes: 24 additions & 144 deletions src/keymaps/totem/keymap.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,152 +12,32 @@
*/

#include QMK_KEYBOARD_H
#include <stdio.h>
#include "totem.h"
#include "keycodes.h"
#include "layers.h"
#include "layout.h"
#include "g/keymap_combo.h"
#include "features/tap_hold.h"

// ┌────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
// │ D E F I N I T I O N S │
// └────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
// ▝▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▘


// ┌────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
// │ K E Y M A P S │
// └────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
// ▝▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▘

const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {

/*
┌─────────────────────────────────────────────────┐
│ │ ╭╮╭╮╭╮╭╮
└─────────────────────────────────────────────────┘ │╰╯╰╯╰╯│
┌─────────┬─────────┬─────────┬─────────┬──────╨──┐┌──╨──────┬─────────┬─────────┬─────────┬─────────┐
╌┄┈┈───═╡ Q │ W │ E │ R │ T ││ Y │ U │ I │ O │ P │
├─────────┼─────────┼─────────┼─────────┼─────────┤├─────────┼─────────┼─────────┼─────────┼─────────┤
│ A │ S │ D │ F │ G ││ H │ J │ K │ L │ ; │
┌─────────┼─────────┼─────────┼─────────┼─────────┼─────────┤├─────────┼─────────┼─────────┼─────────┼─────────┼─────────┐
│ Q │ Z │ X │ C │ V │ B ││ N │ M │ , │ . │ / │ P │
└─────────┴─────────┴─────────┼─────────┼─────────┼─────────┤├─────────┼─────────┼─────────┼─────────┴─────────┴─────────┘
│ CTRL │ LOWER │ SPACE ││ ENTER │ RAISE │ BSPC │
└─────────┴─────────┴─────────┘└─────────┴─────────┴─────────┘*/

[_ALPHA] = LAYOUT(
ALPHA_00, ALPHA_01,ALPHA_02, ALPHA_03, ALPHA_04, ALPHA_05, ALPHA_06, ALPHA_07, ALPHA_08, ALPHA_09,
ALPHA_10, ALPHA_11,ALPHA_12, ALPHA_13, ALPHA_14, ALPHA_15, ALPHA_16, ALPHA_17, ALPHA_18, ALPHA_19,
KC_NO, ALPHA_20, ALPHA_21,ALPHA_22, ALPHA_23, ALPHA_24, ALPHA_25, ALPHA_26, ALPHA_27, ALPHA_28, ALPHA_29, KC_NO,
ALPHA_30, ALPHA_31, ALPHA_32, ALPHA_33, ALPHA_34, ALPHA_35
),
[_ALPHA2] = LAYOUT(
KC_NO, ALPHA_00,ALPHA_02, ALPHA_04, KC_NO, KC_NO, ALPHA_05, ALPHA_07, ALPHA_08, ALPHA_09,
ALPHA_10, ALPHA_11,ALPHA_12, ALPHA_14, KC_NO, KC_NO, ALPHA_15, KC_LPRN, KC_LCBR, ALPHA_19,
KC_NO, KC_NO, ALPHA_20,ALPHA_22, ALPHA_24, KC_NO, KC_NO, ALPHA_25, A(KC_O), A(KC_O), A(KC_U), KC_NO,
ALPHA_30, TO(_ALPHA), KC_NO, KC_NO, ALPHA_34, ALPHA_35
),
[_NAV] = LAYOUT(
NAV_00, NAV_01, NAV_02, NAV_03, NAV_04, NAV_05, NAV_06, NAV_07, NAV_08, NAV_09,
NAV_10, NAV_11, NAV_12, NAV_13, NAV_14, NAV_15, NAV_16, NAV_17, NAV_18, NAV_19,
KC_NO, NAV_20, NAV_21, NAV_22, NAV_23, NAV_24, NAV_25, NAV_26, NAV_27, NAV_28, NAV_29, KC_NO,
ALPHA_30, ALPHA_31, ALPHA_32, ALPHA_33, ALPHA_34, ALPHA_35
),
[_NUM] = LAYOUT(
NUM_00, NUM_01, NUM_02, NUM_03, NUM_04, NUM_05, NUM_06, NUM_07, NUM_08, NUM_09,
NUM_10, NUM_11, NUM_12, NUM_13, NUM_14, NUM_15, NUM_16, NUM_17, NUM_18, NUM_19,
KC_NO, NUM_20, NUM_21, NUM_22, NUM_23, NUM_24, NUM_25, NUM_26, NUM_27, NUM_28, NUM_29, KC_NO,
ALPHA_30, ALPHA_31, ALPHA_32, ALPHA_33, ALPHA_34, ALPHA_35
),

// see https://neo-layout.org/
[_SYM] = LAYOUT(
//╷ ╷ ╷ ╷ ╷ ╷ ╷╷ ╷ ╷ ╷ ╷ ╷ ╷
KC_NO, KC_AT, KC_LBRC, KC_RBRC, KC_CIRC, KC_EXLM, KC_LT, KC_GT, KC_EQL, KC_AMPR,
KC_BSLS, KC_SLASH, KC_LCBR, KC_RCBR, KC_PAST, KC_QUES, KC_LPRN, KC_RPRN, KC_MINS, KC_AT,
KC_NO, KC_HASH, KC_DLR, KC_PIPE, KC_TILDE, KC_GRV, KC_PLUS, KC_PERC, KC_QUOTE, KC_QUOT, KC_UNDS, KC_NO,
ALPHA_30, ALPHA_31, ALPHA_32, ALPHA_33, ALPHA_34, ALPHA_35
),


/*
╺━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╸
┌─────────────────────────────────────────────────┐
│ t e m p l a t e │ ╭╮╭╮╭╮╭╮
└─────────────────────────────────────────────────┘ │╰╯╰╯╰╯│
┌─────────┬─────────┬─────────┬─────────┬──────╨──┐┌──╨──────┬─────────┬─────────┬─────────┬─────────┐
╌┄┈┈───═╡ │ │ │ │ ││ │ │ │ │ │
├─────────┼─────────┼─────────┼─────────┼─────────┤├─────────┼─────────┼─────────┼─────────┼─────────┤
│ │ │ │ │ ││ │ │ │ │ │
┌─────────┼─────────┼─────────┼─────────┼─────────┼─────────┤├─────────┼─────────┼─────────┼─────────┼─────────┼─────────┐
│ │ │ │ │ │ ││ │ │ │ │ │ │
└─────────┴─────────┴─────────┼─────────┼─────────┼─────────┤├─────────┼─────────┼─────────┼─────────┴─────────┴─────────┘
│ │ │ ││ │ │ │
└─────────┴─────────┴─────────┘└─────────┴─────────┴─────────┘
[_TEMPLATE] = LAYOUT(
//╷ ╷ ╷ ╷ ╷ ╷ ╷╷ ╷ ╷ ╷ ╷ ╷ ╷
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______,
),
*/
};


uint16_t get_combo_term(uint16_t index, combo_t *combo) {
switch (index )
{
default:
return COMBO_TERM;
// Convert 3x5_2 to Charybdis Nano 3x5_3+2
#define TOTEM(k) CONV_TOTEM(k)
#define CONV_TOTEM( \
L00, L01, L02, L03, L04, R00, R01, R02, R03, R04, \
L10, L11, L12, L13, L14, R10, R11, R12, R13, R14, \
L20, L21, L22, L23, L24, R20, R21, R22, R23, R24, \
L33, L34, R30, R31 \
) \
{ \
{ L00, L01, L02, L03, L04 }, \
{ L10, L11, L12, L13, L14 }, \
{ L20, L21, L22, L23, L24 }, \
{ KC_NO, KC_NO, KC_NO, L33, L34 }, \
{ R04, R03, R02, R01, R00 }, \
{ R14, R13, R12, R11, R10 }, \
{ R24, R23, R22, R21, R20 }, \
{ KC_NO, KC_NO, KC_NO, R31, R30 }, \
}
}

// TODO https://github.com/qmk/qmk_firmware/blob/master/docs/feature_combo.md
bool get_combo_must_tap(uint16_t index, combo_t *combo) {
// switch (index)
// {
// case CMB_LCTRL:
// case CMB_RCTRL:
// case CMB_EQL:
// case CMB_MINS:
// case CMB_NUM:
// case CMB_Q:
// case CMB_W:
// case CMB_X:
// case CMB_EXCL:
// case CMB_LPAREN:
// case CMB_RPAREN:
// case CMB_RPAREN:
// return false;
// }
// return true;
return false;
}
/*
╺━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╸
██████
██ ▄▄▄▄
██ ██▀▀██
▀▀ ██▄▄██
██████ ▀▀▀▀
██ ▄▄▄▄▄▄
██ ██▀▀▀▀
██ ██████
██▄▄▄▄
▀▀▀▀▀▀
████████
██ ██ ██
██ ██ ██
▀▀ ▀▀ ▀▀
████████
*/



const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[ALPHA] = TOTEM(_BASE),
[NAV] = TOTEM(_NAV),
[NUM] = TOTEM(_NUM),
[SYM1] = TOTEM(_SYM1)
};
Loading

0 comments on commit d0d8d84

Please sign in to comment.