mimxrt685s_pac/clkctl1/
fc14fclksel.rs

1#[doc = "Register `FC14FCLKSEL` reader"]
2pub type R = crate::R<Fc14fclkselSpec>;
3#[doc = "Register `FC14FCLKSEL` writer"]
4pub type W = crate::W<Fc14fclkselSpec>;
5#[doc = "Flexxcomm Functional Clock Source Selection. . .\n\nValue on reset: 7"]
6#[cfg_attr(feature = "defmt", derive(defmt::Format))]
7#[derive(Clone, Copy, Debug, PartialEq, Eq)]
8#[repr(u8)]
9pub enum Sel {
10    #[doc = "0: SFRO Clock."]
11    SfroClk = 0,
12    #[doc = "1: FFRO Clock."]
13    FfroClk = 1,
14    #[doc = "2: Audio PLL Clock."]
15    AudioPllClk = 2,
16    #[doc = "3: Master Clock In."]
17    MasterClk = 3,
18    #[doc = "4: FCn FRG Clock."]
19    FcnFrgClk = 4,
20    #[doc = "7: None, this may be selected in order to reduce power when no output is needed."]
21    None = 7,
22}
23impl From<Sel> for u8 {
24    #[inline(always)]
25    fn from(variant: Sel) -> Self {
26        variant as _
27    }
28}
29impl crate::FieldSpec for Sel {
30    type Ux = u8;
31}
32impl crate::IsEnum for Sel {}
33#[doc = "Field `SEL` reader - Flexxcomm Functional Clock Source Selection. . ."]
34pub type SelR = crate::FieldReader<Sel>;
35impl SelR {
36    #[doc = "Get enumerated values variant"]
37    #[inline(always)]
38    pub const fn variant(&self) -> Option<Sel> {
39        match self.bits {
40            0 => Some(Sel::SfroClk),
41            1 => Some(Sel::FfroClk),
42            2 => Some(Sel::AudioPllClk),
43            3 => Some(Sel::MasterClk),
44            4 => Some(Sel::FcnFrgClk),
45            7 => Some(Sel::None),
46            _ => None,
47        }
48    }
49    #[doc = "SFRO Clock."]
50    #[inline(always)]
51    pub fn is_sfro_clk(&self) -> bool {
52        *self == Sel::SfroClk
53    }
54    #[doc = "FFRO Clock."]
55    #[inline(always)]
56    pub fn is_ffro_clk(&self) -> bool {
57        *self == Sel::FfroClk
58    }
59    #[doc = "Audio PLL Clock."]
60    #[inline(always)]
61    pub fn is_audio_pll_clk(&self) -> bool {
62        *self == Sel::AudioPllClk
63    }
64    #[doc = "Master Clock In."]
65    #[inline(always)]
66    pub fn is_master_clk(&self) -> bool {
67        *self == Sel::MasterClk
68    }
69    #[doc = "FCn FRG Clock."]
70    #[inline(always)]
71    pub fn is_fcn_frg_clk(&self) -> bool {
72        *self == Sel::FcnFrgClk
73    }
74    #[doc = "None, this may be selected in order to reduce power when no output is needed."]
75    #[inline(always)]
76    pub fn is_none(&self) -> bool {
77        *self == Sel::None
78    }
79}
80#[doc = "Field `SEL` writer - Flexxcomm Functional Clock Source Selection. . ."]
81pub type SelW<'a, REG> = crate::FieldWriter<'a, REG, 3, Sel>;
82impl<'a, REG> SelW<'a, REG>
83where
84    REG: crate::Writable + crate::RegisterSpec,
85    REG::Ux: From<u8>,
86{
87    #[doc = "SFRO Clock."]
88    #[inline(always)]
89    pub fn sfro_clk(self) -> &'a mut crate::W<REG> {
90        self.variant(Sel::SfroClk)
91    }
92    #[doc = "FFRO Clock."]
93    #[inline(always)]
94    pub fn ffro_clk(self) -> &'a mut crate::W<REG> {
95        self.variant(Sel::FfroClk)
96    }
97    #[doc = "Audio PLL Clock."]
98    #[inline(always)]
99    pub fn audio_pll_clk(self) -> &'a mut crate::W<REG> {
100        self.variant(Sel::AudioPllClk)
101    }
102    #[doc = "Master Clock In."]
103    #[inline(always)]
104    pub fn master_clk(self) -> &'a mut crate::W<REG> {
105        self.variant(Sel::MasterClk)
106    }
107    #[doc = "FCn FRG Clock."]
108    #[inline(always)]
109    pub fn fcn_frg_clk(self) -> &'a mut crate::W<REG> {
110        self.variant(Sel::FcnFrgClk)
111    }
112    #[doc = "None, this may be selected in order to reduce power when no output is needed."]
113    #[inline(always)]
114    pub fn none(self) -> &'a mut crate::W<REG> {
115        self.variant(Sel::None)
116    }
117}
118impl R {
119    #[doc = "Bits 0:2 - Flexxcomm Functional Clock Source Selection. . ."]
120    #[inline(always)]
121    pub fn sel(&self) -> SelR {
122        SelR::new((self.bits & 7) as u8)
123    }
124}
125#[cfg(feature = "debug")]
126impl core::fmt::Debug for R {
127    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
128        f.debug_struct("FC14FCLKSEL")
129            .field("sel", &self.sel())
130            .finish()
131    }
132}
133impl W {
134    #[doc = "Bits 0:2 - Flexxcomm Functional Clock Source Selection. . ."]
135    #[inline(always)]
136    pub fn sel(&mut self) -> SelW<Fc14fclkselSpec> {
137        SelW::new(self, 0)
138    }
139}
140#[doc = "flexcomm14 clock selection\n\nYou can [`read`](crate::Reg::read) this register and get [`fc14fclksel::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`fc14fclksel::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
141pub struct Fc14fclkselSpec;
142impl crate::RegisterSpec for Fc14fclkselSpec {
143    type Ux = u32;
144}
145#[doc = "`read()` method returns [`fc14fclksel::R`](R) reader structure"]
146impl crate::Readable for Fc14fclkselSpec {}
147#[doc = "`write(|w| ..)` method takes [`fc14fclksel::W`](W) writer structure"]
148impl crate::Writable for Fc14fclkselSpec {
149    type Safety = crate::Unsafe;
150    const ZERO_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
151    const ONE_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
152}
153#[doc = "`reset()` method sets FC14FCLKSEL to value 0x07"]
154impl crate::Resettable for Fc14fclkselSpec {
155    const RESET_VALUE: u32 = 0x07;
156}