efm32pg22_pac/efm32pg22c200/lfrco_s/
lock.rs1#[doc = "Register `LOCK` writer"]
2pub struct W(crate::W<LOCK_SPEC>);
3impl core::ops::Deref for W {
4 type Target = crate::W<LOCK_SPEC>;
5 #[inline(always)]
6 fn deref(&self) -> &Self::Target {
7 &self.0
8 }
9}
10impl core::ops::DerefMut for W {
11 #[inline(always)]
12 fn deref_mut(&mut self) -> &mut Self::Target {
13 &mut self.0
14 }
15}
16impl From<crate::W<LOCK_SPEC>> for W {
17 #[inline(always)]
18 fn from(writer: crate::W<LOCK_SPEC>) -> Self {
19 W(writer)
20 }
21}
22#[doc = "Lock Key\n\nValue on reset: 0"]
23#[derive(Clone, Copy, Debug, PartialEq, Eq)]
24#[repr(u16)]
25pub enum LOCKKEY_AW {
26 #[doc = "0: Lock Configuration Registers"]
27 LOCK = 0,
28 #[doc = "3987: Unlock Configuration Registers"]
29 UNLOCK = 3987,
30}
31impl From<LOCKKEY_AW> for u16 {
32 #[inline(always)]
33 fn from(variant: LOCKKEY_AW) -> Self {
34 variant as _
35 }
36}
37#[doc = "Field `LOCKKEY` writer - Lock Key"]
38pub type LOCKKEY_W<'a, const O: u8> =
39 crate::FieldWriter<'a, u32, LOCK_SPEC, u16, LOCKKEY_AW, 16, O>;
40impl<'a, const O: u8> LOCKKEY_W<'a, O> {
41 #[doc = "Lock Configuration Registers"]
42 #[inline(always)]
43 pub fn lock(self) -> &'a mut W {
44 self.variant(LOCKKEY_AW::LOCK)
45 }
46 #[doc = "Unlock Configuration Registers"]
47 #[inline(always)]
48 pub fn unlock(self) -> &'a mut W {
49 self.variant(LOCKKEY_AW::UNLOCK)
50 }
51}
52impl W {
53 #[doc = "Bits 0:15 - Lock Key"]
54 #[inline(always)]
55 #[must_use]
56 pub fn lockkey(&mut self) -> LOCKKEY_W<0> {
57 LOCKKEY_W::new(self)
58 }
59 #[doc = "Writes raw bits to the register."]
60 #[inline(always)]
61 pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
62 self.0.bits(bits);
63 self
64 }
65}
66#[doc = "Configuration lock register. Locks and unlocks access to configuration registers.\n\nThis register you can [`write_with_zero`](crate::generic::Reg::write_with_zero), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [lock](index.html) module"]
67pub struct LOCK_SPEC;
68impl crate::RegisterSpec for LOCK_SPEC {
69 type Ux = u32;
70}
71#[doc = "`write(|w| ..)` method takes [lock::W](W) writer structure"]
72impl crate::Writable for LOCK_SPEC {
73 type Writer = W;
74 const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
75 const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
76}
77#[doc = "`reset()` method sets LOCK to value 0"]
78impl crate::Resettable for LOCK_SPEC {
79 const RESET_VALUE: Self::Ux = 0;
80}