fn enable_external_32kosc(osc32kctrl: &mut OSC32KCTRL) {
    osc32kctrl.xosc32k.modify(|_, w| {
        w.ondemand().clear_bit();
        // Enable 32khz output
        w.en32k().set_bit();
        w.en1k().set_bit();
        // Crystal connected to xin32/xout32
        w.xtalen().set_bit();
        w.enable().set_bit();
        w.cgm().xt();
        w.runstdby().set_bit()
    });

    osc32kctrl.rtcctrl.write(|w| w.rtcsel().xosc1k());

    // Wait for the oscillator to stabilize
    while osc32kctrl.status.read().xosc32krdy().bit_is_clear() {}
}
/// Turn on the external 32hkz oscillator
Turn on the external 32hkz oscillator
Turn on the external 32hkz oscillator
fn enable_external_32kosc(osc32kctrl: &mut OSC32KCTRL) {
    osc32kctrl.xosc32k.modify(|_, w| {
        w.ondemand().clear_bit();
        // Enable 32khz output
        w.en32k().set_bit();
        w.en1k().set_bit();
        // Crystal connected to xin32/xout32
        w.xtalen().set_bit();
        w.enable().set_bit();
        w.cgm().xt();
        w.runstdby().set_bit()
    });
    osc32kctrl.rtcctrl.write(|w| w.rtcsel().xosc1k());
    // Wait for the oscillator to stabilize
    while osc32kctrl.status.read().xosc32krdy().bit_is_clear() {}
}
fn enable_external_32kosc ( osc32kctrl : & mut OSC32KCTRL ) { osc32kctrl . xosc32k . modify ( | _ , w | { w . ondemand ( ) . clear_bit ( ) ; // Enable 32khz output w . en32k ( ) . set_bit ( ) ; w . en1k ( ) . set_bit ( ) ; // Crystal connected to xin32/xout32 w . xtalen ( ) . set_bit ( ) ; w . enable ( ) . set_bit ( ) ; w . cgm ( ) . xt ( ) ; w . runstdby ( ) . set_bit ( ) } ) ; osc32kctrl . rtcctrl . write ( | w | w . rtcsel ( ) . xosc1k ( ) ) ; // Wait for the oscillator to stabilize while osc32kctrl . status . read ( ) . xosc32krdy ( ) . bit_is_clear ( ) { } }
Turn on the external 32hkz oscillator
Turn on the external 32hkz oscillator
osc32kctrl
&mut OSC32KCTRL
osc32kctrl
&mut OSC32KCTRL