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