From 94b3efe92e192a20fda3cfa4fa0f200011bba924 Mon Sep 17 00:00:00 2001 From: mechlovin <57231893+mechlovin@users.noreply.github.com> Date: Wed, 10 Aug 2022 01:20:36 +0700 Subject: change Adelais En Ciel rev. 3 from STM32F303 to APM32F103 MCU (#16964) Co-authored-by: Drashna Jaelre Co-authored-by: Ryan --- .../mechlovin/adelais/keymaps/default/keymap.c | 58 +++++++++++++++++++- keyboards/mechlovin/adelais/keymaps/via/keymap.c | 64 ++++++++++++++++++++-- keyboards/mechlovin/adelais/rgb_led/rev3/config.h | 17 ++++-- keyboards/mechlovin/adelais/rgb_led/rev3/halconf.h | 4 +- keyboards/mechlovin/adelais/rgb_led/rev3/mcuconf.h | 14 +---- keyboards/mechlovin/adelais/rgb_led/rev3/rev3.c | 48 +--------------- keyboards/mechlovin/adelais/rgb_led/rev3/rules.mk | 14 +++++ 7 files changed, 146 insertions(+), 73 deletions(-) (limited to 'keyboards/mechlovin') diff --git a/keyboards/mechlovin/adelais/keymaps/default/keymap.c b/keyboards/mechlovin/adelais/keymaps/default/keymap.c index 2a38663ed2..3a33b59d1c 100644 --- a/keyboards/mechlovin/adelais/keymaps/default/keymap.c +++ b/keyboards/mechlovin/adelais/keymaps/default/keymap.c @@ -22,7 +22,19 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_SPC, KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_BSLS, MO(1), KC_RSFT, KC_UP, KC_LCTL, KC_LALT, KC_SPC, MO(2), KC_SPC, KC_RALT, KC_RCTL ), - [0] = LAYOUT_all( + [1] = LAYOUT_all( + 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, 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, 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, KC_TRNS, KC_TRNS, KC_TRNS ), + [2] = LAYOUT_all( + RESET, KC_TRNS, KC_F13, KC_F14, KC_F15, KC_F16, KC_F17, KC_F18, KC_F19, KC_F20, KC_F21, KC_F22, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_P7, KC_P8, KC_P9, KC_PSLS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_P4, KC_P5, KC_P6, KC_PAST, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_P1, KC_P2, KC_P3, KC_PPLS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_P0, KC_PDOT, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS ), + [3] = LAYOUT_all( 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, 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, KC_TRNS, KC_TRNS, KC_TRNS, @@ -35,9 +47,9 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { bool encoder_update_user(uint8_t index, bool clockwise) { if (index == 0) { if (clockwise) { - tap_code(KC_VOLU); - } else { tap_code(KC_VOLD); + } else { + tap_code(KC_VOLU); } } else if (index == 1) { @@ -58,3 +70,43 @@ bool encoder_update_user(uint8_t index, bool clockwise) { } #endif + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + if (record->event.pressed) { + switch(keycode) { + case KC_F13: // toggle rgb matrix + rgb_matrix_toggle(); + return false; + case KC_F14: + rgb_matrix_step(); + return false; + case KC_F15: + rgb_matrix_increase_speed(); + return false; + case KC_F16: + rgb_matrix_decrease_speed(); + return false; + case KC_F17: + rgb_matrix_increase_hue(); + return false; + case KC_F18: + rgb_matrix_decrease_hue(); + return false; + case KC_F19: + rgb_matrix_increase_sat(); + return false; + case KC_F20: + rgb_matrix_decrease_sat(); + return false; + case KC_F21: + rgb_matrix_increase_val(); + return false; + case KC_F22: + rgb_matrix_decrease_val(); + return false; + default: + break; + } + } + return true; +} diff --git a/keyboards/mechlovin/adelais/keymaps/via/keymap.c b/keyboards/mechlovin/adelais/keymaps/via/keymap.c index 6ab566e1c3..e9ed9b6a36 100644 --- a/keyboards/mechlovin/adelais/keymaps/via/keymap.c +++ b/keyboards/mechlovin/adelais/keymaps/via/keymap.c @@ -15,6 +15,20 @@ */ #include QMK_KEYBOARD_H +enum my_keycodes { + BL_TOG = USER00, + BL_EFFECT = USER01, + BL_ISPD = USER02, + BL_DSPD = USER03, + BL_IHUE = USER04, + BL_DHUE = USER05, + BL_ISAT = USER06, + BL_DSAT = USER07, + BL_IVAL = USER08, + BL_DVAL = USER09 +}; + + const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [0] = LAYOUT_all( KC_SPC, KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_DEL, @@ -29,11 +43,11 @@ 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 ), [2] = LAYOUT_all( - 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, 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, 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, KC_TRNS, KC_TRNS, KC_TRNS ), + RESET, KC_TRNS, BL_TOG, BL_EFFECT, BL_ISPD, BL_DSPD, BL_IHUE, BL_DHUE, BL_ISAT, BL_DSAT, BL_IVAL, BL_DVAL, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_P7, KC_P8, KC_P9, KC_PSLS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_P4, KC_P5, KC_P6, KC_PAST, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_P1, KC_P2, KC_P3, KC_PPLS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_P0, KC_PDOT, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS ), [3] = LAYOUT_all( 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, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, @@ -70,3 +84,43 @@ bool encoder_update_user(uint8_t index, bool clockwise) { } #endif + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + if (record->event.pressed) { + switch(keycode) { + case BL_TOG: // toggle rgb matrix + rgb_matrix_toggle(); + return false; + case BL_EFFECT: + rgb_matrix_step(); + return false; + case BL_ISPD: + rgb_matrix_increase_speed(); + return false; + case BL_DSPD: + rgb_matrix_decrease_speed(); + return false; + case BL_IHUE: + rgb_matrix_increase_hue(); + return false; + case BL_DHUE: + rgb_matrix_decrease_hue(); + return false; + case BL_ISAT: + rgb_matrix_increase_sat(); + return false; + case BL_DSAT: + rgb_matrix_decrease_sat(); + return false; + case BL_IVAL: + rgb_matrix_increase_val(); + return false; + case BL_DVAL: + rgb_matrix_decrease_val(); + return false; + default: + break; + } + } + return true; +} diff --git a/keyboards/mechlovin/adelais/rgb_led/rev3/config.h b/keyboards/mechlovin/adelais/rgb_led/rev3/config.h index c0817d6062..6efac57ee2 100644 --- a/keyboards/mechlovin/adelais/rgb_led/rev3/config.h +++ b/keyboards/mechlovin/adelais/rgb_led/rev3/config.h @@ -21,8 +21,9 @@ along with this program. If not, see . #define PRODUCT Adelais En Ciel Rev3 #define MATRIX_ROW_PINS { A4, A3, C13, A1, A2} -#define MATRIX_COL_PINS { B10, B11, B2, B1, B0, A6, A5, A14, A13, A15, B3, B4, B5, B8, B9 } +#define MATRIX_COL_PINS { B10, B11, B2, B1, B0, A6, A5, A10, A9, A15, B3, B4, B5, B8, B9 } +#ifdef RGBLIGHT_ENABLE #define RGB_DI_PIN A7 #define WS2812_SPI SPID1 // default: SPID1 #define WS2812_SPI_MOSI_PAL_MODE 5 // Pin "alternate function", see the respective datasheet for the appropriate values for your MCU. default: 5 @@ -40,7 +41,9 @@ along with this program. If not, see . #define RGBLIGHT_HUE_STEP 8 #define RGBLIGHT_SAT_STEP 8 #define RGBLIGHT_VAL_STEP 8 +#endif +#ifdef RGB_MATRIX_ENABLE //rgb matrix setting // This is a 7-bit address, that gets left-shifted and bit 0 // set to 0 for write, 1 for read (as per I2C protocol) @@ -52,13 +55,14 @@ along with this program. If not, see . #define DRIVER_ADDR_1 0b0110010 #define DRIVER_COUNT 1 #define DRIVER_LED_TOTAL 66 + #define RGB_MATRIX_KEYPRESSES // reacts to keypresses #define RGB_MATRIX_KEYRELEASES // reacts to keyreleases (instead of keypresses) #define RGB_MATRIX_FRAMEBUFFER_EFFECTS #define RGB_DISABLE_AFTER_TIMEOUT 0 // number of ticks to wait until disabling effects -#define RGB_DISABLE_WHEN_USB_SUSPENDED // turn off effects when suspended #define RGB_MATRIX_LED_FLUSH_LIMIT 16 // limits in milliseconds how frequently an animation will update the LEDs. 16 (16ms) is equivalent to limiting to 60fps (increases keyboard responsiveness) #define RGB_MATRIX_MAXIMUM_BRIGHTNESS 255 // limits maximum brightness of LEDs to 200 out of 255. If not defined maximum brightness is set to 255 +#define RGB_DISABLE_WHEN_USB_SUSPENDED // turn off effects when suspended #define RGB_MATRIX_STARTUP_MODE RGB_MATRIX_CYCLE_PINWHEEL // Sets the default mode, if none has been set #define ENABLE_RGB_MATRIX_ALPHAS_MODS @@ -108,12 +112,17 @@ along with this program. If not, see . #define RGB_MATRIX_DISABLE_KEYCODES +#define I2C1_CLOCK_SPEED 400000 +#define I2C1_DUTY_CYCLE FAST_DUTY_CYCLE_2 + +#endif + +#ifdef ENCODER_ENABLE #define ENCODERS_PAD_A { B12 } #define ENCODERS_PAD_B { B13 } #define ENCODER_RESOLUTION 4 - #define TAP_CODE_DELAY 10 - +#endif #define LED_NUM_LOCK_PIN A0 #define LED_CAPS_LOCK_PIN C14 diff --git a/keyboards/mechlovin/adelais/rgb_led/rev3/halconf.h b/keyboards/mechlovin/adelais/rgb_led/rev3/halconf.h index d001829d03..a97c4bbc21 100644 --- a/keyboards/mechlovin/adelais/rgb_led/rev3/halconf.h +++ b/keyboards/mechlovin/adelais/rgb_led/rev3/halconf.h @@ -18,9 +18,7 @@ #define HAL_USE_I2C TRUE -#define PAL_USE_CALLBACKS FALSE - -#define PAL_USE_WAIT FALSE +#define HAL_USE_SPI TRUE #include_next diff --git a/keyboards/mechlovin/adelais/rgb_led/rev3/mcuconf.h b/keyboards/mechlovin/adelais/rgb_led/rev3/mcuconf.h index 20d2a82c27..aa5ea7335b 100644 --- a/keyboards/mechlovin/adelais/rgb_led/rev3/mcuconf.h +++ b/keyboards/mechlovin/adelais/rgb_led/rev3/mcuconf.h @@ -18,18 +18,8 @@ #include_next -#undef STM32_GPT_USE_TIM15 -#define STM32_GPT_USE_TIM15 FALSE - -#undef STM32_I2C_USE_I2C1 -#define STM32_I2C_USE_I2C1 TRUE - -#undef STM32_PWM_USE_TIM3 -#define STM32_PWM_USE_TIM3 FALSE - #undef STM32_SPI_USE_SPI1 #define STM32_SPI_USE_SPI1 TRUE -#undef STM32_SPI_USE_SPI2 -#define STM32_SPI_USE_SPI2 FALSE - +#undef STM32_I2C_USE_I2C1 +#define STM32_I2C_USE_I2C1 TRUE \ No newline at end of file diff --git a/keyboards/mechlovin/adelais/rgb_led/rev3/rev3.c b/keyboards/mechlovin/adelais/rgb_led/rev3/rev3.c index b20f897720..d9ea7993cf 100644 --- a/keyboards/mechlovin/adelais/rgb_led/rev3/rev3.c +++ b/keyboards/mechlovin/adelais/rgb_led/rev3/rev3.c @@ -94,8 +94,8 @@ led_config_t g_led_config = { { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15}, {17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, NO_LED}, {32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, NO_LED, 44, NO_LED}, - {45, NO_LED, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58}, - {59, NO_LED, 60, NO_LED, 61, NO_LED, 62, NO_LED, 63, NO_LED, 64, NO_LED, NO_LED, NO_LED, 65}, + {45, 0, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58}, + {59, 16, 60, 31, 61, NO_LED, 62, NO_LED, 63, NO_LED, 64, NO_LED, NO_LED, NO_LED, 65}, }, { //LED Index to Physical Positon {0,0}, { 17, 0}, { 34, 0 }, { 51, 0 }, { 69, 0}, { 86, 0}, {100, 0}, {103, 0}, { 120, 0}, { 138, 0}, { 155, 0}, { 172, 0}, { 189, 0}, {207, 0}, {215, 0}, {224, 0}, @@ -120,47 +120,3 @@ __attribute__((weak)) void rgb_matrix_indicators_user(void) { #endif - -bool process_record_kb(uint16_t keycode, keyrecord_t *record) { - if (record->event.pressed) { - switch(keycode) { - #ifdef RGBLIGHT_ENABLE - #ifdef RGB_MATRIX_ENABLE - case KC_F13: // toggle rgb matrix - rgb_matrix_toggle(); - return false; - case KC_F14: - rgb_matrix_step(); - return false; - case KC_F15: - rgb_matrix_increase_speed(); - return false; - case KC_F16: - rgb_matrix_decrease_speed(); - return false; - case KC_F17: - rgb_matrix_increase_hue(); - return false; - case KC_F18: - rgb_matrix_decrease_hue(); - return false; - case KC_F19: - rgb_matrix_increase_sat(); - return false; - case KC_F20: - rgb_matrix_decrease_sat(); - return false; - case KC_F21: - rgb_matrix_increase_val(); - return false; - case KC_F22: - rgb_matrix_decrease_val(); - return false; - #endif - #endif - default: - break; - } - } - return true; -} \ No newline at end of file diff --git a/keyboards/mechlovin/adelais/rgb_led/rev3/rules.mk b/keyboards/mechlovin/adelais/rgb_led/rev3/rules.mk index 904d20877b..3407a7b780 100644 --- a/keyboards/mechlovin/adelais/rgb_led/rev3/rules.mk +++ b/keyboards/mechlovin/adelais/rgb_led/rev3/rules.mk @@ -1,5 +1,19 @@ +# MCU name +MCU = STM32F103 + +# Bootloader selection +BOOTLOADER = stm32duino + +# Build Options +# change yes to no to disable +# RGB_MATRIX_ENABLE = yes RGB_MATRIX_DRIVER = IS31FL3741 RGBLIGHT_ENABLE = yes ENCODER_ENABLE = yes WS2812_DRIVER = spi +CONSOLE_ENABLE = no # Console for debug +COMMAND_ENABLE = no # Commands for debug and configuration + +# Enter lower-power sleep mode when on the ChibiOS idle thread +OPT_DEFS += -DCORTEX_ENABLE_WFI_IDLE=TRUE \ No newline at end of file -- cgit v1.2.3