Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
434: Fix computation of timer frequency r=burrbull a=SnVIZQ Retrieving timer frequency using PwmHz::get_period() function can cause division by zero exception for certain types of frequencies which are configured by having zero in any of the PSC or ARR register - current implementation uses "clk / (psc * arr)" expression to compute the frequency. Implementation of compute_arr_presc() sets PSC and ARR registers correctly. Performing inverse computation leads to different expression: "clk / ((psc + 1) * (arr + 1))" which properly computes timer frequency from PSC and ARR registers. This patch uses new/fixed expression for computing timer frequency. Change log was modified. Co-authored-by: Juraj Hercek <[email protected]>
- Loading branch information