summaryrefslogtreecommitdiffstats
path: root/users
diff options
context:
space:
mode:
authorJacob Jerrell <jacob.jerrell@gmail.com>2020-12-06 00:30:27 -0600
committerGitHub <noreply@github.com>2020-12-06 17:30:27 +1100
commit3076f86dc11d346d07c63e5fb11702817d7034e7 (patch)
treeebf9b4f3dd89366069f2123a0c984692c3d98e52 /users
parent6b1f96dca8b1218c0e3de6ef23dbde107f8c4588 (diff)
Bocaj - Third Annual Refactor (Redux) (#10295)
* Reset everything to upstream, reapply Bocaj changes * Bocaj - address PR comments * Just in time changes * Bocaj - Several adjustments after using the layout for a while
Diffstat (limited to 'users')
-rw-r--r--users/bocaj/.gitignore1
-rw-r--r--users/bocaj/.gitlab-ci.yml24
-rw-r--r--users/bocaj/bocaj.c285
-rw-r--r--users/bocaj/bocaj.h96
-rw-r--r--users/bocaj/config.h124
-rw-r--r--users/bocaj/process_records.c240
-rw-r--r--users/bocaj/process_records.h62
-rw-r--r--users/bocaj/readme.md101
-rw-r--r--users/bocaj/rgb_matrix_stuff.c106
-rw-r--r--users/bocaj/rgb_matrix_stuff.h10
-rw-r--r--users/bocaj/rules.mk43
-rw-r--r--users/bocaj/send_unicode.c106
-rw-r--r--users/bocaj/send_unicode.h71
-rw-r--r--users/bocaj/tap_dances.c64
-rw-r--r--users/bocaj/tap_dances.h19
-rw-r--r--users/bocaj/wrappers.h202
16 files changed, 766 insertions, 788 deletions
diff --git a/users/bocaj/.gitignore b/users/bocaj/.gitignore
new file mode 100644
index 0000000000..c6df8c0139
--- /dev/null
+++ b/users/bocaj/.gitignore
@@ -0,0 +1 @@
+secrets.c
diff --git a/users/bocaj/.gitlab-ci.yml b/users/bocaj/.gitlab-ci.yml
new file mode 100644
index 0000000000..71e3d26eb4
--- /dev/null
+++ b/users/bocaj/.gitlab-ci.yml
@@ -0,0 +1,24 @@
+stages:
+ - test
+
+QMK Firmware:
+ stage: test
+ variables:
+ GIT_SUBMODULE_STRATEGY: recursive
+ tags:
+ - linux
+ image: qmkfm/base_container
+ before_script:
+ - apt-get update -qy
+ - apt-get install -y build-essential avr-libc binutils-arm-none-eabi binutils-avr dfu-programmer dfu-util gcc gcc-arm-none-eabi git libnewlib-arm-none-eabi gcc-avr python3 unzip wget zip
+ - avr-gcc --version
+ - uname -a
+ script:
+ - make planck/rev6:default planck/rev5:default
+ - make all:bocaj -j2
+ artifacts:
+ name: "$CI_JOB_NAME-$CI_COMMIT_REF_SLUG"
+ paths:
+ - ./*.hex
+ - ./*.bin
+ expire_in: 1 month
diff --git a/users/bocaj/bocaj.c b/users/bocaj/bocaj.c
index 689dbe7b4e..83fe812311 100644
--- a/users/bocaj/bocaj.c
+++ b/users/bocaj/bocaj.c
@@ -1,5 +1,5 @@
/*
-Copyright 2018 Jacob Jerrell <jacob.jerrell@gmail.com> @JacobJerrell
+Copyright 2020 Jacob Jerrell <jacob.jerrell@gmail.com> @JacobJerrell
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
@@ -17,173 +17,194 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "bocaj.h"
+#ifdef KEYBOARD_planck_ez
userspace_config_t userspace_config;
-#if (defined(UNICODE_ENABLE) || defined(UNICODEMAP_ENABLE) || defined(UCIS_ENABLE))
- #define BOCAJ_UNICODE_MODE UC_OSX
+#endif
+
+bool mod_key_press_timer(uint16_t code, uint16_t mod_code, bool pressed) {
+ static uint16_t this_timer;
+ if (pressed) {
+ this_timer = timer_read();
+ } else {
+ if (timer_elapsed(this_timer) < TAPPING_TERM) {
+ tap_code(code);
+ } else {
+ register_code(mod_code);
+ tap_code(code);
+ unregister_code(mod_code);
+ }
+ }
+ return false;
+}
+
+bool mod_key_press(uint16_t code, uint16_t mod_code, bool pressed, uint16_t this_timer) {
+ if (pressed) {
+ this_timer = timer_read();
+ } else {
+ if (timer_elapsed(this_timer) < TAPPING_TERM) {
+ tap_code(code);
+ } else {
+ register_code(mod_code);
+ tap_code(code);
+ unregister_code(mod_code);
+ }
+ }
+ return false;
+}
+
+void bootmagic_lite(void) {
+ matrix_scan();
+#if defined(DEBOUNCING_DELAY) && DEBOUNCING_DELAY > 0
+ wait_ms(DEBOUNCING_DELAY * 2);
+#elif defined(DEBOUNCE) && DEBOUNCE > 0
+ wait_ms(DEBOUNCE * 2);
#else
- // set to 2 for UC_WIN, set to 4 for UC_WINC
- #define BOCAJ_UNICODE_MODE 2
+ wait_ms(30);
#endif
+ matrix_scan();
+ if (matrix_get_row(BOOTMAGIC_LITE_ROW) & (1 << BOOTMAGIC_LITE_COLUMN)) {
+ bootloader_jump();
+ }
+}
-void tap(uint16_t keycode){ register_code(keycode); unregister_code(keycode); };
+__attribute__((weak)) void keyboard_pre_init_keymap(void) {}
+void keyboard_pre_init_user(void) {
+#ifdef KEYBOARD_planck_ez
+ userspace_config.raw = eeconfig_read_user();
+#endif
+ keyboard_pre_init_keymap();
+}
// Add reconfigurable functions here, for keymap customization
// This allows for a global, userspace functions, and continued
// customization of the keymap. Use _keymap instead of _user
// functions in the keymaps
-__attribute__ ((weak))
-void matrix_init_keymap(void) {}
-
-__attribute__ ((weak))
-void startup_keymap(void) {}
-
-__attribute__ ((weak))
-void suspend_power_down_keymap(void) {}
+__attribute__((weak)) void matrix_init_keymap(void) {}
-__attribute__ ((weak))
-void suspend_wakeup_init_keymap(void) {}
-
-__attribute__ ((weak))
-void matrix_scan_keymap(void) {}
-
-__attribute__ ((weak))
-bool process_record_keymap(uint16_t keycode, keyrecord_t *record) {
- return true;
+// Call user matrix init, set default RGB colors and then
+// call the keymap's init function
+void matrix_init_user(void) {
+ matrix_init_keymap();
}
-__attribute__ ((weak))
-void matrix_scan_secrets(void) {}
-
-__attribute__ ((weak))
-uint32_t layer_state_set_keymap (uint32_t state) {
- return state;
-}
+__attribute__((weak)) void keyboard_post_init_keymap(void) {}
-__attribute__ ((weak))
-uint32_t default_layer_state_set_keymap (uint32_t state) {
- return state;
+void keyboard_post_init_user(void) {
+#if defined(RGB_MATRIX_ENABLE)
+ keyboard_post_init_rgb_matrix();
+#endif
+ keyboard_post_init_keymap();
}
-__attribute__ ((weak))
-void led_set_keymap(uint8_t usb_led) {}
-
-// Call user matrix init, set default RGB colors and then
-// call the keymap's init function
-void matrix_init_user(void) {
- userspace_config.raw = eeconfig_read_user();
+__attribute__((weak)) void shutdown_keymap(void) {}
- #if (defined(UNICODE_ENABLE) || defined(UNICODEMAP_ENABLE) || defined(UCIS_ENABLE))
- set_unicode_input_mode(BOCAJ_UNICODE_MODE);
- get_unicode_input_mode();
- #endif //UNICODE_ENABLE
+void rgb_matrix_update_pwm_buffers(void);
+void shutdown_user(void) {
+#ifdef RGB_MATRIX_ENABLE
+ rgb_matrix_set_color_all(0xFF, 0x00, 0x00);
+ rgb_matrix_update_pwm_buffers();
- matrix_init_keymap();
+#endif // RGB_MATRIX_ENABLE
+ shutdown_keymap();
}
-void startup_user (void) {
- startup_keymap();
-}
+__attribute__((weak)) void suspend_power_down_keymap(void) {}
-void suspend_power_down_user(void)
-{
- suspend_power_down_keymap();
-}
+void suspend_power_down_user(void) { suspend_power_down_keymap(); }
-void suspend_wakeup_init_user(void)
-{
- suspend_wakeup_init_keymap();
- #ifdef KEYBOARD_ergodox_ez
- wait_ms(10);
- #endif
-}
+__attribute__((weak)) void suspend_wakeup_init_keymap(void) {}
-void eeconfig_init_user(void) {
- userspace_config.raw = 0;
- eeconfig_update_user(userspace_config.raw);
- #if (defined(UNICODE_ENABLE) || defined(UNICODEMAP_ENABLE) || defined(UCIS_ENABLE))
- set_unicode_input_mode(BOCAJ_UNICODE_MODE);
- get_unicode_input_mode();
- #else
- eeprom_update_byte(EECONFIG_UNICODEMODE, BOCAJ_UNICODE_MODE);
- #endif
-}
+void suspend_wakeup_init_user(void) { suspend_wakeup_init_keymap(); }
+
+__attribute__((weak)) void matrix_scan_secrets(void) {}
+__attribute__((weak)) void matrix_scan_keymap(void) {}
LEADER_EXTERNS();
+
// No global matrix scan code, so just run keymap's matrix
// scan function
void matrix_scan_user(void) {
- static bool has_ran_yet;
- if (!has_ran_yet) {
- has_ran_yet = true;
- startup_user();
- }
- LEADER_DICTIONARY() {
- leading = false;
- leader_end();
-
- // Mac Save (Leader -> s)
- SEQ_ONE_KEY(KC_S) {
- SEND_STRING(SS_LGUI("s"));
+ static bool has_ran_yet;
+ if (!has_ran_yet) {
+ has_ran_yet = true;
+ startup_user();
}
- // Mac copy line down (Leader -> d, d)
- SEQ_TWO_KEYS(KC_D, KC_D) {
- register_code(KC_LSHIFT);
- register_code(KC_HOME);
- unregister_code(KC_HOME);
- unregister_code(KC_LSHIFT);
- SEND_STRING(SS_LGUI("c"));
- tap(KC_END);
- tap(KC_ENTER);
- SEND_STRING(SS_LGUI("v"));
- }
+ LEADER_DICTIONARY() {
+ leading = false;
+ leader_end();
- // Mac copy line up (Leader -> u, u)
- SEQ_TWO_KEYS(KC_U, KC_U) {
- register_code(KC_LSHIFT);
- register_code(KC_HOME);
- unregister_code(KC_HOME);
- unregister_code(KC_LSHIFT);
- SEND_STRING(SS_LGUI("c"));
- tap(KC_UP);
- tap(KC_END);
- tap(KC_ENTER);
- SEND_STRING(SS_LGUI("v"));
- }
+ // Website Refresh / XCode "Run"
+ SEQ_ONE_KEY(KC_R) {
+ SEND_STRING(SS_LGUI("r"));
+ }
- // Mac VS Debug
- SEQ_ONE_KEY(KC_D) {
- tap(KC_F5);
- }
+ SEQ_TWO_KEYS(KC_B, KC_D) {
+ SEND_STRING (QMK_KEYBOARD "/" QMK_KEYMAP " @ " QMK_VERSION " Built at: " QMK_BUILDDATE);
+ }
- // Mac VS Stop Debug
- SEQ_TWO_KEYS(KC_S, KC_D) {
- register_code(KC_LSHIFT);
- tap(KC_F5);
- unregister_code(KC_LSHIFT);
+ #ifndef NO_SECRETS
+ matrix_scan_secrets();
+ #endif // !NO_SECRETS
}
+
+#if defined(RGB_MATRIX_ENABLE)
+ matrix_scan_rgb_matrix();
+#endif
- // Start Diablo 3
- SEQ_ONE_KEY(KC_3) {
- SEND_STRING(SS_LCTRL(" "));
- SEND_STRING("Diablo");
- tap(KC_ENTER);
- }
+ matrix_scan_keymap();
+}
- SEQ_ONE_KEY(KC_B) {
- SEND_STRING (QMK_KEYBOARD "/" QMK_KEYMAP " @ " QMK_VERSION " ");
- tap(KC_ENTER);
- SEND_STRING ("Built at: " QMK_BUILDDATE);
- }
-#ifndef NO_SECRETS
- matrix_scan_secrets();
-#endif // !NO_SECRETS
- }
+__attribute__((weak)) layer_state_t layer_state_set_keymap(layer_state_t state) { return state; }
+
+// on layer change, no matter where the change was initiated
+// Then runs keymap's layer change check
+layer_state_t layer_state_set_user(layer_state_t state) {
+ state = update_tri_layer_state(state, _RAISE, _LOWER, _ADJUST);
+#if defined(RGBLIGHT_ENABLE)
+ state = layer_state_set_rgb_light(state);
+#endif // RGBLIGHT_ENABLE
+ return layer_state_set_keymap(state);
+}
+
+__attribute__((weak)) layer_state_t default_layer_state_set_keymap(layer_state_t state) { return state; }
+
+// Runs state check and changes underglow color and animation
+layer_state_t default_layer_state_set_user(layer_state_t state) {
+ state = default_layer_state_set_keymap(state);
+#if 0
+# if defined(RGB_MATRIX_ENABLE)
+ state = default_layer_state_set_rgb(state);
+# endif // RGB_MATRIX_ENABLE
+#endif
+ return state;
+}
+
+__attribute__((weak)) void led_set_keymap(uint8_t usb_led) {}
+
+// Any custom LED code goes here.
+// So far, I only have keyboard specific code,
+// So nothing goes here.
+void led_set_user(uint8_t usb_led) { led_set_keymap(usb_led); }
+
+__attribute__((weak)) void eeconfig_init_keymap(void) {}
+
+void eeconfig_init_user(void) {
+#ifdef KEYBOARD_planck_ez
+ userspace_config.raw = 0;
+# if defined(RGB_MATRIX_ENABLE)
+ userspace_config.rgb_layer_change = true;
+# endif
+ eeconfig_update_user(userspace_config.raw);
+#endif
+ eeconfig_init_keymap();
+ keyboard_init();
+}
-#ifdef TAP_DANCE_ENABLE // Run Diablo 3 macro checking code.
- run_diablo_macro_check();
-#endif // TAP_DANCE_ENABLE
+bool hasAllBitsInMask(uint8_t value, uint8_t mask) {
+ value &= 0xF;
+ mask &= 0xF;
- matrix_scan_keymap();
+ return (value & mask) == mask;
}
diff --git a/users/bocaj/bocaj.h b/users/bocaj/bocaj.h
index 04991a0150..e69be74da5 100644
--- a/users/bocaj/bocaj.h
+++ b/users/bocaj/bocaj.h
@@ -1,5 +1,6 @@
/*
-Copyright 2018 Jacob Jerrell <jacob.jerrell@gmail.com> @JacobJerrell
+Copyright 2017 Christopher Courtney <drashna@live.com> @drashna
+Copyright 2020 Jacob Jerrell <jacob.jerrell@gmail.com> @JacobJerrell
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
@@ -16,70 +17,57 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
-#include "quantum.h"
+#include QMK_KEYBOARD_H
+
#include "version.h"
#include "eeprom.h"
-#include "wrappers.h"
#include "process_records.h"
-#ifdef TAP_DANCE_ENABLE
- #include "tap_dances.h"
-#endif // TAP_DANCE_ENABLE
+#include "wrappers.h"
+#if defined(RGB_MATRIX_ENABLE)
+# include "rgb_matrix_stuff.h"
+#endif
-/* Layer Names */
+/* Define layer names */
enum userspace_layers {
- _WORKMAN = 0,
- _WINWORKMAN,
- _QWERTY,
- _LOWER,
- _ADJUST,
- _DIABLO,
+ _WORKMAN = 0,
+ _QWERTY,
+ _WWORKMAN,
+ _WQWERTY,
+ _LOWER,
+ _RAISE,
+ _ADJUST,
+ _MOD,
+ LAYER_SAFE_RANGE,
};
-#if (defined(UNICODE_ENABLE) || defined(UNICODEMAP_ENABLE) || defined(UCIS_ENABLE))
- #define BOCAJ_UNICODE_MODE UC_OSX
-#else
- // set to 2 for UC_WIN, set to 4 for UC_WINC
- #define BOCAJ_UNICODE_MODE 2
-#endif
-
-/*
-define modifiers here, since MOD_* doesn't seem to work for these
- */
#define MODS_SHIFT_MASK (MOD_BIT(KC_LSHIFT)|MOD_BIT(KC_RSHIFT))
-#define MODS_CTRL_MASK (MOD_BIT(KC_LCTL)|MOD_BIT(KC_RCTRL))
-#define MODS_ALT_MASK (MOD_BIT(KC_LALT)|MOD_BIT(KC_RALT))
-#define MODS_GUI_MASK (MOD_BIT(KC_LGUI)|MOD_BIT(KC_RGUI))
+#define MODS_CTRL_MASK (MOD_BIT(KC_LCTL)|MOD_BIT(KC_RCTRL))
+#define MODS_ALT_MASK (MOD_BIT(KC_LALT)|MOD_BIT(KC_RALT))
+#define MODS_GUI_MASK (MOD_BIT(KC_LGUI)|MOD_BIT(KC_RGUI))
-bool mod_key_press_timer (uint16_t code, uint16_t mod_code, bool pressed);
-bool mod_key_press (uint16_t code, uint16_t mod_code, bool pressed, uint16_t this_timer);
-bool send_game_macro(const char *str, keyrecord_t *record, bool override);
-void matrix_init_keymap(void);
-void shutdown_keymap(void);
-void suspend_power_down_keymap(void);
-void suspend_wakeup_init_keymap(void);
-void matrix_scan_keymap(void);
-uint32_t layer_state_set_keymap (uint32_t state);
-uint32_t default_layer_state_set_keymap (uint32_t state);
-void led_set_keymap(uint8_t usb_led);
-void eeconfig_init_keymap(void);
-void tap(uint16_t keycode);
+bool mod_key_press_timer(uint16_t code, uint16_t mod_code, bool pressed);
+bool mod_key_press(uint16_t code, uint16_t mod_code, bool pressed, uint16_t this_timer);
+void matrix_init_keymap(void);
+void shutdown_keymap(void);
+void suspend_power_down_keymap(void);
+void suspend_wakeup_init_keymap(void);
+void matrix_scan_keymap(void);
+layer_state_t layer_state_set_keymap(layer_state_t state);
+layer_state_t default_layer_state_set_keymap(layer_state_t state);
+void led_set_keymap(uint8_t usb_led);
+void eeconfig_init_keymap(void);
+bool hasAllBitsInMask(uint8_t value, uint8_t mask);
+// clang-format off
+#ifdef KEYBOARD_planck_ez
typedef union {
- uint8_t raw;
+ uint32_t raw;
+ struct {
+ bool rgb_layer_change :1;
+ bool rgb_matrix_idle_anim :1;
+ };
} userspace_config_t;
+// clang-format on
extern userspace_config_t userspace_config;
-
-// If Tap Dancing is enabled, we manage that here.
-// If it is not, then we define the KC_D3_# codes gracefully
-#ifdef TAP_DANCE_ENABLE
- #define KC_D3_1 TD(TD_D3_1)
- #define KC_D3_2 TD(TD_D3_2)
- #define KC_D3_3 TD(TD_D3_3)
- #define KC_D3_4 TD(TD_D3_4)
-#else // !TAP_DANCE_ENABLE
- #define KC_D3_1 KC_1
- #define KC_D3_2 KC_2
- #define KC_D3_3 KC_3
- #define KC_D3_4 KC_4
-#endif // TAP_DANCE_ENABLE
+#endif
diff --git a/users/bocaj/config.h b/users/bocaj/config.h
index 1956ea6d96..2a44aabfc4 100644
--- a/users/bocaj/config.h
+++ b/users/bocaj/config.h
@@ -1,8 +1,82 @@
#pragma once
-#ifndef QMK_KEYS_PER_SCAN
- #define QMK_KEYS_PER_SCAN 4
-#endif // QMK KEYS PER SCAN
+// Use custom magic number so that when switching branches, EEPROM always gets reset
+#define EECONFIG_MAGIC_NUMBER (uint16_t)0x1339
+
+/* Set Polling rate to 1000Hz */
+#define USB_POLLING_INTERVAL_MS 1
+
+#ifdef AUDIO_ENABLE
+
+# define AUDIO_CLICKY
+# define STARTUP_SONG SONG(RICK_ROLL)
+# define GOODBYE_SONG SONG(SONIC_RING)
+# define DEFAULT_LAYER_SONGS \
+ { SONG(QWERTY_SOUND), SONG(COLEMAK_SOUND), SONG(DVORAK_SOUND), SONG(OVERWATCH_THEME) }
+
+# define AUDIO_CLICKY_FREQ_RANDOMNESS 1.5f
+
+# define UNICODE_SONG_MAC SONG(RICK_ROLL)
+# define UNICODE_SONG_LNX SONG(RICK_ROLL)
+# define UNICODE_SONG_WIN SONG(RICK_ROLL)
+# define UNICODE_SONG_BSD SONG(RICK_ROLL)
+# define UNICODE_SONG_WINC SONG(RICK_ROLL)
+#endif // !AUDIO_ENABLE
+
+#ifdef RGB_MATRIX_ENABLE
+# define RGB_MATRIX_KEYPRESSES // reacts to keypresses (will slow down matrix scan by a lot)
+// # define RGB_MATRIX_KEYRELEASES // reacts to keyreleases (not recommened)
+# define RGB_MATRIX_FRAMEBUFFER_EFFECTS
+// # define RGB_DISABLE_AFTER_TIMEOUT 0 // number of ticks to wait until disabling effects
+# define RGB_DISABLE_WHEN_USB_SUSPENDED true // turn off effects when suspended
+// # define RGB_MATRIX_MAXIMUM_BRIGHTNESS 200 // limits maximum brightness of LEDs to 200 out of 255. If not defined maximum brightness is set to 255
+// # define EECONFIG_RGB_MATRIX (uint32_t *)16
+
+# if defined(__AVR__) && !defined(__AVR_AT90USB1286__)
+# define DISABLE_RGB_MATRIX_ALPHAS_MODS
+# define DISABLE_RGB_MATRIX_GRADIENT_UP_DOWN
+# define DISABLE_RGB_MATRIX_GRADIENT_LEFT_RIGHT
+# define DISABLE_RGB_MATRIX_BREATHING
+# define DISABLE_RGB_MATRIX_BAND_SAT
+# define DISABLE_RGB_MATRIX_BAND_VAL
+# define DISABLE_RGB_MATRIX_BAND_PINWHEEL_SAT
+# define DISABLE_RGB_MATRIX_BAND_PINWHEEL_VAL
+# define DISABLE_RGB_MATRIX_BAND_SPIRAL_SAT
+# define DISABLE_RGB_MATRIX_BAND_SPIRAL_VAL
+# define DISABLE_RGB_MATRIX_CYCLE_ALL
+# define DISABLE_RGB_MATRIX_CYCLE_LEFT_RIGHT
+# define DISABLE_RGB_MATRIX_CYCLE_UP_DOWN
+# define DISABLE_RGB_MATRIX_CYCLE_OUT_IN
+// # define DISABLE_RGB_MATRIX_CYCLE_OUT_IN_DUAL
+# define DISABLE_RGB_MATRIX_RAINBOW_MOVING_CHEVRON
+# define DISABLE_RGB_MATRIX_DUAL_BEACON
+# define DISABLE_RGB_MATRIX_CYCLE_PINWHEEL
+# define DISABLE_RGB_MATRIX_CYCLE_SPIRAL
+# define DISABLE_RGB_MATRIX_RAINBOW_BEACON
+# define DISABLE_RGB_MATRIX_RAINBOW_PINWHEELS
+# define DISABLE_RGB_MATRIX_RAINDROPS
+# define DISABLE_RGB_MATRIX_JELLYBEAN_RAINDROPS
+// # define DISABLE_RGB_MATRIX_TYPING_HEATMAP
+# define DISABLE_RGB_MATRIX_DIGITAL_RAIN
+# define DISABLE_RGB_MATRIX_SOLID_REACTIVE
+# define DISABLE_RGB_MATRIX_SOLID_REACTIVE_SIMPLE
+# define DISABLE_RGB_MATRIX_SOLID_REACTIVE_WIDE
+# define DISABLE_RGB_MATRIX_SOLID_REACTIVE_MULTIWIDE
+# define DISABLE_RGB_MATRIX_SOLID_REACTIVE_CROSS
+# define DISABLE_RGB_MATRIX_SOLID_REACTIVE_MULTICROSS
+# define DISABLE_RGB_MATRIX_SOLID_REACTIVE_NEXUS
+# define DISABLE_RGB_MATRIX_SOLID_REACTIVE_MULTINEXUS
+# define DISABLE_RGB_MATRIX_SPLASH
+# define DISABLE_RGB_MATRIX_MULTISPLASH
+# define DISABLE_RGB_MATRIX_SOLID_SPLASH
+# define DISABLE_RGB_MATRIX_SOLID_MULTISPLASH
+# endif // AVR
+#endif // RGB_MATRIX_ENABLE
+
+#ifdef QMK_KEYS_PER_SCAN
+# undef QMK_KEYS_PER_SCAN
+# define QMK_KEYS_PER_SCAN 1
+#endif // !QMK_KEYS_PER_SCAN
// this makes it possible to do rolling combos (zx) with keys that
// convert to other keys on hold (z becomes ctrl when you hold it,
@@ -10,24 +84,30 @@
// actually sends Ctrl-x. That's bad.)
#define IGNORE_MOD_TAP_INTERRUPT
#undef PERMISSIVE_HOLD
-#define PREVENT_STUCK_MODIFIERS
+//#define TAPPING_FORCE_HOLD
+//#define RETRO_TAPPING
+
+#define FORCE_NKRO
+
+#ifndef TAPPING_TOGGLE
+# define TAPPING_TOGGLE 1
+#endif
#ifdef TAPPING_TERM
-#undef TAPPING_TERM
-#endif // TAPPING_TERM
-#define TAPPING_TERM 175
-
-#define RETRO_TAPPING
-
-// Disable action_get_macro and fn_actions, since we don't use these
-// and it saves on space in the firmware.
-#ifndef NO_DEBUG
-#define NO_DEBUG
-#endif // !NO_DEBUG
-#if !defined(NO_PRINT) && !defined(CONSOLE_ENABLE)
-#define NO_PRINT
-#endif // !NO_PRINT
-#define NO_ACTION_MACRO
-#define NO_ACTION_FUNCTION
-
-#define MACRO_TIMER 5
+# undef TAPPING_TERM
+#endif // TAPPING_TERM
+#if defined(KEYBOARD_ergodox_ez)
+# define TAPPING_TERM 185
+#else
+# define TAPPING_TERM 175
+#endif
+
+#define TAP_CODE_DELAY 5
+
+/* Disable unused and unneeded features to reduce on firmware size */
+#ifdef LOCKING_SUPPORT_ENABLE
+# undef LOCKING_SUPPORT_ENABLE
+#endif
+#ifdef LOCKING_RESYNC_ENABLE
+# undef LOCKING_RESYNC_ENABLE
+#endif
diff --git a/users/bocaj/process_records.c b/users/bocaj/process_records.c
index c36683f8ba..9eb181ad44 100644
--- a/users/bocaj/process_records.c
+++ b/users/bocaj/process_records.c
@@ -1,149 +1,111 @@
#include "bocaj.h"
-#include QMK_KEYBOARD_H
+#include <print.h>
-uint16_t copy_paste_timer;
-uint16_t grave_layer_timer;
-uint16_t heal_layer_timer;
+__attribute__((weak)) bool process_record_keymap(uint16_t keycode, keyrecord_t *record) { return true; }
-__attribute__ ((weak))
-bool process_record_keymap(uint16_t keycode, keyrecord_t *record) {
- return true;
-}
+__attribute__((weak)) bool process_record_secrets(uint16_t keycode, keyrecord_t *record) { return true; }
// Defines actions tor my global custom keycodes. Defined in bocaj.h file
// Then runs the _keymap's record handler if not processed here
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
- switch (keycode) {
- case KC_MWRK:
- if (!record->event.pressed) {
- set_single_persistent_default_layer(_WORKMAN);
- #if (defined(UNICODE_ENABLE) || defined(UNICODEMAP_ENABLE) || defined(UCIS_ENABLE))
- set_unicode_input_mode(0);
- #endif
- layer_move(0);
- ergodox_blink_all_leds();
- }
- break;
- case KC_WWRK:
- if (!record->event.pressed) {
- set_single_persistent_default_layer(_WINWORKMAN);
- #if (defined(UNICODE_ENABLE) || defined(UNICODEMAP_ENABLE) || defined(UCIS_ENABLE))
- set_unicode_input_mode(4);
- #endif
- layer_move(0);
- ergodox_blink_all_leds();
- }
- break;
- case KC_MQWR:
- if (!record->event.pressed) {
- set_single_persistent_default_layer(_QWERTY);
- #if (defined(UNICODE_ENABLE) || defined(UNICODEMAP_ENABLE) || defined(UCIS_ENABLE))
- set_unicode_input_mode(0);
- #endif
- layer_move(0);
- ergodox_blink_all_leds();
- }
- break;
- case MC_LOCK:
- if (!record->event.pressed) {
- layer_move(0);
- SEND_STRING(SS_LCTRL(SS_LGUI("q")));
- }
- break;
- case KC_MAKE: // Compiles the firmware, and adds the flash command based on keyboard bootloader
- if (!record->event.pressed) {
- uint8_t temp_mod = get_mods();
- uint8_t temp_osm = get_oneshot_mods();
- clear_mods();
- clear_oneshot_mods();
- if (biton32(default_layer_state) == _WINWORKMAN) {
- send_string_with_delay_P(PSTR("make " QMK_KEYBOARD ":" QMK_KEYMAP), 10);
- } else {
- send_string_with_delay_P(PSTR("util/docker_build.sh " QMK_KEYBOARD ":" QMK_KEYMAP), 10);
- }
- if (temp_mod & MODS_SHIFT_MASK) {
- send_string_with_delay_P(PSTR(":teensy"), 10);
- }
- if (temp_mod & MODS_CTRL_MASK) {
- send_string_with_delay_P(PSTR(" -j8 --output-sync"), 10);
- }
- send_string_with_delay_P(PSTR(SS_TAP(X_ENTER)), 10);
- set_mods(temp_mod);
- layer_move(0);
- }
- break;
- case KC_DCLR: // reset all Diablo timers, disabling them
-#ifdef TAP_DANCE_ENABLE
- if (record->event.pressed) {
- uint8_t dtime;
- for (dtime = 0; dtime < 4; dtime++) {
- diablo_key_time[dtime] = diablo_times[0];
- }
- }
-#endif // TAP_DANCE_ENABLE
- break;
- case JJ_ARRW:
- if (!record->event.pressed) {
- SEND_STRING("->");
- }
- return false;
- break;
- case LM_GRAVE:
- if (record->event.pressed) {
- grave_layer_timer = timer_read();
- } else {
- if (timer_elapsed(grave_layer_timer) < TAPPING_TERM) {
- uint8_t temp_mod = get_mods();
- uint8_t one_shot = get_oneshot_mods();
- clear_mods();
- if (temp_mod & MODS_SHIFT_MASK || one_shot & MODS_SHIFT_MASK) {
- register_code(KC_LSFT);
- tap(KC_GRAVE);
- unregister_code(KC_LSFT);
- } else {
- tap(KC_GRAVE);
- }
- set_mods(temp_mod);
- } else {
- layer_move(0);
- }
- }
- return false;
- break;
- case KC_CCCV:
- if (record->event.pressed) {
- copy_paste_timer = timer_read();
- } else {
- if (timer_elapsed(copy_paste_timer) > TAPPING_TERM) { // Hold, copy
- SEND_STRING(SS_LGUI("c"));
- } else {
- SEND_STRING(SS_LGUI("v"));
+
+ if (process_record_keymap(keycode, record) && process_record_secrets(keycode, record)
+#ifdef RGB_MATRIX_ENABLE
+ && process_record_user_rgb_matrix(keycode, record)
+#endif
+ ) {
+ switch (keycode) {
+ case KC_WORKMAN:
+ if (!record->event.pressed) {
+ uint8_t mods = mod_config(get_mods());
+ if (!mods) {
+ set_single_persistent_default_layer(_WORKMAN);
+
+ } else if (mods & (MODS_GUI_MASK | MODS_CTRL_MASK)) {
+ set_single_persistent_default_layer(_WWORKMAN);
+ }
+ }
+ return false;
+ break;
+ case KC_QWERTY:
+ if (!record->event.pressed) {
+ uint8_t mods = mod_config(get_mods());
+ if (!mods) {
+ set_single_persistent_default_layer(_QWERTY);
+ } else if (mods & (MODS_GUI_MASK | MODS_CTRL_MASK)) {
+ set_single_persistent_default_layer(_WQWERTY);
+ }
+ }
+ return false;
+ break;
+
+ case MC_ARRW:
+ if (!record->event.pressed) {
+ clear_mods();
+ send_string_with_delay_P(PSTR("->"), TAP_CODE_DELAY);
+ }
+ return false;
+ break;
+
+ case KC_MAKE: // Compiles the firmware, and adds the flash command based on keyboard bootloader
+ if (!record->event.pressed) {
+ clear_mods();
+ send_string_with_delay_P(PSTR("qmk compile "), TAP_CODE_DELAY);
+ send_string_with_delay_P(PSTR("-kb " QMK_KEYBOARD), TAP_CODE_DELAY);
+ send_string_with_delay_P(PSTR(SS_TAP(X_ENTER)), TAP_CODE_DELAY);
+ }
+ return false;
+ break;
+
+ case VRSN: // Prints firmware version
+ if (!record->event.pressed) {
+ send_string_with_delay_P(PSTR(QMK_KEYBOARD "/" QMK_KEYMAP " @ " QMK_VERSION ", Built on: " QMK_BUILDDATE), TAP_CODE_DELAY);
+ }
+ break;
+#if defined(RGB_MATRIX_ENABLE)
+ case KC_RGB_T: // This allows me to use underglow as layer indication, or as normal
+ if (!record->event.pressed) {
+ userspace_config.rgb_layer_change ^= 1;
+ dprintf("rgblight layer change [EEPROM]: %u\n", userspace_config.rgb_layer_change);
+ eeconfig_update_user(userspace_config.raw);
+ if (userspace_config.rgb_layer_change) {
+ rgblight_enable_noeeprom();
+ layer_state_set(layer_state); // This is needed to immediately set the layer color (looks better)
+ } else {
+ rgblight_disable_noeeprom();
+ }
+ }
+ return false;
+ break;
+ case RGB_TOG:
+ if (!record->event.pressed) {
+# if defined(RGB_MATRIX_ENABLE) && !defined(RGB_MATRIX_DISABLE_KEYCODES)
+ rgb_matrix_toggle();
+# endif
+ }
+ return false;
+ break;
+ case RGB_MODE_FORWARD ... RGB_MODE_GRADIENT: // quantum_keycodes.h L400 for definitions
+ if (!record->event.pressed) {
+ bool is_eeprom_updated;
+# if defined(RGB_MATRIX_ENABLE) && defined(RGB_MATRIX_FRAMEBUFFER_EFFECTS)
+ if (userspace_config.rgb_matrix_idle_anim) {
+ userspace_config.rgb_matrix_idle_anim = false;
+ dprintf("RGB Matrix Idle Animation [EEPROM]: %u\n", userspace_config.rgb_matrix_idle_anim);
+ is_eeprom_updated = true;
+ }
+# endif
+ if (is_eeprom_updated) {
+ eeconfig_update_user(userspace_config.raw);
+ }
+ }
+ return false;
+ break;
+#endif
}
- }
- return false;
- break;
-#ifdef UNICODE_ENABLE
- case UC_FLIP: // (ノಠ痊ಠ)ノ彡┻━┻
- if (record->event.pressed) {
- send_unicode_hex_string("0028 30CE 0CA0 75CA 0CA0 0029 30CE 5F61 253B 2501 253B");
- }
- break;
- case UC_TABL: // ┬─┬ノ( º _ ºノ)
- if (record->event.pressed) {
- send_unicode_hex_string("252C 2500 252C 30CE 0028 0020 00BA 0020 005F 0020 00BA 30CE 0029");
- }
- break;
- case UC_SHRG: // ¯\_(ツ)_/¯
- if (record->event.pressed) {
- send_unicode_hex_string("00AF 005C 005F 0028 30C4 0029 005F 002F 00AF");
- }
- break;
- case UC_DISA: // ಠ_ಠ
- if (record->event.pressed) {
- send_unicode_hex_string("0CA0 005F 0CA0");
- }
- break;
+ }
+#ifdef CONSOLE_ENABLE
+ uprintf("KL: kc: %u, col: %u, row: %u, pressed: %u\n", keycode, record->event.key.col, record->event.key.row, record->event.pressed);
#endif
- }
- return process_record_keymap(keycode, record);
+ return true;
}
diff --git a/users/bocaj/process_records.h b/users/bocaj/process_records.h
index 5c55df35e8..c17e2ffdc1 100644
--- a/users/bocaj/process_records.h
+++ b/users/bocaj/process_records.h
@@ -2,49 +2,43 @@
#include "bocaj.h"
#if defined(KEYMAP_SAFE_RANGE)
- #define PLACEHOLDER_SAFE_RANGE KEYMAP_SAFE_RANGE
+# define PLACEHOLDER_SAFE_RANGE KEYMAP_SAFE_RANGE
#else
- #define PLACEHOLDER_SAFE_RANGE SAFE_RANGE
+# define PLACEHOLDER_SAFE_RANGE SAFE_RANGE
#endif
enum userspace_custom_keycodes {
- KC_EPRM = PLACEHOLDER_SAFE_RANGE, // can always be here
- KC_MWRK,
- KC_WWRK,
- KC_MQWR,
- KC_VRSN,
- LM_GRAVE, // Shift if held, layer change if tapped
- JJ_COPY,
- JJ_PSTE,
- JJ_ARRW,
- KC_CCCV,
- MC_LOCK,
- KC_DCLR,
- KC_MAKE,
- UC_FLIP, // (ಠ痊ಠ)┻━┻
- UC_TABL, // ┬─┬ノ( º _ ºノ)
- UC_SHRG, // ¯\_(ツ)_/¯
- UC_DISA, // ಠ_ಠ
- NEW_SAFE_RANGE //use "NEWPLACEHOLDER for keymap specific codes
+ VRSN = PLACEHOLDER_SAFE_RANGE, // Prints QMK Firmware and board info
+ KC_WORKMAN, // Sets default layer to WORKMAN
+ KC_QWERTY, // Sets default layer to QWERTY
+ // KC_COLEMAK, // Sets default layer to COLEMAK
+ // KC_DVORAK, // Sets default layer to DVORAK
+ KC_MAKE, // Run keyboard's customized make command
+ KC_RGB_T, // Toggles RGB Layer Indication mode
+ RGB_IDL, // RGB Idling animations
+ MC_ARRW, // ->
+ UC_FLIP, // (ಠ痊ಠ)┻━┻
+ UC_TABL, // ┬─┬ノ( º _ ºノ)
+ UC_SHRG, // ¯\_(ツ)_/¯
+ UC_DISA, // ಠ_ಠ
+ NEW_SAFE_RANGE // use "NEWPLACEHOLDER for keymap specific codes
};
+