nrf5340_app_pac/nvmc_ns/
writeuicrns.rs

1#[doc = "Register `WRITEUICRNS` writer"]
2pub struct W(crate::W<WRITEUICRNS_SPEC>);
3impl core::ops::Deref for W {
4    type Target = crate::W<WRITEUICRNS_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<WRITEUICRNS_SPEC>> for W {
17    #[inline(always)]
18    fn from(writer: crate::W<WRITEUICRNS_SPEC>) -> Self {
19        W(writer)
20    }
21}
22#[doc = "Allow non-secure code to set APPROTECT\n\nValue on reset: 0"]
23#[derive(Clone, Copy, Debug, PartialEq)]
24pub enum SET_AW {
25    #[doc = "1: Set value"]
26    SET = 1,
27}
28impl From<SET_AW> for bool {
29    #[inline(always)]
30    fn from(variant: SET_AW) -> Self {
31        variant as u8 != 0
32    }
33}
34#[doc = "Field `SET` writer - Allow non-secure code to set APPROTECT"]
35pub type SET_W<'a, const O: u8> = crate::BitWriter<'a, u32, WRITEUICRNS_SPEC, SET_AW, O>;
36impl<'a, const O: u8> SET_W<'a, O> {
37    #[doc = "Set value"]
38    #[inline(always)]
39    pub fn set(self) -> &'a mut W {
40        self.variant(SET_AW::SET)
41    }
42}
43#[doc = "Key to write in order to validate the write operation\n\nValue on reset: 0"]
44#[derive(Clone, Copy, Debug, PartialEq)]
45#[repr(u32)]
46pub enum KEY_AW {
47    #[doc = "184280487: Key value"]
48    KEYVALID = 184280487,
49}
50impl From<KEY_AW> for u32 {
51    #[inline(always)]
52    fn from(variant: KEY_AW) -> Self {
53        variant as _
54    }
55}
56#[doc = "Field `KEY` writer - Key to write in order to validate the write operation"]
57pub type KEY_W<'a, const O: u8> = crate::FieldWriter<'a, u32, WRITEUICRNS_SPEC, u32, KEY_AW, 28, O>;
58impl<'a, const O: u8> KEY_W<'a, O> {
59    #[doc = "Key value"]
60    #[inline(always)]
61    pub fn keyvalid(self) -> &'a mut W {
62        self.variant(KEY_AW::KEYVALID)
63    }
64}
65impl W {
66    #[doc = "Bit 0 - Allow non-secure code to set APPROTECT"]
67    #[inline(always)]
68    pub fn set(&mut self) -> SET_W<0> {
69        SET_W::new(self)
70    }
71    #[doc = "Bits 4:31 - Key to write in order to validate the write operation"]
72    #[inline(always)]
73    pub fn key(&mut self) -> KEY_W<4> {
74        KEY_W::new(self)
75    }
76    #[doc = "Writes raw bits to the register."]
77    #[inline(always)]
78    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
79        self.0.bits(bits);
80        self
81    }
82}
83#[doc = "Non-secure APPROTECT enable register\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 [writeuicrns](index.html) module"]
84pub struct WRITEUICRNS_SPEC;
85impl crate::RegisterSpec for WRITEUICRNS_SPEC {
86    type Ux = u32;
87}
88#[doc = "`write(|w| ..)` method takes [writeuicrns::W](W) writer structure"]
89impl crate::Writable for WRITEUICRNS_SPEC {
90    type Writer = W;
91}
92#[doc = "`reset()` method sets WRITEUICRNS to value 0"]
93impl crate::Resettable for WRITEUICRNS_SPEC {
94    #[inline(always)]
95    fn reset_value() -> Self::Ux {
96        0
97    }
98}