diff --git a/keyboards/xelus/valor/rev2/config.h b/keyboards/xelus/valor/rev2/config.h new file mode 100644 index 0000000000..66669fab46 --- /dev/null +++ b/keyboards/xelus/valor/rev2/config.h @@ -0,0 +1,88 @@ +/* Copyright 2021 Harrison Chan (Xelus) + * + * 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 + +#include "config_common.h" + +/* USB Device descriptor parameter */ +#define VENDOR_ID 0x5845 // "XE" +#define PRODUCT_ID 0x5653 // Valor "VR" + 1 +#define DEVICE_VER 0x0001 +#define MANUFACTURER Xelus +#define PRODUCT Xelus Valor Rev2 + +/* key matrix size */ +#define MATRIX_ROWS 5 +#define MATRIX_COLS 15 + +/* key matrix pins */ +#define MATRIX_ROW_PINS { B11, B10, A3, A1, A2 } +#define MATRIX_COL_PINS { B2, B1, B0, A7, A6, A5, A4, A13, B7, B6, B5, B4, B3, A15, A14 } +#define UNUSED_PINS + +/* COL2ROW or ROW2COL */ +#define DIODE_DIRECTION COL2ROW + +/* Set 0 if debouncing isn't needed */ +#define DEBOUNCE 5 + +/* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */ +#define LOCKING_SUPPORT_ENABLE + +/* Locking resynchronize hack */ +#define LOCKING_RESYNC_ENABLE + +// I2C setup +#define I2C1_SCL 8 +#define I2C1_SDA 9 +#define I2C1_SCL_PAL_MODE 4 +#define I2C1_SDA_PAL_MODE 4 +#define I2C1_TIMINGR_PRESC 0U +#define I2C1_TIMINGR_SCLDEL 11U +#define I2C1_TIMINGR_SDADEL 0U +#define I2C1_TIMINGR_SCLH 14U +#define I2C1_TIMINGR_SCLL 42U + +// I2C EEPROM +#define EEPROM_I2C_24LC64 + +// More EEPROM for layers +#define DYNAMIC_KEYMAP_EEPROM_MAX_ADDR 8191 + +/* RGB Matrix */ +#define RGB_DI_PIN A9 +#define RGBLED_NUM 28 +#define DRIVER_LED_TOTAL 28 +#define NOP_FUDGE 0.4 + +// RGB PWM +#define WS2812_PWM_DRIVER PWMD1 +#define WS2812_PWM_CHANNEL 2 +#define WS2812_PWM_PAL_MODE 1 +#define WS2812_DMA_STREAM STM32_DMA1_STREAM6 +#define WS2812_DMA_CHANNEL 7 +#define WS2812_DMAMUX_ID STM32_DMAMUX1_TIM1_UP + +// RGB Pullup +#define WS2812_EXTERNAL_PULLUP + +// RGB Matrix settings +#define RGB_MATRIX_FRAMEBUFFER_EFFECTS +#define RGB_MATRIX_KEYPRESSES +#define RGB_MATRIX_MAXIMUM_BRIGHTNESS 200 +#define RGB_DISABLE_WHEN_USB_SUSPENDED true +#define RGB_MATRIX_STARTUP_MODE RGB_MATRIX_CUSTOM_test_mode diff --git a/keyboards/xelus/valor/rev2/halconf.h b/keyboards/xelus/valor/rev2/halconf.h new file mode 100644 index 0000000000..03b15da045 --- /dev/null +++ b/keyboards/xelus/valor/rev2/halconf.h @@ -0,0 +1,23 @@ +/* Copyright 2021 QMK + * + * 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 HAL_USE_I2C TRUE + +#define HAL_USE_PWM TRUE + +#include_next + diff --git a/keyboards/xelus/valor/rev2/info.json b/keyboards/xelus/valor/rev2/info.json new file mode 100644 index 0000000000..712050ca8a --- /dev/null +++ b/keyboards/xelus/valor/rev2/info.json @@ -0,0 +1,83 @@ +{ + "keyboard_name": "Xelus Valor Rev2", + "url": "", + "maintainer": "Xelus22", + "width": 17.75, + "height": 5, + "layouts": { + "LAYOUT_alice_split_bs": { + "layout": [ + {"x":0, "y":0}, + {"x":1.25, "y":0}, + {"x":2.25, "y":0}, + {"x":3.25, "y":0}, + {"x":4.25, "y":0}, + {"x":5.25, "y":0}, + {"x":6.25, "y":0}, + {"x":7.25, "y":0}, + {"x":10.25, "y":0}, + {"x":11.25, "y":0}, + {"x":12.25, "y":0}, + {"x":13.25, "y":0}, + {"x":14.25, "y":0}, + {"x":15.25, "y":0}, + {"x":16.25, "y":0}, + {"x":17.25, "y":0}, + + {"x":0, "y":1}, + {"x":1.25, "y":1, "w":1.5}, + {"x":2.75, "y":1}, + {"x":3.75, "y":1}, + {"x":4.75, "y":1}, + {"x":5.75, "y":1}, + {"x":6.75, "y":1}, + {"x":9.75, "y":1}, + {"x":10.75, "y":1}, + {"x":11.75, "y":1}, + {"x":12.75, "y":1}, + {"x":13.75, "y":1}, + {"x":14.75, "y":1}, + {"x":15.75, "y":1}, + {"x":16.75, "y":1, "w":1.5}, + + {"x":0, "y":2}, + {"x":1.25, "y":2, "w":1.75}, + {"x":3, "y":2}, + {"x":4, "y":2}, + {"x":5, "y":2}, + {"x":6, "y":2}, + {"x":7, "y":2}, + {"x":10, "y":2}, + {"x":11, "y":2}, + {"x":12, "y":2}, + {"x":13, "y":2}, + {"x":14, "y":2}, + {"x":15, "y":2}, + {"x":16, "y":2, "w":2.25}, + + {"x":1.25, "y":3, "w":2.25}, + {"x":3.5, "y":3}, + {"x":4.5, "y":3}, + {"x":5.5, "y":3}, + {"x":6.5, "y":3}, + {"x":7.5, "y":3}, + {"x":9.5, "y":3}, + {"x":10.5, "y":3}, + {"x":11.5, "y":3}, + {"x":12.5, "y":3}, + {"x":13.5, "y":3}, + {"x":14.5, "y":3}, + {"x":15.5, "y":3, "w":1.75}, + {"x":17.25, "y":3}, + + {"x":1.25, "y":4, "w":1.5}, + {"x":4.25, "y":4, "w":1.5}, + {"x":5.75, "y":4, "w":2}, + {"x":7.75, "y":4, "w":1.25}, + {"x":9.5, "y":4, "w":2.75}, + {"x":12.25, "y":4, "w":1.5}, + {"x":16.75, "y":4, "w":1.5} + ] + } + } +} diff --git a/keyboards/xelus/valor/rev2/keymaps/default/config.h b/keyboards/xelus/valor/rev2/keymaps/default/config.h new file mode 100644 index 0000000000..824d4633cc --- /dev/null +++ b/keyboards/xelus/valor/rev2/keymaps/default/config.h @@ -0,0 +1,18 @@ +/* Copyright 2021 Harrison Chan (Xelus) + * + * 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 . + */ + +#define USB_POLLING_INTERVAL_MS 1 +#define QMK_KEYS_PER_SCAN 4 diff --git a/keyboards/xelus/valor/rev2/keymaps/default/keymap.c b/keyboards/xelus/valor/rev2/keymaps/default/keymap.c new file mode 100644 index 0000000000..eb5f551126 --- /dev/null +++ b/keyboards/xelus/valor/rev2/keymaps/default/keymap.c @@ -0,0 +1,79 @@ +/* Copyright 2021 Harrison Chan (Xelus) + * + * 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 + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [0] = LAYOUT_all( + KC_ESC, KC_TILD, 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_DEL, KC_BSPC, + KC_PGUP, 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_PGDN, 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, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_RGUI, + KC_LCTL, KC_LALT, KC_SPC, MO(1), KC_SPC, KC_RALT, KC_RCTL + ), + + [1] = LAYOUT_all( + RGB_TOG, KC_TRNS, 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, KC_TRNS, + RGB_MOD, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + RESET, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, 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 RGB_MATRIX_ENABLE +void rgb_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max) { + // caps lock cyan + if (host_keyboard_led_state().caps_lock) { + RGB_MATRIX_INDICATOR_SET_COLOR(27, 0, 128, 128); + } else { + RGB_MATRIX_INDICATOR_SET_COLOR(27, 0, 0, 0); + } + + // num lock cyan + if (host_keyboard_led_state().num_lock) { + RGB_MATRIX_INDICATOR_SET_COLOR(26, 0, 128, 128); + } else { + RGB_MATRIX_INDICATOR_SET_COLOR(26, 0, 0, 0); + } + + // scroll lock cyan + if (host_keyboard_led_state().scroll_lock) { + RGB_MATRIX_INDICATOR_SET_COLOR(25, 0, 128, 128); + } else { + RGB_MATRIX_INDICATOR_SET_COLOR(25, 0, 0, 0); + } + + // layer state + switch (get_highest_layer(layer_state)) { + case 0: + RGB_MATRIX_INDICATOR_SET_COLOR(24, 0, 0, 0); + break; + case 1: + RGB_MATRIX_INDICATOR_SET_COLOR(24, 128, 0, 0); + break; + case 2: + RGB_MATRIX_INDICATOR_SET_COLOR(24, 0, 128, 0); + break; + case 3: + RGB_MATRIX_INDICATOR_SET_COLOR(24, 0, 0, 128); + break; + default: + // white + RGB_MATRIX_INDICATOR_SET_COLOR(24, 128, 128, 128); + break; + } +} +#endif diff --git a/keyboards/xelus/valor/rev2/keymaps/default/readme.md b/keyboards/xelus/valor/rev2/keymaps/default/readme.md new file mode 100644 index 0000000000..8648f1c150 --- /dev/null +++ b/keyboards/xelus/valor/rev2/keymaps/default/readme.md @@ -0,0 +1,2 @@ +# The Default Valor Rev2 Layout + diff --git a/keyboards/xelus/valor/rev2/keymaps/via/config.h b/keyboards/xelus/valor/rev2/keymaps/via/config.h new file mode 100644 index 0000000000..456369d884 --- /dev/null +++ b/keyboards/xelus/valor/rev2/keymaps/via/config.h @@ -0,0 +1,24 @@ +/* Copyright 2021 Harrison Chan (Xelus) + * + * 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 . + */ + +// RGB Matrix +#define VIA_QMK_RGBLIGHT_ENABLE + +// More layers +#define DYNAMIC_KEYMAP_LAYER_COUNT 8 + +#define USB_POLLING_INTERVAL_MS 1 +#define QMK_KEYS_PER_SCAN 4 diff --git a/keyboards/xelus/valor/rev2/keymaps/via/keymap.c b/keyboards/xelus/valor/rev2/keymaps/via/keymap.c new file mode 100644 index 0000000000..c256659514 --- /dev/null +++ b/keyboards/xelus/valor/rev2/keymaps/via/keymap.c @@ -0,0 +1,127 @@ +/* Copyright 2021 Harrison Chan (Xelus) + * + * 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 + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [0] = LAYOUT_all( + KC_ESC, KC_TILD, 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_DEL, KC_BSPC, + KC_PGUP, 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_PGDN, 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, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_RGUI, + KC_LCTL, KC_LALT, KC_SPC, MO(1), KC_SPC, KC_RALT, KC_RCTL + ), + + [1] = LAYOUT_all( + RGB_TOG, KC_TRNS, 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, KC_TRNS, + RGB_MOD, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + RESET, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS + ), + + [2] = LAYOUT_all( + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, 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_all( + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS + ), + + [4] = LAYOUT_all( + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS + ), + + [5] = LAYOUT_all( + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS + ), + + [6] = LAYOUT_all( + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS + ), + + [7] = LAYOUT_all( + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, 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 RGB_MATRIX_ENABLE +void rgb_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max) { + // caps lock cyan + if (host_keyboard_led_state().caps_lock) { + RGB_MATRIX_INDICATOR_SET_COLOR(27, 0, 128, 128); + } else { + RGB_MATRIX_INDICATOR_SET_COLOR(27, 0, 0, 0); + } + + // num lock cyan + if (host_keyboard_led_state().num_lock) { + RGB_MATRIX_INDICATOR_SET_COLOR(26, 0, 128, 128); + } else { + RGB_MATRIX_INDICATOR_SET_COLOR(26, 0, 0, 0); + } + + // scroll lock cyan + if (host_keyboard_led_state().scroll_lock) { + RGB_MATRIX_INDICATOR_SET_COLOR(25, 0, 128, 128); + } else { + RGB_MATRIX_INDICATOR_SET_COLOR(25, 0, 0, 0); + } + + // layer state + switch (get_highest_layer(layer_state)) { + case 0: + RGB_MATRIX_INDICATOR_SET_COLOR(24, 0, 0, 0); + break; + case 1: + RGB_MATRIX_INDICATOR_SET_COLOR(24, 128, 0, 0); + break; + case 2: + RGB_MATRIX_INDICATOR_SET_COLOR(24, 0, 128, 0); + break; + case 3: + RGB_MATRIX_INDICATOR_SET_COLOR(24, 0, 0, 128); + break; + default: + // white + RGB_MATRIX_INDICATOR_SET_COLOR(24, 128, 128, 128); + break; + } +} +#endif diff --git a/keyboards/xelus/valor/rev2/keymaps/via/readme.md b/keyboards/xelus/valor/rev2/keymaps/via/readme.md new file mode 100644 index 0000000000..dcdfd4dd9e --- /dev/null +++ b/keyboards/xelus/valor/rev2/keymaps/via/readme.md @@ -0,0 +1,2 @@ +# The VIA Valor Rev2 Layout + diff --git a/keyboards/xelus/valor/rev2/keymaps/via/rules.mk b/keyboards/xelus/valor/rev2/keymaps/via/rules.mk new file mode 100644 index 0000000000..1e5b99807c --- /dev/null +++ b/keyboards/xelus/valor/rev2/keymaps/via/rules.mk @@ -0,0 +1 @@ +VIA_ENABLE = yes diff --git a/keyboards/xelus/valor/rev2/mcuconf.h b/keyboards/xelus/valor/rev2/mcuconf.h new file mode 100644 index 0000000000..736837565d --- /dev/null +++ b/keyboards/xelus/valor/rev2/mcuconf.h @@ -0,0 +1,30 @@ +/* Copyright 2021 QMK + * + * 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 + +#include_next + +#undef STM32_I2C_USE_I2C1 +#define STM32_I2C_USE_I2C1 TRUE + +#undef STM32_PWM_USE_TIM1 +#define STM32_PWM_USE_TIM1 TRUE + +#undef STM32_I2C_I2C1_RX_DMA_STREAM +#undef STM32_I2C_I2C1_TX_DMA_STREAM +#define STM32_I2C_I2C1_RX_DMA_STREAM STM32_DMA_STREAM_ID(2, 6) +#define STM32_I2C_I2C1_TX_DMA_STREAM STM32_DMA_STREAM_ID(2, 7) diff --git a/keyboards/xelus/valor/rev2/readme.md b/keyboards/xelus/valor/rev2/readme.md new file mode 100644 index 0000000000..863f5ef423 --- /dev/null +++ b/keyboards/xelus/valor/rev2/readme.md @@ -0,0 +1,20 @@ +# Valor Rev 2 + +An Alice replacement keyboard PCB. + +* Keyboard Maintainer: [Xelus22](https://github.com/Xelus22) +* Hardware Supported: Valor Rev 2 +* Hardware Availability: Custom keyboard group buys + +Make example for this keyboard (after setting up your build environment): + + make xelus/valor/rev2:default + +Reset your keyboard in 3 ways: +
    +
  1. Software reset on Fn + PgDn (bottom of the 3 macro buttons)
  2. +
  3. Bootmagic reset: hold down the top left key (usually escape) and plugin the keyboard
  4. +
  5. Physical reset button: on the back of the PCB, there should be a small golden button you can press
  6. +
+ +See the [build environment setup](https://docs.qmk.fm/#/getting_started_build_tools) and the [make instructions](https://docs.qmk.fm/#/getting_started_make_guide) for more information. Brand new to QMK? Start with our [Complete Newbs Guide](https://docs.qmk.fm/#/newbs). diff --git a/keyboards/xelus/valor/rev2/rev2.c b/keyboards/xelus/valor/rev2/rev2.c new file mode 100644 index 0000000000..f130418794 --- /dev/null +++ b/keyboards/xelus/valor/rev2/rev2.c @@ -0,0 +1,72 @@ +/* Copyright 2021 Harrison Chan (Xelus) + * + * 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 "rev2.h" + +#ifdef RGB_MATRIX_ENABLE + +led_config_t g_led_config = { { + // Key Matrix to LED Index + { 24, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED }, + { 25, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED }, + { 26, 27, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED }, + { NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED }, + { NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED } +}, { + // LED Index to Physical Position + { 224, 0 }, + { 224, 9 }, + { 224, 21 }, + { 224, 33 }, + { 224, 45 }, + { 223, 51 }, + { 206, 52 }, + { 190, 52 }, + { 172, 52 }, + { 154, 57 }, + { 136, 61 }, + { 118, 63 }, + { 101, 64 }, + { 80 , 60 }, + { 64 , 57 }, + { 46 , 53 }, + { 28 , 53 }, + { 10 , 52 }, + { 3 , 51 }, + { 2 , 45 }, + { 2 , 33 }, + { 2 , 20 }, + { 2 , 9 }, + { 0 , 0 }, + { 9 , 3 }, + { 6 , 14 }, + { 4 , 26 }, + { 21 , 27 } + +}, { + // LED Index to Flag + 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, + 8, 8, 8, 8 +} }; + + +void keyboard_pre_init_kb(void) { + rgb_matrix_set_flags(LED_FLAG_MODIFIER|LED_FLAG_UNDERGLOW|LED_FLAG_KEYLIGHT); + keyboard_pre_init_user(); +} +#endif diff --git a/keyboards/xelus/valor/rev2/rev2.h b/keyboards/xelus/valor/rev2/rev2.h new file mode 100644 index 0000000000..9cf78c9412 --- /dev/null +++ b/keyboards/xelus/valor/rev2/rev2.h @@ -0,0 +1,37 @@ +/* Copyright 2021 Harrison Chan (Xelus) + * + * 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 + +#include "quantum.h" + +#define ____ KC_NO + +#define LAYOUT_alice_split_bs( \ + K000, K001, K002, K003, K004, K005, K006, K007, K008, K009, K010, K011, K012, K013, K014, K214, \ + K100, K101, K102, K103, K104, K105, K106, K107, K108, K109, K110, K111, K112, K113, K114, \ + K200, K201, K202, K203, K204, K205, K206, K207, K208, K209, K210, K211, K212, K213, \ + K301, K302, K303, K304, K305, K306, K307, K308, K309, K310, K311, K312, K313, K314, \ + K401, K403, K405, K406, K408, K410, K413 \ +) { \ + { K000, K001, K002, K003, K004, K005, K006, K007, K008, K009, K010, K011, K012, K013, K014 }, \ + { K100, K101, K102, K103, K104, K105, K106, K107, K108, K109, K110, K111, K112, K113, K114 }, \ + { K200, K201, K202, K203, K204, K205, K206, K207, K208, K209, K210, K211, K212, K213, K214 }, \ + { ____, K301, K302, K303, K304, K305, K306, K307, K308, K309, K310, K311, K312, K313, K314 }, \ + { ____, K401, ____, K403, ____, K405, K406, ____, K408, ____, K410, ____, ____, K413, ____ } \ +} + +#define LAYOUT_all LAYOUT_alice_split_bs diff --git a/keyboards/xelus/valor/rev2/rgb_matrix_kb.inc b/keyboards/xelus/valor/rev2/rgb_matrix_kb.inc new file mode 100644 index 0000000000..3518406090 --- /dev/null +++ b/keyboards/xelus/valor/rev2/rgb_matrix_kb.inc @@ -0,0 +1,34 @@ +// Step 1. +// Declare custom effects using the RGB_MATRIX_EFFECT macro +// (note the lack of semicolon after the macro!) +RGB_MATRIX_EFFECT(test_mode) + +// Step 2. +// Define effects inside the `RGB_MATRIX_CUSTOM_EFFECT_IMPLS` ifdef block +#ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS + +// e.g: A simple effect, self-contained within a single method +static bool test_mode(effect_params_t* params) { + uint8_t factor = 9; + switch ((g_rgb_timer & (0b11 << factor)) >> factor) { + case 0: { + rgb_matrix_set_color_all(150, 0, 0); + break; + } + case 1: { + rgb_matrix_set_color_all(0, 150, 0); + break; + } + case 2: { + rgb_matrix_set_color_all(0, 0, 150); + break; + } + case 3: { + rgb_matrix_set_color_all(150, 150, 150); + break; + } + } + return false; +} + +#endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS diff --git a/keyboards/xelus/valor/rev2/rules.mk b/keyboards/xelus/valor/rev2/rules.mk new file mode 100644 index 0000000000..7ec6bcc771 --- /dev/null +++ b/keyboards/xelus/valor/rev2/rules.mk @@ -0,0 +1,32 @@ +# MCU name +MCU = STM32L422 + +# Bootloader selection +BOOTLOADER = stm32-dfu + +# Build Options +# change yes to no to disable +# +BOOTMAGIC_ENABLE = lite # Virtual DIP switch configuration +MOUSEKEY_ENABLE = yes # Mouse keys +EXTRAKEY_ENABLE = yes # Audio control and System control +CONSOLE_ENABLE = no # Console for debug +COMMAND_ENABLE = no # Commands for debug and configuration +# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE +SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend +# if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work +NKRO_ENABLE = yes # USB Nkey Rollover +BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality +RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow +BLUETOOTH_ENABLE = no # Enable Bluetooth +AUDIO_ENABLE = no # Audio output +RGB_MATRIX_ENABLE = yes +RGB_MATRIX_DRIVER = WS2812 +RGB_MATRIX_CUSTOM_KB = yes +WS2812_DRIVER = pwm +EEPROM_DRIVER = i2c + +OPT = 2 +LTO_ENABLE = yes + +LAYOUTS = alice_split_bs