atsam4ls4c_pac/bpm/
pmcon.rs

1#[doc = "Register `PMCON` reader"]
2pub struct R(crate::R<PMCON_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<PMCON_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<PMCON_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<PMCON_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `PMCON` writer"]
17pub struct W(crate::W<PMCON_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<PMCON_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<PMCON_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<PMCON_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "Field `PS` reader - Power Scaling Configuration Value"]
38pub type PS_R = crate::FieldReader<u8, u8>;
39#[doc = "Field `PS` writer - Power Scaling Configuration Value"]
40pub type PS_W<'a, const O: u8> = crate::FieldWriter<'a, u32, PMCON_SPEC, u8, u8, 2, O>;
41#[doc = "Field `PSCREQ` reader - Power Scaling Change Request"]
42pub type PSCREQ_R = crate::BitReader<bool>;
43#[doc = "Field `PSCREQ` writer - Power Scaling Change Request"]
44pub type PSCREQ_W<'a, const O: u8> = crate::BitWriter<'a, u32, PMCON_SPEC, bool, O>;
45#[doc = "Field `PSCM` reader - Power Scaling Change Mode"]
46pub type PSCM_R = crate::BitReader<bool>;
47#[doc = "Field `PSCM` writer - Power Scaling Change Mode"]
48pub type PSCM_W<'a, const O: u8> = crate::BitWriter<'a, u32, PMCON_SPEC, bool, O>;
49#[doc = "Field `BKUP` reader - BACKUP Mode"]
50pub type BKUP_R = crate::BitReader<bool>;
51#[doc = "Field `BKUP` writer - BACKUP Mode"]
52pub type BKUP_W<'a, const O: u8> = crate::BitWriter<'a, u32, PMCON_SPEC, bool, O>;
53#[doc = "Field `RET` reader - RETENTION Mode"]
54pub type RET_R = crate::BitReader<bool>;
55#[doc = "Field `RET` writer - RETENTION Mode"]
56pub type RET_W<'a, const O: u8> = crate::BitWriter<'a, u32, PMCON_SPEC, bool, O>;
57#[doc = "Field `SLEEP` reader - SLEEP mode Configuration"]
58pub type SLEEP_R = crate::FieldReader<u8, u8>;
59#[doc = "Field `SLEEP` writer - SLEEP mode Configuration"]
60pub type SLEEP_W<'a, const O: u8> = crate::FieldWriter<'a, u32, PMCON_SPEC, u8, u8, 2, O>;
61#[doc = "Field `CK32S` reader - 32Khz-1Khz Clock Source Selection"]
62pub type CK32S_R = crate::BitReader<bool>;
63#[doc = "Field `CK32S` writer - 32Khz-1Khz Clock Source Selection"]
64pub type CK32S_W<'a, const O: u8> = crate::BitWriter<'a, u32, PMCON_SPEC, bool, O>;
65#[doc = "Field `FASTWKUP` reader - Fast Wakeup"]
66pub type FASTWKUP_R = crate::BitReader<bool>;
67#[doc = "Field `FASTWKUP` writer - Fast Wakeup"]
68pub type FASTWKUP_W<'a, const O: u8> = crate::BitWriter<'a, u32, PMCON_SPEC, bool, O>;
69impl R {
70    #[doc = "Bits 0:1 - Power Scaling Configuration Value"]
71    #[inline(always)]
72    pub fn ps(&self) -> PS_R {
73        PS_R::new((self.bits & 3) as u8)
74    }
75    #[doc = "Bit 2 - Power Scaling Change Request"]
76    #[inline(always)]
77    pub fn pscreq(&self) -> PSCREQ_R {
78        PSCREQ_R::new(((self.bits >> 2) & 1) != 0)
79    }
80    #[doc = "Bit 3 - Power Scaling Change Mode"]
81    #[inline(always)]
82    pub fn pscm(&self) -> PSCM_R {
83        PSCM_R::new(((self.bits >> 3) & 1) != 0)
84    }
85    #[doc = "Bit 8 - BACKUP Mode"]
86    #[inline(always)]
87    pub fn bkup(&self) -> BKUP_R {
88        BKUP_R::new(((self.bits >> 8) & 1) != 0)
89    }
90    #[doc = "Bit 9 - RETENTION Mode"]
91    #[inline(always)]
92    pub fn ret(&self) -> RET_R {
93        RET_R::new(((self.bits >> 9) & 1) != 0)
94    }
95    #[doc = "Bits 12:13 - SLEEP mode Configuration"]
96    #[inline(always)]
97    pub fn sleep(&self) -> SLEEP_R {
98        SLEEP_R::new(((self.bits >> 12) & 3) as u8)
99    }
100    #[doc = "Bit 16 - 32Khz-1Khz Clock Source Selection"]
101    #[inline(always)]
102    pub fn ck32s(&self) -> CK32S_R {
103        CK32S_R::new(((self.bits >> 16) & 1) != 0)
104    }
105    #[doc = "Bit 24 - Fast Wakeup"]
106    #[inline(always)]
107    pub fn fastwkup(&self) -> FASTWKUP_R {
108        FASTWKUP_R::new(((self.bits >> 24) & 1) != 0)
109    }
110}
111impl W {
112    #[doc = "Bits 0:1 - Power Scaling Configuration Value"]
113    #[inline(always)]
114    #[must_use]
115    pub fn ps(&mut self) -> PS_W<0> {
116        PS_W::new(self)
117    }
118    #[doc = "Bit 2 - Power Scaling Change Request"]
119    #[inline(always)]
120    #[must_use]
121    pub fn pscreq(&mut self) -> PSCREQ_W<2> {
122        PSCREQ_W::new(self)
123    }
124    #[doc = "Bit 3 - Power Scaling Change Mode"]
125    #[inline(always)]
126    #[must_use]
127    pub fn pscm(&mut self) -> PSCM_W<3> {
128        PSCM_W::new(self)
129    }
130    #[doc = "Bit 8 - BACKUP Mode"]
131    #[inline(always)]
132    #[must_use]
133    pub fn bkup(&mut self) -> BKUP_W<8> {
134        BKUP_W::new(self)
135    }
136    #[doc = "Bit 9 - RETENTION Mode"]
137    #[inline(always)]
138    #[must_use]
139    pub fn ret(&mut self) -> RET_W<9> {
140        RET_W::new(self)
141    }
142    #[doc = "Bits 12:13 - SLEEP mode Configuration"]
143    #[inline(always)]
144    #[must_use]
145    pub fn sleep(&mut self) -> SLEEP_W<12> {
146        SLEEP_W::new(self)
147    }
148    #[doc = "Bit 16 - 32Khz-1Khz Clock Source Selection"]
149    #[inline(always)]
150    #[must_use]
151    pub fn ck32s(&mut self) -> CK32S_W<16> {
152        CK32S_W::new(self)
153    }
154    #[doc = "Bit 24 - Fast Wakeup"]
155    #[inline(always)]
156    #[must_use]
157    pub fn fastwkup(&mut self) -> FASTWKUP_W<24> {
158        FASTWKUP_W::new(self)
159    }
160    #[doc = "Writes raw bits to the register."]
161    #[inline(always)]
162    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
163        self.0.bits(bits);
164        self
165    }
166}
167#[doc = "Power Mode Control 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 [pmcon](index.html) module"]
168pub struct PMCON_SPEC;
169impl crate::RegisterSpec for PMCON_SPEC {
170    type Ux = u32;
171}
172#[doc = "`read()` method returns [pmcon::R](R) reader structure"]
173impl crate::Readable for PMCON_SPEC {
174    type Reader = R;
175}
176#[doc = "`write(|w| ..)` method takes [pmcon::W](W) writer structure"]
177impl crate::Writable for PMCON_SPEC {
178    type Writer = W;
179    const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
180    const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
181}
182#[doc = "`reset()` method sets PMCON to value 0"]
183impl crate::Resettable for PMCON_SPEC {
184    const RESET_VALUE: Self::Ux = 0;
185}