aboutsummaryrefslogtreecommitdiff
path: root/keyboards/mlego
diff options
context:
space:
mode:
authorAlin Marin Elena <alin@elena.space>2022-01-11 03:14:54 +0000
committerGitHub <noreply@github.com>2022-01-10 19:14:54 -0800
commit01e4d07de0786035979d0f311ef31f87555737d7 (patch)
tree8c310839ec0b7385521488aacfbba09a5f7d2451 /keyboards/mlego
parente2aee8f9bbb0885ede2c2918244902bad9136659 (diff)
downloadqmk_firmware-01e4d07de0786035979d0f311ef31f87555737d7.tar.gz
qmk_firmware-01e4d07de0786035979d0f311ef31f87555737d7.zip
[m65] add via, new mcu gd32f303, stm32f401 weact support for encoder and led strip (#14381)
Co-authored-by: James Young <18669334+noroadsleft@users.noreply.github.com>
Diffstat (limited to 'keyboards/mlego')
-rw-r--r--keyboards/mlego/m65/config.h33
-rw-r--r--keyboards/mlego/m65/info.json81
-rw-r--r--keyboards/mlego/m65/keymaps/default/config.h20
-rw-r--r--keyboards/mlego/m65/keymaps/default/keymap.c169
-rw-r--r--keyboards/mlego/m65/keymaps/default/readme.md13
-rw-r--r--keyboards/mlego/m65/keymaps/dk/config.h20
-rw-r--r--keyboards/mlego/m65/keymaps/dk/keymap.c170
-rw-r--r--keyboards/mlego/m65/keymaps/dk/readme.md13
-rw-r--r--keyboards/mlego/m65/keymaps/uk/config.h22
-rw-r--r--keyboards/mlego/m65/keymaps/uk/keymap.c251
-rw-r--r--keyboards/mlego/m65/keymaps/uk/readme.md13
-rw-r--r--keyboards/mlego/m65/keymaps/uk/rules.mk1
-rw-r--r--keyboards/mlego/m65/keymaps/via/config.h20
-rw-r--r--keyboards/mlego/m65/keymaps/via/keymap.c168
-rw-r--r--keyboards/mlego/m65/keymaps/via/rules.mk1
-rw-r--r--keyboards/mlego/m65/m65.c18
-rw-r--r--keyboards/mlego/m65/m65.h124
-rw-r--r--keyboards/mlego/m65/readme.md129
-rw-r--r--keyboards/mlego/m65/rev1/chconf.h28
-rw-r--r--keyboards/mlego/m65/rev1/config.h59
-rw-r--r--keyboards/mlego/m65/rev1/mcuconf.h27
-rw-r--r--keyboards/mlego/m65/rev1/rules.mk19
-rw-r--r--keyboards/mlego/m65/rev2/board.h20
-rw-r--r--keyboards/mlego/m65/rev2/chconf.h28
-rw-r--r--keyboards/mlego/m65/rev2/config.h70
-rw-r--r--keyboards/mlego/m65/rev2/mcuconf.h27
-rw-r--r--keyboards/mlego/m65/rev2/rules.mk19
-rw-r--r--keyboards/mlego/m65/rev3/config.h59
-rw-r--r--keyboards/mlego/m65/rev3/halconf.h30
-rw-r--r--keyboards/mlego/m65/rev3/mcuconf.h30
-rw-r--r--keyboards/mlego/m65/rev3/rules.mk19
31 files changed, 1701 insertions, 0 deletions
diff --git a/keyboards/mlego/m65/config.h b/keyboards/mlego/m65/config.h
new file mode 100644
index 000000000..25d69d8b7
--- /dev/null
+++ b/keyboards/mlego/m65/config.h
@@ -0,0 +1,33 @@
1/*
2Copyright 2021-2022 Alin M Elena <alinm.elena@gmail.com>
3
4This program is free software: you can redistribute it and/or modify
5it under the terms of the GNU General Public License as published by
6the Free Software Foundation, either version 2 of the License, or
7(at your option) any later version.
8
9This program is distributed in the hope that it will be useful,
10but WITHOUT ANY WARRANTY; without even the implied warranty of
11MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12GNU General Public License for more details.
13
14You should have received a copy of the GNU General Public License
15along with this program. If not, see <http://www.gnu.org/licenses/>.
16*/
17
18#pragma once
19
20#include "config_common.h"
21
22#define VENDOR_ID 0xBABA
23#define MANUFACTURER Alin Elena
24#define PRODUCT m65
25
26#define MATRIX_ROWS 5
27#define MATRIX_COLS 13
28
29#define DIODE_DIRECTION COL2ROW
30#define DEBOUNCE 5
31
32#define LOCKING_SUPPORT_ENABLE
33#define LOCKING_RESYNC_ENABLE
diff --git a/keyboards/mlego/m65/info.json b/keyboards/mlego/m65/info.json
new file mode 100644
index 000000000..c06cf9a71
--- /dev/null
+++ b/keyboards/mlego/m65/info.json
@@ -0,0 +1,81 @@
1{
2 "keyboard_name": "M65",
3 "keyboard_folder": "mlego/m65",
4 "url": "https://gitlab.com/m-lego/m65",
5 "maintainer": "alin elena",
6 "layouts": {
7 "LAYOUT_ortho_5x13": {
8 "layout": [
9 {"x": 0, "y": 0},
10 {"x": 1, "y": 0},
11 {"x": 2, "y": 0},
12 {"x": 3, "y": 0},
13 {"x": 4, "y": 0},
14 {"x": 5, "y": 0},
15 {"x": 6, "y": 0},
16 {"x": 7, "y": 0},
17 {"x": 8, "y": 0},
18 {"x": 9, "y": 0},
19 {"x": 10, "y": 0},
20 {"x": 11, "y": 0},
21 {"x": 12, "y": 0},
22
23 {"x": 0, "y": 1},
24 {"x": 1, "y": 1},
25 {"x": 2, "y": 1},
26 {"x": 3, "y": 1},
27 {"x": 4, "y": 1},
28 {"x": 5, "y": 1},
29 {"x": 6, "y": 1},
30 {"x": 7, "y": 1},
31 {"x": 8, "y": 1},
32 {"x": 9, "y": 1},
33 {"x": 10, "y": 1},
34 {"x": 11, "y": 1},
35 {"x": 12, "y": 1},
36
37 {"x": 0, "y": 2},
38 {"x": 1, "y": 2},
39 {"x": 2, "y": 2},
40 {"x": 3, "y": 2},
41 {"x": 4, "y": 2},
42 {"x": 5, "y": 2},
43 {"x": 6, "y": 2},
44 {"x": 7, "y": 2},
45 {"x": 8, "y": 2},
46 {"x": 9, "y": 2},
47 {"x": 10, "y": 2},
48 {"x": 11, "y": 2},
49 {"x": 12, "y": 2},
50
51 {"x": 0, "y": 3},
52 {"x": 1, "y": 3},
53 {"x": 2, "y": 3},
54 {"x": 3, "y": 3},
55 {"x": 4, "y": 3},
56 {"x": 5, "y": 3},
57 {"x": 6, "y": 3},
58 {"x": 7, "y": 3},
59 {"x": 8, "y": 3},
60 {"x": 9, "y": 3},
61 {"x": 10, "y": 3},
62 {"x": 11, "y": 3},
63 {"x": 12, "y": 3},
64
65 {"x": 0, "y": 4},
66 {"x": 1, "y": 4},
67 {"x": 2, "y": 4},
68 {"x": 3, "y": 4},
69 {"x": 4, "y": 4},
70 {"x": 5, "y": 4},
71 {"x": 6, "y": 4},
72 {"x": 7, "y": 4},
73 {"x": 8, "y": 4},
74 {"x": 9, "y": 4},
75 {"x": 10, "y": 4},
76 {"x": 11, "y": 4},
77 {"x": 12, "y": 4}
78 ]
79 }
80 }
81}
diff --git a/keyboards/mlego/m65/keymaps/default/config.h b/keyboards/mlego/m65/keymaps/default/config.h
new file mode 100644
index 000000000..637c0a8fa
--- /dev/null
+++ b/keyboards/mlego/m65/keymaps/default/config.h
@@ -0,0 +1,20 @@
1/*
2Copyright 2021-2022 Alin M Elena <alinm.elena@gmail.com>
3
4This program is free software: you can redistribute it and/or modify
5it under the terms of the GNU General Public License as published by
6the Free Software Foundation, either version 2 of the License, or
7(at your option) any later version.
8
9This program is distributed in the hope that it will be useful,
10but WITHOUT ANY WARRANTY; without even the implied warranty of
11MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12GNU General Public License for more details.
13
14You should have received a copy of the GNU General Public License
15along with this program. If not, see <http://www.gnu.org/licenses/>.
16*/
17
18#pragma once
19
20#define TAPPING_TOGGLE 2
diff --git a/keyboards/mlego/m65/keymaps/default/keymap.c b/keyboards/mlego/m65/keymaps/default/keymap.c
new file mode 100644
index 000000000..75ad22f39
--- /dev/null
+++ b/keyboards/mlego/m65/keymaps/default/keymap.c
@@ -0,0 +1,169 @@
1/*
2Copyright 2021-2022 Alin M Elena <alinm.elena@gmail.com>
3
4This program is free software: you can redistribute it and/or modify
5it under the terms of the GNU General Public License as published by
6the Free Software Foundation, either version 2 of the License, or
7(at your option) any later version.
8
9This program is distributed in the hope that it will be useful,
10but WITHOUT ANY WARRANTY; without even the implied warranty of
11MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12GNU General Public License for more details.
13
14You should have received a copy of the GNU General Public License
15along with this program. If not, see <http://www.gnu.org/licenses/>.
16*/
17
18#include QMK_KEYBOARD_H
19
20enum layer_names {
21 _QW = 0,
22 _LWR,
23 _RSE,
24 _ADJ
25};
26
27#ifdef RGBLIGHT_ENABLE
28
29const rgblight_segment_t PROGMEM my_qwerty_layer[] = RGBLIGHT_LAYER_SEGMENTS({0, RGBLED_NUM, HSV_PURPLE});
30const rgblight_segment_t PROGMEM my_lwr_layer[] = RGBLIGHT_LAYER_SEGMENTS({0, RGBLED_NUM, HSV_CYAN});
31const rgblight_segment_t PROGMEM my_rse_layer[] = RGBLIGHT_LAYER_SEGMENTS({0, RGBLED_NUM, HSV_RED});
32const rgblight_segment_t PROGMEM my_adj_layer[] = RGBLIGHT_LAYER_SEGMENTS({0, RGBLED_NUM, HSV_GREEN});
33
34const rgblight_segment_t* const PROGMEM my_rgb_layers[] = RGBLIGHT_LAYERS_LIST(my_qwerty_layer, my_lwr_layer, my_rse_layer, my_adj_layer);
35#endif
36
37// clang-format off
38const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
39
40 [_QW] = LAYOUT_ortho_5x13(
41 KC_ESC, KC_1 , KC_2 , KC_3 , KC_4 , KC_5 , KC_6 , KC_7 , KC_8 , KC_9 , KC_0 , KC_MINS, KC_BSPC ,
42 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 ,
43 KC_NUHS, KC_A , KC_S , KC_D , KC_F , KC_G , KC_H , KC_J , KC_K , KC_L , KC_SCLN, KC_QUOT, KC_ENT ,
44 KC_LSPO, KC_NUBS, KC_Z , KC_X , KC_C , KC_V , KC_B , KC_N , KC_M , KC_COMM, KC_DOT , KC_UP , KC_SLSH ,
45 KC_LCTL, KC_LGUI, TT(_LWR), KC_LALT, TT(_RSE), KC_SPC, KC_SPC, KC_SPC, KC_RALT, KC_RSPC, KC_LEFT, KC_DOWN, KC_RGHT),
46
47 [_LWR] = LAYOUT_ortho_5x13(
48 KC_GRV , KC_MUTE, KC_VOLU, KC_VOLD, KC_MPRV, KC_MPLY, KC_MNXT, G(KC_P), KC_SLEP, KC_WAKE, KC_PSCR, KC_DEL , KC_EQL ,
49 KC_BTN3, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ ,
50 KC_BTN2, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ ,
51 _______, KC_BTN1, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_MS_U, _______ ,
52 _______, KC_BTN4, _______, _______, _______, _______, _______, _______, _______, _______, KC_MS_L, KC_MS_D, KC_MS_R),
53
54 [_RSE] = LAYOUT_ortho_5x13(
55 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 ,
56 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ ,
57 KC_CAPS, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ ,
58 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_WH_U, _______ ,
59 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_WH_L, KC_WH_D, KC_WH_R),
60
61 [_ADJ] = LAYOUT_ortho_5x13(
62 RGB_MOD, RGB_RMOD, A(KC_F2), _______, _______, _______, _______, _______, _______, _______, _______, _______ , RGB_M_SW,
63 RGB_HUI, RGB_HUD , RGB_M_P , _______, RESET , RGB_M_T, _______, _______, _______, _______, _______, _______ , RGB_M_SN,
64 RGB_SAI, RGB_SAD , RGB_M_B , _______, _______, _______, _______, _______, _______, _______, _______, _______ , RGB_M_K ,
65 RGB_VAI, RGB_VAD , RGB_M_R , _______, _______, _______, _______, _______, _______, _______, _______, _______ , RGB_M_X ,
66 RGB_TOG, _______ , _______ , _______, _______, _______, _______, _______, _______, _______, _______, RGB_M_TW, RGB_M_G),
67
68};
69// clang-format on
70
71// let us assume we start with both layers off
72bool toggle_lwr = false;
73bool toggle_rse = false;
74
75bool led_update_user(led_t led_state) {
76 // Disable the default LED update code, so that lock LEDs could be reused to show layer status.
77 return false;
78}
79
80void matrix_scan_user(void) {
81 led_lwr(toggle_lwr);
82 led_rse(toggle_rse);
83 led_t led_state = host_keyboard_led_state();
84 led_caps(led_state.caps_lock);
85 if (layer_state_is(_ADJ)) {
86 led_lwr(true);
87 led_rse(true);
88 }
89}
90
91bool process_record_user(uint16_t keycode, keyrecord_t* record) {
92 switch (keycode) {
93 case (TT(_LWR)):
94 if (!record->event.pressed && record->tap.count == TAPPING_TOGGLE) {
95 // This runs before the TT() handler toggles the layer state, so the current layer state is the opposite of the final one after toggle.
96 toggle_lwr = !layer_state_is(_LWR);
97 }
98 return true;
99 break;
100 case (TT(_RSE)):
101 if (record->event.pressed && record->tap.count == TAPPING_TOGGLE) {
102 toggle_rse = !layer_state_is(_RSE);
103 }
104 return true;
105 break;
106 default:
107 return true;
108 }
109}
110
111layer_state_t layer_state_set_user(layer_state_t state) {
112#ifdef RGBLIGHT_ENABLE
113
114 rgblight_set_layer_state(0, layer_state_cmp(state, _QW));
115 rgblight_set_layer_state(1, layer_state_cmp(state, _LWR));
116 rgblight_set_layer_state(2, layer_state_cmp(state, _RSE));
117 rgblight_set_layer_state(3, layer_state_cmp(state, _ADJ));
118
119#endif
120 return update_tri_layer_state(state, _LWR, _RSE, _ADJ);
121}
122
123#ifdef RGBLIGHT_ENABLE
124
125layer_state_t default_layer_state_set_user(layer_state_t state) {
126 rgblight_set_layer_state(0, layer_state_cmp(state, _QW));
127 return state;
128}
129
130void keyboard_post_init_user(void) {
131 // Enable the LED layers
132 rgblight_layers = my_rgb_layers;
133}
134#endif
135
136#ifdef ENCODER_ENABLE
137
138# define MEDIA_KEY_DELAY 10
139
140static inline void my_encoders(const uint8_t index, const bool clockwise) {
141 if (index == 0) { /* First encoder */
142 if (IS_LAYER_ON(_LWR)) {
143 if (clockwise) {
144 rgblight_decrease_val_noeeprom();
145 } else {
146 rgblight_increase_val_noeeprom();
147 }
148 } else if (IS_LAYER_ON(_RSE)) {
149 if (clockwise) {
150 rgblight_decrease_hue_noeeprom();
151 } else {
152 rgblight_increase_hue_noeeprom();
153 }
154
155 } else {
156 if (clockwise) {
157 tap_code_delay(KC_VOLD, MEDIA_KEY_DELAY);
158 } else {
159 tap_code_delay(KC_VOLU, MEDIA_KEY_DELAY);
160 }
161 }
162 }
163}
164
165bool encoder_update_user(uint8_t index, bool clockwise) {
166 my_encoders(index, clockwise);
167 return true;
168}
169#endif
diff --git a/keyboards/mlego/m65/keymaps/default/readme.md b/keyboards/mlego/m65/keymaps/default/readme.md
new file mode 100644
index 000000000..ae7134223
--- /dev/null
+++ b/keyboards/mlego/m65/keymaps/default/readme.md
@@ -0,0 +1,13 @@
1![M65 Layout Image](https://i.imgur.com/Z2O8yhGh.png)
2
3# Default M65 Layout
4
5This is the default layout for M65. For the most part it's a straightforward and easy to follow layout inspired by ISO with a UK
6turn. The only unusual key is the key in the upper left, which sends Escape normally, but Grave when in layer 1 aka LWR. Similarly
7number row in layer 1 give the usual audio KC_GRV, KC_AUDIO_MUTE, KC_AUDIO_VOL_UP, KC_AUDIO_VOL_DOWN, KC_MEDIA_PREV_TRACK,
8KC_MEDIA_PLAY_PAUSE, KC_MEDIA_NEXT_TRACK, M_EXTDISP, KC_SYSTEM_SLEEP, KC_SYSTEM_WAKE, KC_PSCREEN, KC_DEL, KC_EQL in layer 2 aka
9RSE one gets F1-F12 mouse emulation can be used in layer 1 and 2.
10
11flashing is done by LWR+RSE+r
12
13full layout below see in keymap.c
diff --git a/keyboards/mlego/m65/keymaps/dk/config.h b/keyboards/mlego/m65/keymaps/dk/config.h
new file mode 100644
index 000000000..637c0a8fa
--- /dev/null
+++ b/keyboards/mlego/m65/keymaps/dk/config.h
@@ -0,0 +1,20 @@
1/*
2Copyright 2021-2022 Alin M Elena <alinm.elena@gmail.com>
3
4This program is free software: you can redistribute it and/or modify
5it under the terms of the GNU General Public License as published by
6the Free Software Foundation, either version 2 of the License, or
7(at your option) any later version.
8
9This program is distributed in the hope that it will be useful,
10but WITHOUT ANY WARRANTY; without even the implied warranty of
11MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12GNU General Public License for more details.
13
14You should have received a copy of the GNU General Public License
15along with this program. If not, see <http://www.gnu.org/licenses/>.
16*/
17
18#pragma once
19
20#define TAPPING_TOGGLE 2
diff --git a/keyboards/mlego/m65/keymaps/dk/keymap.c b/keyboards/mlego/m65/keymaps/dk/keymap.c
new file mode 100644
index 000000000..a4cb66bb9
--- /dev/null
+++ b/keyboards/mlego/m65/keymaps/dk/keymap.c
@@ -0,0 +1,170 @@
1/*
2Copyright 2021-2022 Alin M Elena <alinm.elena@gmail.com>
3
4This program is free software: you can redistribute it and/or modify
5it under the terms of the GNU General Public License as published by
6the Free Software Foundation, either version 2 of the License, or
7(at your option) any later version.
8
9This program is distributed in the hope that it will be useful,
10but WITHOUT ANY WARRANTY; without even the implied warranty of
11MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12GNU General Public License for more details.
13
14You should have received a copy of the GNU General Public License
15along with this program. If not, see <http://www.gnu.org/licenses/>.
16*/
17
18#include QMK_KEYBOARD_H
19#include "keymap_danish.h"
20
21enum layer_names {
22 _QW = 0,
23 _LWR,
24 _RSE,
25 _ADJ
26};
27
28#ifdef RGBLIGHT_ENABLE
29
30const rgblight_segment_t PROGMEM my_qwerty_layer[] = RGBLIGHT_LAYER_SEGMENTS({0, RGBLED_NUM, HSV_PURPLE});
31const rgblight_segment_t PROGMEM my_lwr_layer[] = RGBLIGHT_LAYER_SEGMENTS({0, RGBLED_NUM, HSV_CYAN});
32const rgblight_segment_t PROGMEM my_rse_layer[] = RGBLIGHT_LAYER_SEGMENTS({0, RGBLED_NUM, HSV_RED});
33const rgblight_segment_t PROGMEM my_adj_layer[] = RGBLIGHT_LAYER_SEGMENTS({0, RGBLED_NUM, HSV_GREEN});
34
35const rgblight_segment_t* const PROGMEM my_rgb_layers[] = RGBLIGHT_LAYERS_LIST(my_qwerty_layer, my_lwr_layer, my_rse_layer, my_adj_layer);
36#endif
37
38// clang-format off
39const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
40
41 [_QW] = LAYOUT_ortho_5x13(
42 KC_ESC, DK_1 , DK_2 , DK_3 , DK_4 , DK_5 , DK_6 , DK_7 , DK_8 , DK_9 , DK_0 , DK_PLUS, KC_BSPC ,
43 KC_TAB, DK_Q , DK_W , DK_E , DK_R , DK_T , DK_Y , DK_U , DK_I , DK_O , DK_P , DK_ARNG, DK_DIAE ,
44 DK_QUOT, DK_A , DK_S , DK_D , DK_F , DK_G , DK_H , DK_J , DK_K , DK_L , DK_AE , DK_OSTR, KC_ENT ,
45 KC_LSPO, DK_LABK, DK_Z , DK_X , DK_C , DK_V , DK_B , DK_N , DK_M , DK_COMM, DK_DOT , KC_UP , DK_MINS ,
46 KC_LCTL, KC_LGUI, TT(_LWR), KC_LALT, TT(_RSE), KC_SPC, KC_SPC, KC_SPC, KC_RALT, KC_RSPC, KC_LEFT, KC_DOWN, KC_RGHT),
47
48 [_LWR] = LAYOUT_ortho_5x13(
49 DK_HALF, KC_MUTE, KC_VOLU, KC_VOLD, KC_MPRV, KC_MPLY, KC_MNXT, G(KC_P), KC_SLEP, KC_WAKE, KC_PSCR, KC_DEL , DK_ACUT ,
50 KC_BTN3, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ ,
51 KC_BTN2, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ ,
52 _______, KC_BTN1, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_MS_U, _______ ,
53 _______, KC_BTN4, _______, _______, _______, _______, _______, _______, _______, _______, KC_MS_L, KC_MS_D, KC_MS_R),
54
55 [_RSE] = LAYOUT_ortho_5x13(
56 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 ,
57 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ ,
58 KC_CAPS, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ ,
59 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_WH_U, _______ ,
60 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_WH_L, KC_WH_D, KC_WH_R),
61
62 [_ADJ] = LAYOUT_ortho_5x13(
63 RGB_MOD,RGB_RMOD, A(KC_F2), _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_M_SW ,
64 RGB_HUI, RGB_HUD, RGB_M_P , _______, RESET , RGB_M_T, _______, _______, _______, _______, _______, _______, RGB_M_SN ,
65 RGB_SAI, RGB_SAD, RGB_M_B , _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_M_K ,
66 RGB_VAI, RGB_VAD, RGB_M_R , _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_M_X ,
67 RGB_TOG, _______, _______ , _______, _______, _______, _______, _______, _______, _______, _______, RGB_M_TW, RGB_M_G),
68
69};
70// clang-format on
71
72// let us assume we start with both layers off
73bool toggle_lwr = false;
74bool toggle_rse = false;
75
76bool led_update_user(led_t led_state) {
77 // Disable the default LED update code, so that lock LEDs could be reused to show layer status.
78 return false;
79}
80
81void matrix_scan_user(void) {
82 led_lwr(toggle_lwr);
83 led_rse(toggle_rse);
84 led_t led_state = host_keyboard_led_state();
85 led_caps(led_state.caps_lock);
86 if (layer_state_is(_ADJ)) {
87 led_lwr(true);
88 led_rse(true);
89 }
90}
91
92bool process_record_user(uint16_t keycode, keyrecord_t* record) {
93 switch (keycode) {
94 case (TT(_LWR)):
95 if (!record->event.pressed && record->tap.count == TAPPING_TOGGLE) {
96 // This runs before the TT() handler toggles the layer state, so the current layer state is the opposite of the final one after toggle.
97 toggle_lwr = !layer_state_is(_LWR);
98 }
99 return true;
100 break;
101 case (TT(_RSE)):
102 if (record->event.pressed && record->tap.count == TAPPING_TOGGLE) {
103 toggle_rse = !layer_state_is(_RSE);
104 }
105 return true;
106 break;
107 default:
108 return true;
109 }
110}
111
112layer_state_t layer_state_set_user(layer_state_t state) {
113#ifdef RGBLIGHT_ENABLE
114
115 rgblight_set_layer_state(0, layer_state_cmp(state, _QW));
116 rgblight_set_layer_state(1, layer_state_cmp(state, _LWR));
117 rgblight_set_layer_state(2, layer_state_cmp(state, _RSE));
118 rgblight_set_layer_state(3, layer_state_cmp(state, _ADJ));
119
120#endif
121 return update_tri_layer_state(state, _LWR, _RSE, _ADJ);
122}
123
124#ifdef RGBLIGHT_ENABLE
125
126layer_state_t default_layer_state_set_user(layer_state_t state) {
127 rgblight_set_layer_state(0, layer_state_cmp(state, _QW));
128 return state;
129}
130
131void keyboard_post_init_user(void) {
132 // Enable the LED layers
133 rgblight_layers = my_rgb_layers;
134}
135#endif
136
137#ifdef ENCODER_ENABLE
138
139# define MEDIA_KEY_DELAY 10
140
141static inline void my_encoders(const uint8_t index, const bool clockwise) {
142 if (index == 0) { /* First encoder */
143 if (IS_LAYER_ON(_LWR)) {
144 if (clockwise) {
145 rgblight_decrease_val_noeeprom();
146 } else {
147 rgblight_increase_val_noeeprom();
148 }
149 } else if (IS_LAYER_ON(_RSE)) {
150 if (clockwise) {
151 rgblight_decrease_hue_noeeprom();
152 } else {
153 rgblight_increase_hue_noeeprom();
154 }
155
156 } else {
157 if (clockwise) {
158 tap_code_delay(KC_VOLD, MEDIA_KEY_DELAY);
159 } else {
160 tap_code_delay(KC_VOLU, MEDIA_KEY_DELAY);
161 }
162 }
163 }
164}
165
166bool encoder_update_user(uint8_t index, bool clockwise) {
167 my_encoders(index, clockwise);
168 return true;
169}
170#endif
diff --git a/keyboards/mlego/m65/keymaps/dk/readme.md b/keyboards/mlego/m65/keymaps/dk/readme.md
new file mode 100644
index 000000000..06fed3bda
--- /dev/null
+++ b/keyboards/mlego/m65/keymaps/dk/readme.md
@@ -0,0 +1,13 @@
1![M65 Layout Image](https://i.imgur.com/RQqsM4gh.png)
2
3# Default M65 Layout
4
5This is the Danish keymap for M65. For the most part it's a straightforward and easy to follow layout inspired by ISO with a DK
6turn. The only unusual key is the key in the upper left, which sends Escape normally, but Grave when in layer 1 aka LWR. Similarly
7number row in layer 1 give the usual audio KC_GRV, KC_AUDIO_MUTE, KC_AUDIO_VOL_UP, KC_AUDIO_VOL_DOWN, KC_MEDIA_PREV_TRACK,
8KC_MEDIA_PLAY_PAUSE, KC_MEDIA_NEXT_TRACK, M_EXTDISP, KC_SYSTEM_SLEEP, KC_SYSTEM_WAKE, KC_PSCREEN, KC_DEL, DK_ACUT in layer 2 aka
9RSE one gets F1-F12 mouse emulation can be used in layer 1 and 2.
10
11flashing is done by LWR+RSE+r
12
13full layout below see in keymap.c
diff --git a/keyboards/mlego/m65/keymaps/uk/config.h b/keyboards/mlego/m65/keymaps/uk/config.h
new file mode 100644
index 000000000..9d446777c
--- /dev/null
+++ b/keyboards/mlego/m65/keymaps/uk/config.h
@@ -0,0 +1,22 @@
1/*
2Copyright 2021-2022 Alin M Elena <alinm.elena@gmail.com>
3
4This program is free software: you can redistribute it and/or modify
5it under the terms of the GNU General Public License as published by
6the Free Software Foundation, either version 2 of the License, or
7(at your option) any later version.
8
9This program is distributed in the hope that it will be useful,
10but WITHOUT ANY WARRANTY; without even the implied warranty of
11MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12GNU General Public License for more details.
13
14You should have received a copy of the GNU General Public License
15along with this program. If not, see <http://www.gnu.org/licenses/>.
16*/
17
18#pragma once
19
20#define TAPPING_TOGGLE 2
21//#define UNICODE_SELECTED_MODES UC_LNX, UC_MAC, UC_WINC
22#define UNICODE_SELECTED_MODES UC_LNX
diff --git a/keyboards/mlego/m65/keymaps/uk/keymap.c b/keyboards/mlego/m65/keymaps/uk/keymap.c
new file mode 100644
index 000000000..528105fc7
--- /dev/null
+++ b/keyboards/mlego/m65/keymaps/uk/keymap.c
@@ -0,0 +1,251 @@
1/*
2Copyright 2021-2022 Alin M Elena <alinm.elena@gmail.com>
3
4This program is free software: you can redistribute it and/or modify
5it under the terms of the GNU General Public License as published by
6the Free Software Foundation, either version 2 of the License, or
7(at your option) any later version.
8
9This program is distributed in the hope that it will be useful,
10but WITHOUT ANY WARRANTY; without even the implied warranty of
11MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12GNU General Public License for more details.
13
14You should have received a copy of the GNU General Public License
15along with this program. If not, see <http://www.gnu.org/licenses/>.
16*/
17
18#include QMK_KEYBOARD_H
19#include "keymap_uk.h"
20
21enum layer_names {
22 _QW = 0,
23 _LWR,
24 _RSE,
25 _ADJ
26};
27
28#ifdef CONSOLE_ENABLE
29
30#include "print.h"
31
32#endif
33
34#ifdef RGBLIGHT_ENABLE
35
36const rgblight_segment_t PROGMEM my_qwerty_layer[] = RGBLIGHT_LAYER_SEGMENTS({0, RGBLED_NUM, HSV_PURPLE});
37const rgblight_segment_t PROGMEM my_lwr_layer[] = RGBLIGHT_LAYER_SEGMENTS({0, RGBLED_NUM, HSV_CYAN});
38const rgblight_segment_t PROGMEM my_rse_layer[] = RGBLIGHT_LAYER_SEGMENTS({0, RGBLED_NUM, HSV_RED});
39const rgblight_segment_t PROGMEM my_adj_layer[] = RGBLIGHT_LAYER_SEGMENTS({0, RGBLED_NUM, HSV_GREEN});
40
41const rgblight_segment_t* const PROGMEM my_rgb_layers[] = RGBLIGHT_LAYERS_LIST(my_qwerty_layer, my_lwr_layer, my_rse_layer, my_adj_layer);
42#endif
43
44const uint32_t PROGMEM unicode_map[] = {
45 [la] = 0x03B1, // å
46 [lA] = 0x0391, // â„«
47 [lb] = 0x03B2, // β
48 [lB] = 0x0392, // Î’
49 [lc] = 0x03C7, //
50 [lC] = 0x0307, //
51 [ld] = 0x03B4, [lD] = 0x2202, [le] = 0x03B5, [lE] = 0x2107,
52 [lf] = 0x03C6, //
53 [lF] = 0x03C8, //
54 [lg] = 0x03B3, //
55 [lG] = 0x0393, //
56 [lh] = 0x210F, //
57 [lH] = 0x1D4D7, //
58 [li] = 0x222B, //
59 [lI] = 0x222E, //
60 [lj] = 0x2208, //
61 [lJ] = 0x2209, //
62 [lk] = 0x03F0, //
63 [lK] = 0x2206, //
64 [ll] = 0x03BB, //
65 [lL] = 0x039B, //
66 [lm] = 0x03BC, //
67 [lM] = 0x2218, //
68 [ln] = 0x03B7, //
69 [lN] = 0x222A, //
70 [lo] = 0x221E, //
71 [lO] = 0x2297, //
72 [lp] = 0x03C0, //
73 [lP] = 0x220F, //
74 [lq] = 0x03C3, //
75 [lQ] = 0x03D5, //
76 [lr] = 0x03C1, //
77 [lR] = 0x2207, //
78 [ls] = 0x2211, //
79 [lS] = 0x2A0B, //
80 [lt] = 0x03D1, //
81 [lT] = 0x03B8, //
82 [lu] = 0x03C4, //
83 [lU] = 0x2102, //
84 [lv] = 0x03BD, //
85 [lV] = 0x039D, //
86 [lw] = 0x03C9, //
87 [lW] = 0x03A9, //
88 [lx] = 0x03BE, //
89 [lX] = 0x039E, //
90 [ly] = 0x211d,
91 [lY] = 0x2124, //
92 [lz] = 0x03B6, //
93 [lZ] = 0x2221, //
94 [lZ] = 0x2221, //
95 [lc1] = 0x224A, //
96 [lC1] = 0x2248, //
97 [lp1] = 0x00B1, //
98 [lP1] = 0x2213, //
99 [lq1] = 0x00D7, //
100 [lQ1] = 0x22C5, //
101 [ll1] = 0x1D53C, //
102 [lL1] = 0x212b, //
103 [lk1] = 0x221D, //
104 [lK1] = 0x2112, //
105 [rc] = 0x00E7, // ç
106 [rC] = 0x00C7, // Ç
107};
108
109// clang-format off
110const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
111
112 [_QW] = LAYOUT_ortho_5x13(
113 KC_ESC, UK_1 , UK_2 , UK_3 , UK_4 , UK_5 , UK_6 , UK_7 , UK_8 , UK_9 , UK_0 , UK_MINS, KC_BSPC ,
114 KC_TAB, UK_Q , UK_W , UK_E , UK_R , UK_T , UK_Y , UK_U , UK_I , UK_O , UK_P , UK_LBRC, UK_RBRC ,
115 UK_HASH, UK_A , UK_S , UK_D , UK_F , UK_G , UK_H , UK_J , UK_K , UK_L , UK_SCLN, UK_QUOT, KC_ENT ,
116 KC_LSPO, UK_BSLS, UK_Z , UK_X , UK_C , UK_V , UK_B , UK_N , UK_M , UK_COMM, UK_DOT , KC_UP , UK_SLSH ,
117 KC_LCTL, KC_LGUI, TT(_LWR), KC_LALT, TT(_RSE), KC_SPC, KC_SPC, KC_SPC, KC_RALT, KC_RSPC, KC_LEFT, KC_DOWN, KC_RGHT),
118
119 [_LWR] = LAYOUT_ortho_5x13(
120 KC_GRV , KC_MUTE, KC_VOLU, KC_VOLD, KC_MPRV, KC_MPLY, KC_MNXT, G(KC_P), KC_SLEP, KC_WAKE, KC_PSCR, KC_DEL , UK_EQL ,
121 KC_BTN3, XP(lq , lQ) , XP(lw , lW) , XP(le , lE) , XP(lr , lR) , XP(lt , lT) , XP(ly , lY) , XP(lu, lU) , XP(li, lI) , XP(lo, lO) , XP(lp , lP) , _______, _______,
122 KC_BTN2, XP(la , lA) , XP(ls , lS) , XP(ld , lD) , XP(lf , lF) , XP(lg , lG) , XP(lh , lH) , XP(lj, lJ) , XP(lk, lK) , XP(ll, lL) , XP(ll1, lL1) , XP(lk1 , lK1) , _______,
123 _______, KC_BTN1, XP(lz , lZ) , XP(lx , lX) , XP(lc , lC) , XP(lv , lV) , XP(lb , lB) , XP(ln , lN) , XP(lm, lM) , XP(lc1, lC1) , XP(lp1, lP1) , KC_MS_U, XP(lq1 , lQ1) ,
124 _______, KC_BTN4, _______, _______, _______, _______, _______, _______, _______, _______, KC_MS_L, KC_MS_D, KC_MS_R),
125
126
127 [_RSE] = LAYOUT_ortho_5x13(
128 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 ,
129 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ ,
130 KC_CAPS, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ ,
131 _______, _______, _______, _______,XP(rc,rC), _______, _______, _______, _______, _______, _______, KC_WH_U, _______ ,
132 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_WH_L, KC_WH_D, KC_WH_R),
133
134 [_ADJ] = LAYOUT_ortho_5x13(
135 RGB_MOD, RGB_RMOD, A(KC_F2), _______, _______, _______, _______, _______, _______, _______, _______, _______ , RGB_M_SW,
136 RGB_HUI, RGB_HUD , RGB_M_P , _______, RESET , RGB_M_T, _______, _______, _______, _______, _______, _______ , RGB_M_SN,
137 RGB_SAI, RGB_SAD , RGB_M_B , _______, _______, _______, _______, _______, _______, _______, _______, _______ , RGB_M_K ,
138 RGB_VAI, RGB_VAD , RGB_M_R , _______, _______, _______, _______, _______, _______, _______, _______, _______ , RGB_M_X ,
139 RGB_TOG, _______ , _______ , _______, _______, _______, _______, _______, _______, _______, _______, RGB_M_TW, RGB_M_G),
140};
141// clang-format on
142
143// let us assume we start with both layers off
144bool toggle_lwr = false;
145bool toggle_rse = false;
146
147bool led_update_user(led_t led_state) {
148 // Disable the default LED update code, so that lock LEDs could be reused to show layer status.
149 return false;
150}
151
152void matrix_scan_user(void) {
153 led_lwr(toggle_lwr);
154 led_rse(toggle_rse);
155 led_t led_state = host_keyboard_led_state();
156 led_caps(led_state.caps_lock);
157 if (layer_state_is(_ADJ)) {
158 led_lwr(true);
159 led_rse(true);
160 }
161}
162
163bool process_record_user(uint16_t keycode, keyrecord_t* record) {
164#ifdef CONSOLE_ENABLE
165 uprintf("KL: kc: 0x%04X, col: %u, row: %u, pressed: %b, time: %u, interrupt: %b, count: %u\n", keycode, record->event.key.col, record->event.key.row, record->event.pressed, record->event.time, record->tap.interrupted, record->tap.count);
166#endif
167
168 switch (keycode) {
169 case (TT(_LWR)):
170 if (!record->event.pressed && record->tap.count == TAPPING_TOGGLE) {
171 // This runs before the TT() handler toggles the layer state, so the current layer state is the opposite of the final one after toggle.
172 toggle_lwr = !layer_state_is(_LWR);
173 }
174 return true;
175 break;
176 case (TT(_RSE)):
177 if (record->event.pressed && record->tap.count == TAPPING_TOGGLE) {
178 toggle_rse = !layer_state_is(_RSE);
179 }
180 return true;
181 break;
182 default:
183 return true;
184 }
185}
186
187layer_state_t layer_state_set_user(layer_state_t state) {
188#ifdef RGBLIGHT_ENABLE
189
190 rgblight_set_layer_state(0, layer_state_cmp(state, _QW));
191 rgblight_set_layer_state(1, layer_state_cmp(state, _LWR));
192 rgblight_set_layer_state(2, layer_state_cmp(state, _RSE));
193 rgblight_set_layer_state(3, layer_state_cmp(state, _ADJ));
194
195#endif
196 return update_tri_layer_state(state, _LWR, _RSE, _ADJ);
197}
198
199#ifdef RGBLIGHT_ENABLE
200
201layer_state_t default_layer_state_set_user(layer_state_t state) {
202 rgblight_set_layer_state(0, layer_state_cmp(state, _QW));
203 return state;
204}
205
206void keyboard_post_init_user(void) {
207 // Enable the LED layers
208 rgblight_layers = my_rgb_layers;
209#ifdef CONSOLE_ENABLE
210
211 debug_enable = true;
212 debug_matrix = true;
213 debug_keyboard = true;
214#endif
215}
216#endif
217
218#ifdef ENCODER_ENABLE
219
220# define MEDIA_KEY_DELAY 10
221
222static inline void my_encoders(const uint8_t index, const bool clockwise) {
223 if (index == 0) { /* First encoder */
224 if (IS_LAYER_ON(_LWR)) {
225 if (clockwise) {
226 rgblight_decrease_val_noeeprom();
227 } else {
228 rgblight_increase_val_noeeprom();
229 }
230 } else if (IS_LAYER_ON(_RSE)) {
231 if (clockwise) {
232 rgblight_decrease_hue_noeeprom();
233 } else {
234 rgblight_increase_hue_noeeprom();
235 }
236
237 } else {
238 if (clockwise) {
239 tap_code_delay(KC_VOLD, MEDIA_KEY_DELAY);
240 } else {
241 tap_code_delay(KC_VOLU, MEDIA_KEY_DELAY);
242 }
243 }
244 }
245}
246
247bool encoder_update_user(uint8_t index, bool clockwise) {
248 my_encoders(index, clockwise);
249 return true;
250}
251#endif
diff --git a/keyboards/mlego/m65/keymaps/uk/readme.md b/keyboards/mlego/m65/keymaps/uk/readme.md
new file mode 100644
index 000000000..bc29d2390
--- /dev/null
+++ b/keyboards/mlego/m65/keymaps/uk/readme.md
@@ -0,0 +1,13 @@
1# Default M65 Layout
2
3![M65 Layout Image](https://i.imgur.com/KZFnAU5h.png)
4
5This is the default layout for M65. For the most part it's a straightforward and easy to follow layout inspired by ISO with a UK
6turn. The only unusual key is the key in the upper left, which sends Escape normally, but Grave when in layer 1 aka LWR. Similarly
7number row in layer 1 give the usual audio KC_GRV, KC_AUDIO_MUTE, KC_AUDIO_VOL_UP, KC_AUDIO_VOL_DOWN, KC_MEDIA_PREV_TRACK,
8KC_MEDIA_PLAY_PAUSE, KC_MEDIA_NEXT_TRACK, M_EXTDISP, KC_SYSTEM_SLEEP, KC_SYSTEM_WAKE, KC_PSCREEN, KC_DEL, KC_EQL in layer 2 aka
9RSE one gets F1-F12 mouse emulation can be used in layer 1 and 2.
10
11flashing is done by LWR+RSE+r
12
13full layout below see in keymap.c
diff --git a/keyboards/mlego/m65/keymaps/uk/rules.mk b/keyboards/mlego/m65/keymaps/uk/rules.mk
new file mode 100644
index 000000000..502b2def7
--- /dev/null
+++ b/keyboards/mlego/m65/keymaps/uk/rules.mk
@@ -0,0 +1 @@
UNICODEMAP_ENABLE = yes
diff --git a/keyboards/mlego/m65/keymaps/via/config.h b/keyboards/mlego/m65/keymaps/via/config.h
new file mode 100644
index 000000000..637c0a8fa
--- /dev/null
+++ b/keyboards/mlego/m65/keymaps/via/config.h
@@ -0,0 +1,20 @@
1/*
2Copyright 2021-2022 Alin M Elena <alinm.elena@gmail.com>
3
4This program is free software: you can redistribute it and/or modify
5it under the terms of the GNU General Public License as published by
6the Free Software Foundation, either version 2 of the License, or
7(at your option) any later version.
8
9This program is distributed in the hope that it will be useful,
10but WITHOUT ANY WARRANTY; without even the implied warranty of
11MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12GNU General Public License for more details.
13
14You should have received a copy of the GNU General Public License
15along with this program. If not, see <http://www.gnu.org/licenses/>.
16*/
17
18#pragma once
19
20#define TAPPING_TOGGLE 2
diff --git a/keyboards/mlego/m65/keymaps/via/keymap.c b/keyboards/mlego/m65/keymaps/via/keymap.c
new file mode 100644
index 000000000..f6bb77bcd
--- /dev/null
+++ b/keyboards/mlego/m65/keymaps/via/keymap.c
@@ -0,0 +1,168 @@
1/*
2Copyright 2021-2022 Alin M Elena <alinm.elena@gmail.com>
3
4This program is free software: you can redistribute it and/or modify
5it under the terms of the GNU General Public License as published by
6the Free Software Foundation, either version 2 of the License, or
7(at your option) any later version.
8
9This program is distributed in the hope that it will be useful,
10but WITHOUT ANY WARRANTY; without even the implied warranty of
11MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12GNU General Public License for more details.
13
14You should have received a copy of the GNU General Public License
15along with this program. If not, see <http://www.gnu.org/licenses/>.
16*/
17
18#include QMK_KEYBOARD_H
19
20enum layer_names {
21 _QW = 0,
22 _LWR,
23 _RSE,
24 _ADJ
25};
26
27#ifdef RGBLIGHT_ENABLE
28
29const rgblight_segment_t PROGMEM my_qwerty_layer[] = RGBLIGHT_LAYER_SEGMENTS({0, RGBLED_NUM, HSV_PURPLE});
30const rgblight_segment_t PROGMEM my_lwr_layer[] = RGBLIGHT_LAYER_SEGMENTS({0, RGBLED_NUM, HSV_CYAN});
31const rgblight_segment_t PROGMEM my_rse_layer[] = RGBLIGHT_LAYER_SEGMENTS({0, RGBLED_NUM, HSV_RED});
32const rgblight_segment_t PROGMEM my_adj_layer[] = RGBLIGHT_LAYER_SEGMENTS({0, RGBLED_NUM, HSV_GREEN});
33
34const rgblight_segment_t* const PROGMEM my_rgb_layers[] = RGBLIGHT_LAYERS_LIST(my_qwerty_layer, my_lwr_layer, my_rse_layer, my_adj_layer);
35#endif
36
37// clang-format off
38const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
39
40 [_QW] = LAYOUT_ortho_5x13(
41 KC_ESC, KC_1 , KC_2 , KC_3 , KC_4 , KC_5 , KC_6 , KC_7 , KC_8 , KC_9 , KC_0 , KC_MINS, KC_BSPC ,
42 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 ,
43 KC_NUHS, KC_A , KC_S , KC_D , KC_F , KC_G , KC_H , KC_J , KC_K , KC_L , KC_SCLN, KC_QUOT, KC_ENT ,
44 KC_LSPO, KC_NUBS, KC_Z , KC_X , KC_C , KC_V , KC_B , KC_N , KC_M , KC_COMM, KC_DOT , KC_UP , KC_SLSH ,
45 KC_LCTL, KC_LGUI, TT(_LWR), KC_LALT, TT(_RSE), KC_SPC, KC_SPC, KC_SPC, KC_RALT, KC_RSPC, KC_LEFT, KC_DOWN, KC_RGHT),
46
47 [_LWR] = LAYOUT_ortho_5x13(
48 KC_GRV , KC_MUTE, KC_VOLU, KC_VOLD, KC_MPRV, KC_MPLY, KC_MNXT, G(KC_P), KC_SLEP, KC_WAKE, KC_PSCR, KC_DEL , KC_EQL ,
49 KC_BTN3, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ ,
50 KC_BTN2, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ ,
51 _______, KC_BTN1, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_MS_U, _______ ,
52 _______, KC_BTN4, _______, _______, _______, _______, _______, _______, _______, _______, KC_MS_L, KC_MS_D, KC_MS_R),
53
54 [_RSE] = LAYOUT_ortho_5x13(
55 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 ,
56 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ ,
57 KC_CAPS, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ ,
58 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_WH_U, _______ ,
59 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_WH_L, KC_WH_D, KC_WH_R),
60
61 [_ADJ] = LAYOUT_ortho_5x13(
62 _______, _______, A(KC_F2), _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ ,
63 _______, _______, _______ , _______, RESET , _______, _______, _______, _______, _______, _______, _______, _______ ,
64 _______, _______, _______ , _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ ,
65 _______, _______, _______ , _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ ,
66 _______, _______, _______ , _______, _______, _______, _______, _______, _______, _______, _______, _______, _______),
67};
68// clang-format on
69
70// let us assume we start with both layers off
71bool toggle_lwr = false;
72bool toggle_rse = false;
73
74bool led_update_user(led_t led_state) {
75 // Disable the default LED update code, so that lock LEDs could be reused to show layer status.
76 return false;
77}
78
79void matrix_scan_user(void) {
80 led_lwr(toggle_lwr);
81 led_rse(toggle_rse);
82 led_t led_state = host_keyboard_led_state();
83 led_caps(led_state.caps_lock);
84 if (layer_state_is(_ADJ)) {
85 led_lwr(true);
86 led_rse(true);
87 }
88}
89
90bool process_record_user(uint16_t keycode, keyrecord_t* record) {
91 switch (keycode) {
92 case (TT(_LWR)):
93 if (!record->event.pressed && record->tap.count == TAPPING_TOGGLE) {
94 // This runs before the TT() handler toggles the layer state, so the current layer state is the opposite of the final one after toggle.
95 toggle_lwr = !layer_state_is(_LWR);
96 }
97 return true;
98 break;
99 case (TT(_RSE)):
100 if (record->event.pressed && record->tap.count == TAPPING_TOGGLE) {
101 toggle_rse = !layer_state_is(_RSE);
102 }
103 return true;
104 break;
105 default:
106 return true;
107 }
108}
109
110layer_state_t layer_state_set_user(layer_state_t state) {
111#ifdef RGBLIGHT_ENABLE
112
113 rgblight_set_layer_state(0, layer_state_cmp(state, _QW));
114 rgblight_set_layer_state(1, layer_state_cmp(state, _LWR));
115 rgblight_set_layer_state(2, layer_state_cmp(state, _RSE));
116 rgblight_set_layer_state(3, layer_state_cmp(state, _ADJ));
117
118#endif
119 return update_tri_layer_state(state, _LWR, _RSE, _ADJ);
120}
121
122#ifdef RGBLIGHT_ENABLE
123
124layer_state_t default_layer_state_set_user(layer_state_t state) {
125 rgblight_set_layer_state(0, layer_state_cmp(state, _QW));
126 return state;
127}
128
129void keyboard_post_init_user(void) {
130 // Enable the LED layers
131 rgblight_layers = my_rgb_layers;
132}
133#endif
134
135#ifdef ENCODER_ENABLE
136
137# define MEDIA_KEY_DELAY 10
138
139static inline void my_encoders(const uint8_t index, const bool clockwise) {
140 if (index == 0) { /* First encoder */
141 if (IS_LAYER_ON(_LWR)) {
142 if (clockwise) {
143 rgblight_decrease_val_noeeprom();
144 } else {
145 rgblight_increase_val_noeeprom();
146 }
147 } else if (IS_LAYER_ON(_RSE)) {
148 if (clockwise) {
149 rgblight_decrease_hue_noeeprom();
150 } else {
151 rgblight_increase_hue_noeeprom();
152 }
153
154 } else {
155 if (clockwise) {
156 tap_code_delay(KC_VOLD, MEDIA_KEY_DELAY);
157 } else {
158 tap_code_delay(KC_VOLU, MEDIA_KEY_DELAY);
159 }
160 }
161 }
162}
163
164bool encoder_update_user(uint8_t index, bool clockwise) {
165 my_encoders(index, clockwise);
166 return true;
167}
168#endif
diff --git a/keyboards/mlego/m65/keymaps/via/rules.mk b/keyboards/mlego/m65/keymaps/via/rules.mk
new file mode 100644
index 000000000..1e5b99807
--- /dev/null
+++ b/keyboards/mlego/m65/keymaps/via/rules.mk
@@ -0,0 +1 @@
VIA_ENABLE = yes
diff --git a/keyboards/mlego/m65/m65.c b/keyboards/mlego/m65/m65.c
new file mode 100644
index 000000000..153359f33
--- /dev/null
+++ b/keyboards/mlego/m65/m65.c
@@ -0,0 +1,18 @@
1/*
2Copyright 2021-2022 Alin M Elena <alinm.elena@gmail.com>
3
4This program is free software: you can redistribute it and/or modify
5it under the terms of the GNU General Public License as published by
6the Free Software Foundation, either version 2 of the License, or
7(at your option) any later version.
8
9This program is distributed in the hope that it will be useful,
10but WITHOUT ANY WARRANTY; without even the implied warranty of
11MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12GNU General Public License for more details.
13
14You should have received a copy of the GNU General Public License
15along with this program. If not, see <http://www.gnu.org/licenses/>.
16*/
17
18#include "m65.h"
diff --git a/keyboards/mlego/m65/m65.h b/keyboards/mlego/m65/m65.h
new file mode 100644
index 000000000..a93a80be7
--- /dev/null
+++ b/keyboards/mlego/m65/m65.h
@@ -0,0 +1,124 @@
1/*
2Copyright 2021-2022 Alin M Elena <alinm.elena@gmail.com>
3
4This program is free software: you can redistribute it and/or modify
5it under the terms of the GNU General Public License as published by
6the Free Software Foundation, either version 2 of the License, or
7(at your option) any later version.
8
9This program is distributed in the hope that it will be useful,
10but WITHOUT ANY WARRANTY; without even the implied warranty of
11MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12GNU General Public License for more details.
13
14You should have received a copy of the GNU General Public License
15along with this program. If not, see <http://www.gnu.org/licenses/>.
16*/
17
18#pragma once
19
20#include "quantum.h"
21
22#define LAYOUT_ortho_5x13( \
23 K000, K001, K002, K003, K004, K005, K006, K007, K008, K009, K010, K011, K012, \
24 K100, K101, K102, K103, K104, K105, K106, K107, K108, K109, K110, K111, K112, \
25 K200, K201, K202, K203, K204, K205, K206, K207, K208, K209, K210, K211, K212, \
26 K300, K301, K302, K303, K304, K305, K306, K307, K308, K309, K310, K311, K312, \
27 K400, K401, K402, K403, K404, K405, K406, K407, K408, K409, K410, K411, K412 \
28) { \
29 { K000, K001, K002, K003, K004, K005, K006, K007, K008, K009, K010, K011, K012 }, \
30 { K100, K101, K102, K103, K104, K105, K106, K107, K108, K109, K110, K111, K112 }, \
31 { K200, K201, K202, K203, K204, K205, K206, K207, K208, K209, K210, K211, K212 }, \
32 { K300, K301, K302, K303, K304, K305, K306, K307, K308, K309, K310, K311, K312 }, \
33 { K400, K401, K402, K403, K404, K405, K406, K407, K408, K409, K410, K411, K412 } \
34}
35
36enum unicode_names {
37 la = 0,
38 lA,
39 lb,
40 lB,
41 lc,
42 lC,
43 ld,
44 lD,
45 le,
46 lE,
47 lf,
48 lF,
49 lg,
50 lG,
51 lh,
52 lH,
53 li,
54 lI,
55 lj,
56 lJ,
57 lk,
58 lK,
59 ll,
60 lL,
61 lm,
62 lM,
63 ln,
64 lN,
65 lo,
66 lO,
67 lp,
68 lP,
69 lq,
70 lQ,
71 lr,
72 lR,
73 ls,
74 lS,
75 lt,
76 lT,
77 lu,
78 lU,
79 lv,
80 lV,
81 lw,
82 lW,
83 lx,
84 lX,
85 ly,
86 lY,
87 lz,
88 lZ,
89 lc1,
90 lC1,
91 lp1,
92 lP1,
93 lq1,
94 lQ1,
95 ll1,
96 lL1,
97 lk1,
98 lK1,
99 rc,
100 rC,
101};
102
103static inline void led_lwr(const bool on) {
104#ifdef LED_NUM_LOCK_PIN
105 writePin(LED_NUM_LOCK_PIN, on);
106#endif
107}
108
109static inline void led_rse(const bool on) {
110#ifdef LED_SCROLL_LOCK_PIN
111 writePin(LED_SCROLL_LOCK_PIN, on);
112#endif
113}
114static inline void led_caps(const bool on) {
115#ifdef LED_CAPS_LOCK_PIN
116 if ((DEVICE_VER == 0x0001) || (DEVICE_VER == 0x0003)) {
117 writePin(LED_CAPS_LOCK_PIN, !on);
118 }
119 if (DEVICE_VER == 0x0002) {
120 writePin(LED_CAPS_LOCK_PIN, on);
121 }
122#endif
123}
124
diff --git a/keyboards/mlego/m65/readme.md b/keyboards/mlego/m65/readme.md
new file mode 100644
index 000000000..2526aed31
--- /dev/null
+++ b/keyboards/mlego/m65/readme.md
@@ -0,0 +1,129 @@
1# M65
2
3![M65](https://i.imgur.com/gXuecush.jpg)
4
5A (13x5) ortholinear keyboard that can be hand wired or using a pcb.
6
7* Keyboard Maintainer: [Alin Elena](https://github.com/alinelena) ([@drFaustroll on GitLab](https://gitlab.com/drFaustroll))
8* Hardware Supported: custom pcb [see](https://gitlab.com/m-lego/m65) STM/APM32F103C8T6, aka Black Pill (rev1),
9 GD32F303CCT6 from we act aka Blue Pill Plus (rev2), STM32F401 from we act (rev3)
10* Hardware Availability: [custom how to](https://alin.elena.space/blog/keeblego/)
11
12
13Make example for this keyboard (after setting up your build environment):
14
15For rev1
16
17 make mlego/m65/rev1:default
18
19Flashing example for this keyboard:
20
21 make mlego/m65/rev1:default:flash
22
23To enter flashing mode, press Lower+Raise+R.
24
25For rev2
26
27 make mlego/m65/rev2:default
28
29Flashing example for this keyboard:
30
31 make mlego/m65/rev2:default:flash
32
33To enter flashing mode, on microcontroller keep pressed KEY and then NRST, release NRST and then after 1s release KEY.
34
35For rev3
36
37 make mlego/m65/rev3:default
38
39Flashing example for this keyboard:
40
41 make mlego/m65/rev3:default:flash
42
43To enter flashing mode, on microcontroller keep pressed BOOT0 and then NRST, release NRST and then after 0.5s or so release BOOT0.
44
45
46See 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).
47
48## Pins and leds rev1 STM/APM32F103C8T6
49
50similar pinout for STM32F303
51
52| Rows | C0 | C1 | C2 | C3 | C4 | C5 | C6 | C7 | C8 | C9 | C10 | C11 | C12 | Pins |
53| :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: |
54| R0 | Esc | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | - | Bksp | B11 |
55| R1 | Tab | q | w | e | r | t | y | u | i | o | p | [ | ] | B0 |
56| R2 | # | a | s | d | f | g | h | j | k | l | ; | ' | Enter | B1 |
57| R3 | Shift | \ | z | x | c | v | b | n | m | , | . | Up | / | A2 |
58| R4 | Ctrl | Menu | Lower | Alt | Raise | Space | Space | Space | AltGr | Shift | Left | Down | Right | A3 |
59| | A10 | A15 | B3 | B4 | B5 | B9 | B8 | B7 | B6 | C15 | A0 | A7 | B10 | |
60
61### Encoders
62
63 - Pad_A: A8
64 - Pad_B: A9
65
66### Leds
67
68| Leds | Pin |
69| ----------- | --- |
70| NUM_LOCK | B12 |
71| CAPS_LOCK | C13 |
72| SCROLL_LOCK | B13 |
73| RBG_DI | B15 |
74
75## Pins and leds rev2 GD32F303CCT6
76
77
78| Rows | C0 | C1 | C2 | C3 | C4 | C5 | C6 | C7 | C8 | C9 | C10 | C11 | C12 | Pins |
79| :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: |
80| R0 | Esc | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | - | Bksp | B11 |
81| R1 | Tab | q | w | e | r | t | y | u | i | o | p | [ | ] | B0 |
82| R2 | # | a | s | d | f | g | h | j | k | l | ; | ' | Enter | B1 |
83| R3 | Shift | \ | z | x | c | v | b | n | m | , | . | Up | / | A2 |
84| R4 | Ctrl | Menu | Lower | Alt | Raise | Space | Space | Space | AltGr | Shift | Left | Down | Right | A3 |
85| | A10 | A15 | B3 | B4 | B5 | B9 | B8 | B7 | B6 | C15 | A0 | A7 | B10 | |
86
87
88### Encoders
89
90 - Pad_A: A8
91 - Pad_B: A9
92
93### Leds
94
95| Leds | Pin |
96| ----------- | --- |
97| NUM_LOCK | B12 |
98| CAPS_LOCK | B2 |
99| SCROLL_LOCK | B13 |
100| RBG_DI | B15 |
101
102
103## Pins and leds rev3 stm32f401
104
105the pinout is the same for stm32f411
106
107| Rows | C0 | C1 | C2 | C3 | C4 | C5 | C6 | C7 | C8 | C9 | C10 | C11 | C12 | Pins |
108| :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: |
109| R0 | Esc | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | - | Bksp | B10 |
110| R1 | Tab | q | w | e | r | t | y | u | i | o | p | [ | ] | A5 |
111| R2 | # | a | s | d | f | g | h | j | k | l | ; | ' | Enter | A6 |
112| R3 | Shift | \ | z | x | c | v | b | n | m | , | . | Up | / | A7 |
113| R4 | Ctrl | Menu | Lower | Alt | Raise | Space | Space | Space | AltGr | Shift | Left | Down | Right | B0 |
114| | A10 | A15 | B3 | B4 | B5 | B9 | B8 | B7 | A1 | A2 | A3 | A4 | B1 | |
115
116### Encoders
117
118 - Pad_A: A0
119 - Pad_B: B6
120
121### LEDS
122
123| Leds | Pin |
124| ----------- | --- |
125| NUM_LOCK | B12 |
126| CAPS_LOCK | C13 |
127| SCROLL_LOCK | B13 |
128| RBG_DI | B15 |
129
diff --git a/keyboards/mlego/m65/rev1/chconf.h b/keyboards/mlego/m65/rev1/chconf.h
new file mode 100644
index 000000000..3ca88e0d2
--- /dev/null
+++ b/keyboards/mlego/m65/rev1/chconf.h
@@ -0,0 +1,28 @@
1/* Copyright 2021-2022 QMK
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17/*
18 * This file was auto-generated by:
19 * `qmk chibios-confmigrate -i keyboards/m65/rev1/chconf.h -r platforms/chibios/common/configs/chconf.h`
20 */
21
22#pragma once
23
24#define CH_CFG_ST_TIMEDELTA 0
25
26#define CH_CFG_USE_CONDVARS_TIMEOUT FALSE
27
28#include_next <chconf.h>
diff --git a/keyboards/mlego/m65/rev1/config.h b/keyboards/mlego/m65/rev1/config.h
new file mode 100644
index 000000000..e0a703c97
--- /dev/null
+++ b/keyboards/mlego/m65/rev1/config.h
@@ -0,0 +1,59 @@
1/*
2Copyright 2021-2022 Alin M Elena <alinm.elena@gmail.com>
3
4This program is free software: you can redistribute it and/or modify
5it under the terms of the GNU General Public License as published by
6the Free Software Foundation, either version 2 of the License, or
7(at your option) any later version.
8
9This program is distributed in the hope that it will be useful,
10but WITHOUT ANY WARRANTY; without even the implied warranty of
11MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12GNU General Public License for more details.
13
14You should have received a copy of the GNU General Public License
15along with this program. If not, see <http://www.gnu.org/licenses/>.
16*/
17
18#pragma once
19
20#define DEVICE_VER 0x0001
21#define PRODUCT_ID 0x6060
22
23#define LED_NUM_LOCK_PIN B12
24#define LED_SCROLL_LOCK_PIN B13
25#define LED_CAPS_LOCK_PIN C13
26
27// 0 1 2 3 4
28#define MATRIX_ROW_PINS \
29 { B11, B0, B1, A2, A3 }
30// 0 1 2 3 4 5 6 7 8 9 10 11 12
31#define MATRIX_COL_PINS \
32 { A10, A15, B3, B4, B5, B9, B8, B7, B6, C15, A0, A7, B10 }
33
34#define ENCODERS_PAD_A \
35 { A8 }
36#define ENCODERS_PAD_B \
37 { A9 }
38
39#define RGB_DI_PIN B15
40
41#define UNUSED_PINS
42#define RGBLIGHT_LAYERS
43
44#define ENCODER_RESOLUTION 4
45
46#undef RGBLED_NUM
47#define RGBLED_NUM 20
48#define RGBLIGHT_EFFECT_BREATHING
49#define RGBLIGHT_EFFECT_RAINBOW_MOOD
50#define RGBLIGHT_EFFECT_RAINBOW_SWIRL
51#define RGBLIGHT_EFFECT_SNAKE
52#define RGBLIGHT_EFFECT_KNIGHT
53#define RGBLIGHT_EFFECT_CHRISTMAS
54#define RGBLIGHT_EFFECT_STATIC_GRADIENT
55#define RGBLIGHT_EFFECT_RGB_TEST
56#define RGBLIGHT_EFFECT_ALTERNATING
57#define RGBLIGHT_EFFECT_TWINKLE
58#define RGBLIGHT_HUE_STEP 8
59#define RGBLIGHT_SAT_STEP 8
diff --git a/keyboards/mlego/m65/rev1/mcuconf.h b/keyboards/mlego/m65/rev1/mcuconf.h
new file mode 100644
index 000000000..6ba4f72b4
--- /dev/null
+++ b/keyboards/mlego/m65/rev1/mcuconf.h
@@ -0,0 +1,27 @@
1/* Copyright 2021-2022 QMK
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17/*
18 * This file was auto-generated by:
19 * `qmk chibios-confmigrate -i keyboards/m65/rev1/mcuconf.h -r platforms/chibios/STM32_F103_STM32DUINO/configs/mcuconf.h`
20 */
21
22#pragma once
23
24#include_next <mcuconf.h>
25
26#undef STM32_SPI_USE_SPI2
27#define STM32_SPI_USE_SPI2 FALSE
diff --git a/keyboards/mlego/m65/rev1/rules.mk b/keyboards/mlego/m65/rev1/rules.mk
new file mode 100644
index 000000000..5e456c260
--- /dev/null
+++ b/keyboards/mlego/m65/rev1/rules.mk
@@ -0,0 +1,19 @@
1# MCU name
2MCU = STM32F103
3
4# Bootloader selection
5BOOTLOADER = stm32duino
6
7# Build Options
8# change yes to no to disable
9#
10BOOTMAGIC_ENABLE = yes # Enable Bootmagic Lite
11MOUSEKEY_ENABLE = yes # Mouse keys
12EXTRAKEY_ENABLE = yes # Audio control and System control
13CONSOLE_ENABLE = no # Console for debug
14COMMAND_ENABLE = no # Commands for debug and configuration
15NKRO_ENABLE = yes # Enable N-Key Rollover
16BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality
17RGBLIGHT_ENABLE = yes # Enable keyboard RGB underglow
18AUDIO_ENABLE = no # Audio output
19ENCODER_ENABLE = yes # Enable encoder
diff --git a/keyboards/mlego/m65/rev2/board.h b/keyboards/mlego/m65/rev2/board.h
new file mode 100644
index 000000000..e0d086577
--- /dev/null
+++ b/keyboards/mlego/m65/rev2/board.h
@@ -0,0 +1,20 @@
1/* Copyright 2021-2022 Alin M Elena <alinm.elena@gmail.com>
2
3This program is free software: you can redistribute it and/or modify
4it under the terms of the GNU General Public License as published by
5the Free Software Foundation, either version 2 of the License, or
6(at your option) any later version.
7
8This program is distributed in the hope that it will be useful,
9but WITHOUT ANY WARRANTY; without even the implied warranty of
10MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11GNU General Public License for more details.
12
13You should have received a copy of the GNU General Public License
14along with this program. If not, see <http://www.gnu.org/licenses/>.
15*/
16
17#pragma once
18#include_next <board.h>
19#undef STM32F103xB
20#define STM32F103xE
diff --git a/keyboards/mlego/m65/rev2/chconf.h b/keyboards/mlego/m65/rev2/chconf.h
new file mode 100644
index 000000000..3ca88e0d2
--- /dev/null
+++ b/keyboards/mlego/m65/rev2/chconf.h
@@ -0,0 +1,28 @@
1/* Copyright 2021-2022 QMK
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17/*
18 * This file was auto-generated by:
19 * `qmk chibios-confmigrate -i keyboards/m65/rev1/chconf.h -r platforms/chibios/common/configs/chconf.h`
20 */
21
22#pragma once
23
24#define CH_CFG_ST_TIMEDELTA 0
25
26#define CH_CFG_USE_CONDVARS_TIMEOUT FALSE
27
28#include_next <chconf.h>
diff --git a/keyboards/mlego/m65/rev2/config.h b/keyboards/mlego/m65/rev2/config.h
new file mode 100644
index 000000000..a548b0182
--- /dev/null
+++ b/keyboards/mlego/m65/rev2/config.h
@@ -0,0 +1,70 @@
1/*
2Copyright 2021-2022 Alin M Elena <alinm.elena@gmail.com>
3
4This program is free software: you can redistribute it and/or modify
5it under the terms of the GNU General Public License as published by
6the Free Software Foundation, either version 2 of the License, or
7(at your option) any later version.
8
9This program is distributed in the hope that it will be useful,
10but WITHOUT ANY WARRANTY; without even the implied warranty of
11MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12GNU General Public License for more details.
13
14You should have received a copy of the GNU General Public License
15along with this program. If not, see <http://www.gnu.org/licenses/>.
16*/
17
18#pragma once
19
20#define DEVICE_VER 0x0002
21#define PRODUCT_ID 0x6060
22
23#define LED_NUM_LOCK_PIN B12
24#define LED_SCROLL_LOCK_PIN B13
25#define LED_CAPS_LOCK_PIN B2
26
27// 0 1 2 3 4
28#define MATRIX_ROW_PINS \
29 { B11, B0, B1, A2, A3 }
30// 0 1 2 3 4 5 6 7 8 9 10 11 12
31#define MATRIX_COL_PINS \
32 { A10, A15, B3, B4, B5, B9, B8, B7, B6, C15, A0, A7, B10 }
33
34#define ENCODERS_PAD_A \
35 { A8 }
36#define ENCODERS_PAD_B \
37 { A9 }
38
39#define RGB_DI_PIN B15
40
41#define UNUSED_PINS
42#define RGBLIGHT_LAYERS
43
44#define ENCODER_RESOLUTION 4
45
46#undef RGBLED_NUM
47#define RGBLED_NUM 20
48#define RGBLIGHT_EFFECT_BREATHING
49#define RGBLIGHT_EFFECT_RAINBOW_MOOD
50#define RGBLIGHT_EFFECT_RAINBOW_SWIRL
51#define RGBLIGHT_EFFECT_SNAKE
52#define RGBLIGHT_EFFECT_KNIGHT
53#define RGBLIGHT_EFFECT_CHRISTMAS
54#define RGBLIGHT_EFFECT_STATIC_GRADIENT
55#define RGBLIGHT_EFFECT_RGB_TEST
56#define RGBLIGHT_EFFECT_ALTERNATING
57#define RGBLIGHT_EFFECT_TWINKLE
58#define RGBLIGHT_HUE_STEP 8
59#define RGBLIGHT_SAT_STEP 8
60
61#define EEPROM_PAGE_SIZE
62#define FEE_PAGE_SIZE 0x800
63#define FEE_PAGE_COUNT 4
64
65#define FEE_MCU_FLASH_SIZE_IGNORE_CHECK
66#define FEE_MCU_FLASH_SIZE \
67 ({ \
68 uint16_t flash_size = *(uint16_t*)FLASHSIZE_BASE; \
69 (flash_size <= 512) ? flash_size : 512; \
70 })
diff --git a/keyboards/mlego/m65/rev2/mcuconf.h b/keyboards/mlego/m65/rev2/mcuconf.h
new file mode 100644
index 000000000..6ba4f72b4
--- /dev/null
+++ b/keyboards/mlego/m65/rev2/mcuconf.h
@@ -0,0 +1,27 @@
1/* Copyright 2021-2022 QMK
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17/*
18 * This file was auto-generated by:
19 * `qmk chibios-confmigrate -i keyboards/m65/rev1/mcuconf.h -r platforms/chibios/STM32_F103_STM32DUINO/configs/mcuconf.h`
20 */
21
22#pragma once
23
24#include_next <mcuconf.h>
25
26#undef STM32_SPI_USE_SPI2
27#define STM32_SPI_USE_SPI2 FALSE
diff --git a/keyboards/mlego/m65/rev2/rules.mk b/keyboards/mlego/m65/rev2/rules.mk
new file mode 100644
index 000000000..1b7c586b7
--- /dev/null
+++ b/keyboards/mlego/m65/rev2/rules.mk
@@ -0,0 +1,19 @@
1# MCU name
2MCU = STM32F103 #GD32F303CCT6 weact
3
4# Bootloader selection
5BOOTLOADER = stm32duino
6
7# Build Options
8# change yes to no to disable
9#
10BOOTMAGIC_ENABLE = yes # Enable Bootmagic Lite
11MOUSEKEY_ENABLE = yes # Mouse keys
12EXTRAKEY_ENABLE = yes # Audio control and System control
13CONSOLE_ENABLE = yes # Console for debug
14COMMAND_ENABLE = yes # Commands for debug and configuration
15NKRO_ENABLE = yes # Enable N-Key Rollover
16BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality
17RGBLIGHT_ENABLE = yes # Enable keyboard RGB underglow
18AUDIO_ENABLE = no # Audio output
19ENCODER_ENABLE = yes # Enable encoder
diff --git a/keyboards/mlego/m65/rev3/config.h b/keyboards/mlego/m65/rev3/config.h
new file mode 100644
index 000000000..97992ee84
--- /dev/null
+++ b/keyboards/mlego/m65/rev3/config.h
@@ -0,0 +1,59 @@
1/*
2Copyright 2021-2022 Alin M Elena <alinm.elena@gmail.com>
3
4This program is free software: you can redistribute it and/or modify
5it under the terms of the GNU General Public License as published by
6the Free Software Foundation, either version 2 of the License, or
7(at your option) any later version.
8
9This program is distributed in the hope that it will be useful,
10but WITHOUT ANY WARRANTY; without even the implied warranty of
11MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12GNU General Public License for more details.
13
14You should have received a copy of the GNU General Public License
15along with this program. If not, see <http://www.gnu.org/licenses/>.
16*/
17
18#pragma once
19
20#define DEVICE_VER 0x0003
21#define PRODUCT_ID 0x6060
22
23#define LED_NUM_LOCK_PIN B12
24#define LED_SCROLL_LOCK_PIN B13
25#define LED_CAPS_LOCK_PIN C13
26
27// 0 1 2 3 4
28#define MATRIX_ROW_PINS \
29 { B10, A5, A6, A7, B0 }
30// 0 1 2 3 4 5 6 7 8 9 10 11 12
31#define MATRIX_COL_PINS \
32 { A10, A15, B3, B4, B5, B9, B8, B7, A1, A2, A3, A4, B1 }
33
34#define ENCODERS_PAD_A \
35 { A0 }
36#define ENCODERS_PAD_B \
37 { B6 }
38
39#define RGB_DI_PIN B15
40
41#define UNUSED_PINS
42#define RGBLIGHT_LAYERS
43
44#define ENCODER_RESOLUTION 4
45
46#undef RGBLED_NUM
47#define RGBLED_NUM 20
48#define RGBLIGHT_EFFECT_BREATHING
49#define RGBLIGHT_EFFECT_RAINBOW_MOOD
50#define RGBLIGHT_EFFECT_RAINBOW_SWIRL
51#define RGBLIGHT_EFFECT_SNAKE
52#define RGBLIGHT_EFFECT_KNIGHT
53#define RGBLIGHT_EFFECT_CHRISTMAS
54#define RGBLIGHT_EFFECT_STATIC_GRADIENT
55#define RGBLIGHT_EFFECT_RGB_TEST
56#define RGBLIGHT_EFFECT_ALTERNATING
57#define RGBLIGHT_EFFECT_TWINKLE
58#define RGBLIGHT_HUE_STEP 8
59#define RGBLIGHT_SAT_STEP 8
diff --git a/keyboards/mlego/m65/rev3/halconf.h b/keyboards/mlego/m65/rev3/halconf.h
new file mode 100644
index 000000000..89815e23b
--- /dev/null
+++ b/keyboards/mlego/m65/rev3/halconf.h
@@ -0,0 +1,30 @@
1/* Copyright 2020 QMK
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17/*
18 * This file was auto-generated by:
19 * `qmk chibios-confmigrate -i keyboards/zvecr/zv48/f401/halconf.h -r platforms/chibios/common/configs/halconf.h`
20 */
21
22#pragma once
23
24#define HAL_USE_PWM TRUE
25
26#define HAL_USE_SERIAL TRUE
27
28#define SERIAL_USB_BUFFERS_SIZE 256
29
30#include_next <halconf.h>
diff --git a/keyboards/mlego/m65/rev3/mcuconf.h b/keyboards/mlego/m65/rev3/mcuconf.h
new file mode 100644
index 000000000..4d90ec07e
--- /dev/null
+++ b/keyboards/mlego/m65/rev3/mcuconf.h
@@ -0,0 +1,30 @@
1/* Copyright 2020 QMK
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17/*
18 * This file was auto-generated by:
19 * `qmk chibios-confmigrate -i keyboards/zvecr/zv48/f401/mcuconf.h -r platforms/chibios/BLACKPILL_STM32_F401/configs/mcuconf.h`
20 */
21
22#pragma once
23
24#include_next <mcuconf.h>
25
26#undef STM32_PWM_USE_TIM3
27#define STM32_PWM_USE_TIM3 TRUE
28
29#undef STM32_SERIAL_USE_USART1
30#define STM32_SERIAL_USE_USART1 TRUE
diff --git a/keyboards/mlego/m65/rev3/rules.mk b/keyboards/mlego/m65/rev3/rules.mk
new file mode 100644
index 000000000..25df19c15
--- /dev/null
+++ b/keyboards/mlego/m65/rev3/rules.mk
@@ -0,0 +1,19 @@
1# MCU name
2MCU = STM32F401
3
4# Bootloader selection
5BOOTLOADER = stm32-dfu
6
7# Build Options
8# change yes to no to disable
9#
10BOOTMAGIC_ENABLE = yes # Enable Bootmagic Lite
11MOUSEKEY_ENABLE = yes # Mouse keys
12EXTRAKEY_ENABLE = yes # Audio control and System control
13CONSOLE_ENABLE = no # Console for debug
14COMMAND_ENABLE = no # Commands for debug and configuration
15NKRO_ENABLE = yes # Enable N-Key Rollover
16BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality
17RGBLIGHT_ENABLE = yes # Enable keyboard RGB underglow
18AUDIO_ENABLE = no # Audio output
19ENCODER_ENABLE = yes # Enable encoder