|
@@ -291,3 +291,47 @@ pub enum PulseWidth {
|
|
|
Ns350 = 350,
|
|
|
Ns500 = 500,
|
|
|
}
|
|
|
+
|
|
|
+impl PulseWidth {
|
|
|
+ pub fn min_freq(&self) -> u32 {
|
|
|
+ match self {
|
|
|
+ PulseWidth::Ns2 => 850_000,
|
|
|
+ PulseWidth::Ns4 => 500_000,
|
|
|
+ PulseWidth::Ns6 => 320_000,
|
|
|
+ PulseWidth::Ns8 => 250_000,
|
|
|
+ PulseWidth::Ns12 => 170_000,
|
|
|
+ PulseWidth::Ns20 => 115_000,
|
|
|
+ PulseWidth::Ns30 => 90_000,
|
|
|
+ PulseWidth::Ns45 => 75_000,
|
|
|
+ PulseWidth::Ns60 => 65_000,
|
|
|
+ PulseWidth::Ns80 => 60_000,
|
|
|
+ PulseWidth::Ns100 => 45_000,
|
|
|
+ PulseWidth::Ns150 => 30_000,
|
|
|
+ PulseWidth::Ns200 => 25_000,
|
|
|
+ PulseWidth::Ns250 => 25_000,
|
|
|
+ PulseWidth::Ns350 => 25_000,
|
|
|
+ PulseWidth::Ns500 => 25_000,
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ pub fn max_freq(&self) -> u32 {
|
|
|
+ match self {
|
|
|
+ PulseWidth::Ns2 => 4_000_000,
|
|
|
+ PulseWidth::Ns4 => 4_000_000,
|
|
|
+ PulseWidth::Ns6 => 4_000_000,
|
|
|
+ PulseWidth::Ns8 => 4_000_000,
|
|
|
+ PulseWidth::Ns12 => 3_000_000,
|
|
|
+ PulseWidth::Ns20 => 3_000_000,
|
|
|
+ PulseWidth::Ns30 => 3_000_000,
|
|
|
+ PulseWidth::Ns45 => 2_000_000,
|
|
|
+ PulseWidth::Ns60 => 2_000_000,
|
|
|
+ PulseWidth::Ns80 => 2_000_000,
|
|
|
+ PulseWidth::Ns100 => 1_000_000,
|
|
|
+ PulseWidth::Ns150 => 1_000_000,
|
|
|
+ PulseWidth::Ns200 => 1_000_000,
|
|
|
+ PulseWidth::Ns250 => 900_000,
|
|
|
+ PulseWidth::Ns350 => 600_000,
|
|
|
+ PulseWidth::Ns500 => 500_000,
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|