aboutsummaryrefslogtreecommitdiff
path: root/embassy-rp
diff options
context:
space:
mode:
Diffstat (limited to 'embassy-rp')
-rw-r--r--embassy-rp/src/pio_programs/clock_divider.rs6
1 files changed, 3 insertions, 3 deletions
diff --git a/embassy-rp/src/pio_programs/clock_divider.rs b/embassy-rp/src/pio_programs/clock_divider.rs
index 28c931ed2..87ba93008 100644
--- a/embassy-rp/src/pio_programs/clock_divider.rs
+++ b/embassy-rp/src/pio_programs/clock_divider.rs
@@ -29,7 +29,7 @@ pub fn calculate_pio_clock_divider(target_hz: u32) -> fixed::FixedU32<U8> {
29/// A fixed-point divider value suitable for use in a PIO state machine configuration 29/// A fixed-point divider value suitable for use in a PIO state machine configuration
30pub const fn calculate_pio_clock_divider_value(sys_hz: u32, target_hz: u32) -> fixed::FixedU32<U8> { 30pub const fn calculate_pio_clock_divider_value(sys_hz: u32, target_hz: u32) -> fixed::FixedU32<U8> {
31 // Requires a non-zero frequency 31 // Requires a non-zero frequency
32 assert!(target_hz > 0, "PIO clock frequency cannot be zero"); 32 core::assert!(target_hz > 0);
33 33
34 // Compute the integer and fractional part of the divider. 34 // Compute the integer and fractional part of the divider.
35 // Doing it this way allows us to avoid u64 division while 35 // Doing it this way allows us to avoid u64 division while
@@ -41,9 +41,9 @@ pub const fn calculate_pio_clock_divider_value(sys_hz: u32, target_hz: u32) -> f
41 let result = integer << 8 | frac; 41 let result = integer << 8 | frac;
42 42
43 // Ensure the result will fit in 16+8 bits. 43 // Ensure the result will fit in 16+8 bits.
44 assert!(result <= 0xffff_ff, "pio clock divider too big"); 44 core::assert!(result <= 0xffff_ff);
45 // The clock divider can't be used to go faster than the system clock. 45 // The clock divider can't be used to go faster than the system clock.
46 assert!(result >= 0x0001_00, "pio clock divider cannot be less than 1"); 46 core::assert!(result >= 0x0001_00);
47 47
48 fixed::FixedU32::from_bits(result) 48 fixed::FixedU32::from_bits(result)
49} 49}