diff options
Diffstat (limited to 'keyboards/owlab')
23 files changed, 104 insertions, 775 deletions
diff --git a/keyboards/owlab/jelly_epoch/hotswap/config.h b/keyboards/owlab/jelly_epoch/hotswap/config.h index b40244be73..0049e447f9 100644 --- a/keyboards/owlab/jelly_epoch/hotswap/config.h +++ b/keyboards/owlab/jelly_epoch/hotswap/config.h @@ -27,7 +27,3 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. # define RGBLIGHT_EFFECT_SNAKE # define RGBLIGHT_EFFECT_STATIC_GRADIENT # define RGBLIGHT_EFFECT_TWINKLE -# define RGBLED_NUM 24 -# define RGBLIGHT_HUE_STEP 8 -# define RGBLIGHT_SAT_STEP 8 -# define RGBLIGHT_VAL_STEP 10 diff --git a/keyboards/owlab/jelly_epoch/hotswap/info.json b/keyboards/owlab/jelly_epoch/hotswap/info.json index c30c06fb67..b27023fcf4 100644 --- a/keyboards/owlab/jelly_epoch/hotswap/info.json +++ b/keyboards/owlab/jelly_epoch/hotswap/info.json @@ -14,6 +14,11 @@ "rows": ["B0", "B1", "B2", "B3", "A15", "B10"] }, "diode_direction": "COL2ROW", + "rgblight": { + "saturation_steps": 8, + "brightness_steps": 10, + "led_count": 24 + }, "ws2812": { "pin": "B15" }, diff --git a/keyboards/owlab/jelly_epoch/soldered/config.h b/keyboards/owlab/jelly_epoch/soldered/config.h index b40244be73..0049e447f9 100644 --- a/keyboards/owlab/jelly_epoch/soldered/config.h +++ b/keyboards/owlab/jelly_epoch/soldered/config.h @@ -27,7 +27,3 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. # define RGBLIGHT_EFFECT_SNAKE # define RGBLIGHT_EFFECT_STATIC_GRADIENT # define RGBLIGHT_EFFECT_TWINKLE -# define RGBLED_NUM 24 -# define RGBLIGHT_HUE_STEP 8 -# define RGBLIGHT_SAT_STEP 8 -# define RGBLIGHT_VAL_STEP 10 diff --git a/keyboards/owlab/jelly_epoch/soldered/info.json b/keyboards/owlab/jelly_epoch/soldered/info.json index 4c66855d6b..a1d079ce2b 100644 --- a/keyboards/owlab/jelly_epoch/soldered/info.json +++ b/keyboards/owlab/jelly_epoch/soldered/info.json @@ -14,6 +14,11 @@ "rows": ["B0", "B1", "B2", "B3", "A15", "B10"] }, "diode_direction": "COL2ROW", + "rgblight": { + "saturation_steps": 8, + "brightness_steps": 10, + "led_count": 24 + }, "ws2812": { "pin": "B15" }, diff --git a/keyboards/owlab/spring/config.h b/keyboards/owlab/spring/config.h index 15d1e18d0b..2b727f29a0 100644 --- a/keyboards/owlab/spring/config.h +++ b/keyboards/owlab/spring/config.h @@ -28,9 +28,5 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. # define RGBLIGHT_EFFECT_RGB_TEST # define RGBLIGHT_EFFECT_ALTERNATING # define RGBLIGHT_EFFECT_TWINKLE -# define RGBLED_NUM 8 -# define RGBLIGHT_HUE_STEP 8 -# define RGBLIGHT_SAT_STEP 8 -# define RGBLIGHT_VAL_STEP 10 # define RGBLIGHT_DEFAULT_MODE RGBLIGHT_MODE_RAINBOW_SWIRL # define RGBLIGHT_DEFAULT_VAL 127 diff --git a/keyboards/owlab/spring/info.json b/keyboards/owlab/spring/info.json index cdf5143061..df71a94100 100644 --- a/keyboards/owlab/spring/info.json +++ b/keyboards/owlab/spring/info.json @@ -14,6 +14,11 @@ "rows": ["B0", "B7", "D0", "D1", "D2"] }, "diode_direction": "COL2ROW", + "rgblight": { + "saturation_steps": 8, + "brightness_steps": 10, + "led_count": 8 + }, "ws2812": { "pin": "D3" }, diff --git a/keyboards/owlab/spring/spring.c b/keyboards/owlab/spring/spring.c index 8088fb03c2..13280ff9b3 100644 --- a/keyboards/owlab/spring/spring.c +++ b/keyboards/owlab/spring/spring.c @@ -108,7 +108,7 @@ bool process_record_kb(uint16_t keycode, keyrecord_t *record) { case KC_CAPS: - if(IS_LED_ON(host_keyboard_leds(), USB_LED_CAPS_LOCK)){ + if(host_keyboard_led_state().caps_lock){ caps_mode_index = CAPS_MODE_LOWER; } else{ caps_mode_index = CAPS_MODE_UPPER; diff --git a/keyboards/owlab/voice65/hotswap/config.h b/keyboards/owlab/voice65/hotswap/config.h index 17222658f3..89e5bf4345 100644 --- a/keyboards/owlab/voice65/hotswap/config.h +++ b/keyboards/owlab/voice65/hotswap/config.h @@ -27,10 +27,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. # define RGBLIGHT_EFFECT_SNAKE # define RGBLIGHT_EFFECT_STATIC_GRADIENT # define RGBLIGHT_EFFECT_TWINKLE -# define RGBLED_NUM 20 -# define RGBLIGHT_HUE_STEP 8 -# define RGBLIGHT_SAT_STEP 8 -# define RGBLIGHT_VAL_STEP 10 # define OWL_VOLUME_RANGE 50 /* RGB matrix */ @@ -95,5 +91,3 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. # define ENABLE_RGB_MATRIX_SOLID_SPLASH # define ENABLE_RGB_MATRIX_SOLID_MULTISPLASH #endif - -#define TAP_CODE_DELAY 10 diff --git a/keyboards/owlab/voice65/hotswap/hotswap.c b/keyboards/owlab/voice65/hotswap/hotswap.c index 57a216f30a..65c0ee7eed 100644 --- a/keyboards/owlab/voice65/hotswap/hotswap.c +++ b/keyboards/owlab/voice65/hotswap/hotswap.c @@ -14,7 +14,7 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -#include "hotswap.h" +#include "quantum.h" #ifdef RGB_MATRIX_ENABLE const is31_led g_is31_leds[RGB_MATRIX_LED_COUNT] = { @@ -122,329 +122,3 @@ bool rgb_matrix_indicators_kb(void) { } return true; } - -enum encoder_modes{ - ENCODER_MODE_ONE, - ENCODER_MODE_TWO, - ENCODER_MODE_THREE -}; - -keyboard_config_t keyboard_config; -rgblight_config_t rgblight_config; - -uint8_t pre_hue, pre_sat, pre_val; -uint8_t previous_rgb_mode = 0; -uint8_t dir_hue, dir_sat; - -bool encoder_in = false; -uint32_t encoder_timer; - -bool encoder_ani_start= false; -uint32_t encoder_ani_timer = 0; - -bool encoder_direction_start = false; -uint32_t encoder_direction_timer = 0; - - -bool lizm_restart_snake = false; -void rgblight_snake_restart(uint8_t hue, uint8_t sat, uint8_t val){ - lizm_restart_snake = true; // restart signal to local each effect - rgblight_config.hue = hue; - rgblight_config.sat = sat; - rgblight_config.val = val; -} - - -void keyboard_post_init_kb(void){ - keyboard_config.raw = eeconfig_read_kb(); - if( keyboard_config.encoder_mode_index > ENCODER_MODE_THREE ){ - keyboard_config.encoder_mode_index = ENCODER_MODE_ONE; - eeconfig_update_kb(keyboard_config.raw); - } -} - -void switch_encoder_mode(uint8_t mode){ - switch(mode){ - case ENCODER_MODE_ONE: - dir_hue = 88; - dir_sat = 255; - break; - - case ENCODER_MODE_TWO: - dir_hue = 0; - dir_sat = 240; - break; - - case ENCODER_MODE_THREE: - dir_hue = 176; - dir_sat = 255; - break; - } - rgblight_sethsv_noeeprom(dir_hue,dir_sat,pre_val); -} - - -void init_encoder_mode(uint8_t mode){ - previous_rgb_mode = rgblight_get_mode(); - pre_hue = rgblight_get_hue(); - pre_sat = rgblight_get_sat(); - pre_val = rgblight_get_val(); - encoder_in = true; - - rgblight_mode_noeeprom(RGBLIGHT_MODE_STATIC_LIGHT); - - switch_encoder_mode(mode); -} - - -void set_encoder_mode(uint8_t mode){ - if(encoder_in == false){ - init_encoder_mode(mode); - }else{ - switch_encoder_mode(mode); - } - eeconfig_update_kb(keyboard_config.raw); - encoder_timer = timer_read32(); -} - -bool process_record_kb(uint16_t keycode, keyrecord_t *record) { - if (record->event.pressed) { - switch(keycode) { - case RGB_MOD: - case RGB_RMOD: - case RGB_HUI: - case RGB_HUD: - case RGB_SAI: - case RGB_SAD: - case RGB_VAI: - case RGB_VAD: - - if(encoder_in){ - return false; - } - break; - - case KC_F13: - rgb_matrix_toggle(); - break; - - case KC_F14: - rgb_matrix_step(); - break; - - case KC_F15: - rgb_matrix_step_reverse(); - break; - - case KC_F16: - rgb_matrix_increase_hue(); //Increase the hue for effect range LEDs - break; - - case KC_F17: - rgb_matrix_decrease_hue(); //Decrease the hue for effect range LEDs - break; - - case KC_F18: - rgb_matrix_increase_sat(); //Increase the saturation for effect range LEDs - break; - - case KC_F19: - rgb_matrix_decrease_sat(); //Decrease the saturation for effect range LEDs - break; - - case KC_F20: - rgb_matrix_increase_val(); //Increase the value for effect range LEDs - break; - - case KC_F21: - rgb_matrix_decrease_val();//Decrease the value for effect range LEDs - break; - - case KC_F22: //change encoder mode upward - if(!encoder_direction_start){ - if(keyboard_config.encoder_mode_index < ENCODER_MODE_THREE){ - keyboard_config.encoder_mode_index++; - } - else{ - keyboard_config.encoder_mode_index = ENCODER_MODE_ONE; - } - set_encoder_mode(keyboard_config.encoder_mode_index); - } - return false; - case KC_F23: - if(!encoder_direction_start){ - if(keyboard_config.encoder_mode_index > ENCODER_MODE_ONE){ - keyboard_config.encoder_mode_index--; - } - else{ - keyboard_config.encoder_mode_index = ENCODER_MODE_THREE; - } - set_encoder_mode(keyboard_config.encoder_mode_index); - } - return false; - - default: - break; - } - } - return process_record_user(keycode, record); -} - - -void matrix_scan_kb(void) { - if(encoder_in){ - if(timer_elapsed32(encoder_timer) > 5000){ - rgblight_mode(previous_rgb_mode); - rgblight_sethsv(pre_hue, pre_sat, pre_val); - encoder_in = false; - } - } - - if(encoder_ani_start){ - if(timer_elapsed32(encoder_ani_timer) > VOLUME_ANIMATION_TIMER){ - encoder_ani_start = false; - rgblight_sethsv_noeeprom(0,0,0); - } - } - - if(encoder_direction_start){ - if(timer_elapsed32(encoder_direction_timer) > (VOLUME_ANIMATION_TIMER+1500)){ - rgblight_mode_noeeprom(RGBLIGHT_MODE_STATIC_LIGHT); - rgblight_sethsv_noeeprom(dir_hue, dir_sat, pre_val); - encoder_direction_start = false; - } - } - matrix_scan_user(); -} - - -void set_volume_animation(bool increase){ - if(!encoder_ani_start){ - rgblight_snake_restart(dir_hue, dir_sat, pre_val); - } - - if(increase){ - rgblight_mode_noeeprom(17); - } else { - rgblight_mode_noeeprom(18); - } - - encoder_ani_timer = timer_read32(); - encoder_direction_timer = encoder_ani_timer; - encoder_ani_start = true; - encoder_direction_start = true; -} - - -bool encoder_update_kb(uint8_t index, bool clockwise) { - uint8_t layer_now = keyboard_config.encoder_mode_index +1; - uint16_t encoder_cw_keycode = keymap_key_to_keycode(layer_now, (keypos_t){.row=2, .col=1 }); - uint16_t encoder_ccw_keycode = keymap_key_to_keycode(layer_now, (keypos_t){.row=2, .col=2 }); - if (index == 0) { /* First encoder */ - if(encoder_in == false){ - init_encoder_mode(keyboard_config.encoder_mode_index); - } - - if (!clockwise) { - switch(encoder_cw_keycode) { - - case KC_F13: - rgb_matrix_toggle(); - break; - - case KC_F14: - rgb_matrix_step(); - break; - - case KC_F15: - rgb_matrix_step_reverse(); - break; - - case KC_F16: - rgb_matrix_increase_hue(); //Increase the hue for effect range LEDs - break; - - case KC_F17: - rgb_matrix_decrease_hue(); //Decrease the hue for effect range LEDs - break; - - case KC_F18: - rgb_matrix_increase_sat(); //Increase the saturation for effect range LEDs - break; - - case KC_F19: - rgb_matrix_decrease_sat(); //Decrease the saturation for effect range LEDs - break; - - case KC_F20: - rgb_matrix_increase_val(); //Increase the value for effect range LEDs - break; - - case KC_F21: - rgb_matrix_decrease_val();//Decrease the value for effect range LEDs - break; - - case KC_VOLU: - case KC_VOLD: - tap_code(encoder_cw_keycode); - break; - - default: - tap_code(encoder_cw_keycode); - break; - } - set_volume_animation(true); - } else { - switch(encoder_ccw_keycode) { - - case KC_F13: - rgb_matrix_toggle(); - break; - - case KC_F14: - rgb_matrix_step(); - break; - - case KC_F15: - rgb_matrix_step_reverse(); - break; - - case KC_F16: - rgb_matrix_increase_hue(); //Increase the hue for effect range LEDs - break; - - case KC_F17: - rgb_matrix_decrease_hue(); //Decrease the hue for effect range LEDs - break; - - case KC_F18: - rgb_matrix_increase_sat(); //Increase the saturation for effect range LEDs - break; - - case KC_F19: - rgb_matrix_decrease_sat(); //Decrease the saturation for effect range LEDs - break; - - case KC_F20: - rgb_matrix_increase_val(); //Increase the value for effect range LEDs - break; - - case KC_F21: - rgb_matrix_decrease_val();//Decrease the value for effect range LEDs - break; - - case KC_VOLU: - case KC_VOLD: - tap_code(encoder_ccw_keycode); - break; - - default: - tap_code(encoder_ccw_keycode); - break; - } - set_volume_animation(false); - } - encoder_timer = timer_read32(); - } - return true; -} diff --git a/keyboards/owlab/voice65/hotswap/hotswap.h b/keyboards/owlab/voice65/hotswap/hotswap.h deleted file mode 100644 index 6536af4c49..0000000000 --- a/keyboards/owlab/voice65/hotswap/hotswap.h +++ /dev/null @@ -1,30 +0,0 @@ -/* Copyright 2021 kb-elmo<mail@elmo.space> - * - * 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 <http://www.gnu.org/licenses/>. - */ - -#pragma once - -#include "quantum.h" - -typedef union { - uint32_t raw; - struct { - uint8_t encoder_mode_index :8; - }; -} keyboard_config_t; - -extern keyboard_config_t keyboard_config; - -#define VOLUME_ANIMATION_TIMER 580 diff --git a/keyboards/owlab/voice65/hotswap/info.json b/keyboards/owlab/voice65/hotswap/info.json index 6b6474ab68..cf6c2503b6 100644 --- a/keyboards/owlab/voice65/hotswap/info.json +++ b/keyboards/owlab/voice65/hotswap/info.json @@ -22,10 +22,16 @@ {"pin_a": "B4", "pin_b": "B5"} ] }, + "qmk": { + "tap_keycode_delay": 10 + }, "ws2812": { "pin": "B15" }, "rgblight": { + "saturation_steps": 8, + "brightness_steps": 10, + "led_count": 20, "max_brightness": 180 }, "processor": "STM32F303", diff --git a/keyboards/owlab/voice65/hotswap/keymaps/default/keymap.c b/keyboards/owlab/voice65/hotswap/keymaps/default/keymap.c index 055f93e188..5d640c162b 100644 --- a/keyboards/owlab/voice65/hotswap/keymaps/default/keymap.c +++ b/keyboards/owlab/voice65/hotswap/keymaps/default/keymap.c @@ -16,35 +16,44 @@ #include QMK_KEYBOARD_H // How long (in ms) to wait between animation steps for the snake mode -const uint8_t RGBLED_SNAKE_INTERVALS[] PROGMEM = {100, 35, 20}; +const uint8_t RGBLED_SNAKE_INTERVALS[] PROGMEM = {100, 35, 20}; const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [0] = LAYOUT_65_ansi_blocker( - 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, KC_BSPC, KC_DEL, - 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, KC_PGUP, - 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_PGDN, + 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, KC_BSPC, KC_DEL, + 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, KC_PGUP, + 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_PGDN, KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, MO(1), KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT ), [1] = LAYOUT_65_ansi_blocker( 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, KC_TRNS, QK_BOOT, KC_TRNS, RGB_TOG, RGB_MOD, RGB_RMOD,RGB_HUI, RGB_HUD, RGB_SAI, RGB_SAD, RGB_VAI, RGB_VAD, KC_TRNS, KC_TRNS, KC_TRNS, KC_HOME, KC_HOME, - KC_TRNS, KC_VOLU, KC_VOLD, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_END, - KC_TRNS, KC_F13, KC_F14, KC_F15, KC_F16, KC_F17, KC_F18, KC_F19, KC_F20, KC_F21, KC_TRNS, KC_TRNS, KC_F22, KC_TRNS, + KC_TRNS, KC_VOLU, KC_VOLD, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_END, + KC_TRNS, KC_F13, KC_F14, KC_F15, KC_F16, KC_F17, KC_F18, KC_F19, KC_F20, KC_F21, KC_TRNS, KC_TRNS, KC_F22, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_F23, KC_TRNS ), [2] = LAYOUT_65_ansi_blocker( KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_PGUP, KC_PGDN, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS ), [3] = LAYOUT_65_ansi_blocker( KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_WH_U, KC_WH_D, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS ) -};
\ No newline at end of file +}; + +#ifdef ENCODER_MAP_ENABLE +const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][NUM_DIRECTIONS] = { + [0] = { ENCODER_CCW_CW(KC_VOLD, KC_VOLU) }, + [1] = { ENCODER_CCW_CW(KC_PGUP, KC_PGDN) }, + [2] = { ENCODER_CCW_CW(KC_WH_U, KC_WH_D) }, + [3] = { ENCODER_CCW_CW(_______, _______) }, +}; +#endif diff --git a/keyboards/owlab/voice65/hotswap/keymaps/default/rules.mk b/keyboards/owlab/voice65/hotswap/keymaps/default/rules.mk new file mode 100644 index 0000000000..ee32568148 --- /dev/null +++ b/keyboards/owlab/voice65/hotswap/keymaps/default/rules.mk @@ -0,0 +1 @@ +ENCODER_MAP_ENABLE = yes diff --git a/keyboards/owlab/voice65/hotswap/keymaps/via/keymap.c b/keyboards/owlab/voice65/hotswap/keymaps/via/keymap.c index 68801ff2f8..5d640c162b 100644 --- a/keyboards/owlab/voice65/hotswap/keymaps/via/keymap.c +++ b/keyboards/owlab/voice65/hotswap/keymaps/via/keymap.c @@ -16,36 +16,44 @@ #include QMK_KEYBOARD_H // How long (in ms) to wait between animation steps for the snake mode -const uint8_t RGBLED_SNAKE_INTERVALS[] PROGMEM = {100, 35, 20}; +const uint8_t RGBLED_SNAKE_INTERVALS[] PROGMEM = {100, 35, 20}; const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [0] = LAYOUT_65_ansi_blocker( - 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, KC_BSPC, KC_DEL, - 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, KC_PGUP, - 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_PGDN, + 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, KC_BSPC, KC_DEL, + 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, KC_PGUP, + 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_PGDN, KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, MO(1), KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT ), [1] = LAYOUT_65_ansi_blocker( 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, KC_TRNS, QK_BOOT, KC_TRNS, RGB_TOG, RGB_MOD, RGB_RMOD,RGB_HUI, RGB_HUD, RGB_SAI, RGB_SAD, RGB_VAI, RGB_VAD, KC_TRNS, KC_TRNS, KC_TRNS, KC_HOME, KC_HOME, - KC_TRNS, KC_VOLU, KC_VOLD, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_END, - KC_TRNS, KC_F13, KC_F14, KC_F15, KC_F16, KC_F17, KC_F18, KC_F19, KC_F20, KC_F21, KC_TRNS, KC_TRNS, KC_F22, KC_TRNS, + KC_TRNS, KC_VOLU, KC_VOLD, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_END, + KC_TRNS, KC_F13, KC_F14, KC_F15, KC_F16, KC_F17, KC_F18, KC_F19, KC_F20, KC_F21, KC_TRNS, KC_TRNS, KC_F22, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_F23, KC_TRNS ), [2] = LAYOUT_65_ansi_blocker( KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_PGUP, KC_PGDN, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS ), [3] = LAYOUT_65_ansi_blocker( KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_WH_U, KC_WH_D, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS ) }; +#ifdef ENCODER_MAP_ENABLE +const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][NUM_DIRECTIONS] = { + [0] = { ENCODER_CCW_CW(KC_VOLD, KC_VOLU) }, + [1] = { ENCODER_CCW_CW(KC_PGUP, KC_PGDN) }, + [2] = { ENCODER_CCW_CW(KC_WH_U, KC_WH_D) }, + [3] = { ENCODER_CCW_CW(_______, _______) }, +}; +#endif diff --git a/keyboards/owlab/voice65/hotswap/keymaps/via/rules.mk b/keyboards/owlab/voice65/hotswap/keymaps/via/rules.mk index 36b7ba9cbc..1189f4ad19 100644 --- a/keyboards/owlab/voice65/hotswap/keymaps/via/rules.mk +++ b/keyboards/owlab/voice65/hotswap/keymaps/via/rules.mk @@ -1,2 +1,3 @@ VIA_ENABLE = yes LTO_ENABLE = yes +ENCODER_MAP_ENABLE = yes diff --git a/keyboards/owlab/voice65/soldered/config.h b/keyboards/owlab/voice65/soldered/config.h index 6f41edccd0..ee882b0d41 100644 --- a/keyboards/owlab/voice65/soldered/config.h +++ b/keyboards/owlab/voice65/soldered/config.h @@ -27,10 +27,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. # define RGBLIGHT_EFFECT_SNAKE # define RGBLIGHT_EFFECT_STATIC_GRADIENT # define RGBLIGHT_EFFECT_TWINKLE -# define RGBLED_NUM 20 -# define RGBLIGHT_HUE_STEP 8 -# define RGBLIGHT_SAT_STEP 8 -# define RGBLIGHT_VAL_STEP 10 # define OWL_VOLUME_RANGE 50 /* RGB matrix*/ @@ -96,5 +92,3 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. # define ENABLE_RGB_MATRIX_SOLID_SPLASH # define ENABLE_RGB_MATRIX_SOLID_MULTISPLASH #endif - -#define TAP_CODE_DELAY 10 diff --git a/keyboards/owlab/voice65/soldered/info.json b/keyboards/owlab/voice65/soldered/info.json index 3b38b45da4..7e9d0be514 100644 --- a/keyboards/owlab/voice65/soldered/info.json +++ b/keyboards/owlab/voice65/soldered/info.json @@ -22,10 +22,16 @@ {"pin_a": "B4", "pin_b": "B5"} ] }, + "qmk": { + "tap_keycode_delay": 10 + }, "ws2812": { "pin": "B15" }, "rgblight": { + "saturation_steps": 8, + "brightness_steps": 10, + "led_count": 20, "max_brightness": 180 }, "processor": "STM32F303", diff --git a/keyboards/owlab/voice65/soldered/keymaps/default/keymap.c b/keyboards/owlab/voice65/soldered/keymaps/default/keymap.c index 055f93e188..5d640c162b 100644 --- a/keyboards/owlab/voice65/soldered/keymaps/default/keymap.c +++ b/keyboards/owlab/voice65/soldered/keymaps/default/keymap.c @@ -16,35 +16,44 @@ #include QMK_KEYBOARD_H // How long (in ms) to wait between animation steps for the snake mode -const uint8_t RGBLED_SNAKE_INTERVALS[] PROGMEM = {100, 35, 20}; +const uint8_t RGBLED_SNAKE_INTERVALS[] PROGMEM = {100, 35, 20}; const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [0] = LAYOUT_65_ansi_blocker( - 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, KC_BSPC, KC_DEL, - 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, KC_PGUP, - 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_PGDN, + 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, KC_BSPC, KC_DEL, + 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, KC_PGUP, + 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_PGDN, KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, MO(1), KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT ), [1] = LAYOUT_65_ansi_blocker( 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, KC_TRNS, QK_BOOT, KC_TRNS, RGB_TOG, RGB_MOD, RGB_RMOD,RGB_HUI, RGB_HUD, RGB_SAI, RGB_SAD, RGB_VAI, RGB_VAD, KC_TRNS, KC_TRNS, KC_TRNS, KC_HOME, KC_HOME, - KC_TRNS, KC_VOLU, KC_VOLD, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_END, - KC_TRNS, KC_F13, KC_F14, KC_F15, KC_F16, KC_F17, KC_F18, KC_F19, KC_F20, KC_F21, KC_TRNS, KC_TRNS, KC_F22, KC_TRNS, + KC_TRNS, KC_VOLU, KC_VOLD, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_END, + KC_TRNS, KC_F13, KC_F14, KC_F15, KC_F16, KC_F17, KC_F18, KC_F19, KC_F20, KC_F21, KC_TRNS, KC_TRNS, KC_F22, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_F23, KC_TRNS ), [2] = LAYOUT_65_ansi_blocker( KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_PGUP, KC_PGDN, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS ), [3] = LAYOUT_65_ansi_blocker( KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_WH_U, KC_WH_D, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS ) -};
\ No newline at end of file +}; + +#ifdef ENCODER_MAP_ENABLE +const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][NUM_DIRECTIONS] = { + [0] = { ENCODER_CCW_CW(KC_VOLD, KC_VOLU) }, + [1] = { ENCODER_CCW_CW(KC_PGUP, KC_PGDN) }, + [2] = { ENCODER_CCW_CW(KC_WH_U, KC_WH_D) }, + [3] = { ENCODER_CCW_CW(_______, _______) }, +}; +#endif diff --git a/keyboards/owlab/voice65/soldered/keymaps/default/rules.mk b/keyboards/owlab/voice65/soldered/keymaps/default/rules.mk new file mode 100644 index 0000000000..ee32568148 --- /dev/null +++ b/keyboards/owlab/voice65/soldered/keymaps/default/rules.mk @@ -0,0 +1 @@ +ENCODER_MAP_ENABLE = yes diff --git a/keyboards/owlab/voice65/soldered/keymaps/via/keymap.c b/keyboards/owlab/voice65/soldered/keymaps/via/keymap.c index 055f93e188..5d640c162b 100644 --- a/keyboards/owlab/voice65/soldered/keymaps/via/keymap.c +++ b/keyboards/owlab/voice65/soldered/keymaps/via/keymap.c @@ -16,35 +16,44 @@ #include QMK_KEYBOARD_H // How long (in ms) to wait between animation steps for the snake mode -const uint8_t RGBLED_SNAKE_INTERVALS[] PROGMEM = {100, 35, 20}; +const uint8_t RGBLED_SNAKE_INTERVALS[] PROGMEM = {100, 35, 20}; const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [0] = LAYOUT_65_ansi_blocker( - 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, KC_BSPC, KC_DEL, - 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, KC_PGUP, - 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_PGDN, + 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, KC_BSPC, KC_DEL, + 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, KC_PGUP, + 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_PGDN, KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, MO(1), KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT ), [1] = LAYOUT_65_ansi_blocker( 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, KC_TRNS, QK_BOOT, KC_TRNS, RGB_TOG, RGB_MOD, RGB_RMOD,RGB_HUI, RGB_HUD, RGB_SAI, RGB_SAD, RGB_VAI, RGB_VAD, KC_TRNS, KC_TRNS, KC_TRNS, KC_HOME, KC_HOME, - KC_TRNS, KC_VOLU, KC_VOLD, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_END, - KC_TRNS, KC_F13, KC_F14, KC_F15, KC_F16, KC_F17, KC_F18, KC_F19, KC_F20, KC_F21, KC_TRNS, KC_TRNS, KC_F22, KC_TRNS, + KC_TRNS, KC_VOLU, KC_VOLD, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_END, + KC_TRNS, KC_F13, KC_F14, KC_F15, KC_F16, KC_F17, KC_F18, KC_F19, KC_F20, KC_F21, KC_TRNS, KC_TRNS, KC_F22, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_F23, KC_TRNS ), [2] = LAYOUT_65_ansi_blocker( KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_PGUP, KC_PGDN, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS ), [3] = LAYOUT_65_ansi_blocker( KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_WH_U, KC_WH_D, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS ) -};
\ No newline at end of file +}; + +#ifdef ENCODER_MAP_ENABLE +const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][NUM_DIRECTIONS] = { + [0] = { ENCODER_CCW_CW(KC_VOLD, KC_VOLU) }, + [1] = { ENCODER_CCW_CW(KC_PGUP, KC_PGDN) }, + [2] = { ENCODER_CCW_CW(KC_WH_U, KC_WH_D) }, + [3] = { ENCODER_CCW_CW(_______, _______) }, +}; +#endif diff --git a/keyboards/owlab/voice65/soldered/keymaps/via/rules.mk b/keyboards/owlab/voice65/soldered/keymaps/via/rules.mk index 36b7ba9cbc..1189f4ad19 100644 --- a/keyboards/owlab/voice65/soldered/keymaps/via/rules.mk +++ b/keyboards/owlab/voice65/soldered/keymaps/via/rules.mk @@ -1,2 +1,3 @@ VIA_ENABLE = yes LTO_ENABLE = yes +ENCODER_MAP_ENABLE = yes diff --git a/keyboards/owlab/voice65/soldered/soldered.c b/keyboards/owlab/voice65/soldered/soldered.c index cfdaaad4ae..1444b05864 100644 --- a/keyboards/owlab/voice65/soldered/soldered.c +++ b/keyboards/owlab/voice65/soldered/soldered.c @@ -14,7 +14,7 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -#include "soldered.h" +#include "quantum.h" #ifdef RGB_MATRIX_ENABLE const is31_led g_is31_leds[RGB_MATRIX_LED_COUNT] = { @@ -126,330 +126,3 @@ bool rgb_matrix_indicators_kb(void) { } return true; } - -enum encoder_modes{ - ENCODER_MODE_ONE, - ENCODER_MODE_TWO, - ENCODER_MODE_THREE -}; - -keyboard_config_t keyboard_config; -rgblight_config_t rgblight_config; - -uint8_t pre_hue, pre_sat, pre_val; -uint8_t previous_rgb_mode = 0; -uint8_t dir_hue, dir_sat; - -bool encoder_in = false; -uint32_t encoder_timer; - -bool encoder_ani_start= false; -uint32_t encoder_ani_timer = 0; - -bool encoder_direction_start = false; -uint32_t encoder_direction_timer = 0; - - -bool lizm_restart_snake = false; -void rgblight_snake_restart(uint8_t hue, uint8_t sat, uint8_t val){ - lizm_restart_snake = true; // restart signal to local each effect - rgblight_config.hue = hue; - rgblight_config.sat = sat; - rgblight_config.val = val; -} - - -void keyboard_post_init_kb(void){ - keyboard_config.raw = eeconfig_read_kb(); - if( keyboard_config.encoder_mode_index > ENCODER_MODE_THREE ){ - keyboard_config.encoder_mode_index = ENCODER_MODE_ONE; - eeconfig_update_kb(keyboard_config.raw); - } -} - -void switch_encoder_mode(uint8_t mode){ - switch(mode){ - case ENCODER_MODE_ONE: - dir_hue = 88; - dir_sat = 255; - break; - - case ENCODER_MODE_TWO: - dir_hue = 0; - dir_sat = 240; - break; - - case ENCODER_MODE_THREE: - dir_hue = 176; - dir_sat = 255; - break; - } - rgblight_sethsv_noeeprom(dir_hue,dir_sat,pre_val); -} - - -void init_encoder_mode(uint8_t mode){ - previous_rgb_mode = rgblight_get_mode(); - pre_hue = rgblight_get_hue(); - pre_sat = rgblight_get_sat(); - pre_val = rgblight_get_val(); - encoder_in = true; - - rgblight_mode_noeeprom(RGBLIGHT_MODE_STATIC_LIGHT); - - switch_encoder_mode(mode); -} - - -void set_encoder_mode(uint8_t mode){ - if(encoder_in == false){ - init_encoder_mode(mode); - }else{ - switch_encoder_mode(mode); - } - eeconfig_update_kb(keyboard_config.raw); - encoder_timer = timer_read32(); -} - -bool process_record_kb(uint16_t keycode, keyrecord_t *record) { - if (record->event.pressed) { - switch(keycode) { - case RGB_MOD: - case RGB_RMOD: - case RGB_HUI: - case RGB_HUD: - case RGB_SAI: - case RGB_SAD: - case RGB_VAI: - case RGB_VAD: - - if(encoder_in){ - return false; - } - break; - - case KC_F13: - rgb_matrix_toggle(); - break; - - case KC_F14: - rgb_matrix_step(); - break; - - case KC_F15: - rgb_matrix_step_reverse(); - break; - - case KC_F16: - rgb_matrix_increase_hue(); //Increase the hue for effect range LEDs - break; - - case KC_F17: - rgb_matrix_decrease_hue(); //Decrease the hue for effect range LEDs - break; - - case KC_F18: - rgb_matrix_increase_sat(); //Increase the saturation for effect range LEDs - break; - - case KC_F19: - rgb_matrix_decrease_sat(); //Decrease the saturation for effect range LEDs - break; - - case KC_F20: - rgb_matrix_increase_val(); //Increase the value for effect range LEDs - break; - - case KC_F21: - rgb_matrix_decrease_val();//Decrease the value for effect range LEDs - break; - - case KC_F22: //change encoder mode upward - if(!encoder_direction_start){ - if(keyboard_config.encoder_mode_index < ENCODER_MODE_THREE){ - keyboard_config.encoder_mode_index++; - } - else{ - keyboard_config.encoder_mode_index = ENCODER_MODE_ONE; - } - set_encoder_mode(keyboard_config.encoder_mode_index); - } - return false; - - case KC_F23: - if(!encoder_direction_start){ - if(keyboard_config.encoder_mode_index > ENCODER_MODE_ONE){ - keyboard_config.encoder_mode_index--; - } - else{ - keyboard_config.encoder_mode_index = ENCODER_MODE_THREE; - } - set_encoder_mode(keyboard_config.encoder_mode_index); - } - return false; - - default: - break; - } - } - return process_record_user(keycode, record); -} - - -void matrix_scan_kb(void) { - if(encoder_in){ - if(timer_elapsed32(encoder_timer) > 5000){ - rgblight_mode(previous_rgb_mode); - rgblight_sethsv(pre_hue, pre_sat, pre_val); - encoder_in = false; - } - } - - if(encoder_ani_start){ - if(timer_elapsed32(encoder_ani_timer) > VOLUME_ANIMATION_TIMER){ - encoder_ani_start = false; - rgblight_sethsv_noeeprom(0,0,0); - } - } - - if(encoder_direction_start){ - if(timer_elapsed32(encoder_direction_timer) > (VOLUME_ANIMATION_TIMER+1500)){ - rgblight_mode_noeeprom(RGBLIGHT_MODE_STATIC_LIGHT); - rgblight_sethsv_noeeprom(dir_hue, dir_sat, pre_val); - encoder_direction_start = false; - } - } - matrix_scan_user(); -} - - -void set_volume_animation(bool increase){ - if(!encoder_ani_start){ - rgblight_snake_restart(dir_hue, dir_sat, pre_val); - } - - if(increase){ - rgblight_mode_noeeprom(17); - } else { - rgblight_mode_noeeprom(18); - } - - encoder_ani_timer = timer_read32(); - encoder_direction_timer = encoder_ani_timer; - encoder_ani_start = true; - encoder_direction_start = true; -} - - -bool encoder_update_kb(uint8_t index, bool clockwise) { - uint8_t layer_now = keyboard_config.encoder_mode_index +1; - uint16_t encoder_cw_keycode = keymap_key_to_keycode(layer_now, (keypos_t){.row=2, .col=1 }); - uint16_t encoder_ccw_keycode = keymap_key_to_keycode(layer_now, (keypos_t){.row=2, .col=2 }); - if (index == 0) { /* First encoder */ - if(encoder_in == false){ - init_encoder_mode(keyboard_config.encoder_mode_index); - } - - if (!clockwise) { - switch(encoder_cw_keycode) { - - case KC_F13: - rgb_matrix_toggle(); - break; - - case KC_F14: - rgb_matrix_step(); - break; - - case KC_F15: - rgb_matrix_step_reverse(); - break; - - case KC_F16: - rgb_matrix_increase_hue(); //Increase the hue for effect range LEDs - break; - - case KC_F17: - rgb_matrix_decrease_hue(); //Decrease the hue for effect range LEDs - break; - - case KC_F18: - rgb_matrix_increase_sat(); //Increase the saturation for effect range LEDs - break; - - case KC_F19: - rgb_matrix_decrease_sat(); //Decrease the saturation for effect range LEDs - break; - - case KC_F20: - rgb_matrix_increase_val(); //Increase the value for effect range LEDs - break; - - case KC_F21: - rgb_matrix_decrease_val();//Decrease the value for effect range LEDs - break; - - case KC_VOLU: - case KC_VOLD: - tap_code(encoder_cw_keycode); - break; - - default: - tap_code(encoder_cw_keycode); - break; - } - set_volume_animation(true); - } else { - switch(encoder_ccw_keycode) { - - case KC_F13: - rgb_matrix_toggle(); - break; - - case KC_F14: - rgb_matrix_step(); - break; - - case KC_F15: - rgb_matrix_step_reverse(); - break; - - case KC_F16: - rgb_matrix_increase_hue(); //Increase the hue for effect range LEDs - break; - - case KC_F17: - rgb_matrix_decrease_hue(); //Decrease the hue for effect range LEDs - break; - - case KC_F18: - rgb_matrix_increase_sat(); //Increase the saturation for effect range LEDs - break; - - case KC_F19: - rgb_matrix_decrease_sat(); //Decrease the saturation for effect range LEDs - break; - - case KC_F20: - rgb_matrix_increase_val(); //Increase the value for effect range LEDs - break; - - case KC_F21: - rgb_matrix_decrease_val();//Decrease the value for effect range LEDs - break; - - case KC_VOLU: - case KC_VOLD: - tap_code(encoder_ccw_keycode); - break; - - default: - tap_code(encoder_ccw_keycode); - break; - } - set_volume_animation(false); - } - encoder_timer = timer_read32(); - } - return true; -} diff --git a/keyboards/owlab/voice65/soldered/soldered.h b/keyboards/owlab/voice65/soldered/soldered.h deleted file mode 100644 index 2c10428cec..0000000000 --- a/keyboards/owlab/voice65/soldered/soldered.h +++ /dev/null @@ -1,30 +0,0 @@ -/* Copyright 2021 kb-elmo<mail@elmo.space> - * - * 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 <http://www.gnu.org/licenses/>. - */ - -#pragma once - -#include "quantum.h" - -typedef union { - uint32_t raw; - struct { - uint8_t encoder_mode_index :8; - }; -} keyboard_config_t; - -extern keyboard_config_t keyboard_config; - -#define VOLUME_ANIMATION_TIMER 580 |