py32f0/py32f002b/usart1/
sr.rs

1///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///Register `SR` writer
17pub struct W(crate::W<SR_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<SR_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<SR_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<SR_SPEC>) -> Self {
34        W(writer)
35    }
36}
37///Field `PE` reader - Parity error
38pub type PE_R = crate::BitReader<bool>;
39///Field `FE` reader - Framing error
40pub type FE_R = crate::BitReader<bool>;
41///Field `NE` reader - Noise error flag
42pub type NE_R = crate::BitReader<bool>;
43///Field `ORE` reader - Overrun error
44pub type ORE_R = crate::BitReader<bool>;
45///Field `IDLE` reader - IDLE line detected
46pub type IDLE_R = crate::BitReader<IDLER_A>;
47/**IDLE line detected
48
49Value on reset: 0*/
50#[derive(Clone, Copy, Debug, PartialEq, Eq)]
51pub enum IDLER_A {
52    ///0: Idle line not detected
53    Busy = 0,
54    ///1: Idle line detected
55    Idle = 1,
56}
57impl From<IDLER_A> for bool {
58    #[inline(always)]
59    fn from(variant: IDLER_A) -> Self {
60        variant as u8 != 0
61    }
62}
63impl IDLE_R {
64    ///Get enumerated values variant
65    #[inline(always)]
66    pub fn variant(&self) -> IDLER_A {
67        match self.bits {
68            false => IDLER_A::Busy,
69            true => IDLER_A::Idle,
70        }
71    }
72    ///Checks if the value of the field is `Busy`
73    #[inline(always)]
74    pub fn is_busy(&self) -> bool {
75        *self == IDLER_A::Busy
76    }
77    ///Checks if the value of the field is `Idle`
78    #[inline(always)]
79    pub fn is_idle(&self) -> bool {
80        *self == IDLER_A::Idle
81    }
82}
83///Field `RXNE` reader - Read data register not empty
84pub type RXNE_R = crate::BitReader<RXNER_A>;
85/**Read data register not empty
86
87Value on reset: 0*/
88#[derive(Clone, Copy, Debug, PartialEq, Eq)]
89pub enum RXNER_A {
90    ///0: No data recived
91    Empty = 0,
92    ///1: Received data
93    NotEmpty = 1,
94}
95impl From<RXNER_A> for bool {
96    #[inline(always)]
97    fn from(variant: RXNER_A) -> Self {
98        variant as u8 != 0
99    }
100}
101impl RXNE_R {
102    ///Get enumerated values variant
103    #[inline(always)]
104    pub fn variant(&self) -> RXNER_A {
105        match self.bits {
106            false => RXNER_A::Empty,
107            true => RXNER_A::NotEmpty,
108        }
109    }
110    ///Checks if the value of the field is `Empty`
111    #[inline(always)]
112    pub fn is_empty(&self) -> bool {
113        *self == RXNER_A::Empty
114    }
115    ///Checks if the value of the field is `NotEmpty`
116    #[inline(always)]
117    pub fn is_not_empty(&self) -> bool {
118        *self == RXNER_A::NotEmpty
119    }
120}
121/**Read data register not empty
122
123Value on reset: 0*/
124#[derive(Clone, Copy, Debug, PartialEq, Eq)]
125pub enum RXNEW_AW {
126    ///0: Clear RXNE flag
127    Clear = 0,
128}
129impl From<RXNEW_AW> for bool {
130    #[inline(always)]
131    fn from(variant: RXNEW_AW) -> Self {
132        variant as u8 != 0
133    }
134}
135///Field `RXNE` writer - Read data register not empty
136pub type RXNE_W<'a, const O: u8> = crate::BitWriter<'a, u32, SR_SPEC, RXNEW_AW, O>;
137impl<'a, const O: u8> RXNE_W<'a, O> {
138    ///Clear RXNE flag
139    #[inline(always)]
140    pub fn clear(self) -> &'a mut W {
141        self.variant(RXNEW_AW::Clear)
142    }
143}
144///Field `TC` reader - Transmission complete
145pub type TC_R = crate::BitReader<TCR_A>;
146/**Transmission complete
147
148Value on reset: 1*/
149#[derive(Clone, Copy, Debug, PartialEq, Eq)]
150pub enum TCR_A {
151    ///0: Data transmit not complete
152    NotComplete = 0,
153    ///1: Data transmit complete
154    Complete = 1,
155}
156impl From<TCR_A> for bool {
157    #[inline(always)]
158    fn from(variant: TCR_A) -> Self {
159        variant as u8 != 0
160    }
161}
162impl TC_R {
163    ///Get enumerated values variant
164    #[inline(always)]
165    pub fn variant(&self) -> TCR_A {
166        match self.bits {
167            false => TCR_A::NotComplete,
168            true => TCR_A::Complete,
169        }
170    }
171    ///Checks if the value of the field is `NotComplete`
172    #[inline(always)]
173    pub fn is_not_complete(&self) -> bool {
174        *self == TCR_A::NotComplete
175    }
176    ///Checks if the value of the field is `Complete`
177    #[inline(always)]
178    pub fn is_complete(&self) -> bool {
179        *self == TCR_A::Complete
180    }
181}
182/**Transmission complete
183
184Value on reset: 1*/
185#[derive(Clone, Copy, Debug, PartialEq, Eq)]
186pub enum TCW_AW {
187    ///0: Clear TC flag
188    Clear = 0,
189}
190impl From<TCW_AW> for bool {
191    #[inline(always)]
192    fn from(variant: TCW_AW) -> Self {
193        variant as u8 != 0
194    }
195}
196///Field `TC` writer - Transmission complete
197pub type TC_W<'a, const O: u8> = crate::BitWriter<'a, u32, SR_SPEC, TCW_AW, O>;
198impl<'a, const O: u8> TC_W<'a, O> {
199    ///Clear TC flag
200    #[inline(always)]
201    pub fn clear(self) -> &'a mut W {
202        self.variant(TCW_AW::Clear)
203    }
204}
205///Field `TXE` reader - Transmit data register empty
206pub type TXE_R = crate::BitReader<TXER_A>;
207/**Transmit data register empty
208
209Value on reset: 1*/
210#[derive(Clone, Copy, Debug, PartialEq, Eq)]
211pub enum TXER_A {
212    ///0: Data not transfer to shift register
213    NotEmpty = 0,
214    ///1: Data transferred to shift register
215    Empty = 1,
216}
217impl From<TXER_A> for bool {
218    #[inline(always)]
219    fn from(variant: TXER_A) -> Self {
220        variant as u8 != 0
221    }
222}
223impl TXE_R {
224    ///Get enumerated values variant
225    #[inline(always)]
226    pub fn variant(&self) -> TXER_A {
227        match self.bits {
228            false => TXER_A::NotEmpty,
229            true => TXER_A::Empty,
230        }
231    }
232    ///Checks if the value of the field is `NotEmpty`
233    #[inline(always)]
234    pub fn is_not_empty(&self) -> bool {
235        *self == TXER_A::NotEmpty
236    }
237    ///Checks if the value of the field is `Empty`
238    #[inline(always)]
239    pub fn is_empty(&self) -> bool {
240        *self == TXER_A::Empty
241    }
242}
243///Field `CTS` reader - CTS flag
244pub type CTS_R = crate::BitReader<CTSR_A>;
245/**CTS flag
246
247Value on reset: 0*/
248#[derive(Clone, Copy, Debug, PartialEq, Eq)]
249pub enum CTSR_A {
250    ///0: CTS line not change
251    NotChange = 0,
252    ///1: CTS line toggle
253    Toggle = 1,
254}
255impl From<CTSR_A> for bool {
256    #[inline(always)]
257    fn from(variant: CTSR_A) -> Self {
258        variant as u8 != 0
259    }
260}
261impl CTS_R {
262    ///Get enumerated values variant
263    #[inline(always)]
264    pub fn variant(&self) -> CTSR_A {
265        match self.bits {
266            false => CTSR_A::NotChange,
267            true => CTSR_A::Toggle,
268        }
269    }
270    ///Checks if the value of the field is `NotChange`
271    #[inline(always)]
272    pub fn is_not_change(&self) -> bool {
273        *self == CTSR_A::NotChange
274    }
275    ///Checks if the value of the field is `Toggle`
276    #[inline(always)]
277    pub fn is_toggle(&self) -> bool {
278        *self == CTSR_A::Toggle
279    }
280}
281/**CTS flag
282
283Value on reset: 0*/
284#[derive(Clone, Copy, Debug, PartialEq, Eq)]
285pub enum CTSW_AW {
286    ///0: Clear CTS flag
287    Clear = 0,
288}
289impl From<CTSW_AW> for bool {
290    #[inline(always)]
291    fn from(variant: CTSW_AW) -> Self {
292        variant as u8 != 0
293    }
294}
295///Field `CTS` writer - CTS flag
296pub type CTS_W<'a, const O: u8> = crate::BitWriter<'a, u32, SR_SPEC, CTSW_AW, O>;
297impl<'a, const O: u8> CTS_W<'a, O> {
298    ///Clear CTS flag
299    #[inline(always)]
300    pub fn clear(self) -> &'a mut W {
301        self.variant(CTSW_AW::Clear)
302    }
303}
304///Field `ABRF` reader - Automate baudrate detection flag
305pub type ABRF_R = crate::BitReader<ABRFR_A>;
306/**Automate baudrate detection flag
307
308Value on reset: 0*/
309#[derive(Clone, Copy, Debug, PartialEq, Eq)]
310pub enum ABRFR_A {
311    ///1: Auto baud rate flag
312    Detected = 1,
313}
314impl From<ABRFR_A> for bool {
315    #[inline(always)]
316    fn from(variant: ABRFR_A) -> Self {
317        variant as u8 != 0
318    }
319}
320impl ABRF_R {
321    ///Get enumerated values variant
322    #[inline(always)]
323    pub fn variant(&self) -> Option<ABRFR_A> {
324        match self.bits {
325            true => Some(ABRFR_A::Detected),
326            _ => None,
327        }
328    }
329    ///Checks if the value of the field is `Detected`
330    #[inline(always)]
331    pub fn is_detected(&self) -> bool {
332        *self == ABRFR_A::Detected
333    }
334}
335///Field `ABRE` reader - Automate baudrate detection error flag
336pub type ABRE_R = crate::BitReader<ABRER_A>;
337/**Automate baudrate detection error flag
338
339Value on reset: 0*/
340#[derive(Clone, Copy, Debug, PartialEq, Eq)]
341pub enum ABRER_A {
342    ///1: Auto baud rate error flag
343    Error = 1,
344}
345impl From<ABRER_A> for bool {
346    #[inline(always)]
347    fn from(variant: ABRER_A) -> Self {
348        variant as u8 != 0
349    }
350}
351impl ABRE_R {
352    ///Get enumerated values variant
353    #[inline(always)]
354    pub fn variant(&self) -> Option<ABRER_A> {
355        match self.bits {
356            true => Some(ABRER_A::Error),
357            _ => None,
358        }
359    }
360    ///Checks if the value of the field is `Error`
361    #[inline(always)]
362    pub fn is_error(&self) -> bool {
363        *self == ABRER_A::Error
364    }
365}
366/**Automate baudrate detection requeset
367
368Value on reset: 0*/
369#[derive(Clone, Copy, Debug, PartialEq, Eq)]
370pub enum ABRRQW_AW {
371    ///1: Reset ABRE flag and request auto baud rate detect for next data frame
372    Request = 1,
373}
374impl From<ABRRQW_AW> for bool {
375    #[inline(always)]
376    fn from(variant: ABRRQW_AW) -> Self {
377        variant as u8 != 0
378    }
379}
380///Field `ABRRQ` writer - Automate baudrate detection requeset
381pub type ABRRQ_W<'a, const O: u8> = crate::BitWriter<'a, u32, SR_SPEC, ABRRQW_AW, O>;
382impl<'a, const O: u8> ABRRQ_W<'a, O> {
383    ///Reset ABRE flag and request auto baud rate detect for next data frame
384    #[inline(always)]
385    pub fn request(self) -> &'a mut W {
386        self.variant(ABRRQW_AW::Request)
387    }
388}
389impl R {
390    ///Bit 0 - Parity error
391    #[inline(always)]
392    pub fn pe(&self) -> PE_R {
393        PE_R::new((self.bits & 1) != 0)
394    }
395    ///Bit 1 - Framing error
396    #[inline(always)]
397    pub fn fe(&self) -> FE_R {
398        FE_R::new(((self.bits >> 1) & 1) != 0)
399    }
400    ///Bit 2 - Noise error flag
401    #[inline(always)]
402    pub fn ne(&self) -> NE_R {
403        NE_R::new(((self.bits >> 2) & 1) != 0)
404    }
405    ///Bit 3 - Overrun error
406    #[inline(always)]
407    pub fn ore(&self) -> ORE_R {
408        ORE_R::new(((self.bits >> 3) & 1) != 0)
409    }
410    ///Bit 4 - IDLE line detected
411    #[inline(always)]
412    pub fn idle(&self) -> IDLE_R {
413        IDLE_R::new(((self.bits >> 4) & 1) != 0)
414    }
415    ///Bit 5 - Read data register not empty
416    #[inline(always)]
417    pub fn rxne(&self) -> RXNE_R {
418        RXNE_R::new(((self.bits >> 5) & 1) != 0)
419    }
420    ///Bit 6 - Transmission complete
421    #[inline(always)]
422    pub fn tc(&self) -> TC_R {
423        TC_R::new(((self.bits >> 6) & 1) != 0)
424    }
425    ///Bit 7 - Transmit data register empty
426    #[inline(always)]
427    pub fn txe(&self) -> TXE_R {
428        TXE_R::new(((self.bits >> 7) & 1) != 0)
429    }
430    ///Bit 9 - CTS flag
431    #[inline(always)]
432    pub fn cts(&self) -> CTS_R {
433        CTS_R::new(((self.bits >> 9) & 1) != 0)
434    }
435    ///Bit 10 - Automate baudrate detection flag
436    #[inline(always)]
437    pub fn abrf(&self) -> ABRF_R {
438        ABRF_R::new(((self.bits >> 10) & 1) != 0)
439    }
440    ///Bit 11 - Automate baudrate detection error flag
441    #[inline(always)]
442    pub fn abre(&self) -> ABRE_R {
443        ABRE_R::new(((self.bits >> 11) & 1) != 0)
444    }
445}
446impl W {
447    ///Bit 5 - Read data register not empty
448    #[inline(always)]
449    #[must_use]
450    pub fn rxne(&mut self) -> RXNE_W<5> {
451        RXNE_W::new(self)
452    }
453    ///Bit 6 - Transmission complete
454    #[inline(always)]
455    #[must_use]
456    pub fn tc(&mut self) -> TC_W<6> {
457        TC_W::new(self)
458    }
459    ///Bit 9 - CTS flag
460    #[inline(always)]
461    #[must_use]
462    pub fn cts(&mut self) -> CTS_W<9> {
463        CTS_W::new(self)
464    }
465    ///Bit 12 - Automate baudrate detection requeset
466    #[inline(always)]
467    #[must_use]
468    pub fn abrrq(&mut self) -> ABRRQ_W<12> {
469        ABRRQ_W::new(self)
470    }
471    ///Writes raw bits to the register.
472    #[inline(always)]
473    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
474        self.0.bits(bits);
475        self
476    }
477}
478/**Status register
479
480This 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).
481
482For information about available fields see [sr](index.html) module*/
483pub struct SR_SPEC;
484impl crate::RegisterSpec for SR_SPEC {
485    type Ux = u32;
486}
487///`read()` method returns [sr::R](R) reader structure
488impl crate::Readable for SR_SPEC {
489    type Reader = R;
490}
491///`write(|w| ..)` method takes [sr::W](W) writer structure
492impl crate::Writable for SR_SPEC {
493    type Writer = W;
494    const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
495    const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
496}
497///`reset()` method sets SR to value 0xc0
498impl crate::Resettable for SR_SPEC {
499    const RESET_VALUE: Self::Ux = 0xc0;
500}