Running PWMObjectInit sets channels to 0 and makes driver unusable.
Posted: Wed Jan 03, 2024 4:44 am
Very minor issue, not sure if it even qualifies as a bug, but for all drivers I usually run driverObjectInit() at the start of my program just in case.
For the PWM driver, in line hal_pwm.c:73 pwmp->channels is set to 0 and never set again after that.
If you try to run pwmEnableChannel it will fail at hal_pwm.c:188 when it checks "channel < pwmp->channels"
pwmp->channels is only set at the start of pwm_lld_init().
Removing line hal_pwm.c:73 or never running pwmObjectInit unnecessarily solves the issue.
For the PWM driver, in line hal_pwm.c:73 pwmp->channels is set to 0 and never set again after that.
If you try to run pwmEnableChannel it will fail at hal_pwm.c:188 when it checks "channel < pwmp->channels"
pwmp->channels is only set at the start of pwm_lld_init().
Removing line hal_pwm.c:73 or never running pwmObjectInit unnecessarily solves the issue.