stm32f1_staging/stm32f107/usart1/
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 PE {
11 NoError = 0,
13 Error = 1,
15}
16impl From<PE> for bool {
17 #[inline(always)]
18 fn from(variant: PE) -> Self {
19 variant as u8 != 0
20 }
21}
22pub type PE_R = crate::BitReader<PE>;
24impl PE_R {
25 #[inline(always)]
27 pub const fn variant(&self) -> PE {
28 match self.bits {
29 false => PE::NoError,
30 true => PE::Error,
31 }
32 }
33 #[inline(always)]
35 pub fn is_no_error(&self) -> bool {
36 *self == PE::NoError
37 }
38 #[inline(always)]
40 pub fn is_error(&self) -> bool {
41 *self == PE::Error
42 }
43}
44#[cfg_attr(feature = "defmt", derive(defmt::Format))]
48#[derive(Clone, Copy, Debug, PartialEq, Eq)]
49pub enum FE {
50 NoError = 0,
52 Error = 1,
54}
55impl From<FE> for bool {
56 #[inline(always)]
57 fn from(variant: FE) -> Self {
58 variant as u8 != 0
59 }
60}
61pub type FE_R = crate::BitReader<FE>;
63impl FE_R {
64 #[inline(always)]
66 pub const fn variant(&self) -> FE {
67 match self.bits {
68 false => FE::NoError,
69 true => FE::Error,
70 }
71 }
72 #[inline(always)]
74 pub fn is_no_error(&self) -> bool {
75 *self == FE::NoError
76 }
77 #[inline(always)]
79 pub fn is_error(&self) -> bool {
80 *self == FE::Error
81 }
82}
83#[cfg_attr(feature = "defmt", derive(defmt::Format))]
87#[derive(Clone, Copy, Debug, PartialEq, Eq)]
88pub enum NE {
89 NoNoise = 0,
91 Noise = 1,
93}
94impl From<NE> for bool {
95 #[inline(always)]
96 fn from(variant: NE) -> Self {
97 variant as u8 != 0
98 }
99}
100pub type NE_R = crate::BitReader<NE>;
102impl NE_R {
103 #[inline(always)]
105 pub const fn variant(&self) -> NE {
106 match self.bits {
107 false => NE::NoNoise,
108 true => NE::Noise,
109 }
110 }
111 #[inline(always)]
113 pub fn is_no_noise(&self) -> bool {
114 *self == NE::NoNoise
115 }
116 #[inline(always)]
118 pub fn is_noise(&self) -> bool {
119 *self == NE::Noise
120 }
121}
122#[cfg_attr(feature = "defmt", derive(defmt::Format))]
126#[derive(Clone, Copy, Debug, PartialEq, Eq)]
127pub enum ORE {
128 NoOverrun = 0,
130 Overrun = 1,
132}
133impl From<ORE> for bool {
134 #[inline(always)]
135 fn from(variant: ORE) -> Self {
136 variant as u8 != 0
137 }
138}
139pub type ORE_R = crate::BitReader<ORE>;
141impl ORE_R {
142 #[inline(always)]
144 pub const fn variant(&self) -> ORE {
145 match self.bits {
146 false => ORE::NoOverrun,
147 true => ORE::Overrun,
148 }
149 }
150 #[inline(always)]
152 pub fn is_no_overrun(&self) -> bool {
153 *self == ORE::NoOverrun
154 }
155 #[inline(always)]
157 pub fn is_overrun(&self) -> bool {
158 *self == ORE::Overrun
159 }
160}
161#[cfg_attr(feature = "defmt", derive(defmt::Format))]
165#[derive(Clone, Copy, Debug, PartialEq, Eq)]
166pub enum IDLE {
167 NoIdle = 0,
169 Idle = 1,
171}
172impl From<IDLE> for bool {
173 #[inline(always)]
174 fn from(variant: IDLE) -> Self {
175 variant as u8 != 0
176 }
177}
178pub type IDLE_R = crate::BitReader<IDLE>;
180impl IDLE_R {
181 #[inline(always)]
183 pub const fn variant(&self) -> IDLE {
184 match self.bits {
185 false => IDLE::NoIdle,
186 true => IDLE::Idle,
187 }
188 }
189 #[inline(always)]
191 pub fn is_no_idle(&self) -> bool {
192 *self == IDLE::NoIdle
193 }
194 #[inline(always)]
196 pub fn is_idle(&self) -> bool {
197 *self == IDLE::Idle
198 }
199}
200#[cfg_attr(feature = "defmt", derive(defmt::Format))]
204#[derive(Clone, Copy, Debug, PartialEq, Eq)]
205pub enum RXNER {
206 NoData = 0,
208 DataReady = 1,
210}
211impl From<RXNER> for bool {
212 #[inline(always)]
213 fn from(variant: RXNER) -> Self {
214 variant as u8 != 0
215 }
216}
217pub type RXNE_R = crate::BitReader<RXNER>;
219impl RXNE_R {
220 #[inline(always)]
222 pub const fn variant(&self) -> RXNER {
223 match self.bits {
224 false => RXNER::NoData,
225 true => RXNER::DataReady,
226 }
227 }
228 #[inline(always)]
230 pub fn is_no_data(&self) -> bool {
231 *self == RXNER::NoData
232 }
233 #[inline(always)]
235 pub fn is_data_ready(&self) -> bool {
236 *self == RXNER::DataReady
237 }
238}
239#[cfg_attr(feature = "defmt", derive(defmt::Format))]
243#[derive(Clone, Copy, Debug, PartialEq, Eq)]
244pub enum RXNEW {
245 Clear = 0,
247}
248impl From<RXNEW> for bool {
249 #[inline(always)]
250 fn from(variant: RXNEW) -> Self {
251 variant as u8 != 0
252 }
253}
254pub type RXNE_W<'a, REG> = crate::BitWriter0C<'a, REG, RXNEW>;
256impl<'a, REG> RXNE_W<'a, REG>
257where
258 REG: crate::Writable + crate::RegisterSpec,
259{
260 #[inline(always)]
262 pub fn clear(self) -> &'a mut crate::W<REG> {
263 self.variant(RXNEW::Clear)
264 }
265}
266#[cfg_attr(feature = "defmt", derive(defmt::Format))]
270#[derive(Clone, Copy, Debug, PartialEq, Eq)]
271pub enum TCR {
272 TxNotComplete = 0,
274 TxComplete = 1,
276}
277impl From<TCR> for bool {
278 #[inline(always)]
279 fn from(variant: TCR) -> Self {
280 variant as u8 != 0
281 }
282}
283pub type TC_R = crate::BitReader<TCR>;
285impl TC_R {
286 #[inline(always)]
288 pub const fn variant(&self) -> TCR {
289 match self.bits {
290 false => TCR::TxNotComplete,
291 true => TCR::TxComplete,
292 }
293 }
294 #[inline(always)]
296 pub fn is_tx_not_complete(&self) -> bool {
297 *self == TCR::TxNotComplete
298 }
299 #[inline(always)]
301 pub fn is_tx_complete(&self) -> bool {
302 *self == TCR::TxComplete
303 }
304}
305#[cfg_attr(feature = "defmt", derive(defmt::Format))]
309#[derive(Clone, Copy, Debug, PartialEq, Eq)]
310pub enum TCW {
311 Clear = 0,
313}
314impl From<TCW> for bool {
315 #[inline(always)]
316 fn from(variant: TCW) -> Self {
317 variant as u8 != 0
318 }
319}
320pub type TC_W<'a, REG> = crate::BitWriter0C<'a, REG, TCW>;
322impl<'a, REG> TC_W<'a, REG>
323where
324 REG: crate::Writable + crate::RegisterSpec,
325{
326 #[inline(always)]
328 pub fn clear(self) -> &'a mut crate::W<REG> {
329 self.variant(TCW::Clear)
330 }
331}
332#[cfg_attr(feature = "defmt", derive(defmt::Format))]
336#[derive(Clone, Copy, Debug, PartialEq, Eq)]
337pub enum TXE {
338 TxNotEmpty = 0,
340 TxEmpty = 1,
342}
343impl From<TXE> for bool {
344 #[inline(always)]
345 fn from(variant: TXE) -> Self {
346 variant as u8 != 0
347 }
348}
349pub type TXE_R = crate::BitReader<TXE>;
351impl TXE_R {
352 #[inline(always)]
354 pub const fn variant(&self) -> TXE {
355 match self.bits {
356 false => TXE::TxNotEmpty,
357 true => TXE::TxEmpty,
358 }
359 }
360 #[inline(always)]
362 pub fn is_tx_not_empty(&self) -> bool {
363 *self == TXE::TxNotEmpty
364 }
365 #[inline(always)]
367 pub fn is_tx_empty(&self) -> bool {
368 *self == TXE::TxEmpty
369 }
370}
371#[cfg_attr(feature = "defmt", derive(defmt::Format))]
375#[derive(Clone, Copy, Debug, PartialEq, Eq)]
376pub enum LBDR {
377 NotDetected = 0,
379 Detected = 1,
381}
382impl From<LBDR> for bool {
383 #[inline(always)]
384 fn from(variant: LBDR) -> Self {
385 variant as u8 != 0
386 }
387}
388pub type LBD_R = crate::BitReader<LBDR>;
390impl LBD_R {
391 #[inline(always)]
393 pub const fn variant(&self) -> LBDR {
394 match self.bits {
395 false => LBDR::NotDetected,
396 true => LBDR::Detected,
397 }
398 }
399 #[inline(always)]
401 pub fn is_not_detected(&self) -> bool {
402 *self == LBDR::NotDetected
403 }
404 #[inline(always)]
406 pub fn is_detected(&self) -> bool {
407 *self == LBDR::Detected
408 }
409}
410#[cfg_attr(feature = "defmt", derive(defmt::Format))]
414#[derive(Clone, Copy, Debug, PartialEq, Eq)]
415pub enum LBDW {
416 Clear = 0,
418}
419impl From<LBDW> for bool {
420 #[inline(always)]
421 fn from(variant: LBDW) -> Self {
422 variant as u8 != 0
423 }
424}
425pub type LBD_W<'a, REG> = crate::BitWriter0C<'a, REG, LBDW>;
427impl<'a, REG> LBD_W<'a, REG>
428where
429 REG: crate::Writable + crate::RegisterSpec,
430{
431 #[inline(always)]
433 pub fn clear(self) -> &'a mut crate::W<REG> {
434 self.variant(LBDW::Clear)
435 }
436}
437#[cfg_attr(feature = "defmt", derive(defmt::Format))]
441#[derive(Clone, Copy, Debug, PartialEq, Eq)]
442pub enum CTSR {
443 NotChanged = 0,
445 Changed = 1,
447}
448impl From<CTSR> for bool {
449 #[inline(always)]
450 fn from(variant: CTSR) -> Self {
451 variant as u8 != 0
452 }
453}
454pub type CTS_R = crate::BitReader<CTSR>;
456impl CTS_R {
457 #[inline(always)]
459 pub const fn variant(&self) -> CTSR {
460 match self.bits {
461 false => CTSR::NotChanged,
462 true => CTSR::Changed,
463 }
464 }
465 #[inline(always)]
467 pub fn is_not_changed(&self) -> bool {
468 *self == CTSR::NotChanged
469 }
470 #[inline(always)]
472 pub fn is_changed(&self) -> bool {
473 *self == CTSR::Changed
474 }
475}
476#[cfg_attr(feature = "defmt", derive(defmt::Format))]
480#[derive(Clone, Copy, Debug, PartialEq, Eq)]
481pub enum CTSW {
482 Clear = 0,
484}
485impl From<CTSW> for bool {
486 #[inline(always)]
487 fn from(variant: CTSW) -> Self {
488 variant as u8 != 0
489 }
490}
491pub type CTS_W<'a, REG> = crate::BitWriter0C<'a, REG, CTSW>;
493impl<'a, REG> CTS_W<'a, REG>
494where
495 REG: crate::Writable + crate::RegisterSpec,
496{
497 #[inline(always)]
499 pub fn clear(self) -> &'a mut crate::W<REG> {
500 self.variant(CTSW::Clear)
501 }
502}
503impl R {
504 #[inline(always)]
506 pub fn pe(&self) -> PE_R {
507 PE_R::new((self.bits & 1) != 0)
508 }
509 #[inline(always)]
511 pub fn fe(&self) -> FE_R {
512 FE_R::new(((self.bits >> 1) & 1) != 0)
513 }
514 #[inline(always)]
516 pub fn ne(&self) -> NE_R {
517 NE_R::new(((self.bits >> 2) & 1) != 0)
518 }
519 #[inline(always)]
521 pub fn ore(&self) -> ORE_R {
522 ORE_R::new(((self.bits >> 3) & 1) != 0)
523 }
524 #[inline(always)]
526 pub fn idle(&self) -> IDLE_R {
527 IDLE_R::new(((self.bits >> 4) & 1) != 0)
528 }
529 #[inline(always)]
531 pub fn rxne(&self) -> RXNE_R {
532 RXNE_R::new(((self.bits >> 5) & 1) != 0)
533 }
534 #[inline(always)]
536 pub fn tc(&self) -> TC_R {
537 TC_R::new(((self.bits >> 6) & 1) != 0)
538 }
539 #[inline(always)]
541 pub fn txe(&self) -> TXE_R {
542 TXE_R::new(((self.bits >> 7) & 1) != 0)
543 }
544 #[inline(always)]
546 pub fn lbd(&self) -> LBD_R {
547 LBD_R::new(((self.bits >> 8) & 1) != 0)
548 }
549 #[inline(always)]
551 pub fn cts(&self) -> CTS_R {
552 CTS_R::new(((self.bits >> 9) & 1) != 0)
553 }
554}
555impl core::fmt::Debug for R {
556 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
557 f.debug_struct("SR")
558 .field("cts", &self.cts())
559 .field("lbd", &self.lbd())
560 .field("txe", &self.txe())
561 .field("tc", &self.tc())
562 .field("rxne", &self.rxne())
563 .field("idle", &self.idle())
564 .field("ore", &self.ore())
565 .field("ne", &self.ne())
566 .field("fe", &self.fe())
567 .field("pe", &self.pe())
568 .finish()
569 }
570}
571impl W {
572 #[inline(always)]
574 pub fn rxne(&mut self) -> RXNE_W<SRrs> {
575 RXNE_W::new(self, 5)
576 }
577 #[inline(always)]
579 pub fn tc(&mut self) -> TC_W<SRrs> {
580 TC_W::new(self, 6)
581 }
582 #[inline(always)]
584 pub fn lbd(&mut self) -> LBD_W<SRrs> {
585 LBD_W::new(self, 8)
586 }
587 #[inline(always)]
589 pub fn cts(&mut self) -> CTS_W<SRrs> {
590 CTS_W::new(self, 9)
591 }
592}
593pub struct SRrs;
599impl crate::RegisterSpec for SRrs {
600 type Ux = u16;
601}
602impl crate::Readable for SRrs {}
604impl crate::Writable for SRrs {
606 type Safety = crate::Unsafe;
607 const ZERO_TO_MODIFY_FIELDS_BITMAP: u16 = 0x0360;
608}
609impl crate::Resettable for SRrs {
611 const RESET_VALUE: u16 = 0xc0;
612}