atsam4e8c_pac/uart1/
wpmr.rs1#[doc = "Register `WPMR` reader"]
2pub struct R(crate::R<WPMR_SPEC>);
3impl core::ops::Deref for R {
4 type Target = crate::R<WPMR_SPEC>;
5 #[inline(always)]
6 fn deref(&self) -> &Self::Target {
7 &self.0
8 }
9}
10impl From<crate::R<WPMR_SPEC>> for R {
11 #[inline(always)]
12 fn from(reader: crate::R<WPMR_SPEC>) -> Self {
13 R(reader)
14 }
15}
16#[doc = "Register `WPMR` writer"]
17pub struct W(crate::W<WPMR_SPEC>);
18impl core::ops::Deref for W {
19 type Target = crate::W<WPMR_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<WPMR_SPEC>> for W {
32 #[inline(always)]
33 fn from(writer: crate::W<WPMR_SPEC>) -> Self {
34 W(writer)
35 }
36}
37#[doc = "Field `WPEN` reader - Write Protection Enable"]
38pub type WPEN_R = crate::BitReader<bool>;
39#[doc = "Field `WPEN` writer - Write Protection Enable"]
40pub type WPEN_W<'a, const O: u8> = crate::BitWriter<'a, u32, WPMR_SPEC, bool, O>;
41#[doc = "Field `WPKEY` reader - Write Protection Key"]
42pub type WPKEY_R = crate::FieldReader<u32, WPKEY_A>;
43#[doc = "Write Protection Key\n\nValue on reset: 0"]
44#[derive(Clone, Copy, Debug, PartialEq, Eq)]
45#[repr(u32)]
46pub enum WPKEY_A {
47 #[doc = "5587282: Writing any other value in this field aborts the write operation.Always reads as 0."]
48 PASSWD = 5587282,
49}
50impl From<WPKEY_A> for u32 {
51 #[inline(always)]
52 fn from(variant: WPKEY_A) -> Self {
53 variant as _
54 }
55}
56impl WPKEY_R {
57 #[doc = "Get enumerated values variant"]
58 #[inline(always)]
59 pub fn variant(&self) -> Option<WPKEY_A> {
60 match self.bits {
61 5587282 => Some(WPKEY_A::PASSWD),
62 _ => None,
63 }
64 }
65 #[doc = "Checks if the value of the field is `PASSWD`"]
66 #[inline(always)]
67 pub fn is_passwd(&self) -> bool {
68 *self == WPKEY_A::PASSWD
69 }
70}
71#[doc = "Field `WPKEY` writer - Write Protection Key"]
72pub type WPKEY_W<'a, const O: u8> = crate::FieldWriter<'a, u32, WPMR_SPEC, u32, WPKEY_A, 24, O>;
73impl<'a, const O: u8> WPKEY_W<'a, O> {
74 #[doc = "Writing any other value in this field aborts the write operation.Always reads as 0."]
75 #[inline(always)]
76 pub fn passwd(self) -> &'a mut W {
77 self.variant(WPKEY_A::PASSWD)
78 }
79}
80impl R {
81 #[doc = "Bit 0 - Write Protection Enable"]
82 #[inline(always)]
83 pub fn wpen(&self) -> WPEN_R {
84 WPEN_R::new((self.bits & 1) != 0)
85 }
86 #[doc = "Bits 8:31 - Write Protection Key"]
87 #[inline(always)]
88 pub fn wpkey(&self) -> WPKEY_R {
89 WPKEY_R::new((self.bits >> 8) & 0x00ff_ffff)
90 }
91}
92impl W {
93 #[doc = "Bit 0 - Write Protection Enable"]
94 #[inline(always)]
95 #[must_use]
96 pub fn wpen(&mut self) -> WPEN_W<0> {
97 WPEN_W::new(self)
98 }
99 #[doc = "Bits 8:31 - Write Protection Key"]
100 #[inline(always)]
101 #[must_use]
102 pub fn wpkey(&mut self) -> WPKEY_W<8> {
103 WPKEY_W::new(self)
104 }
105 #[doc = "Writes raw bits to the register."]
106 #[inline(always)]
107 pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
108 self.0.bits(bits);
109 self
110 }
111}
112#[doc = "Write Protection Mode Register\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 [wpmr](index.html) module"]
113pub struct WPMR_SPEC;
114impl crate::RegisterSpec for WPMR_SPEC {
115 type Ux = u32;
116}
117#[doc = "`read()` method returns [wpmr::R](R) reader structure"]
118impl crate::Readable for WPMR_SPEC {
119 type Reader = R;
120}
121#[doc = "`write(|w| ..)` method takes [wpmr::W](W) writer structure"]
122impl crate::Writable for WPMR_SPEC {
123 type Writer = W;
124 const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
125 const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
126}
127#[doc = "`reset()` method sets WPMR to value 0"]
128impl crate::Resettable for WPMR_SPEC {
129 const RESET_VALUE: Self::Ux = 0;
130}