ra4m1/system/
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 = 2 cycles (0.25 us)"]
44    _0000 = 0,
45    #[doc = "1: Wait time = 1024 cycles (128 us)"]
46    _0001 = 1,
47    #[doc = "2: Wait time = 2048 cycles (256 us)"]
48    _0010 = 2,
49    #[doc = "3: Wait time = 4096 cycles (512 us)"]
50    _0011 = 3,
51    #[doc = "4: Wait time = 8192 cycles (1024 us)"]
52    _0100 = 4,
53    #[doc = "5: Wait time = 16384 cycles (2048 us) (value after reset)"]
54    _0101 = 5,
55    #[doc = "6: Wait time = 32768 cycles (4096 us)"]
56    _0110 = 6,
57    #[doc = "7: Wait time = 65536 cycles (8192 us)"]
58    _0111 = 7,
59    #[doc = "8: Wait time = 131072 cycles (16384 us)"]
60    _1000 = 8,
61    #[doc = "9: Wait time = 262144 cycles (32768 us)."]
62    _1001 = 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::_0000),
76            1 => Some(MSTS_A::_0001),
77            2 => Some(MSTS_A::_0010),
78            3 => Some(MSTS_A::_0011),
79            4 => Some(MSTS_A::_0100),
80            5 => Some(MSTS_A::_0101),
81            6 => Some(MSTS_A::_0110),
82            7 => Some(MSTS_A::_0111),
83            8 => Some(MSTS_A::_1000),
84            9 => Some(MSTS_A::_1001),
85            _ => None,
86        }
87    }
88    #[doc = "Checks if the value of the field is `_0000`"]
89    #[inline(always)]
90    pub fn is_0000(&self) -> bool {
91        *self == MSTS_A::_0000
92    }
93    #[doc = "Checks if the value of the field is `_0001`"]
94    #[inline(always)]
95    pub fn is_0001(&self) -> bool {
96        *self == MSTS_A::_0001
97    }
98    #[doc = "Checks if the value of the field is `_0010`"]
99    #[inline(always)]
100    pub fn is_0010(&self) -> bool {
101        *self == MSTS_A::_0010
102    }
103    #[doc = "Checks if the value of the field is `_0011`"]
104    #[inline(always)]
105    pub fn is_0011(&self) -> bool {
106        *self == MSTS_A::_0011
107    }
108    #[doc = "Checks if the value of the field is `_0100`"]
109    #[inline(always)]
110    pub fn is_0100(&self) -> bool {
111        *self == MSTS_A::_0100
112    }
113    #[doc = "Checks if the value of the field is `_0101`"]
114    #[inline(always)]
115    pub fn is_0101(&self) -> bool {
116        *self == MSTS_A::_0101
117    }
118    #[doc = "Checks if the value of the field is `_0110`"]
119    #[inline(always)]
120    pub fn is_0110(&self) -> bool {
121        *self == MSTS_A::_0110
122    }
123    #[doc = "Checks if the value of the field is `_0111`"]
124    #[inline(always)]
125    pub fn is_0111(&self) -> bool {
126        *self == MSTS_A::_0111
127    }
128    #[doc = "Checks if the value of the field is `_1000`"]
129    #[inline(always)]
130    pub fn is_1000(&self) -> bool {
131        *self == MSTS_A::_1000
132    }
133    #[doc = "Checks if the value of the field is `_1001`"]
134    #[inline(always)]
135    pub fn is_1001(&self) -> bool {
136        *self == MSTS_A::_1001
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 = 2 cycles (0.25 us)"]
143    #[inline(always)]
144    pub fn _0000(self) -> &'a mut W {
145        self.variant(MSTS_A::_0000)
146    }
147    #[doc = "Wait time = 1024 cycles (128 us)"]
148    #[inline(always)]
149    pub fn _0001(self) -> &'a mut W {
150        self.variant(MSTS_A::_0001)
151    }
152    #[doc = "Wait time = 2048 cycles (256 us)"]
153    #[inline(always)]
154    pub fn _0010(self) -> &'a mut W {
155        self.variant(MSTS_A::_0010)
156    }
157    #[doc = "Wait time = 4096 cycles (512 us)"]
158    #[inline(always)]
159    pub fn _0011(self) -> &'a mut W {
160        self.variant(MSTS_A::_0011)
161    }
162    #[doc = "Wait time = 8192 cycles (1024 us)"]
163    #[inline(always)]
164    pub fn _0100(self) -> &'a mut W {
165        self.variant(MSTS_A::_0100)
166    }
167    #[doc = "Wait time = 16384 cycles (2048 us) (value after reset)"]
168    #[inline(always)]
169    pub fn _0101(self) -> &'a mut W {
170        self.variant(MSTS_A::_0101)
171    }
172    #[doc = "Wait time = 32768 cycles (4096 us)"]
173    #[inline(always)]
174    pub fn _0110(self) -> &'a mut W {
175        self.variant(MSTS_A::_0110)
176    }
177    #[doc = "Wait time = 65536 cycles (8192 us)"]
178    #[inline(always)]
179    pub fn _0111(self) -> &'a mut W {
180        self.variant(MSTS_A::_0111)
181    }
182    #[doc = "Wait time = 131072 cycles (16384 us)"]
183    #[inline(always)]
184    pub fn _1000(self) -> &'a mut W {
185        self.variant(MSTS_A::_1000)
186    }
187    #[doc = "Wait time = 262144 cycles (32768 us)."]
188    #[inline(always)]
189    pub fn _1001(self) -> &'a mut W {
190        self.variant(MSTS_A::_1001)
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}