ra6m2/usbhs/
pipesel.rs

1#[doc = "Register `PIPESEL` reader"]
2pub struct R(crate::R<PIPESEL_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<PIPESEL_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<PIPESEL_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<PIPESEL_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `PIPESEL` writer"]
17pub struct W(crate::W<PIPESEL_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<PIPESEL_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<PIPESEL_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<PIPESEL_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "Field `PIPESEL` reader - Pipe Window SelectThese bits specify the pipe for registers at addresses 68H to 6EH."]
38pub type PIPESEL_R = crate::FieldReader<u8, PIPESEL_A>;
39#[doc = "Pipe Window SelectThese bits specify the pipe for registers at addresses 68H to 6EH.\n\nValue on reset: 0"]
40#[derive(Clone, Copy, Debug, PartialEq, Eq)]
41#[repr(u8)]
42pub enum PIPESEL_A {
43    #[doc = "0: No pipe selected"]
44    _0000 = 0,
45    #[doc = "1: PIPE1"]
46    _0001 = 1,
47    #[doc = "2: PIPE2"]
48    _0010 = 2,
49    #[doc = "3: PIPE3"]
50    _0011 = 3,
51    #[doc = "4: PIPE4"]
52    _0100 = 4,
53    #[doc = "5: PIPE5"]
54    _0101 = 5,
55    #[doc = "6: PIPE6"]
56    _0110 = 6,
57    #[doc = "7: PIPE7"]
58    _0111 = 7,
59    #[doc = "8: PIPE8"]
60    _1000 = 8,
61    #[doc = "9: PIPE9"]
62    _1001 = 9,
63}
64impl From<PIPESEL_A> for u8 {
65    #[inline(always)]
66    fn from(variant: PIPESEL_A) -> Self {
67        variant as _
68    }
69}
70impl PIPESEL_R {
71    #[doc = "Get enumerated values variant"]
72    #[inline(always)]
73    pub fn variant(&self) -> Option<PIPESEL_A> {
74        match self.bits {
75            0 => Some(PIPESEL_A::_0000),
76            1 => Some(PIPESEL_A::_0001),
77            2 => Some(PIPESEL_A::_0010),
78            3 => Some(PIPESEL_A::_0011),
79            4 => Some(PIPESEL_A::_0100),
80            5 => Some(PIPESEL_A::_0101),
81            6 => Some(PIPESEL_A::_0110),
82            7 => Some(PIPESEL_A::_0111),
83            8 => Some(PIPESEL_A::_1000),
84            9 => Some(PIPESEL_A::_1001),
85            _ => None,
86        }
87    }
88    #[doc = "Checks if the value of the field is `_0000`"]
89    #[inline(always)]
90    pub fn is_0000(&self) -> bool {
91        *self == PIPESEL_A::_0000
92    }
93    #[doc = "Checks if the value of the field is `_0001`"]
94    #[inline(always)]
95    pub fn is_0001(&self) -> bool {
96        *self == PIPESEL_A::_0001
97    }
98    #[doc = "Checks if the value of the field is `_0010`"]
99    #[inline(always)]
100    pub fn is_0010(&self) -> bool {
101        *self == PIPESEL_A::_0010
102    }
103    #[doc = "Checks if the value of the field is `_0011`"]
104    #[inline(always)]
105    pub fn is_0011(&self) -> bool {
106        *self == PIPESEL_A::_0011
107    }
108    #[doc = "Checks if the value of the field is `_0100`"]
109    #[inline(always)]
110    pub fn is_0100(&self) -> bool {
111        *self == PIPESEL_A::_0100
112    }
113    #[doc = "Checks if the value of the field is `_0101`"]
114    #[inline(always)]
115    pub fn is_0101(&self) -> bool {
116        *self == PIPESEL_A::_0101
117    }
118    #[doc = "Checks if the value of the field is `_0110`"]
119    #[inline(always)]
120    pub fn is_0110(&self) -> bool {
121        *self == PIPESEL_A::_0110
122    }
123    #[doc = "Checks if the value of the field is `_0111`"]
124    #[inline(always)]
125    pub fn is_0111(&self) -> bool {
126        *self == PIPESEL_A::_0111
127    }
128    #[doc = "Checks if the value of the field is `_1000`"]
129    #[inline(always)]
130    pub fn is_1000(&self) -> bool {
131        *self == PIPESEL_A::_1000
132    }
133    #[doc = "Checks if the value of the field is `_1001`"]
134    #[inline(always)]
135    pub fn is_1001(&self) -> bool {
136        *self == PIPESEL_A::_1001
137    }
138}
139#[doc = "Field `PIPESEL` writer - Pipe Window SelectThese bits specify the pipe for registers at addresses 68H to 6EH."]
140pub type PIPESEL_W<'a, const O: u8> =
141    crate::FieldWriter<'a, u16, PIPESEL_SPEC, u8, PIPESEL_A, 4, O>;
142impl<'a, const O: u8> PIPESEL_W<'a, O> {
143    #[doc = "No pipe selected"]
144    #[inline(always)]
145    pub fn _0000(self) -> &'a mut W {
146        self.variant(PIPESEL_A::_0000)
147    }
148    #[doc = "PIPE1"]
149    #[inline(always)]
150    pub fn _0001(self) -> &'a mut W {
151        self.variant(PIPESEL_A::_0001)
152    }
153    #[doc = "PIPE2"]
154    #[inline(always)]
155    pub fn _0010(self) -> &'a mut W {
156        self.variant(PIPESEL_A::_0010)
157    }
158    #[doc = "PIPE3"]
159    #[inline(always)]
160    pub fn _0011(self) -> &'a mut W {
161        self.variant(PIPESEL_A::_0011)
162    }
163    #[doc = "PIPE4"]
164    #[inline(always)]
165    pub fn _0100(self) -> &'a mut W {
166        self.variant(PIPESEL_A::_0100)
167    }
168    #[doc = "PIPE5"]
169    #[inline(always)]
170    pub fn _0101(self) -> &'a mut W {
171        self.variant(PIPESEL_A::_0101)
172    }
173    #[doc = "PIPE6"]
174    #[inline(always)]
175    pub fn _0110(self) -> &'a mut W {
176        self.variant(PIPESEL_A::_0110)
177    }
178    #[doc = "PIPE7"]
179    #[inline(always)]
180    pub fn _0111(self) -> &'a mut W {
181        self.variant(PIPESEL_A::_0111)
182    }
183    #[doc = "PIPE8"]
184    #[inline(always)]
185    pub fn _1000(self) -> &'a mut W {
186        self.variant(PIPESEL_A::_1000)
187    }
188    #[doc = "PIPE9"]
189    #[inline(always)]
190    pub fn _1001(self) -> &'a mut W {
191        self.variant(PIPESEL_A::_1001)
192    }
193}
194impl R {
195    #[doc = "Bits 0:3 - Pipe Window SelectThese bits specify the pipe for registers at addresses 68H to 6EH."]
196    #[inline(always)]
197    pub fn pipesel(&self) -> PIPESEL_R {
198        PIPESEL_R::new((self.bits & 0x0f) as u8)
199    }
200}
201impl W {
202    #[doc = "Bits 0:3 - Pipe Window SelectThese bits specify the pipe for registers at addresses 68H to 6EH."]
203    #[inline(always)]
204    #[must_use]
205    pub fn pipesel(&mut self) -> PIPESEL_W<0> {
206        PIPESEL_W::new(self)
207    }
208    #[doc = "Writes raw bits to the register."]
209    #[inline(always)]
210    pub unsafe fn bits(&mut self, bits: u16) -> &mut Self {
211        self.0.bits(bits);
212        self
213    }
214}
215#[doc = "Pipe Window Select 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 [pipesel](index.html) module"]
216pub struct PIPESEL_SPEC;
217impl crate::RegisterSpec for PIPESEL_SPEC {
218    type Ux = u16;
219}
220#[doc = "`read()` method returns [pipesel::R](R) reader structure"]
221impl crate::Readable for PIPESEL_SPEC {
222    type Reader = R;
223}
224#[doc = "`write(|w| ..)` method takes [pipesel::W](W) writer structure"]
225impl crate::Writable for PIPESEL_SPEC {
226    type Writer = W;
227    const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
228    const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
229}
230#[doc = "`reset()` method sets PIPESEL to value 0"]
231impl crate::Resettable for PIPESEL_SPEC {
232    const RESET_VALUE: Self::Ux = 0;
233}