atsamd51p/nvmctrl/
seecfg.rs

1#[doc = "Register `SEECFG` reader"]
2pub type R = crate::R<SeecfgSpec>;
3#[doc = "Register `SEECFG` writer"]
4pub type W = crate::W<SeecfgSpec>;
5#[doc = "Write Mode\n\nValue on reset: 0"]
6#[derive(Clone, Copy, Debug, PartialEq, Eq)]
7pub enum Wmodeselect {
8    #[doc = "0: A NVM write command is issued after each write in the pagebuffer"]
9    Unbuffered = 0,
10    #[doc = "1: A NVM write command is issued when a write to a new page is requested"]
11    Buffered = 1,
12}
13impl From<Wmodeselect> for bool {
14    #[inline(always)]
15    fn from(variant: Wmodeselect) -> Self {
16        variant as u8 != 0
17    }
18}
19#[doc = "Field `WMODE` reader - Write Mode"]
20pub type WmodeR = crate::BitReader<Wmodeselect>;
21impl WmodeR {
22    #[doc = "Get enumerated values variant"]
23    #[inline(always)]
24    pub const fn variant(&self) -> Wmodeselect {
25        match self.bits {
26            false => Wmodeselect::Unbuffered,
27            true => Wmodeselect::Buffered,
28        }
29    }
30    #[doc = "A NVM write command is issued after each write in the pagebuffer"]
31    #[inline(always)]
32    pub fn is_unbuffered(&self) -> bool {
33        *self == Wmodeselect::Unbuffered
34    }
35    #[doc = "A NVM write command is issued when a write to a new page is requested"]
36    #[inline(always)]
37    pub fn is_buffered(&self) -> bool {
38        *self == Wmodeselect::Buffered
39    }
40}
41#[doc = "Field `WMODE` writer - Write Mode"]
42pub type WmodeW<'a, REG> = crate::BitWriter<'a, REG, Wmodeselect>;
43impl<'a, REG> WmodeW<'a, REG>
44where
45    REG: crate::Writable + crate::RegisterSpec,
46{
47    #[doc = "A NVM write command is issued after each write in the pagebuffer"]
48    #[inline(always)]
49    pub fn unbuffered(self) -> &'a mut crate::W<REG> {
50        self.variant(Wmodeselect::Unbuffered)
51    }
52    #[doc = "A NVM write command is issued when a write to a new page is requested"]
53    #[inline(always)]
54    pub fn buffered(self) -> &'a mut crate::W<REG> {
55        self.variant(Wmodeselect::Buffered)
56    }
57}
58#[doc = "Field `APRDIS` reader - Automatic Page Reallocation Disable"]
59pub type AprdisR = crate::BitReader;
60#[doc = "Field `APRDIS` writer - Automatic Page Reallocation Disable"]
61pub type AprdisW<'a, REG> = crate::BitWriter<'a, REG>;
62impl R {
63    #[doc = "Bit 0 - Write Mode"]
64    #[inline(always)]
65    pub fn wmode(&self) -> WmodeR {
66        WmodeR::new((self.bits & 1) != 0)
67    }
68    #[doc = "Bit 1 - Automatic Page Reallocation Disable"]
69    #[inline(always)]
70    pub fn aprdis(&self) -> AprdisR {
71        AprdisR::new(((self.bits >> 1) & 1) != 0)
72    }
73}
74impl W {
75    #[doc = "Bit 0 - Write Mode"]
76    #[inline(always)]
77    #[must_use]
78    pub fn wmode(&mut self) -> WmodeW<SeecfgSpec> {
79        WmodeW::new(self, 0)
80    }
81    #[doc = "Bit 1 - Automatic Page Reallocation Disable"]
82    #[inline(always)]
83    #[must_use]
84    pub fn aprdis(&mut self) -> AprdisW<SeecfgSpec> {
85        AprdisW::new(self, 1)
86    }
87}
88#[doc = "SmartEEPROM Configuration Register\n\nYou can [`read`](crate::Reg::read) this register and get [`seecfg::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`seecfg::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
89pub struct SeecfgSpec;
90impl crate::RegisterSpec for SeecfgSpec {
91    type Ux = u8;
92}
93#[doc = "`read()` method returns [`seecfg::R`](R) reader structure"]
94impl crate::Readable for SeecfgSpec {}
95#[doc = "`write(|w| ..)` method takes [`seecfg::W`](W) writer structure"]
96impl crate::Writable for SeecfgSpec {
97    type Safety = crate::Unsafe;
98    const ZERO_TO_MODIFY_FIELDS_BITMAP: u8 = 0;
99    const ONE_TO_MODIFY_FIELDS_BITMAP: u8 = 0;
100}
101#[doc = "`reset()` method sets SEECFG to value 0"]
102impl crate::Resettable for SeecfgSpec {
103    const RESET_VALUE: u8 = 0;
104}