eos_s3/misc/
lock_key_ctrl.rs

1#[doc = "Register `LOCK_KEY_CTRL` reader"]
2pub struct R(crate::R<LOCK_KEY_CTRL_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<LOCK_KEY_CTRL_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<LOCK_KEY_CTRL_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<LOCK_KEY_CTRL_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `LOCK_KEY_CTRL` writer"]
17pub struct W(crate::W<LOCK_KEY_CTRL_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<LOCK_KEY_CTRL_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_KEY_CTRL_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<LOCK_KEY_CTRL_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "0: lock disabled, write to register enabled, 1: lock enable, write to register disabled\n\nValue on reset: 1"]
38#[derive(Clone, Copy, Debug, PartialEq)]
39pub enum LOCK_KEY_EN_A {
40    #[doc = "0: Disable lock to allow writing the lock_key field"]
41    LOCK_DISABLE = 0,
42    #[doc = "1: Enable lock to prevent writing the lock_key field"]
43    LOCK_ENABLE = 1,
44}
45impl From<LOCK_KEY_EN_A> for bool {
46    #[inline(always)]
47    fn from(variant: LOCK_KEY_EN_A) -> Self {
48        variant as u8 != 0
49    }
50}
51#[doc = "Field `LOCK_KEY_EN` reader - 0: lock disabled, write to register enabled, 1: lock enable, write to register disabled"]
52pub struct LOCK_KEY_EN_R(crate::FieldReader<bool, LOCK_KEY_EN_A>);
53impl LOCK_KEY_EN_R {
54    #[inline(always)]
55    pub(crate) fn new(bits: bool) -> Self {
56        LOCK_KEY_EN_R(crate::FieldReader::new(bits))
57    }
58    #[doc = r"Get enumerated values variant"]
59    #[inline(always)]
60    pub fn variant(&self) -> LOCK_KEY_EN_A {
61        match self.bits {
62            false => LOCK_KEY_EN_A::LOCK_DISABLE,
63            true => LOCK_KEY_EN_A::LOCK_ENABLE,
64        }
65    }
66    #[doc = "Checks if the value of the field is `LOCK_DISABLE`"]
67    #[inline(always)]
68    pub fn is_lock_disable(&self) -> bool {
69        **self == LOCK_KEY_EN_A::LOCK_DISABLE
70    }
71    #[doc = "Checks if the value of the field is `LOCK_ENABLE`"]
72    #[inline(always)]
73    pub fn is_lock_enable(&self) -> bool {
74        **self == LOCK_KEY_EN_A::LOCK_ENABLE
75    }
76}
77impl core::ops::Deref for LOCK_KEY_EN_R {
78    type Target = crate::FieldReader<bool, LOCK_KEY_EN_A>;
79    #[inline(always)]
80    fn deref(&self) -> &Self::Target {
81        &self.0
82    }
83}
84#[doc = "Field `LOCK_KEY_EN` writer - 0: lock disabled, write to register enabled, 1: lock enable, write to register disabled"]
85pub struct LOCK_KEY_EN_W<'a> {
86    w: &'a mut W,
87}
88impl<'a> LOCK_KEY_EN_W<'a> {
89    #[doc = r"Writes `variant` to the field"]
90    #[inline(always)]
91    pub fn variant(self, variant: LOCK_KEY_EN_A) -> &'a mut W {
92        self.bit(variant.into())
93    }
94    #[doc = "Disable lock to allow writing the lock_key field"]
95    #[inline(always)]
96    pub fn lock_disable(self) -> &'a mut W {
97        self.variant(LOCK_KEY_EN_A::LOCK_DISABLE)
98    }
99    #[doc = "Enable lock to prevent writing the lock_key field"]
100    #[inline(always)]
101    pub fn lock_enable(self) -> &'a mut W {
102        self.variant(LOCK_KEY_EN_A::LOCK_ENABLE)
103    }
104    #[doc = r"Sets the field bit"]
105    #[inline(always)]
106    pub fn set_bit(self) -> &'a mut W {
107        self.bit(true)
108    }
109    #[doc = r"Clears the field bit"]
110    #[inline(always)]
111    pub fn clear_bit(self) -> &'a mut W {
112        self.bit(false)
113    }
114    #[doc = r"Writes raw bits to the field"]
115    #[inline(always)]
116    pub fn bit(self, value: bool) -> &'a mut W {
117        self.w.bits = (self.w.bits & !0x01) | (value as u32 & 0x01);
118        self.w
119    }
120}
121#[doc = "Field `LOCK_KEY` writer - Enable write access to all below registers by writing 0x1ACCE551. Disable write access by writing any other value. M4 WDT Intr/reset clear - 0x4000_4830\\[4:3\\], M4 WDT Intr/reset enable AP - 0x4000_4834\\[4:3\\], Pad #43 (AP_INTR) - 0x40004CAC\\[12:0\\], M4 Low Power Configuration - 0x40004484\\[1:0\\], M4 WDT Clock Gate - 0x40004054\\[0\\]"]
122pub struct LOCK_KEY_W<'a> {
123    w: &'a mut W,
124}
125impl<'a> LOCK_KEY_W<'a> {
126    #[doc = r"Writes raw bits to the field"]
127    #[inline(always)]
128    pub unsafe fn bits(self, value: u32) -> &'a mut W {
129        self.w.bits = (self.w.bits & !(0x7fff_ffff << 1))
130            | ((value as u32 & 0x7fff_ffff) << 1);
131        self.w
132    }
133}
134impl R {
135    #[doc = "Bit 0 - 0: lock disabled, write to register enabled, 1: lock enable, write to register disabled"]
136    #[inline(always)]
137    pub fn lock_key_en(&self) -> LOCK_KEY_EN_R {
138        LOCK_KEY_EN_R::new((self.bits & 0x01) != 0)
139    }
140}
141impl W {
142    #[doc = "Bit 0 - 0: lock disabled, write to register enabled, 1: lock enable, write to register disabled"]
143    #[inline(always)]
144    pub fn lock_key_en(&mut self) -> LOCK_KEY_EN_W {
145        LOCK_KEY_EN_W { w: self }
146    }
147    #[doc = "Bits 1:31 - Enable write access to all below registers by writing 0x1ACCE551. Disable write access by writing any other value. M4 WDT Intr/reset clear - 0x4000_4830\\[4:3\\], M4 WDT Intr/reset enable AP - 0x4000_4834\\[4:3\\], Pad #43 (AP_INTR) - 0x40004CAC\\[12:0\\], M4 Low Power Configuration - 0x40004484\\[1:0\\], M4 WDT Clock Gate - 0x40004054\\[0\\]"]
148    #[inline(always)]
149    pub fn lock_key(&mut self) -> LOCK_KEY_W {
150        LOCK_KEY_W { w: self }
151    }
152    #[doc = "Writes raw bits to the register."]
153    #[inline(always)]
154    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
155        self.0.bits(bits);
156        self
157    }
158}
159#[doc = "Control value and status of LOCK_KEY\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_key_ctrl](index.html) module"]
160pub struct LOCK_KEY_CTRL_SPEC;
161impl crate::RegisterSpec for LOCK_KEY_CTRL_SPEC {
162    type Ux = u32;
163}
164#[doc = "`read()` method returns [lock_key_ctrl::R](R) reader structure"]
165impl crate::Readable for LOCK_KEY_CTRL_SPEC {
166    type Reader = R;
167}
168#[doc = "`write(|w| ..)` method takes [lock_key_ctrl::W](W) writer structure"]
169impl crate::Writable for LOCK_KEY_CTRL_SPEC {
170    type Writer = W;
171}
172#[doc = "`reset()` method sets LOCK_KEY_CTRL to value 0x1acc_e551"]
173impl crate::Resettable for LOCK_KEY_CTRL_SPEC {
174    #[inline(always)]
175    fn reset_value() -> Self::Ux {
176        0x1acc_e551
177    }
178}