Migrating over userspace

- existing repo was not forked. Wanted to make sure I was using the standard,
not replicating it
- Updated the readme.md for the latest mappings
This commit is contained in:
Victor 2024-04-01 22:26:41 -05:00
parent 67fac7803e
commit 089b71d77b
Failed to generate hash of commit
43 changed files with 1762 additions and 44 deletions

View file

@ -0,0 +1,23 @@
#include "capsword.h"
//static bool caps_word_state = false;
bool caps_word_press_user(uint16_t keycode) {
switch (keycode) {
// Keycodes that continue Caps Word, with shift applied.
case KC_A ... KC_Z:
case KC_MINS:
add_weak_mods(MOD_BIT(KC_LSFT)); // Apply shift to next key.
return true;
// Keycodes that continue Caps Word, without shifting.
case KC_1 ... KC_0:
case KC_BSPC:
case KC_DEL:
case KC_UNDS:
return true;
default:
return false; // Deactivate Caps Word.
}
}

View file

@ -0,0 +1,2 @@
#pragma once
#include "t4corun.h"

View file

@ -0,0 +1,75 @@
#include "combo.h"
//only need to make it for the qwerty layer
//const uint16_t PROGMEM dragtog_combo[] = {TR_COMM, TR_DOT, COMBO_END};
//const uint16_t PROGMEM sniptog_combo[] = {KC_M, TR_DOT, COMBO_END};
//const uint16_t PROGMEM moubtn4_combo[] = {KC_SPC, NAV, COMBO_END};
combo_t key_combos[COMBO_LENGTH] = {
/*
#if defined(POINTING_DEVICE_ENABLE)
[DRAGTOGGLE] = COMBO(dragtog_combo, DRG_TOG),
[SNIPERTOGGLE] = COMBO(sniptog_combo, SNP_TOG),
#else
[DRAGTOGGLE] = COMBO(dragtog_combo, ___x___),
[SNIPERTOGGLE] = COMBO(sniptog_combo, ___x___),
#endif //POINTING_DEVICE_ENABLE
#if defined(MOUSELAYER_ENABLE)
[MOUSEBUTTON4] = COMBO(moubtn4_combo, KC_BTN4)
#else
[MOUSEBUTTON4] = COMBO(moubtn4_combo, ___x___)
#endif //MOUSELAYER_ENABLE
*/
};
bool get_combo_must_hold(uint16_t index, combo_t *combo) {
switch (index) {
default:
return false;
}
}
bool get_combo_must_tap(uint16_t index, combo_t *combo) {
switch (index) {
/*
case DRAGTOGGLE:
case SNIPERTOGGLE:
case MOUSEBUTTON4:
return true;
*/
default:
return false;
}
}
bool get_combo_must_press_in_order(uint16_t combo_index, combo_t *combo) {
switch (combo_index) {
/* List combos here that you want to only activate if their keys
* are pressed in the same order as they are defined in the combo's key
* array. */
default:
return false;
}
}
uint16_t get_combo_term(uint16_t index, combo_t *combo) {
// or with combo index, i.e. its name from enum.
switch (index) {
/*
case CONFIGLAYER:
return COMBO_HOLD_TERM + 150;
*/
default:
return COMBO_TERM;
}
}

View file

@ -0,0 +1,12 @@
#pragma once
#include "t4corun.h"
enum combos {
//DRAGTOGGLE,
//SNIPERTOGGLE,
//MOUSEBUTTON4,
COMBO_LENGTH
};
//their documentation is so confusing because you don't use COMBO_LEN defining the actions
uint16_t COMBO_LEN = COMBO_LENGTH;

View file

@ -0,0 +1 @@
#include "mouse.h"

View file

@ -0,0 +1,2 @@
#pragma once
#include "t4corun.h"

View file

@ -0,0 +1,105 @@
#include "oled.h"
void render_crkbd_logo(void) {
static const char PROGMEM crkbd_logo[] = {
0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, 0x90, 0x91, 0x92, 0x93, 0x94,
0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, 0xb0, 0xb1, 0xb2, 0xb3, 0xb4,
0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, 0xd0, 0xd1, 0xd2, 0xd3, 0xd4,
0};
oled_write_P(crkbd_logo, false);
}
void render_default_layer_state(void) {
oled_write_P(PSTR(OLED_RENDER_LAYOUT_NAME), false);
switch (get_highest_layer(default_layer_state)) {
case _QWERTY:
oled_write_P(PSTR(OLED_RENDER_LAYOUT_QWERTY), false);
break;
case _COLEMAK_DH:
oled_write_P(PSTR(OLED_RENDER_LAYOUT_COLEMAK_DH), false);
break;
case _GAME:
oled_write_P(PSTR(OLED_RENDER_LAYOUT_GAME), false);
break;
}
}
void render_layer_state(void) {
oled_write_P(PSTR(OLED_RENDER_LAYER_NAME), false);
oled_write_P(PSTR(OLED_RENDER_LAYER_BASE), get_highest_layer(layer_state) == FIRST_DEFAULT_LAYER);
oled_write_P(PSTR(OLED_RENDER_LAYER_NAVIGATION), get_highest_layer(layer_state) == _NAVIGATION);
oled_write_P(PSTR(OLED_RENDER_LAYER_NUMBER), get_highest_layer(layer_state) == _NUMBER);
oled_write_P(PSTR(OLED_RENDER_LAYER_SYMBOL), get_highest_layer(layer_state) == _SYMBOL);
#if defined(MOUSEKEY_ENABLE)
oled_write_P(PSTR(OLED_RENDER_LAYER_MOUSE), get_highest_layer(layer_state) == _MOUSE);
#endif //MOUSEKEY_ENABLE
oled_write_P(PSTR(OLED_RENDER_LAYER_GAME_NUM), get_highest_layer(layer_state) == _GAME_NUM);
oled_write_P(PSTR(OLED_RENDER_LAYER_CONFIG), get_highest_layer(layer_state) == _CONFIG);
}
void render_keylock_status(void) {
oled_write_P(PSTR(OLED_RENDER_KEYLOCK_NAME), false);
oled_write_P(PSTR(" "), false);
oled_write_P(PSTR("N"), host_keyboard_led_state().num_lock);
oled_write_P(PSTR("C"), host_keyboard_led_state().caps_lock || is_caps_word_on() );
oled_write_ln_P(PSTR("S"), host_keyboard_led_state().scroll_lock );
}
void render_mod_status(void) {
uint8_t current_mod = get_mods();
uint8_t current_osm = get_oneshot_mods();
oled_write_P(PSTR(OLED_RENDER_MODS_NAME), false);
oled_write_P(PSTR(" "), false);
bool isShift = (current_mod | current_osm) & MOD_MASK_SHIFT;
bool isCtrl = (current_mod | current_osm) & MOD_MASK_CTRL;
bool isAlt = (current_mod | current_osm) & MOD_MASK_ALT;
bool isGUI = (current_mod | current_osm) & MOD_MASK_GUI;
oled_write_P(PSTR("S"), isShift );
oled_write_P(PSTR("C"), isCtrl );
oled_write_P(PSTR("A"), isAlt );
oled_write_P(PSTR("G"), isGUI );
}
void render_oled_main(void) {
render_default_layer_state();
render_keylock_status();
render_mod_status();
render_layer_state();
}
bool oled_task_user(void) {
if (is_keyboard_master()) {
render_oled_main(); // Renders the current keyboard state (layer, lock, caps, scroll, etc)
} else {
render_crkbd_logo();
}
return false;
}
oled_rotation_t oled_init_user(oled_rotation_t rotation) {
if (is_keyboard_master()) {
return OLED_ROTATION_270;
} else {
return OLED_ROTATION_270;
}
}

View file

@ -0,0 +1,33 @@
#pragma once
#include "t4corun.h"
#include "oled_driver.h"
#define OLED_RENDER_KEYLOCK_NAME "Lock:"
#define OLED_RENDER_MODS_NAME "Mods:"
#define OLED_RENDER_LAYOUT_NAME "Lyout"
#define OLED_RENDER_LAYOUT_QWERTY " QRTY"
#define OLED_RENDER_LAYOUT_COLEMAK_DH " cmDH"
#define OLED_RENDER_LAYOUT_GAME " Game"
#define OLED_RENDER_LAYER_NAME "Layer"
#define OLED_RENDER_LAYER_BASE " Def "
#define OLED_RENDER_LAYER_NUMBER " Num "
#define OLED_RENDER_LAYER_NAVIGATION " Nav "
#define OLED_RENDER_LAYER_SYMBOL " Sym "
#define OLED_RENDER_LAYER_GAME_NUM " gNum"
#define OLED_RENDER_LAYER_CONFIG " Cfg "
#if defined(MOUSEKEY_ENABLE)
# define OLED_RENDER_LAYER_MOUSE " Mou "
#endif //MOUSEKEY_ENABLE
void render_crkbd_logo(void);
void render_default_layer_state(void);
void render_layer_state(void);
void render_keylock_status(void);
void render_mod_status(void);
void render_oled_main(void);
bool oled_task_user(void);
oled_rotation_t oled_init_user(oled_rotation_t rotation);

View file

@ -0,0 +1,101 @@
#include "rgbmatrix.h"
/*
Achieves the following
- layer tap key indicator when we are in layer
- Caps lock and scroll lock indicators when activated
- mouse button backlight when in mouse layer
- modifier indicators when activated
- default layer indicator
Really only for the charybdis nano, and even then I don't really look down at the
RGB
*/
bool rgb_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max){
/*
uint8_t current_layer = get_highest_layer(layer_state);
uint8_t current_default_layer = get_highest_layer(default_layer_state);
uint8_t current_mod = get_mods();
uint8_t current_osm = get_oneshot_mods();
switch(current_layer) {
case _NAVIGATION:
RGB_MATRIX_INDICATOR_SET_COLOR_wrapper(LED_NAVIGATION, KEY_LAYER_COLOR);
break;
case _NUMBER:
RGB_MATRIX_INDICATOR_SET_COLOR_wrapper(LED_NUMBER, KEY_LAYER_COLOR);
break;
case _SYMBOL:
RGB_MATRIX_INDICATOR_SET_COLOR_wrapper(LED_SYMBOL_L, KEY_TRILAYER_COLOR);
RGB_MATRIX_INDICATOR_SET_COLOR_wrapper(LED_SYMBOL_R, KEY_TRILAYER_COLOR);
break;
case _FUNCTION:
RGB_MATRIX_INDICATOR_SET_COLOR_wrapper(LED_FUNCTION, KEY_TRILAYER_COLOR);
RGB_MATRIX_INDICATOR_SET_COLOR_wrapper(LED_DMACRO_R1, KEY_MACROREC_COLOR);
RGB_MATRIX_INDICATOR_SET_COLOR_wrapper(LED_DMACRO_P1, KEY_MACROPLY_COLOR);
RGB_MATRIX_INDICATOR_SET_COLOR_wrapper(LED_DMACRO_R2, KEY_MACROREC_COLOR);
RGB_MATRIX_INDICATOR_SET_COLOR_wrapper(LED_DMACRO_P2, KEY_MACROPLY_COLOR);
break;
case _MOUSE:
RGB_MATRIX_INDICATOR_SET_COLOR_wrapper(LED_MOUSE, KEY_LAYER_COLOR);
break;
case _CONFIG:
RGB_MATRIX_INDICATOR_SET_COLOR_wrapper(LED_CONFIG, KEY_LAYER_COLOR);
RGB_MATRIX_INDICATOR_SET_COLOR_wrapper(LED_RESET, KEY_RESET_COLOR);
switch (current_default_layer) {
case _DEFAULT_LAYER_1:
RGB_MATRIX_INDICATOR_SET_COLOR_wrapper(LED_QWERTY, KEY_DEFAULTLAYER_COLOR);
break;
case _DEFAULT_LAYER_2:
RGB_MATRIX_INDICATOR_SET_COLOR_wrapper(LED_COLEMAKDH, KEY_DEFAULTLAYER_COLOR);
break;
}
break;
}
if ( (current_mod | current_osm) & MOD_MASK_SHIFT ) {
RGB_MATRIX_INDICATOR_SET_COLOR_wrapper(LED_SHIFT_T, MOD_SHIFT_COLOR);
RGB_MATRIX_INDICATOR_SET_COLOR_wrapper(LED_SHIFT_L, MOD_SHIFT_COLOR);
RGB_MATRIX_INDICATOR_SET_COLOR_wrapper(LED_SHIFT_R, MOD_SHIFT_COLOR);
}
if ( (current_mod | current_osm) & MOD_MASK_CTRL ) {
RGB_MATRIX_INDICATOR_SET_COLOR_wrapper(LED_CTRL_L, MOD_CTRL_COLOR);
RGB_MATRIX_INDICATOR_SET_COLOR_wrapper(LED_CTRL_R, MOD_CTRL_COLOR);
}
if ( (current_mod | current_osm) & MOD_MASK_ALT ) {
RGB_MATRIX_INDICATOR_SET_COLOR_wrapper(LED_ALT_L, MOD_ALT_COLOR);
RGB_MATRIX_INDICATOR_SET_COLOR_wrapper(LED_ALT_R, MOD_ALT_COLOR);
}
if ( (current_mod | current_osm) & MOD_MASK_GUI ) {
RGB_MATRIX_INDICATOR_SET_COLOR_wrapper(LED_GUI_L, MOD_GUI_COLOR);
RGB_MATRIX_INDICATOR_SET_COLOR_wrapper(LED_GUI_R, MOD_GUI_COLOR);
}
if ( host_keyboard_led_state().caps_lock || is_caps_word_on() ) {
RGB_MATRIX_INDICATOR_SET_COLOR_wrapper(LED_CAPSLOCK, CAPSLOCK_COLOR);
}
if ( host_keyboard_led_state().scroll_lock) {
RGB_MATRIX_INDICATOR_SET_COLOR_wrapper(LED_SCRLOCK, SCROLLOCK_COLOR);
}
*/
return false;
}

View file

@ -0,0 +1,111 @@
#pragma once
#include "t4corun.h"
/*
Color preview
( 0, RGB_AZURE);
( 1, RGB_BLACK);
( 2, RGB_BLUE);
( 3, RGB_CHARTREUSE);
( 4, RGB_CORAL);
( 5, RGB_CYAN);
( 6, RGB_GOLD);
( 7, RGB_GOLDENROD);
( 8, RGB_GREEN);
( 9, RGB_MAGENTA);
( 10, RGB_ORANGE);
( 11, RGB_PINK);
( 14, RGB_PURPLE);
( 13, RGB_RED);
( 12, RGB_SPRINGGREEN);
( 32, RGB_TEAL);
( 29, RGB_TURQUOISE);
( 24, RGB_WHITE);
( 23, RGB_YELLOW);
*/
#define LAYER_NAVIGATION_COLOR RGB_AZURE
#define LAYER_SYMBOL_COLOR RGB_CYAN
#define LAYER_NUMBER_COLOR RGB_PURPLE
#define LAYER_MOUSE_COLOR RGB_CORAL
#define LAYER_CONFIG_COLOR RGB_GOLDENROD
#define KEY_LAYER_COLOR RGB_AZURE
#define KEY_TRILAYER_COLOR RGB_PURPLE
#define KEY_DEFAULTLAYER_COLOR RGB_PURPLE
#define KEY_RESET_COLOR RGB_MAGENTA
#define KEY_MACROREC_COLOR RGB_PINK
#define KEY_MACROPLY_COLOR RGB_TURQUOISE
#define MOD_SHIFT_COLOR RGB_WHITE
#define MOD_CTRL_COLOR RGB_CORAL
#define MOD_ALT_COLOR RGB_PINK
#define MOD_GUI_COLOR RGB_GOLDENROD
#define CAPSLOCK_COLOR RGB_WHITE
#define SCROLLOCK_COLOR RGB_WHITE
//so we can send the predefined RGB colors without requiring separate RGB values
#define RGB_MATRIX_INDICATOR_SET_COLOR_wrapper(...) RGB_MATRIX_INDICATOR_SET_COLOR(__VA_ARGS__)
/* qmk_firmware\keyboards\bastardkb\charybdis\3x5\3x5.c
*
* 2 3 8 9 12 30 27 26 21 20
*
* 1 4 7 10 13 31 28 25 22 19
*
* 0 5 6 11 14 32 29 24 23 18
*
* 15 16 17 33 34 XX
*
*/
#if defined(KEYBOARD_bastardkb_charybdis_3x5)
//layers
# define LED_NUMBER 16
# define LED_NAVIGATION 34
# define LED_MOUSE 6
# define LED_SYMBOL_L 16
# define LED_SYMBOL_R 34
# define LED_CONFIG 20
# define LED_FUNCTION 9
//base layers
# define LED_QWERTY 17
# define LED_COLEMAKDH 16
//indicators
# define LED_CAPSLOCK 31
# define LED_SCRLOCK 13
//dynamic macros
# define LED_DMACRO_R1 34
# define LED_DMACRO_P1 33
# define LED_DMACRO_R2 3
# define LED_DMACRO_P2 2
//shift keys
# define LED_SHIFT_T 17
# define LED_SHIFT_L 10
# define LED_SHIFT_R 28
//control keys
# define LED_CTRL_L 7
# define LED_CTRL_R 25
//alt keys
# define LED_ALT_L 4
# define LED_ALT_R 22
//GUI keys
# define LED_GUI_L 1
# define LED_GUI_R 19
//Reset LED
# define LED_RESET 26
#endif

View file

@ -0,0 +1,129 @@
#include "taphold.h"
void insert_brackets(uint16_t left, uint16_t right) {
tap_code16(left);
tap_code16(right);
tap_code16(KC_LEFT);
}
void double_tap(uint16_t keycode, uint32_t ms) {
tap_code16(keycode);
wait_ms(ms);
tap_code16(keycode);
}
//here we can have the holds be more complex, like sending "" when you hold "
bool process_tap_hold_key(keyrecord_t* record, uint16_t keycode) {
//tap is record->tap.count && record->event.pressed
//hold is record->event.pressed
//bool isShift = ( (get_mods() & MOD_BIT(KC_LSFT)) || (get_oneshot_mods() & MOD_BIT(KC_LSFT)) );
uint16_t key = KC_NO;
uint16_t altkey = KC_NO;
switch(keycode) {
//Brackets
//open and close brackets and put the cursor inside
case TR_LCBR:
key = KC_LCBR;
altkey = KC_RCBR;
break;
case TR_LABK:
key = KC_LABK;
altkey = KC_RABK;
break;
case TR_LBRC:
key = KC_LBRC;
altkey = KC_RBRC;
break;
case TR_SQUO:
key = KC_QUOT;
altkey = KC_QUOT;
break;
case TR_DQUO:
key = KC_DQUO;
altkey = KC_DQUO;
break;
//Custom
case TR_LPRN: //tap for comma, hold for bracket parenthesis
case TR_COMM: //tap for comma, hold for left parenthesis
key = KC_COMM;
altkey = KC_LPRN;
break;
case TR_DOT: //tap for dot, hold for right parenthesis
key = KC_DOT;
altkey = KC_RPRN;
break;
case TR_PERC: //tap for percent, hold for carat. for saving room on symbols layer
key = KC_PERC;
altkey = KC_CIRC;
break;
//faux auto-shift
case TR_EQL: //tap for equal, hold for plus
key = KC_EQL;
altkey = KC_PLUS;
break;
case TR_MINS: //tap for minus, hold for underscore
key = KC_MINS;
altkey = KC_UNDS;
break;
case TR_GRV: //tap for grave, hold for tilde
key = KC_GRV;
altkey = KC_TILDE;
break;
case TR_SCLN: //tap for semicolon, hold for colon
key = KC_SCLN;
altkey = KC_COLN;
break;
case TR_QUOT: //tap for single quote, hold for double quote
key = KC_QUOT;
altkey = KC_DQUO;
break;
}
if (record->tap.count && record->event.pressed) {
tap_code16(key);
return false;
} else if (record->tap.count == 0 && record->event.pressed) {
switch(keycode) {
//Brackets
case TR_LCBR:
case TR_LABK:
case TR_LBRC:
case TR_SQUO:
case TR_DQUO:
//isShift ? insert_brackets(LSFT(key), LSFT(altkey)) : insert_brackets(key, altkey);
insert_brackets(key, altkey);
break;
//custom and faux auto-shift
case TR_LPRN:
insert_brackets(KC_LPRN, KC_RPRN);
break;
case TR_COMM:
case TR_DOT:
case TR_PERC:
case TR_EQL:
case TR_MINS:
case TR_GRV:
case TR_SCLN:
case TR_QUOT:
tap_code16(altkey);
break;
}
return false;
}
return true; // Continue default handling.
}

View file

@ -0,0 +1,6 @@
#pragma once
#include "t4corun.h"
void insert_brackets(uint16_t left, uint16_t right);
void double_tap(uint16_t keycode, uint32_t ms);
bool process_tap_hold_key(keyrecord_t* record, uint16_t keycode);

View file

@ -0,0 +1,28 @@
#include "tapping.h"
bool get_hold_on_other_key_press(uint16_t keycode, keyrecord_t *record) {
//This is effective for all dual role keys (e.g. Mod-Taps, Layer-Taps, etc)
switch(keycode) {
default:
//Disable HOLD_ON_OTHER_KEY_PRESS aka enable IGNORE_MOD_TAP_INTERRUPT
return false;
}
}
uint16_t get_quick_tap_term(uint16_t keycode, keyrecord_t *record) {
switch (keycode) {
default:
return QUICK_TAP_TERM;
}
}
uint16_t get_tapping_term(uint16_t keycode, keyrecord_t *record) {
switch (keycode) {
case NAV:
return TAPPING_TERM - 60;
default:
//uprintf("tapping term: %d \n", TAPPING_TERM);
return TAPPING_TERM;
}
}

View file

@ -0,0 +1,2 @@
#pragma once
#include "t4corun.h"