1
0
Fork 0

[Keyboard] Add MW75R2 PCB (#15042)

Co-authored-by: Ryan <fauxpark@gmail.com>
Co-authored-by: James Young <18669334+noroadsleft@users.noreply.github.com>
This commit is contained in:
TW59420 2022-02-21 14:01:31 +08:00 committed by GitHub
parent 65af7272f3
commit f7b5d67a7b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 494 additions and 0 deletions

View file

@ -0,0 +1,80 @@
/* Copyright 2021 TW59420 <https://github.com/TW59420>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include "config_common.h"
/* USB Device descriptor parameter */
#define VENDOR_ID 0x7BA1
#define PRODUCT_ID 0x7502
#define DEVICE_VER 0x0001
#define MANUFACTURER MWStudio
#define PRODUCT MW75R2
/* key matrix size */
#define MATRIX_ROWS 6
#define MATRIX_COLS 15
/* key matrix pins */
#define MATRIX_ROW_PINS { B7, D0, D1, D2, D3, D5}
#define MATRIX_COL_PINS { C7, C6, B6, B5, B4, D7, D4, D6, F7, F6, E6, F0, F1, F4, F5 }
#define BOOTMAGIC_LITE_ROW 0
#define BOOTMAGIC_LITE_COLUMN 0
/* COL2ROW or ROW2COL */
#define DIODE_DIRECTION COL2ROW
/* Set 0 if debouncing isn't needed */
#define DEBOUNCE 5
#define RGB_DI_PIN B3
#define RGBLIGHT_SLEEP
#define RGB_MATRIX_MAXIMUM_BRIGHTNESS 255
#define RGB_MATRIX_STARTUP_VAL RGB_MATRIX_MAXIMUM_BRIGHTNESS
#define DRIVER_LED_TOTAL 21
#define RGBLED_NUM 21
#define ENABLE_RGB_MATRIX_ALPHAS_MODS
#define ENABLE_RGB_MATRIX_BREATHING
#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_FRACTAL
#define ENABLE_RGB_MATRIX_PIXEL_RAIN
#define RGBLIGHT_HUE_STEP 8
#define RGBLIGHT_SAT_STEP 8
#define RGBLIGHT_VAL_STEP 8
#define ENCODERS_PAD_A { B1 }
#define ENCODERS_PAD_B { B2 }

View file

@ -0,0 +1,97 @@
{
"keyboard_name": "MW75R2",
"url": "",
"maintainer": "qmk",
"layouts": {
"LAYOUT": {
"layout": [
{"label":"Esc", "x":0, "y":0},
{"label":"F1", "x":1.5, "y":0},
{"label":"F2", "x":2.5, "y":0},
{"label":"F3", "x":3.5, "y":0},
{"label":"F4", "x":4.5, "y":0},
{"label":"F5", "x":6, "y":0},
{"label":"F6", "x":7, "y":0},
{"label":"F7", "x":8, "y":0},
{"label":"F8", "x":9, "y":0},
{"label":"F9", "x":10.5, "y":0},
{"label":"F10", "x":11.5, "y":0},
{"label":"F11", "x":12.5, "y":0},
{"label":"F12", "x":13.5, "y":0},
{"label":"DEL", "x":15, "y":0},
{"label":"`", "x":0, "y":1.5},
{"label":"1", "x":1, "y":1.5},
{"label":"2", "x":2, "y":1.5},
{"label":"3", "x":3, "y":1.5},
{"label":"4", "x":4, "y":1.5},
{"label":"5", "x":5, "y":1.5},
{"label":"6", "x":6, "y":1.5},
{"label":"7", "x":7, "y":1.5},
{"label":"8", "x":8, "y":1.5},
{"label":"9", "x":9, "y":1.5},
{"label":"0", "x":10, "y":1.5},
{"label":"-", "x":11, "y":1.5},
{"label":"=", "x":12, "y":1.5},
{"label":"Backspace", "x":13, "y":1.5, "w":2},
{"label":"Delete", "x":15, "y":1.5},
{"label":"Tab", "x":0, "y":2.5, "w":1.5},
{"label":"Q", "x":1.5, "y":2.5},
{"label":"W", "x":2.5, "y":2.5},
{"label":"E", "x":3.5, "y":2.5},
{"label":"R", "x":4.5, "y":2.5},
{"label":"T", "x":5.5, "y":2.5},
{"label":"Y", "x":6.5, "y":2.5},
{"label":"U", "x":7.5, "y":2.5},
{"label":"I", "x":8.5, "y":2.5},
{"label":"O", "x":9.5, "y":2.5},
{"label":"P", "x":10.5, "y":2.5},
{"label":"[", "x":11.5, "y":2.5},
{"label":"]", "x":12.5, "y":2.5},
{"label":"\\", "x":13.5, "y":2.5, "w":1.5},
{"label":"PgUp", "x":15, "y":2.5},
{"label":"Caps Lock", "x":0, "y":3.5, "w":1.75},
{"label":"A", "x":1.75, "y":3.5},
{"label":"S", "x":2.75, "y":3.5},
{"label":"D", "x":3.75, "y":3.5},
{"label":"F", "x":4.75, "y":3.5},
{"label":"G", "x":5.75, "y":3.5},
{"label":"H", "x":6.75, "y":3.5},
{"label":"J", "x":7.75, "y":3.5},
{"label":"K", "x":8.75, "y":3.5},
{"label":"L", "x":9.75, "y":3.5},
{"label":";", "x":10.75, "y":3.5},
{"label":"'", "x":11.75, "y":3.5},
{"label":"Enter", "x":12.75, "y":3.5, "w":2.25},
{"label":"PgDn", "x":15, "y":3.5},
{"label":"Shift", "x":0, "y":4.5, "w":2.25},
{"label":"Z", "x":2.25, "y":4.5},
{"label":"X", "x":3.25, "y":4.5},
{"label":"C", "x":4.25, "y":4.5},
{"label":"V", "x":5.25, "y":4.5},
{"label":"B", "x":6.25, "y":4.5},
{"label":"N", "x":7.25, "y":4.5},
{"label":"M", "x":8.25, "y":4.5},
{"label":",", "x":9.25, "y":4.5},
{"label":".", "x":10.25, "y":4.5},
{"label":"/", "x":11.25, "y":4.5},
{"label":"Shift", "x":12.25, "y":4.5, "w":1.75},
{"label":"\u2191", "x":14, "y":4.5},
{"label":"End", "x":15, "y":4.5},
{"label":"Ctrl", "x":0, "y":5.5, "w":1.25},
{"label":"Win", "x":1.25, "y":5.5, "w":1.25},
{"label":"Alt", "x":2.5, "y":5.5, "w":1.25},
{"x":3.75, "y":5.5, "w":6.25},
{"label":"Alt", "x":10, "y":5.5, "w":1.25},
{"label":"Fn", "x":11.25, "y":5.5, "w":1.25},
{"label":"\u2190", "x":13, "y":5.5},
{"label":"\u2193", "x":14, "y":5.5},
{"label":"\u2192", "x":15, "y":5.5}
]
}
}
}

View file

@ -0,0 +1,39 @@
/* Copyright 2021 TW59420 <https://github.com/TW59420>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include QMK_KEYBOARD_H
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[0] = LAYOUT(
KC_ESC, 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_TOG,
KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_DEL,
KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_PGUP,
KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_PGDN,
KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, KC_END,
KC_LCTL, KC_LGUI, KC_LALT, KC_SPACE, KC_RALT, MO(1), KC_LEFT, KC_DOWN, KC_RIGHT
),
[1] = LAYOUT(
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_HUI,
RGB_TOG, _______, _______, _______, RESET, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_HUD,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_SAI,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_VAI, RGB_SAD,
_______, _______, _______, _______, RGB_MOD, _______, RGB_SPD, RGB_VAD, RGB_SPI
),
};

View file

@ -0,0 +1,171 @@
/* Copyright 2021 TW59420 <https://github.com/TW59420>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include QMK_KEYBOARD_H
typedef union {
uint32_t raw;
struct {
bool top_rgb_change :1;
bool bottom_rgb_change :1;
};
} user_config_t;
user_config_t user_config;
#include QMK_KEYBOARD_H
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[0] = LAYOUT(
KC_ESC, 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_TOG,
KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_DEL,
KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_PGUP,
KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_PGDN,
KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, KC_END,
KC_LCTL, KC_LGUI, KC_LALT, KC_SPACE, KC_RALT, MO(1), KC_LEFT, KC_DOWN, KC_RIGHT
),
[1] = LAYOUT(
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, USER00, USER01, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_HUI,
RGB_TOG, _______, _______, _______, RESET, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_HUD,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_SAI,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_VAI, RGB_SAD,
_______, _______, _______, _______, RGB_MOD, _______, RGB_SPD, RGB_VAD, RGB_SPI
),
[2] = LAYOUT(
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______
),
[3] = LAYOUT(
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______
),
};
void keyboard_post_init_user(void) {
// Read the user config from EEPROM
user_config.raw = eeconfig_read_user();
}
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
switch (keycode) {
case USER00:
if (record->event.pressed) {
// Do something when pressed
user_config.top_rgb_change ^= 1; // Toggles the status
eeconfig_update_user(user_config.raw); // Writes the new status to EEPROM
} else {
// Do something else when release
}
return false; // Skip all further processing of this key
case USER01:
if (record->event.pressed) {
// Do something when pressed
user_config.bottom_rgb_change ^= 1; // Toggles the status
eeconfig_update_user(user_config.raw); // Writes the new status to EEPROM
} else {
// Do something else when release
}
return false; // Skip all further processing of this key
default:
return true; // Process all other keycodes normally
}
}
#ifdef ENCODER_ENABLE
#define ENCODERS 1
static uint8_t encoder_state[ENCODERS] = {0};
static keypos_t encoder_cw[ENCODERS] = {{3, 5}};
static keypos_t encoder_ccw[ENCODERS] = {{4, 5}};
void encoder_action_unregister(void) {
#ifdef ENCODERS
for (uint8_t index = 0; index < ENCODERS; ++index) {
if (encoder_state[index]) {
keyevent_t encoder_event = (keyevent_t) {
.key = encoder_state[index] >> 1 ? encoder_cw[index] : encoder_ccw[index],
.pressed = false,
.time = (timer_read() | 1)
};
encoder_state[index] = 0;
action_exec(encoder_event);
}
}
#endif
}
void encoder_action_register(uint8_t index, bool clockwise) {
keyevent_t encoder_event = (keyevent_t) {
.key = clockwise ? encoder_cw[index] : encoder_ccw[index],
.pressed = true,
.time = (timer_read() | 1)
};
encoder_state[index] = (clockwise ^ 1) | (clockwise << 1);
action_exec(encoder_event);
}
void matrix_scan_user(void) {
encoder_action_unregister();
}
bool encoder_update_user(uint8_t index, bool clockwise) {
encoder_action_register(index, clockwise);
return true;
};
#endif
void rgb_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max) {
if (user_config.top_rgb_change)
{
for (size_t i = 14; i < 18; i++)
{
RGB_MATRIX_INDICATOR_SET_COLOR(i, 0, 0, 0);
}
}
if (host_keyboard_led_state().caps_lock) {
for (size_t i = 14; i < 18; i++)
{
RGB_MATRIX_INDICATOR_SET_COLOR(i, 0, 255, 255); // assuming caps lock is at led #5
}
}
if (user_config.bottom_rgb_change)
{
for (size_t i = 0; i < 21; i++)
{
if (i >= 14 && i <18)
continue;
RGB_MATRIX_INDICATOR_SET_COLOR(i, 0, 0, 0);
}
}
}

View file

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

View file

@ -0,0 +1,28 @@
/* Copyright 2021 TW59420 <https://github.com/TW59420>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "mw75r2.h"
#ifdef RGB_MATRIX_ENABLE
led_config_t g_led_config = { {
{ 0, 1, 2, 3, 4, 5, 6, 7 },
{ 8, 9, 10, 11, 12, 13, 14, 15 },
{ 16, 17, 18, 19, 20 }
}, {
{ 105, 60 }, { 70, 60 }, { 35, 60 }, { 0, 60 }, { 0, 40 }, { 0, 20 }, { 0, 0 }, { 42, 0 }, { 84, 0 }, { 126, 0 }, { 168, 0 }, { 210, 0 }, { 210, 20 }, { 210, 40 }, { 40, 20 }, { 120, 20 }, { 40, 40 }, { 120, 40 }, { 210, 60 }, { 175, 60 },{ 140, 60 }
}, {
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
} };
#endif

View file

@ -0,0 +1,34 @@
/* Copyright 2021 TW59420 <https://github.com/TW59420>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include "quantum.h"
#define LAYOUT( \
K000, K002, K003, K004, K005, K006, K007, K008, K009, K010, K011, K012, K013, K014,\
K100, K101, K102, K103, K104, K105, K106, K107, K108, K109, K110, K111, K112, K113, K114,\
K200, K201, K202, K203, K204, K205, K206, K207, K208, K209, K210, K211, K212, K213, K214,\
K300, K301, K302, K303, K304, K305, K306, K307, K308, K309, K310, K311, K312, K314,\
K400, K402, K403, K404, K405, K406, K407, K408, K409, K410, K411, K412, K413, K414,\
K500, K501, K502, K506, K510, K511, K512, K513, K514\
) { \
{ K000, KC_NO, K002, K003, K004, K005, K006, K007, K008, K009, K010, K011, K012, K013, K014 },\
{ K100, K101, K102, K103, K104, K105, K106, K107, K108, K109, K110, K111, K112, K113, K114 },\
{ K200, K201, K202, K203, K204, K205, K206, K207, K208, K209, K210, K211, K212, K213, K214 },\
{ K300, K301, K302, K303, K304, K305, K306, K307, K308, K309, K310, K311, K312, KC_NO, K314 },\
{ K400, KC_NO, K402, K403, K404, K405, K406, K407, K408, K409, K410, K411, K412, K413, K414 },\
{ K500, K501, K502, KC_NO, KC_NO, KC_NO, K506, KC_NO, KC_NO, KC_NO, K510, K511, K512, K513, K514 }\
}

View file

@ -0,0 +1,22 @@
# MW75R2
![MW75R2](https://i.imgur.com/S9Gd81b.jpg?1)
Support Atmega32u4 keyboard.
* Keyboard Maintainer: [TW59420](https://github.com/TW59420)
* Hardware Supported: Atmega32u4
Make example for this keyboard (after setting up your build environment):
make mwstudio/mw75r2:default
Flashing example for this keyboard:
make mwstudio/mw75r2:default: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
* **Physical reset button**: Short press the button on the back of the PCB to enter the Bootloader and flash the firmware
* **Keycode in layout**: Press the key mapped to RESET if it is available

View file

@ -0,0 +1,21 @@
# MCU name
MCU = atmega32u4
# Bootloader selection
BOOTLOADER = atmel-dfu
# 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
BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality
RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow
AUDIO_ENABLE = no # Audio output
RGB_MATRIX_ENABLE = yes
RGB_MATRIX_DRIVER = WS2812
ENCODER_ENABLE = yes