atsam3s1b/ssc/
wpmr.rs

1#[doc = "Register `WPMR` reader"]
2pub type R = crate::R<WpmrSpec>;
3#[doc = "Register `WPMR` writer"]
4pub type W = crate::W<WpmrSpec>;
5#[doc = "Field `WPEN` reader - Write Protect Enable"]
6pub type WpenR = crate::BitReader;
7#[doc = "Field `WPEN` writer - Write Protect Enable"]
8pub type WpenW<'a, REG> = crate::BitWriter<'a, REG>;
9#[doc = "Field `WPKEY` reader - Write Protect KEY"]
10pub type WpkeyR = crate::FieldReader<u32>;
11#[doc = "Field `WPKEY` writer - Write Protect KEY"]
12pub type WpkeyW<'a, REG> = crate::FieldWriter<'a, REG, 24, u32>;
13impl R {
14    #[doc = "Bit 0 - Write Protect Enable"]
15    #[inline(always)]
16    pub fn wpen(&self) -> WpenR {
17        WpenR::new((self.bits & 1) != 0)
18    }
19    #[doc = "Bits 8:31 - Write Protect KEY"]
20    #[inline(always)]
21    pub fn wpkey(&self) -> WpkeyR {
22        WpkeyR::new((self.bits >> 8) & 0x00ff_ffff)
23    }
24}
25impl W {
26    #[doc = "Bit 0 - Write Protect Enable"]
27    #[inline(always)]
28    #[must_use]
29    pub fn wpen(&mut self) -> WpenW<WpmrSpec> {
30        WpenW::new(self, 0)
31    }
32    #[doc = "Bits 8:31 - Write Protect KEY"]
33    #[inline(always)]
34    #[must_use]
35    pub fn wpkey(&mut self) -> WpkeyW<WpmrSpec> {
36        WpkeyW::new(self, 8)
37    }
38}
39#[doc = "Write Protect Mode Register\n\nYou can [`read`](crate::generic::Reg::read) this register and get [`wpmr::R`](R).  You can [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`write_with_zero`](crate::generic::Reg::write_with_zero) this register using [`wpmr::W`](W). You can also [`modify`](crate::generic::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
40pub struct WpmrSpec;
41impl crate::RegisterSpec for WpmrSpec {
42    type Ux = u32;
43}
44#[doc = "`read()` method returns [`wpmr::R`](R) reader structure"]
45impl crate::Readable for WpmrSpec {}
46#[doc = "`write(|w| ..)` method takes [`wpmr::W`](W) writer structure"]
47impl crate::Writable for WpmrSpec {
48    type Safety = crate::Unsafe;
49    const ZERO_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
50    const ONE_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
51}
52#[doc = "`reset()` method sets WPMR to value 0"]
53impl crate::Resettable for WpmrSpec {
54    const RESET_VALUE: u32 = 0;
55}