diff options
Diffstat (limited to 'users')
45 files changed, 3280 insertions, 24 deletions
diff --git a/users/anderson/dmc12.c b/users/anderson/dmc12.c new file mode 100644 index 0000000000..1dd89dce41 --- /dev/null +++ b/users/anderson/dmc12.c @@ -0,0 +1,46 @@ +#include "dmc12.h" + +static uint32_t dmc12_color = 0; +static uint16_t dmc12_timer = 0; +static int8_t dmc12_current = 0; +static uint8_t dmc12_direction = 1; + +void dmc12_start(uint32_t color, bool reset) { + dmc12_color = color; + if (reset) { + dmc12_timer = 0; + dmc12_current = 0; + dmc12_direction = 1; + } +} + +void dmc12_process(void) { + if (!dmc12_timer) { + dmc12_timer = timer_read(); + return; + } + float dist_from_center = ((float)abs(dmc12_current - RGBLED_NUM / 2)) / ((float)RGBLED_NUM); + if (timer_elapsed(dmc12_timer) > dist_from_center * LED_INTERVAL) { + dmc12_current += dmc12_direction; + if (dmc12_current == 0 || dmc12_current == RGBLED_NUM - 1) { + dmc12_direction *= -1; + } + dmc12_timer = timer_read(); + for (int i = 0; i < RGBLED_NUM; i++) { + if (i > dmc12_current - LED_RADIUS && i < dmc12_current + LED_RADIUS) { + float intensity = (LED_RADIUS - abs(i - dmc12_current)) / ((float)LED_RADIUS); + if (i != dmc12_current) { + intensity /= 4.0; + } + rgblight_setrgb_at( + ((dmc12_color >> 16) & 0xFF) * intensity, + ((dmc12_color >> 8) & 0xFF) * intensity, + (dmc12_color & 0xFF) * intensity, + i + ); + } else { + rgblight_setrgb_at(0, 0, 0, i); + } + } + } +} diff --git a/users/anderson/dmc12.h b/users/anderson/dmc12.h new file mode 100644 index 0000000000..6b2bf94a51 --- /dev/null +++ b/users/anderson/dmc12.h @@ -0,0 +1,9 @@ +// Sexy LED animation. + +#include "quantum.h" + +#define LED_INTERVAL 160 +#define LED_RADIUS 6 + +void dmc12_start(uint32_t color, bool reset); +void dmc12_process(void); diff --git a/users/anderson/seq.c b/users/anderson/seq.c new file mode 100644 index 0000000000..ff50648599 --- /dev/null +++ b/users/anderson/seq.c @@ -0,0 +1,38 @@ +#include "seq.h" + +static char buffer[32]; +static uint8_t buffer_size = 0; + +void seq_start(void) { + buffer_size = 0; + SEND_STRING(":"); +} + +bool seq_feed(uint16_t keycode) { + if (keycode == KC_ENTER) { + for (int i = 0; i < buffer_size + 1; i++) { + tap_code(KC_BSPACE); + } + for (int i = 0; i < seq_config_size; i++) { + seq_t item = seq_config[i]; + if (strncmp(item.sequence, buffer, buffer_size) == 0) { + send_unicode_string(item.result); + } + } + buffer_size = 0; + return false; + } else if (keycode == KC_BSPACE) { + if (buffer_size) { + buffer_size--; + tap_code(keycode); + } + return true; + } else { + if (keycode >= KC_A && keycode <= KC_Z) { + buffer[buffer_size++] = keycode - KC_A + 'a'; + tap_code(keycode); + } + return true; + } +} + diff --git a/users/anderson/seq.h b/users/anderson/seq.h new file mode 100644 index 0000000000..2da4e76154 --- /dev/null +++ b/users/anderson/seq.h @@ -0,0 +1,14 @@ +#include "quantum.h" + +#include <string.h> + +typedef struct seq_t { + const char *sequence; + const char *result; +} seq_t; + +extern seq_t seq_config[]; +extern uint16_t seq_config_size; + +void seq_start(void); +bool seq_feed(uint16_t keycode); diff --git a/users/anderson/smoothled.c b/users/anderson/smoothled.c new file mode 100644 index 0000000000..3af729563c --- /dev/null +++ b/users/anderson/smoothled.c @@ -0,0 +1,34 @@ +#include <smoothled.h> + +static uint32_t sourceColor = 0x000000; +static uint32_t currentColor = 0x000000; +static uint32_t targetColor = 0x000000; +static int32_t smoothledTimer = -1; + +void smoothled_set(uint32_t color) { + smoothledTimer = timer_read32(); + sourceColor = currentColor; + targetColor = color; +} + +void smoothled_process(void) { + if (smoothledTimer < 0) { + return; + } + int32_t kb = timer_elapsed32(smoothledTimer); + int32_t ka = SMOOTH_DURATION - kb; + if (kb > SMOOTH_DURATION) { + kb = SMOOTH_DURATION; + ka = 0; + smoothledTimer = -1; + } + currentColor = 0; + for (int i = 2; i >= 0; i--) { + uint32_t shift = i * 8; + currentColor |= (ka * ((uint32_t)(sourceColor >> shift) & 0xFF) + kb * ((uint32_t)(targetColor >> shift) & 0xFF)) / SMOOTH_DURATION; + /*currentColor |= ((targetColor >> shift) & 0xFF);*/ + currentColor <<= 8; + } + currentColor >>= 8; + rgblight_setrgb((currentColor >> 16) & 0xFF, (currentColor >> 8) & 0xFF, currentColor & 0xFF); +} diff --git a/users/anderson/smoothled.h b/users/anderson/smoothled.h new file mode 100644 index 0000000000..bf4f8c1770 --- /dev/null +++ b/users/anderson/smoothled.h @@ -0,0 +1,6 @@ +#include "quantum.h" + +#define SMOOTH_DURATION 160 + +void smoothled_set(uint32_t color); +void smoothled_process(void); diff --git a/users/art/art.c b/users/art/art.c new file mode 100644 index 0000000000..5596e237f8 --- /dev/null +++ b/users/art/art.c @@ -0,0 +1,464 @@ +#include "art.h" +#include "string.h" + +__attribute__ ((weak)) +bool process_record_keymap(uint16_t keycode, keyrecord_t *record) { + return true; +} + +__attribute__ ((weak)) +void led_show_current_os(void) { +} + +static bool mac_ctrl_on = false; //for switching tabs +static bool mac_gui_on = false; //for switching languages +static bool mac_alt_tab_on = false; //for switching windows + +static const char *key_up[2] = {SS_UP(X_LALT), SS_UP(X_LCTL)}; +static const char *key_down[2] = {SS_DOWN(X_LALT), SS_DOWN(X_LCTL)}; + +int char_to_del = 1; +static bool sarcasm_on = false; +static bool sarcasm_key = false; + +void backspace_n_times(int times) { + for (int i=0; i<times; i++) { + SEND_STRING(SS_TAP(X_BSPC)); + } +} + +void send_string_remembering_length(char *string) { + send_string(string); + char_to_del = strlen(string); +} + +void send_shifted_strings(char *string1, char *string2) { + if ( get_mods() & MOD_MASK_SHIFT ) { + clear_mods(); + send_string_remembering_length(string2); + } else { + send_string_remembering_length(string1); + } +} + +void send_shifted_strings_add(char *string1, char *string2) { + bool shifted = get_mods() & MOD_MASK_SHIFT; + clear_mods(); + + send_string_remembering_length(string1); + + if (shifted) { + send_string(string2); + char_to_del = strlen(string1) + strlen(string2); + } +} + +bool is_mac_with_base_layer_off(void) { + return !is_win && !layer_state_is(BASE); +} + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + if (sarcasm_on) { + sarcasm_key = ! sarcasm_key; + if (sarcasm_key) { + SEND_STRING(SS_TAP(X_CAPS)); + } + } + + //Checking all other non-backspace keys to clear the backspace buffer. This is to prevent the bug of deleting N chars sometime after using a macro + if (record->event.pressed && (keycode != KC_BSPACE && keycode != XXXXXXX)) { + char_to_del = 1; + } + + switch (keycode) { + case KC_TAB: + if (record->event.pressed && is_mac_with_base_layer_off()) { + uint8_t mods = get_mods(); + uint8_t mod_state = mods & MOD_MASK_ALT; + if (get_mods() & mod_state) { + del_mods(mod_state); + add_mods(MOD_LCTL); + mac_alt_tab_on = true; + } + + mod_state = mods & MOD_MASK_CTRL; + if (get_mods() & mod_state && !mac_alt_tab_on) { + del_mods(mod_state); + add_mods(MOD_LGUI); + mac_ctrl_on = true; + } + } + break; + case KC_LSFT: + if (record->event.pressed && is_mac_with_base_layer_off()) { + uint8_t mods = get_mods(); + uint8_t mod_state = mods & MOD_MASK_AG; + if (get_mods() & mod_state) { + del_mods(mod_state); + add_mods(MOD_LGUI); + mac_gui_on = true; + SEND_STRING(SS_TAP(X_SPACE)); + return false; + } else { + return true; + } + } + break; + case KC_LEFT: + case KC_RIGHT: + if (record->event.pressed && is_mac_with_base_layer_off()) { + /* && !mac_ctrl_on/!mac_alt_tab_on are required since setting the state while holding the key changes + the modifier from OS's perspective. As a result, just the pressed key cannot be the single source + of truth to determine which state we're in, and a separate bool is required */ + uint8_t mods = get_mods(); + uint8_t mod_state = mods & MOD_MASK_ALT; + //Allows Ctrl <-/-> on Mac if Ctrl Tab is already pressed + if (get_mods() & mod_state && mac_alt_tab_on && !mac_ctrl_on) { + del_mods(mod_state); + add_mods(MOD_LCTL); + } + + mod_state = mods & MOD_MASK_CTRL; + if (get_mods() & mod_state && !mac_alt_tab_on) { + del_mods(mod_state); + add_mods(MOD_LALT); + mac_ctrl_on = true; + } + } + break; + case KC_DEL: + if (record->event.pressed && is_mac_with_base_layer_off()) { + uint8_t mod_state = get_mods() & MOD_MASK_CTRL; + if (get_mods() & mod_state) { + del_mods(mod_state); + add_mods(MOD_LALT); + mac_ctrl_on = true; + } + } + break; + case KC_LALT: + if (!record->event.pressed && is_mac_with_base_layer_off()) { + if (mac_alt_tab_on) { + unregister_mods(MOD_LCTL); + mac_alt_tab_on = false; + return false; + } else if (mac_gui_on) { + SEND_STRING(SS_UP(X_LGUI)); + mac_gui_on = false; + return false; + } + } + break; + case KC_RALT: + if (!record->event.pressed && mac_alt_tab_on && is_mac_with_base_layer_off()) { + unregister_mods(MOD_LCTL); + mac_alt_tab_on = false; + return false; + } + break; + case KC_LCTL: + case KC_RCTL: + if (!record->event.pressed && mac_ctrl_on && is_mac_with_base_layer_off()) { + SEND_STRING(SS_UP(X_LGUI) SS_UP(X_LALT)); + mac_ctrl_on = false; + return false; + } + break; + + case KC_HOME: + if (record->event.pressed && is_mac_with_base_layer_off()) { + SEND_STRING(SS_LCTL(SS_TAP(X_LEFT))); + return false; + } + break; + case KC_END: + if (record->event.pressed && is_mac_with_base_layer_off()) { + SEND_STRING(SS_LCTL(SS_TAP(X_RIGHT))); + return false; + } + break; + case KC_BSPC: + if (record->event.pressed) { + if (char_to_del > 1) { + layer_off(GIT_C); + layer_off(GIT_S); + backspace_n_times(char_to_del); + char_to_del = 1; + return false; + } + + if (is_mac_with_base_layer_off()) { + uint8_t mod_state = get_mods() & MOD_MASK_CTRL; + if (get_mods() & mod_state) { + del_mods(mod_state); + add_mods(MOD_LALT); + mac_ctrl_on = true; + } + } + } + break; + + /* ------------------------------------------------------------------------- + * CUSTOM MACROS + * ------------------------------------------------------------------------ */ + case CTRL_CTV: + if (record->event.pressed) { + if ( get_mods() & MOD_MASK_SHIFT ) { + clear_mods(); + SEND_STRING(SS_LCTL("ctv")); + } else { + SEND_STRING(SS_LCTL("ctv") SS_TAP(X_ENTER)); + } + } + break; + case CTRL_LCTV: + if (record->event.pressed) { + if ( get_mods() & MOD_MASK_SHIFT ) { + //Firefox + clear_mods(); + SEND_STRING(SS_LCTL("lcP")); + wait_ms(200); + SEND_STRING(SS_LCTL("v") SS_TAP(X_ENTER)); + } else if ( get_mods() & MOD_MASK_CTRL ) { + //Chrome + clear_mods(); + SEND_STRING(SS_LCTL("lcNv") SS_TAP(X_ENTER)); + } else { + SEND_STRING(SS_LCTL("lctv")); + } + } + break; + case CTRL_CAV: + if (record->event.pressed) { + SEND_STRING(SS_LCTL("c" SS_TAP(X_TAB))); + wait_ms(50); + SEND_STRING(SS_LCTL("av")); + } + break; + case SARCASM: + if (record->event.pressed) { + sarcasm_on = !sarcasm_on; + } + break; + + /* ------------------------------------------------------------------------- + * OS TOGGLING + * ------------------------------------------------------------------------ */ + case TOG_OS: + if (record->event.pressed) { + is_win = ! is_win; + led_show_current_os(); + } + break; + case CTR_ALT: + if (record->event.pressed) { + send_string(key_down[is_win]); + } else { + send_string(key_up[is_win]); + } + break; + case OS_CTRL: + if (is_win) { + if (record->event.pressed) { + SEND_STRING(SS_DOWN(X_LCTL)); + } else { + SEND_STRING(SS_UP(X_LCTL)); + } + } else { + if (record->event.pressed) { + SEND_STRING(SS_DOWN(X_LGUI)); + } else { + SEND_STRING(SS_UP(X_LGUI)); + } + } + break; + case OS_WIN: + if (is_win) { + if (record->event.pressed) { + SEND_STRING(SS_DOWN(X_LGUI)); + } else { + SEND_STRING(SS_UP(X_LGUI)); + } + } else { + if (record->event.pressed) { + SEND_STRING(SS_DOWN(X_LCTL)); + } else { + SEND_STRING(SS_UP(X_LCTL)); + } + } + break; + + /* ------------------------------------------------------------------------- + * STRING MACROS + * ------------------------------------------------------------------------ */ + // case : + // if (record->event.pressed) { + // send_string_remembering_length(""); + // } + // break; + // case : + // if (record->event.pressed) { + // send_string_remembering_length("", ""); + // } + // break; + case TILD_BLOCK: + if (record->event.pressed) { + SEND_STRING("```" SS_LSFT(SS_TAP(X_ENTER) SS_TAP(X_ENTER)) "```" SS_TAP(X_UP)); + char_to_del = 4; + } + break; + case ADMINS: + if (record->event.pressed) { + send_shifted_strings_add("admin", "/aurora/status"); + } + break; + case PRESCRIPTION: + if (record->event.pressed) { + SEND_STRING("55\t12122019\t"); + char_to_del = 8; + } + break; + case FOURS: + if (record->event.pressed) { + SEND_STRING("4444333322221111\t1\t12\t21\t123\n"); + char_to_del = 16; + } + break; + + case G_ADD: + if (record->event.pressed) { + send_string_remembering_length("git add "); + } + break; + case G_BRCH: + if (record->event.pressed) { + send_shifted_strings_add("git branch ", "-d "); + } + break; + case G_C: + if (record->event.pressed) { + send_string_remembering_length("git c[Heckout/Ommit]"); + layer_on(GIT_C); + } + break; + case G_CHEC: + if (!record->event.pressed) { + bool shifted = get_mods() & MOD_MASK_SHIFT; + clear_mods(); + + backspace_n_times(15); + SEND_STRING("heckout "); + char_to_del = 13; + if (shifted) { + SEND_STRING("-b "); + char_to_del = 16; + } + layer_off(GIT_C); + } + break; + case G_COMM: + if (!record->event.pressed) { + bool shifted = get_mods() & MOD_MASK_SHIFT; + clear_mods(); + + backspace_n_times(15); + SEND_STRING("ommit -"); + char_to_del = 15; + if (shifted) { + SEND_STRING("a"); + char_to_del = 16; + } + SEND_STRING("m \"\"" SS_TAP(X_LEFT)); + layer_off(GIT_C); + } + break; + case G_DEV: + if (record->event.pressed) { + send_shifted_strings("develop", "master"); + } + break; + case G_DIFF: + if (record->event.pressed) { + send_string_remembering_length("git diff "); + } + break; + case G_FTCH: + if (record->event.pressed) { + send_string_remembering_length("git fetch "); + } + break; + case G_LOG: + if (record->event.pressed) { + send_string_remembering_length("git log "); + } + break; + case G_MERG: + if (record->event.pressed) { + send_string_remembering_length("git merge "); + } + break; + case G_P: + if (record->event.pressed) { + send_shifted_strings_add("git pu", "sh -u "); + } + break; + case G_RST: + if (record->event.pressed) { + send_string_remembering_length("git reset "); + } + break; + case G_S: + if (!record->event.pressed) { + send_string_remembering_length("git s[taSh/How/taTus]"); + layer_on(GIT_S); + } + break; + case G_SHOW: + if (!record->event.pressed) { + backspace_n_times(16); + SEND_STRING("how "); + char_to_del = 9; + layer_off(GIT_S); + } + break; + case G_STSH: + if (!record->event.pressed) { + bool shifted = get_mods() & MOD_MASK_SHIFT; + clear_mods(); + + backspace_n_times(16); + SEND_STRING("tash "); + char_to_del = 10; + + if (shifted) { + clear_mods(); + SEND_STRING("apply "); + + char_to_del = 16; + } + + layer_off(GIT_S); + } + break; + case G_STAT: + if (!record->event.pressed) { + backspace_n_times(16); + SEND_STRING("tatus "); + char_to_del = 11; + layer_off(GIT_S); + } + break; + + case CTL_ALT_START ... CTL_ALT_END: + if (record->event.pressed) { + if (is_win) { + tap_code16(LCTL(keycode - CTL_ALT_START)); + } else { + tap_code16(LALT(keycode - CTL_ALT_START)); + } + } + break; + } + + return process_record_keymap(keycode, record); +} diff --git a/users/art/art.h b/users/art/art.h new file mode 100644 index 0000000000..58b005b933 --- /dev/null +++ b/users/art/art.h @@ -0,0 +1,69 @@ +#pragma once +#include QMK_KEYBOARD_H + +#define CTL_ALT(kc) (CTL_ALT_START + ((kc) & 0xff)) + +extern bool is_win; + +enum layer_names { + QWERTY, + WORKMAN, + BASE, //only specific for split75 +#if defined(KEYBOARD_wheatfield_split75) + QWERTY_MOD, + LAYOUT_CHG, +#elif defined(KEYBOARD_ergodone) + FKEYS, + CTRL_NAV, + SHIFT_NAV, +#endif + + MEDIA, + COMBOS, + STRINGS, + CONFIG, + NAV, + NUMPAD, + GIT, + GIT_C, + GIT_S +}; + +enum custom_keycodes_art { + CTRL_CTV = SAFE_RANGE, + CTRL_LCTV, + CTRL_CAV, + SARCASM, + + TOG_OS, + CTR_ALT, + OS_CTRL, + OS_WIN, + + TILD_BLOCK, + ADMINS, + PRESCRIPTION, + FOURS, + + G_ADD, + G_BRCH, + G_C, + G_CHEC, + G_COMM, + G_DEV, + G_DIFF, + G_FTCH, + G_LOG, + G_MERG, + G_P, + G_RST, + G_S, + G_STAT, + G_STSH, + G_SHOW, + + CTL_ALT_START, + CTL_ALT_END = CTL_ALT_START + 0xff, + + NEW_SAFE_RANGE //for keymap specific codes +}; diff --git a/users/art/config.h b/users/art/config.h new file mode 100644 index 0000000000..72419ff376 --- /dev/null +++ b/users/art/config.h @@ -0,0 +1,4 @@ +#pragma once + +#undef TAPPING_TOGGLE +#define TAPPING_TOGGLE 2 diff --git a/users/art/rules.mk b/users/art/rules.mk new file mode 100644 index 0000000000..2b701eb949 --- /dev/null +++ b/users/art/rules.mk @@ -0,0 +1 @@ +SRC += art.c
\ No newline at end of file diff --git a/users/ericgebhart/ericgebhart.c b/users/ericgebhart/ericgebhart.c index 76143c6ed1..abb87899b7 100644 --- a/users/ericgebhart/ericgebhart.c +++ b/users/ericgebhart/ericgebhart.c @@ -61,11 +61,6 @@ uint32_t layer_state_set_keymap (uint32_t state) { __attribute__ ((weak)) void led_set_keymap(uint8_t usb_led) {} -// Runs just one time when the keyboard initializes. -void matrix_init_user(void) { - //ACTION_DEFAULT_LAYER_SET(DVORAK) ; -} - // check default layerstate to see which layer we are on. // if (biton32(layer_state) == _DIABLO) { --- current layer // if (biton32(default_layer_state) == _DIABLO) { --- current default layer diff --git a/users/konstantin/config.h b/users/konstantin/config.h index dcea9be279..2629cdd570 100644 --- a/users/konstantin/config.h +++ b/users/konstantin/config.h @@ -1,7 +1,10 @@ #pragma once +// Keyboard reports #define FORCE_NKRO +#define USB_POLLING_INTERVAL_MS 1 +// Mouse keys #define MOUSEKEY_DELAY 0 #define MOUSEKEY_INTERVAL 10 #define MOUSEKEY_MAX_SPEED 4 @@ -11,22 +14,25 @@ #define MOUSEKEY_WHEEL_MAX_SPEED 4 #define MOUSEKEY_WHEEL_TIME_TO_MAX 50 -#define NO_ACTION_FUNCTION -#define NO_ACTION_MACRO -#define NO_ACTION_ONESHOT - +// RGB lighting #undef RGBLIGHT_ANIMATIONS #define RGBLIGHT_EFFECT_BREATHING #define RGBLIGHT_EFFECT_RAINBOW_MOOD #define RGBLIGHT_EFFECT_RAINBOW_SWIRL #define RGBLIGHT_EFFECT_SNAKE |