Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add MW75 support #14833

Merged
merged 23 commits into from
Oct 23, 2021
Merged
Show file tree
Hide file tree
Changes from 11 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
75 changes: 75 additions & 0 deletions keyboards/mwstudio/mw75/config.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
/* 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 0x7501
#define DEVICE_VER 0x0001
#define MANUFACTURER MWStudio
#define PRODUCT MW75

/* key matrix size */
#define MATRIX_ROWS 7
#define MATRIX_COLS 15

/* key matrix pins */
#define MATRIX_ROW_PINS { B7, D0, D1, D2, D3, D5, B0}
#define MATRIX_COL_PINS { D4, D6, D7, B4, B5, B6, C6, C7, F7, F6, F5, F4, F1, F0, E6 }

#define BOOTMAGIC_LITE_ROW 0
#define BOOTMAGIC_LITE_COLUMN 1

/* 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 200
#define RGB_MATRIX_STARTUP_VAL RGB_MATRIX_MAXIMUM_BRIGHTNESS
#define DRIVER_LED_TOTAL 97
#define RGBLED_NUM 97
#define RGB_MATRIX_KEYPRESSES

// #define DISABLE_RGB_MATRIX_GRADIENT_UP_DOWN
// #define DISABLE_RGB_MATRIX_GRADIENT_LEFT_RIGHT
// #define DISABLE_RGB_MATRIX_SOLID_REACTIVE_WIDE
// #define DISABLE_RGB_MATRIX_SOLID_REACTIVE_MULTIWIDE
// #define DISABLE_RGB_MATRIX_SOLID_REACTIVE_CROSS
// #define DISABLE_RGB_MATRIX_SOLID_REACTIVE_MULTICROSS
// #define DISABLE_RGB_MATRIX_TYPING_HEATMAP
// #define DISABLE_RGB_MATRIX_DIGITAL_RAIN
// #define DISABLE_RGB_MATRIX_BAND_SAT
// #define DISABLE_RGB_MATRIX_BAND_VAL
// #define DISABLE_RGB_MATRIX_BAND_PINWHEEL_SAT
// #define DISABLE_RGB_MATRIX_BAND_PINWHEEL_VAL
// #define DISABLE_RGB_MATRIX_BAND_SPIRAL_SAT
// #define DISABLE_RGB_MATRIX_BAND_SPIRAL_VAL

#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 }
99 changes: 99 additions & 0 deletions keyboards/mwstudio/mw75/info.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
{
"keyboard_name": "MW75",
"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},
{"label":"Vol-", "x":3.75, "y":5.5 },
{"label":"Vol+", "x":4.75, "y":5.5 },
{"x":5.75, "y":5.5, "w":4.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}
]
}
}
}
131 changes: 131 additions & 0 deletions keyboards/mwstudio/mw75/keymaps/default/keymap.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
/* 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;

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_VOLU, KC_VOLD, KC_SPACE, KC_RALT, MO(1), KC_LEFT, KC_DOWN, KC_RIGHT
),

[1] = LAYOUT(
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_F23, KC_F24, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_HUI,
RGB_TOG, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, 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 KC_F23:
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 KC_F24:
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
}
}

bool encoder_update_user(uint8_t index, bool clockwise) {
if (index == 0) {
if (clockwise) {
tap_code(KC_VOLU);
} else {
tap_code(KC_VOLD);
}
}
return true;
}
TW59420 marked this conversation as resolved.
Show resolved Hide resolved

void rgb_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max) {

if (user_config.top_rgb_change)
{
for (size_t i = 0; i < 81; i++)
{
RGB_MATRIX_INDICATOR_SET_COLOR(i, 0, 0, 0);
}
}

if (host_keyboard_led_state().caps_lock) {
RGB_MATRIX_INDICATOR_SET_COLOR(36, 0, 255, 255);
}

if (user_config.bottom_rgb_change)
{
for (size_t i = 81; i < 97; i++)
{
RGB_MATRIX_INDICATOR_SET_COLOR(i, 0, 0, 0);
}
}
}
Loading