ra6m2/can0/
mctl_tx.rs

1#[doc = "Register `MCTL_TX[%s]` reader"]
2pub struct R(crate::R<MCTL_TX_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<MCTL_TX_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<MCTL_TX_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<MCTL_TX_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `MCTL_TX[%s]` writer"]
17pub struct W(crate::W<MCTL_TX_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<MCTL_TX_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<MCTL_TX_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<MCTL_TX_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "Field `SENTDATA` reader - Transmission Complete Flag"]
38pub type SENTDATA_R = crate::BitReader<SENTDATA_A>;
39#[doc = "Transmission Complete Flag\n\nValue on reset: 0"]
40#[derive(Clone, Copy, Debug, PartialEq, Eq)]
41pub enum SENTDATA_A {
42    #[doc = "0: Transmission is not completed"]
43    _0 = 0,
44    #[doc = "1: Transmission is completed"]
45    _1 = 1,
46}
47impl From<SENTDATA_A> for bool {
48    #[inline(always)]
49    fn from(variant: SENTDATA_A) -> Self {
50        variant as u8 != 0
51    }
52}
53impl SENTDATA_R {
54    #[doc = "Get enumerated values variant"]
55    #[inline(always)]
56    pub fn variant(&self) -> SENTDATA_A {
57        match self.bits {
58            false => SENTDATA_A::_0,
59            true => SENTDATA_A::_1,
60        }
61    }
62    #[doc = "Checks if the value of the field is `_0`"]
63    #[inline(always)]
64    pub fn is_0(&self) -> bool {
65        *self == SENTDATA_A::_0
66    }
67    #[doc = "Checks if the value of the field is `_1`"]
68    #[inline(always)]
69    pub fn is_1(&self) -> bool {
70        *self == SENTDATA_A::_1
71    }
72}
73#[doc = "Field `SENTDATA` writer - Transmission Complete Flag"]
74pub type SENTDATA_W<'a, const O: u8> = crate::BitWriter<'a, u8, MCTL_TX_SPEC, SENTDATA_A, O>;
75impl<'a, const O: u8> SENTDATA_W<'a, O> {
76    #[doc = "Transmission is not completed"]
77    #[inline(always)]
78    pub fn _0(self) -> &'a mut W {
79        self.variant(SENTDATA_A::_0)
80    }
81    #[doc = "Transmission is completed"]
82    #[inline(always)]
83    pub fn _1(self) -> &'a mut W {
84        self.variant(SENTDATA_A::_1)
85    }
86}
87#[doc = "Field `TRMACTIVE` reader - Transmission-in-Progress Status Flag (Transmit mailbox setting enabled)"]
88pub type TRMACTIVE_R = crate::BitReader<TRMACTIVE_A>;
89#[doc = "Transmission-in-Progress Status Flag (Transmit mailbox setting enabled)\n\nValue on reset: 0"]
90#[derive(Clone, Copy, Debug, PartialEq, Eq)]
91pub enum TRMACTIVE_A {
92    #[doc = "0: Transmission is pending or transmission is not requested"]
93    _0 = 0,
94    #[doc = "1: From acceptance of transmission request to completion of transmission, or error/arbitration-lost"]
95    _1 = 1,
96}
97impl From<TRMACTIVE_A> for bool {
98    #[inline(always)]
99    fn from(variant: TRMACTIVE_A) -> Self {
100        variant as u8 != 0
101    }
102}
103impl TRMACTIVE_R {
104    #[doc = "Get enumerated values variant"]
105    #[inline(always)]
106    pub fn variant(&self) -> TRMACTIVE_A {
107        match self.bits {
108            false => TRMACTIVE_A::_0,
109            true => TRMACTIVE_A::_1,
110        }
111    }
112    #[doc = "Checks if the value of the field is `_0`"]
113    #[inline(always)]
114    pub fn is_0(&self) -> bool {
115        *self == TRMACTIVE_A::_0
116    }
117    #[doc = "Checks if the value of the field is `_1`"]
118    #[inline(always)]
119    pub fn is_1(&self) -> bool {
120        *self == TRMACTIVE_A::_1
121    }
122}
123#[doc = "Field `TRMABT` reader - Transmission Abort Complete Flag (Transmit mailbox setting enabled)"]
124pub type TRMABT_R = crate::BitReader<TRMABT_A>;
125#[doc = "Transmission Abort Complete Flag (Transmit mailbox setting enabled)\n\nValue on reset: 0"]
126#[derive(Clone, Copy, Debug, PartialEq, Eq)]
127pub enum TRMABT_A {
128    #[doc = "0: Transmission has started, transmission abort failed because transmission is completed, or transmission abort is not requested"]
129    _0 = 0,
130    #[doc = "1: Transmission abort is completed"]
131    _1 = 1,
132}
133impl From<TRMABT_A> for bool {
134    #[inline(always)]
135    fn from(variant: TRMABT_A) -> Self {
136        variant as u8 != 0
137    }
138}
139impl TRMABT_R {
140    #[doc = "Get enumerated values variant"]
141    #[inline(always)]
142    pub fn variant(&self) -> TRMABT_A {
143        match self.bits {
144            false => TRMABT_A::_0,
145            true => TRMABT_A::_1,
146        }
147    }
148    #[doc = "Checks if the value of the field is `_0`"]
149    #[inline(always)]
150    pub fn is_0(&self) -> bool {
151        *self == TRMABT_A::_0
152    }
153    #[doc = "Checks if the value of the field is `_1`"]
154    #[inline(always)]
155    pub fn is_1(&self) -> bool {
156        *self == TRMABT_A::_1
157    }
158}
159#[doc = "Field `TRMABT` writer - Transmission Abort Complete Flag (Transmit mailbox setting enabled)"]
160pub type TRMABT_W<'a, const O: u8> = crate::BitWriter<'a, u8, MCTL_TX_SPEC, TRMABT_A, O>;
161impl<'a, const O: u8> TRMABT_W<'a, O> {
162    #[doc = "Transmission has started, transmission abort failed because transmission is completed, or transmission abort is not requested"]
163    #[inline(always)]
164    pub fn _0(self) -> &'a mut W {
165        self.variant(TRMABT_A::_0)
166    }
167    #[doc = "Transmission abort is completed"]
168    #[inline(always)]
169    pub fn _1(self) -> &'a mut W {
170        self.variant(TRMABT_A::_1)
171    }
172}
173#[doc = "Field `ONESHOT` reader - One-Shot Enable"]
174pub type ONESHOT_R = crate::BitReader<ONESHOT_A>;
175#[doc = "One-Shot Enable\n\nValue on reset: 0"]
176#[derive(Clone, Copy, Debug, PartialEq, Eq)]
177pub enum ONESHOT_A {
178    #[doc = "0: One-shot reception or one-shot transmission disabled"]
179    _0 = 0,
180    #[doc = "1: One-shot reception or one-shot transmission enabled"]
181    _1 = 1,
182}
183impl From<ONESHOT_A> for bool {
184    #[inline(always)]
185    fn from(variant: ONESHOT_A) -> Self {
186        variant as u8 != 0
187    }
188}
189impl ONESHOT_R {
190    #[doc = "Get enumerated values variant"]
191    #[inline(always)]
192    pub fn variant(&self) -> ONESHOT_A {
193        match self.bits {
194            false => ONESHOT_A::_0,
195            true => ONESHOT_A::_1,
196        }
197    }
198    #[doc = "Checks if the value of the field is `_0`"]
199    #[inline(always)]
200    pub fn is_0(&self) -> bool {
201        *self == ONESHOT_A::_0
202    }
203    #[doc = "Checks if the value of the field is `_1`"]
204    #[inline(always)]
205    pub fn is_1(&self) -> bool {
206        *self == ONESHOT_A::_1
207    }
208}
209#[doc = "Field `ONESHOT` writer - One-Shot Enable"]
210pub type ONESHOT_W<'a, const O: u8> = crate::BitWriter<'a, u8, MCTL_TX_SPEC, ONESHOT_A, O>;
211impl<'a, const O: u8> ONESHOT_W<'a, O> {
212    #[doc = "One-shot reception or one-shot transmission disabled"]
213    #[inline(always)]
214    pub fn _0(self) -> &'a mut W {
215        self.variant(ONESHOT_A::_0)
216    }
217    #[doc = "One-shot reception or one-shot transmission enabled"]
218    #[inline(always)]
219    pub fn _1(self) -> &'a mut W {
220        self.variant(ONESHOT_A::_1)
221    }
222}
223#[doc = "Field `RECREQ` reader - Receive Mailbox Request"]
224pub type RECREQ_R = crate::BitReader<RECREQ_A>;
225#[doc = "Receive Mailbox Request\n\nValue on reset: 0"]
226#[derive(Clone, Copy, Debug, PartialEq, Eq)]
227pub enum RECREQ_A {
228    #[doc = "0: Not configured for reception"]
229    _0 = 0,
230    #[doc = "1: Configured for reception"]
231    _1 = 1,
232}
233impl From<RECREQ_A> for bool {
234    #[inline(always)]
235    fn from(variant: RECREQ_A) -> Self {
236        variant as u8 != 0
237    }
238}
239impl RECREQ_R {
240    #[doc = "Get enumerated values variant"]
241    #[inline(always)]
242    pub fn variant(&self) -> RECREQ_A {
243        match self.bits {
244            false => RECREQ_A::_0,
245            true => RECREQ_A::_1,
246        }
247    }
248    #[doc = "Checks if the value of the field is `_0`"]
249    #[inline(always)]
250    pub fn is_0(&self) -> bool {
251        *self == RECREQ_A::_0
252    }
253    #[doc = "Checks if the value of the field is `_1`"]
254    #[inline(always)]
255    pub fn is_1(&self) -> bool {
256        *self == RECREQ_A::_1
257    }
258}
259#[doc = "Field `RECREQ` writer - Receive Mailbox Request"]
260pub type RECREQ_W<'a, const O: u8> = crate::BitWriter<'a, u8, MCTL_TX_SPEC, RECREQ_A, O>;
261impl<'a, const O: u8> RECREQ_W<'a, O> {
262    #[doc = "Not configured for reception"]
263    #[inline(always)]
264    pub fn _0(self) -> &'a mut W {
265        self.variant(RECREQ_A::_0)
266    }
267    #[doc = "Configured for reception"]
268    #[inline(always)]
269    pub fn _1(self) -> &'a mut W {
270        self.variant(RECREQ_A::_1)
271    }
272}
273#[doc = "Field `TRMREQ` reader - Transmit Mailbox Request"]
274pub type TRMREQ_R = crate::BitReader<TRMREQ_A>;
275#[doc = "Transmit Mailbox Request\n\nValue on reset: 0"]
276#[derive(Clone, Copy, Debug, PartialEq, Eq)]
277pub enum TRMREQ_A {
278    #[doc = "0: Not configured for transmission"]
279    _0 = 0,
280    #[doc = "1: Configured for transmission"]
281    _1 = 1,
282}
283impl From<TRMREQ_A> for bool {
284    #[inline(always)]
285    fn from(variant: TRMREQ_A) -> Self {
286        variant as u8 != 0
287    }
288}
289impl TRMREQ_R {
290    #[doc = "Get enumerated values variant"]
291    #[inline(always)]
292    pub fn variant(&self) -> TRMREQ_A {
293        match self.bits {
294            false => TRMREQ_A::_0,
295            true => TRMREQ_A::_1,
296        }
297    }
298    #[doc = "Checks if the value of the field is `_0`"]
299    #[inline(always)]
300    pub fn is_0(&self) -> bool {
301        *self == TRMREQ_A::_0
302    }
303    #[doc = "Checks if the value of the field is `_1`"]
304    #[inline(always)]
305    pub fn is_1(&self) -> bool {
306        *self == TRMREQ_A::_1
307    }
308}
309#[doc = "Field `TRMREQ` writer - Transmit Mailbox Request"]
310pub type TRMREQ_W<'a, const O: u8> = crate::BitWriter<'a, u8, MCTL_TX_SPEC, TRMREQ_A, O>;
311impl<'a, const O: u8> TRMREQ_W<'a, O> {
312    #[doc = "Not configured for transmission"]
313    #[inline(always)]
314    pub fn _0(self) -> &'a mut W {
315        self.variant(TRMREQ_A::_0)
316    }
317    #[doc = "Configured for transmission"]
318    #[inline(always)]
319    pub fn _1(self) -> &'a mut W {
320        self.variant(TRMREQ_A::_1)
321    }
322}
323impl R {
324    #[doc = "Bit 0 - Transmission Complete Flag"]
325    #[inline(always)]
326    pub fn sentdata(&self) -> SENTDATA_R {
327        SENTDATA_R::new((self.bits & 1) != 0)
328    }
329    #[doc = "Bit 1 - Transmission-in-Progress Status Flag (Transmit mailbox setting enabled)"]
330    #[inline(always)]
331    pub fn trmactive(&self) -> TRMACTIVE_R {
332        TRMACTIVE_R::new(((self.bits >> 1) & 1) != 0)
333    }
334    #[doc = "Bit 2 - Transmission Abort Complete Flag (Transmit mailbox setting enabled)"]
335    #[inline(always)]
336    pub fn trmabt(&self) -> TRMABT_R {
337        TRMABT_R::new(((self.bits >> 2) & 1) != 0)
338    }
339    #[doc = "Bit 4 - One-Shot Enable"]
340    #[inline(always)]
341    pub fn oneshot(&self) -> ONESHOT_R {
342        ONESHOT_R::new(((self.bits >> 4) & 1) != 0)
343    }
344    #[doc = "Bit 6 - Receive Mailbox Request"]
345    #[inline(always)]
346    pub fn recreq(&self) -> RECREQ_R {
347        RECREQ_R::new(((self.bits >> 6) & 1) != 0)
348    }
349    #[doc = "Bit 7 - Transmit Mailbox Request"]
350    #[inline(always)]
351    pub fn trmreq(&self) -> TRMREQ_R {
352        TRMREQ_R::new(((self.bits >> 7) & 1) != 0)
353    }
354}
355impl W {
356    #[doc = "Bit 0 - Transmission Complete Flag"]
357    #[inline(always)]
358    #[must_use]
359    pub fn sentdata(&mut self) -> SENTDATA_W<0> {
360        SENTDATA_W::new(self)
361    }
362    #[doc = "Bit 2 - Transmission Abort Complete Flag (Transmit mailbox setting enabled)"]
363    #[inline(always)]
364    #[must_use]
365    pub fn trmabt(&mut self) -> TRMABT_W<2> {
366        TRMABT_W::new(self)
367    }
368    #[doc = "Bit 4 - One-Shot Enable"]
369    #[inline(always)]
370    #[must_use]
371    pub fn oneshot(&mut self) -> ONESHOT_W<4> {
372        ONESHOT_W::new(self)
373    }
374    #[doc = "Bit 6 - Receive Mailbox Request"]
375    #[inline(always)]
376    #[must_use]
377    pub fn recreq(&mut self) -> RECREQ_W<6> {
378        RECREQ_W::new(self)
379    }
380    #[doc = "Bit 7 - Transmit Mailbox Request"]
381    #[inline(always)]
382    #[must_use]
383    pub fn trmreq(&mut self) -> TRMREQ_W<7> {
384        TRMREQ_W::new(self)
385    }
386    #[doc = "Writes raw bits to the register."]
387    #[inline(always)]
388    pub unsafe fn bits(&mut self, bits: u8) -> &mut Self {
389        self.0.bits(bits);
390        self
391    }
392}
393#[doc = "Message Control Register for Transmit\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 [mctl_tx](index.html) module"]
394pub struct MCTL_TX_SPEC;
395impl crate::RegisterSpec for MCTL_TX_SPEC {
396    type Ux = u8;
397}
398#[doc = "`read()` method returns [mctl_tx::R](R) reader structure"]
399impl crate::Readable for MCTL_TX_SPEC {
400    type Reader = R;
401}
402#[doc = "`write(|w| ..)` method takes [mctl_tx::W](W) writer structure"]
403impl crate::Writable for MCTL_TX_SPEC {
404    type Writer = W;
405    const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
406    const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
407}
408#[doc = "`reset()` method sets MCTL_TX[%s]
409to value 0"]
410impl crate::Resettable for MCTL_TX_SPEC {
411    const RESET_VALUE: Self::Ux = 0;
412}