1#[doc = "Register `FMEPROT` reader"]
2pub struct R(crate::R<FMEPROT_SPEC>);
3impl core::ops::Deref for R {
4 type Target = crate::R<FMEPROT_SPEC>;
5 #[inline(always)]
6 fn deref(&self) -> &Self::Target {
7 &self.0
8 }
9}
10impl From<crate::R<FMEPROT_SPEC>> for R {
11 #[inline(always)]
12 fn from(reader: crate::R<FMEPROT_SPEC>) -> Self {
13 R(reader)
14 }
15}
16#[doc = "Register `FMEPROT` writer"]
17pub struct W(crate::W<FMEPROT_SPEC>);
18impl core::ops::Deref for W {
19 type Target = crate::W<FMEPROT_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<FMEPROT_SPEC>> for W {
32 #[inline(always)]
33 fn from(writer: crate::W<FMEPROT_SPEC>) -> Self {
34 W(writer)
35 }
36}
37#[doc = "Field `CEPROT` reader - Code Flash P/E Mode Entry Protection"]
38pub type CEPROT_R = crate::BitReader<CEPROT_A>;
39#[doc = "Code Flash P/E Mode Entry Protection\n\nValue on reset: 1"]
40#[derive(Clone, Copy, Debug, PartialEq, Eq)]
41pub enum CEPROT_A {
42 #[doc = "0: FENTRYC bit is not protected"]
43 _0 = 0,
44 #[doc = "1: FENTRYC bit is protected."]
45 _1 = 1,
46}
47impl From<CEPROT_A> for bool {
48 #[inline(always)]
49 fn from(variant: CEPROT_A) -> Self {
50 variant as u8 != 0
51 }
52}
53impl CEPROT_R {
54 #[doc = "Get enumerated values variant"]
55 #[inline(always)]
56 pub fn variant(&self) -> CEPROT_A {
57 match self.bits {
58 false => CEPROT_A::_0,
59 true => CEPROT_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 == CEPROT_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 == CEPROT_A::_1
71 }
72}
73#[doc = "Field `CEPROT` writer - Code Flash P/E Mode Entry Protection"]
74pub type CEPROT_W<'a, const O: u8> = crate::BitWriter<'a, u16, FMEPROT_SPEC, CEPROT_A, O>;
75impl<'a, const O: u8> CEPROT_W<'a, O> {
76 #[doc = "FENTRYC bit is not protected"]
77 #[inline(always)]
78 pub fn _0(self) -> &'a mut W {
79 self.variant(CEPROT_A::_0)
80 }
81 #[doc = "FENTRYC bit is protected."]
82 #[inline(always)]
83 pub fn _1(self) -> &'a mut W {
84 self.variant(CEPROT_A::_1)
85 }
86}
87#[doc = "Field `KEY` writer - Key Code"]
88pub type KEY_W<'a, const O: u8> = crate::FieldWriter<'a, u16, FMEPROT_SPEC, u8, u8, 8, O>;
89impl R {
90 #[doc = "Bit 0 - Code Flash P/E Mode Entry Protection"]
91 #[inline(always)]
92 pub fn ceprot(&self) -> CEPROT_R {
93 CEPROT_R::new((self.bits & 1) != 0)
94 }
95}
96impl W {
97 #[doc = "Bit 0 - Code Flash P/E Mode Entry Protection"]
98 #[inline(always)]
99 #[must_use]
100 pub fn ceprot(&mut self) -> CEPROT_W<0> {
101 CEPROT_W::new(self)
102 }
103 #[doc = "Bits 8:15 - Key Code"]
104 #[inline(always)]
105 #[must_use]
106 pub fn key(&mut self) -> KEY_W<8> {
107 KEY_W::new(self)
108 }
109 #[doc = "Writes raw bits to the register."]
110 #[inline(always)]
111 pub unsafe fn bits(&mut self, bits: u16) -> &mut Self {
112 self.0.bits(bits);
113 self
114 }
115}
116#[doc = "Flash P/E Mode Entry Protection 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 [fmeprot](index.html) module"]
117pub struct FMEPROT_SPEC;
118impl crate::RegisterSpec for FMEPROT_SPEC {
119 type Ux = u16;
120}
121#[doc = "`read()` method returns [fmeprot::R](R) reader structure"]
122impl crate::Readable for FMEPROT_SPEC {
123 type Reader = R;
124}
125#[doc = "`write(|w| ..)` method takes [fmeprot::W](W) writer structure"]
126impl crate::Writable for FMEPROT_SPEC {
127 type Writer = W;
128 const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
129 const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
130}
131#[doc = "`reset()` method sets FMEPROT to value 0x01"]
132impl crate::Resettable for FMEPROT_SPEC {
133 const RESET_VALUE: Self::Ux = 0x01;
134}