mimxrt685s_pac/clkctl1/
clkoutsel0.rs1#[doc = "Register `CLKOUTSEL0` reader"]
2pub type R = crate::R<Clkoutsel0Spec>;
3#[doc = "Register `CLKOUTSEL0` writer"]
4pub type W = crate::W<Clkoutsel0Spec>;
5#[doc = "Clock Output Select 1st Stage. . .\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: XTALIN Clock."]
13 XtalinClk = 1,
14 #[doc = "2: Low Power Oscillator Clock (LPOSC)."]
15 Lposc = 2,
16 #[doc = "3: FFRO Clock."]
17 FfroClk = 3,
18 #[doc = "4: Main Clock."]
19 MainClk = 4,
20 #[doc = "6: DSP Main Clock."]
21 DspMainClk = 6,
22 #[doc = "7: None, this may be selected in order to reduce power when no output is needed."]
23 None = 7,
24}
25impl From<Sel> for u8 {
26 #[inline(always)]
27 fn from(variant: Sel) -> Self {
28 variant as _
29 }
30}
31impl crate::FieldSpec for Sel {
32 type Ux = u8;
33}
34impl crate::IsEnum for Sel {}
35#[doc = "Field `SEL` reader - Clock Output Select 1st Stage. . ."]
36pub type SelR = crate::FieldReader<Sel>;
37impl SelR {
38 #[doc = "Get enumerated values variant"]
39 #[inline(always)]
40 pub const fn variant(&self) -> Option<Sel> {
41 match self.bits {
42 0 => Some(Sel::SfroClk),
43 1 => Some(Sel::XtalinClk),
44 2 => Some(Sel::Lposc),
45 3 => Some(Sel::FfroClk),
46 4 => Some(Sel::MainClk),
47 6 => Some(Sel::DspMainClk),
48 7 => Some(Sel::None),
49 _ => None,
50 }
51 }
52 #[doc = "SFRO Clock."]
53 #[inline(always)]
54 pub fn is_sfro_clk(&self) -> bool {
55 *self == Sel::SfroClk
56 }
57 #[doc = "XTALIN Clock."]
58 #[inline(always)]
59 pub fn is_xtalin_clk(&self) -> bool {
60 *self == Sel::XtalinClk
61 }
62 #[doc = "Low Power Oscillator Clock (LPOSC)."]
63 #[inline(always)]
64 pub fn is_lposc(&self) -> bool {
65 *self == Sel::Lposc
66 }
67 #[doc = "FFRO Clock."]
68 #[inline(always)]
69 pub fn is_ffro_clk(&self) -> bool {
70 *self == Sel::FfroClk
71 }
72 #[doc = "Main Clock."]
73 #[inline(always)]
74 pub fn is_main_clk(&self) -> bool {
75 *self == Sel::MainClk
76 }
77 #[doc = "DSP Main Clock."]
78 #[inline(always)]
79 pub fn is_dsp_main_clk(&self) -> bool {
80 *self == Sel::DspMainClk
81 }
82 #[doc = "None, this may be selected in order to reduce power when no output is needed."]
83 #[inline(always)]
84 pub fn is_none(&self) -> bool {
85 *self == Sel::None
86 }
87}
88#[doc = "Field `SEL` writer - Clock Output Select 1st Stage. . ."]
89pub type SelW<'a, REG> = crate::FieldWriter<'a, REG, 3, Sel>;
90impl<'a, REG> SelW<'a, REG>
91where
92 REG: crate::Writable + crate::RegisterSpec,
93 REG::Ux: From<u8>,
94{
95 #[doc = "SFRO Clock."]
96 #[inline(always)]
97 pub fn sfro_clk(self) -> &'a mut crate::W<REG> {
98 self.variant(Sel::SfroClk)
99 }
100 #[doc = "XTALIN Clock."]
101 #[inline(always)]
102 pub fn xtalin_clk(self) -> &'a mut crate::W<REG> {
103 self.variant(Sel::XtalinClk)
104 }
105 #[doc = "Low Power Oscillator Clock (LPOSC)."]
106 #[inline(always)]
107 pub fn lposc(self) -> &'a mut crate::W<REG> {
108 self.variant(Sel::Lposc)
109 }
110 #[doc = "FFRO Clock."]
111 #[inline(always)]
112 pub fn ffro_clk(self) -> &'a mut crate::W<REG> {
113 self.variant(Sel::FfroClk)
114 }
115 #[doc = "Main Clock."]
116 #[inline(always)]
117 pub fn main_clk(self) -> &'a mut crate::W<REG> {
118 self.variant(Sel::MainClk)
119 }
120 #[doc = "DSP Main Clock."]
121 #[inline(always)]
122 pub fn dsp_main_clk(self) -> &'a mut crate::W<REG> {
123 self.variant(Sel::DspMainClk)
124 }
125 #[doc = "None, this may be selected in order to reduce power when no output is needed."]
126 #[inline(always)]
127 pub fn none(self) -> &'a mut crate::W<REG> {
128 self.variant(Sel::None)
129 }
130}
131impl R {
132 #[doc = "Bits 0:2 - Clock Output Select 1st Stage. . ."]
133 #[inline(always)]
134 pub fn sel(&self) -> SelR {
135 SelR::new((self.bits & 7) as u8)
136 }
137}
138#[cfg(feature = "debug")]
139impl core::fmt::Debug for R {
140 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
141 f.debug_struct("CLKOUTSEL0")
142 .field("sel", &self.sel())
143 .finish()
144 }
145}
146impl W {
147 #[doc = "Bits 0:2 - Clock Output Select 1st Stage. . ."]
148 #[inline(always)]
149 pub fn sel(&mut self) -> SelW<Clkoutsel0Spec> {
150 SelW::new(self, 0)
151 }
152}
153#[doc = "clock out selection 0\n\nYou can [`read`](crate::Reg::read) this register and get [`clkoutsel0::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`clkoutsel0::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
154pub struct Clkoutsel0Spec;
155impl crate::RegisterSpec for Clkoutsel0Spec {
156 type Ux = u32;
157}
158#[doc = "`read()` method returns [`clkoutsel0::R`](R) reader structure"]
159impl crate::Readable for Clkoutsel0Spec {}
160#[doc = "`write(|w| ..)` method takes [`clkoutsel0::W`](W) writer structure"]
161impl crate::Writable for Clkoutsel0Spec {
162 type Safety = crate::Unsafe;
163 const ZERO_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
164 const ONE_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
165}
166#[doc = "`reset()` method sets CLKOUTSEL0 to value 0x07"]
167impl crate::Resettable for Clkoutsel0Spec {
168 const RESET_VALUE: u32 = 0x07;
169}