diff options
author | lokher <lokher@gmail.com> | 2022-12-06 17:04:10 +0800 |
---|---|---|
committer | lokher <lokher@gmail.com> | 2022-12-06 17:04:10 +0800 |
commit | 27fc28fd2ff52e079a5bc58d6aaea4c752420615 (patch) | |
tree | 7ac943fb1ba4f430a7220efd18f66f6a77205c30 /keyboards/rgbkb/pan | |
parent | e736133392fe6427cfb995da0787337189828272 (diff) | |
parent | 2709b6ed616f8012ff4cfd3ee69a822a8d188351 (diff) |
Merge upstream master
Diffstat (limited to 'keyboards/rgbkb/pan')
-rw-r--r-- | keyboards/rgbkb/pan/config.h | 95 | ||||
-rw-r--r-- | keyboards/rgbkb/pan/keymaps/default/keymap.c | 120 | ||||
-rw-r--r-- | keyboards/rgbkb/pan/pan.c | 135 |
3 files changed, 350 insertions, 0 deletions
diff --git a/keyboards/rgbkb/pan/config.h b/keyboards/rgbkb/pan/config.h new file mode 100644 index 0000000000..bb856bc1f9 --- /dev/null +++ b/keyboards/rgbkb/pan/config.h @@ -0,0 +1,95 @@ +/*Copyright 2020 RGBKB + +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 "config_common.h" + +/* key matrix size */ +#define MATRIX_ROWS 5 +#define MATRIX_COLS 13 + +#define ENCODER_RESOLUTION 4 +#define RGBLED_NUM 64 +#define RGBLIGHT_EFFECT_BREATHING +#define RGBLIGHT_EFFECT_RAINBOW_MOOD +#define RGBLIGHT_EFFECT_RAINBOW_SWIRL +#define RGBLIGHT_EFFECT_SNAKE +#define RGBLIGHT_EFFECT_KNIGHT +#define RGBLIGHT_EFFECT_CHRISTMAS +#define RGBLIGHT_EFFECT_STATIC_GRADIENT +#define RGBLIGHT_EFFECT_RGB_TEST +#define RGBLIGHT_EFFECT_ALTERNATING +#define RGBLIGHT_EFFECT_TWINKLE +#define RGB_MATRIX_LED_COUNT RGBLED_NUM + +/* COL2ROW, ROW2COL*/ +#define DIODE_DIRECTION COL2ROW + +#define RGBLIGHT_LIMIT_VAL 120 +#define USB_MAX_POWER_CONSUMPTION 500 + +// RGB Matrix Animation modes. Explicitly enabled +// For full list of effects, see: +// https://docs.qmk.fm/#/feature_rgb_matrix?id=rgb-matrix-effects +#define ENABLE_RGB_MATRIX_ALPHAS_MODS +#define ENABLE_RGB_MATRIX_GRADIENT_UP_DOWN +#define ENABLE_RGB_MATRIX_GRADIENT_LEFT_RIGHT +#define ENABLE_RGB_MATRIX_BREATHING +#define ENABLE_RGB_MATRIX_BAND_SAT +#define ENABLE_RGB_MATRIX_BAND_VAL +#define ENABLE_RGB_MATRIX_BAND_PINWHEEL_SAT +#define ENABLE_RGB_MATRIX_BAND_PINWHEEL_VAL +#define ENABLE_RGB_MATRIX_BAND_SPIRAL_SAT +#define ENABLE_RGB_MATRIX_BAND_SPIRAL_VAL +#define ENABLE_RGB_MATRIX_CYCLE_ALL +#define ENABLE_RGB_MATRIX_CYCLE_LEFT_RIGHT +#define ENABLE_RGB_MATRIX_CYCLE_UP_DOWN +#define ENABLE_RGB_MATRIX_RAINBOW_MOVING_CHEVRON +#define ENABLE_RGB_MATRIX_CYCLE_OUT_IN +#define ENABLE_RGB_MATRIX_CYCLE_OUT_IN_DUAL +#define ENABLE_RGB_MATRIX_CYCLE_PINWHEEL +#define ENABLE_RGB_MATRIX_CYCLE_SPIRAL +#define ENABLE_RGB_MATRIX_DUAL_BEACON +#define ENABLE_RGB_MATRIX_RAINBOW_BEACON +#define ENABLE_RGB_MATRIX_RAINBOW_PINWHEELS +#define ENABLE_RGB_MATRIX_RAINDROPS +#define ENABLE_RGB_MATRIX_JELLYBEAN_RAINDROPS +#define ENABLE_RGB_MATRIX_HUE_BREATHING +#define ENABLE_RGB_MATRIX_HUE_PENDULUM +#define ENABLE_RGB_MATRIX_HUE_WAVE +#define ENABLE_RGB_MATRIX_PIXEL_RAIN +#define ENABLE_RGB_MATRIX_PIXEL_FLOW +#define ENABLE_RGB_MATRIX_PIXEL_FRACTAL +// enabled only if RGB_MATRIX_FRAMEBUFFER_EFFECTS is defined +#define ENABLE_RGB_MATRIX_TYPING_HEATMAP +#define ENABLE_RGB_MATRIX_DIGITAL_RAIN +// enabled only of RGB_MATRIX_KEYPRESSES or RGB_MATRIX_KEYRELEASES is defined +#define ENABLE_RGB_MATRIX_SOLID_REACTIVE_SIMPLE +#define ENABLE_RGB_MATRIX_SOLID_REACTIVE +#define ENABLE_RGB_MATRIX_SOLID_REACTIVE_WIDE +#define ENABLE_RGB_MATRIX_SOLID_REACTIVE_MULTIWIDE +#define ENABLE_RGB_MATRIX_SOLID_REACTIVE_CROSS +#define ENABLE_RGB_MATRIX_SOLID_REACTIVE_MULTICROSS +#define ENABLE_RGB_MATRIX_SOLID_REACTIVE_NEXUS +#define ENABLE_RGB_MATRIX_SOLID_REACTIVE_MULTINEXUS +#define ENABLE_RGB_MATRIX_SPLASH +#define ENABLE_RGB_MATRIX_MULTISPLASH +#define ENABLE_RGB_MATRIX_SOLID_SPLASH +#define ENABLE_RGB_MATRIX_SOLID_MULTISPLASH + +/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */ +#define DEBOUNCE 5 diff --git a/keyboards/rgbkb/pan/keymaps/default/keymap.c b/keyboards/rgbkb/pan/keymaps/default/keymap.c new file mode 100644 index 0000000000..367aadbb4b --- /dev/null +++ b/keyboards/rgbkb/pan/keymaps/default/keymap.c @@ -0,0 +1,120 @@ + /* Copyright 2020 RGBKB + * + * 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/>. + */ +// Each layer gets a name for readability, which is then used in the keymap matrix below. +// The underscores don't mean anything - you can have a layer called STUFF or any other name. +// Layer names don't all need to be of the same length, obviously, and you can also skip them +// entirely and just use numbers. +#include QMK_KEYBOARD_H + +enum layer_number { + _QWERTY, + _COLEMAK, + _FN, + _ADJ +}; + +#define FN_ESC LT(_FN, KC_ESC) +#define FN_CAPS LT(_FN, KC_CAPS) +#define QWERTY DF(_QWERTY) +#define COLEMAK DF(_COLEMAK) + + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [_QWERTY] = LAYOUT_all( + KC_NO, KC_NO, + QK_GESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, 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_BSLS, + FN_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_ENT, + KC_LSFT, KC_BSLS, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, SC_RSPC, + KC_LCTL, KC_LGUI, KC_LALT, RGB_TOG, MO(_ADJ),KC_SPC, KC_SPC, MO(_FN), KC_LEFT, KC_DOWN, KC_UP, KC_RIGHT + ), + + [_COLEMAK] = LAYOUT_all( + KC_NO, KC_NO, + QK_GESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC, KC_DEL, + KC_TAB, KC_Q, KC_W, KC_F, KC_P, KC_G, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_BSLS, + FN_CAPS, KC_A, KC_R, KC_S, KC_T, KC_D, KC_H, KC_N, KC_E, KC_I, KC_O, KC_ENT, + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, SC_RSPC, KC_ENT, + KC_LCTL, KC_LGUI, KC_LALT, RGB_TOG, MO(_ADJ),KC_SPC, KC_SPC, MO(_FN), KC_LEFT, KC_DOWN, KC_UP, KC_RIGHT + ), + + [_FN] = LAYOUT_all( + KC_NO, KC_NO, + 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_PSCR, + _______, KC_PGDN, KC_UP, KC_PGUP, _______, _______, _______, KC_PGDN, KC_UP, KC_PGUP, KC_PSCR, KC_HOME, + _______, KC_LEFT, KC_DOWN, KC_RGHT, _______, _______, _______, KC_LEFT, KC_DOWN, KC_RGHT, KC_INS, KC_END, + _______, _______, _______, _______, _______, _______, _______, KC_LBRC, _______, KC_RBRC, _______, _______, _______, + _______, _______, _______, RGB_MOD, _______, _______, _______, _______, _______, _______, _______, _______ + ), + + [_ADJ] = LAYOUT_all( + KC_NO, KC_NO, + 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_PSCR, + _______, RGB_SAD, RGB_VAI, RGB_SAI, QK_BOOT, _______, _______, KC_P7, KC_P8, KC_P9, _______, _______, + _______, RGB_HUD, RGB_VAD, RGB_HUI, _______, _______, _______, KC_P4, KC_P5, KC_P6, _______, _______, + _______, RGB_SPD, _______, RGB_SPI, _______, _______, _______, KC_P1, KC_P2, KC_P3, _______, _______, _______, + _______, _______, _______, RGB_MOD, _______, _______, _______, KC_P0, KC_PDOT, KC_NUM, _QWERTY, _COLEMAK + ) +}; + +#ifdef OLED_ENABLE +bool oled_task_user(void) { + // Host Keyboard Layer Status + oled_write_P(PSTR("RGBKB Pan\n"), false); + oled_write_P(PSTR("Layer: "), false); + uint8_t layer = get_highest_layer(layer_state|default_layer_state); + switch (layer) { + case _QWERTY: + oled_write_P(PSTR("Default\n"), false); + break; + case _COLEMAK: + oled_write_P(PSTR("Colemak\n"), false); + break; + case _FN: + oled_write_P(PSTR("Function\n"), false); + break; + case _ADJ: + oled_write_P(PSTR("Adjust\n"), false); + break; + default: + oled_write_P(PSTR("Undefined\n"), false); + // Or use the write_ln shortcut over adding '\n' to the end of your string + //oled_write_ln_P(PSTR("Undefined"), false); + } + led_t led_state = host_keyboard_led_state(); + oled_write_P(led_state.num_lock ? PSTR("Numlock On\n") : PSTR(" \n"), false); + oled_write_P(led_state.caps_lock ? PSTR("Capslock On \n") : PSTR(" \n"), false); + + return false; +} +#endif + +bool encoder_update_user(uint8_t index, bool clockwise) { + if (index == 0) { // First encoder - right + if (clockwise) { + tap_code(KC_VOLU); + } else { + tap_code(KC_VOLD); + } + } else if (index == 1) { // Second encoder - left + if (clockwise) { + tap_code(KC_VOLU); + } else { + tap_code(KC_VOLD); + } + } + return true; +} diff --git a/keyboards/rgbkb/pan/pan.c b/keyboards/rgbkb/pan/pan.c new file mode 100644 index 0000000000..f0194ebdfd --- /dev/null +++ b/keyboards/rgbkb/pan/pan.c @@ -0,0 +1,135 @@ +/* Copyright 2020 RGBKB + * + * 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/>. + */ +#include "pan.h" +#include "quantum.h" +#include "rgb_matrix_types.h" + +#if defined RGB_MATRIX_ENABLE +# if defined(KEYBOARD_rgbkb_pan_rev1) +# include "ws2812.h" + +// LED color buffer +LED_TYPE rgb_matrix_ws2812_array[RGB_MATRIX_LED_COUNT]; + +static void init(void) {} + +static void flush(void) { + // Assumes use of RGB_DI_PIN + ws2812_setleds(rgb_matrix_ws2812_array, RGB_MATRIX_LED_COUNT); +} + +// Set an led in the buffer to a color +static inline void setled(int i, uint8_t r, uint8_t g, uint8_t b) { +# if defined(RGB_ENCODERS) || defined(STAGGERED_RGB_ENCODERS) + if (i == 0 || i == 1) { // if encoder LEDs, change LEDs + rgb_matrix_ws2812_array[i].r = g; + rgb_matrix_ws2812_array[i].g = b; + rgb_matrix_ws2812_array[i].b = r; + } else +# endif + { + rgb_matrix_ws2812_array[i].r = r; + rgb_matrix_ws2812_array[i].g = g; + rgb_matrix_ws2812_array[i].b = b; + } +# ifdef RGBW + convert_rgb_to_rgbw(&rgb_matrix_ws2812_array[i]); +# endif +} + +static void setled_all(uint8_t r, uint8_t g, uint8_t b) { + for (int i = 0; i < ARRAY_SIZE(rgb_matrix_ws2812_array); i++) { + setled(i, r, g, b); + } +} + +const rgb_matrix_driver_t rgb_matrix_driver = { + .init = init, + .flush = flush, + .set_color = setled, + .set_color_all = setled_all, +}; +# endif + +// clang-format off + led_config_t g_led_config = { { + { 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14 }, + { 0, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15 }, + { 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 1 }, + { 52, 51, 50, 49, 48, 47, 46, 45, 44, 43, 42, 41, 40 }, + { 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, NO_LED } + }, { +# ifdef STAGGERED_RGB_ENCODERS + {0, -19},{228, -19}, + {0, 0}, {14, 0}, {33, 0}, {52, 0}, {71, 0}, {90, 0}, {109, 0}, {128, 0}, {147, 0}, {166, 0}, {185, 0}, {204, 0}, {223, 0}, + {209, 19}, {190, 19}, {171, 19}, {152, 19}, {133, 19}, {114, 19}, {95, 19}, {76, 19}, {57, 19}, {38, 19}, {19, 19}, {0, 19}, + {0, 38}, {19, 38}, {38, 38}, {57, 38}, {76, 38}, {95, 38}, {114, 38}, {133, 38}, {152, 38}, {171, 38}, {190, 38}, {209, 38}, + {223, 57}, {204, 57}, {185, 57}, {171, 57}, {147, 57}, {128, 57}, {109, 57}, {90, 57}, {71, 57}, {52, 57}, {33, 57}, {14, 57}, {0, 57}, + {0, 76}, {19, 76}, {38, 76}, {57, 76}, {76, 76}, {95, 76}, {114, 76}, {133, 76}, {152, 76}, {171, 76}, {190, 76}, {209, 76}, +# elif defined RGB_ENCODERS + {0, -19},{228, -19}, + {0, 0}, {19, 0}, {38, 0}, {57, 0}, {76, 0}, {95, 0}, {114, 0}, {133, 0}, {152, 0}, {171, 0}, {190, 0}, {209, 0}, + {209, 19}, {190, 19}, {171, 19}, {152, 19}, {133, 19}, {114, 19}, {95, 19}, {76, 19}, {57, 19}, {38, 19}, {19, 19}, {0, 19}, + {0, 38}, {19, 38}, {38, 38}, {57, 38}, {76, 38}, {95, 38}, {114, 38}, {133, 38}, {152, 38}, {171, 38}, {190, 38}, {209, 38}, + {209, 57}, {190, 57}, {171, 57}, {152, 57}, {133, 57}, {114, 57}, {95, 57}, {76, 57}, {57, 57}, {38, 57}, {19, 57}, {0, 57}, + {0, 76}, {19, 76}, {38, 76}, {57, 76}, {76, 76}, {95, 76}, {114, 76}, {133, 76}, {152, 76}, {171, 76}, {190, 76}, {209, 76}, + {0, 95},{19, 95}, //not used +# elif defined STAGGERED_LAYOUT + {0, 0}, {19, 0}, {38, 0}, {57, 0}, {76, 0}, {95, 0}, {114, 0}, {133, 0}, {152, 0}, {171, 0}, {190, 0}, {209, 0}, {0, 0}, + {209, 19}, {190, 19}, {171, 19}, {152, 19}, {133, 19}, {114, 19}, {95, 19}, {76, 19}, {57, 19}, {38, 19}, {19, 19}, {0, 19}, + {0, 38}, {19, 38}, {38, 38}, {57, 38}, {76, 38}, {95, 38}, {114, 38}, {133, 38}, {152, 38}, {171, 38}, {190, 38}, {209, 38}, + {209, 57}, {190, 57}, {171, 57}, {152, 57}, {133, 57}, {114, 57}, {95, 57}, {76, 57}, {57, 57}, {38, 57}, {19, 57}, {0, 57}, {0, 0}, + {0, 76}, {19, 76}, {38, 76}, {57, 76}, {76, 76}, {95, 76}, {114, 76}, {133, 76}, {152, 76}, {171, 76}, {190, 76}, {209, 76}, + {0, 95},{19, 95},//not used +# else + {0, 0}, {19, 0}, {38, 0}, {57, 0}, {76, 0}, {95, 0}, {114, 0}, {133, 0}, {152, 0}, {171, 0}, {190, 0}, {209, 0}, + {209, 19}, {190, 19}, {171, 19}, {152, 19}, {133, 19}, {114, 19}, {95, 19}, {76, 19}, {57, 19}, {38, 19}, {19, 19}, {0, 19}, + {0, 38}, {19, 38}, {38, 38}, {57, 38}, {76, 38}, {95, 38}, {114, 38}, {133, 38}, {152, 38}, {171, 38}, {190, 38}, {209, 38}, + {209, 57}, {190, 57}, {171, 57}, {152, 57}, {133, 57}, {114, 57}, {95, 57}, {76, 57}, {57, 57}, {38, 57}, {19, 57}, {0, 57}, + {0, 76}, {19, 76}, {38, 76}, {57, 76}, {76, 76}, {95, 76}, {114, 76}, {133, 76}, {152, 76}, {171, 76}, {190, 76}, {209, 76}, + {0, 0},{0, 0}, {0, 0},{0, 0},//not used +# endif + }, { +# ifdef STAGGERED_RGB_ENCODERS + 1, 1, + 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, + 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, + 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, + 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 +# elif defined RGB_ENCODERS + 1, 1, + 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, + 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, + 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, + 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 +# elif defined STAGGERED_LAYOUT + 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, + 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, + 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, + 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 +# else + 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, + 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, + 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, + 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 +# endif + } }; +// clang-format on +#endif |