1#[doc = "Register `FPMCR` reader"]
2pub struct R(crate::R<FPMCR_SPEC>);
3impl core::ops::Deref for R {
4 type Target = crate::R<FPMCR_SPEC>;
5 #[inline(always)]
6 fn deref(&self) -> &Self::Target {
7 &self.0
8 }
9}
10impl From<crate::R<FPMCR_SPEC>> for R {
11 #[inline(always)]
12 fn from(reader: crate::R<FPMCR_SPEC>) -> Self {
13 R(reader)
14 }
15}
16#[doc = "Register `FPMCR` writer"]
17pub struct W(crate::W<FPMCR_SPEC>);
18impl core::ops::Deref for W {
19 type Target = crate::W<FPMCR_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<FPMCR_SPEC>> for W {
32 #[inline(always)]
33 fn from(writer: crate::W<FPMCR_SPEC>) -> Self {
34 W(writer)
35 }
36}
37#[doc = "Field `FMS0` reader - Flash Operating Mode Select 0"]
38pub type FMS0_R = crate::BitReader<FMS0_A>;
39#[doc = "Flash Operating Mode Select 0\n\nValue on reset: 0"]
40#[derive(Clone, Copy, Debug, PartialEq, Eq)]
41pub enum FMS0_A {
42 #[doc = "0: FMS1 = 0: Read mode FMS1 = 1: Data flash P/E mode."]
43 _0 = 0,
44 #[doc = "1: FMS1 = 0: Code flash P/E mode FMS1 = 1: Setting prohibited."]
45 _1 = 1,
46}
47impl From<FMS0_A> for bool {
48 #[inline(always)]
49 fn from(variant: FMS0_A) -> Self {
50 variant as u8 != 0
51 }
52}
53impl FMS0_R {
54 #[doc = "Get enumerated values variant"]
55 #[inline(always)]
56 pub fn variant(&self) -> FMS0_A {
57 match self.bits {
58 false => FMS0_A::_0,
59 true => FMS0_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 == FMS0_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 == FMS0_A::_1
71 }
72}
73#[doc = "Field `FMS0` writer - Flash Operating Mode Select 0"]
74pub type FMS0_W<'a, const O: u8> = crate::BitWriter<'a, u8, FPMCR_SPEC, FMS0_A, O>;
75impl<'a, const O: u8> FMS0_W<'a, O> {
76 #[doc = "FMS1 = 0: Read mode FMS1 = 1: Data flash P/E mode."]
77 #[inline(always)]
78 pub fn _0(self) -> &'a mut W {
79 self.variant(FMS0_A::_0)
80 }
81 #[doc = "FMS1 = 0: Code flash P/E mode FMS1 = 1: Setting prohibited."]
82 #[inline(always)]
83 pub fn _1(self) -> &'a mut W {
84 self.variant(FMS0_A::_1)
85 }
86}
87#[doc = "Field `RPDIS` reader - Code Flash P/E Disable"]
88pub type RPDIS_R = crate::BitReader<RPDIS_A>;
89#[doc = "Code Flash P/E Disable\n\nValue on reset: 1"]
90#[derive(Clone, Copy, Debug, PartialEq, Eq)]
91pub enum RPDIS_A {
92 #[doc = "0: Programming of the code flash is enabled"]
93 _0 = 0,
94 #[doc = "1: Programming of the code flash is disabled."]
95 _1 = 1,
96}
97impl From<RPDIS_A> for bool {
98 #[inline(always)]
99 fn from(variant: RPDIS_A) -> Self {
100 variant as u8 != 0
101 }
102}
103impl RPDIS_R {
104 #[doc = "Get enumerated values variant"]
105 #[inline(always)]
106 pub fn variant(&self) -> RPDIS_A {
107 match self.bits {
108 false => RPDIS_A::_0,
109 true => RPDIS_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 == RPDIS_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 == RPDIS_A::_1
121 }
122}
123#[doc = "Field `RPDIS` writer - Code Flash P/E Disable"]
124pub type RPDIS_W<'a, const O: u8> = crate::BitWriter<'a, u8, FPMCR_SPEC, RPDIS_A, O>;
125impl<'a, const O: u8> RPDIS_W<'a, O> {
126 #[doc = "Programming of the code flash is enabled"]
127 #[inline(always)]
128 pub fn _0(self) -> &'a mut W {
129 self.variant(RPDIS_A::_0)
130 }
131 #[doc = "Programming of the code flash is disabled."]
132 #[inline(always)]
133 pub fn _1(self) -> &'a mut W {
134 self.variant(RPDIS_A::_1)
135 }
136}
137#[doc = "Field `FMS1` reader - Flash Operating Mode Select 1"]
138pub type FMS1_R = crate::BitReader<bool>;
139#[doc = "Field `FMS1` writer - Flash Operating Mode Select 1"]
140pub type FMS1_W<'a, const O: u8> = crate::BitWriter<'a, u8, FPMCR_SPEC, bool, O>;
141impl R {
142 #[doc = "Bit 1 - Flash Operating Mode Select 0"]
143 #[inline(always)]
144 pub fn fms0(&self) -> FMS0_R {
145 FMS0_R::new(((self.bits >> 1) & 1) != 0)
146 }
147 #[doc = "Bit 3 - Code Flash P/E Disable"]
148 #[inline(always)]
149 pub fn rpdis(&self) -> RPDIS_R {
150 RPDIS_R::new(((self.bits >> 3) & 1) != 0)
151 }
152 #[doc = "Bit 4 - Flash Operating Mode Select 1"]
153 #[inline(always)]
154 pub fn fms1(&self) -> FMS1_R {
155 FMS1_R::new(((self.bits >> 4) & 1) != 0)
156 }
157}
158impl W {
159 #[doc = "Bit 1 - Flash Operating Mode Select 0"]
160 #[inline(always)]
161 #[must_use]
162 pub fn fms0(&mut self) -> FMS0_W<1> {
163 FMS0_W::new(self)
164 }
165 #[doc = "Bit 3 - Code Flash P/E Disable"]
166 #[inline(always)]
167 #[must_use]
168 pub fn rpdis(&mut self) -> RPDIS_W<3> {
169 RPDIS_W::new(self)
170 }
171 #[doc = "Bit 4 - Flash Operating Mode Select 1"]
172 #[inline(always)]
173 #[must_use]
174 pub fn fms1(&mut self) -> FMS1_W<4> {
175 FMS1_W::new(self)
176 }
177 #[doc = "Writes raw bits to the register."]
178 #[inline(always)]
179 pub unsafe fn bits(&mut self, bits: u8) -> &mut Self {
180 self.0.bits(bits);
181 self
182 }
183}
184#[doc = "Flash P/E Mode Control 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 [fpmcr](index.html) module"]
185pub struct FPMCR_SPEC;
186impl crate::RegisterSpec for FPMCR_SPEC {
187 type Ux = u8;
188}
189#[doc = "`read()` method returns [fpmcr::R](R) reader structure"]
190impl crate::Readable for FPMCR_SPEC {
191 type Reader = R;
192}
193#[doc = "`write(|w| ..)` method takes [fpmcr::W](W) writer structure"]
194impl crate::Writable for FPMCR_SPEC {
195 type Writer = W;
196 const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
197 const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
198}
199#[doc = "`reset()` method sets FPMCR to value 0x08"]
200impl crate::Resettable for FPMCR_SPEC {
201 const RESET_VALUE: Self::Ux = 0x08;
202}