rp2040_pac/ppb/
scr.rs

1#[doc = "Register `SCR` reader"]
2pub type R = crate::R<SCR_SPEC>;
3#[doc = "Register `SCR` writer"]
4pub type W = crate::W<SCR_SPEC>;
5#[doc = "Field `SLEEPONEXIT` reader - Indicates sleep-on-exit when returning from Handler mode to Thread mode:  
6 0 = Do not sleep when returning to Thread mode.  
7 1 = Enter sleep, or deep sleep, on return from an ISR to Thread mode.  
8 Setting this bit to 1 enables an interrupt driven application to avoid returning to an empty main application."]
9pub type SLEEPONEXIT_R = crate::BitReader;
10#[doc = "Field `SLEEPONEXIT` writer - Indicates sleep-on-exit when returning from Handler mode to Thread mode:  
11 0 = Do not sleep when returning to Thread mode.  
12 1 = Enter sleep, or deep sleep, on return from an ISR to Thread mode.  
13 Setting this bit to 1 enables an interrupt driven application to avoid returning to an empty main application."]
14pub type SLEEPONEXIT_W<'a, REG> = crate::BitWriter<'a, REG>;
15#[doc = "Field `SLEEPDEEP` reader - Controls whether the processor uses sleep or deep sleep as its low power mode:  
16 0 = Sleep.  
17 1 = Deep sleep."]
18pub type SLEEPDEEP_R = crate::BitReader;
19#[doc = "Field `SLEEPDEEP` writer - Controls whether the processor uses sleep or deep sleep as its low power mode:  
20 0 = Sleep.  
21 1 = Deep sleep."]
22pub type SLEEPDEEP_W<'a, REG> = crate::BitWriter<'a, REG>;
23#[doc = "Field `SEVONPEND` reader - Send Event on Pending bit:  
24 0 = Only enabled interrupts or events can wakeup the processor, disabled interrupts are excluded.  
25 1 = Enabled events and all interrupts, including disabled interrupts, can wakeup the processor.  
26 When an event or interrupt becomes pending, the event signal wakes up the processor from WFE. If the  
27 processor is not waiting for an event, the event is registered and affects the next WFE.  
28 The processor also wakes up on execution of an SEV instruction or an external event."]
29pub type SEVONPEND_R = crate::BitReader;
30#[doc = "Field `SEVONPEND` writer - Send Event on Pending bit:  
31 0 = Only enabled interrupts or events can wakeup the processor, disabled interrupts are excluded.  
32 1 = Enabled events and all interrupts, including disabled interrupts, can wakeup the processor.  
33 When an event or interrupt becomes pending, the event signal wakes up the processor from WFE. If the  
34 processor is not waiting for an event, the event is registered and affects the next WFE.  
35 The processor also wakes up on execution of an SEV instruction or an external event."]
36pub type SEVONPEND_W<'a, REG> = crate::BitWriter<'a, REG>;
37impl R {
38    #[doc = "Bit 1 - Indicates sleep-on-exit when returning from Handler mode to Thread mode:  
39 0 = Do not sleep when returning to Thread mode.  
40 1 = Enter sleep, or deep sleep, on return from an ISR to Thread mode.  
41 Setting this bit to 1 enables an interrupt driven application to avoid returning to an empty main application."]
42    #[inline(always)]
43    pub fn sleeponexit(&self) -> SLEEPONEXIT_R {
44        SLEEPONEXIT_R::new(((self.bits >> 1) & 1) != 0)
45    }
46    #[doc = "Bit 2 - Controls whether the processor uses sleep or deep sleep as its low power mode:  
47 0 = Sleep.  
48 1 = Deep sleep."]
49    #[inline(always)]
50    pub fn sleepdeep(&self) -> SLEEPDEEP_R {
51        SLEEPDEEP_R::new(((self.bits >> 2) & 1) != 0)
52    }
53    #[doc = "Bit 4 - Send Event on Pending bit:  
54 0 = Only enabled interrupts or events can wakeup the processor, disabled interrupts are excluded.  
55 1 = Enabled events and all interrupts, including disabled interrupts, can wakeup the processor.  
56 When an event or interrupt becomes pending, the event signal wakes up the processor from WFE. If the  
57 processor is not waiting for an event, the event is registered and affects the next WFE.  
58 The processor also wakes up on execution of an SEV instruction or an external event."]
59    #[inline(always)]
60    pub fn sevonpend(&self) -> SEVONPEND_R {
61        SEVONPEND_R::new(((self.bits >> 4) & 1) != 0)
62    }
63}
64impl W {
65    #[doc = "Bit 1 - Indicates sleep-on-exit when returning from Handler mode to Thread mode:  
66 0 = Do not sleep when returning to Thread mode.  
67 1 = Enter sleep, or deep sleep, on return from an ISR to Thread mode.  
68 Setting this bit to 1 enables an interrupt driven application to avoid returning to an empty main application."]
69    #[inline(always)]
70    #[must_use]
71    pub fn sleeponexit(&mut self) -> SLEEPONEXIT_W<SCR_SPEC> {
72        SLEEPONEXIT_W::new(self, 1)
73    }
74    #[doc = "Bit 2 - Controls whether the processor uses sleep or deep sleep as its low power mode:  
75 0 = Sleep.  
76 1 = Deep sleep."]
77    #[inline(always)]
78    #[must_use]
79    pub fn sleepdeep(&mut self) -> SLEEPDEEP_W<SCR_SPEC> {
80        SLEEPDEEP_W::new(self, 2)
81    }
82    #[doc = "Bit 4 - Send Event on Pending bit:  
83 0 = Only enabled interrupts or events can wakeup the processor, disabled interrupts are excluded.  
84 1 = Enabled events and all interrupts, including disabled interrupts, can wakeup the processor.  
85 When an event or interrupt becomes pending, the event signal wakes up the processor from WFE. If the  
86 processor is not waiting for an event, the event is registered and affects the next WFE.  
87 The processor also wakes up on execution of an SEV instruction or an external event."]
88    #[inline(always)]
89    #[must_use]
90    pub fn sevonpend(&mut self) -> SEVONPEND_W<SCR_SPEC> {
91        SEVONPEND_W::new(self, 4)
92    }
93    #[doc = r" Writes raw bits to the register."]
94    #[doc = r""]
95    #[doc = r" # Safety"]
96    #[doc = r""]
97    #[doc = r" Passing incorrect value can cause undefined behaviour. See reference manual"]
98    #[inline(always)]
99    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
100        self.bits = bits;
101        self
102    }
103}
104#[doc = "System Control Register. Use the System Control Register for power-management functions: signal to the system when the processor can enter a low power state, control how the processor enters and exits low power states.  
105
106You can [`read`](crate::generic::Reg::read) this register and get [`scr::R`](R).  You can [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`write_with_zero`](crate::generic::Reg::write_with_zero) this register using [`scr::W`](W). You can also [`modify`](crate::generic::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
107pub struct SCR_SPEC;
108impl crate::RegisterSpec for SCR_SPEC {
109    type Ux = u32;
110}
111#[doc = "`read()` method returns [`scr::R`](R) reader structure"]
112impl crate::Readable for SCR_SPEC {}
113#[doc = "`write(|w| ..)` method takes [`scr::W`](W) writer structure"]
114impl crate::Writable for SCR_SPEC {
115    const ZERO_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
116    const ONE_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
117}
118#[doc = "`reset()` method sets SCR to value 0"]
119impl crate::Resettable for SCR_SPEC {
120    const RESET_VALUE: u32 = 0;
121}