From e9e6054ee7eaca4cbd8d1c7566f394559ea8770a Mon Sep 17 00:00:00 2001 From: mechlovin <57231893+mechlovin@users.noreply.github.com> Date: Mon, 29 Jun 2020 15:19:09 +0700 Subject: [PATCH] [Keyboard] Refactor: add adelais rev.3 (#9496) * Refactor: add adelais rev.3 * update * Update keymap.c * update * update * update --- .../adelais/keymaps/default/keymap.c | 29 ++++++++++++++++++- .../mechlovin/adelais/keymaps/via/keymap.c | 29 ++++++++++++++++++- keyboards/mechlovin/adelais/readme.md | 2 +- keyboards/mechlovin/adelais/rules.mk | 2 +- .../mechlovin/adelais/standard_led/config.h | 1 - .../adelais/standard_led/rev2/config.h | 3 ++ .../adelais/standard_led/rev2/rules.mk | 0 .../adelais/standard_led/rev3/config.h | 8 +++++ .../adelais/standard_led/rev3/rules.mk | 1 + .../mechlovin/adelais/standard_led/rules.mk | 6 ++-- 10 files changed, 73 insertions(+), 8 deletions(-) create mode 100644 keyboards/mechlovin/adelais/standard_led/rev2/config.h create mode 100644 keyboards/mechlovin/adelais/standard_led/rev2/rules.mk create mode 100644 keyboards/mechlovin/adelais/standard_led/rev3/config.h create mode 100644 keyboards/mechlovin/adelais/standard_led/rev3/rules.mk diff --git a/keyboards/mechlovin/adelais/keymaps/default/keymap.c b/keyboards/mechlovin/adelais/keymaps/default/keymap.c index 7848a5709..19c298d4a 100644 --- a/keyboards/mechlovin/adelais/keymaps/default/keymap.c +++ b/keyboards/mechlovin/adelais/keymaps/default/keymap.c @@ -29,4 +29,31 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS ), -}; \ No newline at end of file +}; + +#ifdef ENCODER_ENABLE +void encoder_update_user(uint8_t index, bool clockwise) { + if (index == 0) { + if (clockwise) { + tap_code(KC_VOLU); + } else { + tap_code(KC_VOLD); + } + } + else if (index == 1) { + if (clockwise) { + tap_code(KC_LEFT); + } else { + tap_code(KC_RGHT); + } + } + else if (index == 2) { + if (clockwise) { + tap_code(KC_UP); + } else { + tap_code(KC_DOWN); + } + } +} + + #endif \ No newline at end of file diff --git a/keyboards/mechlovin/adelais/keymaps/via/keymap.c b/keyboards/mechlovin/adelais/keymaps/via/keymap.c index 03636d02b..d44a4e938 100644 --- a/keyboards/mechlovin/adelais/keymaps/via/keymap.c +++ b/keyboards/mechlovin/adelais/keymaps/via/keymap.c @@ -41,4 +41,31 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS ), -}; \ No newline at end of file +}; + +#ifdef ENCODER_ENABLE +void encoder_update_user(uint8_t index, bool clockwise) { + if (index == 0) { + if (clockwise) { + tap_code(KC_VOLU); + } else { + tap_code(KC_VOLD); + } + } + else if (index == 1) { + if (clockwise) { + tap_code(KC_LEFT); + } else { + tap_code(KC_RGHT); + } + } + else if (index == 2) { + if (clockwise) { + tap_code(KC_UP); + } else { + tap_code(KC_DOWN); + } + } +} + + #endif \ No newline at end of file diff --git a/keyboards/mechlovin/adelais/readme.md b/keyboards/mechlovin/adelais/readme.md index 947d5a31d..f8b3b47ff 100644 --- a/keyboards/mechlovin/adelais/readme.md +++ b/keyboards/mechlovin/adelais/readme.md @@ -3,7 +3,7 @@ ![adelais](https://i.imgur.com/6U1IfZe.png) Compatible with TGR Alice and all clone variants. -`standard_led` (Adelais) comes with backlight and RGB underglow LEDs pre-soldered. +`standard_led` (Adelais) comes with backlight and RGB underglow LEDs pre-soldered. Adelais rev.3 support 3 rotary encoder, USB TypeC both side and reset button. `rgb_led` (Adelais En Ciel) comes with per-key RGB LEDs pre-soldered. * Keyboard Maintainer: [Team Mechlovin'](https://github.com/mechlovin) diff --git a/keyboards/mechlovin/adelais/rules.mk b/keyboards/mechlovin/adelais/rules.mk index 91f87e5f3..75b9b6d28 100644 --- a/keyboards/mechlovin/adelais/rules.mk +++ b/keyboards/mechlovin/adelais/rules.mk @@ -20,4 +20,4 @@ AUDIO_ENABLE = no # Audio output on port C6 FAUXCLICKY_ENABLE = no # Use buzzer to emulate clicky switches HD44780_ENABLE = no # Enable support for HD44780 based LCDs -DEFAULT_FOLDER = mechlovin/adelais/standard_led \ No newline at end of file +DEFAULT_FOLDER = mechlovin/adelais/standard_led/rev2 \ No newline at end of file diff --git a/keyboards/mechlovin/adelais/standard_led/config.h b/keyboards/mechlovin/adelais/standard_led/config.h index 0de6cc6b4..6a008e2f3 100644 --- a/keyboards/mechlovin/adelais/standard_led/config.h +++ b/keyboards/mechlovin/adelais/standard_led/config.h @@ -1,6 +1,5 @@ #pragma once -#define PRODUCT_ID 0xAD01 #define PRODUCT Adelais #define DESCRIPTION Team.Mechlovin Adelais diff --git a/keyboards/mechlovin/adelais/standard_led/rev2/config.h b/keyboards/mechlovin/adelais/standard_led/rev2/config.h new file mode 100644 index 000000000..7c2c63ea2 --- /dev/null +++ b/keyboards/mechlovin/adelais/standard_led/rev2/config.h @@ -0,0 +1,3 @@ +#pragma once + +#define PRODUCT_ID 0xAD01 \ No newline at end of file diff --git a/keyboards/mechlovin/adelais/standard_led/rev2/rules.mk b/keyboards/mechlovin/adelais/standard_led/rev2/rules.mk new file mode 100644 index 000000000..e69de29bb diff --git a/keyboards/mechlovin/adelais/standard_led/rev3/config.h b/keyboards/mechlovin/adelais/standard_led/rev3/config.h new file mode 100644 index 000000000..60e288296 --- /dev/null +++ b/keyboards/mechlovin/adelais/standard_led/rev3/config.h @@ -0,0 +1,8 @@ +#pragma once + +#define PRODUCT_ID 0xAD02 + +#define ENCODERS_PAD_A { A6, A4, B7 } +#define ENCODERS_PAD_B { A5, A3, B6 } +#define ENCODER_RESOLUTION 4 + diff --git a/keyboards/mechlovin/adelais/standard_led/rev3/rules.mk b/keyboards/mechlovin/adelais/standard_led/rev3/rules.mk new file mode 100644 index 000000000..5af1ba853 --- /dev/null +++ b/keyboards/mechlovin/adelais/standard_led/rev3/rules.mk @@ -0,0 +1 @@ +ENCODER_ENABLE = yes diff --git a/keyboards/mechlovin/adelais/standard_led/rules.mk b/keyboards/mechlovin/adelais/standard_led/rules.mk index 4ddc35240..34de30aa9 100644 --- a/keyboards/mechlovin/adelais/standard_led/rules.mk +++ b/keyboards/mechlovin/adelais/standard_led/rules.mk @@ -1,3 +1,3 @@ -BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality -BACKLIGHT_DRIVER = pwm -RGBLIGHT_ENABLE = yes # Enable keyboard RGB underglow \ No newline at end of file + + +DEFAULT_FOLDER = mechlovin/adelais/standard_led/rev2 \ No newline at end of file