fn new_from_ticks(ticks: u32) -> Self {
        let divider_value = ((ticks >> 16) + 1).next_power_of_two();
        let divider = match divider_value {
            1 => PRESCALER_A::DIV1,
            2 => PRESCALER_A::DIV2,
            4 => PRESCALER_A::DIV4,
            8 => PRESCALER_A::DIV8,
            16 => PRESCALER_A::DIV16,
            32 => PRESCALER_A::DIV32,
            64 => PRESCALER_A::DIV64,
            128 => PRESCALER_A::DIV128,
            256 => PRESCALER_A::DIV256,
            512 => PRESCALER_A::DIV512,
            1024 => PRESCALER_A::DIV1024,
            _ => PRESCALER_A::DIV1024, /* would be nice to catch this at compile time
                                        * (rust-lang/rust#51999) */
        };

        let cycles: u32 = ticks / divider_value as u32;

        TimerParams { divider, cycles }
    }
/// Common helper function that gets the best divider & calculates cycles
/// with that divider.
Common helper function that gets the best divider & calculates cycles
with that divider.
Common helper function that gets the best divider & calculates cycles with that divider .
fn new_from_ticks(ticks: u32) -> Self {
        let divider_value = ((ticks >> 16) + 1).next_power_of_two();
        let divider = match divider_value {
            1 => PRESCALER_A::DIV1,
            2 => PRESCALER_A::DIV2,
            4 => PRESCALER_A::DIV4,
            8 => PRESCALER_A::DIV8,
            16 => PRESCALER_A::DIV16,
            32 => PRESCALER_A::DIV32,
            64 => PRESCALER_A::DIV64,
            128 => PRESCALER_A::DIV128,
            256 => PRESCALER_A::DIV256,
            512 => PRESCALER_A::DIV512,
            1024 => PRESCALER_A::DIV1024,
            _ => PRESCALER_A::DIV1024, /* would be nice to catch this at compile time
                                        * (rust-lang/rust#51999) */
        };
        let cycles: u32 = ticks / divider_value as u32;
        TimerParams { divider, cycles }
    }
fn new_from_ticks ( ticks : u32 ) -> Self { let divider_value = ( ( ticks >> 16 ) + 1 ) . next_power_of_two ( ) ; let divider = match divider_value { 1 => PRESCALER_A :: DIV1 , 2 => PRESCALER_A :: DIV2 , 4 => PRESCALER_A :: DIV4 , 8 => PRESCALER_A :: DIV8 , 16 => PRESCALER_A :: DIV16 , 32 => PRESCALER_A :: DIV32 , 64 => PRESCALER_A :: DIV64 , 128 => PRESCALER_A :: DIV128 , 256 => PRESCALER_A :: DIV256 , 512 => PRESCALER_A :: DIV512 , 1024 => PRESCALER_A :: DIV1024 , _ => PRESCALER_A :: DIV1024 , /* would be nice to catch this at compile time
                                        * (rust-lang/rust#51999) */ } ; let cycles : u32 = ticks / divider_value as u32 ; TimerParams { divider , cycles } }
Common helper function that gets the best divider & calculates cycles
with that divider.
Common helper function that gets the best divider & calculates cycles with that divider .
ticks
u32
ticks
u32