HAL config structures
Posted: Fri Jan 13, 2012 3:59 pm
Hi,
I've been some troubles debugging an application, as the callback of a PWM channel was jumping pretty randomly, and finally the problem was related with my PWMConfig structure that was not a global or static variable but a local one inside mi init() funciton.
After some debugging I've noticed that the config structures are not copied but passed as pointer (as I could have guessed by I did not).
Giovanni, maybe adding a note in the HAL documentation that explicitly says to declare those structures as global or static can be useful to avoid writing wrong code as I did.
I've been some troubles debugging an application, as the callback of a PWM channel was jumping pretty randomly, and finally the problem was related with my PWMConfig structure that was not a global or static variable but a local one inside mi init() funciton.
After some debugging I've noticed that the config structures are not copied but passed as pointer (as I could have guessed by I did not).
Giovanni, maybe adding a note in the HAL documentation that explicitly says to declare those structures as global or static can be useful to avoid writing wrong code as I did.