Merge pull request #2685 from msrd0/spi-br-0-not-unreachable

Improve panic message when requesting frequency higher than clock
This commit is contained in:
Dario Nieuwenhuis 2024-03-11 18:12:15 +01:00 committed by GitHub
commit b8be126a47
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -700,7 +700,7 @@ use vals::Mbr as Br;
fn compute_baud_rate(clocks: Hertz, freq: Hertz) -> Br {
let val = match clocks.0 / freq.0 {
0 => unreachable!(),
0 => panic!("You are trying to reach a frequency higher than the clock"),
1..=2 => 0b000,
3..=5 => 0b001,
6..=11 => 0b010,