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.
This commit is contained in:
		
							parent
							
								
									ac06ca2fa0
								
							
						
					
					
						commit
						b6a383811a
					
				| @ -700,7 +700,7 @@ use vals::Mbr as Br; | |||||||
| 
 | 
 | ||||||
| fn compute_baud_rate(clocks: Hertz, freq: Hertz) -> Br { | fn compute_baud_rate(clocks: Hertz, freq: Hertz) -> Br { | ||||||
|     let val = match clocks.0 / freq.0 { |     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, |         1..=2 => 0b000, | ||||||
|         3..=5 => 0b001, |         3..=5 => 0b001, | ||||||
|         6..=11 => 0b010, |         6..=11 => 0b010, | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user