[bsp][stm32/libraries]support PWM1
This commit is contained in:
parent
258e1e09c2
commit
e92a4263b4
|
@ -17,6 +17,17 @@
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#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
|
#ifdef BSP_USING_PWM2
|
||||||
#ifndef PWM2_CONFIG
|
#ifndef PWM2_CONFIG
|
||||||
#define PWM2_CONFIG \
|
#define PWM2_CONFIG \
|
||||||
|
|
|
@ -411,6 +411,18 @@ __exit:
|
||||||
|
|
||||||
static void pwm_get_channel(void)
|
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
|
#ifdef BSP_USING_PWM2_CH1
|
||||||
stm32_pwm_obj[PWM2_INDEX].channel |= 1 << 0;
|
stm32_pwm_obj[PWM2_INDEX].channel |= 1 << 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue