esp32/timg0/
int_ena.rs

1#[doc = "Register `INT_ENA` reader"]
2pub type R = crate::R<INT_ENA_SPEC>;
3#[doc = "Register `INT_ENA` writer"]
4pub type W = crate::W<INT_ENA_SPEC>;
5#[doc = "Field `T(0-1)` reader - interrupt when timer%s alarm"]
6pub type T_R = crate::BitReader;
7#[doc = "Field `T(0-1)` writer - interrupt when timer%s alarm"]
8pub type T_W<'a, REG> = crate::BitWriter<'a, REG>;
9#[doc = "Field `WDT` reader - Interrupt when an interrupt stage timeout"]
10pub type WDT_R = crate::BitReader;
11#[doc = "Field `WDT` writer - Interrupt when an interrupt stage timeout"]
12pub type WDT_W<'a, REG> = crate::BitWriter<'a, REG>;
13#[doc = "Field `LACT` reader - "]
14pub type LACT_R = crate::BitReader;
15#[doc = "Field `LACT` writer - "]
16pub type LACT_W<'a, REG> = crate::BitWriter<'a, REG>;
17impl R {
18    #[doc = "interrupt when timer(0-1) alarm"]
19    #[doc = ""]
20    #[doc = "<div class=\"warning\">`n` is number of field in register. `n == 0` corresponds to `T0` field.</div>"]
21    #[inline(always)]
22    pub fn t(&self, n: u8) -> T_R {
23        #[allow(clippy::no_effect)]
24        [(); 2][n as usize];
25        T_R::new(((self.bits >> n) & 1) != 0)
26    }
27    #[doc = "Iterator for array of:"]
28    #[doc = "interrupt when timer(0-1) alarm"]
29    #[inline(always)]
30    pub fn t_iter(&self) -> impl Iterator<Item = T_R> + '_ {
31        (0..2).map(move |n| T_R::new(((self.bits >> n) & 1) != 0))
32    }
33    #[doc = "Bit 0 - interrupt when timer0 alarm"]
34    #[inline(always)]
35    pub fn t0(&self) -> T_R {
36        T_R::new((self.bits & 1) != 0)
37    }
38    #[doc = "Bit 1 - interrupt when timer1 alarm"]
39    #[inline(always)]
40    pub fn t1(&self) -> T_R {
41        T_R::new(((self.bits >> 1) & 1) != 0)
42    }
43    #[doc = "Bit 2 - Interrupt when an interrupt stage timeout"]
44    #[inline(always)]
45    pub fn wdt(&self) -> WDT_R {
46        WDT_R::new(((self.bits >> 2) & 1) != 0)
47    }
48    #[doc = "Bit 3"]
49    #[inline(always)]
50    pub fn lact(&self) -> LACT_R {
51        LACT_R::new(((self.bits >> 3) & 1) != 0)
52    }
53}
54#[cfg(feature = "impl-register-debug")]
55impl core::fmt::Debug for R {
56    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
57        f.debug_struct("INT_ENA")
58            .field("t0", &self.t0())
59            .field("t1", &self.t1())
60            .field("wdt", &self.wdt())
61            .field("lact", &self.lact())
62            .finish()
63    }
64}
65impl W {
66    #[doc = "interrupt when timer(0-1) alarm"]
67    #[doc = ""]
68    #[doc = "<div class=\"warning\">`n` is number of field in register. `n == 0` corresponds to `T0` field.</div>"]
69    #[inline(always)]
70    pub fn t(&mut self, n: u8) -> T_W<INT_ENA_SPEC> {
71        #[allow(clippy::no_effect)]
72        [(); 2][n as usize];
73        T_W::new(self, n)
74    }
75    #[doc = "Bit 0 - interrupt when timer0 alarm"]
76    #[inline(always)]
77    pub fn t0(&mut self) -> T_W<INT_ENA_SPEC> {
78        T_W::new(self, 0)
79    }
80    #[doc = "Bit 1 - interrupt when timer1 alarm"]
81    #[inline(always)]
82    pub fn t1(&mut self) -> T_W<INT_ENA_SPEC> {
83        T_W::new(self, 1)
84    }
85    #[doc = "Bit 2 - Interrupt when an interrupt stage timeout"]
86    #[inline(always)]
87    pub fn wdt(&mut self) -> WDT_W<INT_ENA_SPEC> {
88        WDT_W::new(self, 2)
89    }
90    #[doc = "Bit 3"]
91    #[inline(always)]
92    pub fn lact(&mut self) -> LACT_W<INT_ENA_SPEC> {
93        LACT_W::new(self, 3)
94    }
95}
96#[doc = "\n\nYou can [`read`](crate::Reg::read) this register and get [`int_ena::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`int_ena::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
97pub struct INT_ENA_SPEC;
98impl crate::RegisterSpec for INT_ENA_SPEC {
99    type Ux = u32;
100}
101#[doc = "`read()` method returns [`int_ena::R`](R) reader structure"]
102impl crate::Readable for INT_ENA_SPEC {}
103#[doc = "`write(|w| ..)` method takes [`int_ena::W`](W) writer structure"]
104impl crate::Writable for INT_ENA_SPEC {
105    type Safety = crate::Unsafe;
106    const ZERO_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
107    const ONE_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
108}
109#[doc = "`reset()` method sets INT_ENA to value 0"]
110impl crate::Resettable for INT_ENA_SPEC {
111    const RESET_VALUE: u32 = 0;
112}