More glyph transformations for spidey3 userspace (#17854)
* add bold and blackboard bold glyph transformations * trim firmware size; cformat * fix typo in macro * trim firmware size a bit more
This commit is contained in:
parent
3d53c64992
commit
f02e355380
6 changed files with 131 additions and 102 deletions
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
#define NO_ACTION_MACRO
|
#define NO_ACTION_MACRO
|
||||||
#define NO_ACTION_FUNCTION
|
#define NO_ACTION_FUNCTION
|
||||||
|
#define NO_ACTION_ONESHOT
|
||||||
#undef LOCKING_SUPPORT_ENABLE
|
#undef LOCKING_SUPPORT_ENABLE
|
||||||
|
|
||||||
#define LAYER_STATE_8BIT
|
#define LAYER_STATE_8BIT
|
||||||
|
|
|
@ -23,7 +23,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||||
),
|
),
|
||||||
// FN
|
// FN
|
||||||
[_FN] = LAYOUT_75_ansi(
|
[_FN] = LAYOUT_75_ansi(
|
||||||
RESET, SPI_NORMAL, SPI_WIDE, SPI_SCRIPT, SPI_BLOCKS, SPI_CIRCLE, SPI_SQUARE, SPI_PARENS, SPI_FRAKTR, XXXXXXX, XXXXXXX, XXXXXXX, SPI_GFLOCK, KC_SLEP, CH_SUSP, KC_PWR,
|
RESET, SPI_NORMAL, SPI_WIDE, SPI_SCRIPT, SPI_BLOCKS, SPI_CIRCLE, SPI_SQUARE, SPI_PARENS, SPI_FRAKTR, SPI_BOLD, SPI_MATH, XXXXXXX, SPI_GFLOCK, KC_SLEP, CH_SUSP, KC_PWR,
|
||||||
EEP_RST, X(SAD), X(MEH), X(HAPPY), X(ANGRY), X(THUMBDN), X(THUMBUP), X(SPIDER), X_BUL, X(LOL), X(SURPRISE),X_DASH, XXXXXXX, KC_PAUS, KC_SLCK,
|
EEP_RST, X(SAD), X(MEH), X(HAPPY), X(ANGRY), X(THUMBDN), X(THUMBUP), X(SPIDER), X_BUL, X(LOL), X(SURPRISE),X_DASH, XXXXXXX, KC_PAUS, KC_SLCK,
|
||||||
XXXXXXX, RGB_TOG, RGB_MOD, RGB_HUD, RGB_HUI, RGB_SAD, RGB_SAI, RGB_VAD, RGB_VAI, RGB_SPD, RGB_SPI, VLK_TOG, XXXXXXX, XXXXXXX, KC_BRIU,
|
XXXXXXX, RGB_TOG, RGB_MOD, RGB_HUD, RGB_HUI, RGB_SAD, RGB_SAI, RGB_VAD, RGB_VAI, RGB_SPD, RGB_SPI, VLK_TOG, XXXXXXX, XXXXXXX, KC_BRIU,
|
||||||
XXXXXXX, RGB_M_P, RGB_M_B, RGB_M_R, RGB_M_SW, RGB_M_SN, RGB_M_K, RGB_M_G, RGB_M_T, SPI_LNX, XXXXXXX, XXXXXXX, XXXXXXX, KC_BRID,
|
XXXXXXX, RGB_M_P, RGB_M_B, RGB_M_R, RGB_M_SW, RGB_M_SN, RGB_M_K, RGB_M_G, RGB_M_T, SPI_LNX, XXXXXXX, XXXXXXX, XXXXXXX, KC_BRID,
|
||||||
|
|
|
@ -7,7 +7,6 @@ void keyboard_post_init_user(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void eeconfig_init_user(void) {
|
void eeconfig_init_user(void) {
|
||||||
print("eeconfig_init_user\n");
|
|
||||||
set_single_persistent_default_layer(_BASE);
|
set_single_persistent_default_layer(_BASE);
|
||||||
#ifdef UNICODEMAP_ENABLE
|
#ifdef UNICODEMAP_ENABLE
|
||||||
eeconfig_init_user_unicode();
|
eeconfig_init_user_unicode();
|
||||||
|
|
|
@ -101,7 +101,6 @@ const rgblight_segment_t *const PROGMEM _rgb_layers[] = {
|
||||||
const uint8_t PROGMEM _n_rgb_layers = sizeof(_rgb_layers) / sizeof(_rgb_layers[0]) - 1;
|
const uint8_t PROGMEM _n_rgb_layers = sizeof(_rgb_layers) / sizeof(_rgb_layers[0]) - 1;
|
||||||
|
|
||||||
void clear_rgb_layers() {
|
void clear_rgb_layers() {
|
||||||
dprint("clear_rgb_layers()\n");
|
|
||||||
for (uint8_t i = 0; i < _n_rgb_layers; i++) {
|
for (uint8_t i = 0; i < _n_rgb_layers; i++) {
|
||||||
rgblight_set_layer_state(i, false);
|
rgblight_set_layer_state(i, false);
|
||||||
}
|
}
|
||||||
|
@ -110,7 +109,6 @@ void clear_rgb_layers() {
|
||||||
void do_rgb_layers(layer_state_t state, uint8_t start, uint8_t end) {
|
void do_rgb_layers(layer_state_t state, uint8_t start, uint8_t end) {
|
||||||
for (uint8_t i = start; i < end; i++) {
|
for (uint8_t i = start; i < end; i++) {
|
||||||
bool is_on = layer_state_cmp(state, i);
|
bool is_on = layer_state_cmp(state, i);
|
||||||
dprintf("layer[%u]=rl[%u]=%u\n", i, LAYER_OFFSET + i, is_on);
|
|
||||||
rgblight_set_layer_state(LAYER_OFFSET + i, is_on);
|
rgblight_set_layer_state(LAYER_OFFSET + i, is_on);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -119,7 +117,6 @@ void do_rgb_unicode(void) {
|
||||||
uint8_t uc_mode = get_unicode_input_mode();
|
uint8_t uc_mode = get_unicode_input_mode();
|
||||||
for (uint8_t i = 0; i < UC__COUNT; i++) {
|
for (uint8_t i = 0; i < UC__COUNT; i++) {
|
||||||
bool is_on = i == uc_mode;
|
bool is_on = i == uc_mode;
|
||||||
dprintf("unicode[%u]=rl[%u]=%u\n", i, UNICODE_OFFSET + i, is_on);
|
|
||||||
rgblight_set_layer_state(UNICODE_OFFSET + i, is_on);
|
rgblight_set_layer_state(UNICODE_OFFSET + i, is_on);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -146,14 +143,15 @@ extern rgblight_status_t rgblight_status;
|
||||||
|
|
||||||
#if defined(RGBLIGHT_STARTUP_ANIMATION)
|
#if defined(RGBLIGHT_STARTUP_ANIMATION)
|
||||||
|
|
||||||
#define STARTUP_ANIMATION_SATURATION 200
|
# define STARTUP_ANIMATION_SATURATION 200
|
||||||
#define STARTUP_ANIMATION_VALUE 255
|
# define STARTUP_ANIMATION_VALUE 255
|
||||||
#define STARTUP_ANIMATION_FADE_STEP 5
|
# define STARTUP_ANIMATION_FADE_STEP 5
|
||||||
#define STARTUP_ANIMATION_CYCLE_STEP 2
|
# define STARTUP_ANIMATION_CYCLE_STEP 2
|
||||||
#define STARTUP_ANIMATION_RAMP_TO_STEPS 70
|
# define STARTUP_ANIMATION_RAMP_TO_STEPS 70
|
||||||
#define STARTUP_ANIMATION_STEP_TIME 10
|
# define STARTUP_ANIMATION_STEP_TIME 10
|
||||||
#define STARTUP_ANIMATION_INITIAL_DELAY 0 // milliseconds, must be < 255 * STEP_TIME
|
# define STARTUP_ANIMATION_INITIAL_DELAY 0 // milliseconds, must be < 255 * STEP_TIME
|
||||||
|
|
||||||
|
// clang-format off
|
||||||
typedef enum {
|
typedef enum {
|
||||||
DISABLED,
|
DISABLED,
|
||||||
WAITING,
|
WAITING,
|
||||||
|
@ -167,6 +165,7 @@ typedef enum {
|
||||||
CLEAN_UP,
|
CLEAN_UP,
|
||||||
DONE
|
DONE
|
||||||
} startup_animation_state_t;
|
} startup_animation_state_t;
|
||||||
|
// clang-format on
|
||||||
|
|
||||||
static rgblight_config_t old_config;
|
static rgblight_config_t old_config;
|
||||||
static uint8_t old_base_mode;
|
static uint8_t old_base_mode;
|
||||||
|
@ -177,8 +176,7 @@ void startup_animation_init(void) {
|
||||||
old_config.raw = rgblight_config.raw;
|
old_config.raw = rgblight_config.raw;
|
||||||
old_base_mode = rgblight_status.base_mode;
|
old_base_mode = rgblight_status.base_mode;
|
||||||
|
|
||||||
if (!old_config.enable)
|
if (!old_config.enable) rgblight_enable_noeeprom();
|
||||||
rgblight_enable_noeeprom();
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -202,9 +200,9 @@ void matrix_scan_user_rgb(void) {
|
||||||
|
|
||||||
switch (startup_animation_state) {
|
switch (startup_animation_state) {
|
||||||
case WAITING:
|
case WAITING:
|
||||||
#ifdef STARTUP_ANIMATION_DEBUG
|
# ifdef STARTUP_ANIMATION_DEBUG
|
||||||
dprintf("sua WAITING counter=%u\n", counter);
|
dprintf("sua WAITING counter=%u\n", counter);
|
||||||
#endif
|
# endif
|
||||||
if (counter < STARTUP_ANIMATION_INITIAL_DELAY / STARTUP_ANIMATION_STEP_TIME) {
|
if (counter < STARTUP_ANIMATION_INITIAL_DELAY / STARTUP_ANIMATION_STEP_TIME) {
|
||||||
counter++;
|
counter++;
|
||||||
} else {
|
} else {
|
||||||
|
@ -213,18 +211,22 @@ void matrix_scan_user_rgb(void) {
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case RESTART:
|
case RESTART:
|
||||||
|
# ifdef STARTUP_ANIMATION_DEBUG
|
||||||
dprintln("sua RESTART");
|
dprintln("sua RESTART");
|
||||||
|
# endif
|
||||||
startup_animation_init();
|
startup_animation_init();
|
||||||
case START:
|
case START:
|
||||||
|
# ifdef STARTUP_ANIMATION_DEBUG
|
||||||
dprintln("sua START");
|
dprintln("sua START");
|
||||||
|
# endif
|
||||||
startup_animation_state = FADE_OLD;
|
startup_animation_state = FADE_OLD;
|
||||||
counter = old_config.val;
|
counter = old_config.val;
|
||||||
// No break! Just roll into FADE_OLD in the same iteration...
|
// No break! Just roll into FADE_OLD in the same iteration...
|
||||||
|
|
||||||
case FADE_OLD:
|
case FADE_OLD:
|
||||||
#ifdef STARTUP_ANIMATION_DEBUG
|
# ifdef STARTUP_ANIMATION_DEBUG
|
||||||
dprintf("sua FADE_OLD counter=%u\n", counter);
|
dprintf("sua FADE_OLD counter=%u\n", counter);
|
||||||
#endif
|
# endif
|
||||||
if (counter >= STARTUP_ANIMATION_FADE_STEP) {
|
if (counter >= STARTUP_ANIMATION_FADE_STEP) {
|
||||||
rgblight_sethsv_noeeprom(old_config.hue, old_config.sat, counter);
|
rgblight_sethsv_noeeprom(old_config.hue, old_config.sat, counter);
|
||||||
counter -= STARTUP_ANIMATION_FADE_STEP;
|
counter -= STARTUP_ANIMATION_FADE_STEP;
|
||||||
|
@ -236,9 +238,9 @@ void matrix_scan_user_rgb(void) {
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case FADE_IN:
|
case FADE_IN:
|
||||||
#ifdef STARTUP_ANIMATION_DEBUG
|
# ifdef STARTUP_ANIMATION_DEBUG
|
||||||
dprintf("sua FADE_IN counter=%u\n", counter);
|
dprintf("sua FADE_IN counter=%u\n", counter);
|
||||||
#endif
|
# endif
|
||||||
if (counter < STARTUP_ANIMATION_VALUE) {
|
if (counter < STARTUP_ANIMATION_VALUE) {
|
||||||
rgblight_sethsv_noeeprom(old_config.hue, STARTUP_ANIMATION_SATURATION, counter);
|
rgblight_sethsv_noeeprom(old_config.hue, STARTUP_ANIMATION_SATURATION, counter);
|
||||||
counter += STARTUP_ANIMATION_FADE_STEP;
|
counter += STARTUP_ANIMATION_FADE_STEP;
|
||||||
|
@ -249,45 +251,45 @@ void matrix_scan_user_rgb(void) {
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CYCLE:
|
case CYCLE:
|
||||||
#ifdef STARTUP_ANIMATION_DEBUG
|
# ifdef STARTUP_ANIMATION_DEBUG
|
||||||
dprintf("sua CYCLE counter=%u\n", counter);
|
dprintf("sua CYCLE counter=%u\n", counter);
|
||||||
#endif
|
# endif
|
||||||
if (counter >= STARTUP_ANIMATION_CYCLE_STEP) {
|
if (counter >= STARTUP_ANIMATION_CYCLE_STEP) {
|
||||||
rgblight_sethsv_noeeprom((counter + old_config.hue) % 255, STARTUP_ANIMATION_SATURATION, STARTUP_ANIMATION_VALUE);
|
rgblight_sethsv_noeeprom((counter + old_config.hue) % 255, STARTUP_ANIMATION_SATURATION, STARTUP_ANIMATION_VALUE);
|
||||||
counter -= STARTUP_ANIMATION_CYCLE_STEP;
|
counter -= STARTUP_ANIMATION_CYCLE_STEP;
|
||||||
} else {
|
} else {
|
||||||
if (
|
if (
|
||||||
#ifdef RGBLIGHT_EFFECT_BREATHING
|
# ifdef RGBLIGHT_EFFECT_BREATHING
|
||||||
(old_base_mode == RGBLIGHT_MODE_BREATHING) ||
|
(old_base_mode == RGBLIGHT_MODE_BREATHING) ||
|
||||||
#endif
|
# endif
|
||||||
#ifdef RGBLIGHT_EFFECT_SNAKE
|
# ifdef RGBLIGHT_EFFECT_SNAKE
|
||||||
(old_base_mode == RGBLIGHT_MODE_SNAKE) ||
|
(old_base_mode == RGBLIGHT_MODE_SNAKE) ||
|
||||||
#endif
|
# endif
|
||||||
#ifdef RGBLIGHT_EFFECT_KNIGHT
|
# ifdef RGBLIGHT_EFFECT_KNIGHT
|
||||||
(old_base_mode == RGBLIGHT_MODE_KNIGHT) ||
|
(old_base_mode == RGBLIGHT_MODE_KNIGHT) ||
|
||||||
#endif
|
# endif
|
||||||
#ifdef RGBLIGHT_EFFECT_TWINKLE
|
# ifdef RGBLIGHT_EFFECT_TWINKLE
|
||||||
(old_base_mode == RGBLIGHT_MODE_TWINKLE) ||
|
(old_base_mode == RGBLIGHT_MODE_TWINKLE) ||
|
||||||
#endif
|
# endif
|
||||||
!old_config.enable) {
|
!old_config.enable) {
|
||||||
counter = STARTUP_ANIMATION_VALUE;
|
counter = STARTUP_ANIMATION_VALUE;
|
||||||
startup_animation_state = RAMP_DOWN;
|
startup_animation_state = RAMP_DOWN;
|
||||||
} else if (
|
} else if (
|
||||||
#ifdef RGBLIGHT_EFFECT_STATIC_GRADIENT
|
# ifdef RGBLIGHT_EFFECT_STATIC_GRADIENT
|
||||||
(old_base_mode == RGBLIGHT_MODE_STATIC_GRADIENT) ||
|
(old_base_mode == RGBLIGHT_MODE_STATIC_GRADIENT) ||
|
||||||
#endif
|
# endif
|
||||||
#ifdef RGBLIGHT_EFFECT_RAINBOW_MOOD
|
# ifdef RGBLIGHT_EFFECT_RAINBOW_MOOD
|
||||||
(old_base_mode == RGBLIGHT_MODE_RAINBOW_MOOD) ||
|
(old_base_mode == RGBLIGHT_MODE_RAINBOW_MOOD) ||
|
||||||
#endif
|
# endif
|
||||||
#ifdef RGBLIGHT_EFFECT_RAINBOW_SWIRL
|
# ifdef RGBLIGHT_EFFECT_RAINBOW_SWIRL
|
||||||
(old_base_mode == RGBLIGHT_MODE_RAINBOW_SWIRL) ||
|
(old_base_mode == RGBLIGHT_MODE_RAINBOW_SWIRL) ||
|
||||||
#endif
|
# endif
|
||||||
#ifdef RGBLIGHT_EFFECT_RAINBOW_CHRISTMAS
|
# ifdef RGBLIGHT_EFFECT_RAINBOW_CHRISTMAS
|
||||||
(old_base_mode == RGBLIGHT_MODE_CHRISTMAS) ||
|
(old_base_mode == RGBLIGHT_MODE_CHRISTMAS) ||
|
||||||
#endif
|
# endif
|
||||||
#ifdef RGBLIGHT_EFFECT_RAINBOW_RGB_TEST_
|
# ifdef RGBLIGHT_EFFECT_RAINBOW_RGB_TEST
|
||||||
(old_base_mode == RGBLIGHT_MODE_RGB_TEST) ||
|
(old_base_mode == RGBLIGHT_MODE_RGB_TEST) ||
|
||||||
#endif
|
# endif
|
||||||
(old_base_mode == RGBLIGHT_MODE_STATIC_LIGHT)) {
|
(old_base_mode == RGBLIGHT_MODE_STATIC_LIGHT)) {
|
||||||
counter = 0;
|
counter = 0;
|
||||||
startup_animation_state = RAMP_TO;
|
startup_animation_state = RAMP_TO;
|
||||||
|
@ -298,9 +300,9 @@ void matrix_scan_user_rgb(void) {
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case RAMP_DOWN:
|
case RAMP_DOWN:
|
||||||
#ifdef STARTUP_ANIMATION_DEBUG
|
# ifdef STARTUP_ANIMATION_DEBUG
|
||||||
dprintf("sua RAMP_DOWN counter=%u\n", counter);
|
dprintf("sua RAMP_DOWN counter=%u\n", counter);
|
||||||
#endif
|
# endif
|
||||||
if (counter >= STARTUP_ANIMATION_FADE_STEP) {
|
if (counter >= STARTUP_ANIMATION_FADE_STEP) {
|
||||||
rgblight_sethsv_noeeprom(old_config.hue, STARTUP_ANIMATION_SATURATION, counter);
|
rgblight_sethsv_noeeprom(old_config.hue, STARTUP_ANIMATION_SATURATION, counter);
|
||||||
counter -= STARTUP_ANIMATION_FADE_STEP;
|
counter -= STARTUP_ANIMATION_FADE_STEP;
|
||||||
|
@ -309,11 +311,10 @@ void matrix_scan_user_rgb(void) {
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case RAMP_TO:
|
case RAMP_TO: {
|
||||||
{
|
# ifdef STARTUP_ANIMATION_DEBUG
|
||||||
#ifdef STARTUP_ANIMATION_DEBUG
|
|
||||||
dprintf("sua RAMP_TO s=%u, v=%u, counter=%u\n", old_config.sat, old_config.val, counter);
|
dprintf("sua RAMP_TO s=%u, v=%u, counter=%u\n", old_config.sat, old_config.val, counter);
|
||||||
#endif
|
# endif
|
||||||
uint8_t steps = STARTUP_ANIMATION_RAMP_TO_STEPS;
|
uint8_t steps = STARTUP_ANIMATION_RAMP_TO_STEPS;
|
||||||
if (counter < steps) {
|
if (counter < steps) {
|
||||||
uint8_t s = STARTUP_ANIMATION_SATURATION + counter * (((float)old_config.sat - STARTUP_ANIMATION_SATURATION) / (float)steps);
|
uint8_t s = STARTUP_ANIMATION_SATURATION + counter * (((float)old_config.sat - STARTUP_ANIMATION_SATURATION) / (float)steps);
|
||||||
|
@ -323,14 +324,17 @@ void matrix_scan_user_rgb(void) {
|
||||||
} else {
|
} else {
|
||||||
startup_animation_state = CLEAN_UP;
|
startup_animation_state = CLEAN_UP;
|
||||||
}
|
}
|
||||||
}
|
} break;
|
||||||
break;
|
|
||||||
|
|
||||||
case CLEAN_UP:
|
case CLEAN_UP:
|
||||||
|
# ifdef STARTUP_ANIMATION_DEBUG
|
||||||
dprintln("sua CLEAN_UP");
|
dprintln("sua CLEAN_UP");
|
||||||
|
# endif
|
||||||
rgblight_reload_from_eeprom();
|
rgblight_reload_from_eeprom();
|
||||||
startup_animation_state = DONE;
|
startup_animation_state = DONE;
|
||||||
|
# ifdef STARTUP_ANIMATION_DEBUG
|
||||||
dprintln("sua DONE");
|
dprintln("sua DONE");
|
||||||
|
# endif
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -344,8 +348,8 @@ void matrix_scan_user_rgb(void) {
|
||||||
if (timer_elapsed(change_timer) > change_tick) {
|
if (timer_elapsed(change_timer) > change_tick) {
|
||||||
HSV hsv = rgblight_get_hsv();
|
HSV hsv = rgblight_get_hsv();
|
||||||
hsv.h += change_hue;
|
hsv.h += change_hue;
|
||||||
hsv.s = change_sat > 0 ? qadd8(hsv.s, (uint8_t) change_sat) : qsub8(hsv.s, (uint8_t) -change_sat);
|
hsv.s = change_sat > 0 ? qadd8(hsv.s, (uint8_t)change_sat) : qsub8(hsv.s, (uint8_t)-change_sat);
|
||||||
hsv.v = change_val > 0 ? qadd8(hsv.v, (uint8_t) change_val) : qsub8(hsv.v, (uint8_t) -change_val);
|
hsv.v = change_val > 0 ? qadd8(hsv.v, (uint8_t)change_val) : qsub8(hsv.v, (uint8_t)-change_val);
|
||||||
rgblight_sethsv_noeeprom(hsv.h, hsv.s, hsv.v);
|
rgblight_sethsv_noeeprom(hsv.h, hsv.s, hsv.v);
|
||||||
change_timer = timer_read();
|
change_timer = timer_read();
|
||||||
}
|
}
|
||||||
|
@ -372,8 +376,6 @@ layer_state_t layer_state_set_user_rgb(layer_state_t state) {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool led_update_user_rgb(led_t led_state) {
|
bool led_update_user_rgb(led_t led_state) {
|
||||||
dprintf("num=%u, cap=%u, scl=%u, cmp=%u, kan=%u\n", led_state.num_lock, led_state.caps_lock, led_state.scroll_lock, led_state.compose, led_state.kana);
|
|
||||||
|
|
||||||
rgblight_set_layer_state(LOCK_OFFSET + USB_LED_NUM_LOCK, led_state.num_lock);
|
rgblight_set_layer_state(LOCK_OFFSET + USB_LED_NUM_LOCK, led_state.num_lock);
|
||||||
rgblight_set_layer_state(LOCK_OFFSET + USB_LED_CAPS_LOCK, led_state.caps_lock);
|
rgblight_set_layer_state(LOCK_OFFSET + USB_LED_CAPS_LOCK, led_state.caps_lock);
|
||||||
rgblight_set_layer_state(LOCK_OFFSET + USB_LED_SCROLL_LOCK, led_state.scroll_lock);
|
rgblight_set_layer_state(LOCK_OFFSET + USB_LED_SCROLL_LOCK, led_state.scroll_lock);
|
||||||
|
@ -385,7 +387,6 @@ void rgb_layer_ack_yn(bool yn) { rgb_layer_ack(yn ? ACK_YES : ACK_NO); }
|
||||||
|
|
||||||
void rgb_layer_ack(layer_ack_t n) {
|
void rgb_layer_ack(layer_ack_t n) {
|
||||||
uint8_t layer = ACK_OFFSET + n;
|
uint8_t layer = ACK_OFFSET + n;
|
||||||
dprintf("rgb_layer_ack(%u) ==> %u\n", n, layer);
|
|
||||||
rgblight_blink_layer(layer, RGB_LAYER_ACK_DURATION);
|
rgblight_blink_layer(layer, RGB_LAYER_ACK_DURATION);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@ static uint32_t matrix_timer = 0;
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
void report_version(void) {
|
void report_version(void) {
|
||||||
uprintln(QMK_KEYBOARD "/" QMK_KEYMAP " @ " QMK_VERSION ", Built on: " QMK_BUILDDATE);
|
uprintln(QMK_KEYBOARD "/" QMK_KEYMAP " @ " QMK_VERSION " - " QMK_BUILDDATE);
|
||||||
reported_version = true;
|
reported_version = true;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -51,8 +51,41 @@ void matrix_scan_user(void) {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
bool process_record_glyph_replacement(uint16_t keycode, keyrecord_t *record, uint32_t baseAlphaLower, uint32_t baseAlphaUpper, uint32_t zeroGlyph, uint32_t baseNumberOne, uint32_t spaceGlyph, uint8_t temp_mod, uint8_t temp_osm) {
|
static uint32_t math_glyph_exceptions(const uint16_t keycode, const bool shifted) {
|
||||||
|
if (shifted) {
|
||||||
|
switch (keycode) {
|
||||||
|
// clang-format off
|
||||||
|
case KC_C: return 0x2102;
|
||||||
|
case KC_H: return 0x210D;
|
||||||
|
case KC_N: return 0x2115;
|
||||||
|
case KC_P: return 0x2119;
|
||||||
|
case KC_Q: return 0x211A;
|
||||||
|
case KC_R: return 0x211D;
|
||||||
|
case KC_Z: return 0x2124;
|
||||||
|
// clang-format on
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool process_record_glyph_replacement(uint16_t keycode, keyrecord_t *record, uint32_t baseAlphaLower, uint32_t baseAlphaUpper, uint32_t zeroGlyph, uint32_t baseNumberOne, uint32_t spaceGlyph, uint32_t (*exceptions)(const uint16_t keycode, const bool shifted), uint8_t temp_mod, uint8_t temp_osm) {
|
||||||
|
void _register(uint32_t codepoint) {
|
||||||
|
unicode_input_start();
|
||||||
|
register_hex32(codepoint);
|
||||||
|
unicode_input_finish();
|
||||||
|
}
|
||||||
|
|
||||||
if ((((temp_mod | temp_osm) & (MOD_MASK_CTRL | MOD_MASK_ALT | MOD_MASK_GUI))) == 0) {
|
if ((((temp_mod | temp_osm) & (MOD_MASK_CTRL | MOD_MASK_ALT | MOD_MASK_GUI))) == 0) {
|
||||||
|
bool shifted = ((temp_mod | temp_osm) & MOD_MASK_SHIFT);
|
||||||
|
if (exceptions) {
|
||||||
|
uint32_t res = exceptions(keycode, shifted);
|
||||||
|
if (res) {
|
||||||
|
if (record->event.pressed) {
|
||||||
|
_register(res);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
switch (keycode) {
|
switch (keycode) {
|
||||||
case KC_A ... KC_Z:
|
case KC_A ... KC_Z:
|
||||||
if (record->event.pressed) {
|
if (record->event.pressed) {
|
||||||
|
@ -61,39 +94,30 @@ bool process_record_glyph_replacement(uint16_t keycode, keyrecord_t *record, uin
|
||||||
clear_oneshot_mods();
|
clear_oneshot_mods();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
unicode_input_start();
|
uint32_t base = shifted ? baseAlphaUpper : baseAlphaLower;
|
||||||
uint32_t base = ((temp_mod | temp_osm) & MOD_MASK_SHIFT) ? baseAlphaUpper : baseAlphaLower;
|
_register(base + (keycode - KC_A));
|
||||||
register_hex32(base + (keycode - KC_A));
|
|
||||||
unicode_input_finish();
|
|
||||||
|
|
||||||
set_mods(temp_mod);
|
set_mods(temp_mod);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
case KC_0:
|
case KC_0:
|
||||||
if ((temp_mod | temp_osm) & MOD_MASK_SHIFT) { // skip shifted numbers, so that we can still use symbols etc.
|
if (shifted) { // skip shifted numbers, so that we can still use symbols etc.
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (record->event.pressed) {
|
if (record->event.pressed) {
|
||||||
unicode_input_start();
|
_register(zeroGlyph);
|
||||||
register_hex32(zeroGlyph);
|
|
||||||
unicode_input_finish();
|
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
case KC_1 ... KC_9:
|
case KC_1 ... KC_9:
|
||||||
if ((temp_mod | temp_osm) & MOD_MASK_SHIFT) { // skip shifted numbers, so that we can still use symbols etc.
|
if (shifted) { // skip shifted numbers, so that we can still use symbols etc.
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (record->event.pressed) {
|
if (record->event.pressed) {
|
||||||
unicode_input_start();
|
_register(baseNumberOne + (keycode - KC_1));
|
||||||
register_hex32(baseNumberOne + (keycode - KC_1));
|
|
||||||
unicode_input_finish();
|
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
case KC_SPACE:
|
case KC_SPACE:
|
||||||
if (record->event.pressed) {
|
if (record->event.pressed) {
|
||||||
unicode_input_start();
|
_register(spaceGlyph); // em space
|
||||||
register_hex32(spaceGlyph); // em space
|
|
||||||
unicode_input_finish();
|
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -163,7 +187,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
||||||
debug_keyboard = 0;
|
debug_keyboard = 0;
|
||||||
debug_matrix = 0;
|
debug_matrix = 0;
|
||||||
}
|
}
|
||||||
uprintf("DEBUG: enable=%u, keyboard=%u, matrix=%u\n", debug_enable, debug_keyboard, debug_matrix);
|
uprintf("DEBUG: enable=%u, kb=%u, matrix=%u\n", debug_enable, debug_keyboard, debug_matrix);
|
||||||
eeconfig_update_debug(debug_config.raw);
|
eeconfig_update_debug(debug_config.raw);
|
||||||
return false;
|
return false;
|
||||||
#endif
|
#endif
|
||||||
|
@ -181,14 +205,12 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
||||||
#endif
|
#endif
|
||||||
// clang-format on
|
// clang-format on
|
||||||
|
|
||||||
case SPI_NORMAL ... SPI_FRAKTR:
|
case SPI_NORMAL ... SPI_MATH:
|
||||||
spi_replace_mode = (spi_replace_mode == keycode) ? SPI_NORMAL : keycode;
|
spi_replace_mode = (spi_replace_mode == keycode) ? SPI_NORMAL : keycode;
|
||||||
dprintf("spi_replace_mode = %u\n", spi_replace_mode);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SPI_GFLOCK:
|
case SPI_GFLOCK:
|
||||||
spi_gflock = !spi_gflock;
|
spi_gflock = !spi_gflock;
|
||||||
dprintf("spi_gflock = %u\n", spi_gflock);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SPI_KP_00:
|
case SPI_KP_00:
|
||||||
|
@ -279,19 +301,23 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
||||||
case KC_SPACE:
|
case KC_SPACE:
|
||||||
switch (spi_replace_mode) {
|
switch (spi_replace_mode) {
|
||||||
case SPI_WIDE:
|
case SPI_WIDE:
|
||||||
return process_record_glyph_replacement(keycode, record, 0xFF41, 0xFF21, 0xFF10, 0xFF11, 0x2003, mods, osm);
|
return process_record_glyph_replacement(keycode, record, 0xFF41, 0xFF21, 0xFF10, 0xFF11, 0x2003, NULL, mods, osm);
|
||||||
case SPI_SCRIPT:
|
case SPI_SCRIPT:
|
||||||
return process_record_glyph_replacement(keycode, record, 0x1D4EA, 0x1D4D0, 0x1D7CE, 0x1D7CF, 0x2002, mods, osm);
|
return process_record_glyph_replacement(keycode, record, 0x1D4EA, 0x1D4D0, 0x1D7CE, 0x1D7CF, 0x2002, NULL, mods, osm);
|
||||||
case SPI_BLOCKS:
|
case SPI_BLOCKS:
|
||||||
return process_record_glyph_replacement(keycode, record, 0x1F170, 0x1F170, '0', '1', 0x2002, mods, osm);
|
return process_record_glyph_replacement(keycode, record, 0x1F170, 0x1F170, '0', '1', 0x2002, NULL, mods, osm);
|
||||||
case SPI_CIRCLE:
|
case SPI_CIRCLE:
|
||||||
return process_record_glyph_replacement(keycode, record, 0x1F150, 0x1F150, '0', '1', 0x2002, mods, osm);
|
return process_record_glyph_replacement(keycode, record, 0x1F150, 0x1F150, '0', '1', 0x2002, NULL, mods, osm);
|
||||||
case SPI_SQUARE:
|
case SPI_SQUARE:
|
||||||
return process_record_glyph_replacement(keycode, record, 0x1F130, 0x1F130, '0', '1', 0x2002, mods, osm);
|
return process_record_glyph_replacement(keycode, record, 0x1F130, 0x1F130, '0', '1', 0x2002, NULL, mods, osm);
|
||||||
case SPI_PARENS:
|
case SPI_PARENS:
|
||||||
return process_record_glyph_replacement(keycode, record, 0x1F110, 0x1F110, '0', '1', 0x2002, mods, osm);
|
return process_record_glyph_replacement(keycode, record, 0x1F110, 0x1F110, '0', '1', 0x2002, NULL, mods, osm);
|
||||||
case SPI_FRAKTR:
|
case SPI_FRAKTR:
|
||||||
return process_record_glyph_replacement(keycode, record, 0x1D586, 0x1D56C, '0', '1', 0x2002, mods, osm);
|
return process_record_glyph_replacement(keycode, record, 0x1D586, 0x1D56C, '0', '1', 0x2002, NULL, mods, osm);
|
||||||
|
case SPI_BOLD:
|
||||||
|
return process_record_glyph_replacement(keycode, record, 0x1D41A, 0x1D400, '0', '1', 0x2002, NULL, mods, osm);
|
||||||
|
case SPI_MATH:
|
||||||
|
return process_record_glyph_replacement(keycode, record, 0x1D552, 0x1D538, '0', '1', 0x2002, &math_glyph_exceptions, mods, osm);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -304,9 +330,9 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
||||||
if (record->event.pressed) {
|
if (record->event.pressed) {
|
||||||
if ((mods | osm) & MOD_MASK_SHIFT) {
|
if ((mods | osm) & MOD_MASK_SHIFT) {
|
||||||
del_mods(MOD_MASK_SHIFT);
|
del_mods(MOD_MASK_SHIFT);
|
||||||
#ifndef NO_ACTION_ONESHOT
|
# ifndef NO_ACTION_ONESHOT
|
||||||
clear_oneshot_mods();
|
clear_oneshot_mods();
|
||||||
#endif
|
# endif
|
||||||
register_code(KC_DEL);
|
register_code(KC_DEL);
|
||||||
delkey_registered = true;
|
delkey_registered = true;
|
||||||
set_mods(mods);
|
set_mods(mods);
|
||||||
|
|
|
@ -29,6 +29,8 @@ enum custom_keycodes {
|
||||||
SPI_SQUARE,
|
SPI_SQUARE,
|
||||||
SPI_PARENS,
|
SPI_PARENS,
|
||||||
SPI_FRAKTR,
|
SPI_FRAKTR,
|
||||||
|
SPI_BOLD,
|
||||||
|
SPI_MATH,
|
||||||
SPI_GFLOCK,
|
SPI_GFLOCK,
|
||||||
SPI_KP_00,
|
SPI_KP_00,
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue