nrf52840_pac/nvmc/
eraseuicr.rs1#[doc = "Register `ERASEUICR` reader"]
2pub struct R(crate::R<ERASEUICR_SPEC>);
3impl core::ops::Deref for R {
4 type Target = crate::R<ERASEUICR_SPEC>;
5 #[inline(always)]
6 fn deref(&self) -> &Self::Target {
7 &self.0
8 }
9}
10impl From<crate::R<ERASEUICR_SPEC>> for R {
11 #[inline(always)]
12 fn from(reader: crate::R<ERASEUICR_SPEC>) -> Self {
13 R(reader)
14 }
15}
16#[doc = "Register `ERASEUICR` writer"]
17pub struct W(crate::W<ERASEUICR_SPEC>);
18impl core::ops::Deref for W {
19 type Target = crate::W<ERASEUICR_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<ERASEUICR_SPEC>> for W {
32 #[inline(always)]
33 fn from(writer: crate::W<ERASEUICR_SPEC>) -> Self {
34 W(writer)
35 }
36}
37#[doc = "Field `ERASEUICR` reader - Register starting erase of all user information configuration registers. Note that the erase must be enabled using CONFIG.WEN before the UICR can be erased."]
38pub type ERASEUICR_R = crate::BitReader<ERASEUICR_A>;
39#[doc = "Register starting erase of all user information configuration registers. Note that the erase must be enabled using CONFIG.WEN before the UICR can be erased.\n\nValue on reset: 0"]
40#[derive(Clone, Copy, Debug, PartialEq)]
41pub enum ERASEUICR_A {
42 #[doc = "0: No operation"]
43 NO_OPERATION = 0,
44 #[doc = "1: Start erase of UICR"]
45 ERASE = 1,
46}
47impl From<ERASEUICR_A> for bool {
48 #[inline(always)]
49 fn from(variant: ERASEUICR_A) -> Self {
50 variant as u8 != 0
51 }
52}
53impl ERASEUICR_R {
54 #[doc = "Get enumerated values variant"]
55 #[inline(always)]
56 pub fn variant(&self) -> ERASEUICR_A {
57 match self.bits {
58 false => ERASEUICR_A::NO_OPERATION,
59 true => ERASEUICR_A::ERASE,
60 }
61 }
62 #[doc = "Checks if the value of the field is `NO_OPERATION`"]
63 #[inline(always)]
64 pub fn is_no_operation(&self) -> bool {
65 *self == ERASEUICR_A::NO_OPERATION
66 }
67 #[doc = "Checks if the value of the field is `ERASE`"]
68 #[inline(always)]
69 pub fn is_erase(&self) -> bool {
70 *self == ERASEUICR_A::ERASE
71 }
72}
73#[doc = "Field `ERASEUICR` writer - Register starting erase of all user information configuration registers. Note that the erase must be enabled using CONFIG.WEN before the UICR can be erased."]
74pub type ERASEUICR_W<'a, const O: u8> = crate::BitWriter<'a, u32, ERASEUICR_SPEC, ERASEUICR_A, O>;
75impl<'a, const O: u8> ERASEUICR_W<'a, O> {
76 #[doc = "No operation"]
77 #[inline(always)]
78 pub fn no_operation(self) -> &'a mut W {
79 self.variant(ERASEUICR_A::NO_OPERATION)
80 }
81 #[doc = "Start erase of UICR"]
82 #[inline(always)]
83 pub fn erase(self) -> &'a mut W {
84 self.variant(ERASEUICR_A::ERASE)
85 }
86}
87impl R {
88 #[doc = "Bit 0 - Register starting erase of all user information configuration registers. Note that the erase must be enabled using CONFIG.WEN before the UICR can be erased."]
89 #[inline(always)]
90 pub fn eraseuicr(&self) -> ERASEUICR_R {
91 ERASEUICR_R::new((self.bits & 1) != 0)
92 }
93}
94impl W {
95 #[doc = "Bit 0 - Register starting erase of all user information configuration registers. Note that the erase must be enabled using CONFIG.WEN before the UICR can be erased."]
96 #[inline(always)]
97 pub fn eraseuicr(&mut self) -> ERASEUICR_W<0> {
98 ERASEUICR_W::new(self)
99 }
100 #[doc = "Writes raw bits to the register."]
101 #[inline(always)]
102 pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
103 self.0.bits(bits);
104 self
105 }
106}
107#[doc = "Register for erasing user information configuration registers\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 [eraseuicr](index.html) module"]
108pub struct ERASEUICR_SPEC;
109impl crate::RegisterSpec for ERASEUICR_SPEC {
110 type Ux = u32;
111}
112#[doc = "`read()` method returns [eraseuicr::R](R) reader structure"]
113impl crate::Readable for ERASEUICR_SPEC {
114 type Reader = R;
115}
116#[doc = "`write(|w| ..)` method takes [eraseuicr::W](W) writer structure"]
117impl crate::Writable for ERASEUICR_SPEC {
118 type Writer = W;
119}
120#[doc = "`reset()` method sets ERASEUICR to value 0"]
121impl crate::Resettable for ERASEUICR_SPEC {
122 #[inline(always)]
123 fn reset_value() -> Self::Ux {
124 0
125 }
126}