stm32f1/stm32f107/can1/
mcr.rs

1#[doc = "Register `MCR` reader"]
2pub struct R(crate::R<MCR_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<MCR_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<MCR_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<MCR_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `MCR` writer"]
17pub struct W(crate::W<MCR_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<MCR_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<MCR_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<MCR_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "Field `DBF` reader - DBF"]
38pub type DBF_R = crate::BitReader<bool>;
39#[doc = "Field `DBF` writer - DBF"]
40pub type DBF_W<'a, const O: u8> = crate::BitWriter<'a, u32, MCR_SPEC, bool, O>;
41#[doc = "Field `RESET` reader - RESET"]
42pub type RESET_R = crate::BitReader<bool>;
43#[doc = "Field `RESET` writer - RESET"]
44pub type RESET_W<'a, const O: u8> = crate::BitWriter<'a, u32, MCR_SPEC, bool, O>;
45#[doc = "Field `TTCM` reader - TTCM"]
46pub type TTCM_R = crate::BitReader<bool>;
47#[doc = "Field `TTCM` writer - TTCM"]
48pub type TTCM_W<'a, const O: u8> = crate::BitWriter<'a, u32, MCR_SPEC, bool, O>;
49#[doc = "Field `ABOM` reader - ABOM"]
50pub type ABOM_R = crate::BitReader<bool>;
51#[doc = "Field `ABOM` writer - ABOM"]
52pub type ABOM_W<'a, const O: u8> = crate::BitWriter<'a, u32, MCR_SPEC, bool, O>;
53#[doc = "Field `AWUM` reader - AWUM"]
54pub type AWUM_R = crate::BitReader<bool>;
55#[doc = "Field `AWUM` writer - AWUM"]
56pub type AWUM_W<'a, const O: u8> = crate::BitWriter<'a, u32, MCR_SPEC, bool, O>;
57#[doc = "Field `NART` reader - NART"]
58pub type NART_R = crate::BitReader<bool>;
59#[doc = "Field `NART` writer - NART"]
60pub type NART_W<'a, const O: u8> = crate::BitWriter<'a, u32, MCR_SPEC, bool, O>;
61#[doc = "Field `RFLM` reader - RFLM"]
62pub type RFLM_R = crate::BitReader<bool>;
63#[doc = "Field `RFLM` writer - RFLM"]
64pub type RFLM_W<'a, const O: u8> = crate::BitWriter<'a, u32, MCR_SPEC, bool, O>;
65#[doc = "Field `TXFP` reader - TXFP"]
66pub type TXFP_R = crate::BitReader<bool>;
67#[doc = "Field `TXFP` writer - TXFP"]
68pub type TXFP_W<'a, const O: u8> = crate::BitWriter<'a, u32, MCR_SPEC, bool, O>;
69#[doc = "Field `SLEEP` reader - SLEEP"]
70pub type SLEEP_R = crate::BitReader<bool>;
71#[doc = "Field `SLEEP` writer - SLEEP"]
72pub type SLEEP_W<'a, const O: u8> = crate::BitWriter<'a, u32, MCR_SPEC, bool, O>;
73#[doc = "Field `INRQ` reader - INRQ"]
74pub type INRQ_R = crate::BitReader<bool>;
75#[doc = "Field `INRQ` writer - INRQ"]
76pub type INRQ_W<'a, const O: u8> = crate::BitWriter<'a, u32, MCR_SPEC, bool, O>;
77impl R {
78    #[doc = "Bit 16 - DBF"]
79    #[inline(always)]
80    pub fn dbf(&self) -> DBF_R {
81        DBF_R::new(((self.bits >> 16) & 1) != 0)
82    }
83    #[doc = "Bit 15 - RESET"]
84    #[inline(always)]
85    pub fn reset(&self) -> RESET_R {
86        RESET_R::new(((self.bits >> 15) & 1) != 0)
87    }
88    #[doc = "Bit 7 - TTCM"]
89    #[inline(always)]
90    pub fn ttcm(&self) -> TTCM_R {
91        TTCM_R::new(((self.bits >> 7) & 1) != 0)
92    }
93    #[doc = "Bit 6 - ABOM"]
94    #[inline(always)]
95    pub fn abom(&self) -> ABOM_R {
96        ABOM_R::new(((self.bits >> 6) & 1) != 0)
97    }
98    #[doc = "Bit 5 - AWUM"]
99    #[inline(always)]
100    pub fn awum(&self) -> AWUM_R {
101        AWUM_R::new(((self.bits >> 5) & 1) != 0)
102    }
103    #[doc = "Bit 4 - NART"]
104    #[inline(always)]
105    pub fn nart(&self) -> NART_R {
106        NART_R::new(((self.bits >> 4) & 1) != 0)
107    }
108    #[doc = "Bit 3 - RFLM"]
109    #[inline(always)]
110    pub fn rflm(&self) -> RFLM_R {
111        RFLM_R::new(((self.bits >> 3) & 1) != 0)
112    }
113    #[doc = "Bit 2 - TXFP"]
114    #[inline(always)]
115    pub fn txfp(&self) -> TXFP_R {
116        TXFP_R::new(((self.bits >> 2) & 1) != 0)
117    }
118    #[doc = "Bit 1 - SLEEP"]
119    #[inline(always)]
120    pub fn sleep(&self) -> SLEEP_R {
121        SLEEP_R::new(((self.bits >> 1) & 1) != 0)
122    }
123    #[doc = "Bit 0 - INRQ"]
124    #[inline(always)]
125    pub fn inrq(&self) -> INRQ_R {
126        INRQ_R::new((self.bits & 1) != 0)
127    }
128}
129impl W {
130    #[doc = "Bit 16 - DBF"]
131    #[inline(always)]
132    pub fn dbf(&mut self) -> DBF_W<16> {
133        DBF_W::new(self)
134    }
135    #[doc = "Bit 15 - RESET"]
136    #[inline(always)]
137    pub fn reset(&mut self) -> RESET_W<15> {
138        RESET_W::new(self)
139    }
140    #[doc = "Bit 7 - TTCM"]
141    #[inline(always)]
142    pub fn ttcm(&mut self) -> TTCM_W<7> {
143        TTCM_W::new(self)
144    }
145    #[doc = "Bit 6 - ABOM"]
146    #[inline(always)]
147    pub fn abom(&mut self) -> ABOM_W<6> {
148        ABOM_W::new(self)
149    }
150    #[doc = "Bit 5 - AWUM"]
151    #[inline(always)]
152    pub fn awum(&mut self) -> AWUM_W<5> {
153        AWUM_W::new(self)
154    }
155    #[doc = "Bit 4 - NART"]
156    #[inline(always)]
157    pub fn nart(&mut self) -> NART_W<4> {
158        NART_W::new(self)
159    }
160    #[doc = "Bit 3 - RFLM"]
161    #[inline(always)]
162    pub fn rflm(&mut self) -> RFLM_W<3> {
163        RFLM_W::new(self)
164    }
165    #[doc = "Bit 2 - TXFP"]
166    #[inline(always)]
167    pub fn txfp(&mut self) -> TXFP_W<2> {
168        TXFP_W::new(self)
169    }
170    #[doc = "Bit 1 - SLEEP"]
171    #[inline(always)]
172    pub fn sleep(&mut self) -> SLEEP_W<1> {
173        SLEEP_W::new(self)
174    }
175    #[doc = "Bit 0 - INRQ"]
176    #[inline(always)]
177    pub fn inrq(&mut self) -> INRQ_W<0> {
178        INRQ_W::new(self)
179    }
180    #[doc = "Writes raw bits to the register."]
181    #[inline(always)]
182    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
183        self.0.bits(bits);
184        self
185    }
186}
187#[doc = "CAN_MCR\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 [mcr](index.html) module"]
188pub struct MCR_SPEC;
189impl crate::RegisterSpec for MCR_SPEC {
190    type Ux = u32;
191}
192#[doc = "`read()` method returns [mcr::R](R) reader structure"]
193impl crate::Readable for MCR_SPEC {
194    type Reader = R;
195}
196#[doc = "`write(|w| ..)` method takes [mcr::W](W) writer structure"]
197impl crate::Writable for MCR_SPEC {
198    type Writer = W;
199}
200#[doc = "`reset()` method sets MCR to value 0"]
201impl crate::Resettable for MCR_SPEC {
202    #[inline(always)]
203    fn reset_value() -> Self::Ux {
204        0
205    }
206}