aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDominic <[email protected]>2024-03-11 17:51:53 +0100
committerDominic <[email protected]>2024-03-11 17:52:18 +0100
commitb6a383811a775d1cb98b4fb2070c55e95c66a648 (patch)
tree4283416b5f01dbb58864b1c8f88455afcc02937f
parentac06ca2fa0aa061a0053336433fa9cbfad5212ca (diff)
Improve panic message when requesting frequency higher than clock
Previously it would panic with message "unreachable", which isn't particularly clear about what the problem is and how to fix it.
-rw-r--r--embassy-stm32/src/spi/mod.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/embassy-stm32/src/spi/mod.rs b/embassy-stm32/src/spi/mod.rs
index 172bc8112..b517f640a 100644
--- a/embassy-stm32/src/spi/mod.rs
+++ b/embassy-stm32/src/spi/mod.rs
@@ -700,7 +700,7 @@ use vals::Mbr as Br;
700 700
701fn compute_baud_rate(clocks: Hertz, freq: Hertz) -> Br { 701fn compute_baud_rate(clocks: Hertz, freq: Hertz) -> Br {
702 let val = match clocks.0 / freq.0 { 702 let val = match clocks.0 / freq.0 {
703 0 => unreachable!(), 703 0 => panic!("You are trying to reach a frequency higher than the clock"),
704 1..=2 => 0b000, 704 1..=2 => 0b000,
705 3..=5 => 0b001, 705 3..=5 => 0b001,
706 6..=11 => 0b010, 706 6..=11 => 0b010,