1#[doc = "Register `MOSCWTCR` reader"]
2pub struct R(crate::R<MOSCWTCR_SPEC>);
3impl core::ops::Deref for R {
4 type Target = crate::R<MOSCWTCR_SPEC>;
5 #[inline(always)]
6 fn deref(&self) -> &Self::Target {
7 &self.0
8 }
9}
10impl From<crate::R<MOSCWTCR_SPEC>> for R {
11 #[inline(always)]
12 fn from(reader: crate::R<MOSCWTCR_SPEC>) -> Self {
13 R(reader)
14 }
15}
16#[doc = "Register `MOSCWTCR` writer"]
17pub struct W(crate::W<MOSCWTCR_SPEC>);
18impl core::ops::Deref for W {
19 type Target = crate::W<MOSCWTCR_SPEC>;
20 #[inline(always)]
21 fn deref(&self) -> &Self::Target {
22 &self.0
23 }
24}
25impl core::ops::DerefMut for W {
26 #[inline(always)]
27 fn deref_mut(&mut self) -> &mut Self::Target {
28 &mut self.0
29 }
30}
31impl From<crate::W<MOSCWTCR_SPEC>> for W {
32 #[inline(always)]
33 fn from(writer: crate::W<MOSCWTCR_SPEC>) -> Self {
34 W(writer)
35 }
36}
37#[doc = "Field `MSTS` reader - Main clock oscillator wait time setting"]
38pub type MSTS_R = crate::FieldReader<u8, MSTS_A>;
39#[doc = "Main clock oscillator wait time setting\n\nValue on reset: 5"]
40#[derive(Clone, Copy, Debug, PartialEq, Eq)]
41#[repr(u8)]
42pub enum MSTS_A {
43 #[doc = "1: Wait time = 35 cycles (133.5 μs)"]
44 _0001 = 1,
45 #[doc = "2: Wait time = 67 cycles (255.6 μs)"]
46 _0010 = 2,
47 #[doc = "3: Wait time = 131 cycles (499.7 μs)"]
48 _0011 = 3,
49 #[doc = "4: Wait time = 259 cycles (988.0 μs)"]
50 _0100 = 4,
51 #[doc = "5: Wait time = 547 cycles (2086.6 μs) (value after reset)"]
52 _0101 = 5,
53 #[doc = "6: Wait time = 1059 cycles (4039.8 μs)"]
54 _0110 = 6,
55 #[doc = "7: Wait time = 2147 cycles (8190.2 μs)"]
56 _0111 = 7,
57 #[doc = "8: Wait time = 4291 cycles (16368.9 μs)"]
58 _1000 = 8,
59 #[doc = "9: Wait time = 8163 cycles (31139.4 μs)."]
60 _1001 = 9,
61}
62impl From<MSTS_A> for u8 {
63 #[inline(always)]
64 fn from(variant: MSTS_A) -> Self {
65 variant as _
66 }
67}
68impl MSTS_R {
69 #[doc = "Get enumerated values variant"]
70 #[inline(always)]
71 pub fn variant(&self) -> Option<MSTS_A> {
72 match self.bits {
73 1 => Some(MSTS_A::_0001),
74 2 => Some(MSTS_A::_0010),
75 3 => Some(MSTS_A::_0011),
76 4 => Some(MSTS_A::_0100),
77 5 => Some(MSTS_A::_0101),
78 6 => Some(MSTS_A::_0110),
79 7 => Some(MSTS_A::_0111),
80 8 => Some(MSTS_A::_1000),
81 9 => Some(MSTS_A::_1001),
82 _ => None,
83 }
84 }
85 #[doc = "Checks if the value of the field is `_0001`"]
86 #[inline(always)]
87 pub fn is_0001(&self) -> bool {
88 *self == MSTS_A::_0001
89 }
90 #[doc = "Checks if the value of the field is `_0010`"]
91 #[inline(always)]
92 pub fn is_0010(&self) -> bool {
93 *self == MSTS_A::_0010
94 }
95 #[doc = "Checks if the value of the field is `_0011`"]
96 #[inline(always)]
97 pub fn is_0011(&self) -> bool {
98 *self == MSTS_A::_0011
99 }
100 #[doc = "Checks if the value of the field is `_0100`"]
101 #[inline(always)]
102 pub fn is_0100(&self) -> bool {
103 *self == MSTS_A::_0100
104 }
105 #[doc = "Checks if the value of the field is `_0101`"]
106 #[inline(always)]
107 pub fn is_0101(&self) -> bool {
108 *self == MSTS_A::_0101
109 }
110 #[doc = "Checks if the value of the field is `_0110`"]
111 #[inline(always)]
112 pub fn is_0110(&self) -> bool {
113 *self == MSTS_A::_0110
114 }
115 #[doc = "Checks if the value of the field is `_0111`"]
116 #[inline(always)]
117 pub fn is_0111(&self) -> bool {
118 *self == MSTS_A::_0111
119 }
120 #[doc = "Checks if the value of the field is `_1000`"]
121 #[inline(always)]
122 pub fn is_1000(&self) -> bool {
123 *self == MSTS_A::_1000
124 }
125 #[doc = "Checks if the value of the field is `_1001`"]
126 #[inline(always)]
127 pub fn is_1001(&self) -> bool {
128 *self == MSTS_A::_1001
129 }
130}
131#[doc = "Field `MSTS` writer - Main clock oscillator wait time setting"]
132pub type MSTS_W<'a, const O: u8> = crate::FieldWriter<'a, u8, MOSCWTCR_SPEC, u8, MSTS_A, 4, O>;
133impl<'a, const O: u8> MSTS_W<'a, O> {
134 #[doc = "Wait time = 35 cycles (133.5 μs)"]
135 #[inline(always)]
136 pub fn _0001(self) -> &'a mut W {
137 self.variant(MSTS_A::_0001)
138 }
139 #[doc = "Wait time = 67 cycles (255.6 μs)"]
140 #[inline(always)]
141 pub fn _0010(self) -> &'a mut W {
142 self.variant(MSTS_A::_0010)
143 }
144 #[doc = "Wait time = 131 cycles (499.7 μs)"]
145 #[inline(always)]
146 pub fn _0011(self) -> &'a mut W {
147 self.variant(MSTS_A::_0011)
148 }
149 #[doc = "Wait time = 259 cycles (988.0 μs)"]
150 #[inline(always)]
151 pub fn _0100(self) -> &'a mut W {
152 self.variant(MSTS_A::_0100)
153 }
154 #[doc = "Wait time = 547 cycles (2086.6 μs) (value after reset)"]
155 #[inline(always)]
156 pub fn _0101(self) -> &'a mut W {
157 self.variant(MSTS_A::_0101)
158 }
159 #[doc = "Wait time = 1059 cycles (4039.8 μs)"]
160 #[inline(always)]
161 pub fn _0110(self) -> &'a mut W {
162 self.variant(MSTS_A::_0110)
163 }
164 #[doc = "Wait time = 2147 cycles (8190.2 μs)"]
165 #[inline(always)]
166 pub fn _0111(self) -> &'a mut W {
167 self.variant(MSTS_A::_0111)
168 }
169 #[doc = "Wait time = 4291 cycles (16368.9 μs)"]
170 #[inline(always)]
171 pub fn _1000(self) -> &'a mut W {
172 self.variant(MSTS_A::_1000)
173 }
174 #[doc = "Wait time = 8163 cycles (31139.4 μs)."]
175 #[inline(always)]
176 pub fn _1001(self) -> &'a mut W {
177 self.variant(MSTS_A::_1001)
178 }
179}
180impl R {
181 #[doc = "Bits 0:3 - Main clock oscillator wait time setting"]
182 #[inline(always)]
183 pub fn msts(&self) -> MSTS_R {
184 MSTS_R::new(self.bits & 0x0f)
185 }
186}
187impl W {
188 #[doc = "Bits 0:3 - Main clock oscillator wait time setting"]
189 #[inline(always)]
190 #[must_use]
191 pub fn msts(&mut self) -> MSTS_W<0> {
192 MSTS_W::new(self)
193 }
194 #[doc = "Writes raw bits to the register."]
195 #[inline(always)]
196 pub unsafe fn bits(&mut self, bits: u8) -> &mut Self {
197 self.0.bits(bits);
198 self
199 }
200}
201#[doc = "Main Clock Oscillator Wait Control Register\n\nThis register you can [`read`](crate::generic::Reg::read), [`write_with_zero`](crate::generic::Reg::write_with_zero), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`modify`](crate::generic::Reg::modify). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [moscwtcr](index.html) module"]
202pub struct MOSCWTCR_SPEC;
203impl crate::RegisterSpec for MOSCWTCR_SPEC {
204 type Ux = u8;
205}
206#[doc = "`read()` method returns [moscwtcr::R](R) reader structure"]
207impl crate::Readable for MOSCWTCR_SPEC {
208 type Reader = R;
209}
210#[doc = "`write(|w| ..)` method takes [moscwtcr::W](W) writer structure"]
211impl crate::Writable for MOSCWTCR_SPEC {
212 type Writer = W;
213 const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
214 const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
215}
216#[doc = "`reset()` method sets MOSCWTCR to value 0x05"]
217impl crate::Resettable for MOSCWTCR_SPEC {
218 const RESET_VALUE: Self::Ux = 0x05;
219}