-
Notifications
You must be signed in to change notification settings - Fork 971
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Clock Divider integer should not be an int but uint8_t #2046
Comments
See #1926 which is the big PR where all the clock-divider code got tweaked recently... |
I don't see the change either in master or in develop branch. I see some updates for the other functions; but not for pwm_set_config_clkdiv_int(). |
If you ran your code in Debug mode, I believe it should have triggered the |
Yes. Ofcourse. |
Based on all the other changes that happened in #1926 I think the intention is that the "higher level function" The Doxygen-comment for |
yes; we clarified all the |
In the file src/rp2_common/hardware_pwm/include/hardware/pwm.h
Second arguement of the below function should be uint8_t
static inline void pwm_config_set_clkdiv_int(pwm_config *c, uint32_t div_int) {
pwm_config_set_clkdiv_int_frac4(c, div_int, 0);
}
static inline void pwm_config_set_clkdiv_int_frac4(pwm_config *c, uint32_t div_int, uint8_t div_frac4) {
static_assert(PWM_CH0_DIV_INT_MSB - PWM_CH0_DIV_INT_LSB == 7, "");
valid_params_if(HARDWARE_PWM, div_int >= 1 && div_int < 256);
static_assert(PWM_CH0_DIV_FRAC_MSB - PWM_CH0_DIV_FRAC_LSB == 3, "");
valid_params_if(HARDWARE_PWM, div_frac4 < 16);
c->div = (((uint)div_int) << PWM_CH0_DIV_INT_LSB) | (((uint)div_frac4) << PWM_CH0_DIV_FRAC_LSB);
}
The text was updated successfully, but these errors were encountered: