Skip to content

Conversation

@geniusgogo
Copy link
Contributor

拉取/合并请求描述:(PR description)

[

  • fixed stm32 bsp drv_pwm.c:pwm timer init.

]

当前拉取/合并请求的状态 Intent for your PR

必须选择一项 Choose one (Mandatory):

  • 本拉取/合并请求是一个草稿版本 This PR is for a code-review and is intended to get feedback
  • [√] 本拉取/合并请求是一个成熟版本 This PR is mature, and ready to be integrated into the repo

代码质量 Code Quality:

我在这个拉取/合并请求中已经考虑了 As part of this pull request, I've considered the following:

  • [√] 已经仔细查看过代码改动的对比 Already check the difference between PR and old code
  • [√] 代码风格正确,包括缩进空格,命名及其他风格 Style guide is adhered to, including spacing, naming and other style
  • [√] 没有垃圾代码,代码尽量精简,不包含#if 0代码,不包含已经被注释了的代码 All redundant code is removed and cleaned up
  • [√] 所有变更均有原因及合理的,并且不会影响到其他软件组件代码或BSP All modifications are justified and not affect other components or BSP
  • [√] 对难懂代码均提供对应的注释 I've commented appropriately where code is tricky
  • [√] 本拉取/合并请求代码是高质量的 Code in this PR is of high quality

Copy link
Contributor

@rtthread-bot rtthread-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AutoTest Result

Rate: 0.00%
Passed: 0/21

点击查看详情

@SummerGift
Copy link
Member

SummerGift commented Jan 21, 2020

Hello, 新年好!

这里进行这样修改的原因是什么呢?

@geniusgogo

@geniusgogo
Copy link
Contributor Author

geniusgogo commented Feb 9, 2020

Hello, 新年好!

这里进行这样修改的原因是什么呢?

@geniusgogo

看上面贴的ISSUES 3333,里面有描述

@SummerGift
Copy link
Member

(#) Configure the TIM in the desired functioning mode using one of the
       Initialization function of this driver:
       (++) HAL_TIM_Base_Init: to use the Timer to generate a simple time base
       (++) HAL_TIM_OC_Init and HAL_TIM_OC_ConfigChannel: to use the Timer to generate an
            Output Compare signal.
       (++) HAL_TIM_PWM_Init and HAL_TIM_PWM_ConfigChannel: to use the Timer to generate a
            PWM signal.
       (++) HAL_TIM_IC_Init and HAL_TIM_IC_ConfigChannel: to use the Timer to measure an
            external signal.
       (++) HAL_TIM_OnePulse_Init and HAL_TIM_OnePulse_ConfigChannel: to use the Timer
            in One Pulse Mode.
       (++) HAL_TIM_Encoder_Init: to use the Timer Encoder Interface.

根据 HAL 驱动的描述,这里应该只是选择一种方式进行初始化,而不是使用两种,感谢提交。

@geniusgogo
Copy link
Contributor Author

(#) Configure the TIM in the desired functioning mode using one of the
       Initialization function of this driver:
       (++) HAL_TIM_Base_Init: to use the Timer to generate a simple time base
       (++) HAL_TIM_OC_Init and HAL_TIM_OC_ConfigChannel: to use the Timer to generate an
            Output Compare signal.
       (++) HAL_TIM_PWM_Init and HAL_TIM_PWM_ConfigChannel: to use the Timer to generate a
            PWM signal.
       (++) HAL_TIM_IC_Init and HAL_TIM_IC_ConfigChannel: to use the Timer to measure an
            external signal.
       (++) HAL_TIM_OnePulse_Init and HAL_TIM_OnePulse_ConfigChannel: to use the Timer
            in One Pulse Mode.
       (++) HAL_TIM_Encoder_Init: to use the Timer Encoder Interface.

根据 HAL 驱动的描述,这里应该只是选择一种方式进行初始化,而不是使用两种,感谢提交。
麻烦看一下我下面这个描述:
d3f8b9b#commitcomment-36788100

@SummerGift
Copy link
Member

(#) Configure the TIM in the desired functioning mode using one of the
       Initialization function of this driver:
       (++) HAL_TIM_Base_Init: to use the Timer to generate a simple time base
       (++) HAL_TIM_OC_Init and HAL_TIM_OC_ConfigChannel: to use the Timer to generate an
            Output Compare signal.
       (++) HAL_TIM_PWM_Init and HAL_TIM_PWM_ConfigChannel: to use the Timer to generate a
            PWM signal.
       (++) HAL_TIM_IC_Init and HAL_TIM_IC_ConfigChannel: to use the Timer to measure an
            external signal.
       (++) HAL_TIM_OnePulse_Init and HAL_TIM_OnePulse_ConfigChannel: to use the Timer
            in One Pulse Mode.
       (++) HAL_TIM_Encoder_Init: to use the Timer Encoder Interface.

根据 HAL 驱动的描述,这里应该只是选择一种方式进行初始化,而不是使用两种,感谢提交。
麻烦看一下我下面这个描述:
d3f8b9b#commitcomment-36788100

嗯,我看到了,根据 HAL 库中的描述,重新初始化 PWM 功能,应当先调用 deinit() 函数,这里先配置成 base 模式后没有进行 deinit,又直接配置成 PWM 模式应该是存在初始化错误问题的。

感谢指出错误。

@BernardXiong BernardXiong merged commit 3bd9694 into RT-Thread:master Feb 19, 2020
@geniusgogo geniusgogo deleted the fixed_drv_pwm branch February 20, 2020 01:17
@SummerGift SummerGift mentioned this pull request May 18, 2020
8 tasks
@icrazt icrazt mentioned this pull request Feb 7, 2021
8 tasks
@mysterywolf
Copy link
Member

#7049

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants