1#[doc = "Register `CKOCR` reader"]
2pub struct R(crate::R<CKOCR_SPEC>);
3impl core::ops::Deref for R {
4 type Target = crate::R<CKOCR_SPEC>;
5 #[inline(always)]
6 fn deref(&self) -> &Self::Target {
7 &self.0
8 }
9}
10impl From<crate::R<CKOCR_SPEC>> for R {
11 #[inline(always)]
12 fn from(reader: crate::R<CKOCR_SPEC>) -> Self {
13 R(reader)
14 }
15}
16#[doc = "Register `CKOCR` writer"]
17pub struct W(crate::W<CKOCR_SPEC>);
18impl core::ops::Deref for W {
19 type Target = crate::W<CKOCR_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<CKOCR_SPEC>> for W {
32 #[inline(always)]
33 fn from(writer: crate::W<CKOCR_SPEC>) -> Self {
34 W(writer)
35 }
36}
37#[doc = "Field `CKOSEL` reader - Clock out source select"]
38pub type CKOSEL_R = crate::FieldReader<u8, CKOSEL_A>;
39#[doc = "Clock out source select\n\nValue on reset: 0"]
40#[derive(Clone, Copy, Debug, PartialEq, Eq)]
41#[repr(u8)]
42pub enum CKOSEL_A {
43 #[doc = "0: HOCO"]
44 _000 = 0,
45 #[doc = "1: MOCO"]
46 _001 = 1,
47 #[doc = "2: LOCO"]
48 _010 = 2,
49 #[doc = "3: MOSC"]
50 _011 = 3,
51 #[doc = "4: SOSC"]
52 _100 = 4,
53}
54impl From<CKOSEL_A> for u8 {
55 #[inline(always)]
56 fn from(variant: CKOSEL_A) -> Self {
57 variant as _
58 }
59}
60impl CKOSEL_R {
61 #[doc = "Get enumerated values variant"]
62 #[inline(always)]
63 pub fn variant(&self) -> Option<CKOSEL_A> {
64 match self.bits {
65 0 => Some(CKOSEL_A::_000),
66 1 => Some(CKOSEL_A::_001),
67 2 => Some(CKOSEL_A::_010),
68 3 => Some(CKOSEL_A::_011),
69 4 => Some(CKOSEL_A::_100),
70 _ => None,
71 }
72 }
73 #[doc = "Checks if the value of the field is `_000`"]
74 #[inline(always)]
75 pub fn is_000(&self) -> bool {
76 *self == CKOSEL_A::_000
77 }
78 #[doc = "Checks if the value of the field is `_001`"]
79 #[inline(always)]
80 pub fn is_001(&self) -> bool {
81 *self == CKOSEL_A::_001
82 }
83 #[doc = "Checks if the value of the field is `_010`"]
84 #[inline(always)]
85 pub fn is_010(&self) -> bool {
86 *self == CKOSEL_A::_010
87 }
88 #[doc = "Checks if the value of the field is `_011`"]
89 #[inline(always)]
90 pub fn is_011(&self) -> bool {
91 *self == CKOSEL_A::_011
92 }
93 #[doc = "Checks if the value of the field is `_100`"]
94 #[inline(always)]
95 pub fn is_100(&self) -> bool {
96 *self == CKOSEL_A::_100
97 }
98}
99#[doc = "Field `CKOSEL` writer - Clock out source select"]
100pub type CKOSEL_W<'a, const O: u8> = crate::FieldWriter<'a, u8, CKOCR_SPEC, u8, CKOSEL_A, 3, O>;
101impl<'a, const O: u8> CKOSEL_W<'a, O> {
102 #[doc = "HOCO"]
103 #[inline(always)]
104 pub fn _000(self) -> &'a mut W {
105 self.variant(CKOSEL_A::_000)
106 }
107 #[doc = "MOCO"]
108 #[inline(always)]
109 pub fn _001(self) -> &'a mut W {
110 self.variant(CKOSEL_A::_001)
111 }
112 #[doc = "LOCO"]
113 #[inline(always)]
114 pub fn _010(self) -> &'a mut W {
115 self.variant(CKOSEL_A::_010)
116 }
117 #[doc = "MOSC"]
118 #[inline(always)]
119 pub fn _011(self) -> &'a mut W {
120 self.variant(CKOSEL_A::_011)
121 }
122 #[doc = "SOSC"]
123 #[inline(always)]
124 pub fn _100(self) -> &'a mut W {
125 self.variant(CKOSEL_A::_100)
126 }
127}
128#[doc = "Field `CKODIV` reader - Clock out input frequency Division Select"]
129pub type CKODIV_R = crate::FieldReader<u8, CKODIV_A>;
130#[doc = "Clock out input frequency Division Select\n\nValue on reset: 0"]
131#[derive(Clone, Copy, Debug, PartialEq, Eq)]
132#[repr(u8)]
133pub enum CKODIV_A {
134 #[doc = "0: /1"]
135 _000 = 0,
136 #[doc = "1: /2"]
137 _001 = 1,
138 #[doc = "2: /4"]
139 _010 = 2,
140 #[doc = "3: /8"]
141 _011 = 3,
142 #[doc = "4: /16"]
143 _100 = 4,
144 #[doc = "5: /32"]
145 _101 = 5,
146 #[doc = "6: /64"]
147 _110 = 6,
148 #[doc = "7: /128"]
149 _111 = 7,
150}
151impl From<CKODIV_A> for u8 {
152 #[inline(always)]
153 fn from(variant: CKODIV_A) -> Self {
154 variant as _
155 }
156}
157impl CKODIV_R {
158 #[doc = "Get enumerated values variant"]
159 #[inline(always)]
160 pub fn variant(&self) -> CKODIV_A {
161 match self.bits {
162 0 => CKODIV_A::_000,
163 1 => CKODIV_A::_001,
164 2 => CKODIV_A::_010,
165 3 => CKODIV_A::_011,
166 4 => CKODIV_A::_100,
167 5 => CKODIV_A::_101,
168 6 => CKODIV_A::_110,
169 7 => CKODIV_A::_111,
170 _ => unreachable!(),
171 }
172 }
173 #[doc = "Checks if the value of the field is `_000`"]
174 #[inline(always)]
175 pub fn is_000(&self) -> bool {
176 *self == CKODIV_A::_000
177 }
178 #[doc = "Checks if the value of the field is `_001`"]
179 #[inline(always)]
180 pub fn is_001(&self) -> bool {
181 *self == CKODIV_A::_001
182 }
183 #[doc = "Checks if the value of the field is `_010`"]
184 #[inline(always)]
185 pub fn is_010(&self) -> bool {
186 *self == CKODIV_A::_010
187 }
188 #[doc = "Checks if the value of the field is `_011`"]
189 #[inline(always)]
190 pub fn is_011(&self) -> bool {
191 *self == CKODIV_A::_011
192 }
193 #[doc = "Checks if the value of the field is `_100`"]
194 #[inline(always)]
195 pub fn is_100(&self) -> bool {
196 *self == CKODIV_A::_100
197 }
198 #[doc = "Checks if the value of the field is `_101`"]
199 #[inline(always)]
200 pub fn is_101(&self) -> bool {
201 *self == CKODIV_A::_101
202 }
203 #[doc = "Checks if the value of the field is `_110`"]
204 #[inline(always)]
205 pub fn is_110(&self) -> bool {
206 *self == CKODIV_A::_110
207 }
208 #[doc = "Checks if the value of the field is `_111`"]
209 #[inline(always)]
210 pub fn is_111(&self) -> bool {
211 *self == CKODIV_A::_111
212 }
213}
214#[doc = "Field `CKODIV` writer - Clock out input frequency Division Select"]
215pub type CKODIV_W<'a, const O: u8> = crate::FieldWriterSafe<'a, u8, CKOCR_SPEC, u8, CKODIV_A, 3, O>;
216impl<'a, const O: u8> CKODIV_W<'a, O> {
217 #[doc = "/1"]
218 #[inline(always)]
219 pub fn _000(self) -> &'a mut W {
220 self.variant(CKODIV_A::_000)
221 }
222 #[doc = "/2"]
223 #[inline(always)]
224 pub fn _001(self) -> &'a mut W {
225 self.variant(CKODIV_A::_001)
226 }
227 #[doc = "/4"]
228 #[inline(always)]
229 pub fn _010(self) -> &'a mut W {
230 self.variant(CKODIV_A::_010)
231 }
232 #[doc = "/8"]
233 #[inline(always)]
234 pub fn _011(self) -> &'a mut W {
235 self.variant(CKODIV_A::_011)
236 }
237 #[doc = "/16"]
238 #[inline(always)]
239 pub fn _100(self) -> &'a mut W {
240 self.variant(CKODIV_A::_100)
241 }
242 #[doc = "/32"]
243 #[inline(always)]
244 pub fn _101(self) -> &'a mut W {
245 self.variant(CKODIV_A::_101)
246 }
247 #[doc = "/64"]
248 #[inline(always)]
249 pub fn _110(self) -> &'a mut W {
250 self.variant(CKODIV_A::_110)
251 }
252 #[doc = "/128"]
253 #[inline(always)]
254 pub fn _111(self) -> &'a mut W {
255 self.variant(CKODIV_A::_111)
256 }
257}
258#[doc = "Field `CKOEN` reader - Clock out enable"]
259pub type CKOEN_R = crate::BitReader<CKOEN_A>;
260#[doc = "Clock out enable\n\nValue on reset: 0"]
261#[derive(Clone, Copy, Debug, PartialEq, Eq)]
262pub enum CKOEN_A {
263 #[doc = "0: Clock Out disable"]
264 _0 = 0,
265 #[doc = "1: Clock Out enable"]
266 _1 = 1,
267}
268impl From<CKOEN_A> for bool {
269 #[inline(always)]
270 fn from(variant: CKOEN_A) -> Self {
271 variant as u8 != 0
272 }
273}
274impl CKOEN_R {
275 #[doc = "Get enumerated values variant"]
276 #[inline(always)]
277 pub fn variant(&self) -> CKOEN_A {
278 match self.bits {
279 false => CKOEN_A::_0,
280 true => CKOEN_A::_1,
281 }
282 }
283 #[doc = "Checks if the value of the field is `_0`"]
284 #[inline(always)]
285 pub fn is_0(&self) -> bool {
286 *self == CKOEN_A::_0
287 }
288 #[doc = "Checks if the value of the field is `_1`"]
289 #[inline(always)]
290 pub fn is_1(&self) -> bool {
291 *self == CKOEN_A::_1
292 }
293}
294#[doc = "Field `CKOEN` writer - Clock out enable"]
295pub type CKOEN_W<'a, const O: u8> = crate::BitWriter<'a, u8, CKOCR_SPEC, CKOEN_A, O>;
296impl<'a, const O: u8> CKOEN_W<'a, O> {
297 #[doc = "Clock Out disable"]
298 #[inline(always)]
299 pub fn _0(self) -> &'a mut W {
300 self.variant(CKOEN_A::_0)
301 }
302 #[doc = "Clock Out enable"]
303 #[inline(always)]
304 pub fn _1(self) -> &'a mut W {
305 self.variant(CKOEN_A::_1)
306 }
307}
308impl R {
309 #[doc = "Bits 0:2 - Clock out source select"]
310 #[inline(always)]
311 pub fn ckosel(&self) -> CKOSEL_R {
312 CKOSEL_R::new(self.bits & 7)
313 }
314 #[doc = "Bits 4:6 - Clock out input frequency Division Select"]
315 #[inline(always)]
316 pub fn ckodiv(&self) -> CKODIV_R {
317 CKODIV_R::new((self.bits >> 4) & 7)
318 }
319 #[doc = "Bit 7 - Clock out enable"]
320 #[inline(always)]
321 pub fn ckoen(&self) -> CKOEN_R {
322 CKOEN_R::new(((self.bits >> 7) & 1) != 0)
323 }
324}
325impl W {
326 #[doc = "Bits 0:2 - Clock out source select"]
327 #[inline(always)]
328 #[must_use]
329 pub fn ckosel(&mut self) -> CKOSEL_W<0> {
330 CKOSEL_W::new(self)
331 }
332 #[doc = "Bits 4:6 - Clock out input frequency Division Select"]
333 #[inline(always)]
334 #[must_use]
335 pub fn ckodiv(&mut self) -> CKODIV_W<4> {
336 CKODIV_W::new(self)
337 }
338 #[doc = "Bit 7 - Clock out enable"]
339 #[inline(always)]
340 #[must_use]
341 pub fn ckoen(&mut self) -> CKOEN_W<7> {
342 CKOEN_W::new(self)
343 }
344 #[doc = "Writes raw bits to the register."]
345 #[inline(always)]
346 pub unsafe fn bits(&mut self, bits: u8) -> &mut Self {
347 self.0.bits(bits);
348 self
349 }
350}
351#[doc = "Clock Out 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 [ckocr](index.html) module"]
352pub struct CKOCR_SPEC;
353impl crate::RegisterSpec for CKOCR_SPEC {
354 type Ux = u8;
355}
356#[doc = "`read()` method returns [ckocr::R](R) reader structure"]
357impl crate::Readable for CKOCR_SPEC {
358 type Reader = R;
359}
360#[doc = "`write(|w| ..)` method takes [ckocr::W](W) writer structure"]
361impl crate::Writable for CKOCR_SPEC {
362 type Writer = W;
363 const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
364 const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
365}
366#[doc = "`reset()` method sets CKOCR to value 0"]
367impl crate::Resettable for CKOCR_SPEC {
368 const RESET_VALUE: Self::Ux = 0;
369}