ra6e1/sci1/
tmpr.rs

1#[doc = "Register `TMPR` reader"]
2pub struct R(crate::R<TMPR_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<TMPR_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<TMPR_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<TMPR_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `TMPR` writer"]
17pub struct W(crate::W<TMPR_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<TMPR_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<TMPR_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<TMPR_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "Field `TPLEN` reader - Transmit preface length"]
38pub type TPLEN_R = crate::FieldReader<u8, TPLEN_A>;
39#[doc = "Transmit preface length\n\nValue on reset: 0"]
40#[derive(Clone, Copy, Debug, PartialEq, Eq)]
41#[repr(u8)]
42pub enum TPLEN_A {
43    #[doc = "0: Disables the transmit preface generation"]
44    _0X0 = 0,
45}
46impl From<TPLEN_A> for u8 {
47    #[inline(always)]
48    fn from(variant: TPLEN_A) -> Self {
49        variant as _
50    }
51}
52impl TPLEN_R {
53    #[doc = "Get enumerated values variant"]
54    #[inline(always)]
55    pub fn variant(&self) -> Option<TPLEN_A> {
56        match self.bits {
57            0 => Some(TPLEN_A::_0X0),
58            _ => None,
59        }
60    }
61    #[doc = "Checks if the value of the field is `_0X0`"]
62    #[inline(always)]
63    pub fn is_0x0(&self) -> bool {
64        *self == TPLEN_A::_0X0
65    }
66}
67#[doc = "Field `TPLEN` writer - Transmit preface length"]
68pub type TPLEN_W<'a, const O: u8> = crate::FieldWriter<'a, u8, TMPR_SPEC, u8, TPLEN_A, 4, O>;
69impl<'a, const O: u8> TPLEN_W<'a, O> {
70    #[doc = "Disables the transmit preface generation"]
71    #[inline(always)]
72    pub fn _0x0(self) -> &'a mut W {
73        self.variant(TPLEN_A::_0X0)
74    }
75}
76#[doc = "Field `TPPAT` reader - Transmit preface pattern"]
77pub type TPPAT_R = crate::FieldReader<u8, TPPAT_A>;
78#[doc = "Transmit preface pattern\n\nValue on reset: 0"]
79#[derive(Clone, Copy, Debug, PartialEq, Eq)]
80#[repr(u8)]
81pub enum TPPAT_A {
82    #[doc = "0: ALL ZERO"]
83    _00 = 0,
84    #[doc = "1: ZERO ONE"]
85    _01 = 1,
86    #[doc = "2: ONE ZERO"]
87    _10 = 2,
88    #[doc = "3: ALL ONE"]
89    _11 = 3,
90}
91impl From<TPPAT_A> for u8 {
92    #[inline(always)]
93    fn from(variant: TPPAT_A) -> Self {
94        variant as _
95    }
96}
97impl TPPAT_R {
98    #[doc = "Get enumerated values variant"]
99    #[inline(always)]
100    pub fn variant(&self) -> TPPAT_A {
101        match self.bits {
102            0 => TPPAT_A::_00,
103            1 => TPPAT_A::_01,
104            2 => TPPAT_A::_10,
105            3 => TPPAT_A::_11,
106            _ => unreachable!(),
107        }
108    }
109    #[doc = "Checks if the value of the field is `_00`"]
110    #[inline(always)]
111    pub fn is_00(&self) -> bool {
112        *self == TPPAT_A::_00
113    }
114    #[doc = "Checks if the value of the field is `_01`"]
115    #[inline(always)]
116    pub fn is_01(&self) -> bool {
117        *self == TPPAT_A::_01
118    }
119    #[doc = "Checks if the value of the field is `_10`"]
120    #[inline(always)]
121    pub fn is_10(&self) -> bool {
122        *self == TPPAT_A::_10
123    }
124    #[doc = "Checks if the value of the field is `_11`"]
125    #[inline(always)]
126    pub fn is_11(&self) -> bool {
127        *self == TPPAT_A::_11
128    }
129}
130#[doc = "Field `TPPAT` writer - Transmit preface pattern"]
131pub type TPPAT_W<'a, const O: u8> = crate::FieldWriterSafe<'a, u8, TMPR_SPEC, u8, TPPAT_A, 2, O>;
132impl<'a, const O: u8> TPPAT_W<'a, O> {
133    #[doc = "ALL ZERO"]
134    #[inline(always)]
135    pub fn _00(self) -> &'a mut W {
136        self.variant(TPPAT_A::_00)
137    }
138    #[doc = "ZERO ONE"]
139    #[inline(always)]
140    pub fn _01(self) -> &'a mut W {
141        self.variant(TPPAT_A::_01)
142    }
143    #[doc = "ONE ZERO"]
144    #[inline(always)]
145    pub fn _10(self) -> &'a mut W {
146        self.variant(TPPAT_A::_10)
147    }
148    #[doc = "ALL ONE"]
149    #[inline(always)]
150    pub fn _11(self) -> &'a mut W {
151        self.variant(TPPAT_A::_11)
152    }
153}
154impl R {
155    #[doc = "Bits 0:3 - Transmit preface length"]
156    #[inline(always)]
157    pub fn tplen(&self) -> TPLEN_R {
158        TPLEN_R::new(self.bits & 0x0f)
159    }
160    #[doc = "Bits 4:5 - Transmit preface pattern"]
161    #[inline(always)]
162    pub fn tppat(&self) -> TPPAT_R {
163        TPPAT_R::new((self.bits >> 4) & 3)
164    }
165}
166impl W {
167    #[doc = "Bits 0:3 - Transmit preface length"]
168    #[inline(always)]
169    #[must_use]
170    pub fn tplen(&mut self) -> TPLEN_W<0> {
171        TPLEN_W::new(self)
172    }
173    #[doc = "Bits 4:5 - Transmit preface pattern"]
174    #[inline(always)]
175    #[must_use]
176    pub fn tppat(&mut self) -> TPPAT_W<4> {
177        TPPAT_W::new(self)
178    }
179    #[doc = "Writes raw bits to the register."]
180    #[inline(always)]
181    pub unsafe fn bits(&mut self, bits: u8) -> &mut Self {
182        self.0.bits(bits);
183        self
184    }
185}
186#[doc = "Transmit Manchester Preface Setting 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 [tmpr](index.html) module"]
187pub struct TMPR_SPEC;
188impl crate::RegisterSpec for TMPR_SPEC {
189    type Ux = u8;
190}
191#[doc = "`read()` method returns [tmpr::R](R) reader structure"]
192impl crate::Readable for TMPR_SPEC {
193    type Reader = R;
194}
195#[doc = "`write(|w| ..)` method takes [tmpr::W](W) writer structure"]
196impl crate::Writable for TMPR_SPEC {
197    type Writer = W;
198    const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
199    const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
200}
201#[doc = "`reset()` method sets TMPR to value 0"]
202impl crate::Resettable for TMPR_SPEC {
203    const RESET_VALUE: Self::Ux = 0;
204}