nrf52820_pac/nvmc/
eraseall.rs

1#[doc = "Register `ERASEALL` writer"]
2pub struct W(crate::W<ERASEALL_SPEC>);
3impl core::ops::Deref for W {
4    type Target = crate::W<ERASEALL_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<ERASEALL_SPEC>> for W {
17    #[inline(always)]
18    fn from(writer: crate::W<ERASEALL_SPEC>) -> Self {
19        W(writer)
20    }
21}
22#[doc = "Erase all non-volatile memory including UICR registers. The erase must be enabled using CONFIG.WEN before the non-volatile memory can be erased.\n\nValue on reset: 0"]
23#[derive(Clone, Copy, Debug, PartialEq)]
24pub enum ERASEALL_AW {
25    #[doc = "0: No operation"]
26    NO_OPERATION = 0,
27    #[doc = "1: Start chip erase"]
28    ERASE = 1,
29}
30impl From<ERASEALL_AW> for bool {
31    #[inline(always)]
32    fn from(variant: ERASEALL_AW) -> Self {
33        variant as u8 != 0
34    }
35}
36#[doc = "Field `ERASEALL` writer - Erase all non-volatile memory including UICR registers. The erase must be enabled using CONFIG.WEN before the non-volatile memory can be erased."]
37pub type ERASEALL_W<'a, const O: u8> = crate::BitWriter<'a, u32, ERASEALL_SPEC, ERASEALL_AW, O>;
38impl<'a, const O: u8> ERASEALL_W<'a, O> {
39    #[doc = "No operation"]
40    #[inline(always)]
41    pub fn no_operation(self) -> &'a mut W {
42        self.variant(ERASEALL_AW::NO_OPERATION)
43    }
44    #[doc = "Start chip erase"]
45    #[inline(always)]
46    pub fn erase(self) -> &'a mut W {
47        self.variant(ERASEALL_AW::ERASE)
48    }
49}
50impl W {
51    #[doc = "Bit 0 - Erase all non-volatile memory including UICR registers. The erase must be enabled using CONFIG.WEN before the non-volatile memory can be erased."]
52    #[inline(always)]
53    pub fn eraseall(&mut self) -> ERASEALL_W<0> {
54        ERASEALL_W::new(self)
55    }
56    #[doc = "Writes raw bits to the register."]
57    #[inline(always)]
58    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
59        self.0.bits(bits);
60        self
61    }
62}
63#[doc = "Register for erasing all non-volatile user memory\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 [eraseall](index.html) module"]
64pub struct ERASEALL_SPEC;
65impl crate::RegisterSpec for ERASEALL_SPEC {
66    type Ux = u32;
67}
68#[doc = "`write(|w| ..)` method takes [eraseall::W](W) writer structure"]
69impl crate::Writable for ERASEALL_SPEC {
70    type Writer = W;
71}
72#[doc = "`reset()` method sets ERASEALL to value 0"]
73impl crate::Resettable for ERASEALL_SPEC {
74    #[inline(always)]
75    fn reset_value() -> Self::Ux {
76        0
77    }
78}