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.
Running PWMObjectInit sets channels to 0 and makes driver unusable. Topic is solved
- Giovanni
- Site Admin
- Posts: 14461
- Joined: Wed May 27, 2009 8:48 am
- Location: Salerno, Italy
- Has thanked: 1077 times
- Been thanked: 922 times
- Contact:
Re: Running PWMObjectInit sets channels to 0 and makes driver unusable.
Hi,
pwmObjectInit() is called internally by the LLD which also sets the channels field, the HLD has no knowledge about the number of channels.
In general, halInit() initializes everything, calling xxxObjectInit() functions undoes initialization already performed in the LLDs.
Giovanni
pwmObjectInit() is called internally by the LLD which also sets the channels field, the HLD has no knowledge about the number of channels.
In general, halInit() initializes everything, calling xxxObjectInit() functions undoes initialization already performed in the LLDs.
Giovanni
Who is online
Users browsing this forum: No registered users and 4 guests