stm32f7/stm32f733/can1/
btr.rs1pub type R = crate::R<BTRrs>;
3pub type W = crate::W<BTRrs>;
5pub type BRP_R = crate::FieldReader<u16>;
7pub type BRP_W<'a, REG> = crate::FieldWriter<'a, REG, 10, u16>;
9pub type TS1_R = crate::FieldReader;
11pub type TS1_W<'a, REG> = crate::FieldWriter<'a, REG, 4>;
13pub type TS2_R = crate::FieldReader;
15pub type TS2_W<'a, REG> = crate::FieldWriter<'a, REG, 3>;
17pub type SJW_R = crate::FieldReader;
19pub type SJW_W<'a, REG> = crate::FieldWriter<'a, REG, 2>;
21#[cfg_attr(feature = "defmt", derive(defmt::Format))]
25#[derive(Clone, Copy, Debug, PartialEq, Eq)]
26pub enum LBKM {
27 Disabled = 0,
29 Enabled = 1,
31}
32impl From<LBKM> for bool {
33 #[inline(always)]
34 fn from(variant: LBKM) -> Self {
35 variant as u8 != 0
36 }
37}
38pub type LBKM_R = crate::BitReader<LBKM>;
40impl LBKM_R {
41 #[inline(always)]
43 pub const fn variant(&self) -> LBKM {
44 match self.bits {
45 false => LBKM::Disabled,
46 true => LBKM::Enabled,
47 }
48 }
49 #[inline(always)]
51 pub fn is_disabled(&self) -> bool {
52 *self == LBKM::Disabled
53 }
54 #[inline(always)]
56 pub fn is_enabled(&self) -> bool {
57 *self == LBKM::Enabled
58 }
59}
60pub type LBKM_W<'a, REG> = crate::BitWriter<'a, REG, LBKM>;
62impl<'a, REG> LBKM_W<'a, REG>
63where
64 REG: crate::Writable + crate::RegisterSpec,
65{
66 #[inline(always)]
68 pub fn disabled(self) -> &'a mut crate::W<REG> {
69 self.variant(LBKM::Disabled)
70 }
71 #[inline(always)]
73 pub fn enabled(self) -> &'a mut crate::W<REG> {
74 self.variant(LBKM::Enabled)
75 }
76}
77#[cfg_attr(feature = "defmt", derive(defmt::Format))]
81#[derive(Clone, Copy, Debug, PartialEq, Eq)]
82pub enum SILM {
83 Normal = 0,
85 Silent = 1,
87}
88impl From<SILM> for bool {
89 #[inline(always)]
90 fn from(variant: SILM) -> Self {
91 variant as u8 != 0
92 }
93}
94pub type SILM_R = crate::BitReader<SILM>;
96impl SILM_R {
97 #[inline(always)]
99 pub const fn variant(&self) -> SILM {
100 match self.bits {
101 false => SILM::Normal,
102 true => SILM::Silent,
103 }
104 }
105 #[inline(always)]
107 pub fn is_normal(&self) -> bool {
108 *self == SILM::Normal
109 }
110 #[inline(always)]
112 pub fn is_silent(&self) -> bool {
113 *self == SILM::Silent
114 }
115}
116pub type SILM_W<'a, REG> = crate::BitWriter<'a, REG, SILM>;
118impl<'a, REG> SILM_W<'a, REG>
119where
120 REG: crate::Writable + crate::RegisterSpec,
121{
122 #[inline(always)]
124 pub fn normal(self) -> &'a mut crate::W<REG> {
125 self.variant(SILM::Normal)
126 }
127 #[inline(always)]
129 pub fn silent(self) -> &'a mut crate::W<REG> {
130 self.variant(SILM::Silent)
131 }
132}
133impl R {
134 #[inline(always)]
136 pub fn brp(&self) -> BRP_R {
137 BRP_R::new((self.bits & 0x03ff) as u16)
138 }
139 #[inline(always)]
141 pub fn ts1(&self) -> TS1_R {
142 TS1_R::new(((self.bits >> 16) & 0x0f) as u8)
143 }
144 #[inline(always)]
146 pub fn ts2(&self) -> TS2_R {
147 TS2_R::new(((self.bits >> 20) & 7) as u8)
148 }
149 #[inline(always)]
151 pub fn sjw(&self) -> SJW_R {
152 SJW_R::new(((self.bits >> 24) & 3) as u8)
153 }
154 #[inline(always)]
156 pub fn lbkm(&self) -> LBKM_R {
157 LBKM_R::new(((self.bits >> 30) & 1) != 0)
158 }
159 #[inline(always)]
161 pub fn silm(&self) -> SILM_R {
162 SILM_R::new(((self.bits >> 31) & 1) != 0)
163 }
164}
165impl core::fmt::Debug for R {
166 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
167 f.debug_struct("BTR")
168 .field("silm", &self.silm())
169 .field("lbkm", &self.lbkm())
170 .field("sjw", &self.sjw())
171 .field("ts2", &self.ts2())
172 .field("ts1", &self.ts1())
173 .field("brp", &self.brp())
174 .finish()
175 }
176}
177impl W {
178 #[inline(always)]
180 pub fn brp(&mut self) -> BRP_W<BTRrs> {
181 BRP_W::new(self, 0)
182 }
183 #[inline(always)]
185 pub fn ts1(&mut self) -> TS1_W<BTRrs> {
186 TS1_W::new(self, 16)
187 }
188 #[inline(always)]
190 pub fn ts2(&mut self) -> TS2_W<BTRrs> {
191 TS2_W::new(self, 20)
192 }
193 #[inline(always)]
195 pub fn sjw(&mut self) -> SJW_W<BTRrs> {
196 SJW_W::new(self, 24)
197 }
198 #[inline(always)]
200 pub fn lbkm(&mut self) -> LBKM_W<BTRrs> {
201 LBKM_W::new(self, 30)
202 }
203 #[inline(always)]
205 pub fn silm(&mut self) -> SILM_W<BTRrs> {
206 SILM_W::new(self, 31)
207 }
208}
209pub struct BTRrs;
215impl crate::RegisterSpec for BTRrs {
216 type Ux = u32;
217}
218impl crate::Readable for BTRrs {}
220impl crate::Writable for BTRrs {
222 type Safety = crate::Unsafe;
223}
224impl crate::Resettable for BTRrs {}