atsamd21g/sercom0/usart/
ctrlb.rs

1#[doc = "Register `CTRLB` reader"]
2pub type R = crate::R<CtrlbSpec>;
3#[doc = "Register `CTRLB` writer"]
4pub type W = crate::W<CtrlbSpec>;
5#[doc = "Field `CHSIZE` reader - Character Size"]
6pub type ChsizeR = crate::FieldReader;
7#[doc = "Field `CHSIZE` writer - Character Size"]
8pub type ChsizeW<'a, REG> = crate::FieldWriter<'a, REG, 3>;
9#[doc = "Field `SBMODE` reader - Stop Bit Mode"]
10pub type SbmodeR = crate::BitReader;
11#[doc = "Field `SBMODE` writer - Stop Bit Mode"]
12pub type SbmodeW<'a, REG> = crate::BitWriter<'a, REG>;
13#[doc = "Field `COLDEN` reader - Collision Detection Enable"]
14pub type ColdenR = crate::BitReader;
15#[doc = "Field `COLDEN` writer - Collision Detection Enable"]
16pub type ColdenW<'a, REG> = crate::BitWriter<'a, REG>;
17#[doc = "Field `SFDE` reader - Start of Frame Detection Enable"]
18pub type SfdeR = crate::BitReader;
19#[doc = "Field `SFDE` writer - Start of Frame Detection Enable"]
20pub type SfdeW<'a, REG> = crate::BitWriter<'a, REG>;
21#[doc = "Field `ENC` reader - Encoding Format"]
22pub type EncR = crate::BitReader;
23#[doc = "Field `ENC` writer - Encoding Format"]
24pub type EncW<'a, REG> = crate::BitWriter<'a, REG>;
25#[doc = "Field `PMODE` reader - Parity Mode"]
26pub type PmodeR = crate::BitReader;
27#[doc = "Field `PMODE` writer - Parity Mode"]
28pub type PmodeW<'a, REG> = crate::BitWriter<'a, REG>;
29#[doc = "Field `TXEN` reader - Transmitter Enable"]
30pub type TxenR = crate::BitReader;
31#[doc = "Field `TXEN` writer - Transmitter Enable"]
32pub type TxenW<'a, REG> = crate::BitWriter<'a, REG>;
33#[doc = "Field `RXEN` reader - Receiver Enable"]
34pub type RxenR = crate::BitReader;
35#[doc = "Field `RXEN` writer - Receiver Enable"]
36pub type RxenW<'a, REG> = crate::BitWriter<'a, REG>;
37impl R {
38    #[doc = "Bits 0:2 - Character Size"]
39    #[inline(always)]
40    pub fn chsize(&self) -> ChsizeR {
41        ChsizeR::new((self.bits & 7) as u8)
42    }
43    #[doc = "Bit 6 - Stop Bit Mode"]
44    #[inline(always)]
45    pub fn sbmode(&self) -> SbmodeR {
46        SbmodeR::new(((self.bits >> 6) & 1) != 0)
47    }
48    #[doc = "Bit 8 - Collision Detection Enable"]
49    #[inline(always)]
50    pub fn colden(&self) -> ColdenR {
51        ColdenR::new(((self.bits >> 8) & 1) != 0)
52    }
53    #[doc = "Bit 9 - Start of Frame Detection Enable"]
54    #[inline(always)]
55    pub fn sfde(&self) -> SfdeR {
56        SfdeR::new(((self.bits >> 9) & 1) != 0)
57    }
58    #[doc = "Bit 10 - Encoding Format"]
59    #[inline(always)]
60    pub fn enc(&self) -> EncR {
61        EncR::new(((self.bits >> 10) & 1) != 0)
62    }
63    #[doc = "Bit 13 - Parity Mode"]
64    #[inline(always)]
65    pub fn pmode(&self) -> PmodeR {
66        PmodeR::new(((self.bits >> 13) & 1) != 0)
67    }
68    #[doc = "Bit 16 - Transmitter Enable"]
69    #[inline(always)]
70    pub fn txen(&self) -> TxenR {
71        TxenR::new(((self.bits >> 16) & 1) != 0)
72    }
73    #[doc = "Bit 17 - Receiver Enable"]
74    #[inline(always)]
75    pub fn rxen(&self) -> RxenR {
76        RxenR::new(((self.bits >> 17) & 1) != 0)
77    }
78}
79impl W {
80    #[doc = "Bits 0:2 - Character Size"]
81    #[inline(always)]
82    #[must_use]
83    pub fn chsize(&mut self) -> ChsizeW<CtrlbSpec> {
84        ChsizeW::new(self, 0)
85    }
86    #[doc = "Bit 6 - Stop Bit Mode"]
87    #[inline(always)]
88    #[must_use]
89    pub fn sbmode(&mut self) -> SbmodeW<CtrlbSpec> {
90        SbmodeW::new(self, 6)
91    }
92    #[doc = "Bit 8 - Collision Detection Enable"]
93    #[inline(always)]
94    #[must_use]
95    pub fn colden(&mut self) -> ColdenW<CtrlbSpec> {
96        ColdenW::new(self, 8)
97    }
98    #[doc = "Bit 9 - Start of Frame Detection Enable"]
99    #[inline(always)]
100    #[must_use]
101    pub fn sfde(&mut self) -> SfdeW<CtrlbSpec> {
102        SfdeW::new(self, 9)
103    }
104    #[doc = "Bit 10 - Encoding Format"]
105    #[inline(always)]
106    #[must_use]
107    pub fn enc(&mut self) -> EncW<CtrlbSpec> {
108        EncW::new(self, 10)
109    }
110    #[doc = "Bit 13 - Parity Mode"]
111    #[inline(always)]
112    #[must_use]
113    pub fn pmode(&mut self) -> PmodeW<CtrlbSpec> {
114        PmodeW::new(self, 13)
115    }
116    #[doc = "Bit 16 - Transmitter Enable"]
117    #[inline(always)]
118    #[must_use]
119    pub fn txen(&mut self) -> TxenW<CtrlbSpec> {
120        TxenW::new(self, 16)
121    }
122    #[doc = "Bit 17 - Receiver Enable"]
123    #[inline(always)]
124    #[must_use]
125    pub fn rxen(&mut self) -> RxenW<CtrlbSpec> {
126        RxenW::new(self, 17)
127    }
128}
129#[doc = "USART Control B\n\nYou can [`read`](crate::Reg::read) this register and get [`ctrlb::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`ctrlb::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
130pub struct CtrlbSpec;
131impl crate::RegisterSpec for CtrlbSpec {
132    type Ux = u32;
133}
134#[doc = "`read()` method returns [`ctrlb::R`](R) reader structure"]
135impl crate::Readable for CtrlbSpec {}
136#[doc = "`write(|w| ..)` method takes [`ctrlb::W`](W) writer structure"]
137impl crate::Writable for CtrlbSpec {
138    type Safety = crate::Unsafe;
139    const ZERO_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
140    const ONE_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
141}
142#[doc = "`reset()` method sets CTRLB to value 0"]
143impl crate::Resettable for CtrlbSpec {
144    const RESET_VALUE: u32 = 0;
145}