From 1310837a7b357650b3aad9d43eeb4b225abe78a2 Mon Sep 17 00:00:00 2001 From: fauxpark Date: Wed, 5 Oct 2022 09:36:20 +1100 Subject: [PATCH 1/2] onekey: Enable ADC for STM32F072 Discovery --- keyboards/handwired/onekey/stm32f0_disco/halconf.h | 2 ++ keyboards/handwired/onekey/stm32f0_disco/mcuconf.h | 3 +++ 2 files changed, 5 insertions(+) diff --git a/keyboards/handwired/onekey/stm32f0_disco/halconf.h b/keyboards/handwired/onekey/stm32f0_disco/halconf.h index 78ed6586c844..432c43c6ccac 100644 --- a/keyboards/handwired/onekey/stm32f0_disco/halconf.h +++ b/keyboards/handwired/onekey/stm32f0_disco/halconf.h @@ -21,6 +21,8 @@ #pragma once +#define HAL_USE_ADC TRUE + #define HAL_USE_PWM TRUE #include_next diff --git a/keyboards/handwired/onekey/stm32f0_disco/mcuconf.h b/keyboards/handwired/onekey/stm32f0_disco/mcuconf.h index ea4f9373a0f7..0bb4f4d64313 100644 --- a/keyboards/handwired/onekey/stm32f0_disco/mcuconf.h +++ b/keyboards/handwired/onekey/stm32f0_disco/mcuconf.h @@ -23,5 +23,8 @@ #include_next +#undef STM32_ADC_USE_ADC1 +#define STM32_ADC_USE_ADC1 TRUE + #undef STM32_PWM_USE_TIM3 #define STM32_PWM_USE_TIM3 TRUE From df146de1e9ccbe2e4797c19b675b7ac333e73856 Mon Sep 17 00:00:00 2001 From: fauxpark Date: Wed, 5 Oct 2022 10:25:46 +1100 Subject: [PATCH 2/2] Set DMA stream for ADC1 --- platforms/chibios/boards/GENERIC_STM32_F072XB/configs/mcuconf.h | 1 + 1 file changed, 1 insertion(+) diff --git a/platforms/chibios/boards/GENERIC_STM32_F072XB/configs/mcuconf.h b/platforms/chibios/boards/GENERIC_STM32_F072XB/configs/mcuconf.h index 32b2777a8100..9d26849dffb3 100644 --- a/platforms/chibios/boards/GENERIC_STM32_F072XB/configs/mcuconf.h +++ b/platforms/chibios/boards/GENERIC_STM32_F072XB/configs/mcuconf.h @@ -80,6 +80,7 @@ #define STM32_ADC_ADC1_DMA_PRIORITY 2 #define STM32_ADC_IRQ_PRIORITY 2 #define STM32_ADC_ADC1_DMA_IRQ_PRIORITY 2 +#define STM32_ADC_ADC1_DMA_STREAM STM32_DMA_STREAM_ID(1, 1) /* * GPT driver system settings.