atsam4lc4b_pac/usart0/
wpsr.rs1#[doc = "Register `WPSR` reader"]
2pub struct R(crate::R<WPSR_SPEC>);
3impl core::ops::Deref for R {
4 type Target = crate::R<WPSR_SPEC>;
5 #[inline(always)]
6 fn deref(&self) -> &Self::Target {
7 &self.0
8 }
9}
10impl From<crate::R<WPSR_SPEC>> for R {
11 #[inline(always)]
12 fn from(reader: crate::R<WPSR_SPEC>) -> Self {
13 R(reader)
14 }
15}
16#[doc = "Field `WPV` reader - Write Protect Violation Status"]
17pub type WPV_R = crate::BitReader<WPVSELECT_A>;
18#[doc = "Write Protect Violation Status\n\nValue on reset: 0"]
19#[derive(Clone, Copy, Debug, PartialEq, Eq)]
20pub enum WPVSELECT_A {
21 #[doc = "0: No Write Protect Violation has occurred since the last read of the WPSR register"]
22 _0 = 0,
23 #[doc = "1: A Write Protect Violation has occurred since the last read of the WPSR register. If this violation is an unauthorized attempt to write a protected register, the associated violation is reported into field WPVSRC"]
24 _1 = 1,
25}
26impl From<WPVSELECT_A> for bool {
27 #[inline(always)]
28 fn from(variant: WPVSELECT_A) -> Self {
29 variant as u8 != 0
30 }
31}
32impl WPV_R {
33 #[doc = "Get enumerated values variant"]
34 #[inline(always)]
35 pub fn variant(&self) -> WPVSELECT_A {
36 match self.bits {
37 false => WPVSELECT_A::_0,
38 true => WPVSELECT_A::_1,
39 }
40 }
41 #[doc = "Checks if the value of the field is `_0`"]
42 #[inline(always)]
43 pub fn is_0(&self) -> bool {
44 *self == WPVSELECT_A::_0
45 }
46 #[doc = "Checks if the value of the field is `_1`"]
47 #[inline(always)]
48 pub fn is_1(&self) -> bool {
49 *self == WPVSELECT_A::_1
50 }
51}
52#[doc = "Field `WPVSRC` reader - Write Protect Violation Source"]
53pub type WPVSRC_R = crate::FieldReader<u16, u16>;
54impl R {
55 #[doc = "Bit 0 - Write Protect Violation Status"]
56 #[inline(always)]
57 pub fn wpv(&self) -> WPV_R {
58 WPV_R::new((self.bits & 1) != 0)
59 }
60 #[doc = "Bits 8:23 - Write Protect Violation Source"]
61 #[inline(always)]
62 pub fn wpvsrc(&self) -> WPVSRC_R {
63 WPVSRC_R::new(((self.bits >> 8) & 0xffff) as u16)
64 }
65}
66#[doc = "Write Protect Status Register\n\nThis register you can [`read`](crate::generic::Reg::read). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [wpsr](index.html) module"]
67pub struct WPSR_SPEC;
68impl crate::RegisterSpec for WPSR_SPEC {
69 type Ux = u32;
70}
71#[doc = "`read()` method returns [wpsr::R](R) reader structure"]
72impl crate::Readable for WPSR_SPEC {
73 type Reader = R;
74}
75#[doc = "`reset()` method sets WPSR to value 0"]
76impl crate::Resettable for WPSR_SPEC {
77 const RESET_VALUE: Self::Ux = 0;
78}