summaryrefslogtreecommitdiff
path: root/keyboards/mlego
diff options
context:
space:
mode:
authorAlin Marin Elena <alin@elena.space>2022-01-13 17:16:26 +0000
committerGitHub <noreply@github.com>2022-01-13 09:16:26 -0800
commit2c8098ea8839d242a5037821d6ba0255637cd15e (patch)
tree19ad1adcaf7ce6dae1b5ab9aba8a8930ae8d5a6a /keyboards/mlego
parenta3af4b09b0786e7c228828b2b3676fb7dd9a1c2f (diff)
downloadqmk_firmware-2c8098ea8839d242a5037821d6ba0255637cd15e.tar.gz
qmk_firmware-2c8098ea8839d242a5037821d6ba0255637cd15e.zip
[Keyboard] move enum_layers in keymaps, in sync with the other mlego/m* (#15832)
Diffstat (limited to 'keyboards/mlego')
-rw-r--r--keyboards/mlego/m48/keymaps/default/keymap.c50
-rw-r--r--keyboards/mlego/m48/keymaps/via/keymap.c50
-rw-r--r--keyboards/mlego/m48/m48.h30
3 files changed, 84 insertions, 46 deletions
diff --git a/keyboards/mlego/m48/keymaps/default/keymap.c b/keyboards/mlego/m48/keymaps/default/keymap.c
index 8a76993c07..df9e1bb46e 100644
--- a/keyboards/mlego/m48/keymaps/default/keymap.c
+++ b/keyboards/mlego/m48/keymaps/default/keymap.c
@@ -17,6 +17,13 @@ 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});
@@ -148,14 +155,6 @@ 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
@@ -180,3 +179,38 @@ 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
diff --git a/keyboards/mlego/m48/keymaps/via/keymap.c b/keyboards/mlego/m48/keymaps/via/keymap.c
index 54ef03cd5a..af625ef207 100644
--- a/keyboards/mlego/m48/keymaps/via/keymap.c
+++ b/keyboards/mlego/m48/keymaps/via/keymap.c
@@ -17,6 +17,13 @@ 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});
@@ -103,14 +110,6 @@ 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
@@ -135,3 +134,38 @@ 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
diff --git a/keyboards/mlego/m48/m48.h b/keyboards/mlego/m48/m48.h
index 766f38124c..f9ef8aee39 100644
--- a/keyboards/mlego/m48/m48.h
+++ b/keyboards/mlego/m48/m48.h
@@ -31,7 +31,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
{ K300, K301, K302, K303, K304, K305, K306, K307, K308, K309, K310, K311 } \
}
-enum layer_names { _QW = 0, _LWR, _RSE, _ADJ };
static inline void led_lwr(const bool on) {
#ifdef LED_NUM_LOCK_PIN
writePin(LED_NUM_LOCK_PIN, on);
@@ -49,32 +48,3 @@ static inline void led_caps(const bool on) {
#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);
- }
- }
- }
-}
-#endif