From 8a9e1caebebf71e1ff634b620b2c45097bc2de9e Mon Sep 17 00:00:00 2001 From: guozhanxin Date: Fri, 8 Mar 2019 10:58:18 +0800 Subject: [PATCH] =?UTF-8?q?[bsp][stm32]=E6=9B=B4=E6=96=B0pwm=E9=A9=B1?= =?UTF-8?q?=E5=8A=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bsp/stm32/libraries/HAL_Drivers/drv_pwm.c | 67 ++++++++++++++++++++++- 1 file changed, 65 insertions(+), 2 deletions(-) diff --git a/bsp/stm32/libraries/HAL_Drivers/drv_pwm.c b/bsp/stm32/libraries/HAL_Drivers/drv_pwm.c index f781e51b0d..444fe94a51 100644 --- a/bsp/stm32/libraries/HAL_Drivers/drv_pwm.c +++ b/bsp/stm32/libraries/HAL_Drivers/drv_pwm.c @@ -414,6 +414,12 @@ static void pwm_get_channel(void) #ifdef BSP_USING_PWM2_CH1 stm32_pwm_obj[PWM2_INDEX].channel |= 1 << 0; #endif +#ifdef BSP_USING_PWM2_CH2 + stm32_pwm_obj[PWM2_INDEX].channel |= 1 << 1; +#endif +#ifdef BSP_USING_PWM2_CH3 + stm32_pwm_obj[PWM2_INDEX].channel |= 1 << 2; +#endif #ifdef BSP_USING_PWM2_CH4 stm32_pwm_obj[PWM2_INDEX].channel |= 1 << 3; #endif @@ -429,21 +435,78 @@ static void pwm_get_channel(void) #ifdef BSP_USING_PWM3_CH4 stm32_pwm_obj[PWM3_INDEX].channel |= 1 << 3; #endif +#ifdef BSP_USING_PWM4_CH1 + stm32_pwm_obj[PWM4_INDEX].channel |= 1 << 0; +#endif #ifdef BSP_USING_PWM4_CH2 stm32_pwm_obj[PWM4_INDEX].channel |= 1 << 1; #endif #ifdef BSP_USING_PWM4_CH3 stm32_pwm_obj[PWM4_INDEX].channel |= 1 << 2; #endif +#ifdef BSP_USING_PWM4_CH4 + stm32_pwm_obj[PWM4_INDEX].channel |= 1 << 3; +#endif #ifdef BSP_USING_PWM5_CH1 - stm32_pwm_obj[PWM5_INDEX].channel |= 1 << 1; + stm32_pwm_obj[PWM5_INDEX].channel |= 1 << 0; #endif #ifdef BSP_USING_PWM5_CH2 - stm32_pwm_obj[PWM5_INDEX].channel |= 1 << 2; + stm32_pwm_obj[PWM5_INDEX].channel |= 1 << 1; #endif #ifdef BSP_USING_PWM5_CH3 + stm32_pwm_obj[PWM5_INDEX].channel |= 1 << 2; +#endif +#ifdef BSP_USING_PWM5_CH4 stm32_pwm_obj[PWM5_INDEX].channel |= 1 << 3; #endif +#ifdef BSP_USING_PWM6_CH1 + stm32_pwm_obj[PWM6_INDEX].channel |= 1 << 0; +#endif +#ifdef BSP_USING_PWM6_CH2 + stm32_pwm_obj[PWM6_INDEX].channel |= 1 << 1; +#endif +#ifdef BSP_USING_PWM6_CH3 + stm32_pwm_obj[PWM6_INDEX].channel |= 1 << 2; +#endif +#ifdef BSP_USING_PWM6_CH4 + stm32_pwm_obj[PWM6_INDEX].channel |= 1 << 3; +#endif +#ifdef BSP_USING_PWM7_CH1 + stm32_pwm_obj[PWM7_INDEX].channel |= 1 << 0; +#endif +#ifdef BSP_USING_PWM7_CH2 + stm32_pwm_obj[PWM7_INDEX].channel |= 1 << 1; +#endif +#ifdef BSP_USING_PWM7_CH3 + stm32_pwm_obj[PWM7_INDEX].channel |= 1 << 2; +#endif +#ifdef BSP_USING_PWM7_CH4 + stm32_pwm_obj[PWM7_INDEX].channel |= 1 << 3; +#endif +#ifdef BSP_USING_PWM8_CH1 + stm32_pwm_obj[PWM8_INDEX].channel |= 1 << 0; +#endif +#ifdef BSP_USING_PWM8_CH2 + stm32_pwm_obj[PWM8_INDEX].channel |= 1 << 1; +#endif +#ifdef BSP_USING_PWM8_CH3 + stm32_pwm_obj[PWM8_INDEX].channel |= 1 << 2; +#endif +#ifdef BSP_USING_PWM8_CH4 + stm32_pwm_obj[PWM8_INDEX].channel |= 1 << 3; +#endif +#ifdef BSP_USING_PWM9_CH1 + stm32_pwm_obj[PWM9_INDEX].channel |= 1 << 0; +#endif +#ifdef BSP_USING_PWM9_CH2 + stm32_pwm_obj[PWM9_INDEX].channel |= 1 << 1; +#endif +#ifdef BSP_USING_PWM9_CH3 + stm32_pwm_obj[PWM9_INDEX].channel |= 1 << 2; +#endif +#ifdef BSP_USING_PWM9_CH4 + stm32_pwm_obj[PWM9_INDEX].channel |= 1 << 3; +#endif } static int stm32_pwm_init(void)