mirror of
https://github.com/apache/nuttx.git
synced 2026-10-10 07:40:27 +00:00
arch/arm64/imx9: skip unused PWM channel slots
A channel number of zero marks an unused slot, as pwm.rst documents. pwm_start() handed every slot to pwm_update_duty(), which refuses channel 0, so a caller that fills only some slots, like PX4's tone alarm, got EINVAL. Signed-off-by: Royyan Zahir <royzah@gmail.com>
This commit is contained in:
parent
e65ca99128
commit
dfd1bf6738
2 changed files with 10 additions and 0 deletions
|
|
@ -602,6 +602,11 @@ static int pwm_start(struct pwm_lowerhalf_s *dev,
|
|||
break;
|
||||
}
|
||||
|
||||
if (info->channels[i].channel == 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
ret = pwm_update_duty(priv, info->channels[i].channel,
|
||||
info->channels[i].duty);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -541,6 +541,11 @@ static int pwm_start(struct pwm_lowerhalf_s *dev,
|
|||
break;
|
||||
}
|
||||
|
||||
if (info->channels[i].channel == 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
ret = pwm_update_duty(priv, info->channels[i].channel,
|
||||
info->channels[i].duty);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue