ra2a1/sci0/
sptr.rs

1#[doc = "Register `SPTR` reader"]
2pub struct R(crate::R<SPTR_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<SPTR_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<SPTR_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<SPTR_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `SPTR` writer"]
17pub struct W(crate::W<SPTR_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<SPTR_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<SPTR_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<SPTR_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "Field `RXDMON` reader - Serial input data monitor bit(The state of the RXD terminal is shown.)"]
38pub type RXDMON_R = crate::BitReader<RXDMON_A>;
39#[doc = "Serial input data monitor bit(The state of the RXD terminal is shown.)\n\nValue on reset: 1"]
40#[derive(Clone, Copy, Debug, PartialEq, Eq)]
41pub enum RXDMON_A {
42    #[doc = "0: RXD terminal is the Low level."]
43    _0 = 0,
44    #[doc = "1: RXD terminal is the High level."]
45    _1 = 1,
46}
47impl From<RXDMON_A> for bool {
48    #[inline(always)]
49    fn from(variant: RXDMON_A) -> Self {
50        variant as u8 != 0
51    }
52}
53impl RXDMON_R {
54    #[doc = "Get enumerated values variant"]
55    #[inline(always)]
56    pub fn variant(&self) -> RXDMON_A {
57        match self.bits {
58            false => RXDMON_A::_0,
59            true => RXDMON_A::_1,
60        }
61    }
62    #[doc = "Checks if the value of the field is `_0`"]
63    #[inline(always)]
64    pub fn is_0(&self) -> bool {
65        *self == RXDMON_A::_0
66    }
67    #[doc = "Checks if the value of the field is `_1`"]
68    #[inline(always)]
69    pub fn is_1(&self) -> bool {
70        *self == RXDMON_A::_1
71    }
72}
73#[doc = "Field `SPB2DT` reader - Serial port break data select bit(The output level of TxD terminal is selected when SCR.TE = 0.)"]
74pub type SPB2DT_R = crate::BitReader<SPB2DT_A>;
75#[doc = "Serial port break data select bit(The output level of TxD terminal is selected when SCR.TE = 0.)\n\nValue on reset: 1"]
76#[derive(Clone, Copy, Debug, PartialEq, Eq)]
77pub enum SPB2DT_A {
78    #[doc = "0: Low level is output in TxD terminal."]
79    _0 = 0,
80    #[doc = "1: High level is output in TxD terminal."]
81    _1 = 1,
82}
83impl From<SPB2DT_A> for bool {
84    #[inline(always)]
85    fn from(variant: SPB2DT_A) -> Self {
86        variant as u8 != 0
87    }
88}
89impl SPB2DT_R {
90    #[doc = "Get enumerated values variant"]
91    #[inline(always)]
92    pub fn variant(&self) -> SPB2DT_A {
93        match self.bits {
94            false => SPB2DT_A::_0,
95            true => SPB2DT_A::_1,
96        }
97    }
98    #[doc = "Checks if the value of the field is `_0`"]
99    #[inline(always)]
100    pub fn is_0(&self) -> bool {
101        *self == SPB2DT_A::_0
102    }
103    #[doc = "Checks if the value of the field is `_1`"]
104    #[inline(always)]
105    pub fn is_1(&self) -> bool {
106        *self == SPB2DT_A::_1
107    }
108}
109#[doc = "Field `SPB2DT` writer - Serial port break data select bit(The output level of TxD terminal is selected when SCR.TE = 0.)"]
110pub type SPB2DT_W<'a, const O: u8> = crate::BitWriter<'a, u8, SPTR_SPEC, SPB2DT_A, O>;
111impl<'a, const O: u8> SPB2DT_W<'a, O> {
112    #[doc = "Low level is output in TxD terminal."]
113    #[inline(always)]
114    pub fn _0(self) -> &'a mut W {
115        self.variant(SPB2DT_A::_0)
116    }
117    #[doc = "High level is output in TxD terminal."]
118    #[inline(always)]
119    pub fn _1(self) -> &'a mut W {
120        self.variant(SPB2DT_A::_1)
121    }
122}
123#[doc = "Field `SPB2IO` reader - Serial port break I/O bit(It's selected whether the value of SPB2DT is output to TxD terminal.)"]
124pub type SPB2IO_R = crate::BitReader<SPB2IO_A>;
125#[doc = "Serial port break I/O bit(It's selected whether the value of SPB2DT is output to TxD terminal.)\n\nValue on reset: 0"]
126#[derive(Clone, Copy, Debug, PartialEq, Eq)]
127pub enum SPB2IO_A {
128    #[doc = "0: The value of SPB2DT bit isn't output in TxD terminal."]
129    _0 = 0,
130    #[doc = "1: The value of SPB2DT bit is output in TxD terminal."]
131    _1 = 1,
132}
133impl From<SPB2IO_A> for bool {
134    #[inline(always)]
135    fn from(variant: SPB2IO_A) -> Self {
136        variant as u8 != 0
137    }
138}
139impl SPB2IO_R {
140    #[doc = "Get enumerated values variant"]
141    #[inline(always)]
142    pub fn variant(&self) -> SPB2IO_A {
143        match self.bits {
144            false => SPB2IO_A::_0,
145            true => SPB2IO_A::_1,
146        }
147    }
148    #[doc = "Checks if the value of the field is `_0`"]
149    #[inline(always)]
150    pub fn is_0(&self) -> bool {
151        *self == SPB2IO_A::_0
152    }
153    #[doc = "Checks if the value of the field is `_1`"]
154    #[inline(always)]
155    pub fn is_1(&self) -> bool {
156        *self == SPB2IO_A::_1
157    }
158}
159#[doc = "Field `SPB2IO` writer - Serial port break I/O bit(It's selected whether the value of SPB2DT is output to TxD terminal.)"]
160pub type SPB2IO_W<'a, const O: u8> = crate::BitWriter<'a, u8, SPTR_SPEC, SPB2IO_A, O>;
161impl<'a, const O: u8> SPB2IO_W<'a, O> {
162    #[doc = "The value of SPB2DT bit isn't output in TxD terminal."]
163    #[inline(always)]
164    pub fn _0(self) -> &'a mut W {
165        self.variant(SPB2IO_A::_0)
166    }
167    #[doc = "The value of SPB2DT bit is output in TxD terminal."]
168    #[inline(always)]
169    pub fn _1(self) -> &'a mut W {
170        self.variant(SPB2IO_A::_1)
171    }
172}
173impl R {
174    #[doc = "Bit 0 - Serial input data monitor bit(The state of the RXD terminal is shown.)"]
175    #[inline(always)]
176    pub fn rxdmon(&self) -> RXDMON_R {
177        RXDMON_R::new((self.bits & 1) != 0)
178    }
179    #[doc = "Bit 1 - Serial port break data select bit(The output level of TxD terminal is selected when SCR.TE = 0.)"]
180    #[inline(always)]
181    pub fn spb2dt(&self) -> SPB2DT_R {
182        SPB2DT_R::new(((self.bits >> 1) & 1) != 0)
183    }
184    #[doc = "Bit 2 - Serial port break I/O bit(It's selected whether the value of SPB2DT is output to TxD terminal.)"]
185    #[inline(always)]
186    pub fn spb2io(&self) -> SPB2IO_R {
187        SPB2IO_R::new(((self.bits >> 2) & 1) != 0)
188    }
189}
190impl W {
191    #[doc = "Bit 1 - Serial port break data select bit(The output level of TxD terminal is selected when SCR.TE = 0.)"]
192    #[inline(always)]
193    #[must_use]
194    pub fn spb2dt(&mut self) -> SPB2DT_W<1> {
195        SPB2DT_W::new(self)
196    }
197    #[doc = "Bit 2 - Serial port break I/O bit(It's selected whether the value of SPB2DT is output to TxD terminal.)"]
198    #[inline(always)]
199    #[must_use]
200    pub fn spb2io(&mut self) -> SPB2IO_W<2> {
201        SPB2IO_W::new(self)
202    }
203    #[doc = "Writes raw bits to the register."]
204    #[inline(always)]
205    pub unsafe fn bits(&mut self, bits: u8) -> &mut Self {
206        self.0.bits(bits);
207        self
208    }
209}
210#[doc = "Serial Port Register\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 [sptr](index.html) module"]
211pub struct SPTR_SPEC;
212impl crate::RegisterSpec for SPTR_SPEC {
213    type Ux = u8;
214}
215#[doc = "`read()` method returns [sptr::R](R) reader structure"]
216impl crate::Readable for SPTR_SPEC {
217    type Reader = R;
218}
219#[doc = "`write(|w| ..)` method takes [sptr::W](W) writer structure"]
220impl crate::Writable for SPTR_SPEC {
221    type Writer = W;
222    const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
223    const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
224}
225#[doc = "`reset()` method sets SPTR to value 0x03"]
226impl crate::Resettable for SPTR_SPEC {
227    const RESET_VALUE: Self::Ux = 0x03;
228}