fn clock_divisor(device: DeviceType, frequency: u32) -> (u32, Option<bool>) {
    match device {
        // FT2232D appears as FT2232C in FTD2XX
        DeviceType::FT2232C => {
            check_limits(device, frequency, 6_000_000);
            (6_000_000 / frequency - 1, None)
        }
        DeviceType::FT2232H | DeviceType::FT4232H | DeviceType::FT232H => {
            check_limits(device, frequency, 30_000_000);
            if frequency <= 6_000_000 {
                (6_000_000 / frequency - 1, Some(true))
            } else {
                (30_000_000 / frequency - 1, Some(false))
            }
        }
        _ => panic!("Unknown device type: {:?}", device),
    }
}
// calculate the clock divisor from a frequency
calculate the clock divisor from a frequency
calculate the clock divisor from a frequency
fn clock_divisor(device: DeviceType, frequency: u32) -> (u32, Option<bool>) {
    match device {
        // FT2232D appears as FT2232C in FTD2XX
        DeviceType::FT2232C => {
            check_limits(device, frequency, 6_000_000);
            (6_000_000 / frequency - 1, None)
        }
        DeviceType::FT2232H | DeviceType::FT4232H | DeviceType::FT232H => {
            check_limits(device, frequency, 30_000_000);
            if frequency <= 6_000_000 {
                (6_000_000 / frequency - 1, Some(true))
            } else {
                (30_000_000 / frequency - 1, Some(false))
            }
        }
        _ => panic!("Unknown device type: {:?}", device),
    }
}
fn clock_divisor ( device : DeviceType , frequency : u32 ) -> ( u32 , Option < bool > ) { match device { // FT2232D appears as FT2232C in FTD2XX DeviceType :: FT2232C => { check_limits ( device , frequency , 6_000_000 ) ; ( 6_000_000 / frequency - 1 , None ) } DeviceType :: FT2232H | DeviceType :: FT4232H | DeviceType :: FT232H => { check_limits ( device , frequency , 30_000_000 ) ; if frequency <= 6_000_000 { ( 6_000_000 / frequency - 1 , Some ( true ) ) } else { ( 30_000_000 / frequency - 1 , Some ( false ) ) } } _ => panic ! ( " " device ) , } }
calculate the clock divisor from a frequency
calculate the clock divisor from a frequency
device
DeviceType
frequency
u32
device
DeviceType
frequency
u32