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

[wip] add mlego/m65 oled revision #15833

Merged
merged 17 commits into from
Jan 30, 2022
Next Next commit
add mlego/m65 oled revision
  • Loading branch information
alin m elena committed Jan 11, 2022
commit d3b52aba86995f38c63ac603dfe7092f5aaa707d
2 changes: 1 addition & 1 deletion keyboards/mlego/m65/info.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
{"x": 8, "y": 4},
{"x": 9, "y": 4},
{"x": 10, "y": 4},
{"x": 11, "y": 4},
{"x": 11, "y": 4}
{"x": 12, "y": 4}
]
}
Expand Down
52 changes: 10 additions & 42 deletions keyboards/mlego/m65/keymaps/default/keymap.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.

#include QMK_KEYBOARD_H

enum layer_names {
_QW = 0,
_LWR,
_RSE,
_ADJ
};

#ifdef RGBLIGHT_ENABLE

const rgblight_segment_t PROGMEM my_qwerty_layer[] = RGBLIGHT_LAYER_SEGMENTS({0, RGBLED_NUM, HSV_PURPLE});
Expand Down Expand Up @@ -108,6 +101,16 @@ bool process_record_user(uint16_t keycode, keyrecord_t* record) {
}
}

#ifdef ENCODER_ENABLE

# define MEDIA_KEY_DELAY 10

bool encoder_update_user(uint8_t index, bool clockwise) {
my_encoders(index, clockwise);
return true;
}
#endif

layer_state_t layer_state_set_user(layer_state_t state) {
#ifdef RGBLIGHT_ENABLE

Expand All @@ -132,38 +135,3 @@ void keyboard_post_init_user(void) {
rgblight_layers = my_rgb_layers;
}
#endif

#ifdef ENCODER_ENABLE

# define MEDIA_KEY_DELAY 10

static inline void my_encoders(const uint8_t index, const bool clockwise) {
if (index == 0) { /* First encoder */
if (IS_LAYER_ON(_LWR)) {
if (clockwise) {
rgblight_decrease_val_noeeprom();
} else {
rgblight_increase_val_noeeprom();
}
} else if (IS_LAYER_ON(_RSE)) {
if (clockwise) {
rgblight_decrease_hue_noeeprom();
} else {
rgblight_increase_hue_noeeprom();
}

} else {
if (clockwise) {
tap_code_delay(KC_VOLD, MEDIA_KEY_DELAY);
} else {
tap_code_delay(KC_VOLU, MEDIA_KEY_DELAY);
}
}
}
}

bool encoder_update_user(uint8_t index, bool clockwise) {
my_encoders(index, clockwise);
return true;
}
#endif
50 changes: 8 additions & 42 deletions keyboards/mlego/m65/keymaps/dk/keymap.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include QMK_KEYBOARD_H
#include "keymap_danish.h"

enum layer_names {
_QW = 0,
_LWR,
_RSE,
_ADJ
};

#ifdef RGBLIGHT_ENABLE

const rgblight_segment_t PROGMEM my_qwerty_layer[] = RGBLIGHT_LAYER_SEGMENTS({0, RGBLED_NUM, HSV_PURPLE});
Expand Down Expand Up @@ -109,6 +102,14 @@ bool process_record_user(uint16_t keycode, keyrecord_t* record) {
}
}

#ifdef ENCODER_ENABLE

bool encoder_update_user(uint8_t index, bool clockwise) {
my_encoders(index, clockwise);
return true;
}
#endif

layer_state_t layer_state_set_user(layer_state_t state) {
#ifdef RGBLIGHT_ENABLE

Expand All @@ -133,38 +134,3 @@ void keyboard_post_init_user(void) {
rgblight_layers = my_rgb_layers;
}
#endif

#ifdef ENCODER_ENABLE

# define MEDIA_KEY_DELAY 10

static inline void my_encoders(const uint8_t index, const bool clockwise) {
if (index == 0) { /* First encoder */
if (IS_LAYER_ON(_LWR)) {
if (clockwise) {
rgblight_decrease_val_noeeprom();
} else {
rgblight_increase_val_noeeprom();
}
} else if (IS_LAYER_ON(_RSE)) {
if (clockwise) {
rgblight_decrease_hue_noeeprom();
} else {
rgblight_increase_hue_noeeprom();
}

} else {
if (clockwise) {
tap_code_delay(KC_VOLD, MEDIA_KEY_DELAY);
} else {
tap_code_delay(KC_VOLU, MEDIA_KEY_DELAY);
}
}
}
}

bool encoder_update_user(uint8_t index, bool clockwise) {
my_encoders(index, clockwise);
return true;
}
#endif
123 changes: 90 additions & 33 deletions keyboards/mlego/m65/keymaps/uk/keymap.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,51 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include QMK_KEYBOARD_H
#include "keymap_uk.h"

enum layer_names {
_QW = 0,
_LWR,
_RSE,
_ADJ
};

#ifdef CONSOLE_ENABLE

#include "print.h"

#endif

#ifdef OLED_ENABLE
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, 0xd0, 0x58, 0x78, 0x68, 0x2c, 0x24, 0x34, 0xf4, 0xf4,
0x3c, 0x3c, 0xfc, 0xf8, 0xf8, 0x70, 0xf0, 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, 0xe0, 0x18, 0x02, 0x00, 0x3c, 0x1e, 0x06, 0x0e, 0x0a, 0x1a, 0x0e, 0x26, 0xff, 0xbf, 0x0d,
0x00, 0x80, 0x80, 0x81, 0xff, 0xfe, 0xf8, 0x01, 0x01, 0x03, 0x03, 0x03, 0x03, 0x05, 0x05, 0x02,
0x02, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0c, 0x04, 0x10, 0x18, 0x20, 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, 0xc0,
0x7c, 0x07, 0x80, 0xe0, 0x60, 0x64, 0xe2, 0x60, 0x10, 0x10, 0x20, 0x22, 0x12, 0x17, 0x3f, 0x0b,
0x01, 0x01, 0x01, 0x01, 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, 0x21, 0x6f, 0xfc,
0xe0, 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, 0x40, 0x60, 0x60, 0x70, 0x70,
0xf0, 0xf0, 0xd0, 0xd0, 0xd0, 0xd0, 0x50, 0x50, 0x50, 0x70, 0x78, 0x78, 0x78, 0x7c, 0x7f, 0x7d,
0x7c, 0x5e, 0x4f, 0x44, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x30, 0x30, 0x30, 0x30,
0x30, 0x30, 0x58, 0x46, 0x47, 0x41, 0x41, 0x01, 0x01, 0x03, 0x03, 0x42, 0x42, 0x42, 0x46, 0x46,
0x46, 0x46, 0x42, 0x43, 0x43, 0x73, 0x77, 0x72, 0x70, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x61,
0x67, 0x6f, 0x7e, 0x78, 0x78, 0x70, 0x70, 0x70, 0x70, 0x70, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60,
0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x40, 0x40, 0x40, 0x48,
0x58, 0x58, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00
};
#endif

#ifdef RGBLIGHT_ENABLE

const rgblight_segment_t PROGMEM my_qwerty_layer[] = RGBLIGHT_LAYER_SEGMENTS({0, RGBLED_NUM, HSV_PURPLE});
Expand Down Expand Up @@ -184,6 +216,14 @@ bool process_record_user(uint16_t keycode, keyrecord_t* record) {
}
}

#ifdef ENCODER_ENABLE

bool encoder_update_user(uint8_t index, bool clockwise) {
my_encoders(index, clockwise);
return true;
}
#endif

layer_state_t layer_state_set_user(layer_state_t state) {
#ifdef RGBLIGHT_ENABLE

Expand Down Expand Up @@ -215,37 +255,54 @@ void keyboard_post_init_user(void) {
}
#endif

#ifdef ENCODER_ENABLE
#ifdef OLED_ENABLE

# define MEDIA_KEY_DELAY 10
static void render_logo(void) {
oled_write_raw_P(m65_logo, sizeof(m65_logo));
}

static inline void my_encoders(const uint8_t index, const bool clockwise) {
if (index == 0) { /* First encoder */
if (IS_LAYER_ON(_LWR)) {
if (clockwise) {
rgblight_decrease_val_noeeprom();
} else {
rgblight_increase_val_noeeprom();
}
} else if (IS_LAYER_ON(_RSE)) {
if (clockwise) {
rgblight_decrease_hue_noeeprom();
} else {
rgblight_increase_hue_noeeprom();
}
/*

} else {
if (clockwise) {
tap_code_delay(KC_VOLD, MEDIA_KEY_DELAY);
} else {
tap_code_delay(KC_VOLU, MEDIA_KEY_DELAY);
}
}
void user_oled_magic(void) {
// Host Keyboard Layer Status
oled_write_P(PSTR("R1: 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.caps_lock ? PSTR("CapsLock ") : PSTR(" "), false);
oled_write_P(led_state.scroll_lock ? PSTR("Raise ") : PSTR(" "), false);

}
*/

bool encoder_update_user(uint8_t index, bool clockwise) {
my_encoders(index, clockwise);
return true;

oled_rotation_t oled_init_user(oled_rotation_t rotation) {
return rotation;
}

bool oled_task_user(void) {
//user_oled_magic();
render_logo();
return false;
}

#endif
Loading