From 3892829d74119b1fe771b4b51c665448a433da1e Mon Sep 17 00:00:00 2001 From: xton Date: Tue, 28 Aug 2018 19:54:17 -0400 Subject: Keymap: xtonhasvim updates (#3768) * cherrypicking file changes just for updates * removed unused heat foo * avoid defining own min/max * add license * formatting --- users/xtonhasvim/fancylighting.c | 167 +++++++++++++++++++++++++++++++++++++++ users/xtonhasvim/fancylighting.h | 35 ++++++++ users/xtonhasvim/rules.mk | 1 + users/xtonhasvim/xtonhasvim.c | 72 +++++++++++------ users/xtonhasvim/xtonhasvim.h | 9 ++- 5 files changed, 258 insertions(+), 26 deletions(-) create mode 100644 users/xtonhasvim/fancylighting.c create mode 100644 users/xtonhasvim/fancylighting.h (limited to 'users/xtonhasvim') diff --git a/users/xtonhasvim/fancylighting.c b/users/xtonhasvim/fancylighting.c new file mode 100644 index 000000000..f4af5ec55 --- /dev/null +++ b/users/xtonhasvim/fancylighting.c @@ -0,0 +1,167 @@ + /* Copyright 2015-2017 Christon DeWan + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#ifdef RGBLIGHT_ENABLE + +#include + +#include "rgblight.h" +#include "color.h" +#include "fancylighting.h" + + +__attribute__ ((weak)) +void matrix_scan_keymap(void) { + // override me, if you want. + return; +} + +#define ABSDIFF(a,b) ((a)>(b)?(a)-(b):(b)-(a)) + +#define FADE_BACK_TIME 500 +#define BREATH_FIRE_TIME 1000 +#define ANIMATION_STEP_INTERVAL 20 +#define POWER_KEY_OFFSET (RGBLED_NUM / 2) +#define SPACE_OFFSET_MAX (RGBLED_NUM / 2) + + +uint16_t effect_start_timer = 0; +uint8_t user_rgb_mode = 0; +LED_TYPE shadowed_led[RGBLED_NUM] = {0}; + +void start_firey_return(void) { + user_rgb_mode = BREATH_FIRE; + effect_start_timer = timer_read(); + for(uint8_t i = 0; i < RGBLED_NUM; i++) { + shadowed_led[i] = led[i]; + } +} + +/** 0---max + * [___] + * [__/] + * [_/\] + * [/\_] + * [\__] + * [___] + **/ + +void set_color_for_offsets(uint16_t time_offset, uint16_t space_offset, uint8_t idx) { + float time_progress = (float)time_offset / BREATH_FIRE_TIME; + float space_progress = (float)space_offset / SPACE_OFFSET_MAX; + float progress = time_progress * 5.0 - space_progress; + if(progress > 1.0) { + progress -= 1.0; + progress /= 4.0; + progress = 1.0 - progress; + } + progress = fmax(0.0,progress); + progress *= progress; // squared! + + float alpha = (time_progress + 0.1) * 7.0 - space_progress; + alpha = fmin(1.0, alpha*alpha); + + LED_TYPE px[1] = {0}; + sethsv((uint16_t)(fmod(time_progress * 1.5 + space_progress,1.0)*360), 255, (uint8_t)(progress*255),&px[0]); + led[idx].r = alpha * px[0].r + ( 1.0 - alpha) * shadowed_led[idx].r; + led[idx].g = alpha * px[0].g + ( 1.0 - alpha) * shadowed_led[idx].g; + led[idx].b = alpha * px[0].b + ( 1.0 - alpha) * shadowed_led[idx].b; +} + +/** + * It's actually a rainbow: a fire curve didn't really look right. + * it's still cool, though! + */ +void rgb_mode_breath_fire(void) { + static uint16_t last_timer = 0; + if(!last_timer) last_timer = timer_read(); + uint16_t this_timer = timer_read(); + + // too soon. don't spam updates + if(this_timer - last_timer < ANIMATION_STEP_INTERVAL) return; + + uint16_t elapsed = this_timer - effect_start_timer; + + last_timer = this_timer; + if(elapsed >= BREATH_FIRE_TIME) { + // complete + user_rgb_mode = FADE_BACK; + effect_start_timer = this_timer; + } else { + // linear fade + for(uint16_t i = 0; i < RGBLED_NUM; i++) { + uint16_t space_offset = ABSDIFF(i,POWER_KEY_OFFSET); + if(space_offset > SPACE_OFFSET_MAX) space_offset = RGBLED_NUM - space_offset; + + set_color_for_offsets(elapsed, space_offset, i); + } + rgblight_set(); + } +} + +void rgb_mode_fade_back(void) { + static uint16_t last_timer = 0; + if(!last_timer) last_timer = timer_read(); + uint16_t this_timer = timer_read(); + + // too soon. don't spam updates + if(this_timer - last_timer < ANIMATION_STEP_INTERVAL) return; + + uint16_t elapsed = this_timer - effect_start_timer; + + last_timer = this_timer; + float progress = (float)elapsed / FADE_BACK_TIME; + progress = fmin(1.0,progress); + + for(uint8_t i = 0; i < RGBLED_NUM; i++) { + led[i].r = shadowed_led[i].r * progress; + led[i].g = shadowed_led[i].g * progress; + led[i].b = shadowed_led[i].b * progress; + } + rgblight_set(); + + if(elapsed >= FADE_BACK_TIME) user_rgb_mode = 0; +} + +/** called when layer state or vstate has changed */ +__attribute__ ((weak)) +void set_state_leds(void) { + return; +} + +void matrix_scan_user(void) { + static uint32_t last_layer = 0; + static uint32_t last_vstate = 0; + if(last_layer != layer_state || last_vstate != vstate) set_state_leds(); + last_layer = layer_state; + last_vstate = vstate; + + switch (user_rgb_mode) { + case BREATH_FIRE: + rgb_mode_breath_fire(); + break; + case FADE_BACK: + rgb_mode_fade_back(); + break; + } + matrix_scan_keymap(); +} + +#else + +void start_firey_return(void) {} + +#endif diff --git a/users/xtonhasvim/fancylighting.h b/users/xtonhasvim/fancylighting.h new file mode 100644 index 000000000..982010d3d --- /dev/null +++ b/users/xtonhasvim/fancylighting.h @@ -0,0 +1,35 @@ +p /* Copyright 2015-2017 Christon DeWan + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#ifndef _fancy_lighting_h +#define _fancy_lighting_h +#ifdef RGBLIGHT_ENABLE + +#include "xtonhasvim.h" + +extern uint8_t user_rgb_mode; +extern LED_TYPE shadowed_led[]; + +void start_firey_return(void); + +#endif //_fancy_lighting_h + +enum xtonhasvim_rgbmodes { + BREATH_FIRE = 1, + FADE_BACK +}; + +#endif //RGBLIGHT_ENABLE diff --git a/users/xtonhasvim/rules.mk b/users/xtonhasvim/rules.mk index 3777917f8..a901bfcf6 100644 --- a/users/xtonhasvim/rules.mk +++ b/users/xtonhasvim/rules.mk @@ -1 +1,2 @@ SRC += xtonhasvim.c +SRC += fancylighting.c diff --git a/users/xtonhasvim/xtonhasvim.c b/users/xtonhasvim/xtonhasvim.c index a2ff2fa31..5f6701830 100644 --- a/users/xtonhasvim/xtonhasvim.c +++ b/users/xtonhasvim/xtonhasvim.c @@ -15,6 +15,7 @@ */ #include "xtonhasvim.h" +#include "fancylighting.h" /************************************ * helper foo @@ -53,13 +54,13 @@ static void ALT(uint16_t keycode) { } -static uint16_t vstate = VIM_START; +uint16_t vstate = VIM_START; static bool yank_was_lines = false; static bool SHIFTED = false; static uint32_t mod_override_layer_state = 0; static uint16_t mod_override_triggering_key = 0; -static void edit(void) { vstate = VIM_START; layer_on(_EDIT); layer_off(_CMD); } +static void edit(void) { vstate = VIM_START; layer_clear(); } #define EDIT edit() @@ -102,25 +103,54 @@ static void simple_movement(uint16_t keycode) { } } +static void comma_period(uint16_t keycode) { + switch (keycode) { + case VIM_COMMA: + if (SHIFTED) { + // indent + CMD(KC_LBRACKET); + } else { + // toggle comment + CMD(KC_SLASH); + } + break; + case VIM_PERIOD: + if (SHIFTED) { + // outdent + CMD(KC_RBRACKET); + } + break; + } +} + __attribute__ ((weak)) bool process_record_keymap(uint16_t keycode, keyrecord_t *record) { return true; } -#define PASS_THRU process_record_keymap(keycode, record) - bool process_record_user(uint16_t keycode, keyrecord_t *record) { - if(record->event.pressed && layer_state_is(_CMD) && IS_MOD(keycode)) { + /* keymap gets first whack */ + if(!process_record_keymap(keycode, record)) return false; + + /****** FIREY_RETURN *****/ + if(record->event.pressed && keycode == FIREY_RETURN) { + start_firey_return(); + TAP(KC_ENT); + } + + /****** mod passthru *****/ + if(record->event.pressed && layer_state_is(vim_cmd_layer()) && (IS_MOD(keycode) || keycode == LSFT(KC_LALT))) { mod_override_layer_state = layer_state; mod_override_triggering_key = keycode; + // TODO: change this to track key location instead layer_clear(); - return PASS_THRU; // let the event fall through... + return true; // let the event fall through... } if(mod_override_layer_state && !record->event.pressed && keycode == mod_override_triggering_key) { layer_state_set(mod_override_layer_state); mod_override_layer_state = 0; mod_override_triggering_key = 0; - return PASS_THRU; + return true; } if (VIM_START <= keycode && keycode <= VIM_ESC) { @@ -132,7 +162,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { if (record->event.pressed) { if(keycode == VIM_START) { // entry from anywhere - layer_on(_CMD); + layer_on(vim_cmd_layer()); vstate = VIM_START; // reset state @@ -176,7 +206,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { break; case VIM_D: if(SHIFTED) { - TAP(KC_K); + CTRL(KC_K); } else { vstate = VIM_D; } @@ -300,19 +330,8 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { } break; case VIM_COMMA: - if(SHIFTED) { - // indent - CMD(KC_LBRACKET); - } else { - // toggle comment - CMD(KC_SLASH); - } - break; case VIM_PERIOD: - if(SHIFTED) { - // outdent - CMD(KC_RBRACKET); - } + comma_period(keycode); break; } break; @@ -483,6 +502,10 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { TAP(KC_RIGHT); vstate = VIM_START; break; + case VIM_COMMA: + case VIM_PERIOD: + comma_period(keycode); + break; default: // do nothing break; @@ -539,6 +562,10 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { TAP(KC_RIGHT); vstate = VIM_START; break; + case VIM_COMMA: + case VIM_PERIOD: + comma_period(keycode); + break; default: // do nothing break; @@ -610,6 +637,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { } return false; } else { - return PASS_THRU; + return true; } } + diff --git a/users/xtonhasvim/xtonhasvim.h b/users/xtonhasvim/xtonhasvim.h index 21b794c03..5ff4932a4 100644 --- a/users/xtonhasvim/xtonhasvim.h +++ b/users/xtonhasvim/xtonhasvim.h @@ -26,6 +26,7 @@ bool process_record_xtonhasvim(uint16_t keycode, keyrecord_t *record); enum xtonhasvim_keycodes { DUMMY = SAFE_RANGE, + FIREY_RETURN, // kick off special effects VIM_START, // bookend for vim states VIM_A, VIM_B, @@ -57,10 +58,10 @@ enum xtonhasvim_keycodes { VIM_SAFE_RANGE // start other keycodes here. }; -enum xtonhasvim_layers { - _EDIT = 12, - _CMD -}; +// NOTE: YOU MUST DEFINE THIS +extern uint8_t vim_cmd_layer(void); + +extern uint16_t vstate; #endif -- cgit v1.3.1 From 78ef62764bfba2b7cb1fb34e477953c16c7a926d Mon Sep 17 00:00:00 2001 From: Christon DeWan Date: Fri, 31 Aug 2018 11:28:14 -0400 Subject: Keymap: I got my intern a KBParadise V60 Type R... (#3813) * new mode for v60 xtonhasvim. still working on it: - need to get indicator lights going - and fun layer properly fleshed out. * status lighting, proper fun layer copied fun layout from keycaps to maximize accessibility * enable power return * support brightness adjustment for indicators * refined brightness setting. is saved in eeprom now * readme. and fixed tilde * more modifiers fall through fun layer * i mean, this kinda works.. * much more reliable way of restoring lights * responded to feedback --- keyboards/v60_type_r/keymaps/xtonhasvim/config.h | 24 +++ keyboards/v60_type_r/keymaps/xtonhasvim/keymap.c | 196 ++++++++++++++++++++++ keyboards/v60_type_r/keymaps/xtonhasvim/readme.md | 20 +++ keyboards/v60_type_r/keymaps/xtonhasvim/rules.mk | 5 + keyboards/v60_type_r/rules.mk | 2 +- users/xtonhasvim/fancylighting.c | 7 +- users/xtonhasvim/fancylighting.h | 9 +- users/xtonhasvim/xtonhasvim.h | 6 +- 8 files changed, 259 insertions(+), 10 deletions(-) create mode 100644 keyboards/v60_type_r/keymaps/xtonhasvim/config.h create mode 100644 keyboards/v60_type_r/keymaps/xtonhasvim/keymap.c create mode 100644 keyboards/v60_type_r/keymaps/xtonhasvim/readme.md create mode 100644 keyboards/v60_type_r/keymaps/xtonhasvim/rules.mk (limited to 'users/xtonhasvim') diff --git a/keyboards/v60_type_r/keymaps/xtonhasvim/config.h b/keyboards/v60_type_r/keymaps/xtonhasvim/config.h new file mode 100644 index 000000000..997802a56 --- /dev/null +++ b/keyboards/v60_type_r/keymaps/xtonhasvim/config.h @@ -0,0 +1,24 @@ +/* Copyright 2018 Christon DeWan (Xton) + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + + +#pragma once + +#define V60_POLESTAR + +#define PERMISSIVE_HOLD + + diff --git a/keyboards/v60_type_r/keymaps/xtonhasvim/keymap.c b/keyboards/v60_type_r/keymaps/xtonhasvim/keymap.c new file mode 100644 index 000000000..ec337bb22 --- /dev/null +++ b/keyboards/v60_type_r/keymaps/xtonhasvim/keymap.c @@ -0,0 +1,196 @@ +/* Copyright 2018 Christon DeWan (Xton) + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +#include QMK_KEYBOARD_H + +#include "xtonhasvim.h" +#include "fancylighting.h" + +#define _______ KC_TRNS +#define X_____X KC_NO + +enum layers { + _QWERTY, + _FUN, + _MOVE, + _CMD +}; + +enum layout_key_codes { + IND_BRI = VIM_SAFE_RANGE, + IND_DIM +}; + +extern uint8_t vim_cmd_layer(void) { return _CMD; } + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [_QWERTY] = LAYOUT_all( + KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, X_____X, KC_BSPC, \ + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, \ + LT(_MOVE, KC_CAPS), KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, \ + KC_LSFT, X_____X, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, X_____X, \ + KC_LCTL, KC_LALT, KC_LGUI, KC_SPC, KC_RGUI, KC_RALT, VIM_START, MO(_FUN)), + + + [_MOVE] = LAYOUT_all( + X_____X, X_____X, X_____X, X_____X, X_____X, X_____X, X_____X, X_____X, X_____X, X_____X, X_____X, X_____X, X_____X, X_____X, X_____X, + X_____X, X_____X, X_____X, X_____X, X_____X, X_____X, KC_HOME, KC_PGDN, KC_PGUP, KC_END, X_____X, X_____X, X_____X, X_____X, + _______, X_____X, LGUI(KC_LBRC), LGUI(LSFT(KC_LBRC)), LGUI(LSFT(KC_RBRC)), LGUI(KC_RBRC), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, X_____X, X_____X, VIM_START, + _______, X_____X, X_____X, X_____X, X_____X, X_____X, X_____X, X_____X, X_____X, X_____X, X_____X, X_____X, X_____X, _______, + _______, _______, _______, _______, _______, _______, _______, _______), + + + [_FUN] = LAYOUT_all( + KC_GRV, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, X_____X, KC_DEL, \ + X_____X, X_____X, KC_UP, RGB_TOG, IND_BRI, X_____X, X_____X, X_____X, KC_PSCR, KC_SLCK, KC_PAUS, KC_UP, X_____X, KC_INS, \ + X_____X, KC_LEFT, KC_DOWN, KC_RIGHT, IND_DIM, X_____X, X_____X, X_____X, KC_HOME, KC_PGUP, KC_LEFT, KC_RIGHT, FIREY_RETURN, \ + _______, X_____X, BL_INC, BL_STEP, BL_DEC, X_____X, KC_VOLD, KC_VOLU, KC_MUTE, KC_END, KC_PGDN, KC_DOWN, _______, X_____X, \ + _______, _______, _______, X_____X, _______, _______, X_____X, _______ + ), + + [_CMD] = LAYOUT_all( + VIM_ESC, X_____X, X_____X, X_____X, X_____X, X_____X, X_____X, X_____X, X_____X, X_____X, X_____X, X_____X, X_____X, X_____X, X_____X, + X_____X, X_____X, VIM_W, VIM_E, X_____X, X_____X, VIM_Y, VIM_U, VIM_I, VIM_O, VIM_P, X_____X, X_____X, X_____X, + _______, VIM_A, VIM_S, VIM_D, X_____X, VIM_G, VIM_H, VIM_J, VIM_K, VIM_L, X_____X, X_____X, X_____X, + VIM_SHIFT, X_____X, X_____X, VIM_X, VIM_C, VIM_V, VIM_B, X_____X, X_____X, VIM_COMMA, VIM_PERIOD, X_____X, VIM_SHIFT,X_____X, + _______, _______, _______, _______, _______, _______, _______, TO(_QWERTY) + ) +}; + + +void led_set_user(uint8_t usb_led) { + if (usb_led & (1<event.pressed) { + switch(keycode) { + case IND_BRI: + if (rgblight_config.val + RGBLIGHT_VAL_STEP > RGBLIGHT_LIMIT_VAL) { + rgblight_config.val = RGBLIGHT_LIMIT_VAL; + } else { + rgblight_config.val = rgblight_config.val + RGBLIGHT_VAL_STEP; + } + eeconfig_update_rgblight(rgblight_config.raw); + set_state_leds(); + break; + case IND_DIM: + if (rgblight_config.val - RGBLIGHT_VAL_STEP < RGBLIGHT_BASE_VAL) { + rgblight_config.val = RGBLIGHT_BASE_VAL; + } else { + rgblight_config.val = rgblight_config.val - RGBLIGHT_VAL_STEP; + } + eeconfig_update_rgblight(rgblight_config.raw); + set_state_leds(); + break; + } + } + return true; +} + +void suspend_power_down_user(void) +{ + // rgb + rgblight_config.enable = false; + rgblight_set(); + + // backlight + /** I don't know why, but 3 means "off" and down is up */ + backlight_config.level = 3; + backlight_config.enable = false; + backlight_set(3); +} + +void suspend_wakeup_init_user(void) +{ + rgblight_config.raw = eeconfig_read_rgblight(); + backlight_config.raw = eeconfig_read_backlight(); + + backlight_set(backlight_config.level); + rgblight_set(); +} + diff --git a/keyboards/v60_type_r/keymaps/xtonhasvim/readme.md b/keyboards/v60_type_r/keymaps/xtonhasvim/readme.md new file mode 100644 index 000000000..541faed2b --- /dev/null +++ b/keyboards/v60_type_r/keymaps/xtonhasvim/readme.md @@ -0,0 +1,20 @@ +KB Paradise V60 Type R Xton Has Vim! Layout +====================== + +If you don't look closely, this layout mimics the default layout fairly well. Care +is taken to match the FN layer to the keycaps that the TypeR comes with. I wrote this layout +for a keyboard that I'm giving my intern as a parting gift and wanted it to be as easy to learn +as possible. + +The key differences: + +- Holding capslock down activates the movement layer, much like the vimouse layout except that I'm using the xtonhasvim movement layer. +- Capslock+return (or right-control) activates vim mode! + +## Keymap Notes + +- Alternate underglow modes are not supported. Instead the underglow is used to indicate state. It can be turned off and dimmed. Polestar underglow LEDs are not individually addressable, sadly. + +### Build + +To build this keymap, simply run `make v60_type_r:xtonhasvim` from the root project directory. Flash using QMK Toolbox diff --git a/keyboards/v60_type_r/keymaps/xtonhasvim/rules.mk b/keyboards/v60_type_r/keymaps/xtonhasvim/rules.mk new file mode 100644 index 000000000..6f9d7cc39 --- /dev/null +++ b/keyboards/v60_type_r/keymaps/xtonhasvim/rules.mk @@ -0,0 +1,5 @@ +BACKLIGHT_ENABLE = yes +RGBLIGHT_ENABLE = yes +MOUSEKEY_ENABLE = no +CONSOLE_ENABLE = no # Console for debug(+400) +DEBUG_ENABLE = no diff --git a/keyboards/v60_type_r/rules.mk b/keyboards/v60_type_r/rules.mk index afd65cd1a..30038d562 100644 --- a/keyboards/v60_type_r/rules.mk +++ b/keyboards/v60_type_r/rules.mk @@ -68,4 +68,4 @@ BLUETOOTH_ENABLE ?= no # Enable Bluetooth with the Adafruit EZ-Key HID AUDIO_ENABLE ?= no # Audio output on port C6 FAUXCLICKY_ENABLE ?= no # Use buzzer to emulate clicky switches -LAYOUTS = 60_ansi \ No newline at end of file +LAYOUTS = 60_ansi diff --git a/users/xtonhasvim/fancylighting.c b/users/xtonhasvim/fancylighting.c index f4af5ec55..dc13df03f 100644 --- a/users/xtonhasvim/fancylighting.c +++ b/users/xtonhasvim/fancylighting.c @@ -34,9 +34,14 @@ void matrix_scan_keymap(void) { #define FADE_BACK_TIME 500 #define BREATH_FIRE_TIME 1000 #define ANIMATION_STEP_INTERVAL 20 + +#if RGBLED_NUM >= 2 #define POWER_KEY_OFFSET (RGBLED_NUM / 2) #define SPACE_OFFSET_MAX (RGBLED_NUM / 2) - +#else +#define POWER_KEY_OFFSET 1 +#define SPACE_OFFSET_MAX 1 +#endif uint16_t effect_start_timer = 0; uint8_t user_rgb_mode = 0; diff --git a/users/xtonhasvim/fancylighting.h b/users/xtonhasvim/fancylighting.h index 982010d3d..02fb58b84 100644 --- a/users/xtonhasvim/fancylighting.h +++ b/users/xtonhasvim/fancylighting.h @@ -1,4 +1,4 @@ -p /* Copyright 2015-2017 Christon DeWan +/* Copyright 2015-2017 Christon DeWan * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -20,16 +20,17 @@ p /* Copyright 2015-2017 Christon DeWan #include "xtonhasvim.h" + extern uint8_t user_rgb_mode; extern LED_TYPE shadowed_led[]; -void start_firey_return(void); -#endif //_fancy_lighting_h +#endif //RGBLIGHT_ENABLE +void start_firey_return(void); enum xtonhasvim_rgbmodes { BREATH_FIRE = 1, FADE_BACK }; -#endif //RGBLIGHT_ENABLE +#endif //_fancy_lighting_h diff --git a/users/xtonhasvim/xtonhasvim.h b/users/xtonhasvim/xtonhasvim.h index 5ff4932a4..2d6670a5e 100644 --- a/users/xtonhasvim/xtonhasvim.h +++ b/users/xtonhasvim/xtonhasvim.h @@ -22,11 +22,9 @@ #define X_____X KC_NO -bool process_record_xtonhasvim(uint16_t keycode, keyrecord_t *record); - enum xtonhasvim_keycodes { - DUMMY = SAFE_RANGE, - FIREY_RETURN, // kick off special effects + // 20: give keyboard-specific codes some room + FIREY_RETURN = SAFE_RANGE + 20, // kick off special effects VIM_START, // bookend for vim states VIM_A, VIM_B, -- cgit v1.3.1 From aa795dc33ee1c854a3ea5a3cb3d15e7e68be89d6 Mon Sep 17 00:00:00 2001 From: Xin-Xin Wang Date: Mon, 3 Sep 2018 19:55:06 -0400 Subject: Keymap: Fix missing braces around initializer error on older gcc (#3840) --- users/xtonhasvim/fancylighting.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'users/xtonhasvim') diff --git a/users/xtonhasvim/fancylighting.c b/users/xtonhasvim/fancylighting.c index dc13df03f..a88ca4beb 100644 --- a/users/xtonhasvim/fancylighting.c +++ b/users/xtonhasvim/fancylighting.c @@ -45,7 +45,7 @@ void matrix_scan_keymap(void) { uint16_t effect_start_timer = 0; uint8_t user_rgb_mode = 0; -LED_TYPE shadowed_led[RGBLED_NUM] = {0}; +LED_TYPE shadowed_led[RGBLED_NUM] = {{0}}; void start_firey_return(void) { user_rgb_mode = BREATH_FIRE; @@ -79,7 +79,7 @@ void set_color_for_offsets(uint16_t time_offset, uint16_t space_offset, uint8_t float alpha = (time_progress + 0.1) * 7.0 - space_progress; alpha = fmin(1.0, alpha*alpha); - LED_TYPE px[1] = {0}; + LED_TYPE px[1] = {{0}}; sethsv((uint16_t)(fmod(time_progress * 1.5 + space_progress,1.0)*360), 255, (uint8_t)(progress*255),&px[0]); led[idx].r = alpha * px[0].r + ( 1.0 - alpha) * shadowed_led[idx].r; led[idx].g = alpha * px[0].g + ( 1.0 - alpha) * shadowed_led[idx].g; -- cgit v1.3.1