stm32f1_staging/stm32f100/spi1/
sr.rs1pub type R = crate::R<SRrs>;
3pub type W = crate::W<SRrs>;
5#[cfg_attr(feature = "defmt", derive(defmt::Format))]
9#[derive(Clone, Copy, Debug, PartialEq, Eq)]
10pub enum RXNE {
11 Empty = 0,
13 NotEmpty = 1,
15}
16impl From<RXNE> for bool {
17 #[inline(always)]
18 fn from(variant: RXNE) -> Self {
19 variant as u8 != 0
20 }
21}
22pub type RXNE_R = crate::BitReader<RXNE>;
24impl RXNE_R {
25 #[inline(always)]
27 pub const fn variant(&self) -> RXNE {
28 match self.bits {
29 false => RXNE::Empty,
30 true => RXNE::NotEmpty,
31 }
32 }
33 #[inline(always)]
35 pub fn is_empty(&self) -> bool {
36 *self == RXNE::Empty
37 }
38 #[inline(always)]
40 pub fn is_not_empty(&self) -> bool {
41 *self == RXNE::NotEmpty
42 }
43}
44#[cfg_attr(feature = "defmt", derive(defmt::Format))]
48#[derive(Clone, Copy, Debug, PartialEq, Eq)]
49pub enum TXE {
50 NotEmpty = 0,
52 Empty = 1,
54}
55impl From<TXE> for bool {
56 #[inline(always)]
57 fn from(variant: TXE) -> Self {
58 variant as u8 != 0
59 }
60}
61pub type TXE_R = crate::BitReader<TXE>;
63impl TXE_R {
64 #[inline(always)]
66 pub const fn variant(&self) -> TXE {
67 match self.bits {
68 false => TXE::NotEmpty,
69 true => TXE::Empty,
70 }
71 }
72 #[inline(always)]
74 pub fn is_not_empty(&self) -> bool {
75 *self == TXE::NotEmpty
76 }
77 #[inline(always)]
79 pub fn is_empty(&self) -> bool {
80 *self == TXE::Empty
81 }
82}
83#[cfg_attr(feature = "defmt", derive(defmt::Format))]
87#[derive(Clone, Copy, Debug, PartialEq, Eq)]
88pub enum CRCERRR {
89 Match = 0,
91 NoMatch = 1,
93}
94impl From<CRCERRR> for bool {
95 #[inline(always)]
96 fn from(variant: CRCERRR) -> Self {
97 variant as u8 != 0
98 }
99}
100pub type CRCERR_R = crate::BitReader<CRCERRR>;
102impl CRCERR_R {
103 #[inline(always)]
105 pub const fn variant(&self) -> CRCERRR {
106 match self.bits {
107 false => CRCERRR::Match,
108 true => CRCERRR::NoMatch,
109 }
110 }
111 #[inline(always)]
113 pub fn is_match(&self) -> bool {
114 *self == CRCERRR::Match
115 }
116 #[inline(always)]
118 pub fn is_no_match(&self) -> bool {
119 *self == CRCERRR::NoMatch
120 }
121}
122#[cfg_attr(feature = "defmt", derive(defmt::Format))]
126#[derive(Clone, Copy, Debug, PartialEq, Eq)]
127pub enum CRCERRW {
128 Clear = 0,
130}
131impl From<CRCERRW> for bool {
132 #[inline(always)]
133 fn from(variant: CRCERRW) -> Self {
134 variant as u8 != 0
135 }
136}
137pub type CRCERR_W<'a, REG> = crate::BitWriter0C<'a, REG, CRCERRW>;
139impl<'a, REG> CRCERR_W<'a, REG>
140where
141 REG: crate::Writable + crate::RegisterSpec,
142{
143 #[inline(always)]
145 pub fn clear(self) -> &'a mut crate::W<REG> {
146 self.variant(CRCERRW::Clear)
147 }
148}
149#[cfg_attr(feature = "defmt", derive(defmt::Format))]
153#[derive(Clone, Copy, Debug, PartialEq, Eq)]
154pub enum MODFR {
155 NoFault = 0,
157 Fault = 1,
159}
160impl From<MODFR> for bool {
161 #[inline(always)]
162 fn from(variant: MODFR) -> Self {
163 variant as u8 != 0
164 }
165}
166pub type MODF_R = crate::BitReader<MODFR>;
168impl MODF_R {
169 #[inline(always)]
171 pub const fn variant(&self) -> MODFR {
172 match self.bits {
173 false => MODFR::NoFault,
174 true => MODFR::Fault,
175 }
176 }
177 #[inline(always)]
179 pub fn is_no_fault(&self) -> bool {
180 *self == MODFR::NoFault
181 }
182 #[inline(always)]
184 pub fn is_fault(&self) -> bool {
185 *self == MODFR::Fault
186 }
187}
188#[cfg_attr(feature = "defmt", derive(defmt::Format))]
192#[derive(Clone, Copy, Debug, PartialEq, Eq)]
193pub enum OVRR {
194 NoOverrun = 0,
196 Overrun = 1,
198}
199impl From<OVRR> for bool {
200 #[inline(always)]
201 fn from(variant: OVRR) -> Self {
202 variant as u8 != 0
203 }
204}
205pub type OVR_R = crate::BitReader<OVRR>;
207impl OVR_R {
208 #[inline(always)]
210 pub const fn variant(&self) -> OVRR {
211 match self.bits {
212 false => OVRR::NoOverrun,
213 true => OVRR::Overrun,
214 }
215 }
216 #[inline(always)]
218 pub fn is_no_overrun(&self) -> bool {
219 *self == OVRR::NoOverrun
220 }
221 #[inline(always)]
223 pub fn is_overrun(&self) -> bool {
224 *self == OVRR::Overrun
225 }
226}
227#[cfg_attr(feature = "defmt", derive(defmt::Format))]
231#[derive(Clone, Copy, Debug, PartialEq, Eq)]
232pub enum BSYR {
233 NotBusy = 0,
235 Busy = 1,
237}
238impl From<BSYR> for bool {
239 #[inline(always)]
240 fn from(variant: BSYR) -> Self {
241 variant as u8 != 0
242 }
243}
244pub type BSY_R = crate::BitReader<BSYR>;
246impl BSY_R {
247 #[inline(always)]
249 pub const fn variant(&self) -> BSYR {
250 match self.bits {
251 false => BSYR::NotBusy,
252 true => BSYR::Busy,
253 }
254 }
255 #[inline(always)]
257 pub fn is_not_busy(&self) -> bool {
258 *self == BSYR::NotBusy
259 }
260 #[inline(always)]
262 pub fn is_busy(&self) -> bool {
263 *self == BSYR::Busy
264 }
265}
266impl R {
267 #[inline(always)]
269 pub fn rxne(&self) -> RXNE_R {
270 RXNE_R::new((self.bits & 1) != 0)
271 }
272 #[inline(always)]
274 pub fn txe(&self) -> TXE_R {
275 TXE_R::new(((self.bits >> 1) & 1) != 0)
276 }
277 #[inline(always)]
279 pub fn crcerr(&self) -> CRCERR_R {
280 CRCERR_R::new(((self.bits >> 4) & 1) != 0)
281 }
282 #[inline(always)]
284 pub fn modf(&self) -> MODF_R {
285 MODF_R::new(((self.bits >> 5) & 1) != 0)
286 }
287 #[inline(always)]
289 pub fn ovr(&self) -> OVR_R {
290 OVR_R::new(((self.bits >> 6) & 1) != 0)
291 }
292 #[inline(always)]
294 pub fn bsy(&self) -> BSY_R {
295 BSY_R::new(((self.bits >> 7) & 1) != 0)
296 }
297}
298impl core::fmt::Debug for R {
299 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
300 f.debug_struct("SR")
301 .field("bsy", &self.bsy())
302 .field("ovr", &self.ovr())
303 .field("modf", &self.modf())
304 .field("crcerr", &self.crcerr())
305 .field("txe", &self.txe())
306 .field("rxne", &self.rxne())
307 .finish()
308 }
309}
310impl W {
311 #[inline(always)]
313 pub fn crcerr(&mut self) -> CRCERR_W<SRrs> {
314 CRCERR_W::new(self, 4)
315 }
316}
317pub struct SRrs;
323impl crate::RegisterSpec for SRrs {
324 type Ux = u16;
325}
326impl crate::Readable for SRrs {}
328impl crate::Writable for SRrs {
330 type Safety = crate::Unsafe;
331 const ZERO_TO_MODIFY_FIELDS_BITMAP: u16 = 0x10;
332}
333impl crate::Resettable for SRrs {
335 const RESET_VALUE: u16 = 0x02;
336}