avr_device/devices/atmega2560/usart3/
ucsr3a.rs

1#[doc = "Register `UCSR3A` reader"]
2pub struct R(crate::R<UCSR3A_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<UCSR3A_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<UCSR3A_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<UCSR3A_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `UCSR3A` writer"]
17pub struct W(crate::W<UCSR3A_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<UCSR3A_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<UCSR3A_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<UCSR3A_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "Field `MPCM3` reader - Multi-processor Communication Mode"]
38pub type MPCM3_R = crate::BitReader<bool>;
39#[doc = "Field `MPCM3` writer - Multi-processor Communication Mode"]
40pub type MPCM3_W<'a, const O: u8> = crate::BitWriter<'a, u8, UCSR3A_SPEC, bool, O>;
41#[doc = "Field `U2X3` reader - Double the USART transmission speed"]
42pub type U2X3_R = crate::BitReader<bool>;
43#[doc = "Field `U2X3` writer - Double the USART transmission speed"]
44pub type U2X3_W<'a, const O: u8> = crate::BitWriter<'a, u8, UCSR3A_SPEC, bool, O>;
45#[doc = "Field `UPE3` reader - Parity Error"]
46pub type UPE3_R = crate::BitReader<bool>;
47#[doc = "Field `DOR3` reader - Data overRun"]
48pub type DOR3_R = crate::BitReader<bool>;
49#[doc = "Field `FE3` reader - Framing Error"]
50pub type FE3_R = crate::BitReader<bool>;
51#[doc = "Field `UDRE3` reader - USART Data Register Empty"]
52pub type UDRE3_R = crate::BitReader<bool>;
53#[doc = "Field `TXC3` reader - USART Transmit Complete"]
54pub type TXC3_R = crate::BitReader<bool>;
55#[doc = "Field `TXC3` writer - USART Transmit Complete"]
56pub type TXC3_W<'a, const O: u8> = crate::BitWriter<'a, u8, UCSR3A_SPEC, bool, O>;
57#[doc = "Field `RXC3` reader - USART Receive Complete"]
58pub type RXC3_R = crate::BitReader<bool>;
59impl R {
60    #[doc = "Bit 0 - Multi-processor Communication Mode"]
61    #[inline(always)]
62    pub fn mpcm3(&self) -> MPCM3_R {
63        MPCM3_R::new((self.bits & 1) != 0)
64    }
65    #[doc = "Bit 1 - Double the USART transmission speed"]
66    #[inline(always)]
67    pub fn u2x3(&self) -> U2X3_R {
68        U2X3_R::new(((self.bits >> 1) & 1) != 0)
69    }
70    #[doc = "Bit 2 - Parity Error"]
71    #[inline(always)]
72    pub fn upe3(&self) -> UPE3_R {
73        UPE3_R::new(((self.bits >> 2) & 1) != 0)
74    }
75    #[doc = "Bit 3 - Data overRun"]
76    #[inline(always)]
77    pub fn dor3(&self) -> DOR3_R {
78        DOR3_R::new(((self.bits >> 3) & 1) != 0)
79    }
80    #[doc = "Bit 4 - Framing Error"]
81    #[inline(always)]
82    pub fn fe3(&self) -> FE3_R {
83        FE3_R::new(((self.bits >> 4) & 1) != 0)
84    }
85    #[doc = "Bit 5 - USART Data Register Empty"]
86    #[inline(always)]
87    pub fn udre3(&self) -> UDRE3_R {
88        UDRE3_R::new(((self.bits >> 5) & 1) != 0)
89    }
90    #[doc = "Bit 6 - USART Transmit Complete"]
91    #[inline(always)]
92    pub fn txc3(&self) -> TXC3_R {
93        TXC3_R::new(((self.bits >> 6) & 1) != 0)
94    }
95    #[doc = "Bit 7 - USART Receive Complete"]
96    #[inline(always)]
97    pub fn rxc3(&self) -> RXC3_R {
98        RXC3_R::new(((self.bits >> 7) & 1) != 0)
99    }
100}
101impl W {
102    #[doc = "Bit 0 - Multi-processor Communication Mode"]
103    #[inline(always)]
104    #[must_use]
105    pub fn mpcm3(&mut self) -> MPCM3_W<0> {
106        MPCM3_W::new(self)
107    }
108    #[doc = "Bit 1 - Double the USART transmission speed"]
109    #[inline(always)]
110    #[must_use]
111    pub fn u2x3(&mut self) -> U2X3_W<1> {
112        U2X3_W::new(self)
113    }
114    #[doc = "Bit 6 - USART Transmit Complete"]
115    #[inline(always)]
116    #[must_use]
117    pub fn txc3(&mut self) -> TXC3_W<6> {
118        TXC3_W::new(self)
119    }
120    #[doc = "Writes raw bits to the register."]
121    #[inline(always)]
122    pub unsafe fn bits(&mut self, bits: u8) -> &mut Self {
123        self.0.bits(bits);
124        self
125    }
126}
127#[doc = "USART Control and Status Register A\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 [ucsr3a](index.html) module"]
128pub struct UCSR3A_SPEC;
129impl crate::RegisterSpec for UCSR3A_SPEC {
130    type Ux = u8;
131}
132#[doc = "`read()` method returns [ucsr3a::R](R) reader structure"]
133impl crate::Readable for UCSR3A_SPEC {
134    type Reader = R;
135}
136#[doc = "`write(|w| ..)` method takes [ucsr3a::W](W) writer structure"]
137impl crate::Writable for UCSR3A_SPEC {
138    type Writer = W;
139    const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
140    const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
141}
142#[doc = "`reset()` method sets UCSR3A to value 0"]
143impl crate::Resettable for UCSR3A_SPEC {
144    const RESET_VALUE: Self::Ux = 0;
145}