1#[doc = "Register `RTCCR%s` reader"]
2pub struct R(crate::R<RTCCR_SPEC>);
3impl core::ops::Deref for R {
4 type Target = crate::R<RTCCR_SPEC>;
5 #[inline(always)]
6 fn deref(&self) -> &Self::Target {
7 &self.0
8 }
9}
10impl From<crate::R<RTCCR_SPEC>> for R {
11 #[inline(always)]
12 fn from(reader: crate::R<RTCCR_SPEC>) -> Self {
13 R(reader)
14 }
15}
16#[doc = "Register `RTCCR%s` writer"]
17pub struct W(crate::W<RTCCR_SPEC>);
18impl core::ops::Deref for W {
19 type Target = crate::W<RTCCR_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<RTCCR_SPEC>> for W {
32 #[inline(always)]
33 fn from(writer: crate::W<RTCCR_SPEC>) -> Self {
34 W(writer)
35 }
36}
37#[doc = "Field `TCCT` reader - Time Capture Control"]
38pub type TCCT_R = crate::FieldReader<u8, TCCT_A>;
39#[doc = "Time Capture Control\n\nValue on reset: 0"]
40#[derive(Clone, Copy, Debug, PartialEq, Eq)]
41#[repr(u8)]
42pub enum TCCT_A {
43 #[doc = "0: No event is detected."]
44 _00 = 0,
45 #[doc = "1: Rising edge is detected."]
46 _01 = 1,
47 #[doc = "2: Falling edge is detected."]
48 _10 = 2,
49 #[doc = "3: Both edges are detected."]
50 _11 = 3,
51}
52impl From<TCCT_A> for u8 {
53 #[inline(always)]
54 fn from(variant: TCCT_A) -> Self {
55 variant as _
56 }
57}
58impl TCCT_R {
59 #[doc = "Get enumerated values variant"]
60 #[inline(always)]
61 pub fn variant(&self) -> TCCT_A {
62 match self.bits {
63 0 => TCCT_A::_00,
64 1 => TCCT_A::_01,
65 2 => TCCT_A::_10,
66 3 => TCCT_A::_11,
67 _ => unreachable!(),
68 }
69 }
70 #[doc = "Checks if the value of the field is `_00`"]
71 #[inline(always)]
72 pub fn is_00(&self) -> bool {
73 *self == TCCT_A::_00
74 }
75 #[doc = "Checks if the value of the field is `_01`"]
76 #[inline(always)]
77 pub fn is_01(&self) -> bool {
78 *self == TCCT_A::_01
79 }
80 #[doc = "Checks if the value of the field is `_10`"]
81 #[inline(always)]
82 pub fn is_10(&self) -> bool {
83 *self == TCCT_A::_10
84 }
85 #[doc = "Checks if the value of the field is `_11`"]
86 #[inline(always)]
87 pub fn is_11(&self) -> bool {
88 *self == TCCT_A::_11
89 }
90}
91#[doc = "Field `TCCT` writer - Time Capture Control"]
92pub type TCCT_W<'a, const O: u8> = crate::FieldWriterSafe<'a, u8, RTCCR_SPEC, u8, TCCT_A, 2, O>;
93impl<'a, const O: u8> TCCT_W<'a, O> {
94 #[doc = "No event is detected."]
95 #[inline(always)]
96 pub fn _00(self) -> &'a mut W {
97 self.variant(TCCT_A::_00)
98 }
99 #[doc = "Rising edge is detected."]
100 #[inline(always)]
101 pub fn _01(self) -> &'a mut W {
102 self.variant(TCCT_A::_01)
103 }
104 #[doc = "Falling edge is detected."]
105 #[inline(always)]
106 pub fn _10(self) -> &'a mut W {
107 self.variant(TCCT_A::_10)
108 }
109 #[doc = "Both edges are detected."]
110 #[inline(always)]
111 pub fn _11(self) -> &'a mut W {
112 self.variant(TCCT_A::_11)
113 }
114}
115#[doc = "Field `TCST` reader - Time Capture Status\n\nThe field is **modified** in some way after a read operation."]
116pub type TCST_R = crate::BitReader<TCST_A>;
117#[doc = "Time Capture Status\n\nValue on reset: 0"]
118#[derive(Clone, Copy, Debug, PartialEq, Eq)]
119pub enum TCST_A {
120 #[doc = "0: No event is detected."]
121 _0 = 0,
122 #[doc = "1: An event is detected."]
123 _1 = 1,
124}
125impl From<TCST_A> for bool {
126 #[inline(always)]
127 fn from(variant: TCST_A) -> Self {
128 variant as u8 != 0
129 }
130}
131impl TCST_R {
132 #[doc = "Get enumerated values variant"]
133 #[inline(always)]
134 pub fn variant(&self) -> TCST_A {
135 match self.bits {
136 false => TCST_A::_0,
137 true => TCST_A::_1,
138 }
139 }
140 #[doc = "Checks if the value of the field is `_0`"]
141 #[inline(always)]
142 pub fn is_0(&self) -> bool {
143 *self == TCST_A::_0
144 }
145 #[doc = "Checks if the value of the field is `_1`"]
146 #[inline(always)]
147 pub fn is_1(&self) -> bool {
148 *self == TCST_A::_1
149 }
150}
151#[doc = "Field `TCST` writer - Time Capture Status"]
152pub type TCST_W<'a, const O: u8> = crate::BitWriter0C<'a, u8, RTCCR_SPEC, TCST_A, O>;
153impl<'a, const O: u8> TCST_W<'a, O> {
154 #[doc = "No event is detected."]
155 #[inline(always)]
156 pub fn _0(self) -> &'a mut W {
157 self.variant(TCST_A::_0)
158 }
159 #[doc = "An event is detected."]
160 #[inline(always)]
161 pub fn _1(self) -> &'a mut W {
162 self.variant(TCST_A::_1)
163 }
164}
165#[doc = "Field `TCNF` reader - Time Capture Noise Filter Control"]
166pub type TCNF_R = crate::FieldReader<u8, TCNF_A>;
167#[doc = "Time Capture Noise Filter Control\n\nValue on reset: 0"]
168#[derive(Clone, Copy, Debug, PartialEq, Eq)]
169#[repr(u8)]
170pub enum TCNF_A {
171 #[doc = "0: The noise filter is off."]
172 _00 = 0,
173 #[doc = "1: Setting prohibited"]
174 _01 = 1,
175 #[doc = "2: The noise filter is on (count source)."]
176 _10 = 2,
177 #[doc = "3: The noise filter is on (count source by divided by 32)."]
178 _11 = 3,
179}
180impl From<TCNF_A> for u8 {
181 #[inline(always)]
182 fn from(variant: TCNF_A) -> Self {
183 variant as _
184 }
185}
186impl TCNF_R {
187 #[doc = "Get enumerated values variant"]
188 #[inline(always)]
189 pub fn variant(&self) -> TCNF_A {
190 match self.bits {
191 0 => TCNF_A::_00,
192 1 => TCNF_A::_01,
193 2 => TCNF_A::_10,
194 3 => TCNF_A::_11,
195 _ => unreachable!(),
196 }
197 }
198 #[doc = "Checks if the value of the field is `_00`"]
199 #[inline(always)]
200 pub fn is_00(&self) -> bool {
201 *self == TCNF_A::_00
202 }
203 #[doc = "Checks if the value of the field is `_01`"]
204 #[inline(always)]
205 pub fn is_01(&self) -> bool {
206 *self == TCNF_A::_01
207 }
208 #[doc = "Checks if the value of the field is `_10`"]
209 #[inline(always)]
210 pub fn is_10(&self) -> bool {
211 *self == TCNF_A::_10
212 }
213 #[doc = "Checks if the value of the field is `_11`"]
214 #[inline(always)]
215 pub fn is_11(&self) -> bool {
216 *self == TCNF_A::_11
217 }
218}
219#[doc = "Field `TCNF` writer - Time Capture Noise Filter Control"]
220pub type TCNF_W<'a, const O: u8> = crate::FieldWriterSafe<'a, u8, RTCCR_SPEC, u8, TCNF_A, 2, O>;
221impl<'a, const O: u8> TCNF_W<'a, O> {
222 #[doc = "The noise filter is off."]
223 #[inline(always)]
224 pub fn _00(self) -> &'a mut W {
225 self.variant(TCNF_A::_00)
226 }
227 #[doc = "Setting prohibited"]
228 #[inline(always)]
229 pub fn _01(self) -> &'a mut W {
230 self.variant(TCNF_A::_01)
231 }
232 #[doc = "The noise filter is on (count source)."]
233 #[inline(always)]
234 pub fn _10(self) -> &'a mut W {
235 self.variant(TCNF_A::_10)
236 }
237 #[doc = "The noise filter is on (count source by divided by 32)."]
238 #[inline(always)]
239 pub fn _11(self) -> &'a mut W {
240 self.variant(TCNF_A::_11)
241 }
242}
243impl R {
244 #[doc = "Bits 0:1 - Time Capture Control"]
245 #[inline(always)]
246 pub fn tcct(&self) -> TCCT_R {
247 TCCT_R::new(self.bits & 3)
248 }
249 #[doc = "Bit 2 - Time Capture Status"]
250 #[inline(always)]
251 pub fn tcst(&self) -> TCST_R {
252 TCST_R::new(((self.bits >> 2) & 1) != 0)
253 }
254 #[doc = "Bits 4:5 - Time Capture Noise Filter Control"]
255 #[inline(always)]
256 pub fn tcnf(&self) -> TCNF_R {
257 TCNF_R::new((self.bits >> 4) & 3)
258 }
259}
260impl W {
261 #[doc = "Bits 0:1 - Time Capture Control"]
262 #[inline(always)]
263 #[must_use]
264 pub fn tcct(&mut self) -> TCCT_W<0> {
265 TCCT_W::new(self)
266 }
267 #[doc = "Bit 2 - Time Capture Status"]
268 #[inline(always)]
269 #[must_use]
270 pub fn tcst(&mut self) -> TCST_W<2> {
271 TCST_W::new(self)
272 }
273 #[doc = "Bits 4:5 - Time Capture Noise Filter Control"]
274 #[inline(always)]
275 #[must_use]
276 pub fn tcnf(&mut self) -> TCNF_W<4> {
277 TCNF_W::new(self)
278 }
279 #[doc = "Writes raw bits to the register."]
280 #[inline(always)]
281 pub unsafe fn bits(&mut self, bits: u8) -> &mut Self {
282 self.0.bits(bits);
283 self
284 }
285}
286#[doc = "Time Capture Control Register %s\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 [rtccr](index.html) module"]
287pub struct RTCCR_SPEC;
288impl crate::RegisterSpec for RTCCR_SPEC {
289 type Ux = u8;
290}
291#[doc = "`read()` method returns [rtccr::R](R) reader structure"]
292impl crate::Readable for RTCCR_SPEC {
293 type Reader = R;
294}
295#[doc = "`write(|w| ..)` method takes [rtccr::W](W) writer structure"]
296impl crate::Writable for RTCCR_SPEC {
297 type Writer = W;
298 const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0x04;
299 const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
300}
301#[doc = "`reset()` method sets RTCCR%s to value 0"]
302impl crate::Resettable for RTCCR_SPEC {
303 const RESET_VALUE: Self::Ux = 0;
304}