esp32/rtc_cntl/
wakeup_state.rs

1#[doc = "Register `WAKEUP_STATE` reader"]
2pub type R = crate::R<WAKEUP_STATE_SPEC>;
3#[doc = "Register `WAKEUP_STATE` writer"]
4pub type W = crate::W<WAKEUP_STATE_SPEC>;
5#[doc = "Field `WAKEUP_CAUSE` reader - wakeup cause"]
6pub type WAKEUP_CAUSE_R = crate::FieldReader<u16>;
7#[doc = "Field `WAKEUP_ENA` reader - wakeup enable bitmap"]
8pub type WAKEUP_ENA_R = crate::FieldReader<u16>;
9#[doc = "Field `WAKEUP_ENA` writer - wakeup enable bitmap"]
10pub type WAKEUP_ENA_W<'a, REG> = crate::FieldWriter<'a, REG, 11, u16>;
11#[doc = "Field `GPIO_WAKEUP_FILTER` reader - enable filter for gpio wakeup event"]
12pub type GPIO_WAKEUP_FILTER_R = crate::BitReader;
13#[doc = "Field `GPIO_WAKEUP_FILTER` writer - enable filter for gpio wakeup event"]
14pub type GPIO_WAKEUP_FILTER_W<'a, REG> = crate::BitWriter<'a, REG>;
15impl R {
16    #[doc = "Bits 0:10 - wakeup cause"]
17    #[inline(always)]
18    pub fn wakeup_cause(&self) -> WAKEUP_CAUSE_R {
19        WAKEUP_CAUSE_R::new((self.bits & 0x07ff) as u16)
20    }
21    #[doc = "Bits 11:21 - wakeup enable bitmap"]
22    #[inline(always)]
23    pub fn wakeup_ena(&self) -> WAKEUP_ENA_R {
24        WAKEUP_ENA_R::new(((self.bits >> 11) & 0x07ff) as u16)
25    }
26    #[doc = "Bit 22 - enable filter for gpio wakeup event"]
27    #[inline(always)]
28    pub fn gpio_wakeup_filter(&self) -> GPIO_WAKEUP_FILTER_R {
29        GPIO_WAKEUP_FILTER_R::new(((self.bits >> 22) & 1) != 0)
30    }
31}
32#[cfg(feature = "impl-register-debug")]
33impl core::fmt::Debug for R {
34    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
35        f.debug_struct("WAKEUP_STATE")
36            .field("wakeup_cause", &self.wakeup_cause())
37            .field("wakeup_ena", &self.wakeup_ena())
38            .field("gpio_wakeup_filter", &self.gpio_wakeup_filter())
39            .finish()
40    }
41}
42impl W {
43    #[doc = "Bits 11:21 - wakeup enable bitmap"]
44    #[inline(always)]
45    pub fn wakeup_ena(&mut self) -> WAKEUP_ENA_W<WAKEUP_STATE_SPEC> {
46        WAKEUP_ENA_W::new(self, 11)
47    }
48    #[doc = "Bit 22 - enable filter for gpio wakeup event"]
49    #[inline(always)]
50    pub fn gpio_wakeup_filter(&mut self) -> GPIO_WAKEUP_FILTER_W<WAKEUP_STATE_SPEC> {
51        GPIO_WAKEUP_FILTER_W::new(self, 22)
52    }
53}
54#[doc = "\n\nYou can [`read`](crate::Reg::read) this register and get [`wakeup_state::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`wakeup_state::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
55pub struct WAKEUP_STATE_SPEC;
56impl crate::RegisterSpec for WAKEUP_STATE_SPEC {
57    type Ux = u32;
58}
59#[doc = "`read()` method returns [`wakeup_state::R`](R) reader structure"]
60impl crate::Readable for WAKEUP_STATE_SPEC {}
61#[doc = "`write(|w| ..)` method takes [`wakeup_state::W`](W) writer structure"]
62impl crate::Writable for WAKEUP_STATE_SPEC {
63    type Safety = crate::Unsafe;
64}
65#[doc = "`reset()` method sets WAKEUP_STATE to value 0x6000"]
66impl crate::Resettable for WAKEUP_STATE_SPEC {
67    const RESET_VALUE: u32 = 0x6000;
68}