1#[doc = "Reader of register CR"]
2pub type R = crate::R<u32, super::CR>;
3#[doc = "Writer for register CR"]
4pub type W = crate::W<u32, super::CR>;
5#[doc = "Register CR `reset()`'s with value 0x2000"]
6impl crate::ResetValue for super::CR {
7 type Type = u32;
8 #[inline(always)]
9 fn reset_value() -> Self::Type {
10 0x2000
11 }
12}
13#[doc = "Reader of field `SYNCOKIE`"]
14pub type SYNCOKIE_R = crate::R<bool, bool>;
15#[doc = "Write proxy for field `SYNCOKIE`"]
16pub struct SYNCOKIE_W<'a> {
17 w: &'a mut W,
18}
19impl<'a> SYNCOKIE_W<'a> {
20 #[doc = r"Sets the field bit"]
21 #[inline(always)]
22 pub fn set_bit(self) -> &'a mut W {
23 self.bit(true)
24 }
25 #[doc = r"Clears the field bit"]
26 #[inline(always)]
27 pub fn clear_bit(self) -> &'a mut W {
28 self.bit(false)
29 }
30 #[doc = r"Writes raw bits to the field"]
31 #[inline(always)]
32 pub fn bit(self, value: bool) -> &'a mut W {
33 self.w.bits = (self.w.bits & !0x01) | ((value as u32) & 0x01);
34 self.w
35 }
36}
37#[doc = "Reader of field `SYNCWARNIE`"]
38pub type SYNCWARNIE_R = crate::R<bool, bool>;
39#[doc = "Write proxy for field `SYNCWARNIE`"]
40pub struct SYNCWARNIE_W<'a> {
41 w: &'a mut W,
42}
43impl<'a> SYNCWARNIE_W<'a> {
44 #[doc = r"Sets the field bit"]
45 #[inline(always)]
46 pub fn set_bit(self) -> &'a mut W {
47 self.bit(true)
48 }
49 #[doc = r"Clears the field bit"]
50 #[inline(always)]
51 pub fn clear_bit(self) -> &'a mut W {
52 self.bit(false)
53 }
54 #[doc = r"Writes raw bits to the field"]
55 #[inline(always)]
56 pub fn bit(self, value: bool) -> &'a mut W {
57 self.w.bits = (self.w.bits & !(0x01 << 1)) | (((value as u32) & 0x01) << 1);
58 self.w
59 }
60}
61#[doc = "Reader of field `ERRIE`"]
62pub type ERRIE_R = crate::R<bool, bool>;
63#[doc = "Write proxy for field `ERRIE`"]
64pub struct ERRIE_W<'a> {
65 w: &'a mut W,
66}
67impl<'a> ERRIE_W<'a> {
68 #[doc = r"Sets the field bit"]
69 #[inline(always)]
70 pub fn set_bit(self) -> &'a mut W {
71 self.bit(true)
72 }
73 #[doc = r"Clears the field bit"]
74 #[inline(always)]
75 pub fn clear_bit(self) -> &'a mut W {
76 self.bit(false)
77 }
78 #[doc = r"Writes raw bits to the field"]
79 #[inline(always)]
80 pub fn bit(self, value: bool) -> &'a mut W {
81 self.w.bits = (self.w.bits & !(0x01 << 2)) | (((value as u32) & 0x01) << 2);
82 self.w
83 }
84}
85#[doc = "Reader of field `ESYNCIE`"]
86pub type ESYNCIE_R = crate::R<bool, bool>;
87#[doc = "Write proxy for field `ESYNCIE`"]
88pub struct ESYNCIE_W<'a> {
89 w: &'a mut W,
90}
91impl<'a> ESYNCIE_W<'a> {
92 #[doc = r"Sets the field bit"]
93 #[inline(always)]
94 pub fn set_bit(self) -> &'a mut W {
95 self.bit(true)
96 }
97 #[doc = r"Clears the field bit"]
98 #[inline(always)]
99 pub fn clear_bit(self) -> &'a mut W {
100 self.bit(false)
101 }
102 #[doc = r"Writes raw bits to the field"]
103 #[inline(always)]
104 pub fn bit(self, value: bool) -> &'a mut W {
105 self.w.bits = (self.w.bits & !(0x01 << 3)) | (((value as u32) & 0x01) << 3);
106 self.w
107 }
108}
109#[doc = "Reader of field `CEN`"]
110pub type CEN_R = crate::R<bool, bool>;
111#[doc = "Write proxy for field `CEN`"]
112pub struct CEN_W<'a> {
113 w: &'a mut W,
114}
115impl<'a> CEN_W<'a> {
116 #[doc = r"Sets the field bit"]
117 #[inline(always)]
118 pub fn set_bit(self) -> &'a mut W {
119 self.bit(true)
120 }
121 #[doc = r"Clears the field bit"]
122 #[inline(always)]
123 pub fn clear_bit(self) -> &'a mut W {
124 self.bit(false)
125 }
126 #[doc = r"Writes raw bits to the field"]
127 #[inline(always)]
128 pub fn bit(self, value: bool) -> &'a mut W {
129 self.w.bits = (self.w.bits & !(0x01 << 5)) | (((value as u32) & 0x01) << 5);
130 self.w
131 }
132}
133#[doc = "Reader of field `AUTOTRIMEN`"]
134pub type AUTOTRIMEN_R = crate::R<bool, bool>;
135#[doc = "Write proxy for field `AUTOTRIMEN`"]
136pub struct AUTOTRIMEN_W<'a> {
137 w: &'a mut W,
138}
139impl<'a> AUTOTRIMEN_W<'a> {
140 #[doc = r"Sets the field bit"]
141 #[inline(always)]
142 pub fn set_bit(self) -> &'a mut W {
143 self.bit(true)
144 }
145 #[doc = r"Clears the field bit"]
146 #[inline(always)]
147 pub fn clear_bit(self) -> &'a mut W {
148 self.bit(false)
149 }
150 #[doc = r"Writes raw bits to the field"]
151 #[inline(always)]
152 pub fn bit(self, value: bool) -> &'a mut W {
153 self.w.bits = (self.w.bits & !(0x01 << 6)) | (((value as u32) & 0x01) << 6);
154 self.w
155 }
156}
157#[doc = "Reader of field `SWSYNC`"]
158pub type SWSYNC_R = crate::R<bool, bool>;
159#[doc = "Write proxy for field `SWSYNC`"]
160pub struct SWSYNC_W<'a> {
161 w: &'a mut W,
162}
163impl<'a> SWSYNC_W<'a> {
164 #[doc = r"Sets the field bit"]
165 #[inline(always)]
166 pub fn set_bit(self) -> &'a mut W {
167 self.bit(true)
168 }
169 #[doc = r"Clears the field bit"]
170 #[inline(always)]
171 pub fn clear_bit(self) -> &'a mut W {
172 self.bit(false)
173 }
174 #[doc = r"Writes raw bits to the field"]
175 #[inline(always)]
176 pub fn bit(self, value: bool) -> &'a mut W {
177 self.w.bits = (self.w.bits & !(0x01 << 7)) | (((value as u32) & 0x01) << 7);
178 self.w
179 }
180}
181#[doc = "Reader of field `TRIM`"]
182pub type TRIM_R = crate::R<u8, u8>;
183#[doc = "Write proxy for field `TRIM`"]
184pub struct TRIM_W<'a> {
185 w: &'a mut W,
186}
187impl<'a> TRIM_W<'a> {
188 #[doc = r"Writes raw bits to the field"]
189 #[inline(always)]
190 pub unsafe fn bits(self, value: u8) -> &'a mut W {
191 self.w.bits = (self.w.bits & !(0x3f << 8)) | (((value as u32) & 0x3f) << 8);
192 self.w
193 }
194}
195impl R {
196 #[doc = "Bit 0 - SYNC event OK interrupt enable"]
197 #[inline(always)]
198 pub fn syncokie(&self) -> SYNCOKIE_R {
199 SYNCOKIE_R::new((self.bits & 0x01) != 0)
200 }
201 #[doc = "Bit 1 - SYNC warning interrupt enable"]
202 #[inline(always)]
203 pub fn syncwarnie(&self) -> SYNCWARNIE_R {
204 SYNCWARNIE_R::new(((self.bits >> 1) & 0x01) != 0)
205 }
206 #[doc = "Bit 2 - Synchronization or trimming error interrupt enable"]
207 #[inline(always)]
208 pub fn errie(&self) -> ERRIE_R {
209 ERRIE_R::new(((self.bits >> 2) & 0x01) != 0)
210 }
211 #[doc = "Bit 3 - Expected SYNC interrupt enable"]
212 #[inline(always)]
213 pub fn esyncie(&self) -> ESYNCIE_R {
214 ESYNCIE_R::new(((self.bits >> 3) & 0x01) != 0)
215 }
216 #[doc = "Bit 5 - Frequency error counter enable"]
217 #[inline(always)]
218 pub fn cen(&self) -> CEN_R {
219 CEN_R::new(((self.bits >> 5) & 0x01) != 0)
220 }
221 #[doc = "Bit 6 - Automatic trimming enable"]
222 #[inline(always)]
223 pub fn autotrimen(&self) -> AUTOTRIMEN_R {
224 AUTOTRIMEN_R::new(((self.bits >> 6) & 0x01) != 0)
225 }
226 #[doc = "Bit 7 - Automatic trimming enable"]
227 #[inline(always)]
228 pub fn swsync(&self) -> SWSYNC_R {
229 SWSYNC_R::new(((self.bits >> 7) & 0x01) != 0)
230 }
231 #[doc = "Bits 8:13 - HSI48 oscillator smooth trimming"]
232 #[inline(always)]
233 pub fn trim(&self) -> TRIM_R {
234 TRIM_R::new(((self.bits >> 8) & 0x3f) as u8)
235 }
236}
237impl W {
238 #[doc = "Bit 0 - SYNC event OK interrupt enable"]
239 #[inline(always)]
240 pub fn syncokie(&mut self) -> SYNCOKIE_W {
241 SYNCOKIE_W { w: self }
242 }
243 #[doc = "Bit 1 - SYNC warning interrupt enable"]
244 #[inline(always)]
245 pub fn syncwarnie(&mut self) -> SYNCWARNIE_W {
246 SYNCWARNIE_W { w: self }
247 }
248 #[doc = "Bit 2 - Synchronization or trimming error interrupt enable"]
249 #[inline(always)]
250 pub fn errie(&mut self) -> ERRIE_W {
251 ERRIE_W { w: self }
252 }
253 #[doc = "Bit 3 - Expected SYNC interrupt enable"]
254 #[inline(always)]
255 pub fn esyncie(&mut self) -> ESYNCIE_W {
256 ESYNCIE_W { w: self }
257 }
258 #[doc = "Bit 5 - Frequency error counter enable"]
259 #[inline(always)]
260 pub fn cen(&mut self) -> CEN_W {
261 CEN_W { w: self }
262 }
263 #[doc = "Bit 6 - Automatic trimming enable"]
264 #[inline(always)]
265 pub fn autotrimen(&mut self) -> AUTOTRIMEN_W {
266 AUTOTRIMEN_W { w: self }
267 }
268 #[doc = "Bit 7 - Automatic trimming enable"]
269 #[inline(always)]
270 pub fn swsync(&mut self) -> SWSYNC_W {
271 SWSYNC_W { w: self }
272 }
273 #[doc = "Bits 8:13 - HSI48 oscillator smooth trimming"]
274 #[inline(always)]
275 pub fn trim(&mut self) -> TRIM_W {
276 TRIM_W { w: self }
277 }
278}