From e67fce6811476e58b64929f5b5ac096426c8f015 Mon Sep 17 00:00:00 2001 From: chriskhosh Date: Sun, 14 Apr 2024 23:58:04 -0400 Subject: [PATCH] Support for RGBKB/Mun2 (#711) * Initial commit of mun2 files * Add debug console * fix driver for touchbar * removing debug and extra driver line * Clean up keymaps --------- Co-authored-by: Legonut Co-authored-by: Legonut --- keyboards/rgbkb/mun2/.noci | 0 keyboards/rgbkb/mun2/config.h | 127 ++++++++++ keyboards/rgbkb/mun2/halconf.h | 18 ++ keyboards/rgbkb/mun2/keymaps/default/config.h | 21 ++ keyboards/rgbkb/mun2/keymaps/default/keymap.c | 212 ++++++++++++++++ keyboards/rgbkb/mun2/keymaps/vial/config.h | 25 ++ keyboards/rgbkb/mun2/keymaps/vial/keymap.c | 136 ++++++++++ keyboards/rgbkb/mun2/keymaps/vial/rules.mk | 3 + keyboards/rgbkb/mun2/keymaps/vial/vial.json | 173 +++++++++++++ keyboards/rgbkb/mun2/mcuconf.h | 18 ++ keyboards/rgbkb/mun2/mun2.c | 23 ++ keyboards/rgbkb/mun2/mun2.h | 26 ++ keyboards/rgbkb/mun2/readme.md | 3 + keyboards/rgbkb/mun2/rev1/info.json | 142 +++++++++++ keyboards/rgbkb/mun2/rev1/rev1.c | 235 ++++++++++++++++++ keyboards/rgbkb/mun2/rev1/rev1.h | 74 ++++++ keyboards/rgbkb/mun2/rev1/rules.mk | 0 keyboards/rgbkb/mun2/rules.mk | 42 ++++ 18 files changed, 1278 insertions(+) create mode 100644 keyboards/rgbkb/mun2/.noci create mode 100644 keyboards/rgbkb/mun2/config.h create mode 100644 keyboards/rgbkb/mun2/halconf.h create mode 100644 keyboards/rgbkb/mun2/keymaps/default/config.h create mode 100644 keyboards/rgbkb/mun2/keymaps/default/keymap.c create mode 100644 keyboards/rgbkb/mun2/keymaps/vial/config.h create mode 100644 keyboards/rgbkb/mun2/keymaps/vial/keymap.c create mode 100644 keyboards/rgbkb/mun2/keymaps/vial/rules.mk create mode 100644 keyboards/rgbkb/mun2/keymaps/vial/vial.json create mode 100644 keyboards/rgbkb/mun2/mcuconf.h create mode 100644 keyboards/rgbkb/mun2/mun2.c create mode 100644 keyboards/rgbkb/mun2/mun2.h create mode 100644 keyboards/rgbkb/mun2/readme.md create mode 100644 keyboards/rgbkb/mun2/rev1/info.json create mode 100644 keyboards/rgbkb/mun2/rev1/rev1.c create mode 100644 keyboards/rgbkb/mun2/rev1/rev1.h create mode 100644 keyboards/rgbkb/mun2/rev1/rules.mk create mode 100644 keyboards/rgbkb/mun2/rules.mk diff --git a/keyboards/rgbkb/mun2/.noci b/keyboards/rgbkb/mun2/.noci new file mode 100644 index 0000000000..e69de29bb2 diff --git a/keyboards/rgbkb/mun2/config.h b/keyboards/rgbkb/mun2/config.h new file mode 100644 index 0000000000..788665356d --- /dev/null +++ b/keyboards/rgbkb/mun2/config.h @@ -0,0 +1,127 @@ +/* + * ---------------------------------------------------------------------------- + * "THE BEER-WARE LICENSE" (Revision 42): + * wrote this file. As long as you retain this + * notice you can do whatever you want with this stuff. If we meet some day, and + * you think this stuff is worth it, you can buy me a beer in return. David Rauseo + * ---------------------------------------------------------------------------- + */ + +#pragma once + +//#include "config_common.h" + +#define PICO_XOSC_STARTUP_DELAY_MULTIPLIER 64 + +/* Matrix Configuration - Rows are doubled up */ +#define MATRIX_ROWS 14 +// Last pins reserved for encoder / touch encoder support +// Empty matrix entries used for encoder / touch encoder support +#define MATRIX_ROW_PINS { GP10, GP9, GP1, GP2, GP3, NO_PIN, NO_PIN } +#define MATRIX_ROW_PINS_RIGHT { GP10, GP9, GP1, GP2, GP3, NO_PIN, NO_PIN} +#define MATRIX_COLS 8 +#define MATRIX_COL_PINS { GP26, GP29, GP18, GP22, GP21, GP23, GP19, GP20 } +#define MATRIX_COL_PINS_RIGHT { GP28, GP29, GP18, GP22, GP21, GP20, GP19, GP23} + +/* Touchbar adjustments */ +#define TOUCH_DEADZONE 50 // width of a "button", wider inputs will be interpreted as a swipe +#define TOUCH_TERM 350 // time of a "button" touch, longer inputs will be a swipe +#define TOUCH_RESOLUTION 25 // sensitivity of swipes, lower=faster +#define TOUCH_SEGMENTS 3 +#define TAP_CODE_DELAY 1 // without a slight delay, the RP2040 doesn't register instant taps + +/* Encoder Configuration */ +#define ENCODERS_PAD_A { GP7, GP27, GP4 } +#define ENCODERS_PAD_A_RIGHT { GP27, GP7, GP5 } + +#define ENCODERS_PAD_B { GP6, GP28, GP5 } +#define ENCODERS_PAD_B_RIGHT { GP26, GP6, GP4 } + +/* COL2ROW or ROW2COL */ +#define DIODE_DIRECTION COL2ROW + +/* Split Keyboard Configuration */ +#define SPLIT_HAND_PIN GP11 +#define SPLIT_USB_DETECT +#define SERIAL_USART_FULL_DUPLEX +#define SELECT_SOFT_SERIAL_SPEED 2 +#define SERIAL_USART_RX_PIN GP17 +#define SERIAL_USART_TX_PIN GP16 + +/* Split Transport Features */ +#define SPLIT_TRANSPORT_MIRROR +#define SPLIT_LAYER_STATE_ENABLE +#define SPLIT_LED_STATE_ENABLE +#define SPLIT_MODS_ENABLE +#define SPLIT_TRANSACTION_IDS_KB TOUCH_ENCODER_SYNC, RGB_MENU_SYNC + +/* I2C Configuration */ +#define I2C_DRIVER I2CD0 +#define I2C1_SCL_PIN GP25 +#define I2C1_SDA_PIN GP24 + +/* RGB Matrix Configuration */ +#define WS2812_PIO_USE_PIO1 +#define WS2812_DI_PIN GP15 + +// NOTE: WS2812 uses the RGBLED_NUM define, RGB Matrix uses DRIVER_LED_TOTAL... +// so make sure both are set and the same +#define RGBLED_NUM 70 +#define DRIVER_LED_TOTAL RGBLED_NUM +#define RGB_MATRIX_SPLIT { 35, 35 } +#define RGB_MATRIX_CENTER { 117, 46 } +#define RGB_MATRIX_MAXIMUM_BRIGHTNESS 255 +#define RGB_MATRIX_LED_FLUSH_LIMIT 33 +#define RGB_MATRIX_LED_PROCESS_LIMIT 10 +#define RGB_DISABLE_WHEN_USB_SUSPENDED + +// 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 RGB_MATRIX_FRAMEBUFFER_EFFECTS +#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 RGB_MATRIX_KEYPRESSES +#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 \ No newline at end of file diff --git a/keyboards/rgbkb/mun2/halconf.h b/keyboards/rgbkb/mun2/halconf.h new file mode 100644 index 0000000000..23f1474200 --- /dev/null +++ b/keyboards/rgbkb/mun2/halconf.h @@ -0,0 +1,18 @@ +/* + * ---------------------------------------------------------------------------- + * "THE BEER-WARE LICENSE" (Revision 42): + * wrote this file. As long as you retain this + * notice you can do whatever you want with this stuff. If we meet some day, and + * you think this stuff is worth it, you can buy me a beer in return. David Rauseo + * ---------------------------------------------------------------------------- + */ + +#pragma once + +#undef HAL_USE_I2C +#define HAL_USE_I2C TRUE + +#undef HAL_USE_SIO +#define HAL_USE_SIO TRUE + +#include_next "halconf.h" diff --git a/keyboards/rgbkb/mun2/keymaps/default/config.h b/keyboards/rgbkb/mun2/keymaps/default/config.h new file mode 100644 index 0000000000..3a3ddd5f7e --- /dev/null +++ b/keyboards/rgbkb/mun2/keymaps/default/config.h @@ -0,0 +1,21 @@ +/* + * ---------------------------------------------------------------------------- + * "THE BEER-WARE LICENSE" (Revision 42): + * wrote this file. As long as you retain this + * notice you can do whatever you want with this stuff. If we meet some day, and + * you think this stuff is worth it, you can buy me a beer in return. David Rauseo + * ---------------------------------------------------------------------------- + */ + +#pragma once + +// No need for the single versions when multi performance isn't a problem =D +#undef ENABLE_RGB_MATRIX_SOLID_REACTIVE_WIDE +#undef ENABLE_RGB_MATRIX_SOLID_REACTIVE_CROSS +#undef ENABLE_RGB_MATRIX_SOLID_REACTIVE_NEXUS +#undef ENABLE_RGB_MATRIX_SPLASH +#undef ENABLE_RGB_MATRIX_SOLID_SPLASH + +// 20m timeout (20m * 60s * 1000mil) +// #define RGB_DISABLE_TIMEOUT 1200000 +#define RGB_DISABLE_WHEN_USB_SUSPENDED \ No newline at end of file diff --git a/keyboards/rgbkb/mun2/keymaps/default/keymap.c b/keyboards/rgbkb/mun2/keymaps/default/keymap.c new file mode 100644 index 0000000000..91d2f8ef40 --- /dev/null +++ b/keyboards/rgbkb/mun2/keymaps/default/keymap.c @@ -0,0 +1,212 @@ +/* + * ---------------------------------------------------------------------------- + * "THE BEER-WARE LICENSE" (Revision 42): + * wrote this file. As long as you retain this + * notice you can do whatever you want with this stuff. If we meet some day, and + * you think this stuff is worth it, you can buy me a beer in return. David Rauseo + * ---------------------------------------------------------------------------- + */ + +#include QMK_KEYBOARD_H + +// 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. +enum sol_layers { + _QWERTY, + _COLEMAK, + _FN, + _ADJUST +}; + +enum zygo_keycodes { + // Disables touch processing + TCH_TOG = SAFE_RANGE, + MENU_BTN, + MENU_UP, + MENU_DN, + RGB_RST +}; + +#define FN MO(_FN) +#define ADJUST MO(_ADJUST) +#define COLEMAK DF(_COLEMAK) +#define QWERTY DF(_QWERTY) +#define FN_CAPS LT(_FN, KC_CAPS) + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + /* QWERTY Layout + ┌──────┬──────┬──────┬──────┬──────┬──────┐ ┌──────┬──────┬──────┬──────┬──────┬──────┐ + | ESC | 1 | 2 | 3 | 4 | 5 | | 6 | 7 | 8 | 9 | 0 | BkSp | + ├──────┼──────┼──────┼──────┼──────┼──────┤ ├──────┼──────┼──────┼──────┼──────┼──────┤ + | Tab | Q | W | E | R | T | | Y | U | I | O | P | \ | + ├──────┼──────┼──────┼──────┼──────┼──────┤ ├──────┼──────┼──────┼──────┼──────┼──────┤ + |FNCAPS| A | S | D | F | G | | H | J | K | L | ; | ' | + ├──────┼──────┼──────┼──────┼──────┼──────┤ ├──────┼──────┼──────┼──────┼──────┼──────┤ + |Shift | Z | X | C | V | B | | N | M | , | . | / |Enter | + ├──────┼──────┼──────┼──────┼──────┼──────┤ ├──────┼──────┼──────┼──────┼──────┼──────┤ + | Ctrl | Win | Alt | RGB |ADJUST| Space| | Space| FN | Left | Down | Up |Right | + └──────┴──────┴──────┴──────┴──────┴──────┘ └──────┴──────┴──────┴──────┴──────┴──────┘ + ┌──────┬──────┬──────┬──────┬──────┬──────┐ ┌──────┬──────┬──────┬──────┬──────┬──────┐ + │Vol Dn│Vol Up│Vol Dn│Vol Up│Vol Dn│Vol Up│ │Vol Dn│Vol Up│Vol Dn│Vol Up│Vol Dn│Vol Up│ + └──────┴──────┴──────┴──────┴──────┴──────┘ └──────┴──────┴──────┴──────┴──────┴──────┘ + ┌──────┬──────┬──────┬──────┬──────┐ ┌──────┬──────┬──────┬──────┬──────┐ + │Vol Dn│Vol Up│ Prev │ Play │ Next │ │Vol Dn│Vol Up│ Prev │ Play │ Next │ + └──────┴──────┴──────┴──────┴──────┘ └──────┴──────┴──────┴──────┴──────┘ + */ + [_QWERTY] = LAYOUT( + QK_GESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_MINS, KC_EQL, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC, + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_LBRC, KC_RBRC, 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_LPRN, KC_RPRN, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_LCBR, KC_RCBR, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT, + KC_LCTL, KC_LGUI, KC_LALT, RGB_TOG, ADJUST, KC_SPC, KC_SPC, KC_SPC, KC_SPC, FN, KC_LEFT, KC_DOWN, KC_UP, KC_RIGHT, + + KC_VOLD, KC_VOLU, KC_VOLD, KC_VOLU, KC_VOLD, KC_VOLU, KC_VOLD, KC_VOLU, KC_VOLD, KC_VOLU, KC_VOLD, KC_VOLU, + KC_VOLU, KC_VOLD, KC_MNXT, KC_MPLY, KC_MPRV, KC_VOLU, KC_VOLD, KC_MNXT, KC_MPLY, KC_MPRV + ), + + /* Colemak Layout + ┌──────┬──────┬──────┬──────┬──────┬──────┐ ┌──────┬──────┬──────┬──────┬──────┬──────┐ + | GESC | 1 | 2 | 3 | 4 | 5 | | 6 | 7 | 8 | 9 | 0 | BkSp | + ├──────┼──────┼──────┼──────┼──────┼──────┤ ├──────┼──────┼──────┼──────┼──────┼──────┤ + | Tab | Q | W | F | P | B | | J | L | U | Y | ; | \ | + ├──────┼──────┼──────┼──────┼──────┼──────┤ ├──────┼──────┼──────┼──────┼──────┼──────┤ + |FNCAPS| A | R | S | T | G | | K | N | E | I | O | ' | + ├──────┼──────┼──────┼──────┼──────┼──────┤ ├──────┼──────┼──────┼──────┼──────┼──────┤ + |Shift | Z | X | C | D | V | | M | H | , | . | / |Enter | + ├──────┼──────┼──────┼──────┼──────┼──────┤ ├──────┼──────┼──────┼──────┼──────┼──────┤ + | Ctrl | Win | Alt | RGB |ADJUST| Space| | Space| FN | Left | Down | Up |Right | + └──────┴──────┴──────┴──────┴──────┴──────┘ └──────┴──────┴──────┴──────┴──────┴──────┘ + ┌──────┬──────┬──────┬──────┬──────┬──────┐ ┌──────┬──────┬──────┬──────┬──────┬──────┐ + │Vol Dn│Vol Up│Vol Dn│Vol Up│Vol Dn│Vol Up│ │Vol Dn│Vol Up│Vol Dn│Vol Up│Vol Dn│Vol Up│ + └──────┴──────┴──────┴──────┴──────┴──────┘ └──────┴──────┴──────┴──────┴──────┴──────┘ + ┌──────┬──────┬──────┬──────┬──────┐ ┌──────┬──────┬──────┬──────┬──────┐ + │Vol Dn│Vol Up│ Prev │ Play │ Next │ │Vol Dn│Vol Up│ Prev │ Play │ Next │ + └──────┴──────┴──────┴──────┴──────┘ └──────┴──────┴──────┴──────┴──────┘ + */ + [_COLEMAK] = LAYOUT( + QK_GESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_F1, KC_F5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC, + KC_TAB, KC_Q, KC_W, KC_F, KC_P, KC_B, KC_F2, KC_F6, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_BSLS, + FN_CAPS, KC_A, KC_R, KC_S, KC_T, KC_G, KC_F3, KC_F7, KC_K, KC_N, KC_E, KC_I, KC_O, KC_QUOT, + KC_LSFT, KC_Z, KC_X, KC_C, KC_D, KC_V, KC_F4, KC_F8, KC_M, KC_H, KC_COMM, KC_DOT, KC_SLSH, KC_ENT, + KC_LCTL, KC_LGUI, KC_LALT, RGB_TOG, ADJUST, KC_SPC, KC_SPC, KC_SPC, KC_SPC, FN, KC_LEFT, KC_DOWN, KC_UP, KC_RIGHT, + + KC_VOLD, KC_VOLU, KC_VOLD, KC_VOLU, KC_VOLD, KC_VOLU, KC_VOLD, KC_VOLU, KC_VOLD, KC_VOLU, KC_VOLD, KC_VOLU, + KC_VOLU, KC_VOLD, KC_MNXT, KC_MPLY, KC_MPRV, KC_VOLU, KC_VOLD, KC_MNXT, KC_MPLY, KC_MPRV + ), + + /* FN Layout + ┌──────┬──────┬──────┬──────┬──────┬──────┐ ┌──────┬──────┬──────┬──────┬──────┬──────┐ + | F1 | F2 | F3 | F4 | F5 | F6 | | F7 | F8 | F9 | F10 | F11 | F12 | + ├──────┼──────┼──────┼──────┼──────┼──────┤ ├──────┼──────┼──────┼──────┼──────┼──────┤ + | | PGDN | UP | PGUP | | | | | PGDN | UP | PGUP | PRINT| HOME | + ├──────┼──────┼──────┼──────┼──────┼──────┤ ├──────┼──────┼──────┼──────┼──────┼──────┤ + | | LEFT | DOWN | RIGHT| | | | | LEFT | DOWN | RIGHT|INSERT| END | + ├──────┼──────┼──────┼──────┼──────┼──────┤ ├──────┼──────┼──────┼──────┼──────┼──────┤ + | | | | | | | | | | | | | | + ├──────┼──────┼──────┼──────┼──────┼──────┤ ├──────┼──────┼──────┼──────┼──────┼──────┤ + | | | |RGBMOD| | | | | PLAY | NEXT | MUTE | VOL- | VOL+ | + └──────┴──────┴──────┴──────┴──────┴──────┘ └──────┴──────┴──────┴──────┴──────┴──────┘ + ┌──────┬──────┬──────┬──────┬──────┬──────┐ ┌──────┬──────┬──────┬──────┬──────┬──────┐ + │ | | | | | | | | | | | | │ + └──────┴──────┴──────┴──────┴──────┴──────┘ └──────┴──────┴──────┴──────┴──────┴──────┘ + ┌──────┬──────┬──────┬──────┬──────┐ ┌──────┬──────┬──────┬──────┬──────┐ + │ | | | | | | | | | | │ + └──────┴──────┴──────┴──────┴──────┘ └──────┴──────┴──────┴──────┴──────┘ + */ + [_FN] = LAYOUT( + 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_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, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, RGB_MOD, _______, _______, _______, _______, _______, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, + + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ + ), + + /* ADJ Layout + ┌──────┬──────┬──────┬──────┬──────┬──────┐ ┌──────┬──────┬──────┬──────┬──────┬──────┐ + | F1 | F2 | F3 | F4 | F5 | F6 | | F7 | F8 | F9 | F10 | F11 | F12 | + ├──────┼──────┼──────┼──────┼──────┼──────┤ ├──────┼──────┼──────┼──────┼──────┼──────┤ + | | SAD | VAI | SAI |QK_BOOT| | | | | | | | | + ├──────┼──────┼──────┼──────┼──────┼──────┤ ├──────┼──────┼──────┼──────┼──────┼──────┤ + | | HUD | VAD | HUI |RGBRST| | | |QWERTY|COLEMK| | | | + ├──────┼──────┼──────┼──────┼──────┼──────┤ ├──────┼──────┼──────┼──────┼──────┼──────┤ + | | | | | | | | | |RGBTOG| HUI | SAI | VAI | + ├──────┼──────┼──────┼──────┼──────┼──────┤ ├──────┼──────┼──────┼──────┼──────┼──────┤ + | | | |RGBNXT| | | | | |RGBPRV| HUD | SAD | VAD | + └──────┴──────┴──────┴──────┴──────┴──────┘ └──────┴──────┴──────┴──────┴──────┴──────┘ + ┌──────┬──────┬──────┬──────┬──────┬──────┐ ┌──────┬──────┬──────┬──────┬──────┬──────┐ + │ | | | | | | | | | | | | │ + └──────┴──────┴──────┴──────┴──────┴──────┘ └──────┴──────┴──────┴──────┴──────┴──────┘ + ┌──────┬──────┬──────┬──────┬──────┐ ┌──────┬──────┬──────┬──────┬──────┐ + │ | | | | | | | | | | │ + └──────┴──────┴──────┴──────┴──────┘ └──────┴──────┴──────┴──────┴──────┘ + */ + [_ADJUST] = LAYOUT( + KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, _______, _______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, + _______, RGB_SAD, RGB_VAI, RGB_SAI, QK_BOOT, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, RGB_HUD, RGB_VAD, RGB_HUI, RGB_RST, _______, _______, _______, _______, QWERTY, COLEMAK, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_TOG, RGB_HUI, RGB_SAI, RGB_VAI, + _______, _______, _______, RGB_MOD, _______, _______, _______, _______, _______, _______, RGB_RMOD, RGB_HUD, RGB_SAD, RGB_VAD, + + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ + ) +}; + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + switch (keycode) + { + case MENU_BTN: + if (record->event.pressed) { + rgb_menu_selection(); + } + return false; + case MENU_UP: + if (record->event.pressed) { + rgb_menu_action(true); + } + return false; + case MENU_DN: + if (record->event.pressed) { + rgb_menu_action(false); + } + return false; + case RGB_RST: + if (record->event.pressed) { + eeconfig_update_rgb_matrix_default(); + } + return false; + case TCH_TOG: + if (record->event.pressed) { + touch_encoder_toggle(); + } + return false; // Skip all further processing of this key + default: + return true; + } +} + +void render_layer_status(void) { + // Host Keyboard Layer Status + oled_write_P(PSTR("Layer"), false); + switch (get_highest_layer(layer_state)) { + case _QWERTY: + oled_write_ln_P(PSTR("QWRTY"), false); + break; + case _COLEMAK: + oled_write_ln_P(PSTR("Colemk"), false); + break; + case _FN: + oled_write_ln_P(PSTR("FN "), false); + break; + case _ADJUST: + oled_write_ln_P(PSTR("Adjst"), false); + break; + default: + oled_write_ln_P(PSTR("Undef"), false); + } +} \ No newline at end of file diff --git a/keyboards/rgbkb/mun2/keymaps/vial/config.h b/keyboards/rgbkb/mun2/keymaps/vial/config.h new file mode 100644 index 0000000000..6af41456c7 --- /dev/null +++ b/keyboards/rgbkb/mun2/keymaps/vial/config.h @@ -0,0 +1,25 @@ +/* + * ---------------------------------------------------------------------------- + * "THE BEER-WARE LICENSE" (Revision 42): + * wrote this file. As long as you retain this + * notice you can do whatever you want with this stuff. If we meet some day, and + * you think this stuff is worth it, you can buy me a beer in return. David Rauseo + * ---------------------------------------------------------------------------- + */ + +#pragma once + +// No need for the single versions when multi performance isn't a problem =D +#undef ENABLE_RGB_MATRIX_SOLID_REACTIVE_WIDE +#undef ENABLE_RGB_MATRIX_SOLID_REACTIVE_CROSS +#undef ENABLE_RGB_MATRIX_SOLID_REACTIVE_NEXUS +#undef ENABLE_RGB_MATRIX_SPLASH +#undef ENABLE_RGB_MATRIX_SOLID_SPLASH + +// 20m timeout (20m * 60s * 1000mil) +// #define RGB_DISABLE_TIMEOUT 1200000 +#define RGB_DISABLE_WHEN_USB_SUSPENDED + +#define VIAL_KEYBOARD_UID {0x5F, 0x2E, 0x2D, 0x59, 0xF3, 0x4F, 0x90, 0x79} +#define VIAL_UNLOCK_COMBO_ROWS { 1, 10 } +#define VIAL_UNLOCK_COMBO_COLS { 0, 1 } \ No newline at end of file diff --git a/keyboards/rgbkb/mun2/keymaps/vial/keymap.c b/keyboards/rgbkb/mun2/keymaps/vial/keymap.c new file mode 100644 index 0000000000..16a2763a0a --- /dev/null +++ b/keyboards/rgbkb/mun2/keymaps/vial/keymap.c @@ -0,0 +1,136 @@ +/* + * ---------------------------------------------------------------------------- + * "THE BEER-WARE LICENSE" (Revision 42): + * wrote this file. As long as you retain this + * notice you can do whatever you want with this stuff. If we meet some day, and + * you think this stuff is worth it, you can buy me a beer in return. David Rauseo + * ---------------------------------------------------------------------------- + */ + +#include QMK_KEYBOARD_H + +// 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. +enum sol_layers { + _QWERTY, + _COLEMAK, + _FN, + _ADJUST +}; + +enum zygo_keycodes { + // Disables touch processing + TCH_TOG = SAFE_RANGE, + MENU_BTN, + MENU_UP, + MENU_DN, + RGB_RST +}; + +#define FN MO(_FN) +#define ADJUST MO(_ADJUST) +#define COLEMAK DF(_COLEMAK) +#define QWERTY DF(_QWERTY) +#define FN_CAPS LT(_FN, KC_CAPS) + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [_QWERTY] = LAYOUT( + QK_GESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_MINS, KC_EQL, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC, + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_LBRC, KC_RBRC, 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_LPRN, KC_RPRN, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_LCBR, KC_RCBR, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT, + KC_LCTL, KC_LGUI, KC_LALT, RGB_TOG, ADJUST, KC_SPC, KC_SPC, KC_SPC, KC_SPC, KC_LEFT, KC_DOWN, KC_UP, KC_RIGHT, KC_RCTL, + + KC_VOLD, KC_VOLU, KC_VOLD, KC_VOLU, KC_VOLD, KC_VOLU, KC_VOLD, KC_VOLU, KC_VOLD, KC_VOLU, KC_VOLD, KC_VOLU, + KC_VOLU, KC_VOLD, KC_MNXT, KC_MPLY, KC_MPRV, KC_VOLU, KC_VOLD, KC_MNXT, KC_MPLY, KC_MPRV + ), + + [_COLEMAK] = LAYOUT( + QK_GESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_F1, KC_F5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC, + KC_TAB, KC_Q, KC_W, KC_F, KC_P, KC_B, KC_F2, KC_F6, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_BSLS, + FN_CAPS, KC_A, KC_R, KC_S, KC_T, KC_G, KC_F3, KC_F7, KC_K, KC_N, KC_E, KC_I, KC_O, KC_QUOT, + KC_LSFT, KC_Z, KC_X, KC_C, KC_D, KC_V, KC_F4, KC_F8, KC_M, KC_H, KC_COMM, KC_DOT, KC_SLSH, KC_ENT, + KC_LCTL, KC_LGUI, KC_LALT, RGB_TOG, ADJUST, KC_SPC, KC_SPC, KC_SPC, KC_SPC, KC_LEFT, KC_DOWN, KC_UP, KC_RIGHT, KC_RCTL, + + KC_VOLD, KC_VOLU, KC_VOLD, KC_VOLU, KC_VOLD, KC_VOLU, KC_VOLD, KC_VOLU, KC_VOLD, KC_VOLU, KC_VOLD, KC_VOLU, + KC_VOLU, KC_VOLD, KC_MNXT, KC_MPLY, KC_MPRV, KC_VOLU, KC_VOLD, KC_MNXT, KC_MPLY, KC_MPRV + ), + + [_FN] = LAYOUT( + _______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F11, KC_F12, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, _______, + _______, 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, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, RGB_MOD, _______, _______, _______, _______, _______, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, + + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ + ), + + [_ADJUST] = LAYOUT( + _______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F11, KC_F12, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, _______, + _______, RGB_SAD, RGB_VAI, RGB_SAI, QK_BOOT, _______, _______, _______, _______, KC_P7, KC_P8, KC_P9, _______, _______, + _______, RGB_HUD, RGB_VAD, RGB_HUI, RGB_RST, _______, _______, _______, _______, 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, + + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ + ) +}; + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + switch (keycode) + { + case MENU_BTN: + if (record->event.pressed) { + rgb_menu_selection(); + } + return false; + case MENU_UP: + if (record->event.pressed) { + rgb_menu_action(true); + } + return false; + case MENU_DN: + if (record->event.pressed) { + rgb_menu_action(false); + } + return false; + case RGB_RST: + if (record->event.pressed) { + eeconfig_update_rgb_matrix_default(); + } + return false; + case TCH_TOG: + if (record->event.pressed) { + touch_encoder_toggle(); + } + return false; // Skip all further processing of this key + default: + return true; + } +} + +void render_layer_status(void) { + // Host Keyboard Layer Status + oled_write_P(PSTR("Layer"), false); + switch (get_highest_layer(layer_state)) { + case _QWERTY: + oled_write_ln_P(PSTR("QWRTY"), false); + break; + case _COLEMAK: + oled_write_ln_P(PSTR("Colemk"), false); + break; + case _FN: + oled_write_ln_P(PSTR("FN "), false); + break; + case _ADJUST: + oled_write_ln_P(PSTR("Adjst"), false); + break; + default: + oled_write_ln_P(PSTR("Undef"), false); + } +} \ No newline at end of file diff --git a/keyboards/rgbkb/mun2/keymaps/vial/rules.mk b/keyboards/rgbkb/mun2/keymaps/vial/rules.mk new file mode 100644 index 0000000000..31bb6d699f --- /dev/null +++ b/keyboards/rgbkb/mun2/keymaps/vial/rules.mk @@ -0,0 +1,3 @@ +VIA_ENABLE = yes +VIAL_ENABLE = yes +VIALRGB_ENABLE = yes \ No newline at end of file diff --git a/keyboards/rgbkb/mun2/keymaps/vial/vial.json b/keyboards/rgbkb/mun2/keymaps/vial/vial.json new file mode 100644 index 0000000000..a91e92ccfb --- /dev/null +++ b/keyboards/rgbkb/mun2/keymaps/vial/vial.json @@ -0,0 +1,173 @@ +{ + "lighting": "none", + "matrix": { + "rows": 14, + "cols": 8 + }, + "layouts": { + "labels":[], + "keymap":[ + [ + { + "c": "#d1d1d1", + "w": 1.5 + }, + "1,0", + "0,2", + "0,3", + "0,4", + "0,5", + "0,6", + "0,7", + { + "x": 1 + }, + "7,7", + "7,6", + "7,5", + "7,4", + "7,3", + "7,2", + { + "w": 1.5 + }, + "8,0" + ], + [ + { + "w": 1.5 + }, + "1,1", + "1,2", + "1,3", + "1,4", + "1,5", + "1,6", + "1,7", + { + "x": 1 + }, + "8,7", + "8,6", + "8,5", + "8,4", + "8,3", + "8,2", + { + "w": 1.5 + }, + "8,1" + ], + [ + { + "w": 1.5 + }, + "2,1", + "2,2", + "2,3", + "2,4", + "2,5", + "2,6", + "2,7", + { + "x": 1 + }, + "9,7", + "9,6", + "9,5", + "9,4", + "9,3", + "9,2", + { + "w": 1.5 + }, + "9,1" + ], + [ + { + "w": 1.5 + }, + "3,1", + "3,2", + "3,3", + "3,4", + "3,5", + "3,6", + "3,7", + { + "x": 1 + }, + "10,7", + "10,6", + "10,5", + "10,4", + "10,3", + "10,2", + { + "w": 1.5 + }, + "10,1" + ], + [ + { + "w": 1.5 + }, + "3,0", + "4,2", + "4,3", + "4,4", + "4,5", + "4,6", + "4,7", + { + "x": 1 + }, + "11,7", + "11,6", + "11,5", + "11,4", + "11,3", + "11,2", + { + "w": 1.5 + }, + "10,0" + ], + [ + { + "y": 0.25 + }, + "5,0", + "5,1", + "5,2", + "5,3", + "5,4", + "5,5", + { + "x": 4 + }, + "12,0", + "12,1", + "12,2", + "12,3", + "12,4", + "12,5" + ], + [ + "6,0", + "6,1", + "6,2", + "6,3", + "6,4", + { + "x": 6 + }, + "13,0", + "13,1", + "13,2", + "13,3", + "13,4" + ] +] + } +} \ No newline at end of file diff --git a/keyboards/rgbkb/mun2/mcuconf.h b/keyboards/rgbkb/mun2/mcuconf.h new file mode 100644 index 0000000000..7602048e2a --- /dev/null +++ b/keyboards/rgbkb/mun2/mcuconf.h @@ -0,0 +1,18 @@ +/* + * ---------------------------------------------------------------------------- + * "THE BEER-WARE LICENSE" (Revision 42): + * wrote this file. As long as you retain this + * notice you can do whatever you want with this stuff. If we meet some day, and + * you think this stuff is worth it, you can buy me a beer in return. David Rauseo + * ---------------------------------------------------------------------------- + */ + +#pragma once + +#include_next "mcuconf.h" + +#undef RP_I2C_USE_I2C0 +#define RP_I2C_USE_I2C0 TRUE + +#undef RP_SIO_USE_UART0 +#define RP_SIO_USE_UART0 TRUE \ No newline at end of file diff --git a/keyboards/rgbkb/mun2/mun2.c b/keyboards/rgbkb/mun2/mun2.c new file mode 100644 index 0000000000..3536e9aa20 --- /dev/null +++ b/keyboards/rgbkb/mun2/mun2.c @@ -0,0 +1,23 @@ +/* + * ---------------------------------------------------------------------------- + * "THE BEER-WARE LICENSE" (Revision 42): + * wrote this file. As long as you retain this + * notice you can do whatever you want with this stuff. If we meet some day, and + * you think this stuff is worth it, you can buy me a beer in return. David Rauseo + * ---------------------------------------------------------------------------- + */ + +#include "mun2.h" +#include + +void keyboard_post_init_kb(void) { + touch_encoder_init(); + transaction_register_rpc(TOUCH_ENCODER_SYNC, touch_encoder_slave_sync); + transaction_register_rpc(RGB_MENU_SYNC, rgb_menu_slave_sync); + keyboard_post_init_user(); +} + +void housekeeping_task_kb(void) { + touch_encoder_update(TOUCH_ENCODER_SYNC); + rgb_menu_update(RGB_MENU_SYNC); +} \ No newline at end of file diff --git a/keyboards/rgbkb/mun2/mun2.h b/keyboards/rgbkb/mun2/mun2.h new file mode 100644 index 0000000000..ccb4dbcd36 --- /dev/null +++ b/keyboards/rgbkb/mun2/mun2.h @@ -0,0 +1,26 @@ +/* + * Copyright 2022 + * + * 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 + +#if defined(KEYBOARD_rgbkb_mun2_rev1) +# include "rev1.h" +#endif + +#include "quantum.h" +#include "touch_encoder.h" +#include "common_oled.h" diff --git a/keyboards/rgbkb/mun2/readme.md b/keyboards/rgbkb/mun2/readme.md new file mode 100644 index 0000000000..6b5b5fc9fb --- /dev/null +++ b/keyboards/rgbkb/mun2/readme.md @@ -0,0 +1,3 @@ +# Mun 2 + +* To flash the keyboard, plug the PCB in while holding the BOOT button. Or, while it's plugged in, hold BOOT and tap RESET. Then, drag your .uf2 file into the new file storage device that should pop up. diff --git a/keyboards/rgbkb/mun2/rev1/info.json b/keyboards/rgbkb/mun2/rev1/info.json new file mode 100644 index 0000000000..bd43b6533d --- /dev/null +++ b/keyboards/rgbkb/mun2/rev1/info.json @@ -0,0 +1,142 @@ +{ + "keyboard_name": "Mun 2", + "manufacturer": "RGBKB", + "url": "https://github.com/", + "maintainer": "Legonut, RGBKB, XScorpion2", + "usb": { + "vid": "0x3535", + "pid": "0x3510", + "device_version": "0.0.1" + }, + "layouts": { + "LAYOUT": { + "layout": [ + { "x": 0, "y": 0 }, + { "x": 1, "y": 0 }, + { "x": 2, "y": 0 }, + { "x": 3, "y": 0 }, + { "x": 4, "y": 0 }, + { "x": 5, "y": 0 }, + { "x": 6, "y": 0 }, + { "x": 7, "y": 0 }, + + //{ "x": 15, "y": 0 }, + ///{ "x": 14, "y": 0 }, + { "x": 13, "y": 0 }, + { "x": 12, "y": 0 }, + { "x": 11, "y": 0 }, + { "x": 10, "y": 0 }, + { "x": 9, "y": 0 }, + { "x": 8, "y": 0 }, + + { "x": 0, "y": 1 }, + { "x": 1, "y": 1 }, + { "x": 2, "y": 1 }, + { "x": 3, "y": 1 }, + { "x": 4, "y": 1 }, + { "x": 5, "y": 1 }, + { "x": 6, "y": 1 }, + { "x": 7, "y": 1 }, + + //{ "x": 15, "y": 1 }, + //{ "x": 14, "y": 1 }, + { "x": 13, "y": 1 }, + { "x": 12, "y": 1 }, + { "x": 11, "y": 1 }, + { "x": 10, "y": 1 }, + { "x": 9, "y": 1 }, + { "x": 8, "y": 1 }, + + { "x": 0, "y": 2 }, + { "x": 1, "y": 2 }, + { "x": 2, "y": 2 }, + { "x": 3, "y": 2 }, + { "x": 4, "y": 2 }, + { "x": 5, "y": 2 }, + { "x": 6, "y": 2 }, + { "x": 7, "y": 2 }, + + //{ "x": 15, "y": 2 }, + //{ "x": 14, "y": 2 }, + { "x": 13, "y": 2 }, + { "x": 12, "y": 2 }, + { "x": 11, "y": 2 }, + { "x": 10, "y": 2 }, + { "x": 9, "y": 2 }, + { "x": 8, "y": 2 }, + + { "x": 0, "y": 3 }, + { "x": 1, "y": 3 }, + { "x": 2, "y": 3 }, + { "x": 3, "y": 3 }, + { "x": 4, "y": 3 }, + { "x": 5, "y": 3 }, + { "x": 6, "y": 3 }, + { "x": 7, "y": 3 }, + + //{ "x": 15, "y": 3 }, + //{ "x": 14, "y": 3 }, + { "x": 13, "y": 3 }, + { "x": 12, "y": 3 }, + { "x": 11, "y": 3 }, + { "x": 10, "y": 3 }, + { "x": 9, "y": 3 }, + { "x": 8, "y": 3 }, + + { "x": 0, "y": 4 }, + { "x": 1, "y": 4 }, + { "x": 2, "y": 4 }, + { "x": 3, "y": 4 }, + { "x": 4, "y": 4 }, + { "x": 5, "y": 4 }, + { "x": 6, "y": 4 }, + { "x": 7, "y": 4 }, + + //{ "x": 15, "y": 4 }, + //{ "x": 14, "y": 4 }, + { "x": 13, "y": 4 }, + { "x": 12, "y": 4 }, + { "x": 11, "y": 4 }, + { "x": 10, "y": 4 }, + { "x": 9, "y": 4 }, + { "x": 8, "y": 4 }, + + { "x": 0, "y": 5 }, + { "x": 1, "y": 5 }, + { "x": 2, "y": 5 }, + { "x": 3, "y": 5 }, + { "x": 4, "y": 5 }, + { "x": 5, "y": 5 }, + { "x": 6, "y": 5 }, + { "x": 7, "y": 5 }, + + //{ "x": 15, "y": 5 }, + //{ "x": 14, "y": 5 }, + //{ "x": 13, "y": 5 }, + //{ "x": 12, "y": 5 }, + { "x": 11, "y": 5 }, + { "x": 10, "y": 5 }, + { "x": 9, "y": 5 }, + { "x": 8, "y": 5 }, + + { "x": 0, "y": 6 }, + { "x": 1, "y": 6 }, + { "x": 2, "y": 6 }, + { "x": 3, "y": 6 }, + { "x": 4, "y": 6 }, + { "x": 5, "y": 6 }, + { "x": 6, "y": 6 }, + { "x": 7, "y": 0 }, + + //{ "x": 15, "y": 6 }, + //{ "x": 14, "y": 6 }, + //{ "x": 13, "y": 6 }, + //{ "x": 12, "y": 6 }, + //{ "x": 11, "y": 6 }, + //{ "x": 10, "y": 6 }, + { "x": 9, "y": 6 }, + { "x": 8, "y": 6 } + ] + } + } +} \ No newline at end of file diff --git a/keyboards/rgbkb/mun2/rev1/rev1.c b/keyboards/rgbkb/mun2/rev1/rev1.c new file mode 100644 index 0000000000..708439eb6c --- /dev/null +++ b/keyboards/rgbkb/mun2/rev1/rev1.c @@ -0,0 +1,235 @@ +/* + * ---------------------------------------------------------------------------- + * "THE BEER-WARE LICENSE" (Revision 42): + * wrote this file. As long as you retain this + * notice you can do whatever you want with this stuff. If we meet some day, and + * you think this stuff is worth it, you can buy me a beer in return. David Rauseo + * ---------------------------------------------------------------------------- + */ + +#include "rev1.h" +#include "split_util.h" + +#define NUMBER_OF_TOUCH_ENCODERS 2 +#define TOUCH_ENCODER_OPTIONS TOUCH_SEGMENTS + 2 + +#define NUMBER_OF_ENCODERS 6 +#define ENCODER_OPTIONS 2 + +typedef struct PACKED { + uint8_t r; + uint8_t c; +} encodermap_t; + +// this maps encoders and then touch encoders to their respective electrical matrix entry +// mapping is row (y) then column (x) when looking at the electrical layout +const encodermap_t encoder_map[NUMBER_OF_ENCODERS][ENCODER_OPTIONS] = +{ + { { 5, 0 }, { 5, 1 } }, // Encoder 0 matrix entries + { { 5, 2 }, { 5, 3 } }, // Encoder 1 matrix entries + { { 5, 4 }, { 5, 5 } }, // Encoder 2 matrix entries + { { 12, 0 }, { 12, 1 } }, // Encoder 3 matrix entries + { { 12, 2 }, { 12, 3 } }, // Encoder 4 matrix entries + { { 12, 4 }, { 12, 5 } } // Encoder 5 matrix entries +}; + +const encodermap_t touch_encoder_map[NUMBER_OF_TOUCH_ENCODERS][TOUCH_ENCODER_OPTIONS] = +{ + { { 6, 0 }, { 6, 1 }, { 6, 2 }, { 6, 3 }, { 6, 4 }, }, // Touch Encoder 0 matrix entries + { { 13, 0 }, { 13, 1 }, { 13, 2 }, { 13, 3 }, { 13, 4 }, } // Touch Encoder 1 matrix entries +}; + +static void process_encoder_matrix(encodermap_t pos) { + action_exec(MAKE_KEYEVENT(pos.r, pos.c, true)); +#if TAP_CODE_DELAY > 0 + wait_ms(TAP_CODE_DELAY); +#endif + action_exec(MAKE_KEYEVENT(pos.r, pos.c, false)); +} + +bool encoder_update_kb(uint8_t index, bool clockwise) { + if (!encoder_update_user(index, clockwise)) + return false; + + // Mapping clockwise (typically increase) to zero, and counter clockwise (decrease) to 1 + process_encoder_matrix(encoder_map[index][clockwise ? 0 : 1]); + return false; +} + +bool touch_encoder_update_kb(uint8_t index, bool clockwise) { + if (!touch_encoder_update_user(index, clockwise)) + return false; + + // Mapping clockwise (typically increase) to zero, and counter clockwise (decrease) to 1 + process_encoder_matrix(touch_encoder_map[index][clockwise ? 0 : 1]); + return false; +} + +bool touch_encoder_tapped_kb(uint8_t index, uint8_t section) { + if (!touch_encoder_tapped_user(index, section)) + return false; + + process_encoder_matrix(touch_encoder_map[index][section + 2]); + return false; +} + +#ifdef RGB_MATRIX_ENABLE +// clang-format off +led_config_t g_led_config = { { + { NO_LED, NO_LED, 1, 2, 3, 4, 5, 6}, + { 0, 13, 12, 11, 10, 9, 8, 7}, + { NO_LED, 14, 15, 16, 17, 18, 19, 20}, + { 28, 27, 26, 25, 24, 23, 22, 21}, + { NO_LED, NO_LED, 29, 30, 31, 32, 33, 34}, + + { 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, 36, 37, 38, 39, 40, 41}, + { 35, 48, 47, 46, 45, 44, 43, 42}, + { NO_LED, 49, 50, 51, 52, 53, 54, 55}, + { 63, 62, 61, 60, 59, 58, 57, 56}, + { NO_LED, NO_LED, 64, 65, 66, 67, 68, 69}, + + { 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 } +}, { + { 11, 16},{ 34, 16},{ 49, 16},{ 64, 16},{ 79, 16},{ 94, 16},{ 109, 16}, + { 109, 31},{ 94, 31},{ 79, 31},{ 64, 31},{ 49, 31},{ 34, 31},{ 11, 31}, + { 11, 46},{ 34, 46},{ 49, 46},{ 64, 46},{ 79, 46},{ 94, 46},{ 109, 46}, + { 109, 61},{ 94, 61},{ 79, 61},{ 64, 61},{ 49, 61},{ 34, 61},{ 11, 61}, + { 11, 76},{ 34, 76},{ 49, 76},{ 64, 76},{ 79, 72},{ 94, 72},{ 109, 72}, + + //{ 97, 5},{ 91, 5},{ 86, 5},{ 80, 5},{ 75, 5},{ 69, 5},{ 63, 5}, + //{ 58, 5},{ 52, 5},{ 46, 5},{ 41, 5},{ 35, 5},{ 30, 5},{ 24, 5},{ 18, 5}, + + { 219, 16},{ 199, 16},{ 184, 16},{ 169, 16},{ 154, 16},{ 139, 16},{ 124, 16}, + { 124, 31},{ 139, 31},{ 154, 31},{ 169, 31},{ 184, 31},{ 199, 31},{ 219, 31}, + { 219, 46},{ 199, 46},{ 184, 46},{ 169, 46},{ 154, 46},{ 139, 46},{ 124, 46}, + { 124, 61},{ 139, 61},{ 154, 61},{ 169, 61},{ 184, 61},{ 199, 61},{ 219, 61}, + { 219, 76},{ 199, 76},{ 184, 76},{ 169, 76},{ 154, 72},{ 139, 72},{ 124, 72} + + //{ 159, 5},{ 164, 5},{ 170, 5},{ 176, 5},{ 181, 5},{ 187, 5},{ 192, 5}, + //{ 198, 5},{ 204, 5},{ 209, 5},{ 215, 5},{ 221, 5},{ 226, 5},{ 232, 5},{ 238, 5} + +}, { + 1, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 1, + 1, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 1, + 1, 1, 1, 1, 1, 1, 1, + //2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 1, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 1, + 1, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 1, + 1, 1, 1, 1, 1, 1, 1 + //2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 + +} }; +// clang-format on + +void rgb_matrix_increase_flags(void) +{ + switch (rgb_matrix_get_flags()) { + case LED_FLAG_ALL: { + rgb_matrix_set_flags(LED_FLAG_KEYLIGHT | LED_FLAG_MODIFIER); + rgb_matrix_set_color_all(0, 0, 0); + } + break; + case LED_FLAG_KEYLIGHT | LED_FLAG_MODIFIER: { + rgb_matrix_set_flags(LED_FLAG_UNDERGLOW); + rgb_matrix_set_color_all(0, 0, 0); + } + break; + case LED_FLAG_UNDERGLOW: { + rgb_matrix_set_flags(LED_FLAG_NONE); + rgb_matrix_disable_noeeprom(); + } + break; + default: { + rgb_matrix_set_flags(LED_FLAG_ALL); + rgb_matrix_enable_noeeprom(); + } + break; + } +} +#endif + + +__attribute__((weak)) +void render_layer_status(void) { + // Keymap specific, expected to be overridden + // Host Keyboard Layer Status + oled_write_P(PSTR("Layer"), false); + oled_write_ln_P(PSTR("Undef"), false); +} + +__attribute__((weak)) +void render_leds_status(void) +{ + // Host Keyboard LED Status + static const char PROGMEM led_icon[] = { + 0x0F,0x3A,0 + }; + oled_write_P(led_icon, false); + led_t led_state = host_keyboard_led_state(); + oled_write_P( led_state.num_lock ? PSTR("N") : PSTR(" "), false); + oled_write_P( led_state.caps_lock ? PSTR("C") : PSTR(" "), false); + oled_write_P(led_state.scroll_lock ? PSTR("S") : PSTR(" "), false); +} + +__attribute__((weak)) +void render_touch_status(void) +{ + // Host Touch LED Status + static const char PROGMEM touch_icon[] = { + 0x12,0x3A,0 + }; + oled_write_P(touch_icon, false); + oled_write_P( touch_encoder_is_on() ? PSTR("T") : PSTR(" "), false); + oled_write_P(touch_encoder_is_calibrating() ? PSTR("C") : PSTR(" "), false); + oled_write_P(PSTR(" "), false); +} + +oled_rotation_t oled_init_kb(oled_rotation_t rotation) { + // Sol 3 uses OLED_ROTATION_270 for default rotation on both halves + return oled_init_user(OLED_ROTATION_270); +} + +bool oled_task_kb(void) { + if (!oled_task_user()) + return false; + + if (is_keyboard_left()) { + render_icon(); + oled_write_P(PSTR(" "), false); + render_layer_status(); + oled_write_P(PSTR(" "), false); + render_leds_status(); + oled_write_P(PSTR(" "), false); + render_touch_status(); + } + else { + render_icon(); + oled_write_P(PSTR(" "), false); + render_rgb_menu(); + } + return false; +} + +//bool process_record_kb(uint16_t keycode, keyrecord_t *record) { +// if (!process_record_user(keycode, record)) +// return false; +// +// switch(keycode) { +//#ifdef RGB_MATRIX_ENABLE +// case RGB_TOG: +// if (record->event.pressed) { +// rgb_matrix_increase_flags(); +// } +// return false; +//#endif +// } +// return true; +//}; diff --git a/keyboards/rgbkb/mun2/rev1/rev1.h b/keyboards/rgbkb/mun2/rev1/rev1.h new file mode 100644 index 0000000000..1cdd6e5ee4 --- /dev/null +++ b/keyboards/rgbkb/mun2/rev1/rev1.h @@ -0,0 +1,74 @@ +/* + * ---------------------------------------------------------------------------- + * "THE BEER-WARE LICENSE" (Revision 42): + * wrote this file. As long as you retain this + * notice you can do whatever you want with this stuff. If we meet some day, and + * you think this stuff is worth it, you can buy me a beer in return. David Rauseo + * ---------------------------------------------------------------------------- + */ + +#pragma once + +#include "mun2.h" + +// clang-format off +/* Blank ascii map to reuse, with labeled possible encoder positions +┌──────┬──────┬──────┬──────┬──────┬──────┬──────┐ ┌──────┬──────┬──────┬──────┬──────┬──────┬──────┐ +│ │ │ │ │ │ │ E1 │ │ E4 │ │ │ │ │ │ │ +├──────┼──────┼──────┼──────┼──────┼──────┼──────┤ ├──────┼──────┼──────┼──────┼──────┼──────┼──────┤ +│ │ │ │ │ │ │ E1 │ │ E4 │ │ │ │ │ │ │ +├──────┼──────┼──────┼──────┼──────┼──────┼──────┤ ├──────┼──────┼──────┼──────┼──────┼──────┼──────┤ +│ │ │ │ │ | │ E2 │ │ E5 │ │ │ │ │ │ │ +├──────┼──────┼──────┼──────┼──────┼──────┼──────┤ ├──────┼──────┼──────┼──────┼──────┼──────┼──────┤ +│ │ │ │ │ │ │ E2 │ │ E5 │ │ │ │ │ │ │ +├──────┼──────┼──────┼──────┼──────┼──────┼──────┤ ├──────┼──────┼──────┼──────┼──────┼──────┼──────┤ +│ │ │ E3 │ E3 │ E3 │ │ │ │ │ │ E6 │ E6 │ E6 │ │ │ +└──────┴──────┴──────┴──────┴──────┴──────┴──────┘ └──────┴──────┴──────┴──────┴──────┴──────┴──────┘ +┌──────┬──────┬──────┬──────┬──────┬──────┐ ┌──────┬──────┬──────┬──────┬──────┬──────┐ +│ E0↑ │ E0↓ │ E1↑ │ E1↓ │ E2↑ │ E2↓ │ │ E3↑ │ E3↓ │ E4↑ │ E4↓ │ E5↑ │ E5↓ │ +└──────┴──────┴──────┴──────┴──────┴──────┘ └──────┴──────┴──────┴──────┴──────┴──────┘ +┌──────┬──────┬──────┬──────┬──────┐ ┌──────┬──────┬──────┬──────┬──────┐ +│ T0↑ │ T0↓ │ │ │ │ │ T1↑ │ T1↓ │ │ │ │ +└──────┴──────┴──────┴──────┴──────┘ └──────┴──────┴──────┴──────┴──────┘ +*/ + +#define LAYOUT( \ + L10, L02, L03, L04, L05, L06, L07, R07, R06, R05, R04, R03, R02, R10, \ + L11, L12, L13, L14, L15, L16, L17, R17, R16, R15, R14, R13, R12, R11, \ + L21, L22, L23, L24, L25, L26, L27, R27, R26, R25, R24, R23, R22, R21, \ + L31, L32, L33, L34, L35, L36, L37, R37, R36, R35, R34, R33, R32, R31, \ + L30, L42, L43, L44, L45, L46, L47, R47, R46, R45, R44, R43, R42, R30, \ + \ + E0L, E0R, E1L, E1R, E2L, E2R, E3L, E3R, E4L, E4R, E5L, E5R, \ + LT0, LT1, LT2, LSL, LSR, RT0, RT1, RT2, RSL, RSR \ +) \ +{ \ + /* Left Half */ \ + { KC_NO, KC_NO, L02, L03, L04, L05, L06, L07,}, \ + { L10, L11, L12, L13, L14, L15, L16, L17,}, \ + { KC_NO, L21, L22, L23, L24, L25, L26, L27,}, \ + { L30, L31, L32, L33, L34, L35, L36, L37,}, \ + { KC_NO, KC_NO, L42, L43, L44, L45, L46, L47,}, \ + { E0L, E0R, E1L, E1R, E2L, E2R, KC_NO, KC_NO, }, \ + { LT0, LT1, LT2, LSL, LSR, KC_NO, KC_NO, KC_NO }, \ + /* Right Half */ \ + { KC_NO, KC_NO, R02, R03, R04, R05, R06, R07,}, \ + { R10, R11, R12, R13, R14, R15, R16, R17,}, \ + { KC_NO, R21, R22, R23, R24, R25, R26, R27,}, \ + { R30, R31, R32, R33, R34, R35, R36, R37,}, \ + { KC_NO, KC_NO, R42, R43, R44, R45, R46, R47,}, \ + { E3L, E3R, E4L, E4R, E5L, E5R, KC_NO, KC_NO,}, \ + { RT0, RT1, RT2, RSL, RSR, KC_NO, KC_NO, KC_NO } \ +} +// clang-format on + +// weak functions overridable by the user +void render_layer_status(void); +void render_leds_status(void); +void render_touch_status(void); +void render_audio_status(void); + +#ifdef RGB_MATRIX_ENABLE +// utility function to cycle active led zones +void rgb_matrix_increase_flags(void); +#endif \ No newline at end of file diff --git a/keyboards/rgbkb/mun2/rev1/rules.mk b/keyboards/rgbkb/mun2/rev1/rules.mk new file mode 100644 index 0000000000..e69de29bb2 diff --git a/keyboards/rgbkb/mun2/rules.mk b/keyboards/rgbkb/mun2/rules.mk new file mode 100644 index 0000000000..73d69cf0de --- /dev/null +++ b/keyboards/rgbkb/mun2/rules.mk @@ -0,0 +1,42 @@ +# MCU name +MCU = RP2040 + +# Bootloader selection +BOOTLOADER = rp2040 + +# Touch encoder needs +VPATH += keyboards/rgbkb/common +SRC += touch_encoder.c +SRC += common_oled.c +QUANTUM_LIB_SRC += i2c_master.c + +# Build Options +# change yes to no to disable +# +BOOTMAGIC_ENABLE = yes # Enable Bootmagic Lite +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 +NKRO_ENABLE = yes # Enable N-Key Rollover +AUDIO_ENABLE = no # Audio output + +DYNAMIC_MACRO_ENABLE = yes +DIP_SWITCH_ENABLE = no + +WS2812_DRIVER = vendor +RGBLIGHT_ENABLE = no +RGB_MATRIX_ENABLE = yes +RGB_MATRIX_DRIVER = ws2812 + +OLED_ENABLE = yes +OLED_DRIVER = ssd1306 # Enable the OLED Driver + +ENCODER_ENABLE = yes + +SPLIT_KEYBOARD = yes +SERIAL_DRIVER = vendor + +OPT_DEFS += -DOLED_FONT_H=\"keyboards/rgbkb/common/glcdfont.c\" + +DEFAULT_FOLDER = rgbkb/mun2/rev1 \ No newline at end of file