mimxrt685s_pac/clkctl0/
utickfclksel.rs

1#[doc = "Register `UTICKFCLKSEL` reader"]
2pub type R = crate::R<UtickfclkselSpec>;
3#[doc = "Register `UTICKFCLKSEL` writer"]
4pub type W = crate::W<UtickfclkselSpec>;
5#[doc = "uTICK 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: Low Power Oscillator Clock (LPOSC)."]
11    Lposc = 0,
12    #[doc = "7: None, this may be selected in order to reduce power when no output is needed."]
13    None = 7,
14}
15impl From<Sel> for u8 {
16    #[inline(always)]
17    fn from(variant: Sel) -> Self {
18        variant as _
19    }
20}
21impl crate::FieldSpec for Sel {
22    type Ux = u8;
23}
24impl crate::IsEnum for Sel {}
25#[doc = "Field `SEL` reader - uTICK Functional Clock Source Selection. ."]
26pub type SelR = crate::FieldReader<Sel>;
27impl SelR {
28    #[doc = "Get enumerated values variant"]
29    #[inline(always)]
30    pub const fn variant(&self) -> Option<Sel> {
31        match self.bits {
32            0 => Some(Sel::Lposc),
33            7 => Some(Sel::None),
34            _ => None,
35        }
36    }
37    #[doc = "Low Power Oscillator Clock (LPOSC)."]
38    #[inline(always)]
39    pub fn is_lposc(&self) -> bool {
40        *self == Sel::Lposc
41    }
42    #[doc = "None, this may be selected in order to reduce power when no output is needed."]
43    #[inline(always)]
44    pub fn is_none(&self) -> bool {
45        *self == Sel::None
46    }
47}
48#[doc = "Field `SEL` writer - uTICK Functional Clock Source Selection. ."]
49pub type SelW<'a, REG> = crate::FieldWriter<'a, REG, 3, Sel>;
50impl<'a, REG> SelW<'a, REG>
51where
52    REG: crate::Writable + crate::RegisterSpec,
53    REG::Ux: From<u8>,
54{
55    #[doc = "Low Power Oscillator Clock (LPOSC)."]
56    #[inline(always)]
57    pub fn lposc(self) -> &'a mut crate::W<REG> {
58        self.variant(Sel::Lposc)
59    }
60    #[doc = "None, this may be selected in order to reduce power when no output is needed."]
61    #[inline(always)]
62    pub fn none(self) -> &'a mut crate::W<REG> {
63        self.variant(Sel::None)
64    }
65}
66impl R {
67    #[doc = "Bits 0:2 - uTICK Functional Clock Source Selection. ."]
68    #[inline(always)]
69    pub fn sel(&self) -> SelR {
70        SelR::new((self.bits & 7) as u8)
71    }
72}
73#[cfg(feature = "debug")]
74impl core::fmt::Debug for R {
75    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
76        f.debug_struct("UTICKFCLKSEL")
77            .field("sel", &self.sel())
78            .finish()
79    }
80}
81impl W {
82    #[doc = "Bits 0:2 - uTICK Functional Clock Source Selection. ."]
83    #[inline(always)]
84    pub fn sel(&mut self) -> SelW<UtickfclkselSpec> {
85        SelW::new(self, 0)
86    }
87}
88#[doc = "UTICK fclk selection\n\nYou can [`read`](crate::Reg::read) this register and get [`utickfclksel::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`utickfclksel::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
89pub struct UtickfclkselSpec;
90impl crate::RegisterSpec for UtickfclkselSpec {
91    type Ux = u32;
92}
93#[doc = "`read()` method returns [`utickfclksel::R`](R) reader structure"]
94impl crate::Readable for UtickfclkselSpec {}
95#[doc = "`write(|w| ..)` method takes [`utickfclksel::W`](W) writer structure"]
96impl crate::Writable for UtickfclkselSpec {
97    type Safety = crate::Unsafe;
98    const ZERO_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
99    const ONE_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
100}
101#[doc = "`reset()` method sets UTICKFCLKSEL to value 0x07"]
102impl crate::Resettable for UtickfclkselSpec {
103    const RESET_VALUE: u32 = 0x07;
104}