s32k144_pac/can2/
flt_id2_idmask.rs1#[doc = "Register `FLT_ID2_IDMASK` reader"]
2pub struct R(crate::R<FLT_ID2_IDMASK_SPEC>);
3impl core::ops::Deref for R {
4 type Target = crate::R<FLT_ID2_IDMASK_SPEC>;
5 #[inline(always)]
6 fn deref(&self) -> &Self::Target {
7 &self.0
8 }
9}
10impl From<crate::R<FLT_ID2_IDMASK_SPEC>> for R {
11 #[inline(always)]
12 fn from(reader: crate::R<FLT_ID2_IDMASK_SPEC>) -> Self {
13 R(reader)
14 }
15}
16#[doc = "Register `FLT_ID2_IDMASK` writer"]
17pub struct W(crate::W<FLT_ID2_IDMASK_SPEC>);
18impl core::ops::Deref for W {
19 type Target = crate::W<FLT_ID2_IDMASK_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<FLT_ID2_IDMASK_SPEC>> for W {
32 #[inline(always)]
33 fn from(writer: crate::W<FLT_ID2_IDMASK_SPEC>) -> Self {
34 W(writer)
35 }
36}
37#[doc = "Field `FLT_ID2_IDMASK` reader - ID Filter 2 for Pretended Networking Filtering / ID Mask Bits for Pretended Networking ID Filtering"]
38pub struct FLT_ID2_IDMASK_R(crate::FieldReader<u32, u32>);
39impl FLT_ID2_IDMASK_R {
40 #[inline(always)]
41 pub(crate) fn new(bits: u32) -> Self {
42 FLT_ID2_IDMASK_R(crate::FieldReader::new(bits))
43 }
44}
45impl core::ops::Deref for FLT_ID2_IDMASK_R {
46 type Target = crate::FieldReader<u32, u32>;
47 #[inline(always)]
48 fn deref(&self) -> &Self::Target {
49 &self.0
50 }
51}
52#[doc = "Field `FLT_ID2_IDMASK` writer - ID Filter 2 for Pretended Networking Filtering / ID Mask Bits for Pretended Networking ID Filtering"]
53pub struct FLT_ID2_IDMASK_W<'a> {
54 w: &'a mut W,
55}
56impl<'a> FLT_ID2_IDMASK_W<'a> {
57 #[doc = r"Writes raw bits to the field"]
58 #[inline(always)]
59 pub unsafe fn bits(self, value: u32) -> &'a mut W {
60 self.w.bits = (self.w.bits & !0x1fff_ffff) | (value as u32 & 0x1fff_ffff);
61 self.w
62 }
63}
64#[doc = "Remote Transmission Request Mask Bit\n\nValue on reset: 0"]
65#[derive(Clone, Copy, Debug, PartialEq)]
66pub enum RTR_MSK_A {
67 #[doc = "0: The corresponding bit in the filter is \"don't care\""]
68 _0 = 0,
69 #[doc = "1: The corresponding bit in the filter is checked"]
70 _1 = 1,
71}
72impl From<RTR_MSK_A> for bool {
73 #[inline(always)]
74 fn from(variant: RTR_MSK_A) -> Self {
75 variant as u8 != 0
76 }
77}
78#[doc = "Field `RTR_MSK` reader - Remote Transmission Request Mask Bit"]
79pub struct RTR_MSK_R(crate::FieldReader<bool, RTR_MSK_A>);
80impl RTR_MSK_R {
81 #[inline(always)]
82 pub(crate) fn new(bits: bool) -> Self {
83 RTR_MSK_R(crate::FieldReader::new(bits))
84 }
85 #[doc = r"Get enumerated values variant"]
86 #[inline(always)]
87 pub fn variant(&self) -> RTR_MSK_A {
88 match self.bits {
89 false => RTR_MSK_A::_0,
90 true => RTR_MSK_A::_1,
91 }
92 }
93 #[doc = "Checks if the value of the field is `_0`"]
94 #[inline(always)]
95 pub fn is_0(&self) -> bool {
96 **self == RTR_MSK_A::_0
97 }
98 #[doc = "Checks if the value of the field is `_1`"]
99 #[inline(always)]
100 pub fn is_1(&self) -> bool {
101 **self == RTR_MSK_A::_1
102 }
103}
104impl core::ops::Deref for RTR_MSK_R {
105 type Target = crate::FieldReader<bool, RTR_MSK_A>;
106 #[inline(always)]
107 fn deref(&self) -> &Self::Target {
108 &self.0
109 }
110}
111#[doc = "Field `RTR_MSK` writer - Remote Transmission Request Mask Bit"]
112pub struct RTR_MSK_W<'a> {
113 w: &'a mut W,
114}
115impl<'a> RTR_MSK_W<'a> {
116 #[doc = r"Writes `variant` to the field"]
117 #[inline(always)]
118 pub fn variant(self, variant: RTR_MSK_A) -> &'a mut W {
119 self.bit(variant.into())
120 }
121 #[doc = "The corresponding bit in the filter is \"don't care\""]
122 #[inline(always)]
123 pub fn _0(self) -> &'a mut W {
124 self.variant(RTR_MSK_A::_0)
125 }
126 #[doc = "The corresponding bit in the filter is checked"]
127 #[inline(always)]
128 pub fn _1(self) -> &'a mut W {
129 self.variant(RTR_MSK_A::_1)
130 }
131 #[doc = r"Sets the field bit"]
132 #[inline(always)]
133 pub fn set_bit(self) -> &'a mut W {
134 self.bit(true)
135 }
136 #[doc = r"Clears the field bit"]
137 #[inline(always)]
138 pub fn clear_bit(self) -> &'a mut W {
139 self.bit(false)
140 }
141 #[doc = r"Writes raw bits to the field"]
142 #[inline(always)]
143 pub fn bit(self, value: bool) -> &'a mut W {
144 self.w.bits = (self.w.bits & !(0x01 << 29)) | ((value as u32 & 0x01) << 29);
145 self.w
146 }
147}
148#[doc = "ID Extended Mask Bit\n\nValue on reset: 0"]
149#[derive(Clone, Copy, Debug, PartialEq)]
150pub enum IDE_MSK_A {
151 #[doc = "0: The corresponding bit in the filter is \"don't care\""]
152 _0 = 0,
153 #[doc = "1: The corresponding bit in the filter is checked"]
154 _1 = 1,
155}
156impl From<IDE_MSK_A> for bool {
157 #[inline(always)]
158 fn from(variant: IDE_MSK_A) -> Self {
159 variant as u8 != 0
160 }
161}
162#[doc = "Field `IDE_MSK` reader - ID Extended Mask Bit"]
163pub struct IDE_MSK_R(crate::FieldReader<bool, IDE_MSK_A>);
164impl IDE_MSK_R {
165 #[inline(always)]
166 pub(crate) fn new(bits: bool) -> Self {
167 IDE_MSK_R(crate::FieldReader::new(bits))
168 }
169 #[doc = r"Get enumerated values variant"]
170 #[inline(always)]
171 pub fn variant(&self) -> IDE_MSK_A {
172 match self.bits {
173 false => IDE_MSK_A::_0,
174 true => IDE_MSK_A::_1,
175 }
176 }
177 #[doc = "Checks if the value of the field is `_0`"]
178 #[inline(always)]
179 pub fn is_0(&self) -> bool {
180 **self == IDE_MSK_A::_0
181 }
182 #[doc = "Checks if the value of the field is `_1`"]
183 #[inline(always)]
184 pub fn is_1(&self) -> bool {
185 **self == IDE_MSK_A::_1
186 }
187}
188impl core::ops::Deref for IDE_MSK_R {
189 type Target = crate::FieldReader<bool, IDE_MSK_A>;
190 #[inline(always)]
191 fn deref(&self) -> &Self::Target {
192 &self.0
193 }
194}
195#[doc = "Field `IDE_MSK` writer - ID Extended Mask Bit"]
196pub struct IDE_MSK_W<'a> {
197 w: &'a mut W,
198}
199impl<'a> IDE_MSK_W<'a> {
200 #[doc = r"Writes `variant` to the field"]
201 #[inline(always)]
202 pub fn variant(self, variant: IDE_MSK_A) -> &'a mut W {
203 self.bit(variant.into())
204 }
205 #[doc = "The corresponding bit in the filter is \"don't care\""]
206 #[inline(always)]
207 pub fn _0(self) -> &'a mut W {
208 self.variant(IDE_MSK_A::_0)
209 }
210 #[doc = "The corresponding bit in the filter is checked"]
211 #[inline(always)]
212 pub fn _1(self) -> &'a mut W {
213 self.variant(IDE_MSK_A::_1)
214 }
215 #[doc = r"Sets the field bit"]
216 #[inline(always)]
217 pub fn set_bit(self) -> &'a mut W {
218 self.bit(true)
219 }
220 #[doc = r"Clears the field bit"]
221 #[inline(always)]
222 pub fn clear_bit(self) -> &'a mut W {
223 self.bit(false)
224 }
225 #[doc = r"Writes raw bits to the field"]
226 #[inline(always)]
227 pub fn bit(self, value: bool) -> &'a mut W {
228 self.w.bits = (self.w.bits & !(0x01 << 30)) | ((value as u32 & 0x01) << 30);
229 self.w
230 }
231}
232impl R {
233 #[doc = "Bits 0:28 - ID Filter 2 for Pretended Networking Filtering / ID Mask Bits for Pretended Networking ID Filtering"]
234 #[inline(always)]
235 pub fn flt_id2_idmask(&self) -> FLT_ID2_IDMASK_R {
236 FLT_ID2_IDMASK_R::new((self.bits & 0x1fff_ffff) as u32)
237 }
238 #[doc = "Bit 29 - Remote Transmission Request Mask Bit"]
239 #[inline(always)]
240 pub fn rtr_msk(&self) -> RTR_MSK_R {
241 RTR_MSK_R::new(((self.bits >> 29) & 0x01) != 0)
242 }
243 #[doc = "Bit 30 - ID Extended Mask Bit"]
244 #[inline(always)]
245 pub fn ide_msk(&self) -> IDE_MSK_R {
246 IDE_MSK_R::new(((self.bits >> 30) & 0x01) != 0)
247 }
248}
249impl W {
250 #[doc = "Bits 0:28 - ID Filter 2 for Pretended Networking Filtering / ID Mask Bits for Pretended Networking ID Filtering"]
251 #[inline(always)]
252 pub fn flt_id2_idmask(&mut self) -> FLT_ID2_IDMASK_W {
253 FLT_ID2_IDMASK_W { w: self }
254 }
255 #[doc = "Bit 29 - Remote Transmission Request Mask Bit"]
256 #[inline(always)]
257 pub fn rtr_msk(&mut self) -> RTR_MSK_W {
258 RTR_MSK_W { w: self }
259 }
260 #[doc = "Bit 30 - ID Extended Mask Bit"]
261 #[inline(always)]
262 pub fn ide_msk(&mut self) -> IDE_MSK_W {
263 IDE_MSK_W { w: self }
264 }
265 #[doc = "Writes raw bits to the register."]
266 #[inline(always)]
267 pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
268 self.0.bits(bits);
269 self
270 }
271}
272#[doc = "Pretended Networking ID Filter 2 Register / ID Mask 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 [flt_id2_idmask](index.html) module"]
273pub struct FLT_ID2_IDMASK_SPEC;
274impl crate::RegisterSpec for FLT_ID2_IDMASK_SPEC {
275 type Ux = u32;
276}
277#[doc = "`read()` method returns [flt_id2_idmask::R](R) reader structure"]
278impl crate::Readable for FLT_ID2_IDMASK_SPEC {
279 type Reader = R;
280}
281#[doc = "`write(|w| ..)` method takes [flt_id2_idmask::W](W) writer structure"]
282impl crate::Writable for FLT_ID2_IDMASK_SPEC {
283 type Writer = W;
284}
285#[doc = "`reset()` method sets FLT_ID2_IDMASK to value 0"]
286impl crate::Resettable for FLT_ID2_IDMASK_SPEC {
287 #[inline(always)]
288 fn reset_value() -> Self::Ux {
289 0
290 }
291}