Skip to main content

imxrt_hal/common/
ccm.rs

1use crate::iomuxc;
2
3/// Frequency (Hz) of the crystal oscillator.
4pub const XTAL_OSCILLATOR_HZ: u32 = 24_000_000;
5
6/// A CCM clock output pin.
7///
8/// This adapter configures the IOMUXC pad, and protects the pad
9/// from accidentally being used for anything else. It does not
10/// enable / disable anything in the CCM to enable the output. Use the functions
11/// in the [`output_source`](crate::ccm::output_source) module
12/// to the CLKO settings.
13pub struct Output<P> {
14    pin: P,
15}
16
17impl<P, const N: u8> Output<P>
18where
19    P: iomuxc::ccm::Pin<Function = iomuxc::ccm::Observable<N>>,
20{
21    /// Create the output pin.
22    #[inline]
23    pub fn new(mut pin: P) -> Self {
24        iomuxc::ccm::prepare(&mut pin);
25        Self { pin }
26    }
27
28    /// Release the output pin.
29    #[inline]
30    pub fn release(self) -> P {
31        self.pin
32    }
33}