esp32s2_ulp/rtc_io/
pin.rs

1#[doc = "Register `PIN%s` reader"]
2pub type R = crate::R<PIN_SPEC>;
3#[doc = "Register `PIN%s` writer"]
4pub type W = crate::W<PIN_SPEC>;
5#[doc = "Field `GPIO_PIN_PAD_DRIVER` reader - Pad driver selection. 0: normal output. 1: open drain."]
6pub type GPIO_PIN_PAD_DRIVER_R = crate::BitReader;
7#[doc = "Field `GPIO_PIN_PAD_DRIVER` writer - Pad driver selection. 0: normal output. 1: open drain."]
8pub type GPIO_PIN_PAD_DRIVER_W<'a, REG> = crate::BitWriter<'a, REG>;
9#[doc = "Field `GPIO_PIN_INT_TYPE` reader - GPIO interrupt type selection. 0: GPIO interrupt disabled. 1: rising edge trigger. 2: falling edge trigger. 3: any edge trigger. 4: low level trigger. 5: high level trigger."]
10pub type GPIO_PIN_INT_TYPE_R = crate::FieldReader;
11#[doc = "Field `GPIO_PIN_INT_TYPE` writer - GPIO interrupt type selection. 0: GPIO interrupt disabled. 1: rising edge trigger. 2: falling edge trigger. 3: any edge trigger. 4: low level trigger. 5: high level trigger."]
12pub type GPIO_PIN_INT_TYPE_W<'a, REG> = crate::FieldWriter<'a, REG, 3>;
13#[doc = "Field `GPIO_PIN_WAKEUP_ENABLE` reader - GPIO wake-up enable. This will only wake up ESP32-S2 from Light-sleep."]
14pub type GPIO_PIN_WAKEUP_ENABLE_R = crate::BitReader;
15#[doc = "Field `GPIO_PIN_WAKEUP_ENABLE` writer - GPIO wake-up enable. This will only wake up ESP32-S2 from Light-sleep."]
16pub type GPIO_PIN_WAKEUP_ENABLE_W<'a, REG> = crate::BitWriter<'a, REG>;
17impl R {
18    #[doc = "Bit 2 - Pad driver selection. 0: normal output. 1: open drain."]
19    #[inline(always)]
20    pub fn gpio_pin_pad_driver(&self) -> GPIO_PIN_PAD_DRIVER_R {
21        GPIO_PIN_PAD_DRIVER_R::new(((self.bits >> 2) & 1) != 0)
22    }
23    #[doc = "Bits 7:9 - GPIO interrupt type selection. 0: GPIO interrupt disabled. 1: rising edge trigger. 2: falling edge trigger. 3: any edge trigger. 4: low level trigger. 5: high level trigger."]
24    #[inline(always)]
25    pub fn gpio_pin_int_type(&self) -> GPIO_PIN_INT_TYPE_R {
26        GPIO_PIN_INT_TYPE_R::new(((self.bits >> 7) & 7) as u8)
27    }
28    #[doc = "Bit 10 - GPIO wake-up enable. This will only wake up ESP32-S2 from Light-sleep."]
29    #[inline(always)]
30    pub fn gpio_pin_wakeup_enable(&self) -> GPIO_PIN_WAKEUP_ENABLE_R {
31        GPIO_PIN_WAKEUP_ENABLE_R::new(((self.bits >> 10) & 1) != 0)
32    }
33}
34#[cfg(feature = "impl-register-debug")]
35impl core::fmt::Debug for R {
36    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
37        f.debug_struct("PIN")
38            .field("gpio_pin_pad_driver", &self.gpio_pin_pad_driver())
39            .field("gpio_pin_int_type", &self.gpio_pin_int_type())
40            .field("gpio_pin_wakeup_enable", &self.gpio_pin_wakeup_enable())
41            .finish()
42    }
43}
44impl W {
45    #[doc = "Bit 2 - Pad driver selection. 0: normal output. 1: open drain."]
46    #[inline(always)]
47    #[must_use]
48    pub fn gpio_pin_pad_driver(&mut self) -> GPIO_PIN_PAD_DRIVER_W<PIN_SPEC> {
49        GPIO_PIN_PAD_DRIVER_W::new(self, 2)
50    }
51    #[doc = "Bits 7:9 - GPIO interrupt type selection. 0: GPIO interrupt disabled. 1: rising edge trigger. 2: falling edge trigger. 3: any edge trigger. 4: low level trigger. 5: high level trigger."]
52    #[inline(always)]
53    #[must_use]
54    pub fn gpio_pin_int_type(&mut self) -> GPIO_PIN_INT_TYPE_W<PIN_SPEC> {
55        GPIO_PIN_INT_TYPE_W::new(self, 7)
56    }
57    #[doc = "Bit 10 - GPIO wake-up enable. This will only wake up ESP32-S2 from Light-sleep."]
58    #[inline(always)]
59    #[must_use]
60    pub fn gpio_pin_wakeup_enable(&mut self) -> GPIO_PIN_WAKEUP_ENABLE_W<PIN_SPEC> {
61        GPIO_PIN_WAKEUP_ENABLE_W::new(self, 10)
62    }
63}
64#[doc = "RTC configuration for pin %s\n\nYou can [`read`](crate::Reg::read) this register and get [`pin::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`pin::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
65pub struct PIN_SPEC;
66impl crate::RegisterSpec for PIN_SPEC {
67    type Ux = u32;
68}
69#[doc = "`read()` method returns [`pin::R`](R) reader structure"]
70impl crate::Readable for PIN_SPEC {}
71#[doc = "`write(|w| ..)` method takes [`pin::W`](W) writer structure"]
72impl crate::Writable for PIN_SPEC {
73    type Safety = crate::Unsafe;
74    const ZERO_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
75    const ONE_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
76}
77#[doc = "`reset()` method sets PIN%s to value 0"]
78impl crate::Resettable for PIN_SPEC {
79    const RESET_VALUE: u32 = 0;
80}