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