From 3b23b29568faeb3b1cd61d4395d1d66d720907ca Mon Sep 17 00:00:00 2001 From: qianjiuyuan <149981328+heyQianJiu@users.noreply.github.com> Date: Mon, 26 May 2025 12:34:48 +0800 Subject: [PATCH 01/11] [bsp]stm32f103keysking:add uart3 --- bsp/stm32/stm32f103-keysking-learning/.config | 1 + .../stm32f103-keysking-learning/README.md | 14 +++--- .../board/CubeMX_Config/CubeMX_Config.ioc | 21 ++++++--- .../CubeMX_Config/Src/stm32f1xx_hal_msp.c | 47 ++++++++++++++++++- .../stm32f103-keysking-learning/board/Kconfig | 4 +- .../stm32f103-keysking-learning/rtconfig.h | 1 + 6 files changed, 74 insertions(+), 14 deletions(-) diff --git a/bsp/stm32/stm32f103-keysking-learning/.config b/bsp/stm32/stm32f103-keysking-learning/.config index 10ff6177867..76baf338bc7 100644 --- a/bsp/stm32/stm32f103-keysking-learning/.config +++ b/bsp/stm32/stm32f103-keysking-learning/.config @@ -1389,6 +1389,7 @@ CONFIG_BSP_USING_GPIO=y CONFIG_BSP_USING_UART=y CONFIG_BSP_STM32_UART_V1_TX_TIMEOUT=2000 CONFIG_BSP_USING_UART2=y +CONFIG_BSP_USING_UART3=y # CONFIG_BSP_USING_UDID is not set # end of On-chip Peripheral Drivers diff --git a/bsp/stm32/stm32f103-keysking-learning/README.md b/bsp/stm32/stm32f103-keysking-learning/README.md index 3b1e26bedf0..3228dc6b32c 100644 --- a/bsp/stm32/stm32f103-keysking-learning/README.md +++ b/bsp/stm32/stm32f103-keysking-learning/README.md @@ -41,12 +41,12 @@ Keysking学习板是B站UP主Keysking推出的一块基于ARM Cortex-M3内核的 本BSP目前对外设的支持情况如下: -| 板载外设 | 支持情况 | 备注 | -| -------- |:--------:| ------- | -| USB转串口 | 支持 | UART2 | -| **片上外设** | **支持情况** | **备注** | -| GPIO | 支持 | | -| UART | 支持 | UART1,2 | +| 板载外设 | 支持情况 | 备注 | +| -------- |:--------:| ----------- | +| USB转串口 | 支持 | UART2 | +| **片上外设** | **支持情况** | **备注** | +| GPIO | 支持 | | +| UART | 支持 | UART2,3 | ## 使用说明 @@ -121,3 +121,5 @@ STM32F103C8T6的Flash在官方文档中的大小是64KB,但是其实该芯片 维护人: * qianjiuyuan, 邮箱:<3211471056@qq.com> + + diff --git a/bsp/stm32/stm32f103-keysking-learning/board/CubeMX_Config/CubeMX_Config.ioc b/bsp/stm32/stm32f103-keysking-learning/board/CubeMX_Config/CubeMX_Config.ioc index 110cf73b9c0..d00f61a24d6 100644 --- a/bsp/stm32/stm32f103-keysking-learning/board/CubeMX_Config/CubeMX_Config.ioc +++ b/bsp/stm32/stm32f103-keysking-learning/board/CubeMX_Config/CubeMX_Config.ioc @@ -11,19 +11,22 @@ Mcu.IP0=NVIC Mcu.IP1=RCC Mcu.IP2=SYS Mcu.IP3=USART2 -Mcu.IPNb=4 +Mcu.IP4=USART3 +Mcu.IPNb=5 Mcu.Name=STM32F103C(8-B)Tx Mcu.Package=LQFP48 Mcu.Pin0=PC14-OSC32_IN Mcu.Pin1=PC15-OSC32_OUT +Mcu.Pin10=VP_SYS_VS_Systick Mcu.Pin2=PD0-OSC_IN Mcu.Pin3=PD1-OSC_OUT Mcu.Pin4=PA2 Mcu.Pin5=PA3 -Mcu.Pin6=PA13 -Mcu.Pin7=PA14 -Mcu.Pin8=VP_SYS_VS_Systick -Mcu.PinsNb=9 +Mcu.Pin6=PB10 +Mcu.Pin7=PB11 +Mcu.Pin8=PA13 +Mcu.Pin9=PA14 +Mcu.PinsNb=11 Mcu.ThirdPartyNb=0 Mcu.UserConstants= Mcu.UserName=STM32F103C8Tx @@ -52,6 +55,10 @@ PA3.GPIOParameters=GPIO_PuPd PA3.GPIO_PuPd=GPIO_PULLUP PA3.Mode=Asynchronous PA3.Signal=USART2_RX +PB10.Mode=Asynchronous +PB10.Signal=USART3_TX +PB11.Mode=Asynchronous +PB11.Signal=USART3_RX PC14-OSC32_IN.Mode=LSE-External-Oscillator PC14-OSC32_IN.Signal=RCC_OSC32_IN PC15-OSC32_OUT.Mode=LSE-External-Oscillator @@ -91,7 +98,7 @@ ProjectManager.ToolChainLocation= ProjectManager.UAScriptAfterPath= ProjectManager.UAScriptBeforePath= ProjectManager.UnderRoot=false -ProjectManager.functionlistsort=1-MX_GPIO_Init-GPIO-false-HAL-true,2-SystemClock_Config-RCC-false-HAL-false,3-MX_USART2_UART_Init-USART2-false-HAL-true +ProjectManager.functionlistsort=1-MX_GPIO_Init-GPIO-false-HAL-true,2-SystemClock_Config-RCC-false-HAL-false,3-MX_USART2_UART_Init-USART2-false-HAL-true,4-MX_USART1_UART_Init-USART1-false-HAL-true,5-MX_USART3_UART_Init-USART3-false-HAL-true RCC.ADCFreqValue=12000000 RCC.ADCPresc=RCC_ADCPCLK2_DIV6 RCC.AHBFreq_Value=72000000 @@ -117,6 +124,8 @@ RCC.USBPrescaler=RCC_USBCLKSOURCE_PLL_DIV1_5 RCC.VCOOutput2Freq_Value=8000000 USART2.IPParameters=VirtualMode USART2.VirtualMode=VM_ASYNC +USART3.IPParameters=VirtualMode +USART3.VirtualMode=VM_ASYNC VP_SYS_VS_Systick.Mode=SysTick VP_SYS_VS_Systick.Signal=SYS_VS_Systick board=custom diff --git a/bsp/stm32/stm32f103-keysking-learning/board/CubeMX_Config/Src/stm32f1xx_hal_msp.c b/bsp/stm32/stm32f103-keysking-learning/board/CubeMX_Config/Src/stm32f1xx_hal_msp.c index 4b76386bac6..f40a8b078b8 100644 --- a/bsp/stm32/stm32f103-keysking-learning/board/CubeMX_Config/Src/stm32f1xx_hal_msp.c +++ b/bsp/stm32/stm32f103-keysking-learning/board/CubeMX_Config/Src/stm32f1xx_hal_msp.c @@ -20,7 +20,7 @@ /* USER CODE END Header */ /* Includes ------------------------------------------------------------------*/ -// #include "main.h" +#include "main.h" /* USER CODE BEGIN Includes */ #include /* USER CODE END Includes */ @@ -117,6 +117,33 @@ void HAL_UART_MspInit(UART_HandleTypeDef* huart) /* USER CODE END USART2_MspInit 1 */ } + else if(huart->Instance==USART3) + { + /* USER CODE BEGIN USART3_MspInit 0 */ + + /* USER CODE END USART3_MspInit 0 */ + /* Peripheral clock enable */ + __HAL_RCC_USART3_CLK_ENABLE(); + + __HAL_RCC_GPIOB_CLK_ENABLE(); + /**USART3 GPIO Configuration + PB10 ------> USART3_TX + PB11 ------> USART3_RX + */ + GPIO_InitStruct.Pin = GPIO_PIN_10; + GPIO_InitStruct.Mode = GPIO_MODE_AF_PP; + GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH; + HAL_GPIO_Init(GPIOB, &GPIO_InitStruct); + + GPIO_InitStruct.Pin = GPIO_PIN_11; + GPIO_InitStruct.Mode = GPIO_MODE_INPUT; + GPIO_InitStruct.Pull = GPIO_NOPULL; + HAL_GPIO_Init(GPIOB, &GPIO_InitStruct); + + /* USER CODE BEGIN USART3_MspInit 1 */ + + /* USER CODE END USART3_MspInit 1 */ + } } @@ -146,6 +173,24 @@ void HAL_UART_MspDeInit(UART_HandleTypeDef* huart) /* USER CODE END USART2_MspDeInit 1 */ } + else if(huart->Instance==USART3) + { + /* USER CODE BEGIN USART3_MspDeInit 0 */ + + /* USER CODE END USART3_MspDeInit 0 */ + /* Peripheral clock disable */ + __HAL_RCC_USART3_CLK_DISABLE(); + + /**USART3 GPIO Configuration + PB10 ------> USART3_TX + PB11 ------> USART3_RX + */ + HAL_GPIO_DeInit(GPIOB, GPIO_PIN_10|GPIO_PIN_11); + + /* USER CODE BEGIN USART3_MspDeInit 1 */ + + /* USER CODE END USART3_MspDeInit 1 */ + } } diff --git a/bsp/stm32/stm32f103-keysking-learning/board/Kconfig b/bsp/stm32/stm32f103-keysking-learning/board/Kconfig index ee4349ab832..20deaca0971 100644 --- a/bsp/stm32/stm32f103-keysking-learning/board/Kconfig +++ b/bsp/stm32/stm32f103-keysking-learning/board/Kconfig @@ -23,7 +23,6 @@ menu "On-chip Peripheral Drivers" select RT_USING_SERIAL if BSP_USING_UART - config BSP_STM32_UART_V1_TX_TIMEOUT int "UART TX timeout" default 2000 @@ -31,6 +30,9 @@ menu "On-chip Peripheral Drivers" config BSP_USING_UART2 bool "Enable UART2" default y + config BSP_USING_UART3 + bool "Enable UART3" + default y #config BSP_UART2_RX_USING_DMA # bool "Enable UART2 RX DMA" diff --git a/bsp/stm32/stm32f103-keysking-learning/rtconfig.h b/bsp/stm32/stm32f103-keysking-learning/rtconfig.h index 67e49e18632..567b43898ea 100644 --- a/bsp/stm32/stm32f103-keysking-learning/rtconfig.h +++ b/bsp/stm32/stm32f103-keysking-learning/rtconfig.h @@ -411,6 +411,7 @@ #define BSP_USING_UART #define BSP_STM32_UART_V1_TX_TIMEOUT 2000 #define BSP_USING_UART2 +#define BSP_USING_UART3 /* end of On-chip Peripheral Drivers */ /* Board extended module Drivers */ From 0a0378217e2ecd00b3103fbed86e727f13188720 Mon Sep 17 00:00:00 2001 From: qianjiuyuan <149981328+heyQianJiu@users.noreply.github.com> Date: Tue, 27 May 2025 17:21:45 +0800 Subject: [PATCH 02/11] =?UTF-8?q?[bsp]stm32f103-keysking=20pwm=E9=A9=B1?= =?UTF-8?q?=E5=8A=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../.ci/attachconfig/ci.attachconfig.yml | 9 +- bsp/stm32/stm32f103-keysking-learning/.config | 6 +- .../stm32f103-keysking-learning/README.md | 16 +-- .../board/CubeMX_Config/CubeMX_Config.ioc | 53 +++++++-- .../CubeMX_Config/Inc/stm32f1xx_hal_conf.h | 2 +- .../CubeMX_Config/Src/stm32f1xx_hal_msp.c | 112 +++++++++++++++++- .../stm32f103-keysking-learning/rtconfig.h | 4 + 7 files changed, 175 insertions(+), 27 deletions(-) diff --git a/bsp/stm32/stm32f103-keysking-learning/.ci/attachconfig/ci.attachconfig.yml b/bsp/stm32/stm32f103-keysking-learning/.ci/attachconfig/ci.attachconfig.yml index ad74d731f5e..84658cffd61 100644 --- a/bsp/stm32/stm32f103-keysking-learning/.ci/attachconfig/ci.attachconfig.yml +++ b/bsp/stm32/stm32f103-keysking-learning/.ci/attachconfig/ci.attachconfig.yml @@ -5,12 +5,13 @@ system.use_nano: <<: *scons kconfig: CONFIG_RT_USING_NANO=y -devices.gpio: +devices.uart: <<: *scons kconfig: - CONFIG_BSP_USING_GPIO=y -devices.uart: + - CONFIG_BSP_USING_UART=y + - CONFIG_USING_SERIAL=y +devices.servo: <<: *scons kconfig: - - CONFIG_BSP_USING_UART=y - - CONFIG_USING_SERIAL=y \ No newline at end of file + - CONFIG_BSP_USING_SERVO=y diff --git a/bsp/stm32/stm32f103-keysking-learning/.config b/bsp/stm32/stm32f103-keysking-learning/.config index 76baf338bc7..3087fc9e72e 100644 --- a/bsp/stm32/stm32f103-keysking-learning/.config +++ b/bsp/stm32/stm32f103-keysking-learning/.config @@ -252,7 +252,7 @@ CONFIG_RT_SERIAL_RB_BUFSZ=64 # CONFIG_RT_USING_NULL is not set # CONFIG_RT_USING_ZERO is not set # CONFIG_RT_USING_RANDOM is not set -# CONFIG_RT_USING_PWM is not set +CONFIG_RT_USING_PWM=y # CONFIG_RT_USING_PULSE_ENCODER is not set # CONFIG_RT_USING_INPUT_CAPTURE is not set # CONFIG_RT_USING_MTD_NOR is not set @@ -1380,6 +1380,7 @@ CONFIG_SOC_SERIES_STM32F1=y # Onboard Peripheral Drivers # CONFIG_BSP_USING_USB_TO_USART=y +# CONFIG_BSP_USING_SERVO is not set # end of Onboard Peripheral Drivers # @@ -1390,6 +1391,9 @@ CONFIG_BSP_USING_UART=y CONFIG_BSP_STM32_UART_V1_TX_TIMEOUT=2000 CONFIG_BSP_USING_UART2=y CONFIG_BSP_USING_UART3=y +CONFIG_BSP_USING_PWM=y +CONFIG_BSP_USING_PWM3=y +# CONFIG_BSP_USING_PWM4 is not set # CONFIG_BSP_USING_UDID is not set # end of On-chip Peripheral Drivers diff --git a/bsp/stm32/stm32f103-keysking-learning/README.md b/bsp/stm32/stm32f103-keysking-learning/README.md index 3228dc6b32c..8c353f02d72 100644 --- a/bsp/stm32/stm32f103-keysking-learning/README.md +++ b/bsp/stm32/stm32f103-keysking-learning/README.md @@ -41,12 +41,14 @@ Keysking学习板是B站UP主Keysking推出的一块基于ARM Cortex-M3内核的 本BSP目前对外设的支持情况如下: -| 板载外设 | 支持情况 | 备注 | -| -------- |:--------:| ----------- | -| USB转串口 | 支持 | UART2 | -| **片上外设** | **支持情况** | **备注** | -| GPIO | 支持 | | -| UART | 支持 | UART2,3 | +| 板载外设 | 支持情况 | 备注 | +| -------- |:--------:| -------------- | +| USB转串口 | 支持 | UART2(用作finsh) | +| 舵机 | 支持 | PWM4CH3 | +| **片上外设** | **支持情况** | **备注** | +| GPIO | 支持 | | +| UART | 支持 | UART2,3 | +| PWM | 支持 | PWM3,PWM4 | ## 使用说明 @@ -121,5 +123,3 @@ STM32F103C8T6的Flash在官方文档中的大小是64KB,但是其实该芯片 维护人: * qianjiuyuan, 邮箱:<3211471056@qq.com> - - diff --git a/bsp/stm32/stm32f103-keysking-learning/board/CubeMX_Config/CubeMX_Config.ioc b/bsp/stm32/stm32f103-keysking-learning/board/CubeMX_Config/CubeMX_Config.ioc index d00f61a24d6..6726b584bba 100644 --- a/bsp/stm32/stm32f103-keysking-learning/board/CubeMX_Config/CubeMX_Config.ioc +++ b/bsp/stm32/stm32f103-keysking-learning/board/CubeMX_Config/CubeMX_Config.ioc @@ -10,23 +10,30 @@ Mcu.Family=STM32F1 Mcu.IP0=NVIC Mcu.IP1=RCC Mcu.IP2=SYS -Mcu.IP3=USART2 -Mcu.IP4=USART3 -Mcu.IPNb=5 +Mcu.IP3=TIM3 +Mcu.IP4=TIM4 +Mcu.IP5=USART2 +Mcu.IP6=USART3 +Mcu.IPNb=7 Mcu.Name=STM32F103C(8-B)Tx Mcu.Package=LQFP48 Mcu.Pin0=PC14-OSC32_IN Mcu.Pin1=PC15-OSC32_OUT -Mcu.Pin10=VP_SYS_VS_Systick +Mcu.Pin10=PA13 +Mcu.Pin11=PA14 +Mcu.Pin12=PB8 +Mcu.Pin13=VP_SYS_VS_Systick +Mcu.Pin14=VP_TIM3_VS_ClockSourceINT +Mcu.Pin15=VP_TIM4_VS_ClockSourceINT Mcu.Pin2=PD0-OSC_IN Mcu.Pin3=PD1-OSC_OUT Mcu.Pin4=PA2 Mcu.Pin5=PA3 -Mcu.Pin6=PB10 -Mcu.Pin7=PB11 -Mcu.Pin8=PA13 -Mcu.Pin9=PA14 -Mcu.PinsNb=11 +Mcu.Pin6=PA6 +Mcu.Pin7=PB10 +Mcu.Pin8=PB11 +Mcu.Pin9=PA8 +Mcu.PinsNb=16 Mcu.ThirdPartyNb=0 Mcu.UserConstants= Mcu.UserName=STM32F103C8Tx @@ -55,10 +62,16 @@ PA3.GPIOParameters=GPIO_PuPd PA3.GPIO_PuPd=GPIO_PULLUP PA3.Mode=Asynchronous PA3.Signal=USART2_RX +PA6.Locked=true +PA6.Signal=S_TIM3_CH1 +PA8.Mode=Clock-out +PA8.Signal=RCC_MCO PB10.Mode=Asynchronous PB10.Signal=USART3_TX PB11.Mode=Asynchronous PB11.Signal=USART3_RX +PB8.Locked=true +PB8.Signal=S_TIM4_CH3 PC14-OSC32_IN.Mode=LSE-External-Oscillator PC14-OSC32_IN.Signal=RCC_OSC32_IN PC15-OSC32_OUT.Mode=LSE-External-Oscillator @@ -98,7 +111,7 @@ ProjectManager.ToolChainLocation= ProjectManager.UAScriptAfterPath= ProjectManager.UAScriptBeforePath= ProjectManager.UnderRoot=false -ProjectManager.functionlistsort=1-MX_GPIO_Init-GPIO-false-HAL-true,2-SystemClock_Config-RCC-false-HAL-false,3-MX_USART2_UART_Init-USART2-false-HAL-true,4-MX_USART1_UART_Init-USART1-false-HAL-true,5-MX_USART3_UART_Init-USART3-false-HAL-true +ProjectManager.functionlistsort=1-MX_GPIO_Init-GPIO-false-HAL-true,2-SystemClock_Config-RCC-false-HAL-false,3-MX_USART2_UART_Init-USART2-false-HAL-true,4-MX_USART3_UART_Init-USART3-false-HAL-true,5-MX_TIM3_Init-TIM3-false-HAL-true RCC.ADCFreqValue=12000000 RCC.ADCPresc=RCC_ADCPCLK2_DIV6 RCC.AHBFreq_Value=72000000 @@ -110,22 +123,38 @@ RCC.APB2TimFreq_Value=72000000 RCC.FCLKCortexFreq_Value=72000000 RCC.FamilyName=M RCC.HCLKFreq_Value=72000000 -RCC.IPParameters=ADCFreqValue,ADCPresc,AHBFreq_Value,APB1CLKDivider,APB1Freq_Value,APB1TimFreq_Value,APB2Freq_Value,APB2TimFreq_Value,FCLKCortexFreq_Value,FamilyName,HCLKFreq_Value,MCOFreq_Value,PLLCLKFreq_Value,PLLMCOFreq_Value,PLLMUL,PLLSourceVirtual,SYSCLKFreq_VALUE,SYSCLKSource,TimSysFreq_Value,USBFreq_Value,USBPrescaler,VCOOutput2Freq_Value -RCC.MCOFreq_Value=72000000 +RCC.IPParameters=ADCFreqValue,ADCPresc,AHBFreq_Value,APB1CLKDivider,APB1Freq_Value,APB1TimFreq_Value,APB2Freq_Value,APB2TimFreq_Value,FCLKCortexFreq_Value,FamilyName,HCLKFreq_Value,MCOFreq_Value,PLLCLKFreq_Value,PLLMCOFreq_Value,PLLMUL,PLLSourceVirtual,RCC_MCOSource,SYSCLKFreq_VALUE,SYSCLKSource,TimSysFreq_Value,USBFreq_Value,USBPrescaler,VCOOutput2Freq_Value +RCC.MCOFreq_Value=36000000 RCC.PLLCLKFreq_Value=72000000 RCC.PLLMCOFreq_Value=36000000 RCC.PLLMUL=RCC_PLL_MUL9 RCC.PLLSourceVirtual=RCC_PLLSOURCE_HSE +RCC.RCC_MCOSource=RCC_MCO1SOURCE_PLLCLK RCC.SYSCLKFreq_VALUE=72000000 RCC.SYSCLKSource=RCC_SYSCLKSOURCE_PLLCLK RCC.TimSysFreq_Value=72000000 RCC.USBFreq_Value=48000000 RCC.USBPrescaler=RCC_USBCLKSOURCE_PLL_DIV1_5 RCC.VCOOutput2Freq_Value=8000000 +SH.S_TIM3_CH1.0=TIM3_CH1,PWM Generation1 CH1 +SH.S_TIM3_CH1.ConfNb=1 +SH.S_TIM4_CH3.0=TIM4_CH3,PWM Generation3 CH3 +SH.S_TIM4_CH3.ConfNb=1 +TIM3.Channel-PWM\ Generation1\ CH1=TIM_CHANNEL_1 +TIM3.IPParameters=Channel-PWM Generation1 CH1,Prescaler,Period,Pulse-PWM Generation1 CH1 +TIM3.Period=10000-1 +TIM3.Prescaler=7200-1 +TIM3.Pulse-PWM\ Generation1\ CH1=50 +TIM4.Channel-PWM\ Generation3\ CH3=TIM_CHANNEL_3 +TIM4.IPParameters=Channel-PWM Generation3 CH3 USART2.IPParameters=VirtualMode USART2.VirtualMode=VM_ASYNC USART3.IPParameters=VirtualMode USART3.VirtualMode=VM_ASYNC VP_SYS_VS_Systick.Mode=SysTick VP_SYS_VS_Systick.Signal=SYS_VS_Systick +VP_TIM3_VS_ClockSourceINT.Mode=Internal +VP_TIM3_VS_ClockSourceINT.Signal=TIM3_VS_ClockSourceINT +VP_TIM4_VS_ClockSourceINT.Mode=Internal +VP_TIM4_VS_ClockSourceINT.Signal=TIM4_VS_ClockSourceINT board=custom diff --git a/bsp/stm32/stm32f103-keysking-learning/board/CubeMX_Config/Inc/stm32f1xx_hal_conf.h b/bsp/stm32/stm32f103-keysking-learning/board/CubeMX_Config/Inc/stm32f1xx_hal_conf.h index a0fcf27f579..705db016ae6 100644 --- a/bsp/stm32/stm32f103-keysking-learning/board/CubeMX_Config/Inc/stm32f1xx_hal_conf.h +++ b/bsp/stm32/stm32f103-keysking-learning/board/CubeMX_Config/Inc/stm32f1xx_hal_conf.h @@ -64,7 +64,7 @@ /*#define HAL_SMARTCARD_MODULE_ENABLED */ /*#define HAL_SPI_MODULE_ENABLED */ /*#define HAL_SRAM_MODULE_ENABLED */ -/*#define HAL_TIM_MODULE_ENABLED */ +#define HAL_TIM_MODULE_ENABLED #define HAL_UART_MODULE_ENABLED /*#define HAL_USART_MODULE_ENABLED */ /*#define HAL_WWDG_MODULE_ENABLED */ diff --git a/bsp/stm32/stm32f103-keysking-learning/board/CubeMX_Config/Src/stm32f1xx_hal_msp.c b/bsp/stm32/stm32f103-keysking-learning/board/CubeMX_Config/Src/stm32f1xx_hal_msp.c index f40a8b078b8..a99c2d378b0 100644 --- a/bsp/stm32/stm32f103-keysking-learning/board/CubeMX_Config/Src/stm32f1xx_hal_msp.c +++ b/bsp/stm32/stm32f103-keysking-learning/board/CubeMX_Config/Src/stm32f1xx_hal_msp.c @@ -58,7 +58,9 @@ /* USER CODE BEGIN 0 */ /* USER CODE END 0 */ -/** + +void HAL_TIM_MspPostInit(TIM_HandleTypeDef *htim); + /** * Initializes the Global MSP. */ void HAL_MspInit(void) @@ -81,6 +83,114 @@ void HAL_MspInit(void) /* USER CODE END MspInit 1 */ } +/** +* @brief TIM_Base MSP Initialization +* This function configures the hardware resources used in this example +* @param htim_base: TIM_Base handle pointer +* @retval None +*/ +void HAL_TIM_Base_MspInit(TIM_HandleTypeDef* htim_base) +{ + if(htim_base->Instance==TIM3) + { + /* USER CODE BEGIN TIM3_MspInit 0 */ + + /* USER CODE END TIM3_MspInit 0 */ + /* Peripheral clock enable */ + __HAL_RCC_TIM3_CLK_ENABLE(); + /* USER CODE BEGIN TIM3_MspInit 1 */ + + /* USER CODE END TIM3_MspInit 1 */ + } + else if(htim_base->Instance==TIM4) + { + /* USER CODE BEGIN TIM4_MspInit 0 */ + + /* USER CODE END TIM4_MspInit 0 */ + /* Peripheral clock enable */ + __HAL_RCC_TIM4_CLK_ENABLE(); + /* USER CODE BEGIN TIM4_MspInit 1 */ + + /* USER CODE END TIM4_MspInit 1 */ + } + +} + +void HAL_TIM_MspPostInit(TIM_HandleTypeDef* htim) +{ + GPIO_InitTypeDef GPIO_InitStruct = {0}; + if(htim->Instance==TIM3) + { + /* USER CODE BEGIN TIM3_MspPostInit 0 */ + + /* USER CODE END TIM3_MspPostInit 0 */ + __HAL_RCC_GPIOA_CLK_ENABLE(); + /**TIM3 GPIO Configuration + PA6 ------> TIM3_CH1 + */ + GPIO_InitStruct.Pin = GPIO_PIN_6; + GPIO_InitStruct.Mode = GPIO_MODE_AF_PP; + GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW; + HAL_GPIO_Init(GPIOA, &GPIO_InitStruct); + + /* USER CODE BEGIN TIM3_MspPostInit 1 */ + + /* USER CODE END TIM3_MspPostInit 1 */ + } + else if(htim->Instance==TIM4) + { + /* USER CODE BEGIN TIM4_MspPostInit 0 */ + + /* USER CODE END TIM4_MspPostInit 0 */ + + __HAL_RCC_GPIOB_CLK_ENABLE(); + /**TIM4 GPIO Configuration + PB8 ------> TIM4_CH3 + */ + GPIO_InitStruct.Pin = GPIO_PIN_8; + GPIO_InitStruct.Mode = GPIO_MODE_AF_PP; + GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW; + HAL_GPIO_Init(GPIOB, &GPIO_InitStruct); + + /* USER CODE BEGIN TIM4_MspPostInit 1 */ + + /* USER CODE END TIM4_MspPostInit 1 */ + } + +} +/** +* @brief TIM_Base MSP De-Initialization +* This function freeze the hardware resources used in this example +* @param htim_base: TIM_Base handle pointer +* @retval None +*/ +void HAL_TIM_Base_MspDeInit(TIM_HandleTypeDef* htim_base) +{ + if(htim_base->Instance==TIM3) + { + /* USER CODE BEGIN TIM3_MspDeInit 0 */ + + /* USER CODE END TIM3_MspDeInit 0 */ + /* Peripheral clock disable */ + __HAL_RCC_TIM3_CLK_DISABLE(); + /* USER CODE BEGIN TIM3_MspDeInit 1 */ + + /* USER CODE END TIM3_MspDeInit 1 */ + } + else if(htim_base->Instance==TIM4) + { + /* USER CODE BEGIN TIM4_MspDeInit 0 */ + + /* USER CODE END TIM4_MspDeInit 0 */ + /* Peripheral clock disable */ + __HAL_RCC_TIM4_CLK_DISABLE(); + /* USER CODE BEGIN TIM4_MspDeInit 1 */ + + /* USER CODE END TIM4_MspDeInit 1 */ + } + +} + /** * @brief UART MSP Initialization * This function configures the hardware resources used in this example diff --git a/bsp/stm32/stm32f103-keysking-learning/rtconfig.h b/bsp/stm32/stm32f103-keysking-learning/rtconfig.h index 567b43898ea..568316e766b 100644 --- a/bsp/stm32/stm32f103-keysking-learning/rtconfig.h +++ b/bsp/stm32/stm32f103-keysking-learning/rtconfig.h @@ -148,6 +148,7 @@ #define RT_USING_SERIAL_V1 #define RT_SERIAL_USING_DMA #define RT_SERIAL_RB_BUFSZ 64 +#define RT_USING_PWM #define RT_USING_PIN /* end of Device Drivers */ @@ -412,6 +413,9 @@ #define BSP_STM32_UART_V1_TX_TIMEOUT 2000 #define BSP_USING_UART2 #define BSP_USING_UART3 +#define BSP_USING_PWM +#define BSP_USING_PWM3 +#define BSP_USING_PWM3_CH1 /* end of On-chip Peripheral Drivers */ /* Board extended module Drivers */ From 825140bc11c7ad94a5c524b7750735ffb4b4e05a Mon Sep 17 00:00:00 2001 From: qianjiuyuan <149981328+heyQianJiu@users.noreply.github.com> Date: Tue, 27 May 2025 23:54:39 +0800 Subject: [PATCH 03/11] =?UTF-8?q?[bsp]stm32f103-keysking=20pulse=20encoder?= =?UTF-8?q?=E8=AE=BE=E5=A4=87=E9=A9=B1=E5=8A=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../.ci/attachconfig/ci.attachconfig.yml | 5 ++ bsp/stm32/stm32f103-keysking-learning/.config | 7 +- .../stm32f103-keysking-learning/README.md | 24 ++++--- .../board/CubeMX_Config/.mxproject | 4 +- .../board/CubeMX_Config/CubeMX_Config.ioc | 45 ++++++++----- .../CubeMX_Config/Src/stm32f1xx_hal_msp.c | 66 ++++++++++++++++++- .../stm32f103-keysking-learning/board/Kconfig | 63 ++++++++++++++++++ .../stm32f103-keysking-learning/rtconfig.h | 1 + 8 files changed, 185 insertions(+), 30 deletions(-) diff --git a/bsp/stm32/stm32f103-keysking-learning/.ci/attachconfig/ci.attachconfig.yml b/bsp/stm32/stm32f103-keysking-learning/.ci/attachconfig/ci.attachconfig.yml index 84658cffd61..b1121f38569 100644 --- a/bsp/stm32/stm32f103-keysking-learning/.ci/attachconfig/ci.attachconfig.yml +++ b/bsp/stm32/stm32f103-keysking-learning/.ci/attachconfig/ci.attachconfig.yml @@ -15,3 +15,8 @@ devices.servo: <<: *scons kconfig: - CONFIG_BSP_USING_SERVO=y +devices.pulse_encoder: + <<: *scons + kconfig: + - CONFIG_BSP_USING_PULSE_ENCODER=y + - CONFIG_BSP_USING_PULSE_ENCODER1=y diff --git a/bsp/stm32/stm32f103-keysking-learning/.config b/bsp/stm32/stm32f103-keysking-learning/.config index 3087fc9e72e..7eabaa7c1de 100644 --- a/bsp/stm32/stm32f103-keysking-learning/.config +++ b/bsp/stm32/stm32f103-keysking-learning/.config @@ -253,7 +253,7 @@ CONFIG_RT_SERIAL_RB_BUFSZ=64 # CONFIG_RT_USING_ZERO is not set # CONFIG_RT_USING_RANDOM is not set CONFIG_RT_USING_PWM=y -# CONFIG_RT_USING_PULSE_ENCODER is not set +CONFIG_RT_USING_PULSE_ENCODER=y # CONFIG_RT_USING_INPUT_CAPTURE is not set # CONFIG_RT_USING_MTD_NOR is not set # CONFIG_RT_USING_MTD_NAND is not set @@ -1393,7 +1393,12 @@ CONFIG_BSP_USING_UART2=y CONFIG_BSP_USING_UART3=y CONFIG_BSP_USING_PWM=y CONFIG_BSP_USING_PWM3=y +CONFIG_BSP_USING_PWM3_CH1=y +# CONFIG_BSP_USING_PWM3_CH2 is not set +# CONFIG_BSP_USING_PWM3_CH3 is not set +# CONFIG_BSP_USING_PWM3_CH4 is not set # CONFIG_BSP_USING_PWM4 is not set +# CONFIG_BSP_USING_PULSE_ENCODER is not set # CONFIG_BSP_USING_UDID is not set # end of On-chip Peripheral Drivers diff --git a/bsp/stm32/stm32f103-keysking-learning/README.md b/bsp/stm32/stm32f103-keysking-learning/README.md index 8c353f02d72..84f38fc1328 100644 --- a/bsp/stm32/stm32f103-keysking-learning/README.md +++ b/bsp/stm32/stm32f103-keysking-learning/README.md @@ -41,15 +41,19 @@ Keysking学习板是B站UP主Keysking推出的一块基于ARM Cortex-M3内核的 本BSP目前对外设的支持情况如下: -| 板载外设 | 支持情况 | 备注 | -| -------- |:--------:| -------------- | -| USB转串口 | 支持 | UART2(用作finsh) | -| 舵机 | 支持 | PWM4CH3 | -| **片上外设** | **支持情况** | **备注** | -| GPIO | 支持 | | -| UART | 支持 | UART2,3 | -| PWM | 支持 | PWM3,PWM4 | - +| 板载外设 | 支持情况 | 备注 | +|------------|:--------:|--------------------------------------------| +| USB转串口 | 支持 | UART2(用作finsh) | +| 旋转编码器 | 支持 | A相(PA8),B相(PA9),按键(PB15) | +| OLED | | | +| LED | 支持 | GPIO or PWM: Blue(PA6),Green(PA7),Red(PB0) | +| **片上外设** | **支持情况** | **备注** | +| GPIO | 支持 | | +| UART | 支持 | UART2,3 | +| PWM | 支持 | PWM3,PWM4 | +| **预留外设接口** | **支持情况** | **备注** | +| SERVO | 支持 | PWM4_CH3 | +| 无源蜂鸣器 | 支持 | PWM4_CH4 | ## 使用说明 使用说明分为如下两个章节: @@ -122,4 +126,4 @@ STM32F103C8T6的Flash在官方文档中的大小是64KB,但是其实该芯片 维护人: -* qianjiuyuan, 邮箱:<3211471056@qq.com> +* qianjiuyuan, 邮箱: diff --git a/bsp/stm32/stm32f103-keysking-learning/board/CubeMX_Config/.mxproject b/bsp/stm32/stm32f103-keysking-learning/board/CubeMX_Config/.mxproject index 6445cb89afa..f3c11fac742 100644 --- a/bsp/stm32/stm32f103-keysking-learning/board/CubeMX_Config/.mxproject +++ b/bsp/stm32/stm32f103-keysking-learning/board/CubeMX_Config/.mxproject @@ -1,8 +1,8 @@ [PreviousLibFiles] -LibFiles=Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_tim.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_tim_ex.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_uart.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_ll_usart.h;Drivers\STM32F1xx_HAL_Driver\Inc\Legacy\stm32_hal_legacy.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_def.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_rcc.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_rcc_ex.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_ll_bus.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_ll_rcc.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_ll_system.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_ll_utils.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_gpio.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_gpio_ex.h;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_gpio_ex.c;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_ll_gpio.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_dma_ex.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_dma.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_ll_dma.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_cortex.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_ll_cortex.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_pwr.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_ll_pwr.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_flash.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_flash_ex.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_exti.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_ll_exti.h;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_tim.c;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_tim_ex.c;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_uart.c;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal.c;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_rcc.c;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_rcc_ex.c;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_gpio.c;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_dma.c;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_cortex.c;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_pwr.c;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_flash.c;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_flash_ex.c;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_exti.c;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_tim.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_tim_ex.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_uart.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_ll_usart.h;Drivers\STM32F1xx_HAL_Driver\Inc\Legacy\stm32_hal_legacy.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_def.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_rcc.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_rcc_ex.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_ll_bus.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_ll_rcc.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_ll_system.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_ll_utils.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_gpio.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_gpio_ex.h;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_gpio_ex.c;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_ll_gpio.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_dma_ex.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_dma.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_ll_dma.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_cortex.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_ll_cortex.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_pwr.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_ll_pwr.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_flash.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_flash_ex.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_exti.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_ll_exti.h;Drivers\CMSIS\Device\ST\STM32F1xx\Include\stm32f103xb.h;Drivers\CMSIS\Device\ST\STM32F1xx\Include\stm32f1xx.h;Drivers\CMSIS\Device\ST\STM32F1xx\Include\system_stm32f1xx.h;Drivers\CMSIS\Device\ST\STM32F1xx\Include\system_stm32f1xx.h;Drivers\CMSIS\Device\ST\STM32F1xx\Source\Templates\system_stm32f1xx.c;Drivers\CMSIS\Include\cmsis_armcc.h;Drivers\CMSIS\Include\cmsis_armclang.h;Drivers\CMSIS\Include\cmsis_compiler.h;Drivers\CMSIS\Include\cmsis_gcc.h;Drivers\CMSIS\Include\cmsis_iccarm.h;Drivers\CMSIS\Include\cmsis_version.h;Drivers\CMSIS\Include\core_armv8mbl.h;Drivers\CMSIS\Include\core_armv8mml.h;Drivers\CMSIS\Include\core_cm0.h;Drivers\CMSIS\Include\core_cm0plus.h;Drivers\CMSIS\Include\core_cm1.h;Drivers\CMSIS\Include\core_cm23.h;Drivers\CMSIS\Include\core_cm3.h;Drivers\CMSIS\Include\core_cm33.h;Drivers\CMSIS\Include\core_cm4.h;Drivers\CMSIS\Include\core_cm7.h;Drivers\CMSIS\Include\core_sc000.h;Drivers\CMSIS\Include\core_sc300.h;Drivers\CMSIS\Include\mpu_armv7.h;Drivers\CMSIS\Include\mpu_armv8.h;Drivers\CMSIS\Include\tz_context.h; +LibFiles=Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_tim.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_tim_ex.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_ll_tim.h;Drivers\STM32F1xx_HAL_Driver\Inc\Legacy\stm32_hal_legacy.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_def.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_rcc.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_rcc_ex.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_ll_bus.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_ll_rcc.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_ll_system.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_ll_utils.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_gpio.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_gpio_ex.h;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_gpio_ex.c;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_ll_gpio.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_dma_ex.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_dma.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_ll_dma.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_cortex.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_ll_cortex.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_pwr.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_ll_pwr.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_flash.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_flash_ex.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_exti.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_ll_exti.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_uart.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_ll_usart.h;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_tim.c;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_tim_ex.c;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal.c;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_rcc.c;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_rcc_ex.c;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_gpio.c;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_dma.c;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_cortex.c;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_pwr.c;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_flash.c;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_flash_ex.c;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_exti.c;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_uart.c;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_tim.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_tim_ex.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_ll_tim.h;Drivers\STM32F1xx_HAL_Driver\Inc\Legacy\stm32_hal_legacy.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_def.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_rcc.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_rcc_ex.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_ll_bus.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_ll_rcc.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_ll_system.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_ll_utils.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_gpio.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_gpio_ex.h;Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_gpio_ex.c;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_ll_gpio.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_dma_ex.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_dma.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_ll_dma.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_cortex.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_ll_cortex.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_pwr.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_ll_pwr.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_flash.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_flash_ex.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_exti.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_ll_exti.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_hal_uart.h;Drivers\STM32F1xx_HAL_Driver\Inc\stm32f1xx_ll_usart.h;Drivers\CMSIS\Device\ST\STM32F1xx\Include\stm32f103xb.h;Drivers\CMSIS\Device\ST\STM32F1xx\Include\stm32f1xx.h;Drivers\CMSIS\Device\ST\STM32F1xx\Include\system_stm32f1xx.h;Drivers\CMSIS\Device\ST\STM32F1xx\Include\system_stm32f1xx.h;Drivers\CMSIS\Device\ST\STM32F1xx\Source\Templates\system_stm32f1xx.c;Drivers\CMSIS\Include\cmsis_armcc.h;Drivers\CMSIS\Include\cmsis_armclang.h;Drivers\CMSIS\Include\cmsis_compiler.h;Drivers\CMSIS\Include\cmsis_gcc.h;Drivers\CMSIS\Include\cmsis_iccarm.h;Drivers\CMSIS\Include\cmsis_version.h;Drivers\CMSIS\Include\core_armv8mbl.h;Drivers\CMSIS\Include\core_armv8mml.h;Drivers\CMSIS\Include\core_cm0.h;Drivers\CMSIS\Include\core_cm0plus.h;Drivers\CMSIS\Include\core_cm1.h;Drivers\CMSIS\Include\core_cm23.h;Drivers\CMSIS\Include\core_cm3.h;Drivers\CMSIS\Include\core_cm33.h;Drivers\CMSIS\Include\core_cm4.h;Drivers\CMSIS\Include\core_cm7.h;Drivers\CMSIS\Include\core_sc000.h;Drivers\CMSIS\Include\core_sc300.h;Drivers\CMSIS\Include\mpu_armv7.h;Drivers\CMSIS\Include\mpu_armv8.h;Drivers\CMSIS\Include\tz_context.h; [PreviousUsedKeilFiles] -SourceFiles=..\Src\main.c;..\Src\stm32f1xx_it.c;..\Src\stm32f1xx_hal_msp.c;..\Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_gpio_ex.c;..\Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_tim.c;..\Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_tim_ex.c;..\Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_uart.c;..\Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal.c;..\Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_rcc.c;..\Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_rcc_ex.c;..\Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_gpio.c;..\Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_dma.c;..\Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_cortex.c;..\Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_pwr.c;..\Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_flash.c;..\Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_flash_ex.c;..\Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_exti.c;..\Drivers\CMSIS\Device\ST\STM32F1xx\Source\Templates\system_stm32f1xx.c;..\\Src\system_stm32f1xx.c;..\Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_gpio_ex.c;..\Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_tim.c;..\Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_tim_ex.c;..\Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_uart.c;..\Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal.c;..\Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_rcc.c;..\Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_rcc_ex.c;..\Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_gpio.c;..\Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_dma.c;..\Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_cortex.c;..\Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_pwr.c;..\Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_flash.c;..\Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_flash_ex.c;..\Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_exti.c;..\Drivers\CMSIS\Device\ST\STM32F1xx\Source\Templates\system_stm32f1xx.c;..\\Src\system_stm32f1xx.c;;; +SourceFiles=..\Src\main.c;..\Src\stm32f1xx_it.c;..\Src\stm32f1xx_hal_msp.c;..\Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_gpio_ex.c;..\Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_tim.c;..\Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_tim_ex.c;..\Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal.c;..\Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_rcc.c;..\Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_rcc_ex.c;..\Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_gpio.c;..\Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_dma.c;..\Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_cortex.c;..\Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_pwr.c;..\Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_flash.c;..\Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_flash_ex.c;..\Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_exti.c;..\Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_uart.c;..\Drivers\CMSIS\Device\ST\STM32F1xx\Source\Templates\system_stm32f1xx.c;..\\Src\system_stm32f1xx.c;..\Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_gpio_ex.c;..\Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_tim.c;..\Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_tim_ex.c;..\Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal.c;..\Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_rcc.c;..\Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_rcc_ex.c;..\Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_gpio.c;..\Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_dma.c;..\Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_cortex.c;..\Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_pwr.c;..\Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_flash.c;..\Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_flash_ex.c;..\Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_exti.c;..\Drivers\STM32F1xx_HAL_Driver\Src\stm32f1xx_hal_uart.c;..\Drivers\CMSIS\Device\ST\STM32F1xx\Source\Templates\system_stm32f1xx.c;..\\Src\system_stm32f1xx.c;;; HeaderPath=..\Drivers\STM32F1xx_HAL_Driver\Inc;..\Drivers\STM32F1xx_HAL_Driver\Inc\Legacy;..\Drivers\CMSIS\Device\ST\STM32F1xx\Include;..\Drivers\CMSIS\Include;..\Inc; CDefines=USE_HAL_DRIVER;STM32F103xB;USE_HAL_DRIVER;USE_HAL_DRIVER; diff --git a/bsp/stm32/stm32f103-keysking-learning/board/CubeMX_Config/CubeMX_Config.ioc b/bsp/stm32/stm32f103-keysking-learning/board/CubeMX_Config/CubeMX_Config.ioc index 6726b584bba..31fdf3fc0b1 100644 --- a/bsp/stm32/stm32f103-keysking-learning/board/CubeMX_Config/CubeMX_Config.ioc +++ b/bsp/stm32/stm32f103-keysking-learning/board/CubeMX_Config/CubeMX_Config.ioc @@ -10,21 +10,24 @@ Mcu.Family=STM32F1 Mcu.IP0=NVIC Mcu.IP1=RCC Mcu.IP2=SYS -Mcu.IP3=TIM3 -Mcu.IP4=TIM4 -Mcu.IP5=USART2 -Mcu.IP6=USART3 -Mcu.IPNb=7 +Mcu.IP3=TIM1 +Mcu.IP4=TIM3 +Mcu.IP5=TIM4 +Mcu.IP6=USART2 +Mcu.IP7=USART3 +Mcu.IPNb=8 Mcu.Name=STM32F103C(8-B)Tx Mcu.Package=LQFP48 Mcu.Pin0=PC14-OSC32_IN Mcu.Pin1=PC15-OSC32_OUT -Mcu.Pin10=PA13 -Mcu.Pin11=PA14 -Mcu.Pin12=PB8 -Mcu.Pin13=VP_SYS_VS_Systick -Mcu.Pin14=VP_TIM3_VS_ClockSourceINT -Mcu.Pin15=VP_TIM4_VS_ClockSourceINT +Mcu.Pin10=PA9 +Mcu.Pin11=PA13 +Mcu.Pin12=PA14 +Mcu.Pin13=PB8 +Mcu.Pin14=PB9 +Mcu.Pin15=VP_SYS_VS_Systick +Mcu.Pin16=VP_TIM3_VS_ClockSourceINT +Mcu.Pin17=VP_TIM4_VS_ClockSourceINT Mcu.Pin2=PD0-OSC_IN Mcu.Pin3=PD1-OSC_OUT Mcu.Pin4=PA2 @@ -33,7 +36,7 @@ Mcu.Pin6=PA6 Mcu.Pin7=PB10 Mcu.Pin8=PB11 Mcu.Pin9=PA8 -Mcu.PinsNb=16 +Mcu.PinsNb=18 Mcu.ThirdPartyNb=0 Mcu.UserConstants= Mcu.UserName=STM32F103C8Tx @@ -64,14 +67,15 @@ PA3.Mode=Asynchronous PA3.Signal=USART2_RX PA6.Locked=true PA6.Signal=S_TIM3_CH1 -PA8.Mode=Clock-out -PA8.Signal=RCC_MCO +PA8.Signal=S_TIM1_CH1 +PA9.Signal=S_TIM1_CH2 PB10.Mode=Asynchronous PB10.Signal=USART3_TX PB11.Mode=Asynchronous PB11.Signal=USART3_RX PB8.Locked=true PB8.Signal=S_TIM4_CH3 +PB9.Signal=S_TIM4_CH4 PC14-OSC32_IN.Mode=LSE-External-Oscillator PC14-OSC32_IN.Signal=RCC_OSC32_IN PC15-OSC32_OUT.Mode=LSE-External-Oscillator @@ -111,7 +115,7 @@ ProjectManager.ToolChainLocation= ProjectManager.UAScriptAfterPath= ProjectManager.UAScriptBeforePath= ProjectManager.UnderRoot=false -ProjectManager.functionlistsort=1-MX_GPIO_Init-GPIO-false-HAL-true,2-SystemClock_Config-RCC-false-HAL-false,3-MX_USART2_UART_Init-USART2-false-HAL-true,4-MX_USART3_UART_Init-USART3-false-HAL-true,5-MX_TIM3_Init-TIM3-false-HAL-true +ProjectManager.functionlistsort=1-MX_GPIO_Init-GPIO-false-HAL-true,2-SystemClock_Config-RCC-false-HAL-false,3-MX_USART2_UART_Init-USART2-false-HAL-true,4-MX_USART3_UART_Init-USART3-false-HAL-true,5-MX_TIM3_Init-TIM3-false-HAL-true,6-MX_TIM4_Init-TIM4-false-HAL-true,7-MX_TIM1_Init-TIM1-false-HAL-true RCC.ADCFreqValue=12000000 RCC.ADCPresc=RCC_ADCPCLK2_DIV6 RCC.AHBFreq_Value=72000000 @@ -136,17 +140,26 @@ RCC.TimSysFreq_Value=72000000 RCC.USBFreq_Value=48000000 RCC.USBPrescaler=RCC_USBCLKSOURCE_PLL_DIV1_5 RCC.VCOOutput2Freq_Value=8000000 +SH.S_TIM1_CH1.0=TIM1_CH1,Encoder_Interface +SH.S_TIM1_CH1.ConfNb=1 +SH.S_TIM1_CH2.0=TIM1_CH2,Encoder_Interface +SH.S_TIM1_CH2.ConfNb=1 SH.S_TIM3_CH1.0=TIM3_CH1,PWM Generation1 CH1 SH.S_TIM3_CH1.ConfNb=1 SH.S_TIM4_CH3.0=TIM4_CH3,PWM Generation3 CH3 SH.S_TIM4_CH3.ConfNb=1 +SH.S_TIM4_CH4.0=TIM4_CH4,PWM Generation4 CH4 +SH.S_TIM4_CH4.ConfNb=1 +TIM1.IPParameters=Prescaler +TIM1.Prescaler=2-1 TIM3.Channel-PWM\ Generation1\ CH1=TIM_CHANNEL_1 TIM3.IPParameters=Channel-PWM Generation1 CH1,Prescaler,Period,Pulse-PWM Generation1 CH1 TIM3.Period=10000-1 TIM3.Prescaler=7200-1 TIM3.Pulse-PWM\ Generation1\ CH1=50 TIM4.Channel-PWM\ Generation3\ CH3=TIM_CHANNEL_3 -TIM4.IPParameters=Channel-PWM Generation3 CH3 +TIM4.Channel-PWM\ Generation4\ CH4=TIM_CHANNEL_4 +TIM4.IPParameters=Channel-PWM Generation3 CH3,Channel-PWM Generation4 CH4 USART2.IPParameters=VirtualMode USART2.VirtualMode=VM_ASYNC USART3.IPParameters=VirtualMode diff --git a/bsp/stm32/stm32f103-keysking-learning/board/CubeMX_Config/Src/stm32f1xx_hal_msp.c b/bsp/stm32/stm32f103-keysking-learning/board/CubeMX_Config/Src/stm32f1xx_hal_msp.c index a99c2d378b0..bb9a8f7a561 100644 --- a/bsp/stm32/stm32f103-keysking-learning/board/CubeMX_Config/Src/stm32f1xx_hal_msp.c +++ b/bsp/stm32/stm32f103-keysking-learning/board/CubeMX_Config/Src/stm32f1xx_hal_msp.c @@ -83,6 +83,40 @@ void HAL_MspInit(void) /* USER CODE END MspInit 1 */ } +/** +* @brief TIM_Encoder MSP Initialization +* This function configures the hardware resources used in this example +* @param htim_encoder: TIM_Encoder handle pointer +* @retval None +*/ +void HAL_TIM_Encoder_MspInit(TIM_HandleTypeDef* htim_encoder) +{ + GPIO_InitTypeDef GPIO_InitStruct = {0}; + if(htim_encoder->Instance==TIM1) + { + /* USER CODE BEGIN TIM1_MspInit 0 */ + + /* USER CODE END TIM1_MspInit 0 */ + /* Peripheral clock enable */ + __HAL_RCC_TIM1_CLK_ENABLE(); + + __HAL_RCC_GPIOA_CLK_ENABLE(); + /**TIM1 GPIO Configuration + PA8 ------> TIM1_CH1 + PA9 ------> TIM1_CH2 + */ + GPIO_InitStruct.Pin = GPIO_PIN_8|GPIO_PIN_9; + GPIO_InitStruct.Mode = GPIO_MODE_INPUT; + GPIO_InitStruct.Pull = GPIO_NOPULL; + HAL_GPIO_Init(GPIOA, &GPIO_InitStruct); + + /* USER CODE BEGIN TIM1_MspInit 1 */ + + /* USER CODE END TIM1_MspInit 1 */ + } + +} + /** * @brief TIM_Base MSP Initialization * This function configures the hardware resources used in this example @@ -146,8 +180,9 @@ void HAL_TIM_MspPostInit(TIM_HandleTypeDef* htim) __HAL_RCC_GPIOB_CLK_ENABLE(); /**TIM4 GPIO Configuration PB8 ------> TIM4_CH3 + PB9 ------> TIM4_CH4 */ - GPIO_InitStruct.Pin = GPIO_PIN_8; + GPIO_InitStruct.Pin = GPIO_PIN_8|GPIO_PIN_9; GPIO_InitStruct.Mode = GPIO_MODE_AF_PP; GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW; HAL_GPIO_Init(GPIOB, &GPIO_InitStruct); @@ -158,6 +193,35 @@ void HAL_TIM_MspPostInit(TIM_HandleTypeDef* htim) } } +/** +* @brief TIM_Encoder MSP De-Initialization +* This function freeze the hardware resources used in this example +* @param htim_encoder: TIM_Encoder handle pointer +* @retval None +*/ +void HAL_TIM_Encoder_MspDeInit(TIM_HandleTypeDef* htim_encoder) +{ + if(htim_encoder->Instance==TIM1) + { + /* USER CODE BEGIN TIM1_MspDeInit 0 */ + + /* USER CODE END TIM1_MspDeInit 0 */ + /* Peripheral clock disable */ + __HAL_RCC_TIM1_CLK_DISABLE(); + + /**TIM1 GPIO Configuration + PA8 ------> TIM1_CH1 + PA9 ------> TIM1_CH2 + */ + HAL_GPIO_DeInit(GPIOA, GPIO_PIN_8|GPIO_PIN_9); + + /* USER CODE BEGIN TIM1_MspDeInit 1 */ + + /* USER CODE END TIM1_MspDeInit 1 */ + } + +} + /** * @brief TIM_Base MSP De-Initialization * This function freeze the hardware resources used in this example diff --git a/bsp/stm32/stm32f103-keysking-learning/board/Kconfig b/bsp/stm32/stm32f103-keysking-learning/board/Kconfig index 20deaca0971..2f1ed35e5cb 100644 --- a/bsp/stm32/stm32f103-keysking-learning/board/Kconfig +++ b/bsp/stm32/stm32f103-keysking-learning/board/Kconfig @@ -7,6 +7,13 @@ menu "Onboard Peripheral Drivers" select BSP_USING_UART select BSP_USING_UART2 default y + config BSP_USING_SERVO + bool "Enable Servo" + select BSP_USING_PWM + select BSP_USING_PWM4 + select BSP_USING_PWM4_CH3 + default n + endmenu @@ -39,8 +46,64 @@ menu "On-chip Peripheral Drivers" # depends on BSP_USING_UART2 && RT_SERIAL_USING_DMA # default n + endif + + menuconfig BSP_USING_PWM + bool "Enable PWM" + select RT_USING_PWM + default n + + if BSP_USING_PWM + menuconfig BSP_USING_PWM3 + bool "Enable PWM3" + default y + if BSP_USING_PWM3 + config BSP_USING_PWM3_CH1 + bool "Enable PWM3_CH1(PA6,Blue LED)" + default y + config BSP_USING_PWM3_CH2 + bool "Enable PWM3_CH2(PA7,Green LED)" + default n + config BSP_USING_PWM3_CH3 + bool "Enable PWM3_CH3(PB0,Red LED)" + default n + config BSP_USING_PWM3_CH4 + bool "Enable PWM3_CH4" + default n + endif + + menuconfig BSP_USING_PWM4 + bool "Enable PWM4" + default n + if BSP_USING_PWM4 + config BSP_USING_PWM4_CH1 + bool "Enable PWM4_CH1" + default n + config BSP_USING_PWM4_CH2 + bool "Enable PWM4_CH2" + default n + config BSP_USING_PWM4_CH3 + bool "Enable PWM4_CH3(PB8,Servo)" + default y + config BSP_USING_PWM4_CH4 + bool "Enable PWM4_CH4(PB9,Beeper)" + default y + endif endif + menuconfig BSP_USING_PULSE_ENCODER + bool "Enable Pulse Encoder" + select RT_USING_PULSE_ENCODER + default n + + if BSP_USING_PULSE_ENCODER + config BSP_USING_PULSE_ENCODER1 + bool "Enable Pulse Encoder1" + default y + + endif + + source "$(BSP_DIR)/../libraries/HAL_Drivers/drivers/Kconfig" diff --git a/bsp/stm32/stm32f103-keysking-learning/rtconfig.h b/bsp/stm32/stm32f103-keysking-learning/rtconfig.h index 568316e766b..f7c8c4212b7 100644 --- a/bsp/stm32/stm32f103-keysking-learning/rtconfig.h +++ b/bsp/stm32/stm32f103-keysking-learning/rtconfig.h @@ -149,6 +149,7 @@ #define RT_SERIAL_USING_DMA #define RT_SERIAL_RB_BUFSZ 64 #define RT_USING_PWM +#define RT_USING_PULSE_ENCODER #define RT_USING_PIN /* end of Device Drivers */ From d57c201bad8e1e141bcfaefce2c7cfc3880bcf12 Mon Sep 17 00:00:00 2001 From: qianjiuyuan <149981328+heyQianJiu@users.noreply.github.com> Date: Wed, 28 May 2025 00:03:27 +0800 Subject: [PATCH 04/11] =?UTF-8?q?[bsp]=E5=89=8D=E4=B8=89=E4=B8=AAcommit?= =?UTF-8?q?=E7=9A=84mdk5=E5=92=8Ciar=E5=B7=A5=E7=A8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../stm32f103-keysking-learning/project.ewp | 120 ++++++++------ .../project.uvprojx | 146 +++++++++++++----- 2 files changed, 175 insertions(+), 91 deletions(-) diff --git a/bsp/stm32/stm32f103-keysking-learning/project.ewp b/bsp/stm32/stm32f103-keysking-learning/project.ewp index 1dfedecb58b..8354a7bc9da 100644 --- a/bsp/stm32/stm32f103-keysking-learning/project.ewp +++ b/bsp/stm32/stm32f103-keysking-learning/project.ewp @@ -348,30 +348,30 @@