1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195
#[doc = "Reader of register PASSWD"] pub type R = crate::R<u32, super::PASSWD>; #[doc = "Writer for register PASSWD"] pub type W = crate::W<u32, super::PASSWD>; #[doc = "Register PASSWD `reset()`'s with value 0x07"] impl crate::ResetValue for super::PASSWD { type Type = u32; #[inline(always)] fn reset_value() -> Self::Type { 0x07 } } #[doc = "Bit Protection Scheme Control Bits\n\nValue on reset: 3"] #[derive(Clone, Copy, Debug, PartialEq)] pub enum MODE_A { #[doc = "0: Scheme disabled - direct access to the protected bits is allowed."] VALUE1, #[doc = "3: Scheme enabled - the bit field PASS has to be written with the passwords to open and close the access to the protected bits. (Default)"] VALUE2, } impl From<MODE_A> for u8 { #[inline(always)] fn from(variant: MODE_A) -> Self { match variant { MODE_A::VALUE1 => 0, MODE_A::VALUE2 => 3, } } } #[doc = "Reader of field `MODE`"] pub type MODE_R = crate::R<u8, MODE_A>; impl MODE_R { #[doc = r"Get enumerated values variant"] #[inline(always)] pub fn variant(&self) -> crate::Variant<u8, MODE_A> { use crate::Variant::*; match self.bits { 0 => Val(MODE_A::VALUE1), 3 => Val(MODE_A::VALUE2), i => Res(i), } } #[doc = "Checks if the value of the field is `VALUE1`"] #[inline(always)] pub fn is_value1(&self) -> bool { *self == MODE_A::VALUE1 } #[doc = "Checks if the value of the field is `VALUE2`"] #[inline(always)] pub fn is_value2(&self) -> bool { *self == MODE_A::VALUE2 } } #[doc = "Write proxy for field `MODE`"] pub struct MODE_W<'a> { w: &'a mut W, } impl<'a> MODE_W<'a> { #[doc = r"Writes `variant` to the field"] #[inline(always)] pub fn variant(self, variant: MODE_A) -> &'a mut W { unsafe { self.bits(variant.into()) } } #[doc = "Scheme disabled - direct access to the protected bits is allowed."] #[inline(always)] pub fn value1(self) -> &'a mut W { self.variant(MODE_A::VALUE1) } #[doc = "Scheme enabled - the bit field PASS has to be written with the passwords to open and close the access to the protected bits. (Default)"] #[inline(always)] pub fn value2(self) -> &'a mut W { self.variant(MODE_A::VALUE2) } #[doc = r"Writes raw bits to the field"] #[inline(always)] pub unsafe fn bits(self, value: u8) -> &'a mut W { self.w.bits = (self.w.bits & !0x03) | ((value as u32) & 0x03); self.w } } #[doc = "Bit Protection Signal Status Bit\n\nValue on reset: 1"] #[derive(Clone, Copy, Debug, PartialEq)] pub enum PROTS_A { #[doc = "0: Software is able to write to all protected bits."] VALUE1, #[doc = "1: Software is unable to write to any of the protected bits."] VALUE2, } impl From<PROTS_A> for bool { #[inline(always)] fn from(variant: PROTS_A) -> Self { match variant { PROTS_A::VALUE1 => false, PROTS_A::VALUE2 => true, } } } #[doc = "Reader of field `PROTS`"] pub type PROTS_R = crate::R<bool, PROTS_A>; impl PROTS_R { #[doc = r"Get enumerated values variant"] #[inline(always)] pub fn variant(&self) -> PROTS_A { match self.bits { false => PROTS_A::VALUE1, true => PROTS_A::VALUE2, } } #[doc = "Checks if the value of the field is `VALUE1`"] #[inline(always)] pub fn is_value1(&self) -> bool { *self == PROTS_A::VALUE1 } #[doc = "Checks if the value of the field is `VALUE2`"] #[inline(always)] pub fn is_value2(&self) -> bool { *self == PROTS_A::VALUE2 } } #[doc = "Password Bits\n\nValue on reset: 0"] #[derive(Clone, Copy, Debug, PartialEq)] pub enum PASS_AW { #[doc = "24: Enables writing of the bit field MODE."] VALUE1, #[doc = "19: Opens access to writing of all protected bits."] VALUE2, #[doc = "21: Closes access to writing of all protected bits."] VALUE3, } impl From<PASS_AW> for u8 { #[inline(always)] fn from(variant: PASS_AW) -> Self { match variant { PASS_AW::VALUE1 => 24, PASS_AW::VALUE2 => 19, PASS_AW::VALUE3 => 21, } } } #[doc = "Write proxy for field `PASS`"] pub struct PASS_W<'a> { w: &'a mut W, } impl<'a> PASS_W<'a> { #[doc = r"Writes `variant` to the field"] #[inline(always)] pub fn variant(self, variant: PASS_AW) -> &'a mut W { unsafe { self.bits(variant.into()) } } #[doc = "Enables writing of the bit field MODE."] #[inline(always)] pub fn value1(self) -> &'a mut W { self.variant(PASS_AW::VALUE1) } #[doc = "Opens access to writing of all protected bits."] #[inline(always)] pub fn value2(self) -> &'a mut W { self.variant(PASS_AW::VALUE2) } #[doc = "Closes access to writing of all protected bits."] #[inline(always)] pub fn value3(self) -> &'a mut W { self.variant(PASS_AW::VALUE3) } #[doc = r"Writes raw bits to the field"] #[inline(always)] pub unsafe fn bits(self, value: u8) -> &'a mut W { self.w.bits = (self.w.bits & !(0x1f << 3)) | (((value as u32) & 0x1f) << 3); self.w } } impl R { #[doc = "Bits 0:1 - Bit Protection Scheme Control Bits"] #[inline(always)] pub fn mode(&self) -> MODE_R { MODE_R::new((self.bits & 0x03) as u8) } #[doc = "Bit 2 - Bit Protection Signal Status Bit"] #[inline(always)] pub fn prots(&self) -> PROTS_R { PROTS_R::new(((self.bits >> 2) & 0x01) != 0) } } impl W { #[doc = "Bits 0:1 - Bit Protection Scheme Control Bits"] #[inline(always)] pub fn mode(&mut self) -> MODE_W { MODE_W { w: self } } #[doc = "Bits 3:7 - Password Bits"] #[inline(always)] pub fn pass(&mut self) -> PASS_W { PASS_W { w: self } } }