swm341_pac/can0/
sr.rs

1#[doc = "Register `SR` reader"]
2pub struct R(crate::R<SR_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<SR_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<SR_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<SR_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Field `RXDA` reader - RXDA field"]
17pub type RXDA_R = crate::BitReader<bool>;
18#[doc = "Field `RXOV` reader - RXOV field"]
19pub type RXOV_R = crate::BitReader<bool>;
20#[doc = "Field `TXBR` reader - TXBR field"]
21pub type TXBR_R = crate::BitReader<bool>;
22#[doc = "Field `TXOK` reader - TXOK field"]
23pub type TXOK_R = crate::BitReader<bool>;
24#[doc = "Field `RXBUSY` reader - RXBUSY field"]
25pub type RXBUSY_R = crate::BitReader<bool>;
26#[doc = "Field `TXBUSY` reader - TXBUSY field"]
27pub type TXBUSY_R = crate::BitReader<bool>;
28#[doc = "Field `ERRWARN` reader - ERRWARN field"]
29pub type ERRWARN_R = crate::BitReader<bool>;
30#[doc = "Field `BUSOFF` reader - BUSOFF field"]
31pub type BUSOFF_R = crate::BitReader<bool>;
32impl R {
33    #[doc = "Bit 0 - RXDA field"]
34    #[inline(always)]
35    pub fn rxda(&self) -> RXDA_R {
36        RXDA_R::new((self.bits & 1) != 0)
37    }
38    #[doc = "Bit 1 - RXOV field"]
39    #[inline(always)]
40    pub fn rxov(&self) -> RXOV_R {
41        RXOV_R::new(((self.bits >> 1) & 1) != 0)
42    }
43    #[doc = "Bit 2 - TXBR field"]
44    #[inline(always)]
45    pub fn txbr(&self) -> TXBR_R {
46        TXBR_R::new(((self.bits >> 2) & 1) != 0)
47    }
48    #[doc = "Bit 3 - TXOK field"]
49    #[inline(always)]
50    pub fn txok(&self) -> TXOK_R {
51        TXOK_R::new(((self.bits >> 3) & 1) != 0)
52    }
53    #[doc = "Bit 4 - RXBUSY field"]
54    #[inline(always)]
55    pub fn rxbusy(&self) -> RXBUSY_R {
56        RXBUSY_R::new(((self.bits >> 4) & 1) != 0)
57    }
58    #[doc = "Bit 5 - TXBUSY field"]
59    #[inline(always)]
60    pub fn txbusy(&self) -> TXBUSY_R {
61        TXBUSY_R::new(((self.bits >> 5) & 1) != 0)
62    }
63    #[doc = "Bit 6 - ERRWARN field"]
64    #[inline(always)]
65    pub fn errwarn(&self) -> ERRWARN_R {
66        ERRWARN_R::new(((self.bits >> 6) & 1) != 0)
67    }
68    #[doc = "Bit 7 - BUSOFF field"]
69    #[inline(always)]
70    pub fn busoff(&self) -> BUSOFF_R {
71        BUSOFF_R::new(((self.bits >> 7) & 1) != 0)
72    }
73}
74#[doc = "SR register\n\nThis register you can [`read`](crate::generic::Reg::read). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [sr](index.html) module"]
75pub struct SR_SPEC;
76impl crate::RegisterSpec for SR_SPEC {
77    type Ux = u32;
78}
79#[doc = "`read()` method returns [sr::R](R) reader structure"]
80impl crate::Readable for SR_SPEC {
81    type Reader = R;
82}
83#[doc = "`reset()` method sets SR to value 0"]
84impl crate::Resettable for SR_SPEC {
85    #[inline(always)]
86    fn reset_value() -> Self::Ux {
87        0
88    }
89}