avr_device/devices/atmega32u4/cpu/
rampz.rs1#[doc = "Register `RAMPZ` reader"]
2pub struct R(crate::R<RAMPZ_SPEC>);
3impl core::ops::Deref for R {
4 type Target = crate::R<RAMPZ_SPEC>;
5 #[inline(always)]
6 fn deref(&self) -> &Self::Target {
7 &self.0
8 }
9}
10impl From<crate::R<RAMPZ_SPEC>> for R {
11 #[inline(always)]
12 fn from(reader: crate::R<RAMPZ_SPEC>) -> Self {
13 R(reader)
14 }
15}
16#[doc = "Register `RAMPZ` writer"]
17pub struct W(crate::W<RAMPZ_SPEC>);
18impl core::ops::Deref for W {
19 type Target = crate::W<RAMPZ_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<RAMPZ_SPEC>> for W {
32 #[inline(always)]
33 fn from(writer: crate::W<RAMPZ_SPEC>) -> Self {
34 W(writer)
35 }
36}
37#[doc = "Field `RAMPZ` reader - Extended Z-Pointer Value"]
38pub type RAMPZ_R = crate::FieldReader<u8, RAMPZ_A>;
39#[doc = "Extended Z-Pointer Value\n\nValue on reset: 0"]
40#[derive(Clone, Copy, Debug, PartialEq, Eq)]
41#[repr(u8)]
42pub enum RAMPZ_A {
43 #[doc = "0: Default value of Z-pointer MSB's."]
44 VAL_0 = 0,
45}
46impl From<RAMPZ_A> for u8 {
47 #[inline(always)]
48 fn from(variant: RAMPZ_A) -> Self {
49 variant as _
50 }
51}
52impl RAMPZ_R {
53 #[doc = "Get enumerated values variant"]
54 #[inline(always)]
55 pub fn variant(&self) -> Option<RAMPZ_A> {
56 match self.bits {
57 0 => Some(RAMPZ_A::VAL_0),
58 _ => None,
59 }
60 }
61 #[doc = "Checks if the value of the field is `VAL_0`"]
62 #[inline(always)]
63 pub fn is_val_0(&self) -> bool {
64 *self == RAMPZ_A::VAL_0
65 }
66}
67#[doc = "Field `RAMPZ` writer - Extended Z-Pointer Value"]
68pub type RAMPZ_W<'a, const O: u8> = crate::FieldWriter<'a, u8, RAMPZ_SPEC, u8, RAMPZ_A, 2, O>;
69impl<'a, const O: u8> RAMPZ_W<'a, O> {
70 #[doc = "Default value of Z-pointer MSB's."]
71 #[inline(always)]
72 pub fn val_0(self) -> &'a mut W {
73 self.variant(RAMPZ_A::VAL_0)
74 }
75}
76#[doc = "Field `Res` reader - Reserved"]
77pub type RES_R = crate::FieldReader<u8, u8>;
78#[doc = "Field `Res` writer - Reserved"]
79pub type RES_W<'a, const O: u8> = crate::FieldWriterSafe<'a, u8, RAMPZ_SPEC, u8, u8, 6, O>;
80impl R {
81 #[doc = "Bits 0:1 - Extended Z-Pointer Value"]
82 #[inline(always)]
83 pub fn rampz(&self) -> RAMPZ_R {
84 RAMPZ_R::new(self.bits & 3)
85 }
86 #[doc = "Bits 2:7 - Reserved"]
87 #[inline(always)]
88 pub fn res(&self) -> RES_R {
89 RES_R::new((self.bits >> 2) & 0x3f)
90 }
91}
92impl W {
93 #[doc = "Bits 0:1 - Extended Z-Pointer Value"]
94 #[inline(always)]
95 #[must_use]
96 pub fn rampz(&mut self) -> RAMPZ_W<0> {
97 RAMPZ_W::new(self)
98 }
99 #[doc = "Bits 2:7 - Reserved"]
100 #[inline(always)]
101 #[must_use]
102 pub fn res(&mut self) -> RES_W<2> {
103 RES_W::new(self)
104 }
105 #[doc = "Writes raw bits to the register."]
106 #[inline(always)]
107 pub unsafe fn bits(&mut self, bits: u8) -> &mut Self {
108 self.0.bits(bits);
109 self
110 }
111}
112#[doc = "Extended Z-pointer Register for ELPM/SPM\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 [rampz](index.html) module"]
113pub struct RAMPZ_SPEC;
114impl crate::RegisterSpec for RAMPZ_SPEC {
115 type Ux = u8;
116}
117#[doc = "`read()` method returns [rampz::R](R) reader structure"]
118impl crate::Readable for RAMPZ_SPEC {
119 type Reader = R;
120}
121#[doc = "`write(|w| ..)` method takes [rampz::W](W) writer structure"]
122impl crate::Writable for RAMPZ_SPEC {
123 type Writer = W;
124 const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
125 const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
126}
127#[doc = "`reset()` method sets RAMPZ to value 0"]
128impl crate::Resettable for RAMPZ_SPEC {
129 const RESET_VALUE: Self::Ux = 0;
130}