avr_device/devices/atmega2560/usart1/
ucsr1b.rs

1#[doc = "Register `UCSR1B` reader"]
2pub struct R(crate::R<UCSR1B_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<UCSR1B_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<UCSR1B_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<UCSR1B_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `UCSR1B` writer"]
17pub struct W(crate::W<UCSR1B_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<UCSR1B_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<UCSR1B_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<UCSR1B_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "Field `TXB81` reader - Transmit Data Bit 8"]
38pub type TXB81_R = crate::BitReader<bool>;
39#[doc = "Field `TXB81` writer - Transmit Data Bit 8"]
40pub type TXB81_W<'a, const O: u8> = crate::BitWriter<'a, u8, UCSR1B_SPEC, bool, O>;
41#[doc = "Field `RXB81` reader - Receive Data Bit 8"]
42pub type RXB81_R = crate::BitReader<bool>;
43#[doc = "Field `UCSZ12` reader - Character Size"]
44pub type UCSZ12_R = crate::BitReader<bool>;
45#[doc = "Field `UCSZ12` writer - Character Size"]
46pub type UCSZ12_W<'a, const O: u8> = crate::BitWriter<'a, u8, UCSR1B_SPEC, bool, O>;
47#[doc = "Field `TXEN1` reader - Transmitter Enable"]
48pub type TXEN1_R = crate::BitReader<bool>;
49#[doc = "Field `TXEN1` writer - Transmitter Enable"]
50pub type TXEN1_W<'a, const O: u8> = crate::BitWriter<'a, u8, UCSR1B_SPEC, bool, O>;
51#[doc = "Field `RXEN1` reader - Receiver Enable"]
52pub type RXEN1_R = crate::BitReader<bool>;
53#[doc = "Field `RXEN1` writer - Receiver Enable"]
54pub type RXEN1_W<'a, const O: u8> = crate::BitWriter<'a, u8, UCSR1B_SPEC, bool, O>;
55#[doc = "Field `UDRIE1` reader - USART Data register Empty Interrupt Enable"]
56pub type UDRIE1_R = crate::BitReader<bool>;
57#[doc = "Field `UDRIE1` writer - USART Data register Empty Interrupt Enable"]
58pub type UDRIE1_W<'a, const O: u8> = crate::BitWriter<'a, u8, UCSR1B_SPEC, bool, O>;
59#[doc = "Field `TXCIE1` reader - TX Complete Interrupt Enable"]
60pub type TXCIE1_R = crate::BitReader<bool>;
61#[doc = "Field `TXCIE1` writer - TX Complete Interrupt Enable"]
62pub type TXCIE1_W<'a, const O: u8> = crate::BitWriter<'a, u8, UCSR1B_SPEC, bool, O>;
63#[doc = "Field `RXCIE1` reader - RX Complete Interrupt Enable"]
64pub type RXCIE1_R = crate::BitReader<bool>;
65#[doc = "Field `RXCIE1` writer - RX Complete Interrupt Enable"]
66pub type RXCIE1_W<'a, const O: u8> = crate::BitWriter<'a, u8, UCSR1B_SPEC, bool, O>;
67impl R {
68    #[doc = "Bit 0 - Transmit Data Bit 8"]
69    #[inline(always)]
70    pub fn txb81(&self) -> TXB81_R {
71        TXB81_R::new((self.bits & 1) != 0)
72    }
73    #[doc = "Bit 1 - Receive Data Bit 8"]
74    #[inline(always)]
75    pub fn rxb81(&self) -> RXB81_R {
76        RXB81_R::new(((self.bits >> 1) & 1) != 0)
77    }
78    #[doc = "Bit 2 - Character Size"]
79    #[inline(always)]
80    pub fn ucsz12(&self) -> UCSZ12_R {
81        UCSZ12_R::new(((self.bits >> 2) & 1) != 0)
82    }
83    #[doc = "Bit 3 - Transmitter Enable"]
84    #[inline(always)]
85    pub fn txen1(&self) -> TXEN1_R {
86        TXEN1_R::new(((self.bits >> 3) & 1) != 0)
87    }
88    #[doc = "Bit 4 - Receiver Enable"]
89    #[inline(always)]
90    pub fn rxen1(&self) -> RXEN1_R {
91        RXEN1_R::new(((self.bits >> 4) & 1) != 0)
92    }
93    #[doc = "Bit 5 - USART Data register Empty Interrupt Enable"]
94    #[inline(always)]
95    pub fn udrie1(&self) -> UDRIE1_R {
96        UDRIE1_R::new(((self.bits >> 5) & 1) != 0)
97    }
98    #[doc = "Bit 6 - TX Complete Interrupt Enable"]
99    #[inline(always)]
100    pub fn txcie1(&self) -> TXCIE1_R {
101        TXCIE1_R::new(((self.bits >> 6) & 1) != 0)
102    }
103    #[doc = "Bit 7 - RX Complete Interrupt Enable"]
104    #[inline(always)]
105    pub fn rxcie1(&self) -> RXCIE1_R {
106        RXCIE1_R::new(((self.bits >> 7) & 1) != 0)
107    }
108}
109impl W {
110    #[doc = "Bit 0 - Transmit Data Bit 8"]
111    #[inline(always)]
112    #[must_use]
113    pub fn txb81(&mut self) -> TXB81_W<0> {
114        TXB81_W::new(self)
115    }
116    #[doc = "Bit 2 - Character Size"]
117    #[inline(always)]
118    #[must_use]
119    pub fn ucsz12(&mut self) -> UCSZ12_W<2> {
120        UCSZ12_W::new(self)
121    }
122    #[doc = "Bit 3 - Transmitter Enable"]
123    #[inline(always)]
124    #[must_use]
125    pub fn txen1(&mut self) -> TXEN1_W<3> {
126        TXEN1_W::new(self)
127    }
128    #[doc = "Bit 4 - Receiver Enable"]
129    #[inline(always)]
130    #[must_use]
131    pub fn rxen1(&mut self) -> RXEN1_W<4> {
132        RXEN1_W::new(self)
133    }
134    #[doc = "Bit 5 - USART Data register Empty Interrupt Enable"]
135    #[inline(always)]
136    #[must_use]
137    pub fn udrie1(&mut self) -> UDRIE1_W<5> {
138        UDRIE1_W::new(self)
139    }
140    #[doc = "Bit 6 - TX Complete Interrupt Enable"]
141    #[inline(always)]
142    #[must_use]
143    pub fn txcie1(&mut self) -> TXCIE1_W<6> {
144        TXCIE1_W::new(self)
145    }
146    #[doc = "Bit 7 - RX Complete Interrupt Enable"]
147    #[inline(always)]
148    #[must_use]
149    pub fn rxcie1(&mut self) -> RXCIE1_W<7> {
150        RXCIE1_W::new(self)
151    }
152    #[doc = "Writes raw bits to the register."]
153    #[inline(always)]
154    pub unsafe fn bits(&mut self, bits: u8) -> &mut Self {
155        self.0.bits(bits);
156        self
157    }
158}
159#[doc = "USART Control and Status Register B\n\nThis 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).\n\nFor information about available fields see [ucsr1b](index.html) module"]
160pub struct UCSR1B_SPEC;
161impl crate::RegisterSpec for UCSR1B_SPEC {
162    type Ux = u8;
163}
164#[doc = "`read()` method returns [ucsr1b::R](R) reader structure"]
165impl crate::Readable for UCSR1B_SPEC {
166    type Reader = R;
167}
168#[doc = "`write(|w| ..)` method takes [ucsr1b::W](W) writer structure"]
169impl crate::Writable for UCSR1B_SPEC {
170    type Writer = W;
171    const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
172    const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
173}
174#[doc = "`reset()` method sets UCSR1B to value 0"]
175impl crate::Resettable for UCSR1B_SPEC {
176    const RESET_VALUE: Self::Ux = 0;
177}