Skip to content

Commit

Permalink
[Keyboard] add mmk_3 (qmk#22569)
Browse files Browse the repository at this point in the history
Co-authored-by: jack <[email protected]>
Co-authored-by: Ryan <[email protected]>
Co-authored-by: Drashna Jaelre <[email protected]>
Co-authored-by: Joel Challis <[email protected]>
  • Loading branch information
5 people authored and Nathan committed Feb 11, 2024
1 parent ac2ee97 commit f661aa0
Show file tree
Hide file tree
Showing 9 changed files with 222 additions and 0 deletions.
26 changes: 26 additions & 0 deletions keyboards/mwstudio/mmk_3/config.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/* Copyright 2023 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

#define RGBLIGHT_LAYERS
#define RGBLIGHT_DEFAULT_MODE RGBLIGHT_MODE_RAINBOW_SWIRL + 5

#define WS2812_PWM_DRIVER PWMD4
#define WS2812_PWM_CHANNEL 3
#define WS2812_PWM_PAL_MODE 1
#define WS2812_DMA_STREAM STM32_DMA1_STREAM7
#define WS2812_DMA_CHANNEL 2
22 changes: 22 additions & 0 deletions keyboards/mwstudio/mmk_3/halconf.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/* Copyright 2022 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

#define HAL_USE_PWM TRUE

#include_next <halconf.h>

53 changes: 53 additions & 0 deletions keyboards/mwstudio/mmk_3/info.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
{
"manufacturer": "MWStudio",
"keyboard_name": "MMK_3",
"maintainer": "TW59420",
"bootloader": "stm32duino",
"diode_direction": "ROW2COL",
"features": {
"bootmagic": true,
"extrakey": true,
"mousekey": false,
"nkro": true,
"rgblight": true
},
"matrix_pins": {
"cols": ["A3", "A4", "A5"],
"rows": ["A6"]
},
"processor": "STM32F103",
"rgblight": {
"animations": {
"alternating": true,
"breathing": true,
"christmas": true,
"knight": true,
"rainbow_mood": true,
"rainbow_swirl": true,
"snake": true,
"static_gradient": true,
"twinkle": true
},
"hue_steps": 10,
"led_count": 5
},
"url": "",
"usb": {
"device_version": "1.0.0",
"pid": "0x3001",
"vid": "0x7BA1"
},
"ws2812": {
"driver": "pwm"
"pin": "B8",
},
"layouts": {
"LAYOUT": {
"layout": [
{ "matrix": [0, 0], "x": 0, "y": 0 },
{ "matrix": [0, 1], "x": 1, "y": 0 },
{ "matrix": [0, 2], "x": 2, "y": 0 }
]
}
}
}
26 changes: 26 additions & 0 deletions keyboards/mwstudio/mmk_3/keymaps/default/keymap.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/* Copyright 2023 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(LT(3, KC_LCTL), LT(1, KC_C), LT(2, KC_V)),

[1] = LAYOUT(RGB_VAD, KC_TRNS, RGB_VAI),

[2] = LAYOUT(RGB_SAD, RGB_SAI, KC_TRNS),

[3] = LAYOUT(KC_TRNS, RGB_HUD, RGB_HUI)};
47 changes: 47 additions & 0 deletions keyboards/mwstudio/mmk_3/keymaps/via/keymap.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/* Copyright 2023 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 rgblight_segment_t PROGMEM my_layer0_dfu[] = RGBLIGHT_LAYER_SEGMENTS({3, 2, HSV_WHITE});
const rgblight_segment_t PROGMEM my_layer1_val[] = RGBLIGHT_LAYER_SEGMENTS({3, 2, HSV_BLUE});
const rgblight_segment_t PROGMEM my_layer2_sat[] = RGBLIGHT_LAYER_SEGMENTS({3, 2, HSV_PURPLE});
const rgblight_segment_t PROGMEM my_layer3_hue[] = RGBLIGHT_LAYER_SEGMENTS({3, 2, HSV_RED});

const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {

[0] = LAYOUT(LT(3, KC_LCTL), LT(1, KC_C), LT(2, KC_V)),

[1] = LAYOUT(RGB_VAD, KC_TRNS, RGB_VAI),

[2] = LAYOUT(RGB_SAD, RGB_SAI, KC_TRNS),

[3] = LAYOUT(KC_TRNS, RGB_HUD, RGB_HUI)};

const rgblight_segment_t* const PROGMEM my_rgb_layers[] = RGBLIGHT_LAYERS_LIST(my_layer0_dfu, my_layer1_val, my_layer2_sat, my_layer3_hue);

void keyboard_post_init_user(void) {
// Enable the LED layers
rgblight_layers = my_rgb_layers;
}

layer_state_t layer_state_set_user(layer_state_t state) {
rgblight_set_layer_state(0, layer_state_cmp(state, 0));
rgblight_set_layer_state(1, layer_state_cmp(state, 1));
rgblight_set_layer_state(2, layer_state_cmp(state, 2));
rgblight_set_layer_state(3, layer_state_cmp(state, 3));
return state;
}
2 changes: 2 additions & 0 deletions keyboards/mwstudio/mmk_3/keymaps/via/rules.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
VIA_ENABLE = yes
LTO_ENABLE = yes
23 changes: 23 additions & 0 deletions keyboards/mwstudio/mmk_3/mcuconf.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/* Copyright 2023 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_next <mcuconf.h>

#undef STM32_PWM_USE_TIM4
#define STM32_PWM_USE_TIM4 TRUE


22 changes: 22 additions & 0 deletions keyboards/mwstudio/mmk_3/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# 3Key

![3Key](https://i.imgur.com/WuwlVknh.jpeg)

Support APM32F103C8T6 keyboard.

* Keyboard Maintainer: [TW59420](https://github.com/TW59420)
* Hardware Supported: APM32F103C8T6

Make example for this keyboard (after setting up your build environment):

make mwstudio/mmk_3:default

Flashing example for this keyboard:

make mwstudio/mmk_3: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
1 change: 1 addition & 0 deletions keyboards/mwstudio/mmk_3/rules.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# This file intentionally left blank

0 comments on commit f661aa0

Please sign in to comment.