efm32gg12b410_pac/qspi0/
routeloc0.rs

1#[doc = "Register `ROUTELOC0` reader"]
2pub struct R(crate::R<ROUTELOC0_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<ROUTELOC0_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<ROUTELOC0_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<ROUTELOC0_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `ROUTELOC0` writer"]
17pub struct W(crate::W<ROUTELOC0_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<ROUTELOC0_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<ROUTELOC0_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<ROUTELOC0_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "I/O Location\n\nValue on reset: 0"]
38#[derive(Clone, Copy, Debug, PartialEq)]
39#[repr(u8)]
40pub enum QSPILOC_A {
41    #[doc = "0: Location 0"]
42    LOC0 = 0,
43    #[doc = "1: Location 1"]
44    LOC1 = 1,
45}
46impl From<QSPILOC_A> for u8 {
47    #[inline(always)]
48    fn from(variant: QSPILOC_A) -> Self {
49        variant as _
50    }
51}
52#[doc = "Field `QSPILOC` reader - I/O Location"]
53pub type QSPILOC_R = crate::FieldReader<u8, QSPILOC_A>;
54impl QSPILOC_R {
55    #[doc = "Get enumerated values variant"]
56    #[inline(always)]
57    pub fn variant(&self) -> Option<QSPILOC_A> {
58        match self.bits {
59            0 => Some(QSPILOC_A::LOC0),
60            1 => Some(QSPILOC_A::LOC1),
61            _ => None,
62        }
63    }
64    #[doc = "Checks if the value of the field is `LOC0`"]
65    #[inline(always)]
66    pub fn is_loc0(&self) -> bool {
67        *self == QSPILOC_A::LOC0
68    }
69    #[doc = "Checks if the value of the field is `LOC1`"]
70    #[inline(always)]
71    pub fn is_loc1(&self) -> bool {
72        *self == QSPILOC_A::LOC1
73    }
74}
75#[doc = "Field `QSPILOC` writer - I/O Location"]
76pub type QSPILOC_W<'a> = crate::FieldWriter<'a, u32, ROUTELOC0_SPEC, u8, QSPILOC_A, 6, 0>;
77impl<'a> QSPILOC_W<'a> {
78    #[doc = "Location 0"]
79    #[inline(always)]
80    pub fn loc0(self) -> &'a mut W {
81        self.variant(QSPILOC_A::LOC0)
82    }
83    #[doc = "Location 1"]
84    #[inline(always)]
85    pub fn loc1(self) -> &'a mut W {
86        self.variant(QSPILOC_A::LOC1)
87    }
88}
89#[doc = "I/O Location\n\nValue on reset: 0"]
90#[derive(Clone, Copy, Debug, PartialEq)]
91#[repr(u8)]
92pub enum QSPIRSTLOC_A {
93    #[doc = "0: Location 0"]
94    LOC0 = 0,
95    #[doc = "1: Location 1"]
96    LOC1 = 1,
97}
98impl From<QSPIRSTLOC_A> for u8 {
99    #[inline(always)]
100    fn from(variant: QSPIRSTLOC_A) -> Self {
101        variant as _
102    }
103}
104#[doc = "Field `QSPIRSTLOC` reader - I/O Location"]
105pub type QSPIRSTLOC_R = crate::FieldReader<u8, QSPIRSTLOC_A>;
106impl QSPIRSTLOC_R {
107    #[doc = "Get enumerated values variant"]
108    #[inline(always)]
109    pub fn variant(&self) -> Option<QSPIRSTLOC_A> {
110        match self.bits {
111            0 => Some(QSPIRSTLOC_A::LOC0),
112            1 => Some(QSPIRSTLOC_A::LOC1),
113            _ => None,
114        }
115    }
116    #[doc = "Checks if the value of the field is `LOC0`"]
117    #[inline(always)]
118    pub fn is_loc0(&self) -> bool {
119        *self == QSPIRSTLOC_A::LOC0
120    }
121    #[doc = "Checks if the value of the field is `LOC1`"]
122    #[inline(always)]
123    pub fn is_loc1(&self) -> bool {
124        *self == QSPIRSTLOC_A::LOC1
125    }
126}
127#[doc = "Field `QSPIRSTLOC` writer - I/O Location"]
128pub type QSPIRSTLOC_W<'a> = crate::FieldWriter<'a, u32, ROUTELOC0_SPEC, u8, QSPIRSTLOC_A, 6, 6>;
129impl<'a> QSPIRSTLOC_W<'a> {
130    #[doc = "Location 0"]
131    #[inline(always)]
132    pub fn loc0(self) -> &'a mut W {
133        self.variant(QSPIRSTLOC_A::LOC0)
134    }
135    #[doc = "Location 1"]
136    #[inline(always)]
137    pub fn loc1(self) -> &'a mut W {
138        self.variant(QSPIRSTLOC_A::LOC1)
139    }
140}
141impl R {
142    #[doc = "Bits 0:5 - I/O Location"]
143    #[inline(always)]
144    pub fn qspiloc(&self) -> QSPILOC_R {
145        QSPILOC_R::new((self.bits & 0x3f) as u8)
146    }
147    #[doc = "Bits 6:11 - I/O Location"]
148    #[inline(always)]
149    pub fn qspirstloc(&self) -> QSPIRSTLOC_R {
150        QSPIRSTLOC_R::new(((self.bits >> 6) & 0x3f) as u8)
151    }
152}
153impl W {
154    #[doc = "Bits 0:5 - I/O Location"]
155    #[inline(always)]
156    pub fn qspiloc(&mut self) -> QSPILOC_W {
157        QSPILOC_W::new(self)
158    }
159    #[doc = "Bits 6:11 - I/O Location"]
160    #[inline(always)]
161    pub fn qspirstloc(&mut self) -> QSPIRSTLOC_W {
162        QSPIRSTLOC_W::new(self)
163    }
164    #[doc = "Writes raw bits to the register."]
165    #[inline(always)]
166    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
167        self.0.bits(bits);
168        self
169    }
170}
171#[doc = "I/O Route Location Register 0\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 [routeloc0](index.html) module"]
172pub struct ROUTELOC0_SPEC;
173impl crate::RegisterSpec for ROUTELOC0_SPEC {
174    type Ux = u32;
175}
176#[doc = "`read()` method returns [routeloc0::R](R) reader structure"]
177impl crate::Readable for ROUTELOC0_SPEC {
178    type Reader = R;
179}
180#[doc = "`write(|w| ..)` method takes [routeloc0::W](W) writer structure"]
181impl crate::Writable for ROUTELOC0_SPEC {
182    type Writer = W;
183}
184#[doc = "`reset()` method sets ROUTELOC0 to value 0"]
185impl crate::Resettable for ROUTELOC0_SPEC {
186    #[inline(always)]
187    fn reset_value() -> Self::Ux {
188        0
189    }
190}