mimxrt685s_pac/clkctl0/
sysoscbypass.rs

1#[doc = "Register `SYSOSCBYPASS` reader"]
2pub type R = crate::R<SysoscbypassSpec>;
3#[doc = "Register `SYSOSCBYPASS` writer"]
4pub type W = crate::W<SysoscbypassSpec>;
5#[doc = "Extenal Clock Source Selection.\n\nValue on reset: 0"]
6#[cfg_attr(feature = "defmt", derive(defmt::Format))]
7#[derive(Clone, Copy, Debug, PartialEq, Eq)]
8#[repr(u8)]
9pub enum Sel {
10    #[doc = "0: External XTAL Clock."]
11    ExtXtalClk = 0,
12    #[doc = "1: Clock IN Clock."]
13    ClockInClk = 1,
14    #[doc = "7: NONE.this may be selected in order to reduce power when no output is needed."]
15    None = 7,
16}
17impl From<Sel> for u8 {
18    #[inline(always)]
19    fn from(variant: Sel) -> Self {
20        variant as _
21    }
22}
23impl crate::FieldSpec for Sel {
24    type Ux = u8;
25}
26impl crate::IsEnum for Sel {}
27#[doc = "Field `SEL` reader - Extenal Clock Source Selection."]
28pub type SelR = crate::FieldReader<Sel>;
29impl SelR {
30    #[doc = "Get enumerated values variant"]
31    #[inline(always)]
32    pub const fn variant(&self) -> Option<Sel> {
33        match self.bits {
34            0 => Some(Sel::ExtXtalClk),
35            1 => Some(Sel::ClockInClk),
36            7 => Some(Sel::None),
37            _ => None,
38        }
39    }
40    #[doc = "External XTAL Clock."]
41    #[inline(always)]
42    pub fn is_ext_xtal_clk(&self) -> bool {
43        *self == Sel::ExtXtalClk
44    }
45    #[doc = "Clock IN Clock."]
46    #[inline(always)]
47    pub fn is_clock_in_clk(&self) -> bool {
48        *self == Sel::ClockInClk
49    }
50    #[doc = "NONE.this may be selected in order to reduce power when no output is needed."]
51    #[inline(always)]
52    pub fn is_none(&self) -> bool {
53        *self == Sel::None
54    }
55}
56#[doc = "Field `SEL` writer - Extenal Clock Source Selection."]
57pub type SelW<'a, REG> = crate::FieldWriter<'a, REG, 3, Sel>;
58impl<'a, REG> SelW<'a, REG>
59where
60    REG: crate::Writable + crate::RegisterSpec,
61    REG::Ux: From<u8>,
62{
63    #[doc = "External XTAL Clock."]
64    #[inline(always)]
65    pub fn ext_xtal_clk(self) -> &'a mut crate::W<REG> {
66        self.variant(Sel::ExtXtalClk)
67    }
68    #[doc = "Clock IN Clock."]
69    #[inline(always)]
70    pub fn clock_in_clk(self) -> &'a mut crate::W<REG> {
71        self.variant(Sel::ClockInClk)
72    }
73    #[doc = "NONE.this may be selected in order to reduce power when no output is needed."]
74    #[inline(always)]
75    pub fn none(self) -> &'a mut crate::W<REG> {
76        self.variant(Sel::None)
77    }
78}
79impl R {
80    #[doc = "Bits 0:2 - Extenal Clock Source Selection."]
81    #[inline(always)]
82    pub fn sel(&self) -> SelR {
83        SelR::new((self.bits & 7) as u8)
84    }
85}
86#[cfg(feature = "debug")]
87impl core::fmt::Debug for R {
88    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
89        f.debug_struct("SYSOSCBYPASS")
90            .field("sel", &self.sel())
91            .finish()
92    }
93}
94impl W {
95    #[doc = "Bits 0:2 - Extenal Clock Source Selection."]
96    #[inline(always)]
97    pub fn sel(&mut self) -> SelW<SysoscbypassSpec> {
98        SelW::new(self, 0)
99    }
100}
101#[doc = "system oscillator bypass\n\nYou can [`read`](crate::Reg::read) this register and get [`sysoscbypass::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`sysoscbypass::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
102pub struct SysoscbypassSpec;
103impl crate::RegisterSpec for SysoscbypassSpec {
104    type Ux = u32;
105}
106#[doc = "`read()` method returns [`sysoscbypass::R`](R) reader structure"]
107impl crate::Readable for SysoscbypassSpec {}
108#[doc = "`write(|w| ..)` method takes [`sysoscbypass::W`](W) writer structure"]
109impl crate::Writable for SysoscbypassSpec {
110    type Safety = crate::Unsafe;
111    const ZERO_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
112    const ONE_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
113}
114#[doc = "`reset()` method sets SYSOSCBYPASS to value 0"]
115impl crate::Resettable for SysoscbypassSpec {
116    const RESET_VALUE: u32 = 0;
117}