From e0d15e6182a331ed27535f81539f2d7243d02bc0 Mon Sep 17 00:00:00 2001 From: yulei Date: Sat, 7 Mar 2020 21:19:06 +0800 Subject: [PATCH] fixed #8259 (#8333) --- keyboards/matrix/noah/boards/noah_bd/board.mk | 4 ++ keyboards/matrix/noah/config.h | 16 ++--- keyboards/matrix/noah/halconf.h | 4 +- keyboards/matrix/noah/matrix.c | 2 +- keyboards/matrix/noah/mcuconf.h | 61 +++++++------------ keyboards/matrix/noah/noah.c | 27 +++----- keyboards/matrix/noah/rules.mk | 10 ++- 7 files changed, 52 insertions(+), 72 deletions(-) diff --git a/keyboards/matrix/noah/boards/noah_bd/board.mk b/keyboards/matrix/noah/boards/noah_bd/board.mk index e4cd10acf..185f9e1e9 100644 --- a/keyboards/matrix/noah/boards/noah_bd/board.mk +++ b/keyboards/matrix/noah/boards/noah_bd/board.mk @@ -3,3 +3,7 @@ BOARDSRC = $(BOARD_PATH)/boards/noah_bd/board.c # Required include directories BOARDINC = $(BOARD_PATH)/boards/noah_bd + +# Shared variables +ALLCSRC += $(BOARDSRC) +ALLINC += $(BOARDINC) diff --git a/keyboards/matrix/noah/config.h b/keyboards/matrix/noah/config.h index ccedd43cc..796e45e2f 100644 --- a/keyboards/matrix/noah/config.h +++ b/keyboards/matrix/noah/config.h @@ -17,8 +17,12 @@ #define MATRIX_ROWS 5 #define MATRIX_COLS 15 +#define MATRIX_ROW_PINS { B0, A1, C14, C13, A0} +#define MATRIX_COL_PINS { C15, B10, B7, B6, B5, B4, A15, A10, A9, A8, B15, B14, B13, B12, B2} +#define UNUSED_PINS + #define DIODE_DIRECTION COL2ROW -#define DEBOUNCING_DELAY 5 +#define DEBOUNCE 5 // i2c setting #define USE_I2CV1 @@ -37,13 +41,11 @@ #define DRIVER_LED_TOTAL (DRIVER_1_LED_TOTAL + DRIVER_2_LED_TOTAL) /* indicator rgb */ -#define WS2812_LED_N 7 -#define RGBLED_NUM WS2812_LED_N +#define RGBLED_NUM 7 #define RGB_DI_PIN B1 #define RGBLIGHT_ANIMATIONS -//#define WS2812_EXTERNAL_PULLUP // tapping setting -#define TAPPING_TERM 200 -#define RETRO_TAPPING -#define PERMISSIVE_HOLD +//#define TAPPING_TERM 200 +//#define RETRO_TAPPING +//#define PERMISSIVE_HOLD diff --git a/keyboards/matrix/noah/halconf.h b/keyboards/matrix/noah/halconf.h index 2fccb45e1..34501edfd 100644 --- a/keyboards/matrix/noah/halconf.h +++ b/keyboards/matrix/noah/halconf.h @@ -72,7 +72,7 @@ * @brief Enables the GPT subsystem. */ #if !defined(HAL_USE_GPT) || defined(__DOXYGEN__) -#define HAL_USE_GPT TRUE +#define HAL_USE_GPT FALSE #endif /** @@ -114,7 +114,7 @@ * @brief Enables the PWM subsystem. */ #if !defined(HAL_USE_PWM) || defined(__DOXYGEN__) -#define HAL_USE_PWM TRUE +#define HAL_USE_PWM FALSE #endif /** diff --git a/keyboards/matrix/noah/matrix.c b/keyboards/matrix/noah/matrix.c index 02861a8e3..737f570c1 100644 --- a/keyboards/matrix/noah/matrix.c +++ b/keyboards/matrix/noah/matrix.c @@ -130,7 +130,7 @@ uint8_t matrix_scan(void) } } - if (debouncing && timer_elapsed(debouncing_time) > DEBOUNCING_DELAY) { + if (debouncing && timer_elapsed(debouncing_time) > DEBOUNCE) { for (int row = 0; row < MATRIX_ROWS; row++) { matrix[row] = 0; for (int col = 0; col < MATRIX_COLS; col++) { diff --git a/keyboards/matrix/noah/mcuconf.h b/keyboards/matrix/noah/mcuconf.h index 8405d61e1..54a1f2661 100644 --- a/keyboards/matrix/noah/mcuconf.h +++ b/keyboards/matrix/noah/mcuconf.h @@ -1,5 +1,5 @@ /* - ChibiOS - Copyright (C) 2006..2016 Giovanni Di Sirio + ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -57,13 +57,31 @@ #define STM32_MCO1PRE STM32_MCO1PRE_DIV1 #define STM32_MCO2SEL STM32_MCO2SEL_SYSCLK #define STM32_MCO2PRE STM32_MCO2PRE_DIV5 -#define STM32_I2SSRC STM32_I2SSRC_PLLI2S +#define STM32_I2SSRC STM32_I2SSRC_CKIN #define STM32_PLLI2SN_VALUE 192 -#define STM32_PLLI2SR_VALUE 2 +#define STM32_PLLI2SR_VALUE 5 #define STM32_PVD_ENABLE FALSE #define STM32_PLS STM32_PLS_LEV0 #define STM32_BKPRAM_ENABLE FALSE +/* + * IRQ system settings. + */ +#define STM32_IRQ_EXTI0_PRIORITY 6 +#define STM32_IRQ_EXTI1_PRIORITY 6 +#define STM32_IRQ_EXTI2_PRIORITY 6 +#define STM32_IRQ_EXTI3_PRIORITY 6 +#define STM32_IRQ_EXTI4_PRIORITY 6 +#define STM32_IRQ_EXTI5_9_PRIORITY 6 +#define STM32_IRQ_EXTI10_15_PRIORITY 6 +#define STM32_IRQ_EXTI16_PRIORITY 6 +#define STM32_IRQ_EXTI17_PRIORITY 15 +#define STM32_IRQ_EXTI18_PRIORITY 6 +#define STM32_IRQ_EXTI19_PRIORITY 6 +#define STM32_IRQ_EXTI20_PRIORITY 6 +#define STM32_IRQ_EXTI21_PRIORITY 15 +#define STM32_IRQ_EXTI22_PRIORITY 15 + /* * ADC driver system settings. */ @@ -74,22 +92,6 @@ #define STM32_ADC_IRQ_PRIORITY 6 #define STM32_ADC_ADC1_DMA_IRQ_PRIORITY 6 -/* - * EXT driver system settings. - */ -#define STM32_EXT_EXTI0_IRQ_PRIORITY 6 -#define STM32_EXT_EXTI1_IRQ_PRIORITY 6 -#define STM32_EXT_EXTI2_IRQ_PRIORITY 6 -#define STM32_EXT_EXTI3_IRQ_PRIORITY 6 -#define STM32_EXT_EXTI4_IRQ_PRIORITY 6 -#define STM32_EXT_EXTI5_9_IRQ_PRIORITY 6 -#define STM32_EXT_EXTI10_15_IRQ_PRIORITY 6 -#define STM32_EXT_EXTI16_IRQ_PRIORITY 6 -#define STM32_EXT_EXTI17_IRQ_PRIORITY 15 -#define STM32_EXT_EXTI18_IRQ_PRIORITY 6 -#define STM32_EXT_EXTI19_IRQ_PRIORITY 6 -#define STM32_EXT_EXTI22_IRQ_PRIORITY 15 - /* * GPT driver system settings. */ @@ -164,9 +166,9 @@ * PWM driver system settings. */ #define STM32_PWM_USE_ADVANCED FALSE -#define STM32_PWM_USE_TIM1 TRUE +#define STM32_PWM_USE_TIM1 FALSE #define STM32_PWM_USE_TIM2 FALSE -#define STM32_PWM_USE_TIM3 TRUE +#define STM32_PWM_USE_TIM3 FALSE #define STM32_PWM_USE_TIM4 FALSE #define STM32_PWM_USE_TIM5 FALSE #define STM32_PWM_USE_TIM9 FALSE @@ -182,11 +184,9 @@ */ #define STM32_SERIAL_USE_USART1 FALSE #define STM32_SERIAL_USE_USART2 FALSE -#define STM32_SERIAL_USE_USART3 FALSE #define STM32_SERIAL_USE_USART6 FALSE #define STM32_SERIAL_USART1_PRIORITY 12 #define STM32_SERIAL_USART2_PRIORITY 12 -#define STM32_SERIAL_USART3_PRIORITY 12 #define STM32_SERIAL_USART6_PRIORITY 12 /* @@ -195,28 +195,18 @@ #define STM32_SPI_USE_SPI1 TRUE #define STM32_SPI_USE_SPI2 FALSE #define STM32_SPI_USE_SPI3 FALSE -#define STM32_SPI_USE_SPI4 FALSE -#define STM32_SPI_USE_SPI5 FALSE #define STM32_SPI_SPI1_RX_DMA_STREAM STM32_DMA_STREAM_ID(2, 0) #define STM32_SPI_SPI1_TX_DMA_STREAM STM32_DMA_STREAM_ID(2, 3) #define STM32_SPI_SPI2_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 3) #define STM32_SPI_SPI2_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 4) #define STM32_SPI_SPI3_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 0) #define STM32_SPI_SPI3_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 7) -#define STM32_SPI_SPI4_RX_DMA_STREAM STM32_DMA_STREAM_ID(2, 4) -#define STM32_SPI_SPI4_TX_DMA_STREAM STM32_DMA_STREAM_ID(2, 1) -#define STM32_SPI_SPI5_RX_DMA_STREAM STM32_DMA_STREAM_ID(2, 5) -#define STM32_SPI_SPI5_TX_DMA_STREAM STM32_DMA_STREAM_ID(2, 6) #define STM32_SPI_SPI1_DMA_PRIORITY 1 #define STM32_SPI_SPI2_DMA_PRIORITY 1 #define STM32_SPI_SPI3_DMA_PRIORITY 1 -#define STM32_SPI_SPI4_DMA_PRIORITY 1 -#define STM32_SPI_SPI5_DMA_PRIORITY 1 #define STM32_SPI_SPI1_IRQ_PRIORITY 10 #define STM32_SPI_SPI2_IRQ_PRIORITY 10 #define STM32_SPI_SPI3_IRQ_PRIORITY 10 -#define STM32_SPI_SPI4_IRQ_PRIORITY 10 -#define STM32_SPI_SPI5_IRQ_PRIORITY 10 #define STM32_SPI_DMA_ERROR_HOOK(spip) osalSysHalt("DMA failure") /* @@ -230,23 +220,18 @@ */ #define STM32_UART_USE_USART1 FALSE #define STM32_UART_USE_USART2 FALSE -#define STM32_UART_USE_USART3 FALSE #define STM32_UART_USE_USART6 FALSE #define STM32_UART_USART1_RX_DMA_STREAM STM32_DMA_STREAM_ID(2, 5) #define STM32_UART_USART1_TX_DMA_STREAM STM32_DMA_STREAM_ID(2, 7) #define STM32_UART_USART2_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 5) #define STM32_UART_USART2_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 6) -#define STM32_UART_USART3_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 1) -#define STM32_UART_USART3_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 3) #define STM32_UART_USART6_RX_DMA_STREAM STM32_DMA_STREAM_ID(2, 2) #define STM32_UART_USART6_TX_DMA_STREAM STM32_DMA_STREAM_ID(2, 7) #define STM32_UART_USART1_IRQ_PRIORITY 12 #define STM32_UART_USART2_IRQ_PRIORITY 12 -#define STM32_UART_USART3_IRQ_PRIORITY 12 #define STM32_UART_USART6_IRQ_PRIORITY 12 #define STM32_UART_USART1_DMA_PRIORITY 0 #define STM32_UART_USART2_DMA_PRIORITY 0 -#define STM32_UART_USART3_DMA_PRIORITY 0 #define STM32_UART_USART6_DMA_PRIORITY 0 #define STM32_UART_DMA_ERROR_HOOK(uartp) osalSysHalt("DMA failure") diff --git a/keyboards/matrix/noah/noah.c b/keyboards/matrix/noah/noah.c index 64069148e..cf3340443 100644 --- a/keyboards/matrix/noah/noah.c +++ b/keyboards/matrix/noah/noah.c @@ -50,29 +50,20 @@ void rgblight_set(void) { } #endif -void matrix_scan_kb(void) { matrix_scan_user(); } +void matrix_init_kb(void) { matrix_init_user(); } -void matrix_init_kb(void) { - matrix_init_user(); -} __attribute__((weak)) -void matrix_init_user(void) { -#ifdef RGBLIGHT_ENABLE - rgblight_enable(); -#endif +void matrix_init_user(void) { } -#ifdef RGB_MATRIX_ENABLE - rgb_matrix_disable(); +void matrix_scan_kb(void) { +#ifdef RGBLIGHT_ENABLE + rgblight_task(); #endif + matrix_scan_user(); } __attribute__((weak)) -void matrix_scan_user(void) { -#ifdef RGBLIGHT_ENABLE - rgblight_task(); -#endif -} - +void matrix_scan_user(void) { } #ifdef RGB_MATRIX_ENABLE const is31_led g_is31_leds[DRIVER_LED_TOTAL] = { @@ -184,9 +175,9 @@ led_config_t g_led_config = { { 20, 16},{ 42, 32}, { 45, 16},{ 50, 16},{ 65, 16},{ 80, 16},{ 95, 16},{ 70, 32},{ 84, 32},{ 98, 32}, - { 14, 32},{ 56, 32},{ 50, 48},{ 80, 48},{110, 48},{ 95, 48},{100, 64},{112, 64}, + { 14, 32},{ 56, 32},{ 65, 48},{ 80, 48},{110, 48},{ 95, 48},{112, 64},{100, 64}, { 42, 32},{ 38, 64}, - { 0, 32},{ 10, 48},{ 0, 48},{ 20, 48},{ 35, 48},{ 65, 48},{ 0, 64},{ 19, 64}, + { 0, 32},{ 10, 48},{ 0, 48},{ 20, 48},{ 35, 48},{ 50, 48},{ 0, 64},{ 19, 64}, {105, 0},{120, 0},{135, 0},{150, 0},{165, 0},{180, 0},{202, 0},{224, 0}, {110, 16},{224, 16}, diff --git a/keyboards/matrix/noah/rules.mk b/keyboards/matrix/noah/rules.mk index c24cfd906..80854e67e 100644 --- a/keyboards/matrix/noah/rules.mk +++ b/keyboards/matrix/noah/rules.mk @@ -37,20 +37,18 @@ OPT_DEFS = # comment out to disable the options. # BOOTMAGIC_ENABLE = yes # Virtual DIP switch configuration -MOUSEKEY_ENABLE = no # Mouse keys +MOUSEKEY_ENABLE = yes # Mouse keys EXTRAKEY_ENABLE = yes # Audio control and System control CONSOLE_ENABLE = no # Console for debug COMMAND_ENABLE = no # Commands for debug and configuration NKRO_ENABLE = no # USB Nkey Rollover -NO_USB_STARTUP_CHECK = yes # Disable initialization only when usb is plugged in +NO_USB_STARTUP_CHECK = yes # Disable initialization only when usb is plugged in -CUSTOM_MATRIX = yes RGB_MATRIX_ENABLE = yes RGBLIGHT_ENABLE = yes RGBLIGHT_CUSTOM_DRIVER = yes +CUSTOM_MATRIX = yes # project specific files -SRC += \ - matrix.c \ - ws2812.c +SRC += ws2812.c matrix.c