1#[doc = "Register `FENTRYR` reader"]
2pub struct R(crate::R<FENTRYR_SPEC>);
3impl core::ops::Deref for R {
4 type Target = crate::R<FENTRYR_SPEC>;
5 #[inline(always)]
6 fn deref(&self) -> &Self::Target {
7 &self.0
8 }
9}
10impl From<crate::R<FENTRYR_SPEC>> for R {
11 #[inline(always)]
12 fn from(reader: crate::R<FENTRYR_SPEC>) -> Self {
13 R(reader)
14 }
15}
16#[doc = "Register `FENTRYR` writer"]
17pub struct W(crate::W<FENTRYR_SPEC>);
18impl core::ops::Deref for W {
19 type Target = crate::W<FENTRYR_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<FENTRYR_SPEC>> for W {
32 #[inline(always)]
33 fn from(writer: crate::W<FENTRYR_SPEC>) -> Self {
34 W(writer)
35 }
36}
37#[doc = "Field `FENTRY0` reader - Code Flash P/E Mode Entry 0"]
38pub type FENTRY0_R = crate::BitReader<FENTRY0_A>;
39#[doc = "Code Flash P/E Mode Entry 0\n\nValue on reset: 0"]
40#[derive(Clone, Copy, Debug, PartialEq, Eq)]
41pub enum FENTRY0_A {
42 #[doc = "0: The code flash is the read mode"]
43 _0 = 0,
44 #[doc = "1: The code flash is the P/E mode."]
45 _1 = 1,
46}
47impl From<FENTRY0_A> for bool {
48 #[inline(always)]
49 fn from(variant: FENTRY0_A) -> Self {
50 variant as u8 != 0
51 }
52}
53impl FENTRY0_R {
54 #[doc = "Get enumerated values variant"]
55 #[inline(always)]
56 pub fn variant(&self) -> FENTRY0_A {
57 match self.bits {
58 false => FENTRY0_A::_0,
59 true => FENTRY0_A::_1,
60 }
61 }
62 #[doc = "Checks if the value of the field is `_0`"]
63 #[inline(always)]
64 pub fn is_0(&self) -> bool {
65 *self == FENTRY0_A::_0
66 }
67 #[doc = "Checks if the value of the field is `_1`"]
68 #[inline(always)]
69 pub fn is_1(&self) -> bool {
70 *self == FENTRY0_A::_1
71 }
72}
73#[doc = "Field `FENTRY0` writer - Code Flash P/E Mode Entry 0"]
74pub type FENTRY0_W<'a, const O: u8> = crate::BitWriter<'a, u16, FENTRYR_SPEC, FENTRY0_A, O>;
75impl<'a, const O: u8> FENTRY0_W<'a, O> {
76 #[doc = "The code flash is the read mode"]
77 #[inline(always)]
78 pub fn _0(self) -> &'a mut W {
79 self.variant(FENTRY0_A::_0)
80 }
81 #[doc = "The code flash is the P/E mode."]
82 #[inline(always)]
83 pub fn _1(self) -> &'a mut W {
84 self.variant(FENTRY0_A::_1)
85 }
86}
87#[doc = "Field `FENTRYD` reader - Data Flash P/E Mode Entry"]
88pub type FENTRYD_R = crate::BitReader<FENTRYD_A>;
89#[doc = "Data Flash P/E Mode Entry\n\nValue on reset: 0"]
90#[derive(Clone, Copy, Debug, PartialEq, Eq)]
91pub enum FENTRYD_A {
92 #[doc = "0: The data flash is the read mode"]
93 _0 = 0,
94 #[doc = "1: The data flash is the P/E mode."]
95 _1 = 1,
96}
97impl From<FENTRYD_A> for bool {
98 #[inline(always)]
99 fn from(variant: FENTRYD_A) -> Self {
100 variant as u8 != 0
101 }
102}
103impl FENTRYD_R {
104 #[doc = "Get enumerated values variant"]
105 #[inline(always)]
106 pub fn variant(&self) -> FENTRYD_A {
107 match self.bits {
108 false => FENTRYD_A::_0,
109 true => FENTRYD_A::_1,
110 }
111 }
112 #[doc = "Checks if the value of the field is `_0`"]
113 #[inline(always)]
114 pub fn is_0(&self) -> bool {
115 *self == FENTRYD_A::_0
116 }
117 #[doc = "Checks if the value of the field is `_1`"]
118 #[inline(always)]
119 pub fn is_1(&self) -> bool {
120 *self == FENTRYD_A::_1
121 }
122}
123#[doc = "Field `FENTRYD` writer - Data Flash P/E Mode Entry"]
124pub type FENTRYD_W<'a, const O: u8> = crate::BitWriter<'a, u16, FENTRYR_SPEC, FENTRYD_A, O>;
125impl<'a, const O: u8> FENTRYD_W<'a, O> {
126 #[doc = "The data flash is the read mode"]
127 #[inline(always)]
128 pub fn _0(self) -> &'a mut W {
129 self.variant(FENTRYD_A::_0)
130 }
131 #[doc = "The data flash is the P/E mode."]
132 #[inline(always)]
133 pub fn _1(self) -> &'a mut W {
134 self.variant(FENTRYD_A::_1)
135 }
136}
137#[doc = "Field `FEKEY` writer - Key Code"]
138pub type FEKEY_W<'a, const O: u8> = crate::FieldWriter<'a, u16, FENTRYR_SPEC, u8, u8, 8, O>;
139impl R {
140 #[doc = "Bit 0 - Code Flash P/E Mode Entry 0"]
141 #[inline(always)]
142 pub fn fentry0(&self) -> FENTRY0_R {
143 FENTRY0_R::new((self.bits & 1) != 0)
144 }
145 #[doc = "Bit 7 - Data Flash P/E Mode Entry"]
146 #[inline(always)]
147 pub fn fentryd(&self) -> FENTRYD_R {
148 FENTRYD_R::new(((self.bits >> 7) & 1) != 0)
149 }
150}
151impl W {
152 #[doc = "Bit 0 - Code Flash P/E Mode Entry 0"]
153 #[inline(always)]
154 #[must_use]
155 pub fn fentry0(&mut self) -> FENTRY0_W<0> {
156 FENTRY0_W::new(self)
157 }
158 #[doc = "Bit 7 - Data Flash P/E Mode Entry"]
159 #[inline(always)]
160 #[must_use]
161 pub fn fentryd(&mut self) -> FENTRYD_W<7> {
162 FENTRYD_W::new(self)
163 }
164 #[doc = "Bits 8:15 - Key Code"]
165 #[inline(always)]
166 #[must_use]
167 pub fn fekey(&mut self) -> FEKEY_W<8> {
168 FEKEY_W::new(self)
169 }
170 #[doc = "Writes raw bits to the register."]
171 #[inline(always)]
172 pub unsafe fn bits(&mut self, bits: u16) -> &mut Self {
173 self.0.bits(bits);
174 self
175 }
176}
177#[doc = "Flash P/E Mode Entry 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 [fentryr](index.html) module"]
178pub struct FENTRYR_SPEC;
179impl crate::RegisterSpec for FENTRYR_SPEC {
180 type Ux = u16;
181}
182#[doc = "`read()` method returns [fentryr::R](R) reader structure"]
183impl crate::Readable for FENTRYR_SPEC {
184 type Reader = R;
185}
186#[doc = "`write(|w| ..)` method takes [fentryr::W](W) writer structure"]
187impl crate::Writable for FENTRYR_SPEC {
188 type Writer = W;
189 const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
190 const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
191}
192#[doc = "`reset()` method sets FENTRYR to value 0"]
193impl crate::Resettable for FENTRYR_SPEC {
194 const RESET_VALUE: Self::Ux = 0;
195}