avr_device/devices/atmega32u4/cpu/
clkpr.rs1#[doc = "Register `CLKPR` reader"]
2pub struct R(crate::R<CLKPR_SPEC>);
3impl core::ops::Deref for R {
4 type Target = crate::R<CLKPR_SPEC>;
5 #[inline(always)]
6 fn deref(&self) -> &Self::Target {
7 &self.0
8 }
9}
10impl From<crate::R<CLKPR_SPEC>> for R {
11 #[inline(always)]
12 fn from(reader: crate::R<CLKPR_SPEC>) -> Self {
13 R(reader)
14 }
15}
16#[doc = "Register `CLKPR` writer"]
17pub struct W(crate::W<CLKPR_SPEC>);
18impl core::ops::Deref for W {
19 type Target = crate::W<CLKPR_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<CLKPR_SPEC>> for W {
32 #[inline(always)]
33 fn from(writer: crate::W<CLKPR_SPEC>) -> Self {
34 W(writer)
35 }
36}
37#[doc = "Field `CLKPS` reader - No Description."]
38pub type CLKPS_R = crate::FieldReader<u8, CLKPS_A>;
39#[doc = "No Description.\n\nValue on reset: 0"]
40#[derive(Clone, Copy, Debug, PartialEq, Eq)]
41#[repr(u8)]
42pub enum CLKPS_A {
43 #[doc = "0: 1"]
44 VAL_0X00 = 0,
45 #[doc = "1: 2"]
46 VAL_0X01 = 1,
47 #[doc = "2: 4"]
48 VAL_0X02 = 2,
49 #[doc = "3: 8"]
50 VAL_0X03 = 3,
51 #[doc = "4: 16"]
52 VAL_0X04 = 4,
53 #[doc = "5: 32"]
54 VAL_0X05 = 5,
55 #[doc = "6: 64"]
56 VAL_0X06 = 6,
57 #[doc = "7: 128"]
58 VAL_0X07 = 7,
59 #[doc = "8: 256"]
60 VAL_0X08 = 8,
61}
62impl From<CLKPS_A> for u8 {
63 #[inline(always)]
64 fn from(variant: CLKPS_A) -> Self {
65 variant as _
66 }
67}
68impl CLKPS_R {
69 #[doc = "Get enumerated values variant"]
70 #[inline(always)]
71 pub fn variant(&self) -> Option<CLKPS_A> {
72 match self.bits {
73 0 => Some(CLKPS_A::VAL_0X00),
74 1 => Some(CLKPS_A::VAL_0X01),
75 2 => Some(CLKPS_A::VAL_0X02),
76 3 => Some(CLKPS_A::VAL_0X03),
77 4 => Some(CLKPS_A::VAL_0X04),
78 5 => Some(CLKPS_A::VAL_0X05),
79 6 => Some(CLKPS_A::VAL_0X06),
80 7 => Some(CLKPS_A::VAL_0X07),
81 8 => Some(CLKPS_A::VAL_0X08),
82 _ => None,
83 }
84 }
85 #[doc = "Checks if the value of the field is `VAL_0X00`"]
86 #[inline(always)]
87 pub fn is_val_0x00(&self) -> bool {
88 *self == CLKPS_A::VAL_0X00
89 }
90 #[doc = "Checks if the value of the field is `VAL_0X01`"]
91 #[inline(always)]
92 pub fn is_val_0x01(&self) -> bool {
93 *self == CLKPS_A::VAL_0X01
94 }
95 #[doc = "Checks if the value of the field is `VAL_0X02`"]
96 #[inline(always)]
97 pub fn is_val_0x02(&self) -> bool {
98 *self == CLKPS_A::VAL_0X02
99 }
100 #[doc = "Checks if the value of the field is `VAL_0X03`"]
101 #[inline(always)]
102 pub fn is_val_0x03(&self) -> bool {
103 *self == CLKPS_A::VAL_0X03
104 }
105 #[doc = "Checks if the value of the field is `VAL_0X04`"]
106 #[inline(always)]
107 pub fn is_val_0x04(&self) -> bool {
108 *self == CLKPS_A::VAL_0X04
109 }
110 #[doc = "Checks if the value of the field is `VAL_0X05`"]
111 #[inline(always)]
112 pub fn is_val_0x05(&self) -> bool {
113 *self == CLKPS_A::VAL_0X05
114 }
115 #[doc = "Checks if the value of the field is `VAL_0X06`"]
116 #[inline(always)]
117 pub fn is_val_0x06(&self) -> bool {
118 *self == CLKPS_A::VAL_0X06
119 }
120 #[doc = "Checks if the value of the field is `VAL_0X07`"]
121 #[inline(always)]
122 pub fn is_val_0x07(&self) -> bool {
123 *self == CLKPS_A::VAL_0X07
124 }
125 #[doc = "Checks if the value of the field is `VAL_0X08`"]
126 #[inline(always)]
127 pub fn is_val_0x08(&self) -> bool {
128 *self == CLKPS_A::VAL_0X08
129 }
130}
131#[doc = "Field `CLKPS` writer - No Description."]
132pub type CLKPS_W<'a, const O: u8> = crate::FieldWriter<'a, u8, CLKPR_SPEC, u8, CLKPS_A, 4, O>;
133impl<'a, const O: u8> CLKPS_W<'a, O> {
134 #[doc = "1"]
135 #[inline(always)]
136 pub fn val_0x00(self) -> &'a mut W {
137 self.variant(CLKPS_A::VAL_0X00)
138 }
139 #[doc = "2"]
140 #[inline(always)]
141 pub fn val_0x01(self) -> &'a mut W {
142 self.variant(CLKPS_A::VAL_0X01)
143 }
144 #[doc = "4"]
145 #[inline(always)]
146 pub fn val_0x02(self) -> &'a mut W {
147 self.variant(CLKPS_A::VAL_0X02)
148 }
149 #[doc = "8"]
150 #[inline(always)]
151 pub fn val_0x03(self) -> &'a mut W {
152 self.variant(CLKPS_A::VAL_0X03)
153 }
154 #[doc = "16"]
155 #[inline(always)]
156 pub fn val_0x04(self) -> &'a mut W {
157 self.variant(CLKPS_A::VAL_0X04)
158 }
159 #[doc = "32"]
160 #[inline(always)]
161 pub fn val_0x05(self) -> &'a mut W {
162 self.variant(CLKPS_A::VAL_0X05)
163 }
164 #[doc = "64"]
165 #[inline(always)]
166 pub fn val_0x06(self) -> &'a mut W {
167 self.variant(CLKPS_A::VAL_0X06)
168 }
169 #[doc = "128"]
170 #[inline(always)]
171 pub fn val_0x07(self) -> &'a mut W {
172 self.variant(CLKPS_A::VAL_0X07)
173 }
174 #[doc = "256"]
175 #[inline(always)]
176 pub fn val_0x08(self) -> &'a mut W {
177 self.variant(CLKPS_A::VAL_0X08)
178 }
179}
180#[doc = "Field `CLKPCE` reader - No Description."]
181pub type CLKPCE_R = crate::BitReader<bool>;
182#[doc = "Field `CLKPCE` writer - No Description."]
183pub type CLKPCE_W<'a, const O: u8> = crate::BitWriter<'a, u8, CLKPR_SPEC, bool, O>;
184impl R {
185 #[doc = "Bits 0:3 - No Description."]
186 #[inline(always)]
187 pub fn clkps(&self) -> CLKPS_R {
188 CLKPS_R::new(self.bits & 0x0f)
189 }
190 #[doc = "Bit 7 - No Description."]
191 #[inline(always)]
192 pub fn clkpce(&self) -> CLKPCE_R {
193 CLKPCE_R::new(((self.bits >> 7) & 1) != 0)
194 }
195}
196impl W {
197 #[doc = "Bits 0:3 - No Description."]
198 #[inline(always)]
199 #[must_use]
200 pub fn clkps(&mut self) -> CLKPS_W<0> {
201 CLKPS_W::new(self)
202 }
203 #[doc = "Bit 7 - No Description."]
204 #[inline(always)]
205 #[must_use]
206 pub fn clkpce(&mut self) -> CLKPCE_W<7> {
207 CLKPCE_W::new(self)
208 }
209 #[doc = "Writes raw bits to the register."]
210 #[inline(always)]
211 pub unsafe fn bits(&mut self, bits: u8) -> &mut Self {
212 self.0.bits(bits);
213 self
214 }
215}
216#[doc = "No Description.\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 [clkpr](index.html) module"]
217pub struct CLKPR_SPEC;
218impl crate::RegisterSpec for CLKPR_SPEC {
219 type Ux = u8;
220}
221#[doc = "`read()` method returns [clkpr::R](R) reader structure"]
222impl crate::Readable for CLKPR_SPEC {
223 type Reader = R;
224}
225#[doc = "`write(|w| ..)` method takes [clkpr::W](W) writer structure"]
226impl crate::Writable for CLKPR_SPEC {
227 type Writer = W;
228 const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
229 const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
230}
231#[doc = "`reset()` method sets CLKPR to value 0"]
232impl crate::Resettable for CLKPR_SPEC {
233 const RESET_VALUE: Self::Ux = 0;
234}