diff --git a/keyboards/mario/config.h b/keyboards/mario/config.h new file mode 100644 index 00000000000..642f91966aa --- /dev/null +++ b/keyboards/mario/config.h @@ -0,0 +1,27 @@ +/* +Copyright 2024 @yuting wang + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . +*/ + +#pragma once + +#define DYNAMIC_KEYMAP_LAYER_COUNT 5 +#define TAPPING_TERM 180 + +/* Select hand configuration */ +#define MASTER_LEFT +#define USE_SERIAL_PD2 + +#define OLED_FONT_H "keyboards/crkbd/lib/glcdfont.c" \ No newline at end of file diff --git a/keyboards/mario/info.json b/keyboards/mario/info.json new file mode 100644 index 00000000000..c8737e46bf7 --- /dev/null +++ b/keyboards/mario/info.json @@ -0,0 +1,100 @@ +{ + "keyboard_name": "mario", + "maintainer": "yuting wang", + "processor": "atmega32u4", + "bootloader": "atmel-dfu", + "rgb_matrix": { + "driver": "ws2812" + }, + "features": { + "bootmagic": true, + "extrakey": true, + "mousekey": true, + "nkro": true, + "oled": false + }, + "build": { + "lto": true + }, + "matrix_pins": { + "cols": [ "F6", "F7", "B1", "B3", "B2", "B6" ], + "rows": [ "D4", "C6", "D7", "E6" ] + }, + "diode_direction": "COL2ROW", + "split": { + "enabled": true + }, + "url": "", + "usb": { + "vid": "0x4653", + "pid": "0x0001", + "device_version": "0.0.1" + }, + "matrix_size": { + "cols": 6, + "rows": 8 + }, + + "rgblight": { + "led_count": 42, + "split_count": [21, 21] + }, + + "community_layouts": ["split_3x6_3"], + "layouts": { + "LAYOUT_split_3x6_3": { + "layout": [ + {"matrix": [0, 0], "x": 0, "y": 0.3}, + {"matrix": [0, 1], "x": 1, "y": 0.3}, + {"matrix": [0, 2], "x": 2, "y": 0.1}, + {"matrix": [0, 3], "x": 3, "y": 0}, + {"matrix": [0, 4], "x": 4, "y": 0.1}, + {"matrix": [0, 5], "x": 5, "y": 0.2}, + + {"matrix": [4, 5], "x": 9, "y": 0.2}, + {"matrix": [4, 4], "x": 10, "y": 0.1}, + {"matrix": [4, 3], "x": 11, "y": 0}, + {"matrix": [4, 2], "x": 12, "y": 0.1}, + {"matrix": [4, 1], "x": 13, "y": 0.3}, + {"matrix": [4, 0], "x": 14, "y": 0.3}, + + {"matrix": [1, 0], "x": 0, "y": 1.3}, + {"matrix": [1, 1], "x": 1, "y": 1.3}, + {"matrix": [1, 2], "x": 2, "y": 1.1}, + {"matrix": [1, 3], "x": 3, "y": 1}, + {"matrix": [1, 4], "x": 4, "y": 1.1}, + {"matrix": [1, 5], "x": 5, "y": 1.2}, + + {"matrix": [5, 5], "x": 9, "y": 1.2}, + {"matrix": [5, 4], "x": 10, "y": 1.1}, + {"matrix": [5, 3], "x": 11, "y": 1}, + {"matrix": [5, 2], "x": 12, "y": 1.1}, + {"matrix": [5, 1], "x": 13, "y": 1.3}, + {"matrix": [5, 0], "x": 14, "y": 1.3}, + + {"matrix": [2, 0], "x": 0, "y": 2.3}, + {"matrix": [2, 1], "x": 1, "y": 2.3}, + {"matrix": [2, 2], "x": 2, "y": 2.1}, + {"matrix": [2, 3], "x": 3, "y": 2}, + {"matrix": [2, 4], "x": 4, "y": 2.1}, + {"matrix": [2, 5], "x": 5, "y": 2.2}, + + {"matrix": [6, 5], "x": 9, "y": 2.2}, + {"matrix": [6, 4], "x": 10, "y": 2.1}, + {"matrix": [6, 3], "x": 11, "y": 2}, + {"matrix": [6, 2], "x": 12, "y": 2.1}, + {"matrix": [6, 1], "x": 13, "y": 2.3}, + {"matrix": [6, 0], "x": 14, "y": 2.3}, + + {"matrix": [3, 3], "x": 4, "y": 3.7}, + {"matrix": [3, 4], "x": 5, "y": 3.7}, + {"matrix": [3, 5], "x": 6, "y": 3.2, "h": 1.5}, + + {"matrix": [7, 5], "x": 8, "y": 3.2, "h": 1.5}, + {"matrix": [7, 4], "x": 9, "y": 3.7}, + {"matrix": [7, 3], "x": 10, "y": 3.7} + ] + } + } + +} diff --git a/keyboards/mario/keymaps/default/config.h b/keyboards/mario/keymaps/default/config.h new file mode 100644 index 00000000000..8b356fcca76 --- /dev/null +++ b/keyboards/mario/keymaps/default/config.h @@ -0,0 +1,42 @@ +/* +Copyright 2024 @yuting wang + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . +*/ + +#pragma once +#define MANUFACTURER "Yuting Wang" +#define WS2812_DI_PIN D3 +#define SOFT_SERIAL_PIN D2 + +#define DYNAMIC_KEYMAP_LAYER_COUNT 5 +#define TAPPING_TERM 180 + +#define VIAL_KEYBOARD_UID {0xE8, 0x8C, 0xEF, 0x50, 0x0A, 0xD0, 0x3C, 0xAF} +#define VIAL_UNLOCK_COMBO_ROWS {0, 0} +#define VIAL_UNLOCK_COMBO_COLS {0, 1} + +/* Select hand configuration */ +#define MASTER_LEFT +#define LED_ANIMATIONS + +#ifdef RGBLIGHT_ENABLE +# define RGBLIGHT_LIMIT_VAL 120 +# define RGBLIGHT_HUE_STEP 10 +# define RGBLIGHT_SAT_STEP 17 +# define RGBLIGHT_VAL_STEP 17 +#endif + + +#define OLED_FONT_H "keyboards/crkbd/lib/glcdfont.c" \ No newline at end of file diff --git a/keyboards/mario/keymaps/default/keymap.c b/keyboards/mario/keymaps/default/keymap.c new file mode 100644 index 00000000000..7e4292f86f4 --- /dev/null +++ b/keyboards/mario/keymaps/default/keymap.c @@ -0,0 +1,185 @@ +// Copyright 2024 Yuting Wang +// SPDX-License-Identifier: GPL-2.0-or-later + +#include QMK_KEYBOARD_H + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [0] = LAYOUT_split_3x6_3( + //,-----------------------------------------------------. ,-----------------------------------------------------. + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC, + //|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------| + KC_LCTL, KC_A, KC_S, KC_D, KC_F, KC_G, 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_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ESC, + //|--------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------| + KC_LGUI, TL_LOWR, KC_SPC, KC_ENT, TL_UPPR, KC_RALT + //`--------------------------' `--------------------------' + + ), + + [1] = LAYOUT_split_3x6_3( + //,-----------------------------------------------------. ,-----------------------------------------------------. + KC_TAB, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC, + //|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------| + KC_LCTL, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_LEFT, KC_DOWN, KC_UP,KC_RIGHT, XXXXXXX, XXXXXXX, + //|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------| + KC_LSFT, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, + //|--------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------| + KC_LGUI, _______, KC_SPC, KC_ENT, _______, KC_RALT + //`--------------------------' `--------------------------' + ), + + [2] = LAYOUT_split_3x6_3( + //,-----------------------------------------------------. ,-----------------------------------------------------. + KC_TAB, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_BSPC, + //|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------| + KC_LCTL, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS, KC_GRV, + //|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------| + KC_LSFT, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_PIPE, KC_TILD, + //|--------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------| + KC_LGUI, _______, KC_SPC, KC_ENT, _______, KC_RALT + //`--------------------------' `--------------------------' + ), + + [3] = LAYOUT_split_3x6_3( + //,-----------------------------------------------------. ,-----------------------------------------------------. + QK_BOOT, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, + //|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------| + RGB_TOG, RGB_HUI, RGB_SAI, RGB_VAI, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, + //|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------| + RGB_MOD, RGB_HUD, RGB_SAD, RGB_VAD, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, + //|--------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------| + KC_LGUI, _______, KC_SPC, KC_ENT, _______, KC_RALT + //`--------------------------' `--------------------------' + ), + + [4] = LAYOUT_split_3x6_3( + //,-----------------------------------------------------. ,-----------------------------------------------------. + XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, + //|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------| + XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_BTN1, KC_BTN2, XXXXXXX, + //|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------| + XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, + //|--------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------| + XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX + //`--------------------------' `--------------------------' + ) +}; + +#if defined(ENCODER_MAP_ENABLE) +const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][NUM_DIRECTIONS] = { + [0] = { ENCODER_CCW_CW(KC_MS_WH_UP, KC_MS_WH_DOWN) }, + [1] = { ENCODER_CCW_CW(KC_VOLD, KC_VOLU) }, + [2] = { ENCODER_CCW_CW(RGB_SAD, RGB_SAI) }, + [3] = { ENCODER_CCW_CW(RGB_HUD, RGB_HUI) }, + [4] = { ENCODER_CCW_CW(KC_LEFT, KC_RIGHT) }, +}; +#endif + + +#ifdef OLED_ENABLE +#include + +oled_rotation_t oled_init_user(oled_rotation_t rotation) { + if (!is_keyboard_master()) { + return OLED_ROTATION_180; // flips the display 180 degrees if offhand + } + return rotation; +} + +#define L_BASE 0 +#define L_LOWER 2 +#define L_RAISE 4 +#define L_ADJUST 8 + +void oled_render_layer_state(void) { + oled_write_P(PSTR("Layer: "), false); + switch (layer_state) { + case L_BASE: + oled_write_ln_P(PSTR("Default"), false); + break; + case L_LOWER: + oled_write_ln_P(PSTR("Lower"), false); + break; + case L_RAISE: + oled_write_ln_P(PSTR("Raise"), false); + break; + case L_ADJUST: + case L_ADJUST|L_LOWER: + case L_ADJUST|L_RAISE: + case L_ADJUST|L_LOWER|L_RAISE: + oled_write_ln_P(PSTR("Adjust"), false); + break; + } +} + + +char keylog_str[24] = {}; + +const char code_to_name[60] = { + ' ', ' ', ' ', ' ', 'a', 'b', 'c', 'd', 'e', 'f', + 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', + 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', + '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', + 'R', 'E', 'B', 'T', '_', '-', '=', '[', ']', '\\', + '#', ';', '\'', '`', ',', '.', '/', ' ', ' ', ' '}; + +void set_keylog(uint16_t keycode, keyrecord_t *record) { + char name = ' '; + if ((keycode >= QK_MOD_TAP && keycode <= QK_MOD_TAP_MAX) || + (keycode >= QK_LAYER_TAP && keycode <= QK_LAYER_TAP_MAX)) { keycode = keycode & 0xFF; } + if (keycode < 60) { + name = code_to_name[keycode]; + } + + // update keylog + snprintf(keylog_str, sizeof(keylog_str), "%dx%d, k%2d : %c", + record->event.key.row, record->event.key.col, + keycode, name); +} + +void oled_render_keylog(void) { + oled_write(keylog_str, false); +} + +void render_bootmagic_status(bool status) { + /* Show Ctrl-Gui Swap options */ + static const char PROGMEM logo[][2][3] = { + {{0x97, 0x98, 0}, {0xb7, 0xb8, 0}}, + {{0x95, 0x96, 0}, {0xb5, 0xb6, 0}}, + }; + if (status) { + oled_write_ln_P(logo[0][0], false); + oled_write_ln_P(logo[0][1], false); + } else { + oled_write_ln_P(logo[1][0], false); + oled_write_ln_P(logo[1][1], false); + } +} + +void oled_render_logo(void) { + static const char PROGMEM crkbd_logo[] = { + 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, 0x90, 0x91, 0x92, 0x93, 0x94, + 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, + 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, + 0}; + oled_write_P(crkbd_logo, false); +} + +bool oled_task_user(void) { + if (is_keyboard_master()) { + oled_render_layer_state(); + oled_render_keylog(); + } else { + oled_render_logo(); + } + return false; +} + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + if (record->event.pressed) { + set_keylog(keycode, record); + } + return true; +} +#endif // OLED_ENABLE \ No newline at end of file diff --git a/keyboards/mario/keymaps/default/rules.mk b/keyboards/mario/keymaps/default/rules.mk new file mode 100644 index 00000000000..7aa78fb7e0c --- /dev/null +++ b/keyboards/mario/keymaps/default/rules.mk @@ -0,0 +1,11 @@ +CONSOLE_ENABLE = no +POINTING_DEVICE_ENABLE = no +VIA_ENABLE = yes +VIAL_ENABLE = yes +RGBLIGHT_ENABLE = no +RGB_MATRIX_ENABLE = no # Can't have RGBLIGHT and RGB_MATRIX at the same time. +COMBO_ENABLE = no +QMK_SETTINGS = no +MOUSEKEY_ENABLE = no +EXTRAKEY_ENABLE = no +CONSOLE_ENABLE = no diff --git a/keyboards/mario/keymaps/default/vial.json b/keyboards/mario/keymaps/default/vial.json new file mode 100644 index 00000000000..c06394052e5 --- /dev/null +++ b/keyboards/mario/keymaps/default/vial.json @@ -0,0 +1,48 @@ +{ + "manufacturer": "Yuting Wang", + "keyboard_name": "mario", + "maintainer": "Yuting Wang", + "bootloader": "rp2040", + "diode_direction": "COL2ROW", + "features": { + "bootmagic": true, + "extrakey": true, + "lto": true, + "mousekey": false, + "nkro": true, + "oled": true + }, + "matrix_pins": { + "cols": [ "F6", "F7", "B1", "B3", "B2", "B6" ], + "rows": [ "D4", "C6", "D7", "E6" ] + }, + "processor": "RP2040", + "url": "", + "usb": { + "vid": "0x4653", + "pid": "0x0001", + "device_version": "0.0.1" + }, + "matrix": { "rows": 8, "cols": 6 }, + "layouts": { + "keymap": [ + [{"y":1,"x":3.5},"0,3",{"x":7.5},"4,3"], + [{"y":-0.875,"x":2.5},"0,2",{"x":1},"0,4",{"x":5.5},"4,4",{"x":1},"4,2"], + [{"y":-0.875,"x":5.5},"0,5",{"x":3.5},"4,5"], + [{"y":-0.875,"x":0.5},"0,0","0,1",{"x":11.5},"4,1","4,0"], + [{"y":-0.375,"x":3.5},"1,3",{"x":7.5},"5,3"], + [{"y":-0.875,"x":2.5},"1,2",{"x":1},"1,4",{"x":5.5},"5,4",{"x":1},"5,2"], + [{"y":-0.875,"x":5.5},"1,5",{"x":3.5},"5,5"], + [{"y":-0.875,"x":0.5},"1,0","1,1",{"x":11.5},"5,1","5,0"], + [{"y":-0.375,"x":3.5},"2,3",{"x":7.5},"6,3"], + [{"y":-0.875,"x":2.5},"2,2",{"x":1},"2,4",{"x":5.5},"6,4",{"x":1},"6,2"], + [{"y":-0.875,"x":5.5},"2,5",{"x":3.5},"6,5"], + [{"y":-0.875,"x":0.5},"2,0","2,1",{"x":11.5},"6,1","6,0"], + [{"y":-0.125,"x":4},"3,3",{"x":6.5},"7,3"], + [{"r":15,"rx":4.5,"ry":9.1,"y":-4.85,"x":-0.5},"3,4"], + [{"r":30,"rx":5.4,"ry":9.3,"y":-5.05,"x":-1.4,"h":1.5},"3,5"], + [{"r":-30,"rx":11.1,"y":-5.05,"x":0.4,"h":1.5},"7,5"], + [{"r":-15,"rx":12,"ry":9.1,"y":-4.85,"x":-0.5},"7,4"] + ] + } +} \ No newline at end of file diff --git a/keyboards/mario/keymaps/vial/config.h b/keyboards/mario/keymaps/vial/config.h new file mode 100644 index 00000000000..bc9dd04fb29 --- /dev/null +++ b/keyboards/mario/keymaps/vial/config.h @@ -0,0 +1,78 @@ +/* +Copyright 2024 @yuting wang + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . +*/ + +#pragma once +#define MANUFACTURER "Yuting Wang" +#define WS2812_DI_PIN D3 +#define SOFT_SERIAL_PIN D2 + +#define VIAL_KEYBOARD_UID {0xE8, 0x8C, 0xEF, 0x50, 0x0A, 0xD0, 0x3C, 0xAF} +#define VIAL_UNLOCK_COMBO_ROWS {0, 0} +#define VIAL_UNLOCK_COMBO_COLS {0, 1} + +#define DYNAMIC_KEYMAP_LAYER_COUNT 5 +#define TAPPING_TERM 180 + +/* Select hand configuration */ +#define MASTER_LEFT +#define LED_ANIMATIONS + +#ifdef RGBLIGHT_ENABLE +# define RGBLIGHT_LIMIT_VAL 120 +# define RGBLIGHT_HUE_STEP 10 +# define RGBLIGHT_SAT_STEP 17 +# define RGBLIGHT_VAL_STEP 17 +#endif + +// place overrides here +// Selection of RGBLIGHT MODE to use. +#if defined(LED_ANIMATIONS) + #define RGBLIGHT_EFFECT_BREATHING + #define RGBLIGHT_EFFECT_RAINBOW_MOOD + #define RGBLIGHT_EFFECT_RAINBOW_SWIRL + #define RGBLIGHT_EFFECT_SNAKE + #define RGBLIGHT_EFFECT_KNIGHT + #define RGBLIGHT_EFFECT_CHRISTMAS + #define RGBLIGHT_EFFECT_STATIC_GRADIENT + //#define RGBLIGHT_EFFECT_RGB_TEST + //#define RGBLIGHT_EFFECT_ALTERNATING +#endif + +#define OLED_FONT_H "keyboards/crkbd/lib/glcdfont.c" +#define SPLIT_POINTING_ENABLE +#ifdef SPLIT_POINTING_ENABLE +# define POINTING_DEVICE_RIGHT +# define ANALOG_JOYSTICK_X_AXIS_PIN F4 +# define ANALOG_JOYSTICK_Y_AXIS_PIN F5 +# define ANALOG_JOYSTICK_CLICK_PIN B6 +# define ANALOG_JOYSTICK_SPEED_REGULATOR 6 +# define ANALOG_JOYSTICK_SPEED_MAX 20 +#endif + +#ifdef ENCODER_ENABLE +#define ENCODERS_PAD_A { F4 } +#define ENCODERS_PAD_B { F5 } +#define ENCODER_RESOLUTIONS_LEFT { 2 } +#define ENCODERS_PAD_A_RIGHT { } +#define ENCODERS_PAD_B_RIGHT { } +#define ENCODER_RESOLUTIONS_RIGHT { } +#endif + +#define POINTING_DEVICE_AUTO_MOUSE_ENABLE +// only required if not setting mouse layer elsewhere +#define AUTO_MOUSE_DEFAULT_LAYER 4 +#define AUTO_MOUSE_TIME 650 \ No newline at end of file diff --git a/keyboards/mario/keymaps/vial/keymap.c b/keyboards/mario/keymaps/vial/keymap.c new file mode 100644 index 00000000000..2b5b46e88c8 --- /dev/null +++ b/keyboards/mario/keymaps/vial/keymap.c @@ -0,0 +1,192 @@ +// Copyright 2024 Yuting Wang +// SPDX-License-Identifier: GPL-2.0-or-later + +#include QMK_KEYBOARD_H + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [0] = LAYOUT_split_3x6_3( + //,-----------------------------------------------------. ,-----------------------------------------------------. + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC, + //|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------| + KC_LCTL, KC_A, KC_S, KC_D, KC_F, KC_G, 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_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ESC, + //|--------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------| + KC_LGUI, TL_LOWR, KC_SPC, KC_ENT, TL_UPPR, KC_RALT + //`--------------------------' `--------------------------' + + ), + + [1] = LAYOUT_split_3x6_3( + //,-----------------------------------------------------. ,-----------------------------------------------------. + KC_TAB, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC, + //|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------| + KC_LCTL, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_LEFT, KC_DOWN, KC_UP,KC_RIGHT, XXXXXXX, XXXXXXX, + //|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------| + KC_LSFT, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, + //|--------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------| + KC_LGUI, _______, KC_SPC, KC_ENT, _______, KC_RALT + //`--------------------------' `--------------------------' + ), + + [2] = LAYOUT_split_3x6_3( + //,-----------------------------------------------------. ,-----------------------------------------------------. + KC_TAB, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_BSPC, + //|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------| + KC_LCTL, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS, KC_GRV, + //|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------| + KC_LSFT, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_PIPE, KC_TILD, + //|--------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------| + KC_LGUI, _______, KC_SPC, KC_ENT, _______, KC_RALT + //`--------------------------' `--------------------------' + ), + + [3] = LAYOUT_split_3x6_3( + //,-----------------------------------------------------. ,-----------------------------------------------------. + QK_BOOT, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, + //|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------| + RGB_TOG, RGB_HUI, RGB_SAI, RGB_VAI, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, + //|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------| + RGB_MOD, RGB_HUD, RGB_SAD, RGB_VAD, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, + //|--------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------| + KC_LGUI, _______, KC_SPC, KC_ENT, _______, KC_RALT + //`--------------------------' `--------------------------' + ), + + [4] = LAYOUT_split_3x6_3( + //,-----------------------------------------------------. ,-----------------------------------------------------. + XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, + //|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------| + XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_BTN1, KC_BTN2, XXXXXXX, + //|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------| + XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, + //|--------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------| + XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX + //`--------------------------' `--------------------------' + ) +}; + +#ifdef POINTING_DEVICE_ENABLE +void pointing_device_init_user(void) { + //set_auto_mouse_layer(); // only required if AUTO_MOUSE_DEFAULT_LAYER is not set to index of + set_auto_mouse_enable(true); // always required before the auto mouse feature will work +} +#endif + +#if defined(ENCODER_MAP_ENABLE) +const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][NUM_DIRECTIONS] = { + [0] = { ENCODER_CCW_CW(KC_MS_WH_UP, KC_MS_WH_DOWN) }, + [1] = { ENCODER_CCW_CW(KC_VOLD, KC_VOLU) }, + [2] = { ENCODER_CCW_CW(RGB_SAD, RGB_SAI) }, + [3] = { ENCODER_CCW_CW(RGB_HUD, RGB_HUI) }, + [4] = { ENCODER_CCW_CW(KC_LEFT, KC_RIGHT) }, +}; +#endif + + +#ifdef OLED_ENABLE +#include + +oled_rotation_t oled_init_user(oled_rotation_t rotation) { + if (!is_keyboard_master()) { + return OLED_ROTATION_180; // flips the display 180 degrees if offhand + } + return rotation; +} + +#define L_BASE 0 +#define L_LOWER 2 +#define L_RAISE 4 +#define L_ADJUST 8 + +void oled_render_layer_state(void) { + oled_write_P(PSTR("Layer: "), false); + switch (layer_state) { + case L_BASE: + oled_write_ln_P(PSTR("Default"), false); + break; + case L_LOWER: + oled_write_ln_P(PSTR("Lower"), false); + break; + case L_RAISE: + oled_write_ln_P(PSTR("Raise"), false); + break; + case L_ADJUST: + case L_ADJUST|L_LOWER: + case L_ADJUST|L_RAISE: + case L_ADJUST|L_LOWER|L_RAISE: + oled_write_ln_P(PSTR("Adjust"), false); + break; + } +} + + +char keylog_str[24] = {}; + +const char code_to_name[60] = { + ' ', ' ', ' ', ' ', 'a', 'b', 'c', 'd', 'e', 'f', + 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', + 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', + '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', + 'R', 'E', 'B', 'T', '_', '-', '=', '[', ']', '\\', + '#', ';', '\'', '`', ',', '.', '/', ' ', ' ', ' '}; + +void set_keylog(uint16_t keycode, keyrecord_t *record) { + char name = ' '; + if ((keycode >= QK_MOD_TAP && keycode <= QK_MOD_TAP_MAX) || + (keycode >= QK_LAYER_TAP && keycode <= QK_LAYER_TAP_MAX)) { keycode = keycode & 0xFF; } + if (keycode < 60) { + name = code_to_name[keycode]; + } + + // update keylog + snprintf(keylog_str, sizeof(keylog_str), "%dx%d, k%2d : %c", + record->event.key.row, record->event.key.col, + keycode, name); +} + +void oled_render_keylog(void) { + oled_write(keylog_str, false); +} + +void render_bootmagic_status(bool status) { + /* Show Ctrl-Gui Swap options */ + static const char PROGMEM logo[][2][3] = { + {{0x97, 0x98, 0}, {0xb7, 0xb8, 0}}, + {{0x95, 0x96, 0}, {0xb5, 0xb6, 0}}, + }; + if (status) { + oled_write_ln_P(logo[0][0], false); + oled_write_ln_P(logo[0][1], false); + } else { + oled_write_ln_P(logo[1][0], false); + oled_write_ln_P(logo[1][1], false); + } +} + +void oled_render_logo(void) { + static const char PROGMEM crkbd_logo[] = { + 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, 0x90, 0x91, 0x92, 0x93, 0x94, + 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, + 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, + 0}; + oled_write_P(crkbd_logo, false); +} + +bool oled_task_user(void) { + if (is_keyboard_master()) { + oled_render_layer_state(); + oled_render_keylog(); + } else { + oled_render_logo(); + } + return false; +} + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + if (record->event.pressed) { + set_keylog(keycode, record); + } + return true; +} +#endif // OLED_ENABLE \ No newline at end of file diff --git a/keyboards/mario/keymaps/vial/rules.mk b/keyboards/mario/keymaps/vial/rules.mk new file mode 100644 index 00000000000..1c0eacd00e2 --- /dev/null +++ b/keyboards/mario/keymaps/vial/rules.mk @@ -0,0 +1,3 @@ +VIAL_ENABLE = yes +ENCODER_ENABLE = yes +ENCODER_MAP_ENABLE = yes \ No newline at end of file diff --git a/keyboards/mario/keymaps/vial/vial.json b/keyboards/mario/keymaps/vial/vial.json new file mode 100644 index 00000000000..f84c076f9db --- /dev/null +++ b/keyboards/mario/keymaps/vial/vial.json @@ -0,0 +1,48 @@ +{ + "manufacturer": "Yuting Wang", + "keyboard_name": "mario", + "maintainer": "Yuting Wang", + "bootloader": "rp2040", + "diode_direction": "COL2ROW", + "features": { + "bootmagic": true, + "extrakey": true, + "lto": true, + "mousekey": true, + "nkro": true, + "oled": true + }, + "matrix_pins": { + "cols": [ "F6", "F7", "B1", "B3", "B2", "B6" ], + "rows": [ "D4", "C6", "D7", "E6" ] + }, + "processor": "RP2040", + "url": "", + "usb": { + "vid": "0x4653", + "pid": "0x0001", + "device_version": "0.0.1" + }, + "matrix": { "rows": 8, "cols": 6 }, + "layouts": { + "keymap": [ + [{"y":1,"x":3.5},"0,3",{"x":7.5},"4,3"], + [{"y":-0.875,"x":2.5},"0,2",{"x":1},"0,4",{"x":5.5},"4,4",{"x":1},"4,2"], + [{"y":-0.875,"x":5.5},"0,5",{"x":3.5},"4,5"], + [{"y":-0.875,"x":0.5},"0,0","0,1",{"x":11.5},"4,1","4,0"], + [{"y":-0.375,"x":3.5},"1,3",{"x":7.5},"5,3"], + [{"y":-0.875,"x":2.5},"1,2",{"x":1},"1,4",{"x":5.5},"5,4",{"x":1},"5,2"], + [{"y":-0.875,"x":5.5},"1,5",{"x":3.5},"5,5"], + [{"y":-0.875,"x":0.5},"1,0","1,1",{"x":11.5},"5,1","5,0"], + [{"y":-0.375,"x":3.5},"2,3",{"x":7.5},"6,3"], + [{"y":-0.875,"x":2.5},"2,2",{"x":1},"2,4",{"x":5.5},"6,4",{"x":1},"6,2"], + [{"y":-0.875,"x":5.5},"2,5",{"x":3.5},"6,5"], + [{"y":-0.875,"x":0.5},"2,0","2,1",{"x":11.5},"6,1","6,0"], + [{"y":-0.125,"x":4},"3,3",{"x":6.5},"7,3"], + [{"r":15,"rx":4.5,"ry":9.1,"y":-4.85,"x":-0.5},"3,4"], + [{"r":30,"rx":5.4,"ry":9.3,"y":-5.05,"x":-1.4,"h":1.5},"3,5"], + [{"r":-30,"rx":11.1,"y":-5.05,"x":0.4,"h":1.5},"7,5"], + [{"r":-15,"rx":12,"ry":9.1,"y":-4.85,"x":-0.5},"7,4"] + ] + } +} \ No newline at end of file diff --git a/keyboards/mario/readme.md b/keyboards/mario/readme.md new file mode 100644 index 00000000000..ad5e304852e --- /dev/null +++ b/keyboards/mario/readme.md @@ -0,0 +1,30 @@ +# mario + +![mario](https://github.com/YkieWang/images/blob/main/DSC01937.JPG) +![mario](https://github.com/YkieWang/images/blob/main/DSC01938.JPG) +![mario](https://github.com/YkieWang/images/blob/main/DSC01940.JPG) + +*A short description of the keyboard/project* + +* Keyboard Maintainer: [Yuting Wang](https://github.com/YkieWang) +* Hardware Supported: *coming soon* +* Hardware Availability: *coming soon* +* I designed this keyboard based on crkbd, thanks the maintainers of crkbd! And I added a encoder in the left and a joystick in the right. The encoder could help me with scrolling, while the joystick can control the cursor, which makes things easier when I code, because I don't need to move my hand to reach the mouse. + +Make example for this keyboard (after setting up your build environment): + + make mario:vial + +Flashing example for this keyboard: + + make mario:vial:flash + +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). + +## Bootloader + +Enter the bootloader in 3 ways: + +* **Bootmagic reset**: Hold down the key at (0,0) in the matrix (usually the top left key or Escape) and plug in the keyboard +* **Physical reset button**: Briefly press the button on the back of the PCB - some may have pads you must short instead +* **Keycode in layout**: Press the key mapped to `QK_BOOT` if it is available diff --git a/keyboards/mario/rules.mk b/keyboards/mario/rules.mk new file mode 100644 index 00000000000..1b504f6c472 --- /dev/null +++ b/keyboards/mario/rules.mk @@ -0,0 +1,6 @@ +CONSOLE_ENABLE = no +VIA_ENABLE = yes +RGBLIGHT_ENABLE = no +RGB_MATRIX_ENABLE = no # Can't have RGBLIGHT and RGB_MATRIX at the same time. +COMBO_ENABLE = no +QMK_SETTINGS = no \ No newline at end of file