diff options
Diffstat (limited to 'users/xulkal')
-rw-r--r-- | users/xulkal/config.h | 23 | ||||
-rw-r--r-- | users/xulkal/custom_encoder.c | 13 | ||||
-rw-r--r-- | users/xulkal/custom_encoder.h | 2 | ||||
-rw-r--r-- | users/xulkal/custom_keycodes.h | 28 | ||||
-rw-r--r-- | users/xulkal/custom_oled.c | 190 | ||||
-rw-r--r-- | users/xulkal/custom_oled.h | 2 | ||||
-rw-r--r-- | users/xulkal/custom_tap_dance.c | 62 | ||||
-rw-r--r-- | users/xulkal/custom_tap_dance.h | 26 | ||||
-rw-r--r-- | users/xulkal/layouts.h | 12 | ||||
-rw-r--r-- | users/xulkal/process_records.c | 117 | ||||
-rw-r--r-- | users/xulkal/process_records.h | 42 | ||||
-rw-r--r-- | users/xulkal/rules.mk | 8 | ||||
-rw-r--r-- | users/xulkal/timer_utils.c | 12 | ||||
-rw-r--r-- | users/xulkal/timer_utils.h | 6 | ||||
-rw-r--r-- | users/xulkal/xulkal.h | 3 |
15 files changed, 415 insertions, 131 deletions
diff --git a/users/xulkal/config.h b/users/xulkal/config.h index 2899017b03..c794530d45 100644 --- a/users/xulkal/config.h +++ b/users/xulkal/config.h @@ -1,27 +1,30 @@ #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 +#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 #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 #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 -#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 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..7280ef7019 --- /dev/null +++ b/users/xulkal/custom_oled.c @@ -0,0 +1,190 @@ +#include "custom_oled.h" +#include "process_records.h" + +#include <stdio.h> + +#ifdef OLED_DRIVER_ENABLE + +#ifdef RGBLIGHT_ENABLE +rgblight_config_t rgblight_config; +#endif + +static void render_logo(void) +{ + 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(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][4] = { + {0x97,0x98,0x0a,0}, + {0xb7,0xb8,0x0a,0} }; + + oled_write_P(mode_logo[0], false); + oled_write_P(mode_logo[1], false); + + 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)); + + // Host Keyboard LED Status + uint8_t led_usb_state = host_keyboard_leds(); + oled_write_P(led_usb_state & (1<<USB_LED_NUM_LOCK) ? PSTR("-----NUMLK") : PSTR("----- "), false); + oled_write_P(led_usb_state & (1<<USB_LED_CAPS_LOCK) ? PSTR("CAPLK") : PSTR(" "), false); + oled_write_P(led_usb_state & (1<<USB_LED_SCROLL_LOCK) ? PSTR("SCRLK") : PSTR(" "), false); + +#if defined(RGB_MATRIX_ENABLE) + 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.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); + oled_write_P(PSTR("-----"), false); + static char buffer[31] = {0}; + snprintf(buffer, sizeof(buffer), "h%3d s%3d v%3d s%3d m%3d\n", rgblight_config.hue, rgblight_config.sat, rgblight_config.val, rgblight_config.speed, rgblight_config.mode); + oled_write(buffer, false); +#endif +} + +oled_rotation_t oled_init_user(oled_rotation_t rotation) { + if (is_keyboard_master()) + return OLED_ROTATION_270; + return OLED_ROTATION_180; +} + +#else // OLED_90ROTATION + +static void render_layer(uint8_t layer) +{ + switch (layer) + { + case _QWERTY: + oled_write_P(PSTR("Default\n"), false); + break; +#ifndef GAMELAYER_DISABLE + case _GAME: + oled_write_P(PSTR("Game\n"), false); + break; +#endif + 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 + } +} + +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.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}; + snprintf(buffer, sizeof(buffer), " h%3d s%3d v%3d\n", rgblight_config.hue, rgblight_config.sat, rgblight_config.val); + oled_write(buffer, false); +#else + oled_write_P(PSTR("\n")); +#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); +#elif defined(RGBLIGHT_ENABLE) + snprintf(buffer, sizeof(buffer), " s%3d m%3d\n", rgblight_config.speed, rgblight_config.mode); + oled_write(buffer, false); +#else + oled_write_P(PSTR("\n")); +#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); + uint8_t layer = biton(layer_state); + if (layer != _QWERTY) + render_layer(layer); + else + render_layer(biton32(default_layer_state)); + + // Host Keyboard LED Status + uint8_t led_usb_state = host_keyboard_leds(); + oled_write_P(led_usb_state & (1<<USB_LED_NUM_LOCK) ? PSTR("NUMLCK ") : PSTR(" "), false); + oled_write_P(led_usb_state & (1<<USB_LED_CAPS_LOCK) ? PSTR("CAPLCK ") : PSTR(" "), false); + oled_write_P(led_usb_state & (1<<USB_LED_SCROLL_LOCK) ? PSTR("SCRLCK ") : PSTR(" "), false); +} + +#endif // OLED_90ROTATION + +void oled_task_user(void) +{ + if (is_keyboard_master()) + render_status(); + else + { + render_logo(); + oled_scroll_left(); + } +} + +#endif diff --git a/users/xulkal/custom_oled.h b/users/xulkal/custom_oled.h new file mode 100644 index 0000000000..010d4b1383 --- /dev/null +++ b/users/xulkal/custom_oled.h @@ -0,0 +1,2 @@ +#pragma once +#include "quantum.h" diff --git a/users/xulkal/custom_tap_dance.c b/users/xulkal/custom_tap_dance.c new file mode 100644 index 0000000000..7123f1be6b --- /dev/null +++ b/users/xulkal/custom_tap_dance.c @@ -0,0 +1,62 @@ +#include "custom_tap_dance.h" +#include "custom_keycodes.h" +#include "timer_utils.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)), + [DELETE] = ACTION_TAP_DANCE_DOUBLE (KC_DELETE, LCTL(KC_DELETE)), + [DOT] = ACTION_TAP_DANCE_DOUBLE (KC_DOT, KC_GRAVE) +}; + +#else + +static uint16_t td_keycode; +static uint16_t td_timer; + +const uint16_t PROGMEM td_keymaps[TD_MAX - TD_MIN][2] = { + [TD_COMM - TD_MIN] = { KC_COMM, KC_QUOT }, + [TD_BSPC - TD_MIN] = { KC_BSPACE, LCTL(KC_BSPACE) }, + [TD_DEL - TD_MIN] = { KC_DELETE, LCTL(KC_DELETE) }, + [TD_DOT - TD_MIN] = { KC_DOT, KC_GRAVE } +}; + +void run_tap_dance_double(uint8_t i) +{ + tap_code16(pgm_read_word(&td_keymaps[td_keycode - TD_MIN][i])); + td_keycode = KC_TRANSPARENT; + td_timer = timer_read() + TAPPING_TERM; +} + +bool process_tap_dance_double(uint16_t keycode, keyrecord_t *record) +{ + if (TD_MIN <= keycode && keycode < TD_MAX) + { + if (record->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 2cd309f76b..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 @@ -50,7 +50,7 @@ * |------+------+------+------+------+------| |------+------+------+------+------+------| * | | | | | | | | | | | | | | * |------+------+------+------+------+------| |------+------+------+------+------+------| - * | | | | | | | | | PREV | VOL- | VOL+ | NEXT | PLAY | + * | | | | | | | | | PREV | VOL+ | VOL- | NEXT | PLAY | * `-----------------------------------------' `-----------------------------------------' */ @@ -64,11 +64,11 @@ #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 * ,-----------------------------------------. ,-----------------------------------------. - * | | | | | | | | | | | | | | + * | |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.c b/users/xulkal/process_records.c index 531f99eb06..115623caa4 100644 --- a/users/xulkal/process_records.c +++ b/users/xulkal/process_records.c @@ -1,93 +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 -bool process_record_user(uint16_t keycode, keyrecord_t *record) { - 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) { - set_single_persistent_default_layer(_GAME); - } -#endif - return false; - break; - 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; - break; - case RAISE: - if (record->event.pressed) { - layer_on(_RAISE); -#ifdef TRILAYER_ENABLED - update_tri_layer(_LOWER, _RAISE, _ADJUST); +uint32_t layer_state_set_user(uint32_t state) +{ + return update_tri_layer_state(state, _LOWER, _RAISE, _ADJUST); +} #endif - } else { - layer_off(_RAISE); -#ifdef TRILAYER_ENABLED - update_tri_layer(_LOWER, _RAISE, _ADJUST); + +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 - } - return false; - break; - case RGBRST: + + 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(); - } -#endif - return false; - break; + if (record->event.pressed) + eeconfig_update_rgb_matrix_default(); +#endif + } + 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) && -#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; +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 9e42953809..701ef7e74f 100644 --- a/users/xulkal/process_records.h +++ b/users/xulkal/process_records.h @@ -1,49 +1,17 @@ #pragma once #include "quantum.h" - -#define RIS_ESC LT(_RAISE, KC_ESC) -#define RIS_CAPS LT(_RAISE, KC_CAPS) - -#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, +#ifndef GAMELAYER_DISABLE _GAME, +#endif _LOWER, _RAISE, +#ifdef TRILAYER_ENABLED _ADJUST -}; - -enum custom_keycodes { - QWERTY = SAFE_RANGE, - GAME, - LOWER, - RAISE, - RGBRST +#endif }; bool process_record_keymap(uint16_t keycode, keyrecord_t *record); -bool process_record_rgb(uint16_t keycode, keyrecord_t *record); diff --git a/users/xulkal/rules.mk b/users/xulkal/rules.mk index 6758f52f5f..ab0231d7dc 100644 --- a/users/xulkal/rules.mk +++ b/users/xulkal/rules.mk @@ -1,10 +1,14 @@ 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) +TAP_DANCE_ENABLE = yes 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 <stdbool.h> + +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" |