efm32wg230_pac/cmu/
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 `CLKOUT0PEN` reader - CLKOUT0 Pin Enable"]
38pub type CLKOUT0PEN_R = crate::BitReader<bool>;
39#[doc = "Field `CLKOUT0PEN` writer - CLKOUT0 Pin Enable"]
40pub type CLKOUT0PEN_W<'a> = crate::BitWriter<'a, u32, ROUTE_SPEC, bool, 0>;
41#[doc = "Field `CLKOUT1PEN` reader - CLKOUT1 Pin Enable"]
42pub type CLKOUT1PEN_R = crate::BitReader<bool>;
43#[doc = "Field `CLKOUT1PEN` writer - CLKOUT1 Pin Enable"]
44pub type CLKOUT1PEN_W<'a> = crate::BitWriter<'a, u32, ROUTE_SPEC, bool, 1>;
45#[doc = "I/O Location\n\nValue on reset: 0"]
46#[derive(Clone, Copy, Debug, PartialEq)]
47#[repr(u8)]
48pub enum LOCATION_A {
49 #[doc = "0: Location 0"]
50 LOC0 = 0,
51 #[doc = "1: Location 1"]
52 LOC1 = 1,
53 #[doc = "2: Location 2"]
54 LOC2 = 2,
55}
56impl From<LOCATION_A> for u8 {
57 #[inline(always)]
58 fn from(variant: LOCATION_A) -> Self {
59 variant as _
60 }
61}
62#[doc = "Field `LOCATION` reader - I/O Location"]
63pub type LOCATION_R = crate::FieldReader<u8, LOCATION_A>;
64impl LOCATION_R {
65 #[doc = "Get enumerated values variant"]
66 #[inline(always)]
67 pub fn variant(&self) -> Option<LOCATION_A> {
68 match self.bits {
69 0 => Some(LOCATION_A::LOC0),
70 1 => Some(LOCATION_A::LOC1),
71 2 => Some(LOCATION_A::LOC2),
72 _ => None,
73 }
74 }
75 #[doc = "Checks if the value of the field is `LOC0`"]
76 #[inline(always)]
77 pub fn is_loc0(&self) -> bool {
78 *self == LOCATION_A::LOC0
79 }
80 #[doc = "Checks if the value of the field is `LOC1`"]
81 #[inline(always)]
82 pub fn is_loc1(&self) -> bool {
83 *self == LOCATION_A::LOC1
84 }
85 #[doc = "Checks if the value of the field is `LOC2`"]
86 #[inline(always)]
87 pub fn is_loc2(&self) -> bool {
88 *self == LOCATION_A::LOC2
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, 2>;
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 #[doc = "Location 2"]
105 #[inline(always)]
106 pub fn loc2(self) -> &'a mut W {
107 self.variant(LOCATION_A::LOC2)
108 }
109}
110impl R {
111 #[doc = "Bit 0 - CLKOUT0 Pin Enable"]
112 #[inline(always)]
113 pub fn clkout0pen(&self) -> CLKOUT0PEN_R {
114 CLKOUT0PEN_R::new((self.bits & 1) != 0)
115 }
116 #[doc = "Bit 1 - CLKOUT1 Pin Enable"]
117 #[inline(always)]
118 pub fn clkout1pen(&self) -> CLKOUT1PEN_R {
119 CLKOUT1PEN_R::new(((self.bits >> 1) & 1) != 0)
120 }
121 #[doc = "Bits 2:4 - I/O Location"]
122 #[inline(always)]
123 pub fn location(&self) -> LOCATION_R {
124 LOCATION_R::new(((self.bits >> 2) & 7) as u8)
125 }
126}
127impl W {
128 #[doc = "Bit 0 - CLKOUT0 Pin Enable"]
129 #[inline(always)]
130 pub fn clkout0pen(&mut self) -> CLKOUT0PEN_W {
131 CLKOUT0PEN_W::new(self)
132 }
133 #[doc = "Bit 1 - CLKOUT1 Pin Enable"]
134 #[inline(always)]
135 pub fn clkout1pen(&mut self) -> CLKOUT1PEN_W {
136 CLKOUT1PEN_W::new(self)
137 }
138 #[doc = "Bits 2:4 - I/O Location"]
139 #[inline(always)]
140 pub fn location(&mut self) -> LOCATION_W {
141 LOCATION_W::new(self)
142 }
143 #[doc = "Writes raw bits to the register."]
144 #[inline(always)]
145 pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
146 self.0.bits(bits);
147 self
148 }
149}
150#[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"]
151pub struct ROUTE_SPEC;
152impl crate::RegisterSpec for ROUTE_SPEC {
153 type Ux = u32;
154}
155#[doc = "`read()` method returns [route::R](R) reader structure"]
156impl crate::Readable for ROUTE_SPEC {
157 type Reader = R;
158}
159#[doc = "`write(|w| ..)` method takes [route::W](W) writer structure"]
160impl crate::Writable for ROUTE_SPEC {
161 type Writer = W;
162}
163#[doc = "`reset()` method sets ROUTE to value 0"]
164impl crate::Resettable for ROUTE_SPEC {
165 #[inline(always)]
166 fn reset_value() -> Self::Ux {
167 0
168 }
169}