Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix long delay during ADC initialization
As explained in issue stm32-rs#206, the code here is doing the calculation completely wrong. This leads to a multi-second startup delay instead of just a few clock cycles. Fix this by using the correct calculation; currently only ADC clock configurations synchronous to the AHB are supported which makes this quite easy: We just need to delay the given number of cycles * the selected ADC clock prescaler (1, 2, or 4). To make this code future proof against an implementation of asynchronous ADC clock configurations, use a `match` statement here which will fail to compile once the `ASYNCHRONOUS` variant is added to the `CkMode` struct - thus forcing the implementor to take another look at this. Fixes: stm32-rs#206
- Loading branch information