efm32gg12b510_pac/msc/
bankswitchlock.rs1#[doc = "Register `BANKSWITCHLOCK` reader"]
2pub struct R(crate::R<BANKSWITCHLOCK_SPEC>);
3impl core::ops::Deref for R {
4 type Target = crate::R<BANKSWITCHLOCK_SPEC>;
5 #[inline(always)]
6 fn deref(&self) -> &Self::Target {
7 &self.0
8 }
9}
10impl From<crate::R<BANKSWITCHLOCK_SPEC>> for R {
11 #[inline(always)]
12 fn from(reader: crate::R<BANKSWITCHLOCK_SPEC>) -> Self {
13 R(reader)
14 }
15}
16#[doc = "Register `BANKSWITCHLOCK` writer"]
17pub struct W(crate::W<BANKSWITCHLOCK_SPEC>);
18impl core::ops::Deref for W {
19 type Target = crate::W<BANKSWITCHLOCK_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<BANKSWITCHLOCK_SPEC>> for W {
32 #[inline(always)]
33 fn from(writer: crate::W<BANKSWITCHLOCK_SPEC>) -> Self {
34 W(writer)
35 }
36}
37#[doc = "Bank Switching Lock\n\nValue on reset: 1"]
38#[derive(Clone, Copy, Debug, PartialEq)]
39#[repr(u16)]
40pub enum BANKSWITCHLOCKKEY_A {
41 #[doc = "0: `0`"]
42 UNLOCKED = 0,
43 #[doc = "1: `1`"]
44 LOCKED = 1,
45}
46impl From<BANKSWITCHLOCKKEY_A> for u16 {
47 #[inline(always)]
48 fn from(variant: BANKSWITCHLOCKKEY_A) -> Self {
49 variant as _
50 }
51}
52#[doc = "Field `BANKSWITCHLOCKKEY` reader - Bank Switching Lock"]
53pub type BANKSWITCHLOCKKEY_R = crate::FieldReader<u16, BANKSWITCHLOCKKEY_A>;
54impl BANKSWITCHLOCKKEY_R {
55 #[doc = "Get enumerated values variant"]
56 #[inline(always)]
57 pub fn variant(&self) -> Option<BANKSWITCHLOCKKEY_A> {
58 match self.bits {
59 0 => Some(BANKSWITCHLOCKKEY_A::UNLOCKED),
60 1 => Some(BANKSWITCHLOCKKEY_A::LOCKED),
61 _ => None,
62 }
63 }
64 #[doc = "Checks if the value of the field is `UNLOCKED`"]
65 #[inline(always)]
66 pub fn is_unlocked(&self) -> bool {
67 *self == BANKSWITCHLOCKKEY_A::UNLOCKED
68 }
69 #[doc = "Checks if the value of the field is `LOCKED`"]
70 #[inline(always)]
71 pub fn is_locked(&self) -> bool {
72 *self == BANKSWITCHLOCKKEY_A::LOCKED
73 }
74}
75#[doc = "Field `BANKSWITCHLOCKKEY` writer - Bank Switching Lock"]
76pub type BANKSWITCHLOCKKEY_W<'a> =
77 crate::FieldWriter<'a, u32, BANKSWITCHLOCK_SPEC, u16, BANKSWITCHLOCKKEY_A, 16, 0>;
78impl<'a> BANKSWITCHLOCKKEY_W<'a> {
79 #[doc = "`0`"]
80 #[inline(always)]
81 pub fn unlocked(self) -> &'a mut W {
82 self.variant(BANKSWITCHLOCKKEY_A::UNLOCKED)
83 }
84 #[doc = "`1`"]
85 #[inline(always)]
86 pub fn locked(self) -> &'a mut W {
87 self.variant(BANKSWITCHLOCKKEY_A::LOCKED)
88 }
89}
90impl R {
91 #[doc = "Bits 0:15 - Bank Switching Lock"]
92 #[inline(always)]
93 pub fn bankswitchlockkey(&self) -> BANKSWITCHLOCKKEY_R {
94 BANKSWITCHLOCKKEY_R::new((self.bits & 0xffff) as u16)
95 }
96}
97impl W {
98 #[doc = "Bits 0:15 - Bank Switching Lock"]
99 #[inline(always)]
100 pub fn bankswitchlockkey(&mut self) -> BANKSWITCHLOCKKEY_W {
101 BANKSWITCHLOCKKEY_W::new(self)
102 }
103 #[doc = "Writes raw bits to the register."]
104 #[inline(always)]
105 pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
106 self.0.bits(bits);
107 self
108 }
109}
110#[doc = "Bank Switching Lock 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 [bankswitchlock](index.html) module"]
111pub struct BANKSWITCHLOCK_SPEC;
112impl crate::RegisterSpec for BANKSWITCHLOCK_SPEC {
113 type Ux = u32;
114}
115#[doc = "`read()` method returns [bankswitchlock::R](R) reader structure"]
116impl crate::Readable for BANKSWITCHLOCK_SPEC {
117 type Reader = R;
118}
119#[doc = "`write(|w| ..)` method takes [bankswitchlock::W](W) writer structure"]
120impl crate::Writable for BANKSWITCHLOCK_SPEC {
121 type Writer = W;
122}
123#[doc = "`reset()` method sets BANKSWITCHLOCK to value 0x01"]
124impl crate::Resettable for BANKSWITCHLOCK_SPEC {
125 #[inline(always)]
126 fn reset_value() -> Self::Ux {
127 0x01
128 }
129}