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