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 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251
#[doc = "Reader of register CFGR1"] pub type R = crate::R<u32, super::CFGR1>; #[doc = "Writer for register CFGR1"] pub type W = crate::W<u32, super::CFGR1>; #[doc = "Register CFGR1 `reset()`'s with value 0"] impl crate::ResetValue for super::CFGR1 { type Type = u32; #[inline(always)] fn reset_value() -> Self::Type { 0 } } #[doc = "Boot mode selected by the boot pins status bits\n\nValue on reset: 0"] #[derive(Clone, Copy, Debug, PartialEq)] pub enum BOOT_MODE_A { #[doc = "0: Main Flash memory boot mode"] MAINFLASH, #[doc = "1: System Flash memory boot mode"] SYSTEMFLASH, #[doc = "3: Embedded SRAM boot mode"] SRAM, } impl From<BOOT_MODE_A> for u8 { #[inline(always)] fn from(variant: BOOT_MODE_A) -> Self { match variant { BOOT_MODE_A::MAINFLASH => 0, BOOT_MODE_A::SYSTEMFLASH => 1, BOOT_MODE_A::SRAM => 3, } } } #[doc = "Reader of field `BOOT_MODE`"] pub type BOOT_MODE_R = crate::R<u8, BOOT_MODE_A>; impl BOOT_MODE_R { #[doc = r"Get enumerated values variant"] #[inline(always)] pub fn variant(&self) -> crate::Variant<u8, BOOT_MODE_A> { use crate::Variant::*; match self.bits { 0 => Val(BOOT_MODE_A::MAINFLASH), 1 => Val(BOOT_MODE_A::SYSTEMFLASH), 3 => Val(BOOT_MODE_A::SRAM), i => Res(i), } } #[doc = "Checks if the value of the field is `MAINFLASH`"] #[inline(always)] pub fn is_main_flash(&self) -> bool { *self == BOOT_MODE_A::MAINFLASH } #[doc = "Checks if the value of the field is `SYSTEMFLASH`"] #[inline(always)] pub fn is_system_flash(&self) -> bool { *self == BOOT_MODE_A::SYSTEMFLASH } #[doc = "Checks if the value of the field is `SRAM`"] #[inline(always)] pub fn is_sram(&self) -> bool { *self == BOOT_MODE_A::SRAM } } #[doc = "Memory mapping selection bits\n\nValue on reset: 0"] #[derive(Clone, Copy, Debug, PartialEq)] pub enum MEM_MODE_A { #[doc = "0: Main Flash memory mapped at 0x0000_0000"] MAINFLASH, #[doc = "1: System Flash memory mapped at 0x0000_0000"] SYSTEMFLASH, #[doc = "3: Embedded SRAM mapped at 0x0000_0000"] SRAM, } impl From<MEM_MODE_A> for u8 { #[inline(always)] fn from(variant: MEM_MODE_A) -> Self { match variant { MEM_MODE_A::MAINFLASH => 0, MEM_MODE_A::SYSTEMFLASH => 1, MEM_MODE_A::SRAM => 3, } } } #[doc = "Reader of field `MEM_MODE`"] pub type MEM_MODE_R = crate::R<u8, MEM_MODE_A>; impl MEM_MODE_R { #[doc = r"Get enumerated values variant"] #[inline(always)] pub fn variant(&self) -> crate::Variant<u8, MEM_MODE_A> { use crate::Variant::*; match self.bits { 0 => Val(MEM_MODE_A::MAINFLASH), 1 => Val(MEM_MODE_A::SYSTEMFLASH), 3 => Val(MEM_MODE_A::SRAM), i => Res(i), } } #[doc = "Checks if the value of the field is `MAINFLASH`"] #[inline(always)] pub fn is_main_flash(&self) -> bool { *self == MEM_MODE_A::MAINFLASH } #[doc = "Checks if the value of the field is `SYSTEMFLASH`"] #[inline(always)] pub fn is_system_flash(&self) -> bool { *self == MEM_MODE_A::SYSTEMFLASH } #[doc = "Checks if the value of the field is `SRAM`"] #[inline(always)] pub fn is_sram(&self) -> bool { *self == MEM_MODE_A::SRAM } } #[doc = "Write proxy for field `MEM_MODE`"] pub struct MEM_MODE_W<'a> { w: &'a mut W, } impl<'a> MEM_MODE_W<'a> { #[doc = r"Writes `variant` to the field"] #[inline(always)] pub fn variant(self, variant: MEM_MODE_A) -> &'a mut W { unsafe { self.bits(variant.into()) } } #[doc = "Main Flash memory mapped at 0x0000_0000"] #[inline(always)] pub fn main_flash(self) -> &'a mut W { self.variant(MEM_MODE_A::MAINFLASH) } #[doc = "System Flash memory mapped at 0x0000_0000"] #[inline(always)] pub fn system_flash(self) -> &'a mut W { self.variant(MEM_MODE_A::SYSTEMFLASH) } #[doc = "Embedded SRAM mapped at 0x0000_0000"] #[inline(always)] pub fn sram(self) -> &'a mut W { self.variant(MEM_MODE_A::SRAM) } #[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 = "User bank swapping\n\nValue on reset: 0"] #[derive(Clone, Copy, Debug, PartialEq)] pub enum UFB_A { #[doc = "0: Flash Program memory Bank 1 is mapped at 0x0800 0000 (and aliased at 0x0000 0000 if MEM_MODE=00) and Data EEPROM Bank 1 at 0x0808 0000 (aliased at 0x0008 0000 if MEM_MODE=00)"] BANK1, #[doc = "1: Flash Program memory Bank 2 is mapped at 0x0800 0000 (and aliased at 0x0000 0000 if MEM_MODE=00) and Data EEPROM Bank 2 at 0x0808 0000 (and aliased at 0x0008 0000 if MEM_MODE=00)"] BANK2, } impl From<UFB_A> for bool { #[inline(always)] fn from(variant: UFB_A) -> Self { match variant { UFB_A::BANK1 => false, UFB_A::BANK2 => true, } } } #[doc = "Reader of field `UFB`"] pub type UFB_R = crate::R<bool, UFB_A>; impl UFB_R { #[doc = r"Get enumerated values variant"] #[inline(always)] pub fn variant(&self) -> UFB_A { match self.bits { false => UFB_A::BANK1, true => UFB_A::BANK2, } } #[doc = "Checks if the value of the field is `BANK1`"] #[inline(always)] pub fn is_bank1(&self) -> bool { *self == UFB_A::BANK1 } #[doc = "Checks if the value of the field is `BANK2`"] #[inline(always)] pub fn is_bank2(&self) -> bool { *self == UFB_A::BANK2 } } #[doc = "Write proxy for field `UFB`"] pub struct UFB_W<'a> { w: &'a mut W, } impl<'a> UFB_W<'a> { #[doc = r"Writes `variant` to the field"] #[inline(always)] pub fn variant(self, variant: UFB_A) -> &'a mut W { { self.bit(variant.into()) } } #[doc = "Flash Program memory Bank 1 is mapped at 0x0800 0000 (and aliased at 0x0000 0000 if MEM_MODE=00) and Data EEPROM Bank 1 at 0x0808 0000 (aliased at 0x0008 0000 if MEM_MODE=00)"] #[inline(always)] pub fn bank1(self) -> &'a mut W { self.variant(UFB_A::BANK1) } #[doc = "Flash Program memory Bank 2 is mapped at 0x0800 0000 (and aliased at 0x0000 0000 if MEM_MODE=00) and Data EEPROM Bank 2 at 0x0808 0000 (and aliased at 0x0008 0000 if MEM_MODE=00)"] #[inline(always)] pub fn bank2(self) -> &'a mut W { self.variant(UFB_A::BANK2) } #[doc = r"Sets the field bit"] #[inline(always)] pub fn set_bit(self) -> &'a mut W { self.bit(true) } #[doc = r"Clears the field bit"] #[inline(always)] pub fn clear_bit(self) -> &'a mut W { self.bit(false) } #[doc = r"Writes raw bits to the field"] #[inline(always)] pub fn bit(self, value: bool) -> &'a mut W { self.w.bits = (self.w.bits & !(0x01 << 3)) | (((value as u32) & 0x01) << 3); self.w } } impl R { #[doc = "Bits 8:9 - Boot mode selected by the boot pins status bits"] #[inline(always)] pub fn boot_mode(&self) -> BOOT_MODE_R { BOOT_MODE_R::new(((self.bits >> 8) & 0x03) as u8) } #[doc = "Bits 0:1 - Memory mapping selection bits"] #[inline(always)] pub fn mem_mode(&self) -> MEM_MODE_R { MEM_MODE_R::new((self.bits & 0x03) as u8) } #[doc = "Bit 3 - User bank swapping"] #[inline(always)] pub fn ufb(&self) -> UFB_R { UFB_R::new(((self.bits >> 3) & 0x01) != 0) } } impl W { #[doc = "Bits 0:1 - Memory mapping selection bits"] #[inline(always)] pub fn mem_mode(&mut self) -> MEM_MODE_W { MEM_MODE_W { w: self } } #[doc = "Bit 3 - User bank swapping"] #[inline(always)] pub fn ufb(&mut self) -> UFB_W { UFB_W { w: self } } }