Skip to content

Commit 936503e

Browse files
Alin Marin Elenadrashnafauxpark
authored andcommitted
[Keyboard] mlego fix product id and sync oled code (qmk#16237)
* sync oled code over the keymaps * put different product ids * put different product ids for the rest * put different product ids for the rest * try to reduce code duplication * make ifdefs nice and correct * move the leds code out of keymap * try to reduce code duplication * move the rgb code outside the keymaps for reuse * Update keyboards/mlego/m65/m65.c Co-authored-by: Drashna Jaelre <[email protected]> * Update keyboards/mlego/m65/m65.c Co-authored-by: Drashna Jaelre <[email protected]> * move more code outside keymaps for reuse * add few more xps * add mic mute * update to new name of macros for reset * style for matrix * clean split * use tinyuf2 as bootloader * Update keyboards/mlego/m65/rev4/rules.mk Co-authored-by: Ryan <[email protected]> * radionalise product id and device version * add tinyuf2 as default bootloader for stm32f4 * update tinyuf2 * update tinyuf2 and via. f411 remove tinyuf2 since is not really working. make the config more conditional * sync the keymap with default * revert via non building with gcc 11 Co-authored-by: Drashna Jaelre <[email protected]> Co-authored-by: Ryan <[email protected]>
1 parent 5506276 commit 936503e

File tree

33 files changed

+909
-524
lines changed

33 files changed

+909
-524
lines changed

keyboards/mlego/m48/config.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@
2727

2828
#define DEBOUNCE 5
2929

30+
/* COL2ROW, ROW2COL*/
31+
#define DIODE_DIRECTION COL2ROW
32+
3033
/* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */
3134
#define LOCKING_SUPPORT_ENABLE
3235
/* Locking resynchronize hack */

keyboards/mlego/m48/keymaps/via/keymap.c

Lines changed: 59 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -39,32 +39,77 @@ const rgblight_segment_t* const PROGMEM my_rgb_layers[] = RGBLIGHT_LAYERS_LIST(m
3939

4040
// clang-format off
4141
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
42+
/* Qwerty
43+
* ,-----------------------------------------------------------------------------------.
44+
* | Tab | Q | W | E | R | T | Y | U | I | O | P | Bksp |
45+
* |------+------+------+------+------+------+------+------+------+------+------+------|
46+
* | Esc | A | S | D | F | G | H | J | K | L | ; | " |
47+
* |------+------+------+------+------+------+------+------+------+------+------+------|
48+
* | Shift| Z | X | C | V | B | N | M | , | . | / |Enter |
49+
* |------+------+------+------+------+------+------+------+------+------+------+------|
50+
* | | Ctrl | Alt | GUI |Lower | Space |Raise | Left | Down | Up |Right |
51+
* `-----------------------------------------------------------------------------------'
52+
*/
4253
[_QW] = LAYOUT_ortho_4x12(
43-
KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC,
44-
KC_ESC, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_DEL,
45-
KC_TAB, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT,
46-
KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT
54+
KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC,
55+
KC_ESC, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT,
56+
KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT ,
57+
KC_TRNS,KC_LCTL, KC_LALT, KC_LGUI, LOWER, KC_SPC, KC_SPC, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT
4758
),
4859

60+
/* Lower
61+
* ,-----------------------------------------------------------------------------------.
62+
* | ~ | ! | @ | # | $ | % | ^ | & | * | ( | ) | Bksp |
63+
* |------+------+------+------+------+------+------+------+------+------+------+------|
64+
* | Del | F1 | F2 | F3 | F4 | F5 | F6 | _ | + | { | } | | |
65+
* |------+------+------+------+------+------+------+------+------+------+------+------|
66+
* | | F7 | F8 | F9 | F10 | F11 | F12 |ISO ~ |ISO | | Home | End | |
67+
* |------+------+------+------+------+------+------+------+------+------+------+------|
68+
* | | | | | | | | Next | Vol- | Vol+ | Play |
69+
* `-----------------------------------------------------------------------------------'
70+
*/
4971
[_LWR] = LAYOUT_ortho_4x12(
50-
KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_DEL,
51-
KC_DEL, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_PIPE,
52-
_______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12,S(KC_NUHS),S(KC_NUBS),_______, _______, _______,
53-
_______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY
72+
KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_BSPC,
73+
KC_DEL, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_PIPE,
74+
_______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, S(KC_NUHS), S(KC_NUBS), KC_HOME, KC_END, _______,
75+
_______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY
5476
),
5577

78+
/* Raise
79+
* ,-----------------------------------------------------------------------------------.
80+
* | ` | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | Bksp |
81+
* |------+------+------+------+------+------+------+------+------+------+------+------|
82+
* | Del | F1 | F2 | F3 | F4 | F5 | F6 | - | = | [ | ] | \ |
83+
* |------+------+------+------+------+------+------+------+------+------+------+------|
84+
* | | F7 | F8 | F9 | F10 | F11 | F12 |ISO # |ISO / |Pg Up |Pg Dn | |
85+
* |------+------+------+------+------+------+------+------+------+------+------+------|
86+
* | | | | | | | | Next | Vol- | Vol+ | Play |
87+
* `-----------------------------------------------------------------------------------'
88+
*/
5689
[_RSE] = LAYOUT_ortho_4x12(
57-
KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_DEL,
90+
KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC,
5891
KC_DEL, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS,
59-
_______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_NUHS, KC_NUBS, _______, _______, _______,
92+
_______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_NUHS, KC_NUBS, KC_PGUP, KC_PGDN, _______,
6093
_______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY
6194
),
6295

96+
/* Adjust (Lower + Raise)
97+
* v------------------------RGB CONTROL--------------------v
98+
* ,-----------------------------------------------------------------------------------.
99+
* | | Reset|Debug | RGB |RGBMOD| HUE+ | HUE- | SAT+ | SAT- |BRGTH+|BRGTH-| Del |
100+
* |------+------+------+------+------+------+------+------+------+------+------+------|
101+
* | | |MUSmod|Aud on|Audoff|AGnorm|AGswap| | | | | |
102+
* |------+------+------+------+------+------+------+------+------+------+------+------|
103+
* | |Voice-|Voice+|Mus on|Musoff|MIDIon|MIDIof|TermOn|TermOf| | | |
104+
* |------+------+------+------+------+------+------+------+------+------+------+------|
105+
* | | | | | | | | | | | |
106+
* `-----------------------------------------------------------------------------------'
107+
*/
63108
[_ADJ] = LAYOUT_ortho_4x12(
64-
_______, QK_BOOT, _______, _______, _______, _______, RGB_TOG, RGB_MOD, RGB_RMOD,RGB_M_G, QK_BOOT, _______,
65-
_______, _______, _______, _______, _______, _______, RGB_HUI, RGB_SAI, RGB_VAI, _______, _______, _______,
66-
_______, _______, _______, _______, _______, _______, RGB_HUD, RGB_SAD, RGB_VAD, _______, _______, _______,
67-
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
109+
_______, QK_BOOT, DEBUG, RGB_TOG, RGB_MOD, RGB_HUI, RGB_HUD, RGB_SAI, RGB_SAD, RGB_VAI, RGB_VAD, KC_DEL ,
110+
_______, _______, MU_MOD, AU_ON, AU_OFF, AG_NORM, AG_SWAP, _______, _______, _______, _______, _______,
111+
_______, MUV_DE, MUV_IN, MU_ON, MU_OFF, MI_ON, MI_OFF, TERM_ON, TERM_OFF, _______, _______, _______,
112+
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
68113
)
69114

70115
};

keyboards/mlego/m48/m48.c

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,3 @@
1515
*/
1616
#include "m48.h"
1717

18-
/*
19-
void keyboard_pre_init_kb(void){
20-
21-
// Workaround for reversible pcb/mcu
22-
palSetLineMode(C13, PAL_MODE_INPUT_PULLUP);
23-
palSetLineMode(C15, PAL_MODE_INPUT_PULLUP);
24-
palSetLineMode(B7, PAL_MODE_OUTPUT_OPENDRAIN);
25-
palSetLineMode(A0, PAL_MODE_OUTPUT_OPENDRAIN);
26-
palSetLineMode(A1, PAL_MODE_OUTPUT_OPENDRAIN);
27-
28-
keyboard_pre_init_user();
29-
}
30-
*/

keyboards/mlego/m48/rev1/config.h

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,32 +18,29 @@
1818
#include "config_common.h"
1919

2020
/* USB Device descriptor parameter */
21-
#define PRODUCT_ID 0x0001
21+
#define PRODUCT_ID 0x6261
2222
#define DEVICE_VER 0x0001
2323

2424
#define MATRIX_ROW_PINS \
2525
{ A6, A7, B0, B10 }
2626
#define MATRIX_COL_PINS \
2727
{ A10, A15, B3, B4, B5, B7, B6, A1, A2, A3, A4, A5 }
2828

29+
#ifdef ENCODER_ENABLE
2930
#define ENCODERS_PAD_A \
3031
{ A0 }
3132
#define ENCODERS_PAD_B \
3233
{ B8 }
34+
#define ENCODER_RESOLUTION 4
35+
#endif
3336

3437
#define LED_NUM_LOCK_PIN B12
3538
#define LED_SCROLL_LOCK_PIN B13
3639
#define LED_CAPS_LOCK_PIN C13
3740

38-
#define RGB_DI_PIN B15
39-
40-
#define UNUSED_PINS
41+
#ifdef RGBLIGHT_ENABLE
4142
#define RGBLIGHT_LAYERS
42-
43-
/* COL2ROW, ROW2COL*/
44-
#define DIODE_DIRECTION COL2ROW
45-
46-
#define MATRIX_IO_DELAY 5
43+
#define RGB_DI_PIN B15
4744

4845
#define RGBLED_NUM 20
4946
#define RGBLIGHT_EFFECT_BREATHING
@@ -56,3 +53,9 @@
5653
#define RGBLIGHT_EFFECT_RGB_TEST
5754
#define RGBLIGHT_EFFECT_ALTERNATING
5855
#define RGBLIGHT_EFFECT_TWINKLE
56+
57+
#endif
58+
59+
#define UNUSED_PINS
60+
// you want to comment this if using stm32-dfu as bootloader
61+
#define FEE_PAGE_BASE_ADDRESS 0x08008000
Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
/*
2+
ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
17+
/*
18+
* STM32F401xE memory setup.
19+
*/
20+
MEMORY
21+
{
22+
flash0 (rx) : org = 0x08000000, len = 16k /* tinyuf2 bootloader requires app to be located at 64k offset for this MCU */
23+
flash1 (rx) : org = 0x08004000, len = 16k
24+
flash2 (rx) : org = 0x08008000, len = 16k /* emulated eeprom */
25+
flash3 (rx) : org = 0x0800C000, len = 16k
26+
flash4 (rx) : org = 0x08010000, len = 512k - 64k
27+
flash5 (rx) : org = 0x00000000, len = 0
28+
flash6 (rx) : org = 0x00000000, len = 0
29+
flash7 (rx) : org = 0x00000000, len = 0
30+
ram0 (wx) : org = 0x20000000, len = 96k
31+
ram1 (wx) : org = 0x00000000, len = 0
32+
ram2 (wx) : org = 0x00000000, len = 0
33+
ram3 (wx) : org = 0x00000000, len = 0
34+
ram4 (wx) : org = 0x00000000, len = 0
35+
ram5 (wx) : org = 0x00000000, len = 0
36+
ram6 (wx) : org = 0x00000000, len = 0
37+
ram7 (wx) : org = 0x00000000, len = 0
38+
}
39+
40+
/* For each data/text section two region are defined, a virtual region
41+
and a load region (_LMA suffix).*/
42+
43+
/* Flash region to be used for exception vectors.*/
44+
REGION_ALIAS("VECTORS_FLASH", flash4);
45+
REGION_ALIAS("VECTORS_FLASH_LMA", flash4);
46+
47+
/* Flash region to be used for constructors and destructors.*/
48+
REGION_ALIAS("XTORS_FLASH", flash4);
49+
REGION_ALIAS("XTORS_FLASH_LMA", flash4);
50+
51+
/* Flash region to be used for code text.*/
52+
REGION_ALIAS("TEXT_FLASH", flash4);
53+
REGION_ALIAS("TEXT_FLASH_LMA", flash4);
54+
55+
/* Flash region to be used for read only data.*/
56+
REGION_ALIAS("RODATA_FLASH", flash4);
57+
REGION_ALIAS("RODATA_FLASH_LMA", flash4);
58+
59+
/* Flash region to be used for various.*/
60+
REGION_ALIAS("VARIOUS_FLASH", flash4);
61+
REGION_ALIAS("VARIOUS_FLASH_LMA", flash4);
62+
63+
/* Flash region to be used for RAM(n) initialization data.*/
64+
REGION_ALIAS("RAM_INIT_FLASH_LMA", flash4);
65+
66+
/* RAM region to be used for Main stack. This stack accommodates the processing
67+
of all exceptions and interrupts.*/
68+
REGION_ALIAS("MAIN_STACK_RAM", ram0);
69+
70+
/* RAM region to be used for the process stack. This is the stack used by
71+
the main() function.*/
72+
REGION_ALIAS("PROCESS_STACK_RAM", ram0);
73+
74+
/* RAM region to be used for data segment.*/
75+
REGION_ALIAS("DATA_RAM", ram0);
76+
REGION_ALIAS("DATA_RAM_LMA", flash4);
77+
78+
/* RAM region to be used for BSS segment.*/
79+
REGION_ALIAS("BSS_RAM", ram0);
80+
81+
/* RAM region to be used for the default heap.*/
82+
REGION_ALIAS("HEAP_RAM", ram0);
83+
84+
/* Generic rules inclusion.*/
85+
INCLUDE rules.ld
86+
87+
/* TinyUF2 bootloader reset support */
88+
_board_dfu_dbl_tap = ORIGIN(ram0) + 64k - 4; /* this is based off the linker file for tinyuf2 */

keyboards/mlego/m48/rev1/rules.mk

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,10 @@
22
MCU = STM32F401
33

44
# Bootloader selection
5-
BOOTLOADER = stm32-dfu
5+
BOOTLOADER = tinyuf2
6+
MCU_LDSCRIPT = STM32F401xE
7+
EEPROM_DRIVER = vendor
8+
#BOOTLOADER = stm32-dfu
69

710
# Build Options
811
# change yes to no to disable

keyboards/mlego/m60/config.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@
2525
#define MATRIX_ROWS 5
2626
#define MATRIX_COLS 12
2727

28+
/* COL2ROW, ROW2COL*/
29+
#define DIODE_DIRECTION COL2ROW
30+
2831
#define DEBOUNCE 5
2932

3033
/* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */

keyboards/mlego/m60/keymaps/default/keymap.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
6464
),
6565

6666
[_ADJ] = LAYOUT_ortho_5x12(
67-
_______, QK_BOOT, _______, _______, _______, _______, RGB_TOG, RGB_MOD, RGB_RMOD,RGB_M_G, QK_BOOT, _______,
67+
_______, QK_BOOT, _______, _______, _______, _______, RGB_TOG, RGB_MOD, RGB_RMOD,RGB_M_G, QK_BOOT, _______,
6868
_______, _______, _______, _______, _______, _______, RGB_HUI, RGB_SAI, RGB_VAI, _______, _______, _______,
6969
_______, _______, _______, _______, _______, _______, RGB_HUD, RGB_SAD, RGB_VAD, _______, _______, _______,
7070
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,

keyboards/mlego/m60/m60.c

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,3 @@
1515
*/
1616
#include "m60.h"
1717

18-
/*
19-
void keyboard_pre_init_kb(void){
20-
21-
// Workaround for reversible pcb/mcu
22-
palSetLineMode(C13, PAL_MODE_INPUT_PULLUP);
23-
palSetLineMode(C15, PAL_MODE_INPUT_PULLUP);
24-
palSetLineMode(B7, PAL_MODE_OUTPUT_OPENDRAIN);
25-
palSetLineMode(A0, PAL_MODE_OUTPUT_OPENDRAIN);
26-
palSetLineMode(A1, PAL_MODE_OUTPUT_OPENDRAIN);
27-
28-
keyboard_pre_init_user();
29-
}
30-
*/

keyboards/mlego/m60/m60.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,7 @@ static inline void led_rse(const bool on) {
4646
}
4747
static inline void led_caps(const bool on) {
4848
#ifdef LED_CAPS_LOCK_PIN
49-
if ((DEVICE_VER == 0x0001) || (DEVICE_VER == 0x0003)) {
5049
writePin(LED_CAPS_LOCK_PIN, !on);
51-
}
52-
if (DEVICE_VER == 0x0002) {
53-
writePin(LED_CAPS_LOCK_PIN, on);
54-
}
5550
#endif
5651
}
5752

0 commit comments

Comments
 (0)