efm32pg22_pac/efm32pg22c200/emu_ns/
pd1paretctrl.rs

1#[doc = "Register `PD1PARETCTRL` reader"]
2pub struct R(crate::R<PD1PARETCTRL_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<PD1PARETCTRL_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<PD1PARETCTRL_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<PD1PARETCTRL_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `PD1PARETCTRL` writer"]
17pub struct W(crate::W<PD1PARETCTRL_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<PD1PARETCTRL_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<PD1PARETCTRL_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<PD1PARETCTRL_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "Field `PD1PARETDIS` reader - Disable PD1 Partial Retention"]
38pub type PD1PARETDIS_R = crate::FieldReader<u16, PD1PARETDIS_A>;
39#[doc = "Disable PD1 Partial Retention\n\nValue on reset: 0"]
40#[derive(Clone, Copy, Debug, PartialEq, Eq)]
41#[repr(u16)]
42pub enum PD1PARETDIS_A {
43    #[doc = "0: Retain associated registers when in EM2/3"]
44    RETAIN = 0,
45    #[doc = "1: Do not retain associcated registers when in EM2/3"]
46    NORETAIN = 1,
47}
48impl From<PD1PARETDIS_A> for u16 {
49    #[inline(always)]
50    fn from(variant: PD1PARETDIS_A) -> Self {
51        variant as _
52    }
53}
54impl PD1PARETDIS_R {
55    #[doc = "Get enumerated values variant"]
56    #[inline(always)]
57    pub fn variant(&self) -> Option<PD1PARETDIS_A> {
58        match self.bits {
59            0 => Some(PD1PARETDIS_A::RETAIN),
60            1 => Some(PD1PARETDIS_A::NORETAIN),
61            _ => None,
62        }
63    }
64    #[doc = "Checks if the value of the field is `RETAIN`"]
65    #[inline(always)]
66    pub fn is_retain(&self) -> bool {
67        *self == PD1PARETDIS_A::RETAIN
68    }
69    #[doc = "Checks if the value of the field is `NORETAIN`"]
70    #[inline(always)]
71    pub fn is_noretain(&self) -> bool {
72        *self == PD1PARETDIS_A::NORETAIN
73    }
74}
75#[doc = "Field `PD1PARETDIS` writer - Disable PD1 Partial Retention"]
76pub type PD1PARETDIS_W<'a, const O: u8> =
77    crate::FieldWriter<'a, u32, PD1PARETCTRL_SPEC, u16, PD1PARETDIS_A, 16, O>;
78impl<'a, const O: u8> PD1PARETDIS_W<'a, O> {
79    #[doc = "Retain associated registers when in EM2/3"]
80    #[inline(always)]
81    pub fn retain(self) -> &'a mut W {
82        self.variant(PD1PARETDIS_A::RETAIN)
83    }
84    #[doc = "Do not retain associcated registers when in EM2/3"]
85    #[inline(always)]
86    pub fn noretain(self) -> &'a mut W {
87        self.variant(PD1PARETDIS_A::NORETAIN)
88    }
89}
90impl R {
91    #[doc = "Bits 0:15 - Disable PD1 Partial Retention"]
92    #[inline(always)]
93    pub fn pd1paretdis(&self) -> PD1PARETDIS_R {
94        PD1PARETDIS_R::new((self.bits & 0xffff) as u16)
95    }
96}
97impl W {
98    #[doc = "Bits 0:15 - Disable PD1 Partial Retention"]
99    #[inline(always)]
100    #[must_use]
101    pub fn pd1paretdis(&mut self) -> PD1PARETDIS_W<0> {
102        PD1PARETDIS_W::new(self)
103    }
104    #[doc = "Writes raw bits to the register."]
105    #[inline(always)]
106    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
107        self.0.bits(bits);
108        self
109    }
110}
111#[doc = "No Description\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 [pd1paretctrl](index.html) module"]
112pub struct PD1PARETCTRL_SPEC;
113impl crate::RegisterSpec for PD1PARETCTRL_SPEC {
114    type Ux = u32;
115}
116#[doc = "`read()` method returns [pd1paretctrl::R](R) reader structure"]
117impl crate::Readable for PD1PARETCTRL_SPEC {
118    type Reader = R;
119}
120#[doc = "`write(|w| ..)` method takes [pd1paretctrl::W](W) writer structure"]
121impl crate::Writable for PD1PARETCTRL_SPEC {
122    type Writer = W;
123    const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
124    const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
125}
126#[doc = "`reset()` method sets PD1PARETCTRL to value 0"]
127impl crate::Resettable for PD1PARETCTRL_SPEC {
128    const RESET_VALUE: Self::Ux = 0;
129}