1
0
Fork 0

Keyboards/RGBKB/Mün (#13239)

This commit is contained in:
XScorpion2 2021-06-26 00:00:21 -05:00 committed by GitHub
parent f8c01a8e5a
commit 8b059088ba
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
27 changed files with 2049 additions and 0 deletions

View file

View file

@ -0,0 +1,106 @@
/*
* ----------------------------------------------------------------------------
* "THE BEER-WARE LICENSE" (Revision 42):
* <https://github.com/Legonut> 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"
/* USB Device descriptor parameter */
#define VENDOR_ID 0x3535
#define PRODUCT_ID 0x3505
#define MANUFACTURER RGBKB
#define PRODUCT Mün
#define USB_POLLING_INTERVAL_MS 1
/* Matrix Configuration - Rows are doubled up */
#define MATRIX_ROWS 14
// B1, A2 reserved for encoder / touch encoder support
#define MATRIX_ROW_PINS { A1, A3, B3, A13, B15, B1, A2 }
#define MATRIX_COLS 7
#define MATRIX_COL_PINS { A0, B11, B0, B10, B12, B2, A8 }
#define MATRIX_IO_DELAY 5
#define BUSY_WAIT
#define BUSY_WAIT_INSTRUCTIONS 35 // Increase if two rows are pressed at the same time.
#define GPIO_INPUT_PIN_DELAY 10
/* 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
/* Encoder Configuration */
#define ENCODERS_PAD_A { B8, B9 }
#define ENCODERS_PAD_B { A14, A15 }
#define TOUCH_SEGMENTS 3
/* COL2ROW or ROW2COL */
#define DIODE_DIRECTION COL2ROW
/* CRC Configuration */
#define CRC8_OPTIMIZE_SPEED
#define CRC8_USE_TABLE
/* Split Keyboard Configuration */
#define EE_HANDS
#define SPLIT_USB_DETECT
// also handles the SERIAL_USART_TX_PIN define
#define SOFT_SERIAL_PIN A9
#define SERIAL_USART_TX_PAL_MODE 7
#define SERIAL_USART_TIMEOUT 5
#define SERIAL_USART_DRIVER SD1
//#define SERIAL_USART_FULL_DUPLEX - Waiting on reunification pr
#if SERIAL_USART_FULL_DUPLEX
#define SERIAL_USART_RX_PIN A10
#define SERIAL_USART_RX_PAL_MODE 7
// Mun connects TX to TX and RX to RX as we were planning on i2c split, so we need pin swap for full duplex
#define SERIAL_USART_PIN_SWAP
#define SERIAL_USART_SPEED (2 * 1024 * 1024)
#else
#define SERIAL_USART_SPEED (1 * 1024 * 1024)
#endif
/* Split Transport Features */
#define SPLIT_TRANSPORT_MIRROR
#define SPLIT_LAYER_STATE_ENABLE
#define SPLIT_LED_STATE_ENABLE
#define SPLIT_TRANSACTION_IDS_KB TOUCH_ENCODER_SYNC, RGB_MENU_SYNC
/* RGB LED Configuration */
#define RGB_DI_PIN B5
#define RGBLED_NUM 98
#define RGBLED_SPLIT { 49, 49 }
#define RGBLIGHT_ANIMATIONS
#define DRIVER_LED_TOTAL RGBLED_NUM
#define RGB_MATRIX_SPLIT RGBLED_SPLIT
#define RGB_MATRIX_CENTER { 128, 34 }
#define RGB_MATRIX_LED_FLUSH_LIMIT 33
#define RGB_MATRIX_LED_PROCESS_LIMIT 10
#define RGB_MATRIX_KEYPRESSES
#define RGB_MATRIX_FRAMEBUFFER_EFFECTS
#define RGB_DISABLE_WHEN_USB_SUSPENDED true
#if RGB_UNLIMITED_POWER
#define RGBLIGHT_LIMIT_VAL 255
#else
#define RGBLIGHT_LIMIT_VAL 127
#endif
#define RGB_MATRIX_MAXIMUM_BRIGHTNESS RGBLIGHT_LIMIT_VAL
#define WS2812_PWM_DRIVER PWMD3
#define WS2812_PWM_CHANNEL 2
#define WS2812_PWM_PAL_MODE 2
#define WS2812_DMA_STREAM STM32_DMA1_STREAM3
#define WS2812_DMA_CHANNEL 3
#define TOUCH_UPDATE_INTERVAL 33
#define OLED_UPDATE_INTERVAL 33
#define TAP_CODE_DELAY 5

View file

@ -0,0 +1,24 @@
/*
* ----------------------------------------------------------------------------
* "THE BEER-WARE LICENSE" (Revision 42):
* <https://github.com/Legonut> 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
//#define HAL_USE_DAC TRUE
//#define HAL_USE_GPT TRUE
#define HAL_USE_I2C TRUE
#define HAL_USE_PWM TRUE
#define HAL_USE_SERIAL TRUE
#define HAL_USE_SERIAL_USB TRUE
#include_next <halconf.h>

View file

@ -0,0 +1,32 @@
/*
* ----------------------------------------------------------------------------
* "THE BEER-WARE LICENSE" (Revision 42):
* <https://github.com/Legonut> 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
#define DISABLE_RGB_MATRIX_SOLID_REACTIVE_WIDE
#define DISABLE_RGB_MATRIX_SOLID_REACTIVE_CROSS
#define DISABLE_RGB_MATRIX_SOLID_REACTIVE_NEXUS
#define DISABLE_RGB_MATRIX_SPLASH
#define DISABLE_RGB_MATRIX_SOLID_SPLASH
// 20m timeout (20m * 60s * 1000mil)
// #define RGB_DISABLE_TIMEOUT 1200000
#define RGB_DISABLE_WHEN_USB_SUSPENDED true
#define VIA_EEPROM_LAYOUT_OPTIONS_SIZE 2
// 224B per layer right now
#define DYNAMIC_KEYMAP_LAYER_COUNT 8
#define DYNAMIC_KEYMAP_EEPROM_MAX_ADDR 2047
#define VIA_QMK_RGBLIGHT_ENABLE
#define STM32_ONBOARD_EEPROM_SIZE 2048

View file

@ -0,0 +1,252 @@
/*
* ----------------------------------------------------------------------------
* "THE BEER-WARE LICENSE" (Revision 42):
* <https://github.com/Legonut> 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
#include "common_oled.h"
enum keymap_layers {
_QWERTY,
_COLEMAK,
_GAME,
_FN,
_ADJUST,
_VIA1,
_VIA2,
_VIA3
};
enum keymap_keycodes {
// Disables touch processing
TCH_TOG = SAFE_RANGE,
MENU_BTN,
MENU_UP,
MENU_DN
};
// Default Layers
#define QWERTY DF(_QWERTY)
#define COLEMAK DF(_COLEMAK)
#define GAME DF(_GAME)
// Momentary Layers
#define FN MO(_FN)
#define ADJUST MO(_ADJUST)
#define FN_CAPS LT(_FN, KC_CAPS)
#define FN_ESC LT(_FN, KC_ESC)
/* This keyboard is enabled with an RGB Menu Control system.
This functionality is enabled, but still requires a little configuration based on your exact setup.
The RGB Menu will appear on the Right Half's OLED and can be controlled by the MENU keycodes:
MENU_BTN - Triggers a button action for the menu
MENU_UP - Triggers an increase action for the menu
MENU_DN - Triggers a decrease action for the menu
To finish configuration for your board, you will want to change the default keycodes for an encoder on the right half.
Encoder press keycode should be set to MENU_BTN, Clockwise should be MENU_UP, and Counter Clockwise should be MENU_DN.
Depending on where you add an encoder to the right half will determin in the default keymap where you should put those keycodes.
*/
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
/* QWERTY
* .--------------------------------------------------------------. .--------------------------------------------------------------.
* | `~/ESC | 1 | 2 | 3 | 4 | 5 | - | | = | 6 | 7 | 8 | 9 | 0 | Bckspc |
* |--------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------|
* | Tab | Q | W | E | R | T | [ | | ] | Y | U | I | O | P | \ |
* |--------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------|
* | FN/Caps| A | S | D | F | G | ( | | ) | H | J | K | L | : | ' |
* |--------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------|
* | Shift | Z | X | C | V | B | { | | } | N | M | , | . | / |Shft/Ent|
* |--------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------|
* | Ctrl | Win | Alt | RGBTOG | Adjust | Space | Bksp | | Enter | Space | Left | Down | Up | Right | Ctrl |
* '--------+--------+--------+--------+--------+--------+--------' '--------+--------+--------+--------+--------+--------+--------'
* Encoder 1 Encoder 2 Encoder 3 Encoder 4
* .-----------------------------------. .-----------------------------------.
* | VolUp | VolDn | VolUp | VolDn | | PgUp | PgDn | PgUp | PgDn |
* |--------+--------+--------+--------+--------. .--------+--------+--------+--------+--------|
* | VolDn | VolUp | Next | Play | Prev | Touch Encoder Touch Encoder | RgbHuI | RgbHuD | RgbMdD | RgbTog | RgbMdI |
* '--------+--------+--------+--------+--------' '--------+--------+--------+--------+--------'
*/
[_QWERTY] = LAYOUT(
KC_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_BSLASH,
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_SFTENT,
KC_LCTL, KC_LGUI, KC_LALT, RGB_TOG, ADJUST, KC_SPC, KC_DEL, KC_ENT, KC_SPC, KC_LEFT, KC_DOWN, KC_UP, KC_RIGHT,KC_RCTL,
KC_VOLU, KC_VOLD, KC_VOLU, KC_VOLD, KC_PGDN, KC_PGUP, KC_PGDN, KC_PGUP,
KC_VOLD, KC_VOLU, KC_MNXT, KC_MPLY, KC_MPRV, RGB_HUI, RGB_HUD, RGB_RMOD,RGB_TOG, RGB_MOD
),
[_COLEMAK] = LAYOUT(
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, KC_Q, KC_W, KC_F, KC_P, KC_G, _______, _______, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, _______,
_______, KC_A, KC_R, KC_S, KC_T, KC_D, _______, _______, KC_H, KC_N, KC_E, KC_I, KC_O, _______,
_______, KC_Z, KC_X, KC_C, KC_V, KC_B, _______, _______, KC_K, KC_M, KC_COMM, KC_DOT, KC_SLSH, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______
),
[_GAME] = LAYOUT(
_______, _______, _______, _______, _______, _______, KC_F1, KC_F5, _______, _______, _______, _______, _______, _______,
_______, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_F2, KC_F6, KC_Y, KC_U, KC_I, KC_O, KC_P, _______,
_______, KC_A, KC_S, KC_D, KC_F, KC_G, KC_F3, KC_F7, KC_H, KC_J, KC_K, KC_L, KC_SCLN, _______,
_______, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_F4, KC_F8, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, _______,
_______, KC_NO, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______
),
[_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_HOME, KC_UP, KC_END, _______, _______, _______, _______, _______, KC_HOME, KC_UP, KC_END, KC_PSCR, KC_PGUP,
_______, KC_LEFT, KC_DOWN, KC_RGHT, _______, _______, _______, _______, _______, KC_LEFT, KC_DOWN, KC_RGHT, KC_INS, KC_PGDN,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, TCH_TOG, _______, _______, _______, _______, _______, 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, RESET, _______, _______, _______, _______, 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, _______, GAME,
_______, RGB_RMOD,_______, RGB_MOD, _______, _______, _______, _______, _______, KC_P0, KC_PDOT, KC_NLCK, QWERTY, COLEMAK,
_______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______
),
[_VIA1] = LAYOUT(
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______
),
[_VIA2] = LAYOUT(
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______
),
[_VIA3] = LAYOUT(
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______
),
};
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 TCH_TOG:
if (record->event.pressed) {
touch_encoder_toggle();
}
return false; // Skip all further processing of this key
default:
return true;
}
}
static void render_layer(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 _GAME:
oled_write_ln_P(PSTR("Game "), 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);
}
}
static void render_leds(void)
{
// Host Keyboard LED Status
led_t led_state = host_keyboard_led_state();
oled_write_P(led_state.num_lock ? PSTR("NUMLK") : PSTR(" "), false);
oled_write_P(led_state.caps_lock ? PSTR("CAPLK") : PSTR(" "), false);
oled_write_P(led_state.scroll_lock ? PSTR("SCRLK") : PSTR(" "), false);
}
static void render_touch(void)
{
// Host Touch LED Status
oled_write_P(!touch_encoder_toggled() ? PSTR("TOUCH") : PSTR(" "), false);
oled_write_P(touch_encoder_calibrating() ? PSTR("CLBRT") : PSTR(" "), false);
}
void oled_task_user(void) {
if (is_keyboard_left()) {
render_icon();
oled_write_P(PSTR(" "), false);
render_layer();
oled_write_P(PSTR(" "), false);
render_leds();
oled_write_P(PSTR(" "), false);
render_touch();
}
else {
render_icon();
oled_write_P(PSTR(" "), false);
render_rgb_menu();
}
}
oled_rotation_t oled_init_user(oled_rotation_t rotation) {
return OLED_ROTATION_270;
}

View file

@ -0,0 +1 @@
VIA_ENABLE = yes

View file

@ -0,0 +1,42 @@
/*
* ----------------------------------------------------------------------------
* "THE BEER-WARE LICENSE" (Revision 42):
* <https://github.com/Legonut> 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
// Xulkal custom stuff
#undef TAPPING_FORCE_HOLD
#undef TAPPING_TERM
#define TAPPING_TERM 175
#define SPACE_CADET_MODIFIER_CARRYOVER
#define LSPO_KEYS KC_LSFT, KC_TRNS, KC_LBRC
#define RSPC_KEYS KC_RSFT, KC_TRNS, KC_RBRC
#define LCPO_KEYS KC_LCTL, KC_TRNS, KC_MINS
#define RCPC_KEYS KC_RCTL, KC_TRNS, KC_EQL
// No need for the single versions when multi performance isn't a problem =D
#define DISABLE_RGB_MATRIX_SOLID_REACTIVE_WIDE
#define DISABLE_RGB_MATRIX_SOLID_REACTIVE_CROSS
#define DISABLE_RGB_MATRIX_SOLID_REACTIVE_NEXUS
#define DISABLE_RGB_MATRIX_SPLASH
#define DISABLE_RGB_MATRIX_SOLID_SPLASH
// 20m timeout (20m * 60s * 1000mil)
// #define RGB_DISABLE_TIMEOUT 1200000
#define RGB_DISABLE_WHEN_USB_SUSPENDED true
#define OLED_SCROLL_TIMEOUT 20000
#define ONESHOT_TAP_TOGGLE 2
#define RGB_MATRIX_HUE_STEP 8
#define RGB_MATRIX_SAT_STEP 8
#define RGB_MATRIX_VAL_STEP 8
#define RGB_MATRIX_SPD_STEP 8
#define ENCODER_RESOLUTION 2

View file

@ -0,0 +1,246 @@
/*
* ----------------------------------------------------------------------------
* "THE BEER-WARE LICENSE" (Revision 42):
* <https://github.com/Legonut> 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
#include "common_oled.h"
enum keymap_layers {
_QWERTY,
_FUNCTION,
_ADJUST
};
enum keymap_keycodes {
// Disables touch processing
TCH_TOG = SAFE_RANGE,
MENU_BTN,
MENU_UP,
MENU_DN,
RGB_RST
};
// Default Layers
#define QWERTY DF(_QWERTY)
// Momentary Layers
#define FN OSL(_FUNCTION)
#define ADJ OSL(_ADJUST)
// clang-format off
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
/* QWERTY
* .--------------------------------------------------------------. .--------------------------------------------------------------.
* | `~/ESC | 1 | 2 | 3 | 4 | 5 | | | | 6 | 7 | 8 | 9 | 0 | Bckspc |
* |--------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------|
* | Tab | Q | W | E | R | T | | | | Y | U | I | O | P | \ |
* |--------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------|
* | Caps | A | S | D | F | G | Play | | MN BTN | H | J | K | L | : | Enter |
* |--------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------|
* | Shft[ | Z | X | C | V | B | { | | } | N | M | , | . | / | Shft] |
* |--------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------|
* | Ctrl- | Win | Alt | Del | Space | | ADJ | | FN | | Space | '" | Alt | App | Ctrl= |
* '--------+--------+--------+--------|--------+--------+--------' '--------+--------+--------+--------+--------+--------+--------'
* Encoder 1 Encoder 2 Encoder 3 Encoder 4
* .-----------------------------------. .-----------------------------------.
* | VolUp | VolDn | VolUp | VolDn | | PgUp | PgDn | PgUp | PgDn |
* |--------+--------+--------+--------+--------. .--------+--------+--------+--------+--------|
* | VolDn | VolUp | Next | Play | Prev | Touch Encoder Touch Encoder | RgbHuI | RgbHuD | RgbMdD | RgbTog | RgbMdI |
* '--------+--------+--------+--------+--------' '--------+--------+--------+--------+--------'
*/
[_QWERTY] = LAYOUT(
KC_GESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_NO, KC_NO, 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_NO, KC_NO, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSLS,
KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_MPLY, MENU_BTN,KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_ENT,
KC_LSPO, 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_RSPC,
KC_LCPO, KC_LGUI, KC_LALT, KC_DEL, KC_SPC, KC_NO, ADJ, FN, KC_NO, KC_SPC, KC_QUOTE,KC_RALT, KC_APP, KC_RCPC,
KC_VOLU, KC_VOLD, KC_VOLU, KC_VOLD, MENU_DN, MENU_UP, MENU_DN, MENU_UP,
KC_VOLD, KC_VOLU, KC_MNXT, KC_MPLY, KC_MPRV, RGB_HUI, RGB_HUD, RGB_RMOD,RGB_TOG, RGB_MOD
),
/* Function
* .--------------------------------------------------------------. .--------------------------------------------------------------.
* | F12 | F1 | F2 | F3 | F4 | F5 | | | | F6 | F7 | F8 | F9 | F10 | F11 |
* |--------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------|
* | | SPDI | SAI | VAI | HUI | RGBMD | | | | | | PrtScr | ScrLck | PseBrk | |
* |--------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------|
* | | SPDD | SAD | VAD | HUD | RGBRMD | | | | | | Ins | Home | PgUp | |
* |--------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------|
* | | RGBRST | | | | RGBTOG | | | | | | Del | End | PgDn | |
* |--------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------|
* | | | | | | | | | | | Play | Prev | Next | VolUp | VolDn |
* '--------+--------+--------+--------+--------+--------+--------' '--------+--------+--------+--------+--------+--------+--------'
* Encoder 1 Encoder 2 Encoder 3 Encoder 4
* .-----------------------------------. .-----------------------------------.
* | | | | | | | | | |
* |--------+--------+--------+--------+--------. .--------+--------+--------+--------+--------|
* | | | | | | Touch Encoder Touch Encoder | | | | | |
* '--------+--------+--------+--------+--------' '--------+--------+--------+--------+--------'
*/
[_FUNCTION] = LAYOUT(
KC_F12, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, _______, _______, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11,
_______, RGB_SPI, RGB_SAI, RGB_VAI, RGB_HUI, RGB_MOD, _______, _______, _______, _______, KC_PSCR, KC_SLCK, KC_PAUS, _______,
_______, RGB_SPD, RGB_SAD, RGB_VAD, RGB_HUD, RGB_RMOD,_______, _______, _______, _______, KC_INS, KC_HOME, KC_PGUP, _______,
_______, RGB_RST, _______, _______, _______, RGB_TOG, _______, _______, _______, _______, KC_DEL, KC_END, KC_PGDN, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, KC_MPLY, KC_MPRV, KC_MNXT, KC_VOLU, KC_VOLD,
_______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______
),
/* Adjust
* .--------------------------------------------------------------. .--------------------------------------------------------------.
* | | | | | | | | | | | NumLck | / | * | - | Del |
* |--------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------|
* | | Home | Up | End | Reset | T_TOG | | | | | 7 | 8 | 9 | + | |
* |--------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------|
* | | Left | Down | Right | | | | | | | 4 | 5 | 6 | + | |
* |--------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------|
* | | | | | | EepRst | | | | | 1 | 2 | 3 | Enter | |
* |--------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------|
* | | | | | | | | | | | | 0 | . | Enter | |
* '--------+--------+--------+--------+--------+--------+--------' '--------+--------+--------+--------+--------+--------+--------'
* Encoder 1 Encoder 2 Encoder 3 Encoder 4
* .-----------------------------------. .-----------------------------------.
* | | | | | | | | | |
* |--------+--------+--------+--------+--------. .--------+--------+--------+--------+--------|
* | | | | | | Touch Encoder Touch Encoder | | | | | |
* '--------+--------+--------+--------+--------' '--------+--------+--------+--------+--------'
*/
[_ADJUST] = LAYOUT(
KC_GRV, _______, _______, _______, _______, _______, _______, _______, _______, KC_NLCK, KC_PSLS, KC_PAST, KC_PMNS, KC_DEL,
_______, KC_HOME, KC_UP, KC_END, RESET, TCH_TOG, _______, _______, _______, KC_KP_7, KC_KP_8, KC_KP_9, KC_PPLS, _______,
_______, KC_LEFT, KC_DOWN, KC_RIGHT,_______, _______, _______, _______, _______, KC_KP_4, KC_KP_5, KC_KP_6, KC_PPLS, _______,
_______, _______, _______, _______, _______, EEP_RST, _______, _______, _______, KC_KP_1, KC_KP_2, KC_KP_3, KC_PENT, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_KP_0, KC_PDOT, KC_PENT, _______,
_______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______
)
};
// clang-format on
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;
}
}
static void render_layer(void) {
// Host Keyboard Layer Status
oled_write_P(PSTR("Layer"), false);
switch (get_highest_layer(layer_state)) {
case _QWERTY:
oled_write_ln_P(PSTR("BASE "), false);
break;
case _FUNCTION:
oled_write_ln_P(PSTR("FUNC "), false);
break;
case _ADJUST:
oled_write_ln_P(PSTR("ADJS "), false);
break;
}
}
static void render_leds(void)
{
// Host Keyboard LED Status
led_t led_state = host_keyboard_led_state();
oled_write_P(led_state.num_lock ? PSTR("NUMLK") : PSTR(" "), false);
oled_write_P(led_state.caps_lock ? PSTR("CAPLK") : PSTR(" "), false);
oled_write_P(led_state.scroll_lock ? PSTR("SCRLK") : PSTR(" "), false);
}
static void render_touch(void)
{
// Host Touch LED Status
oled_write_P(!touch_encoder_toggled() ? PSTR("TOUCH") : PSTR(" "), false);
oled_write_P(touch_encoder_calibrating() ? PSTR("CLBRT") : PSTR(" "), false);
}
/*static uint32_t scan_counter = 0;
static uint32_t scan_value = 0;
static uint16_t scan_timer = 1000;
void do_counters(void) {
scan_counter++;
uint16_t now = sync_timer_read();
if (timer_expired(now, scan_timer))
{
scan_timer += 1000;
scan_value = (scan_value + scan_counter) / 2;
scan_counter = 0;
}
}
void matrix_scan_user(void) {
do_counters();
}
void matrix_slave_scan_user(void) {
do_counters();
}
void render_debug_scan(void) {
static char buffer[6] = {0};
snprintf(buffer, sizeof(buffer), "%5d", scan_value);
oled_write_ln_P(buffer, false);
}*/
void oled_task_user(void) {
if (is_keyboard_left()) {
render_layer();
oled_write_P(PSTR(" "), false);
render_leds();
oled_write_P(PSTR(" "), false);
render_touch();
//oled_write_P(PSTR(" "), false);
//render_debug_scan();
oled_set_cursor(0, 12);
render_icon();
}
else {
render_rgb_menu();
//oled_write_P(PSTR(" "), false);
//render_debug_scan();
oled_set_cursor(0, 12);
render_icon();
}
}
oled_rotation_t oled_init_user(oled_rotation_t rotation) {
return OLED_ROTATION_270;
}

View file

@ -0,0 +1,4 @@
MOUSEKEY_ENABLE = yes # using for mouse wheel up and down, more granular than page up/down
OPT_DEFS += -DRGB_UNLIMITED_POWER
DEBOUNCE_TYPE = sym_eager_pk

View file

@ -0,0 +1,156 @@
/*
* ----------------------------------------------------------------------------
* "THE BEER-WARE LICENSE" (Revision 42):
* <https://github.com/KarlK90> 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. KarlK90
* ----------------------------------------------------------------------------
*/
#include <stdint.h>
#include <stdbool.h>
#include <string.h>
#include "util.h"
#include "matrix.h"
#include "debounce.h"
#include "quantum.h"
#include "split_util.h"
#include "config.h"
#include "transactions.h"
#define ERROR_DISCONNECT_COUNT 5
#define ROWS_PER_HAND (MATRIX_ROWS / 2)
static const pin_t row_pins[ROWS_PER_HAND] = MATRIX_ROW_PINS;
static const pin_t col_pins[MATRIX_COLS] = MATRIX_COL_PINS;
/* matrix state(1:on, 0:off) */
extern matrix_row_t raw_matrix[MATRIX_ROWS]; // raw values
extern matrix_row_t matrix[MATRIX_ROWS]; // debounced values
// row offsets for each hand
uint8_t thisHand, thatHand;
// user-defined overridable functions
__attribute__((weak)) void matrix_slave_scan_kb(void) { matrix_slave_scan_user(); }
__attribute__((weak)) void matrix_slave_scan_user(void) {}
static void init_pins(void) {
for (size_t i = 0; i < MATRIX_COLS; i++) {
setPinInputHigh(col_pins[i]);
}
for (size_t i = 0; i < ROWS_PER_HAND; i++) {
setPinOutput(row_pins[i]);
writePinHigh(row_pins[i]);
}
}
void matrix_init(void) {
split_pre_init();
thisHand = isLeftHand ? 0 : (ROWS_PER_HAND);
thatHand = ROWS_PER_HAND - thisHand;
// initialize key pins
init_pins();
// initialize matrix state: all keys off
memset(raw_matrix, 0, sizeof(raw_matrix));
memset(matrix, 0, sizeof(matrix));
debounce_init(ROWS_PER_HAND);
matrix_init_quantum();
split_post_init();
}
bool matrix_post_scan(void) {
bool changed = false;
if (is_keyboard_master()) {
static uint8_t error_count;
matrix_row_t slave_matrix[ROWS_PER_HAND] = {0};
if (!transport_master(matrix + thisHand, slave_matrix)) {
error_count++;
if (error_count > ERROR_DISCONNECT_COUNT) {
// reset other half if disconnected
memset(&matrix[thatHand], 0, sizeof(slave_matrix));
memset(slave_matrix, 0, sizeof(slave_matrix));
changed = true;
}
} else {
error_count = 0;
if (memcmp(&matrix[thatHand], slave_matrix, sizeof(slave_matrix)) != 0) {
memcpy(&matrix[thatHand], slave_matrix, sizeof(slave_matrix));
changed = true;
}
}
matrix_scan_quantum();
} else {
transport_slave(matrix + thatHand, matrix + thisHand);
matrix_slave_scan_kb();
}
return changed;
}
uint8_t matrix_scan(void) {
bool local_changed = false;
matrix_row_t current_matrix[ROWS_PER_HAND];
for (size_t row_idx = 0; row_idx < ROWS_PER_HAND; row_idx++) {
/* Drive row pin low. */
ATOMIC_BLOCK_FORCEON { writePinLow(row_pins[row_idx]); }
matrix_output_select_delay();
/* Read all columns in one go, aka port scanning. */
uint16_t porta = palReadPort(GPIOA);
uint16_t portb = palReadPort(GPIOB);
/* Order of pins on the mun is: A0, B11, B0, B10, B12, B2, A8
Pin is active low, therefore we have to invert the result. */
matrix_row_t cols = ~(((porta & (0x1 << 0)) >> 0) // A0 (0)
| ((portb & (0x1 << 11)) >> 10) // B11 (1)
| ((portb & (0x1 << 0)) << 2) // B0 (2)
| ((portb & (0x1 << 10)) >> 7) // B10 (3)
| ((portb & (0x1 << 12)) >> 8) // B12 (4)
| ((portb & (0x1 << 2)) << 3) // B2 (5)
| ((porta & (0x1 << 8)) >> 2)); // A8 (6)
/* Reverse the order of columns for left hand as the board is flipped. */
// if (isLeftHand) {
// #if defined(__arm__)
// /* rbit assembly reverses bit order of 32bit registers. */
// uint32_t temp = cols;
// __asm__("rbit %0, %1" : "=r"(temp) : "r"(temp));
// cols = temp >> 24;
// #else
// /* RISC-V bit manipulation extension not present. Use bit-hack.
// https://graphics.stanford.edu/~seander/bithacks.html#ReverseByteWith32Bits */
// cols = (matrix_row_t)(((cols * 0x0802LU & 0x22110LU) | (cols * 0x8020LU & 0x88440LU)) * 0x10101LU >> 16);
// #endif
// }
current_matrix[row_idx] = cols;
/* Drive row pin high again. */
ATOMIC_BLOCK_FORCEON { writePinHigh(row_pins[row_idx]); }
matrix_output_unselect_delay();
}
if (memcmp(raw_matrix, current_matrix, sizeof(current_matrix)) != 0) {
memcpy(raw_matrix, current_matrix, sizeof(current_matrix));
local_changed = true;
}
debounce(raw_matrix, matrix + thisHand, ROWS_PER_HAND, local_changed);
bool remote_changed = matrix_post_scan();
return (uint8_t)(local_changed || remote_changed);
}

View file

@ -0,0 +1,42 @@
/*
* ----------------------------------------------------------------------------
* "THE BEER-WARE LICENSE" (Revision 42):
* <https://github.com/Legonut> 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 STM32_DAC_USE_DAC1_CH1
#define STM32_DAC_USE_DAC1_CH1 TRUE
#undef STM32_DAC_USE_DAC1_CH2
#define STM32_DAC_USE_DAC1_CH2 TRUE
#undef STM32_GPT_USE_TIM6
#define STM32_GPT_USE_TIM6 TRUE
#undef STM32_GPT_USE_TIM7
#define STM32_GPT_USE_TIM7 TRUE
#undef STM32_GPT_USE_TIM8
#define STM32_GPT_USE_TIM8 TRUE
#undef STM32_GPT_USE_TIM15
#define STM32_GPT_USE_TIM15 TRUE
#undef STM32_I2C_USE_I2C1
#define STM32_I2C_USE_I2C1 TRUE
#undef STM32_PWM_USE_TIM3
#define STM32_PWM_USE_TIM3 TRUE
#undef STM32_PWM_USE_TIM4
#define STM32_PWM_USE_TIM4 TRUE
#undef STM32_SERIAL_USE_USART1
#define STM32_SERIAL_USE_USART1 TRUE

35
keyboards/rgbkb/mun/mun.c Normal file
View file

@ -0,0 +1,35 @@
/*
* ----------------------------------------------------------------------------
* "THE BEER-WARE LICENSE" (Revision 42):
* <https://github.com/Legonut> 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 "mun.h"
#include "touch_encoder.h"
#include "common_oled.h"
#include <transactions.h>
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);
}
#if defined(BUSY_WAIT)
void matrix_output_unselect_delay(void) {
for (int32_t i = 0; i < BUSY_WAIT_INSTRUCTIONS; i++) {
__asm__ volatile("nop" ::: "memory");
}
}
#endif

16
keyboards/rgbkb/mun/mun.h Normal file
View file

@ -0,0 +1,16 @@
/*
* ----------------------------------------------------------------------------
* "THE BEER-WARE LICENSE" (Revision 42):
* <https://github.com/Legonut> 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
#if defined(KEYBOARD_rgbkb_mun_rev1)
# include "rev1.h"
#endif
#include "quantum.h"

View file

@ -0,0 +1,15 @@
# Mün
![Mün](https://i.redd.it/zw534js2o5861.jpg)
Mün is powered by STM32 with full QMK support. Each key has super-bright RGB backlighting and MX Kailh hotswap sockets. No soldering is required to get a fully functioning keyboard. There are an additional 14 rear-facing RGB LEDs on each side. Each half can be configured to run as master or slave with the two USB-C ports. They also support up to two rotary encoders and one OLED panel per half.
Keyboard Maintainer: [Legonut](https://github.com/Legonut)
Hardware Supported: Mün PCB R1.0, R1.1, R1.2
Hardware Availability: [RGBKB](https://www.rgbkb.net)
Make example for this keyboard (after setting up your build environment):
make rgbkb/mun:default
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).

View file

@ -0,0 +1,12 @@
/*
* ----------------------------------------------------------------------------
* "THE BEER-WARE LICENSE" (Revision 42):
* <https://github.com/Legonut> 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
#define DEVICE_VER 0x0001

View file

@ -0,0 +1,101 @@
{
"keyboard_name": "Mun",
"url": "https://www.rgbkb.net/products/mun",
"maintainer": "Legonut",
"width": 13.5,
"height": 6.5,
"layouts": {
"LAYOUT": {
"layout": [
{"label":"L00", "x":0, "y":0},
{"label":"L01", "x":1, "y":0},
{"label":"L02", "x":2, "y":0},
{"label":"L03", "x":3, "y":0},
{"label":"L04", "x":4, "y":0},
{"label":"L05", "x":5, "y":0},
{"label":"L06", "x":6, "y":0},
{"label":"R00", "x":7.5, "y":0},
{"label":"R01", "x":8.5, "y":0},
{"label":"R02", "x":9.5, "y":0},
{"label":"R03", "x":10.5, "y":0},
{"label":"R04", "x":11.5, "y":0},
{"label":"R05", "x":12.5, "y":0},
{"label":"R06", "x":13.5, "y":0},
{"label":"L10", "x":0, "y":1},
{"label":"L11", "x":1, "y":1},
{"label":"L12", "x":2, "y":1},
{"label":"L13", "x":3, "y":1},
{"label":"L14", "x":4, "y":1},
{"label":"L15", "x":5, "y":1},
{"label":"L16", "x":6, "y":1},
{"label":"R10", "x":7.5, "y":1},
{"label":"R11", "x":8.5, "y":1},
{"label":"R12", "x":9.5, "y":1},
{"label":"R13", "x":10.5, "y":1},
{"label":"R14", "x":11.5, "y":1},
{"label":"R15", "x":12.5, "y":1},
{"label":"R16", "x":13.5, "y":1},
{"label":"L20", "x":0, "y":2},
{"label":"L21", "x":1, "y":2},
{"label":"L22", "x":2, "y":2},
{"label":"L23", "x":3, "y":2},
{"label":"L24", "x":4, "y":2},
{"label":"L25", "x":5, "y":2},
{"label":"L26", "x":6, "y":2},
{"label":"R20", "x":7.5, "y":2},
{"label":"R21", "x":8.5, "y":2},
{"label":"R22", "x":9.5, "y":2},
{"label":"R23", "x":10.5, "y":2},
{"label":"R24", "x":11.5, "y":2},
{"label":"R25", "x":12.5, "y":2},
{"label":"R26", "x":13.5, "y":2},
{"label":"L30", "x":0, "y":3},
{"label":"L31", "x":1, "y":3},
{"label":"L32", "x":2, "y":3},
{"label":"L33", "x":3, "y":3},
{"label":"L34", "x":4, "y":3},
{"label":"L35", "x":5, "y":3},
{"label":"L36", "x":6, "y":3},
{"label":"R30", "x":7.5, "y":3},
{"label":"R21", "x":8.5, "y":3},
{"label":"R32", "x":9.5, "y":3},
{"label":"R33", "x":10.5, "y":3},
{"label":"R34", "x":11.5, "y":3},
{"label":"R35", "x":12.5, "y":3},
{"label":"R36", "x":13.5, "y":3},
{"label":"L40", "x":0, "y":4},
{"label":"L41", "x":1, "y":4},
{"label":"L42", "x":2, "y":4},
{"label":"L43", "x":3, "y":4},
{"label":"L44", "x":4, "y":4},
{"label":"L45", "x":5, "y":4},
{"label":"L46", "x":6, "y":4},
{"label":"R40", "x":7.5, "y":4},
{"label":"R41", "x":8.5, "y":4},
{"label":"R42", "x":9.5, "y":4},
{"label":"R43", "x":10.5, "y":4},
{"label":"R44", "x":11.5, "y":4},
{"label":"R45", "x":12.5, "y":4},
{"label":"R46", "x":13.5, "y":4},
{"label":"E00", "x":0, "y":5.5},
{"label":"E01", "x":1, "y":5.5},
{"label":"E10", "x":2, "y":5.5},
{"label":"E11", "x":3, "y":5.5},
{"label":"E20", "x":10.5, "y":5.5},
{"label":"E21", "x":11.5, "y":5.5},
{"label":"E30", "x":12.5, "y":5.5},
{"label":"E31", "x":13.5, "y":5.5},
{"label":"T00", "x":0, "y":6.5},
{"label":"T01", "x":1, "y":6.5},
{"label":"T02", "x":2, "y":6.5},
{"label":"T03", "x":3, "y":6.5},
{"label":"T04", "x":4, "y":6.5},
{"label":"T10", "x":9.5, "y":6.5},
{"label":"T11", "x":10.5, "y":6.5},
{"label":"T12", "x":11.5, "y":6.5},
{"label":"T13", "x":12.5, "y":6.5},
{"label":"T14", "x":13.5, "y":6.5}
]
}
}
}

View file

@ -0,0 +1,15 @@
# Mün
![Mün](https://i.redd.it/zw534js2o5861.jpg)
Mün is powered by STM32 with full QMK support. Each key has super-bright RGB backlighting and MX Kailh hotswap sockets. No soldering is required to get a fully functioning keyboard. There are an additional 14 rear-facing RGB LEDs on each side. Each half can be configured to run as master or slave with the two USB-C ports. They also support up to two rotary encoders and one OLED panel per half.
Keyboard Maintainer: [Legonut](https://github.com/Legonut)
Hardware Supported: Mün PCB R1.0, R1.1, R1.2
Hardware Availability: [RGBKB](https://www.rgbkb.net)
Make example for this keyboard (after setting up your build environment):
make rgbkb/mun:default
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).

View file

@ -0,0 +1,122 @@
/*
* ----------------------------------------------------------------------------
* "THE BEER-WARE LICENSE" (Revision 42):
* <https://github.com/Legonut> 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"
#define NUMBER_OF_TOUCH_ENCODERS 2
#define TOUCH_ENCODER_OPTIONS TOUCH_SEGMENTS + 2
#define NUMBER_OF_ENCODERS 4
#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 1 matrix entries
{ { 5, 2 }, { 5, 3 } }, // Encoder 2 matrix entries
{ { 12, 0 }, { 12, 1 } }, // Encoder 3 matrix entries
{ { 12, 2 }, { 12, 3 } }, // Encoder 4 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 1 matrix entries
{ { 13, 0 }, { 13, 1 }, { 13, 2 }, { 13, 3 }, { 13, 4 } } // Touch Encoder 2 matrix entries
};
static void process_encoder_matrix(encodermap_t pos) {
action_exec((keyevent_t){
.key = (keypos_t){.row = pos.r, .col = pos.c}, .pressed = true, .time = (timer_read() | 1) /* time should not be 0 */
});
#if TAP_CODE_DELAY > 0
wait_ms(TAP_CODE_DELAY);
#endif
action_exec((keyevent_t){
.key = (keypos_t){.row = pos.r, .col = pos.c}, .pressed = false, .time = (timer_read() | 1) /* time should not be 0 */
});
}
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 = { {
{ 0, 1, 2, 3, 4, 5, 6 },
{ 13, 12, 11, 10, 9, 8, 7 },
{ 14, 15, 16, 17, 18, 19, 20 },
{ 27, 26, 25, 24, 23, 22, 21 },
{ 28, 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 },
{ 49, 50, 51, 52, 53, 54, 55 },
{ 62, 61, 60, 59, 58, 57, 56 },
{ 63, 64, 65, 66, 67, 68, 69 },
{ 76, 75, 74, 73, 72, 71, 70 },
{ 77, 78, 79, 80, 81, 82, 83 },
{ NO_LED, NO_LED, NO_LED, NO_LED, NO_LED },
{ NO_LED, NO_LED, NO_LED, NO_LED, NO_LED }
}, {
{ 16, 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},{ 16, 31},
{ 16, 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},{ 16, 61},
{ 16, 76},{ 34, 76},{ 49, 76},{ 64, 76},{ 83, 72},{ 98, 72},{ 113, 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},
{ 240, 16},{ 222, 16},{ 207, 16},{ 192, 16},{ 177, 16},{ 162, 16},{ 147, 16},
{ 147, 31},{ 162, 31},{ 177, 31},{ 192, 31},{ 207, 31},{ 222, 31},{ 240, 31},
{ 240, 46},{ 222, 46},{ 207, 46},{ 192, 46},{ 177, 46},{ 162, 46},{ 147, 46},
{ 147, 61},{ 162, 61},{ 177, 61},{ 192, 61},{ 207, 61},{ 222, 61},{ 240, 61},
{ 240, 76},{ 222, 76},{ 207, 76},{ 192, 76},{ 180, 72},{ 165, 72},{ 150, 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},
}, {
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,
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
} };
// clang-format on
#endif

View file

@ -0,0 +1,43 @@
/*
* ----------------------------------------------------------------------------
* "THE BEER-WARE LICENSE" (Revision 42):
* <https://github.com/Legonut> 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 "mun.h"
#include "touch_encoder.h"
// clang-format off
#define LAYOUT( \
L00, L01, L02, L03, L04, L05, L06, R00, R01, R02, R03, R04, R05, R06, \
L10, L11, L12, L13, L14, L15, L16, R10, R11, R12, R13, R14, R15, R16, \
L20, L21, L22, L23, L24, L25, L26, R20, R21, R22, R23, R24, R25, R26, \
L30, L31, L32, L33, L34, L35, L36, R30, R31, R32, R33, R34, R35, R36, \
L40, L41, L42, L43, L44, L45, L46, R40, R41, R42, R43, R44, R45, R46, \
E00, E01, E10, E11, E20, E21, E30, E31, \
T00, T01, T02, T03, T04, T10, T11, T12, T13, T14 \
) \
{ \
/* Left Half */ \
{ L00, L01, L02, L03, L04, L05, L06 }, \
{ L10, L11, L12, L13, L14, L15, L16 }, \
{ L20, L21, L22, L23, L24, L25, L26 }, \
{ L30, L31, L32, L33, L34, L35, L36 }, \
{ L40, L41, L42, L43, L44, L45, L46 }, \
{ E00, E01, E10, E11, KC_NO, KC_NO, KC_NO }, \
{ T00, T01, T02, T03, T04, KC_NO, KC_NO }, \
/* Right Half */ \
{ R06, R05, R04, R03, R02, R01, R00 }, \
{ R16, R15, R14, R13, R12, R11, R10 }, \
{ R26, R25, R24, R23, R22, R21, R20 }, \
{ R36, R35, R34, R33, R32, R31, R30 }, \
{ R46, R45, R44, R43, R42, R41, R40 }, \
{ E20, E21, E30, E31, KC_NO, KC_NO, KC_NO }, \
{ T10, T11, T12, T13, T14, KC_NO, KC_NO } \
}
// clang-format on

View file

@ -0,0 +1,13 @@
{
"keyboard": "rgbkb/mun/rev1",
"keymap": "default",
"commit": "xxxxxxxxxxxxxxxxxxxxx",
"layout": "LAYOUT",
"layers": [
["KC_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","LT(3,KC_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_SFTENT","KC_LCTL","KC_LGUI","KC_LALT","RGB_TOG","MO(4)","KC_SPC","KC_BSPC","KC_ENT","KC_SPC","KC_LEFT","KC_DOWN","KC_UP","KC_RGHT","KC_RCTL","KC_VOLU","KC_VOLD","KC_VOLU","KC_VOLD","KC_PGUP","KC_PGDN","KC_PGUP","KC_PGDN","KC_VOLD","KC_VOLU","KC_MRWD","KC_MPLY","KC_MFFD","RGB_HUI","RGB_HUD","RGB_RMOD","RGB_TOG","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","KC_TRNS","KC_Q","KC_W","KC_F","KC_P","KC_G","KC_TRNS","KC_TRNS","KC_J","KC_L","KC_U","KC_Y","KC_SCLN","KC_TRNS","KC_TRNS","KC_A","KC_R","KC_S","KC_T","KC_D","KC_TRNS","KC_TRNS","KC_H","KC_N","KC_E","KC_I","KC_O","KC_TRNS","KC_TRNS","KC_Z","KC_X","KC_C","KC_V","KC_B","KC_TRNS","KC_TRNS","KC_K","KC_M","KC_COMM","KC_DOT","KC_SLSH","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS"],
["KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_F1","KC_F5","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_Q","KC_W","KC_E","KC_R","KC_T","KC_F2","KC_F6","KC_Y","KC_U","KC_I","KC_O","KC_P","KC_TRNS","KC_TRNS","KC_A","KC_S","KC_D","KC_F","KC_G","KC_F3","KC_F7","KC_H","KC_J","KC_K","KC_L","KC_SCLN","KC_TRNS","KC_TRNS","KC_Z","KC_X","KC_C","KC_V","KC_B","KC_F4","KC_F8","KC_N","KC_M","KC_COMM","KC_DOT","KC_SLSH","KC_TRNS","KC_TRNS","KC_NO","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS"],
["KC_TRNS","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_TRNS","KC_TRNS","KC_HOME","KC_UP","KC_END","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_HOME","KC_UP","KC_END","KC_PSCR","KC_PGUP","KC_TRNS","KC_LEFT","KC_DOWN","KC_RGHT","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_LEFT","KC_DOWN","KC_RGHT","KC_INS","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","ANY(TCH_TOG)","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_MPLY","KC_MNXT","KC_MUTE","KC_VOLD","KC_VOLU","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS"],
["KC_TRNS","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_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_P7","KC_P8","KC_P9","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_P4","KC_P5","KC_P6","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_P1","KC_P2","KC_P3","KC_TRNS","DF(2)","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_P0","KC_PDOT","KC_NLCK","DF(0)","DF(1)","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS"]
]
}

View file

View file

@ -0,0 +1,46 @@
# MCU name
MCU = STM32F303
# Touch encoder needs
SRC += ../common/touch_encoder.c
SRC += ../common/common_oled.c
QUANTUM_LIB_SRC += i2c_master.c
# Build Options
# change to "no" to disable the options, or define them in the Makefile in
# the appropriate keymap folder that will get included automatically
#
BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration
## (Note that for BOOTMAGIC on Teensy LC you have to use a custom .ld script.)
MOUSEKEY_ENABLE = no # Mouse keys
EXTRAKEY_ENABLE = yes # Audio control and System control
CONSOLE_ENABLE = yes # Console for debug
COMMAND_ENABLE = no # Commands for debug and configuration
NKRO_ENABLE = yes # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
MIDI_ENABLE = no # MIDI controls
AUDIO_ENABLE = no # Audio output
UNICODE_ENABLE = no # Unicode
BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID
WS2812_DRIVER = pwm
RGBLIGHT_ENABLE = no # Enable WS2812 RGB underlight.
RGB_MATRIX_ENABLE = yes
RGB_MATRIX_DRIVER = WS2812
SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
OLED_DRIVER_ENABLE = yes # Enable the OLED Driver
ENCODER_ENABLE = yes
SPLIT_KEYBOARD = yes
SERIAL_DRIVER = usart
LTO_ENABLE = yes
OPT = 3
OPT_DEFS += -DOLED_FONT_H=\"../common/glcdfont.c\"
OPT_DEFS += -Ikeyboards/rgbkb/common
CUSTOM_MATRIX = yes
SRC += matrix.c matrix_common.c
DEFAULT_FOLDER = rgbkb/mun/rev1