1#[doc = "Reader of register FPROT%s"]
2pub type R = crate::R<u8, super::FPROT>;
3#[doc = "Writer for register FPROT%s"]
4pub type W = crate::W<u8, super::FPROT>;
5#[doc = "Register FPROT%s `reset()`'s with value 0"]
6impl crate::ResetValue for super::FPROT {
7 type Type = u8;
8 #[inline(always)]
9 fn reset_value() -> Self::Type {
10 0
11 }
12}
13#[doc = "Program Flash Region Protect\n\nValue on reset: 0"]
14#[derive(Clone, Copy, Debug, PartialEq)]
15pub enum PROT_A {
16 #[doc = "0: Program flash region is protected."]
17 _0,
18 #[doc = "1: Program flash region is not protected"]
19 _1,
20}
21impl From<PROT_A> for u8 {
22 #[inline(always)]
23 fn from(variant: PROT_A) -> Self {
24 match variant {
25 PROT_A::_0 => 0,
26 PROT_A::_1 => 1,
27 }
28 }
29}
30#[doc = "Reader of field `PROT`"]
31pub type PROT_R = crate::R<u8, PROT_A>;
32impl PROT_R {
33 #[doc = r"Get enumerated values variant"]
34 #[inline(always)]
35 pub fn variant(&self) -> crate::Variant<u8, PROT_A> {
36 use crate::Variant::*;
37 match self.bits {
38 0 => Val(PROT_A::_0),
39 1 => Val(PROT_A::_1),
40 i => Res(i),
41 }
42 }
43 #[doc = "Checks if the value of the field is `_0`"]
44 #[inline(always)]
45 pub fn is_0(&self) -> bool {
46 *self == PROT_A::_0
47 }
48 #[doc = "Checks if the value of the field is `_1`"]
49 #[inline(always)]
50 pub fn is_1(&self) -> bool {
51 *self == PROT_A::_1
52 }
53}
54#[doc = "Write proxy for field `PROT`"]
55pub struct PROT_W<'a> {
56 w: &'a mut W,
57}
58impl<'a> PROT_W<'a> {
59 #[doc = r"Writes `variant` to the field"]
60 #[inline(always)]
61 pub fn variant(self, variant: PROT_A) -> &'a mut W {
62 unsafe { self.bits(variant.into()) }
63 }
64 #[doc = "Program flash region is protected."]
65 #[inline(always)]
66 pub fn _0(self) -> &'a mut W {
67 self.variant(PROT_A::_0)
68 }
69 #[doc = "Program flash region is not protected"]
70 #[inline(always)]
71 pub fn _1(self) -> &'a mut W {
72 self.variant(PROT_A::_1)
73 }
74 #[doc = r"Writes raw bits to the field"]
75 #[inline(always)]
76 pub unsafe fn bits(self, value: u8) -> &'a mut W {
77 self.w.bits = (self.w.bits & !0xff) | ((value as u8) & 0xff);
78 self.w
79 }
80}
81impl R {
82 #[doc = "Bits 0:7 - Program Flash Region Protect"]
83 #[inline(always)]
84 pub fn prot(&self) -> PROT_R {
85 PROT_R::new((self.bits & 0xff) as u8)
86 }
87}
88impl W {
89 #[doc = "Bits 0:7 - Program Flash Region Protect"]
90 #[inline(always)]
91 pub fn prot(&mut self) -> PROT_W {
92 PROT_W { w: self }
93 }
94}