diff options
| author | yangjie <[email protected]> | 2019-04-23 19:17:21 +0800 |
|---|---|---|
| committer | yangjie <[email protected]> | 2019-04-23 19:17:21 +0800 |
| commit | e92a4263b4068612bddf9adf0d27a0f5b09bfb8d (patch) | |
| tree | 3d9aa07a49c45a1fd1de512ffaea6974b9025915 /bsp/stm32/libraries | |
| parent | 258e1e09c2b10a69f529ef562b9de71cbf66a6bb (diff) | |
[bsp][stm32/libraries]support PWM1
Diffstat (limited to 'bsp/stm32/libraries')
| -rw-r--r-- | bsp/stm32/libraries/HAL_Drivers/config/l4/pwm_config.h | 11 | ||||
| -rw-r--r-- | bsp/stm32/libraries/HAL_Drivers/drv_pwm.c | 12 |
2 files changed, 23 insertions, 0 deletions
diff --git a/bsp/stm32/libraries/HAL_Drivers/config/l4/pwm_config.h b/bsp/stm32/libraries/HAL_Drivers/config/l4/pwm_config.h index 1a5575de0c..50ea3791b6 100644 --- a/bsp/stm32/libraries/HAL_Drivers/config/l4/pwm_config.h +++ b/bsp/stm32/libraries/HAL_Drivers/config/l4/pwm_config.h @@ -17,6 +17,17 @@ extern "C" { #endif +#ifdef BSP_USING_PWM1 +#ifndef PWM1_CONFIG +#define PWM1_CONFIG \ + { \ + .tim_handle.Instance = TIM1, \ + .name = "pwm1", \ + .channel = 0 \ + } +#endif /* PWM1_CONFIG */ +#endif /* BSP_USING_PWM1 */ + #ifdef BSP_USING_PWM2 #ifndef PWM2_CONFIG #define PWM2_CONFIG \ diff --git a/bsp/stm32/libraries/HAL_Drivers/drv_pwm.c b/bsp/stm32/libraries/HAL_Drivers/drv_pwm.c index 444fe94a51..6f1c123a56 100644 --- a/bsp/stm32/libraries/HAL_Drivers/drv_pwm.c +++ b/bsp/stm32/libraries/HAL_Drivers/drv_pwm.c @@ -411,6 +411,18 @@ __exit: static void pwm_get_channel(void) { +#ifdef BSP_USING_PWM1_CH1 + stm32_pwm_obj[PWM1_INDEX].channel |= 1 << 0; +#endif +#ifdef BSP_USING_PWM1_CH2 + stm32_pwm_obj[PWM1_INDEX].channel |= 1 << 2; +#endif +#ifdef BSP_USING_PWM1_CH3 + stm32_pwm_obj[PWM1_INDEX].channel |= 1 << 3; +#endif +#ifdef BSP_USING_PWM1_CH4 + stm32_pwm_obj[PWM1_INDEX].channel |= 1 << 4; +#endif #ifdef BSP_USING_PWM2_CH1 stm32_pwm_obj[PWM2_INDEX].channel |= 1 << 0; #endif |
