From 8d46bb9cabb9c8e81c7ca1266d97a0126cc80767 Mon Sep 17 00:00:00 2001 From: XScorpion2 Date: Sun, 12 May 2019 00:42:57 -0500 Subject: [Keyboard] Adding RGBKB Zygomorph Keyboard (#5841) * Initial Zygomorph 5x6 code Split is not working yet * layout changes implement 4 row config option (not done yet), remove layout comments in layout.c * Zygomorph layouts for 5x12, 5x6, 4x12, and 4x6 Also, info.json *should* be nearly usable for the configurator * temporary fix for pin D5 being broken * show D5 issue comment * add build notes * Pin B7 broken in split why? * remove fix * Fix some pin assignments * begin to fix keymap * Create new 5x6 layout * update key positions * Initial Zygomorph 5x6 code Split is not working yet * layout changes implement 4 row config option (not done yet), remove layout comments in layout.c * Zygomorph layouts for 5x12, 5x6, 4x12, and 4x6 Also, info.json *should* be nearly usable for the configurator * temporary fix for pin D5 being broken * show D5 issue comment * add build notes * Pin B7 broken in split why? * remove fix * Fix some pin assignments * begin to fix keymap * Create new 5x6 layout * Rough first pass at split common conversion. Keymap cleanup to cover just the basics. Broke OLED code out into separate example. * Fix readme * Removal of old encoder / oled driver, fix for layout macros * small update * xulkal zygomorph keymaps * Removed the LED_MIRRORED option as leds are always mirrored on Zygomorph * Xulkal keymaps update * split rgb light support * fix line endings * Apply suggestions from code review Co-Authored-By: zvecr * More layout and compile fixes from pr review * Cleaning up rules.mk files * Apply suggestions from code review Co-Authored-By: zvecr * Updating defaults * Apply suggestions from code review Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com> --- users/xulkal/layouts.h | 4 ++-- users/xulkal/process_records.h | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) (limited to 'users/xulkal') diff --git a/users/xulkal/layouts.h b/users/xulkal/layouts.h index 2cd309f76b..61637bfe3b 100644 --- a/users/xulkal/layouts.h +++ b/users/xulkal/layouts.h @@ -68,7 +68,7 @@ /* LOWER Layout * ,-----------------------------------------. ,-----------------------------------------. - * | | | | | | | | | | | | | | + * | |RGBMD |RGBRMD|RGBTOG| | | | | | | | | | * |------+------+------+------+------+------| |------+------+------+------+------+------| * | SPDI | SAI | VAI | HUI | RESET| | | | | 7 | 8 | 9 | | * |------+------+------+------+------+------| |------+------+------+------+------+------| @@ -80,7 +80,7 @@ * `-----------------------------------------' `-----------------------------------------' */ -#define __________________LOWER_L1_________________ _______, RGB_RMOD, RGB_MOD, _______, _______, _______ +#define __________________LOWER_L1_________________ _______, RGB_RMOD, RGB_MOD, RGB_TOG, _______, _______ #define __________________LOWER_L2_________________ RGB_SPI, RGB_SAI, RGB_VAI, RGB_HUI, RESET, _______ #define __________________LOWER_L3_________________ RGB_SPD, RGB_SAD, RGB_VAD, RGB_HUD, RGBRST, _______ #define __________________LOWER_L4_________________ _______, _______, _______, _______, _______, _______ diff --git a/users/xulkal/process_records.h b/users/xulkal/process_records.h index 9e42953809..d79ab7e32b 100644 --- a/users/xulkal/process_records.h +++ b/users/xulkal/process_records.h @@ -31,10 +31,14 @@ enum { enum layer_number { _QWERTY = 0, +#ifndef GAMELAYER_DISABLE _GAME, +#endif _LOWER, _RAISE, +#ifdef TRILAYER_ENABLED _ADJUST +#endif }; enum custom_keycodes { -- cgit v1.2.3 From 9b46fabe084cd3e15104f88ef5d1f87f215de3c6 Mon Sep 17 00:00:00 2001 From: XScorpion2 Date: Mon, 13 May 2019 09:58:15 -0500 Subject: Xulkal Keymap Changes (#5861) --- users/xulkal/config.h | 17 ++++++++++++++--- users/xulkal/layouts.h | 4 ++-- users/xulkal/process_records.c | 15 ++++++++++----- 3 files changed, 26 insertions(+), 10 deletions(-) (limited to 'users/xulkal') diff --git a/users/xulkal/config.h b/users/xulkal/config.h index 2899017b03..ecd01f7946 100644 --- a/users/xulkal/config.h +++ b/users/xulkal/config.h @@ -1,8 +1,6 @@ #pragma once -#ifndef TAPPING_FORCE_HOLD -#define TAPPING_FORCE_HOLD -#endif // TAPPING_FORCE_HOLD +#undef TAPPING_FORCE_HOLD #undef TAPPING_TERM #define TAPPING_TERM 175 @@ -12,6 +10,17 @@ #define LCPO_KEYS KC_LCTL, KC_TRNS, KC_MINS #define RCPC_KEYS KC_RCTL, KC_TRNS, KC_EQL +// Running out of firmware space +#if defined(__AVR__) +#undef RGB_MATRIX_KEYPRESSES +#undef RGB_MATRIX_KEYRELEASES +#undef RGB_MATRIX_FRAMEBUFFER_EFFECTS +#else +#define RGB_MATRIX_KEYPRESSES +#undef RGB_MATRIX_KEYRELEASES +#define RGB_MATRIX_FRAMEBUFFER_EFFECTS +#endif + // No need for the single versions when multi performance isn't a problem =D #define DISABLE_RGB_MATRIX_SOLID_REACTIVE_WIDE #define DISABLE_RGB_MATRIX_SOLID_REACTIVE_CROSS @@ -20,8 +29,10 @@ #define DISABLE_RGB_MATRIX_SOLID_SPLASH // Don't like or feel to identical to other effects +#if defined(__AVR__) #define DISABLE_RGB_MATRIX_RAINBOW_BEACON #define DISABLE_RGB_MATRIX_JELLYBEAN_RAINDROPS #define DISABLE_RGB_MATRIX_DIGITAL_RAIN #define DISABLE_RGB_MATRIX_SOLID_REACTIVE_SIMPLE #define DISABLE_RGB_MATRIX_SOLID_REACTIVE_MULTINEXUS +#endif diff --git a/users/xulkal/layouts.h b/users/xulkal/layouts.h index 61637bfe3b..5180992a88 100644 --- a/users/xulkal/layouts.h +++ b/users/xulkal/layouts.h @@ -50,7 +50,7 @@ * |------+------+------+------+------+------| |------+------+------+------+------+------| * | | | | | | | | | | | | | | * |------+------+------+------+------+------| |------+------+------+------+------+------| - * | | | | | | | | | PREV | VOL- | VOL+ | NEXT | PLAY | + * | | | | | | | | | PREV | VOL+ | VOL- | NEXT | PLAY | * `-----------------------------------------' `-----------------------------------------' */ @@ -64,7 +64,7 @@ #define __________________RAISE_R2_________________ _______, KC_INS, KC_HOME, KC_PGUP, KC_PSCR, _______ #define __________________RAISE_R3_________________ _______, KC_DEL, KC_END, KC_PGDN, KC_SLCK, _______ #define __________________RAISE_R4_________________ _______, _______, _______, _______, _______, _______ -#define __________________RAISE_R5_________________ _______, KC_MPRV, KC_MPRV, KC_VOLD, KC_MNXT, KC_MPLY +#define __________________RAISE_R5_________________ _______, KC_MPRV, KC_VOLU, KC_VOLD, KC_MNXT, KC_MPLY /* LOWER Layout * ,-----------------------------------------. ,-----------------------------------------. diff --git a/users/xulkal/process_records.c b/users/xulkal/process_records.c index 531f99eb06..7c2b5e133f 100644 --- a/users/xulkal/process_records.c +++ b/users/xulkal/process_records.c @@ -16,13 +16,13 @@ extern void eeconfig_update_rgb_matrix_default(void); #endif bool process_record_user(uint16_t keycode, keyrecord_t *record) { + static uint16_t reset_timer; switch (keycode) { case QWERTY: if (record->event.pressed) { set_single_persistent_default_layer(_QWERTY); } return false; - break; case GAME: #ifndef GAMELAYER_DISABLE if (record->event.pressed) { @@ -30,7 +30,6 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { } #endif return false; - break; case LOWER: if (record->event.pressed) { layer_on(_LOWER); @@ -44,7 +43,6 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { #endif } return false; - break; case RAISE: if (record->event.pressed) { layer_on(_RAISE); @@ -58,7 +56,6 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { #endif } return false; - break; case RGBRST: #if defined(RGBLIGHT_ENABLE) if (record->event.pressed) { @@ -71,7 +68,15 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { } #endif return false; - break; + case RESET: + if (record->event.pressed) { + reset_timer = timer_read(); + } else { + if (timer_elapsed(reset_timer) >= 500) { + reset_keyboard(); + } + } + return false; } return process_record_keymap(keycode, record) && -- cgit v1.2.3 From a0d6c5a1136e2c56aa4a57eac08355c2b5d79ad5 Mon Sep 17 00:00:00 2001 From: XScorpion2 Date: Sun, 19 May 2019 11:15:50 -0500 Subject: [Keymap] Update Xulkal user code (#5920) --- users/xulkal/config.h | 10 +------- users/xulkal/process_records.c | 56 ++++++------------------------------------ users/xulkal/process_records.h | 18 +++++++++----- 3 files changed, 20 insertions(+), 64 deletions(-) (limited to 'users/xulkal') diff --git a/users/xulkal/config.h b/users/xulkal/config.h index ecd01f7946..c794530d45 100644 --- a/users/xulkal/config.h +++ b/users/xulkal/config.h @@ -5,6 +5,7 @@ #undef TAPPING_TERM #define TAPPING_TERM 175 +#define SPACE_CADET_MODIFIER_CARRYOVER #define LSPO_KEYS KC_LSFT, KC_TRNS, KC_LBRC #define RSPC_KEYS KC_RSFT, KC_TRNS, KC_RBRC #define LCPO_KEYS KC_LCTL, KC_TRNS, KC_MINS @@ -27,12 +28,3 @@ #define DISABLE_RGB_MATRIX_SOLID_REACTIVE_NEXUS #define DISABLE_RGB_MATRIX_SPLASH #define DISABLE_RGB_MATRIX_SOLID_SPLASH - -// Don't like or feel to identical to other effects -#if defined(__AVR__) -#define DISABLE_RGB_MATRIX_RAINBOW_BEACON -#define DISABLE_RGB_MATRIX_JELLYBEAN_RAINDROPS -#define DISABLE_RGB_MATRIX_DIGITAL_RAIN -#define DISABLE_RGB_MATRIX_SOLID_REACTIVE_SIMPLE -#define DISABLE_RGB_MATRIX_SOLID_REACTIVE_MULTINEXUS -#endif diff --git a/users/xulkal/process_records.c b/users/xulkal/process_records.c index 7c2b5e133f..5ba59965fb 100644 --- a/users/xulkal/process_records.c +++ b/users/xulkal/process_records.c @@ -15,47 +15,15 @@ qk_tap_dance_action_t tap_dance_actions[] = { extern void eeconfig_update_rgb_matrix_default(void); #endif +#ifdef TRILAYER_ENABLED +uint32_t layer_state_set_user(uint32_t state) { + return update_tri_layer_state(state, _LOWER, _RAISE, _ADJUST); +} +#endif + bool process_record_user(uint16_t keycode, keyrecord_t *record) { static uint16_t reset_timer; switch (keycode) { - case QWERTY: - if (record->event.pressed) { - set_single_persistent_default_layer(_QWERTY); - } - return false; - case GAME: -#ifndef GAMELAYER_DISABLE - if (record->event.pressed) { - set_single_persistent_default_layer(_GAME); - } -#endif - return false; - case LOWER: - if (record->event.pressed) { - layer_on(_LOWER); -#ifdef TRILAYER_ENABLED - update_tri_layer(_LOWER, _RAISE, _ADJUST); -#endif - } else { - layer_off(_LOWER); -#ifdef TRILAYER_ENABLED - update_tri_layer(_LOWER, _RAISE, _ADJUST); -#endif - } - return false; - case RAISE: - if (record->event.pressed) { - layer_on(_RAISE); -#ifdef TRILAYER_ENABLED - update_tri_layer(_LOWER, _RAISE, _ADJUST); -#endif - } else { - layer_off(_RAISE); -#ifdef TRILAYER_ENABLED - update_tri_layer(_LOWER, _RAISE, _ADJUST); -#endif - } - return false; case RGBRST: #if defined(RGBLIGHT_ENABLE) if (record->event.pressed) { @@ -79,20 +47,10 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { return false; } - return process_record_keymap(keycode, record) && -#if defined(RGBLIGHT_ENABLE) || defined(RGB_MATRIX_ENABLE) - process_record_rgb(keycode, record) && -#endif // RGBLIGHT_ENABLE; - true; + return process_record_keymap(keycode, record); } __attribute__ ((weak)) bool process_record_keymap(uint16_t keycode, keyrecord_t *record) { return true; } - - -__attribute__ ((weak)) -bool process_record_rgb(uint16_t keycode, keyrecord_t *record) { - return true; -} diff --git a/users/xulkal/process_records.h b/users/xulkal/process_records.h index d79ab7e32b..8a195df5cd 100644 --- a/users/xulkal/process_records.h +++ b/users/xulkal/process_records.h @@ -4,6 +4,17 @@ #define RIS_ESC LT(_RAISE, KC_ESC) #define RIS_CAPS LT(_RAISE, KC_CAPS) +#define QWERTY DF(_QWERTY) + +#ifndef GAMELAYER_DISABLE +#define GAME DF(_GAME) +#else +#define GAME KC_TRANSPARENT +#endif + +#define LOWER MO(_LOWER) +#define RAISE MO(_RAISE) + #ifdef TAP_DANCE_ENABLE #include "process_tap_dance.h" @@ -42,12 +53,7 @@ enum layer_number { }; enum custom_keycodes { - QWERTY = SAFE_RANGE, - GAME, - LOWER, - RAISE, - RGBRST + RGBRST = SAFE_RANGE }; bool process_record_keymap(uint16_t keycode, keyrecord_t *record); -bool process_record_rgb(uint16_t keycode, keyrecord_t *record); -- cgit v1.2.3 From 4f788c2ae90583f64e0cec6545a3da75a5aff0f8 Mon Sep 17 00:00:00 2001 From: XScorpion2 Date: Sat, 1 Jun 2019 16:39:31 -0500 Subject: [Keymap] Xulkal user changes (#6044) * Xulkal user changes Xulkal user changes * Reduce code duplication * Massive user code refactor --- users/xulkal/custom_encoder.c | 13 ++++++ users/xulkal/custom_encoder.h | 2 + users/xulkal/custom_keycodes.h | 28 ++++++++++++ users/xulkal/custom_oled.c | 96 +++++++++++++++++++++++++++++++++++++++++ users/xulkal/custom_oled.h | 2 + users/xulkal/custom_tap_dance.c | 61 ++++++++++++++++++++++++++ users/xulkal/custom_tap_dance.h | 26 +++++++++++ users/xulkal/layouts.h | 4 +- users/xulkal/process_records.c | 74 +++++++++++++++---------------- users/xulkal/process_records.h | 44 +------------------ users/xulkal/rules.mk | 7 ++- users/xulkal/timer_utils.c | 12 ++++++ users/xulkal/timer_utils.h | 6 +++ users/xulkal/xulkal.h | 3 ++ 14 files changed, 295 insertions(+), 83 deletions(-) create mode 100644 users/xulkal/custom_encoder.c create mode 100644 users/xulkal/custom_encoder.h create mode 100644 users/xulkal/custom_keycodes.h create mode 100644 users/xulkal/custom_oled.c create mode 100644 users/xulkal/custom_oled.h create mode 100644 users/xulkal/custom_tap_dance.c create mode 100644 users/xulkal/custom_tap_dance.h create mode 100644 users/xulkal/timer_utils.c create mode 100644 users/xulkal/timer_utils.h (limited to 'users/xulkal') diff --git a/users/xulkal/custom_encoder.c b/users/xulkal/custom_encoder.c new file mode 100644 index 0000000000..09f1cda0d1 --- /dev/null +++ b/users/xulkal/custom_encoder.c @@ -0,0 +1,13 @@ +#include "custom_encoder.h" + +#ifdef ENCODER_ENABLE +const uint16_t PROGMEM encoders[][2] = { + { KC_PGUP, KC_PGDN }, + { KC_DOWN, KC_UP } +} + +void encoder_update_user(uint8_t index, bool clockwise) +{ + tap_code16(pgm_read_word(&encoders[index][clockwise])); +} +#endif diff --git a/users/xulkal/custom_encoder.h b/users/xulkal/custom_encoder.h new file mode 100644 index 0000000000..010d4b1383 --- /dev/null +++ b/users/xulkal/custom_encoder.h @@ -0,0 +1,2 @@ +#pragma once +#include "quantum.h" diff --git a/users/xulkal/custom_keycodes.h b/users/xulkal/custom_keycodes.h new file mode 100644 index 0000000000..d4ae0bd477 --- /dev/null +++ b/users/xulkal/custom_keycodes.h @@ -0,0 +1,28 @@ +#pragma once + +enum custom_keycodes { + RGBRST = SAFE_RANGE, +#ifndef TAP_DANCE_ENABLE + TD_MIN, + TD_COMM = TD_MIN, + TD_BSPC, + TD_DEL, + TD_DOT, + TD_MAX, +#endif + KEYMAP_SAFE_RANGE +}; + +#define RIS_ESC LT(_RAISE, KC_ESC) +#define RIS_CAPS LT(_RAISE, KC_CAPS) + +#define QWERTY DF(_QWERTY) + +#ifndef GAMELAYER_DISABLE +#define GAME DF(_GAME) +#else +#define GAME KC_TRANSPARENT +#endif + +#define LOWER MO(_LOWER) +#define RAISE MO(_RAISE) diff --git a/users/xulkal/custom_oled.c b/users/xulkal/custom_oled.c new file mode 100644 index 0000000000..77e580b956 --- /dev/null +++ b/users/xulkal/custom_oled.c @@ -0,0 +1,96 @@ +#include "custom_oled.h" +#include "process_records.h" + +#include + +#ifdef OLED_DRIVER_ENABLE + +static void render_logo(void) +{ + static const char PROGMEM sol_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(sol_logo, false); +} + +static void render_status(void) +{ + // Render to mode icon + static const char PROGMEM mode_logo[2][3] = { + {0x97,0x98,0}, + {0xb7,0xb8,0} + }; + + oled_write_P(mode_logo[0], false); + +#if defined(RGB_MATRIX_ENABLE) + static char buffer[20] = {0}; + snprintf(buffer, sizeof(buffer), " h%3d s%3d v%3d\n", rgb_matrix_config.hue, rgb_matrix_config.sat, rgb_matrix_config.val); + oled_write(buffer, false); +#endif + + oled_write_P(mode_logo[1], false); + +#if defined(RGB_MATRIX_ENABLE) + snprintf(buffer, sizeof(buffer), " s%3d m%3d\n", rgb_matrix_config.speed, rgb_matrix_config.mode); + oled_write(buffer, false); +#endif + + // Define layers here, Have not worked out how to have text displayed for each layer. Copy down the number you see and add a case for it below + oled_write_P(PSTR("Layer: "), false); + switch (biton32(layer_state)) + { + case _QWERTY: +#ifndef GAMELAYER_DISABLE + switch (biton32(default_layer_state)) + { + case _QWERTY: + oled_write_P(PSTR("Default\n"), false); + break; + case _GAME: + oled_write_P(PSTR("Game\n"), false); + break; + default: + oled_write_P(PSTR("Undefined\n"), false); + break; + } +#else + oled_write_P(PSTR("Default\n"), false); +#endif + break; + case _LOWER: + oled_write_P(PSTR("Lower\n"), false); + break; + case _RAISE: + oled_write_P(PSTR("Raise\n"), false); + break; +#ifdef TRILAYER_ENABLED + case _ADJUST: + oled_write_P(PSTR("Adjust\n"), false); + break; +#endif + default: + oled_write_P(PSTR("Undefined\n"), false); + break; + } + + // Host Keyboard LED Status + uint8_t led_usb_state = host_keyboard_leds(); + oled_write_P(led_usb_state & (1<event.pressed) + { + if (td_keycode != keycode || timer_expired(td_timer)) + { + td_keycode = keycode; + td_timer = timer_read() + TAPPING_TERM; + } + else + run_tap_dance_double(1); + } + return false; + } + + if (td_keycode != KC_TRANSPARENT) + run_tap_dance_double(0); + return true; +} + +void matrix_scan_user(void) +{ + if (td_keycode != KC_TRANSPARENT && timer_expired(td_timer)) + run_tap_dance_double(0); +} + +#endif diff --git a/users/xulkal/custom_tap_dance.h b/users/xulkal/custom_tap_dance.h new file mode 100644 index 0000000000..33398808d3 --- /dev/null +++ b/users/xulkal/custom_tap_dance.h @@ -0,0 +1,26 @@ +#pragma once +#include "quantum.h" + +#ifdef TAP_DANCE_ENABLE + +#include "process_tap_dance.h" + +//Tap Dance Declarations +enum { + COMM_QUOT = 0, + BACKSPACE, + DELETE, + DOT +}; + +#define TD_COMM TD(COMM_QUOT) +#define TD_BSPC TD(BACKSPACE) +#define TD_DEL TD(DELETE) +#define TD_DOT TD(DOT) + +#else + +void run_tap_dance_double(uint8_t i); +bool process_tap_dance_double(uint16_t keycode, keyrecord_t *record); + +#endif diff --git a/users/xulkal/layouts.h b/users/xulkal/layouts.h index 5180992a88..65dad8c63c 100644 --- a/users/xulkal/layouts.h +++ b/users/xulkal/layouts.h @@ -15,7 +15,7 @@ */ #define _________________QWERTY_L1_________________ KC_GESC, KC_1, KC_2, KC_3, KC_4, KC_5 -#define _________________QWERTY_L2_________________ TD_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T +#define _________________QWERTY_L2_________________ KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T #define _________________QWERTY_L3_________________ RIS_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G #define _________________QWERTY_L4_________________ KC_LSPO, KC_Z, KC_X, KC_C, KC_V, KC_B #define _________________QWERTY_L5_________________ KC_LCPO, KC_LGUI, LOWER, RAISE, KC_LALT, KC_SPC @@ -23,7 +23,7 @@ #define _________________QWERTY_R1_________________ KC_6, KC_7, KC_8, KC_9, KC_0, TD_BSPC #define _________________QWERTY_R2_________________ KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSLS #define _________________QWERTY_R3_________________ KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_ENT -#define _________________QWERTY_R4_________________ KC_N, KC_M, TD_COMM, KC_DOT, KC_SLASH, KC_RSPC +#define _________________QWERTY_R4_________________ KC_N, KC_M, TD_COMM, TD_DOT, KC_SLASH, KC_RSPC #define _________________QWERTY_R5_________________ KC_SPC, KC_LEFT, KC_UP, KC_DOWN, KC_RIGHT, KC_RCPC diff --git a/users/xulkal/process_records.c b/users/xulkal/process_records.c index 5ba59965fb..115623caa4 100644 --- a/users/xulkal/process_records.c +++ b/users/xulkal/process_records.c @@ -1,56 +1,58 @@ #include "process_records.h" - -#ifdef TAP_DANCE_ENABLE -//Tap Dance Definitions -qk_tap_dance_action_t tap_dance_actions[] = { - [COMM_QUOT] = ACTION_TAP_DANCE_DOUBLE(KC_COMM, KC_QUOT), - [BACKSPACE] = ACTION_TAP_DANCE_DOUBLE (KC_BSPACE, LCTL(KC_BSPACE)), - [TAP_TAB] = ACTION_TAP_DANCE_DOUBLE (KC_TAB, LSFT(KC_TAB)), - [CTRL_MINUS] = ACTION_TAP_DANCE_DOUBLE (KC_LCTL, KC_MINS), - [CTRL_PLUS] = ACTION_TAP_DANCE_DOUBLE (KC_RCTL, KC_EQL) -}; -#endif +#include "custom_keycodes.h" +#include "timer_utils.h" #if defined(RGB_MATRIX_ENABLE) extern void eeconfig_update_rgb_matrix_default(void); #endif #ifdef TRILAYER_ENABLED -uint32_t layer_state_set_user(uint32_t state) { - return update_tri_layer_state(state, _LOWER, _RAISE, _ADJUST); +uint32_t layer_state_set_user(uint32_t state) +{ + return update_tri_layer_state(state, _LOWER, _RAISE, _ADJUST); } #endif -bool process_record_user(uint16_t keycode, keyrecord_t *record) { - static uint16_t reset_timer; - switch (keycode) { - case RGBRST: +bool process_record_user(uint16_t keycode, keyrecord_t *record) +{ + static uint16_t reset_timer; + +#ifndef TAP_DANCE_ENABLE + if (!process_tap_dance_double(keycode, record)) + return false; +#endif + + switch (keycode) + { + case RGBRST: + { #if defined(RGBLIGHT_ENABLE) - if (record->event.pressed) { - eeconfig_update_rgblight_default(); - rgblight_enable(); - } + if (record->event.pressed) + { + eeconfig_update_rgblight_default(); + rgblight_enable(); + } #elif defined(RGB_MATRIX_ENABLE) - if (record->event.pressed) { - eeconfig_update_rgb_matrix_default(); - } + if (record->event.pressed) + eeconfig_update_rgb_matrix_default(); #endif - return false; - case RESET: - if (record->event.pressed) { - reset_timer = timer_read(); - } else { - if (timer_elapsed(reset_timer) >= 500) { - reset_keyboard(); - } - } - return false; + } + return false; + case RESET: + { + if (record->event.pressed) + reset_timer = timer_read() + 500; + else if (timer_expired(reset_timer)) + reset_keyboard(); + } + return false; } return process_record_keymap(keycode, record); } __attribute__ ((weak)) -bool process_record_keymap(uint16_t keycode, keyrecord_t *record) { - return true; +bool process_record_keymap(uint16_t keycode, keyrecord_t *record) +{ + return true; } diff --git a/users/xulkal/process_records.h b/users/xulkal/process_records.h index 8a195df5cd..701ef7e74f 100644 --- a/users/xulkal/process_records.h +++ b/users/xulkal/process_records.h @@ -1,44 +1,6 @@ #pragma once #include "quantum.h" - -#define RIS_ESC LT(_RAISE, KC_ESC) -#define RIS_CAPS LT(_RAISE, KC_CAPS) - -#define QWERTY DF(_QWERTY) - -#ifndef GAMELAYER_DISABLE -#define GAME DF(_GAME) -#else -#define GAME KC_TRANSPARENT -#endif - -#define LOWER MO(_LOWER) -#define RAISE MO(_RAISE) - -#ifdef TAP_DANCE_ENABLE -#include "process_tap_dance.h" - -//Tap Dance Declarations -enum { - COMM_QUOT = 0, - BACKSPACE, - TAP_TAB, - CTRL_MINUS, - CTRL_PLUS -}; - -#define TD_COMM TD(COMM_QUOT) -#define TD_BSPC TD(BACKSPACE) -#define TD_TAB TD(TAP_TAB) -#define TD_LCTL TD(CTRL_MINUS) -#define TD_RCTL TD(CTRL_PLUS) -#else -#define TD_COMM KC_COMM -#define TD_BSPC KC_BSPACE -#define TD_TAB KC_TAB -#define TD_LCTL KC_LCTL -#define TD_RCTL KC_RCTL -#endif +#include "custom_tap_dance.h" enum layer_number { _QWERTY = 0, @@ -52,8 +14,4 @@ enum layer_number { #endif }; -enum custom_keycodes { - RGBRST = SAFE_RANGE -}; - bool process_record_keymap(uint16_t keycode, keyrecord_t *record); diff --git a/users/xulkal/rules.mk b/users/xulkal/rules.mk index 6758f52f5f..50dc75d615 100644 --- a/users/xulkal/rules.mk +++ b/users/xulkal/rules.mk @@ -1,10 +1,13 @@ SRC += xulkal.c \ - process_records.c + process_records.c \ + custom_tap_dance.c \ + custom_encoder.c \ + custom_oled.c \ + timer_utils.c # Some usual defaults MOUSEKEY_ENABLE = no # Mouse keys (+4700) EXTRAKEY_ENABLE = yes # Audio control and System control (+450) -TAP_DANCE_ENABLE = yes # Enable the tap dance feature. (+1100) ifneq ($(strip $(DISABLE_LTO)), yes) EXTRAFLAGS += -flto diff --git a/users/xulkal/timer_utils.c b/users/xulkal/timer_utils.c new file mode 100644 index 0000000000..5f5d9a1ebf --- /dev/null +++ b/users/xulkal/timer_utils.c @@ -0,0 +1,12 @@ +#include "timer_utils.h" + +bool timer_expired(uint16_t last) +{ + return timer_read() - last < 0x8000; +} + +bool timer_expired32(uint32_t last) +{ + return timer_read32() - last < 0x80000000; +} + diff --git a/users/xulkal/timer_utils.h b/users/xulkal/timer_utils.h new file mode 100644 index 0000000000..7e2a0b74db --- /dev/null +++ b/users/xulkal/timer_utils.h @@ -0,0 +1,6 @@ +#pragma once +#include "timer.h" +#include + +bool timer_expired(uint16_t last); +bool timer_expired32(uint32_t last); diff --git a/users/xulkal/xulkal.h b/users/xulkal/xulkal.h index ae73599239..9bc83b7de7 100644 --- a/users/xulkal/xulkal.h +++ b/users/xulkal/xulkal.h @@ -2,3 +2,6 @@ #include "process_records.h" #include "layouts.h" +#include "timer_utils.h" +#include "custom_keycodes.h" +#include "custom_tap_dance.h" -- cgit v1.2.3 From de968eb310b82dbba7c69971ad0d1280aaac7b27 Mon Sep 17 00:00:00 2001 From: XScorpion2 Date: Wed, 5 Jun 2019 18:14:35 -0500 Subject: [Keymap] Xulkal changes (#6075) --- users/xulkal/custom_oled.c | 166 +++++++++++++++++++++++++++++++--------- users/xulkal/custom_tap_dance.c | 3 +- users/xulkal/rules.mk | 1 + 3 files changed, 133 insertions(+), 37 deletions(-) (limited to 'users/xulkal') diff --git a/users/xulkal/custom_oled.c b/users/xulkal/custom_oled.c index 77e580b956..d871e96f06 100644 --- a/users/xulkal/custom_oled.c +++ b/users/xulkal/custom_oled.c @@ -5,60 +5,112 @@ #ifdef OLED_DRIVER_ENABLE +#ifdef RGBLIGHT_ENABLE +rgblight_config_t rgblight_config; +#endif + static void render_logo(void) { - static const char PROGMEM sol_logo[] = { + static const char PROGMEM font_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(sol_logo, false); + oled_write_P(font_logo, false); +} + +#if defined(OLED_90ROTATION) + +// TODO: Need to define this function / extern only for helix based split common keyboards +extern uint8_t is_master; +bool is_keyboard_master(void) +{ + return is_master; +} + +static void render_layer(uint8_t layer) +{ + switch (layer) + { + case _QWERTY: + oled_write_P(PSTR("DFLT "), false); + break; +#ifndef GAMELAYER_DISABLE + case _GAME: + oled_write_P(PSTR("GAME "), false); + break; +#endif + case _LOWER: + oled_write_P(PSTR("LOWER"), false); + break; + case _RAISE: + oled_write_P(PSTR("RAISE"), false); + break; +#ifdef TRILAYER_ENABLED + case _ADJUST: + oled_write_P(PSTR("ADJST"), false); + break; +#endif + } } static void render_status(void) { // Render to mode icon - static const char PROGMEM mode_logo[2][3] = { - {0x97,0x98,0}, - {0xb7,0xb8,0} - }; + static const char PROGMEM mode_logo[2][4] = { + {0x97,0x98,0x0a,0}, + {0xb7,0xb8,0x0a,0} }; oled_write_P(mode_logo[0], false); + oled_write_P(mode_logo[1], false); -#if defined(RGB_MATRIX_ENABLE) - static char buffer[20] = {0}; - snprintf(buffer, sizeof(buffer), " h%3d s%3d v%3d\n", rgb_matrix_config.hue, rgb_matrix_config.sat, rgb_matrix_config.val); - oled_write(buffer, false); -#endif + oled_write_P(PSTR("Layer"), false); + uint8_t layer = biton(layer_state); + if (layer != _QWERTY) + render_layer(layer); + else + render_layer(biton32(default_layer_state)); - oled_write_P(mode_logo[1], false); + // Host Keyboard LED Status + uint8_t led_usb_state = host_keyboard_leds(); + oled_write_P(led_usb_state & (1< Date: Sun, 19 May 2019 23:12:29 -0500 Subject: Switching rgb_config_t to use HSV struct --- users/xulkal/custom_oled.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'users/xulkal') diff --git a/users/xulkal/custom_oled.c b/users/xulkal/custom_oled.c index d871e96f06..7280ef7019 100644 --- a/users/xulkal/custom_oled.c +++ b/users/xulkal/custom_oled.c @@ -80,7 +80,7 @@ static void render_status(void) oled_set_cursor(0, oled_max_lines() - 7); oled_write_P(PSTR("-----"), false); static char buffer[26] = {0}; - snprintf(buffer, sizeof(buffer), "h%3d s%3d v%3d s%3d m%3d\n", rgb_matrix_config.hue, rgb_matrix_config.sat, rgb_matrix_config.val, rgb_matrix_config.speed, rgb_matrix_config.mode); + snprintf(buffer, sizeof(buffer), "h%3d s%3d v%3d s%3d m%3d\n", rgb_matrix_config.hsv.h, rgb_matrix_config.hsv.s, rgb_matrix_config.hsv.v, rgb_matrix_config.speed, rgb_matrix_config.mode); oled_write(buffer, false); #elif defined(RGBLIGHT_ENABLE) oled_set_cursor(0, oled_max_lines() - 7); @@ -137,7 +137,7 @@ static void render_status(void) #if defined(RGB_MATRIX_ENABLE) static char buffer[20] = {0}; - snprintf(buffer, sizeof(buffer), " h%3d s%3d v%3d\n", rgb_matrix_config.hue, rgb_matrix_config.sat, rgb_matrix_config.val); + snprintf(buffer, sizeof(buffer), " h%3d s%3d v%3d\n", rgb_matrix_config.hsv.h, rgb_matrix_config.hsv.s, rgb_matrix_config.hsv.v); oled_write(buffer, false); #elif defined(RGBLIGHT_ENABLE) static char buffer[20] = {0}; -- cgit v1.2.3