mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-19 11:03:35 +08:00
Fix the STM32 PWM driver pulse count logic
git-svn-id: https://nuttx.svn.sourceforge.net/svnroot/nuttx/trunk@4298 7fd9a85b-ad96-42d3-883c-3090e2eb8679
This commit is contained in:
+4
-1
@@ -322,7 +322,7 @@ static int pwm_start(FAR struct pwm_upperhalf_s *upper, unsigned int oflags)
|
||||
* We do these things before starting the PWM to avoid race conditions.
|
||||
*/
|
||||
|
||||
upper->waiting = (upper->info.count > 0) && ((oflags & O_NONBLOCK) != 0);
|
||||
upper->waiting = (upper->info.count > 0) && ((oflags & O_NONBLOCK) == 0);
|
||||
upper->started = true;
|
||||
|
||||
/* Invoke the bottom half method to start the pulse train */
|
||||
@@ -354,6 +354,7 @@ static int pwm_start(FAR struct pwm_upperhalf_s *upper, unsigned int oflags)
|
||||
{
|
||||
/* Looks like we won't be waiting after all */
|
||||
|
||||
pwmvdbg("start failed: %d\n", ret);
|
||||
upper->started = false;
|
||||
upper->waiting = false;
|
||||
}
|
||||
@@ -649,6 +650,8 @@ void pwm_expired(FAR void *handle)
|
||||
{
|
||||
FAR struct pwm_upperhalf_s *upper = (FAR struct pwm_upperhalf_s *)handle;
|
||||
|
||||
pwmllvdbg("started: %d waiting: %d\n", upper->started, upper->waiting);
|
||||
|
||||
/* Make sure that the PWM is started */
|
||||
|
||||
if (upper->started)
|
||||
|
||||
Reference in New Issue
Block a user