mcxa_pac/mrcc0/
mrcc_systick_clksel.rs1#[doc = "Register `MRCC_SYSTICK_CLKSEL` reader"]
2pub type R = crate::R<MrccSystickClkselSpec>;
3#[doc = "Register `MRCC_SYSTICK_CLKSEL` writer"]
4pub type W = crate::W<MrccSystickClkselSpec>;
5#[doc = "Functional Clock Mux Select\n\nValue on reset: 3"]
6#[cfg_attr(feature = "defmt", derive(defmt::Format))]
7#[derive(Clone, Copy, Debug, PartialEq, Eq)]
8#[repr(u8)]
9pub enum Mux {
10 #[doc = "0: CPU_CLK"]
11 ClkrootCpu = 0,
12 #[doc = "1: CLK_1M"]
13 Clkroot1m = 1,
14 #[doc = "2: CLK_16K"]
15 Clkroot16k = 2,
16}
17impl From<Mux> for u8 {
18 #[inline(always)]
19 fn from(variant: Mux) -> Self {
20 variant as _
21 }
22}
23impl crate::FieldSpec for Mux {
24 type Ux = u8;
25}
26impl crate::IsEnum for Mux {}
27#[doc = "Field `MUX` reader - Functional Clock Mux Select"]
28pub type MuxR = crate::FieldReader<Mux>;
29impl MuxR {
30 #[doc = "Get enumerated values variant"]
31 #[inline(always)]
32 pub const fn variant(&self) -> Option<Mux> {
33 match self.bits {
34 0 => Some(Mux::ClkrootCpu),
35 1 => Some(Mux::Clkroot1m),
36 2 => Some(Mux::Clkroot16k),
37 _ => None,
38 }
39 }
40 #[doc = "CPU_CLK"]
41 #[inline(always)]
42 pub fn is_clkroot_cpu(&self) -> bool {
43 *self == Mux::ClkrootCpu
44 }
45 #[doc = "CLK_1M"]
46 #[inline(always)]
47 pub fn is_clkroot_1m(&self) -> bool {
48 *self == Mux::Clkroot1m
49 }
50 #[doc = "CLK_16K"]
51 #[inline(always)]
52 pub fn is_clkroot_16k(&self) -> bool {
53 *self == Mux::Clkroot16k
54 }
55}
56#[doc = "Field `MUX` writer - Functional Clock Mux Select"]
57pub type MuxW<'a, REG> = crate::FieldWriter<'a, REG, 2, Mux>;
58impl<'a, REG> MuxW<'a, REG>
59where
60 REG: crate::Writable + crate::RegisterSpec,
61 REG::Ux: From<u8>,
62{
63 #[doc = "CPU_CLK"]
64 #[inline(always)]
65 pub fn clkroot_cpu(self) -> &'a mut crate::W<REG> {
66 self.variant(Mux::ClkrootCpu)
67 }
68 #[doc = "CLK_1M"]
69 #[inline(always)]
70 pub fn clkroot_1m(self) -> &'a mut crate::W<REG> {
71 self.variant(Mux::Clkroot1m)
72 }
73 #[doc = "CLK_16K"]
74 #[inline(always)]
75 pub fn clkroot_16k(self) -> &'a mut crate::W<REG> {
76 self.variant(Mux::Clkroot16k)
77 }
78}
79impl R {
80 #[doc = "Bits 0:1 - Functional Clock Mux Select"]
81 #[inline(always)]
82 pub fn mux(&self) -> MuxR {
83 MuxR::new((self.bits & 3) 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("MRCC_SYSTICK_CLKSEL").field("mux", &self.mux()).finish()
90 }
91}
92impl W {
93 #[doc = "Bits 0:1 - Functional Clock Mux Select"]
94 #[inline(always)]
95 pub fn mux(&mut self) -> MuxW<'_, MrccSystickClkselSpec> {
96 MuxW::new(self, 0)
97 }
98}
99#[doc = "SYSTICK clock selection control\n\nYou can [`read`](crate::Reg::read) this register and get [`mrcc_systick_clksel::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`mrcc_systick_clksel::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
100pub struct MrccSystickClkselSpec;
101impl crate::RegisterSpec for MrccSystickClkselSpec {
102 type Ux = u32;
103}
104#[doc = "`read()` method returns [`mrcc_systick_clksel::R`](R) reader structure"]
105impl crate::Readable for MrccSystickClkselSpec {}
106#[doc = "`write(|w| ..)` method takes [`mrcc_systick_clksel::W`](W) writer structure"]
107impl crate::Writable for MrccSystickClkselSpec {
108 type Safety = crate::Unsafe;
109}
110#[doc = "`reset()` method sets MRCC_SYSTICK_CLKSEL to value 0x03"]
111impl crate::Resettable for MrccSystickClkselSpec {
112 const RESET_VALUE: u32 = 0x03;
113}