efm32gg12b810/emu/
pwrlock.rs1#[doc = "Reader of register PWRLOCK"]
2pub type R = crate::R<u32, super::PWRLOCK>;
3#[doc = "Writer for register PWRLOCK"]
4pub type W = crate::W<u32, super::PWRLOCK>;
5#[doc = "Register PWRLOCK `reset()`'s with value 0"]
6impl crate::ResetValue for super::PWRLOCK {
7 type Type = u32;
8 #[inline(always)]
9 fn reset_value() -> Self::Type {
10 0
11 }
12}
13#[doc = "Regulator and Supply Configuration Lock Key\n\nValue on reset: 0"]
14#[derive(Clone, Copy, Debug, PartialEq)]
15#[repr(u16)]
16pub enum LOCKKEY_A {
17 #[doc = "0: `0`"]
18 UNLOCKED = 0,
19 #[doc = "1: `1`"]
20 LOCKED = 1,
21}
22impl From<LOCKKEY_A> for u16 {
23 #[inline(always)]
24 fn from(variant: LOCKKEY_A) -> Self {
25 variant as _
26 }
27}
28#[doc = "Reader of field `LOCKKEY`"]
29pub type LOCKKEY_R = crate::R<u16, LOCKKEY_A>;
30impl LOCKKEY_R {
31 #[doc = r"Get enumerated values variant"]
32 #[inline(always)]
33 pub fn variant(&self) -> crate::Variant<u16, LOCKKEY_A> {
34 use crate::Variant::*;
35 match self.bits {
36 0 => Val(LOCKKEY_A::UNLOCKED),
37 1 => Val(LOCKKEY_A::LOCKED),
38 i => Res(i),
39 }
40 }
41 #[doc = "Checks if the value of the field is `UNLOCKED`"]
42 #[inline(always)]
43 pub fn is_unlocked(&self) -> bool {
44 *self == LOCKKEY_A::UNLOCKED
45 }
46 #[doc = "Checks if the value of the field is `LOCKED`"]
47 #[inline(always)]
48 pub fn is_locked(&self) -> bool {
49 *self == LOCKKEY_A::LOCKED
50 }
51}
52#[doc = "Write proxy for field `LOCKKEY`"]
53pub struct LOCKKEY_W<'a> {
54 w: &'a mut W,
55}
56impl<'a> LOCKKEY_W<'a> {
57 #[doc = r"Writes `variant` to the field"]
58 #[inline(always)]
59 pub fn variant(self, variant: LOCKKEY_A) -> &'a mut W {
60 unsafe { self.bits(variant.into()) }
61 }
62 #[doc = "`0`"]
63 #[inline(always)]
64 pub fn unlocked(self) -> &'a mut W {
65 self.variant(LOCKKEY_A::UNLOCKED)
66 }
67 #[doc = "`1`"]
68 #[inline(always)]
69 pub fn locked(self) -> &'a mut W {
70 self.variant(LOCKKEY_A::LOCKED)
71 }
72 #[doc = r"Writes raw bits to the field"]
73 #[inline(always)]
74 pub unsafe fn bits(self, value: u16) -> &'a mut W {
75 self.w.bits = (self.w.bits & !0xffff) | ((value as u32) & 0xffff);
76 self.w
77 }
78}
79impl R {
80 #[doc = "Bits 0:15 - Regulator and Supply Configuration Lock Key"]
81 #[inline(always)]
82 pub fn lockkey(&self) -> LOCKKEY_R {
83 LOCKKEY_R::new((self.bits & 0xffff) as u16)
84 }
85}
86impl W {
87 #[doc = "Bits 0:15 - Regulator and Supply Configuration Lock Key"]
88 #[inline(always)]
89 pub fn lockkey(&mut self) -> LOCKKEY_W {
90 LOCKKEY_W { w: self }
91 }
92}