s32k144w_pac/can0/
wu_mtc.rs1#[doc = "Register `WU_MTC` reader"]
2pub struct R(crate::R<WU_MTC_SPEC>);
3impl core::ops::Deref for R {
4 type Target = crate::R<WU_MTC_SPEC>;
5 #[inline(always)]
6 fn deref(&self) -> &Self::Target {
7 &self.0
8 }
9}
10impl From<crate::R<WU_MTC_SPEC>> for R {
11 #[inline(always)]
12 fn from(reader: crate::R<WU_MTC_SPEC>) -> Self {
13 R(reader)
14 }
15}
16#[doc = "Register `WU_MTC` writer"]
17pub struct W(crate::W<WU_MTC_SPEC>);
18impl core::ops::Deref for W {
19 type Target = crate::W<WU_MTC_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<WU_MTC_SPEC>> for W {
32 #[inline(always)]
33 fn from(writer: crate::W<WU_MTC_SPEC>) -> Self {
34 W(writer)
35 }
36}
37#[doc = "Field `MCOUNTER` reader - Number of Matches when in Pretended Networking"]
38pub struct MCOUNTER_R(crate::FieldReader<u8, u8>);
39impl MCOUNTER_R {
40 #[inline(always)]
41 pub(crate) fn new(bits: u8) -> Self {
42 MCOUNTER_R(crate::FieldReader::new(bits))
43 }
44}
45impl core::ops::Deref for MCOUNTER_R {
46 type Target = crate::FieldReader<u8, u8>;
47 #[inline(always)]
48 fn deref(&self) -> &Self::Target {
49 &self.0
50 }
51}
52#[doc = "Wake Up by Match Flag Bit\n\nValue on reset: 0"]
53#[derive(Clone, Copy, Debug, PartialEq)]
54pub enum WUMF_A {
55 #[doc = "0: No wakeup by match event detected"]
56 NO_MATCH = 0,
57 #[doc = "1: Wakeup by match event detected"]
58 MATCH = 1,
59}
60impl From<WUMF_A> for bool {
61 #[inline(always)]
62 fn from(variant: WUMF_A) -> Self {
63 variant as u8 != 0
64 }
65}
66#[doc = "Field `WUMF` reader - Wake Up by Match Flag Bit"]
67pub struct WUMF_R(crate::FieldReader<bool, WUMF_A>);
68impl WUMF_R {
69 #[inline(always)]
70 pub(crate) fn new(bits: bool) -> Self {
71 WUMF_R(crate::FieldReader::new(bits))
72 }
73 #[doc = r"Get enumerated values variant"]
74 #[inline(always)]
75 pub fn variant(&self) -> WUMF_A {
76 match self.bits {
77 false => WUMF_A::NO_MATCH,
78 true => WUMF_A::MATCH,
79 }
80 }
81 #[doc = "Checks if the value of the field is `NO_MATCH`"]
82 #[inline(always)]
83 pub fn is_no_match(&self) -> bool {
84 **self == WUMF_A::NO_MATCH
85 }
86 #[doc = "Checks if the value of the field is `MATCH`"]
87 #[inline(always)]
88 pub fn is_match(&self) -> bool {
89 **self == WUMF_A::MATCH
90 }
91}
92impl core::ops::Deref for WUMF_R {
93 type Target = crate::FieldReader<bool, WUMF_A>;
94 #[inline(always)]
95 fn deref(&self) -> &Self::Target {
96 &self.0
97 }
98}
99#[doc = "Field `WUMF` writer - Wake Up by Match Flag Bit"]
100pub struct WUMF_W<'a> {
101 w: &'a mut W,
102}
103impl<'a> WUMF_W<'a> {
104 #[doc = r"Writes `variant` to the field"]
105 #[inline(always)]
106 pub fn variant(self, variant: WUMF_A) -> &'a mut W {
107 self.bit(variant.into())
108 }
109 #[doc = "No wakeup by match event detected"]
110 #[inline(always)]
111 pub fn no_match(self) -> &'a mut W {
112 self.variant(WUMF_A::NO_MATCH)
113 }
114 #[doc = "Wakeup by match event detected"]
115 #[inline(always)]
116 pub fn match_(self) -> &'a mut W {
117 self.variant(WUMF_A::MATCH)
118 }
119 #[doc = r"Sets the field bit"]
120 #[inline(always)]
121 pub fn set_bit(self) -> &'a mut W {
122 self.bit(true)
123 }
124 #[doc = r"Clears the field bit"]
125 #[inline(always)]
126 pub fn clear_bit(self) -> &'a mut W {
127 self.bit(false)
128 }
129 #[doc = r"Writes raw bits to the field"]
130 #[inline(always)]
131 pub fn bit(self, value: bool) -> &'a mut W {
132 self.w.bits = (self.w.bits & !(0x01 << 16)) | ((value as u32 & 0x01) << 16);
133 self.w
134 }
135}
136#[doc = "Wake Up by Timeout Flag Bit\n\nValue on reset: 0"]
137#[derive(Clone, Copy, Debug, PartialEq)]
138pub enum WTOF_A {
139 #[doc = "0: No wakeup by timeout event detected"]
140 NO_WAKEUP = 0,
141 #[doc = "1: Wakeup by timeout event detected"]
142 WAKEUP = 1,
143}
144impl From<WTOF_A> for bool {
145 #[inline(always)]
146 fn from(variant: WTOF_A) -> Self {
147 variant as u8 != 0
148 }
149}
150#[doc = "Field `WTOF` reader - Wake Up by Timeout Flag Bit"]
151pub struct WTOF_R(crate::FieldReader<bool, WTOF_A>);
152impl WTOF_R {
153 #[inline(always)]
154 pub(crate) fn new(bits: bool) -> Self {
155 WTOF_R(crate::FieldReader::new(bits))
156 }
157 #[doc = r"Get enumerated values variant"]
158 #[inline(always)]
159 pub fn variant(&self) -> WTOF_A {
160 match self.bits {
161 false => WTOF_A::NO_WAKEUP,
162 true => WTOF_A::WAKEUP,
163 }
164 }
165 #[doc = "Checks if the value of the field is `NO_WAKEUP`"]
166 #[inline(always)]
167 pub fn is_no_wakeup(&self) -> bool {
168 **self == WTOF_A::NO_WAKEUP
169 }
170 #[doc = "Checks if the value of the field is `WAKEUP`"]
171 #[inline(always)]
172 pub fn is_wakeup(&self) -> bool {
173 **self == WTOF_A::WAKEUP
174 }
175}
176impl core::ops::Deref for WTOF_R {
177 type Target = crate::FieldReader<bool, WTOF_A>;
178 #[inline(always)]
179 fn deref(&self) -> &Self::Target {
180 &self.0
181 }
182}
183#[doc = "Field `WTOF` writer - Wake Up by Timeout Flag Bit"]
184pub struct WTOF_W<'a> {
185 w: &'a mut W,
186}
187impl<'a> WTOF_W<'a> {
188 #[doc = r"Writes `variant` to the field"]
189 #[inline(always)]
190 pub fn variant(self, variant: WTOF_A) -> &'a mut W {
191 self.bit(variant.into())
192 }
193 #[doc = "No wakeup by timeout event detected"]
194 #[inline(always)]
195 pub fn no_wakeup(self) -> &'a mut W {
196 self.variant(WTOF_A::NO_WAKEUP)
197 }
198 #[doc = "Wakeup by timeout event detected"]
199 #[inline(always)]
200 pub fn wakeup(self) -> &'a mut W {
201 self.variant(WTOF_A::WAKEUP)
202 }
203 #[doc = r"Sets the field bit"]
204 #[inline(always)]
205 pub fn set_bit(self) -> &'a mut W {
206 self.bit(true)
207 }
208 #[doc = r"Clears the field bit"]
209 #[inline(always)]
210 pub fn clear_bit(self) -> &'a mut W {
211 self.bit(false)
212 }
213 #[doc = r"Writes raw bits to the field"]
214 #[inline(always)]
215 pub fn bit(self, value: bool) -> &'a mut W {
216 self.w.bits = (self.w.bits & !(0x01 << 17)) | ((value as u32 & 0x01) << 17);
217 self.w
218 }
219}
220impl R {
221 #[doc = "Bits 8:15 - Number of Matches when in Pretended Networking"]
222 #[inline(always)]
223 pub fn mcounter(&self) -> MCOUNTER_R {
224 MCOUNTER_R::new(((self.bits >> 8) & 0xff) as u8)
225 }
226 #[doc = "Bit 16 - Wake Up by Match Flag Bit"]
227 #[inline(always)]
228 pub fn wumf(&self) -> WUMF_R {
229 WUMF_R::new(((self.bits >> 16) & 0x01) != 0)
230 }
231 #[doc = "Bit 17 - Wake Up by Timeout Flag Bit"]
232 #[inline(always)]
233 pub fn wtof(&self) -> WTOF_R {
234 WTOF_R::new(((self.bits >> 17) & 0x01) != 0)
235 }
236}
237impl W {
238 #[doc = "Bit 16 - Wake Up by Match Flag Bit"]
239 #[inline(always)]
240 pub fn wumf(&mut self) -> WUMF_W {
241 WUMF_W { w: self }
242 }
243 #[doc = "Bit 17 - Wake Up by Timeout Flag Bit"]
244 #[inline(always)]
245 pub fn wtof(&mut self) -> WTOF_W {
246 WTOF_W { w: self }
247 }
248 #[doc = "Writes raw bits to the register."]
249 #[inline(always)]
250 pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
251 self.0.bits(bits);
252 self
253 }
254}
255#[doc = "Pretended Networking Wake Up Match 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 [wu_mtc](index.html) module"]
256pub struct WU_MTC_SPEC;
257impl crate::RegisterSpec for WU_MTC_SPEC {
258 type Ux = u32;
259}
260#[doc = "`read()` method returns [wu_mtc::R](R) reader structure"]
261impl crate::Readable for WU_MTC_SPEC {
262 type Reader = R;
263}
264#[doc = "`write(|w| ..)` method takes [wu_mtc::W](W) writer structure"]
265impl crate::Writable for WU_MTC_SPEC {
266 type Writer = W;
267}
268#[doc = "`reset()` method sets WU_MTC to value 0"]
269impl crate::Resettable for WU_MTC_SPEC {
270 #[inline(always)]
271 fn reset_value() -> Self::Ux {
272 0
273 }
274}