ra6t2/sysc/
moscwtcr.rs

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 = "0: Wait time = 3 cycles (11.4 us)"]
44    _0X0 = 0,
45    #[doc = "1: Wait time = 35 cycles (133.5 us)"]
46    _0X1 = 1,
47    #[doc = "2: Wait time = 67 cycles (255.6 us)"]
48    _0X2 = 2,
49    #[doc = "3: Wait time = 131 cycles (499.7 us)"]
50    _0X3 = 3,
51    #[doc = "4: Wait time = 259 cycles (988.0 us)"]
52    _0X4 = 4,
53    #[doc = "5: Wait time = 547 cycles (2086.6 us)"]
54    _0X5 = 5,
55    #[doc = "6: Wait time = 1059 cycles (4039.8 us)"]
56    _0X6 = 6,
57    #[doc = "7: Wait time = 2147 cycles (8190.2 us)"]
58    _0X7 = 7,
59    #[doc = "8: Wait time = 4291 cycles (16368.9 us)"]
60    _0X8 = 8,
61    #[doc = "9: Wait time = 8163 cycles (31139.4 us)"]
62    _0X9 = 9,
63}
64impl From<MSTS_A> for u8 {
65    #[inline(always)]
66    fn from(variant: MSTS_A) -> Self {
67        variant as _
68    }
69}
70impl MSTS_R {
71    #[doc = "Get enumerated values variant"]
72    #[inline(always)]
73    pub fn variant(&self) -> Option<MSTS_A> {
74        match self.bits {
75            0 => Some(MSTS_A::_0X0),
76            1 => Some(MSTS_A::_0X1),
77            2 => Some(MSTS_A::_0X2),
78            3 => Some(MSTS_A::_0X3),
79            4 => Some(MSTS_A::_0X4),
80            5 => Some(MSTS_A::_0X5),
81            6 => Some(MSTS_A::_0X6),
82            7 => Some(MSTS_A::_0X7),
83            8 => Some(MSTS_A::_0X8),
84            9 => Some(MSTS_A::_0X9),
85            _ => None,
86        }
87    }
88    #[doc = "Checks if the value of the field is `_0X0`"]
89    #[inline(always)]
90    pub fn is_0x0(&self) -> bool {
91        *self == MSTS_A::_0X0
92    }
93    #[doc = "Checks if the value of the field is `_0X1`"]
94    #[inline(always)]
95    pub fn is_0x1(&self) -> bool {
96        *self == MSTS_A::_0X1
97    }
98    #[doc = "Checks if the value of the field is `_0X2`"]
99    #[inline(always)]
100    pub fn is_0x2(&self) -> bool {
101        *self == MSTS_A::_0X2
102    }
103    #[doc = "Checks if the value of the field is `_0X3`"]
104    #[inline(always)]
105    pub fn is_0x3(&self) -> bool {
106        *self == MSTS_A::_0X3
107    }
108    #[doc = "Checks if the value of the field is `_0X4`"]
109    #[inline(always)]
110    pub fn is_0x4(&self) -> bool {
111        *self == MSTS_A::_0X4
112    }
113    #[doc = "Checks if the value of the field is `_0X5`"]
114    #[inline(always)]
115    pub fn is_0x5(&self) -> bool {
116        *self == MSTS_A::_0X5
117    }
118    #[doc = "Checks if the value of the field is `_0X6`"]
119    #[inline(always)]
120    pub fn is_0x6(&self) -> bool {
121        *self == MSTS_A::_0X6
122    }
123    #[doc = "Checks if the value of the field is `_0X7`"]
124    #[inline(always)]
125    pub fn is_0x7(&self) -> bool {
126        *self == MSTS_A::_0X7
127    }
128    #[doc = "Checks if the value of the field is `_0X8`"]
129    #[inline(always)]
130    pub fn is_0x8(&self) -> bool {
131        *self == MSTS_A::_0X8
132    }
133    #[doc = "Checks if the value of the field is `_0X9`"]
134    #[inline(always)]
135    pub fn is_0x9(&self) -> bool {
136        *self == MSTS_A::_0X9
137    }
138}
139#[doc = "Field `MSTS` writer - Main Clock Oscillator Wait Time Setting"]
140pub type MSTS_W<'a, const O: u8> = crate::FieldWriter<'a, u8, MOSCWTCR_SPEC, u8, MSTS_A, 4, O>;
141impl<'a, const O: u8> MSTS_W<'a, O> {
142    #[doc = "Wait time = 3 cycles (11.4 us)"]
143    #[inline(always)]
144    pub fn _0x0(self) -> &'a mut W {
145        self.variant(MSTS_A::_0X0)
146    }
147    #[doc = "Wait time = 35 cycles (133.5 us)"]
148    #[inline(always)]
149    pub fn _0x1(self) -> &'a mut W {
150        self.variant(MSTS_A::_0X1)
151    }
152    #[doc = "Wait time = 67 cycles (255.6 us)"]
153    #[inline(always)]
154    pub fn _0x2(self) -> &'a mut W {
155        self.variant(MSTS_A::_0X2)
156    }
157    #[doc = "Wait time = 131 cycles (499.7 us)"]
158    #[inline(always)]
159    pub fn _0x3(self) -> &'a mut W {
160        self.variant(MSTS_A::_0X3)
161    }
162    #[doc = "Wait time = 259 cycles (988.0 us)"]
163    #[inline(always)]
164    pub fn _0x4(self) -> &'a mut W {
165        self.variant(MSTS_A::_0X4)
166    }
167    #[doc = "Wait time = 547 cycles (2086.6 us)"]
168    #[inline(always)]
169    pub fn _0x5(self) -> &'a mut W {
170        self.variant(MSTS_A::_0X5)
171    }
172    #[doc = "Wait time = 1059 cycles (4039.8 us)"]
173    #[inline(always)]
174    pub fn _0x6(self) -> &'a mut W {
175        self.variant(MSTS_A::_0X6)
176    }
177    #[doc = "Wait time = 2147 cycles (8190.2 us)"]
178    #[inline(always)]
179    pub fn _0x7(self) -> &'a mut W {
180        self.variant(MSTS_A::_0X7)
181    }
182    #[doc = "Wait time = 4291 cycles (16368.9 us)"]
183    #[inline(always)]
184    pub fn _0x8(self) -> &'a mut W {
185        self.variant(MSTS_A::_0X8)
186    }
187    #[doc = "Wait time = 8163 cycles (31139.4 us)"]
188    #[inline(always)]
189    pub fn _0x9(self) -> &'a mut W {
190        self.variant(MSTS_A::_0X9)
191    }
192}
193impl R {
194    #[doc = "Bits 0:3 - Main Clock Oscillator Wait Time Setting"]
195    #[inline(always)]
196    pub fn msts(&self) -> MSTS_R {
197        MSTS_R::new(self.bits & 0x0f)
198    }
199}
200impl W {
201    #[doc = "Bits 0:3 - Main Clock Oscillator Wait Time Setting"]
202    #[inline(always)]
203    #[must_use]
204    pub fn msts(&mut self) -> MSTS_W<0> {
205        MSTS_W::new(self)
206    }
207    #[doc = "Writes raw bits to the register."]
208    #[inline(always)]
209    pub unsafe fn bits(&mut self, bits: u8) -> &mut Self {
210        self.0.bits(bits);
211        self
212    }
213}
214#[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"]
215pub struct MOSCWTCR_SPEC;
216impl crate::RegisterSpec for MOSCWTCR_SPEC {
217    type Ux = u8;
218}
219#[doc = "`read()` method returns [moscwtcr::R](R) reader structure"]
220impl crate::Readable for MOSCWTCR_SPEC {
221    type Reader = R;
222}
223#[doc = "`write(|w| ..)` method takes [moscwtcr::W](W) writer structure"]
224impl crate::Writable for MOSCWTCR_SPEC {
225    type Writer = W;
226    const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
227    const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
228}
229#[doc = "`reset()` method sets MOSCWTCR to value 0x05"]
230impl crate::Resettable for MOSCWTCR_SPEC {
231    const RESET_VALUE: Self::Ux = 0x05;
232}