Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

mlego fix product id and sync oled code #16237

Merged
merged 33 commits into from
Jun 11, 2022
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
c8c0b2d
sync oled code over the keymaps
Feb 5, 2022
768e416
put different product ids
Feb 5, 2022
e0e9697
put different product ids for the rest
Feb 5, 2022
2d104ae
put different product ids for the rest
Feb 5, 2022
b822058
try to reduce code duplication
Feb 6, 2022
def6503
make ifdefs nice and correct
Feb 6, 2022
364387c
move the leds code out of keymap
Feb 6, 2022
a808813
try to reduce code duplication
Feb 6, 2022
fa31b9d
move the rgb code outside the keymaps for reuse
Feb 6, 2022
ae8a6a1
Update keyboards/mlego/m65/m65.c
Feb 6, 2022
f9667a0
Update keyboards/mlego/m65/m65.c
Feb 6, 2022
8c1b224
move more code outside keymaps for reuse
Feb 6, 2022
dc66976
add few more xps
Feb 13, 2022
9ae348b
Merge branch 'qmk:master' into mlego_fix_product_id
Feb 13, 2022
e9aac2e
Merge branch 'qmk:master' into mlego_fix_product_id
May 21, 2022
a647d84
add mic mute
May 22, 2022
6c9705d
update to new name of macros for reset
alinelena May 23, 2022
2ebebb5
style for matrix
alinelena May 23, 2022
2930c7c
Merge branch 'qmk:master' into mlego_fix_product_id
May 28, 2022
3eef077
Merge remote-tracking branch 'origin/master' into mlego_fix_product_id
May 29, 2022
df30292
Merge branch 'qmk:master' into mlego_fix_product_id
May 29, 2022
78966d9
clean split
May 31, 2022
f49b268
use tinyuf2 as bootloader
alinelena Jun 1, 2022
5a3ed7c
Update keyboards/mlego/m65/rev4/rules.mk
Jun 2, 2022
57b36b5
radionalise product id and device version
Jun 2, 2022
02e81b1
add tinyuf2 as default bootloader for stm32f4
alinelena Jun 3, 2022
0d4d0eb
Merge branch 'qmk:master' into mlego_fix_product_id
Jun 4, 2022
d63aa7c
Merge branch 'qmk:master' into mlego_fix_product_id
Jun 8, 2022
b376776
update tinyuf2
alinelena Jun 8, 2022
aceb072
Merge branch 'qmk:master' into mlego_fix_product_id
Jun 9, 2022
8b14798
update tinyuf2 and via. f411 remove tinyuf2 since is not really worki…
alinelena Jun 9, 2022
8e018a7
sync the keymap with default
alinelena Jun 10, 2022
06c50ec
revert via non building with gcc 11
alinelena Jun 10, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion keyboards/mlego/m48/rev1/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

/* USB Device descriptor parameter */
#define PRODUCT_ID 0x0001
#define DEVICE_VER 0x0001
#define DEVICE_VER 0x6261
alinelena marked this conversation as resolved.
Show resolved Hide resolved

#define MATRIX_ROW_PINS \
{ A6, A7, B0, B10 }
Expand Down
2 changes: 1 addition & 1 deletion keyboards/mlego/m60/rev1/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

/* USB Device descriptor parameter */
#define PRODUCT_ID 0x0001
#define DEVICE_VER 0x0001
#define DEVICE_VER 0x6161
alinelena marked this conversation as resolved.
Show resolved Hide resolved

#define MATRIX_ROW_PINS \
{ A6, A7, B0, B1, B10 }
Expand Down
79 changes: 79 additions & 0 deletions keyboards/mlego/m65/keymaps/default/keymap.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,17 @@ enum layer_names {
_ADJ
};

#ifdef OLED_ENABLE
alinelena marked this conversation as resolved.
Show resolved Hide resolved
static uint32_t oled_logo_timer = 0;
static bool clear_logo = true;
static const char PROGMEM m65_logo[] = {
0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99, 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5,
0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, 0x90, 0x91, 0x92, 0x93, 0x94,
0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, 0xb0, 0xb1, 0xb2, 0xb3, 0xb4,
0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, 0xd0, 0xd1, 0xd2, 0xd3, 0xd4,
0};
#endif

#ifdef RGBLIGHT_ENABLE

const rgblight_segment_t PROGMEM my_qwerty_layer[] = RGBLIGHT_LAYER_SEGMENTS({0, RGBLED_NUM, HSV_PURPLE});
Expand Down Expand Up @@ -167,3 +178,71 @@ bool encoder_update_user(uint8_t index, bool clockwise) {
return true;
}
#endif

#ifdef OLED_ENABLE

static void render_logo(void) {
oled_write_P(m65_logo, false);
}

void user_oled_magic(void) {
// Host Keyboard Layer Status
oled_write_P(PSTR("Layer: "), false);

switch (get_highest_layer(layer_state)) {
case _QW:
oled_write_P(PSTR("Default\n"), false);
break;
case _LWR:
oled_write_P(PSTR("Lower\n"), false);
break;
case _RSE:
oled_write_P(PSTR("Raise\n"), false);
break;
case _ADJ:
oled_write_P(PSTR("ADJ\n"), false);
break;
default:
// Or use the write_ln shortcut over adding '\n' to the end of your string
oled_write_ln_P(PSTR("Undefined"), false);
}

// Host Keyboard LED Status
led_t led_state = host_keyboard_led_state();
oled_write_P(led_state.num_lock ? PSTR("Lower ") : PSTR(" "), false);
oled_write_P(led_state.scroll_lock ? PSTR("Raise ") : PSTR(" "), false);
oled_write_P(led_state.caps_lock ? PSTR("CapsLock ") : PSTR(" "), false);
#ifdef WPM_ENABLE
oled_write_P(PSTR("\nwpm: "), false);
uint8_t wpm = get_current_wpm();
oled_write_P(wpm != 0 ? get_u8_str(wpm,' ') : PSTR(" "), false);
#endif
}

oled_rotation_t oled_init_user(oled_rotation_t rotation) {
return OLED_ROTATION_180;
}

void clear_screen(void) {
if (clear_logo){
for (uint8_t i = 0; i < OLED_DISPLAY_HEIGHT; ++i) {
for (uint8_t j = 0; j < OLED_DISPLAY_WIDTH; ++j) {
oled_write_raw_byte(0x0, i*OLED_DISPLAY_WIDTH + j);
}
}
clear_logo = false;
}
}

# define SHOW_LOGO 5000
bool oled_task_user(void) {
if ((timer_elapsed32(oled_logo_timer) < SHOW_LOGO)){
render_logo();
}else{
clear_screen();
user_oled_magic();
}
return false;
}

#endif
79 changes: 79 additions & 0 deletions keyboards/mlego/m65/keymaps/dk/keymap.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,17 @@ enum layer_names {
_ADJ
};

#ifdef OLED_ENABLE
static uint32_t oled_logo_timer = 0;
static bool clear_logo = true;
static const char PROGMEM m65_logo[] = {
0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99, 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5,
0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, 0x90, 0x91, 0x92, 0x93, 0x94,
0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, 0xb0, 0xb1, 0xb2, 0xb3, 0xb4,
0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, 0xd0, 0xd1, 0xd2, 0xd3, 0xd4,
0};
#endif

#ifdef RGBLIGHT_ENABLE

const rgblight_segment_t PROGMEM my_qwerty_layer[] = RGBLIGHT_LAYER_SEGMENTS({0, RGBLED_NUM, HSV_PURPLE});
Expand Down Expand Up @@ -168,3 +179,71 @@ bool encoder_update_user(uint8_t index, bool clockwise) {
return true;
}
#endif

#ifdef OLED_ENABLE

static void render_logo(void) {
oled_write_P(m65_logo, false);
}

void user_oled_magic(void) {
// Host Keyboard Layer Status
oled_write_P(PSTR("Layer: "), false);

switch (get_highest_layer(layer_state)) {
case _QW:
oled_write_P(PSTR("Default\n"), false);
break;
case _LWR:
oled_write_P(PSTR("Lower\n"), false);
break;
case _RSE:
oled_write_P(PSTR("Raise\n"), false);
break;
case _ADJ:
oled_write_P(PSTR("ADJ\n"), false);
break;
default:
// Or use the write_ln shortcut over adding '\n' to the end of your string
oled_write_ln_P(PSTR("Undefined"), false);
}

// Host Keyboard LED Status
led_t led_state = host_keyboard_led_state();
oled_write_P(led_state.num_lock ? PSTR("Lower ") : PSTR(" "), false);
oled_write_P(led_state.scroll_lock ? PSTR("Raise ") : PSTR(" "), false);
oled_write_P(led_state.caps_lock ? PSTR("CapsLock ") : PSTR(" "), false);
#ifdef WPM_ENABLE
oled_write_P(PSTR("\nwpm: "), false);
uint8_t wpm = get_current_wpm();
oled_write_P(wpm != 0 ? get_u8_str(wpm,' ') : PSTR(" "), false);
#endif
}

oled_rotation_t oled_init_user(oled_rotation_t rotation) {
return OLED_ROTATION_180;
}

void clear_screen(void) {
if (clear_logo){
for (uint8_t i = 0; i < OLED_DISPLAY_HEIGHT; ++i) {
for (uint8_t j = 0; j < OLED_DISPLAY_WIDTH; ++j) {
oled_write_raw_byte(0x0, i*OLED_DISPLAY_WIDTH + j);
}
}
clear_logo = false;
}
}

# define SHOW_LOGO 5000
bool oled_task_user(void) {
if ((timer_elapsed32(oled_logo_timer) < SHOW_LOGO)){
render_logo();
}else{
clear_screen();
user_oled_magic();
}
return false;
}

#endif
106 changes: 64 additions & 42 deletions keyboards/mlego/m65/keymaps/via/keymap.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,17 @@ enum layer_names {
_ADJ
};

#ifdef OLED_ENABLE
static uint32_t oled_logo_timer = 0;
static bool clear_logo = true;
static const char PROGMEM m65_logo[] = {
0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99, 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5,
0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, 0x90, 0x91, 0x92, 0x93, 0x94,
0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, 0xb0, 0xb1, 0xb2, 0xb3, 0xb4,
0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, 0xd0, 0xd1, 0xd2, 0xd3, 0xd4,
0};
#endif

#ifdef RGBLIGHT_ENABLE

const rgblight_segment_t PROGMEM my_qwerty_layer[] = RGBLIGHT_LAYER_SEGMENTS({0, RGBLED_NUM, HSV_PURPLE});
Expand Down Expand Up @@ -170,55 +181,66 @@ bool encoder_update_user(uint8_t index, bool clockwise) {
#ifdef OLED_ENABLE

static void render_logo(void) {
static const char PROGMEM m65_logo[] = {
// 'slon', 128x32px
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x40, 0xc0, 0xa0, 0xa0,
0xa0, 0xd0, 0xf0, 0xe0, 0xe0, 0xe0, 0xe0, 0xc0, 0xc0, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x0c, 0xc3, 0x3c, 0x0f, 0x05, 0x14, 0x14,
0x04, 0xfc, 0x9f, 0x88, 0x80, 0x81, 0xe7, 0xfc, 0x03, 0x03, 0x07, 0x05, 0x06, 0x06, 0x08, 0x0c,
0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x04, 0x10, 0x18, 0x30, 0x40, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x80, 0x80, 0xe0, 0xde, 0xc1, 0xf0, 0x89, 0x0b, 0x18, 0x08, 0x04, 0x04,
0x01, 0x1a, 0x0f, 0x00, 0x00, 0x80, 0xc0, 0x20, 0x20, 0x20, 0x60, 0x40, 0x40, 0x42, 0x40, 0x40,
0x40, 0x40, 0x40, 0xe0, 0x60, 0x00, 0x00, 0x00, 0x00, 0x08, 0x13, 0x7c, 0xe0, 0xc0, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x06, 0x06, 0x06, 0x07, 0x07, 0x07, 0x05,
0x05, 0x05, 0x07, 0x05, 0x07, 0x07, 0x07, 0x07, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x01,
0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02,
0x02, 0x02, 0x02, 0x03, 0x03, 0x03, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x03, 0x03, 0x07,
0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06,
0x04, 0x05, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00
};

oled_write_raw_P(m65_logo, sizeof(m65_logo));

oled_write_P(m65_logo, false);
}

void user_oled_magic(void) {
// Host Keyboard Layer Status
oled_write_P(PSTR("Layer: "), false);

switch (get_highest_layer(layer_state)) {
case _QW:
oled_write_P(PSTR("Default\n"), false);
break;
case _LWR:
oled_write_P(PSTR("Lower\n"), false);
break;
case _RSE:
oled_write_P(PSTR("Raise\n"), false);
break;
case _ADJ:
oled_write_P(PSTR("ADJ\n"), false);
break;
default:
// Or use the write_ln shortcut over adding '\n' to the end of your string
oled_write_ln_P(PSTR("Undefined"), false);
}

// Host Keyboard LED Status
led_t led_state = host_keyboard_led_state();
oled_write_P(led_state.num_lock ? PSTR("Lower ") : PSTR(" "), false);
oled_write_P(led_state.scroll_lock ? PSTR("Raise ") : PSTR(" "), false);
oled_write_P(led_state.caps_lock ? PSTR("CapsLock ") : PSTR(" "), false);
#ifdef WPM_ENABLE
oled_write_P(PSTR("\nwpm: "), false);
uint8_t wpm = get_current_wpm();
oled_write_P(wpm != 0 ? get_u8_str(wpm,' ') : PSTR(" "), false);
#endif
}

oled_rotation_t oled_init_user(oled_rotation_t rotation) {
return rotation;
return OLED_ROTATION_180;
}

void clear_screen(void) {
if (clear_logo){
for (uint8_t i = 0; i < OLED_DISPLAY_HEIGHT; ++i) {
for (uint8_t j = 0; j < OLED_DISPLAY_WIDTH; ++j) {
oled_write_raw_byte(0x0, i*OLED_DISPLAY_WIDTH + j);
}
}
clear_logo = false;
}
}

# define SHOW_LOGO 5000
bool oled_task_user(void) {
//user_oled_magic();
render_logo();
if ((timer_elapsed32(oled_logo_timer) < SHOW_LOGO)){
render_logo();
}else{
clear_screen();
user_oled_magic();
}
return false;
}

Expand Down
2 changes: 1 addition & 1 deletion keyboards/mlego/m65/rev1/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#pragma once

#define DEVICE_VER 0x0001
#define PRODUCT_ID 0x6060
#define PRODUCT_ID 0x6061

#define LED_NUM_LOCK_PIN B12
#define LED_SCROLL_LOCK_PIN B13
Expand Down
2 changes: 1 addition & 1 deletion keyboards/mlego/m65/rev2/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#pragma once

#define DEVICE_VER 0x0002
#define PRODUCT_ID 0x6060
#define PRODUCT_ID 0x6062

#define LED_NUM_LOCK_PIN B12
#define LED_SCROLL_LOCK_PIN B13
Expand Down
2 changes: 1 addition & 1 deletion keyboards/mlego/m65/rev3/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#pragma once

#define DEVICE_VER 0x0003
#define PRODUCT_ID 0x6060
#define PRODUCT_ID 0x6063

#define LED_NUM_LOCK_PIN B12
#define LED_SCROLL_LOCK_PIN B13
Expand Down
2 changes: 1 addition & 1 deletion keyboards/mlego/m65/rev4/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#pragma once

#define DEVICE_VER 0x0004
#define PRODUCT_ID 0x6060
#define PRODUCT_ID 0x6064

#define LED_NUM_LOCK_PIN B12
#define LED_SCROLL_LOCK_PIN B13
Expand Down