atsam3s1c/hsmci/
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 `WP_EN` reader - Write Protection Enable"]
6pub type WpEnR = crate::BitReader;
7#[doc = "Field `WP_EN` writer - Write Protection Enable"]
8pub type WpEnW<'a, REG> = crate::BitWriter<'a, REG>;
9#[doc = "Field `WP_KEY` reader - Write Protection Key password"]
10pub type WpKeyR = crate::FieldReader<u32>;
11#[doc = "Field `WP_KEY` writer - Write Protection Key password"]
12pub type WpKeyW<'a, REG> = crate::FieldWriter<'a, REG, 24, u32>;
13impl R {
14    #[doc = "Bit 0 - Write Protection Enable"]
15    #[inline(always)]
16    pub fn wp_en(&self) -> WpEnR {
17        WpEnR::new((self.bits & 1) != 0)
18    }
19    #[doc = "Bits 8:31 - Write Protection Key password"]
20    #[inline(always)]
21    pub fn wp_key(&self) -> WpKeyR {
22        WpKeyR::new((self.bits >> 8) & 0x00ff_ffff)
23    }
24}
25impl W {
26    #[doc = "Bit 0 - Write Protection Enable"]
27    #[inline(always)]
28    #[must_use]
29    pub fn wp_en(&mut self) -> WpEnW<WpmrSpec> {
30        WpEnW::new(self, 0)
31    }
32    #[doc = "Bits 8:31 - Write Protection Key password"]
33    #[inline(always)]
34    #[must_use]
35    pub fn wp_key(&mut self) -> WpKeyW<WpmrSpec> {
36        WpKeyW::new(self, 8)
37    }
38}
39#[doc = "Write Protection Mode Register\n\nYou can [`read`](crate::generic::Reg::read) this register and get [`wpmr::R`](R).  You can [`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}