esp32/timg0/t/
config.rs

1#[doc = "Register `CONFIG` reader"]
2pub type R = crate::R<CONFIG_SPEC>;
3#[doc = "Register `CONFIG` writer"]
4pub type W = crate::W<CONFIG_SPEC>;
5#[doc = "Field `ALARM_EN` reader - When set alarm is enabled"]
6pub type ALARM_EN_R = crate::BitReader;
7#[doc = "Field `ALARM_EN` writer - When set alarm is enabled"]
8pub type ALARM_EN_W<'a, REG> = crate::BitWriter<'a, REG>;
9#[doc = "Field `LEVEL_INT_EN` reader - When set level type interrupt will be generated during alarm"]
10pub type LEVEL_INT_EN_R = crate::BitReader;
11#[doc = "Field `LEVEL_INT_EN` writer - When set level type interrupt will be generated during alarm"]
12pub type LEVEL_INT_EN_W<'a, REG> = crate::BitWriter<'a, REG>;
13#[doc = "Field `EDGE_INT_EN` reader - When set edge type interrupt will be generated during alarm"]
14pub type EDGE_INT_EN_R = crate::BitReader;
15#[doc = "Field `EDGE_INT_EN` writer - When set edge type interrupt will be generated during alarm"]
16pub type EDGE_INT_EN_W<'a, REG> = crate::BitWriter<'a, REG>;
17#[doc = "Field `DIVIDER` reader - Timer 0 clock (T0_clk) prescale value."]
18pub type DIVIDER_R = crate::FieldReader<u16>;
19#[doc = "Field `DIVIDER` writer - Timer 0 clock (T0_clk) prescale value."]
20pub type DIVIDER_W<'a, REG> = crate::FieldWriter<'a, REG, 16, u16>;
21#[doc = "Field `AUTORELOAD` reader - When set timer 0 auto-reload at alarming is enabled"]
22pub type AUTORELOAD_R = crate::BitReader;
23#[doc = "Field `AUTORELOAD` writer - When set timer 0 auto-reload at alarming is enabled"]
24pub type AUTORELOAD_W<'a, REG> = crate::BitWriter<'a, REG>;
25#[doc = "Field `INCREASE` reader - When set timer 0 time-base counter increment. When cleared timer 0 time-base counter decrement."]
26pub type INCREASE_R = crate::BitReader;
27#[doc = "Field `INCREASE` writer - When set timer 0 time-base counter increment. When cleared timer 0 time-base counter decrement."]
28pub type INCREASE_W<'a, REG> = crate::BitWriter<'a, REG>;
29#[doc = "Field `EN` reader - When set timer 0 time-base counter is enabled"]
30pub type EN_R = crate::BitReader;
31#[doc = "Field `EN` writer - When set timer 0 time-base counter is enabled"]
32pub type EN_W<'a, REG> = crate::BitWriter<'a, REG>;
33impl R {
34    #[doc = "Bit 10 - When set alarm is enabled"]
35    #[inline(always)]
36    pub fn alarm_en(&self) -> ALARM_EN_R {
37        ALARM_EN_R::new(((self.bits >> 10) & 1) != 0)
38    }
39    #[doc = "Bit 11 - When set level type interrupt will be generated during alarm"]
40    #[inline(always)]
41    pub fn level_int_en(&self) -> LEVEL_INT_EN_R {
42        LEVEL_INT_EN_R::new(((self.bits >> 11) & 1) != 0)
43    }
44    #[doc = "Bit 12 - When set edge type interrupt will be generated during alarm"]
45    #[inline(always)]
46    pub fn edge_int_en(&self) -> EDGE_INT_EN_R {
47        EDGE_INT_EN_R::new(((self.bits >> 12) & 1) != 0)
48    }
49    #[doc = "Bits 13:28 - Timer 0 clock (T0_clk) prescale value."]
50    #[inline(always)]
51    pub fn divider(&self) -> DIVIDER_R {
52        DIVIDER_R::new(((self.bits >> 13) & 0xffff) as u16)
53    }
54    #[doc = "Bit 29 - When set timer 0 auto-reload at alarming is enabled"]
55    #[inline(always)]
56    pub fn autoreload(&self) -> AUTORELOAD_R {
57        AUTORELOAD_R::new(((self.bits >> 29) & 1) != 0)
58    }
59    #[doc = "Bit 30 - When set timer 0 time-base counter increment. When cleared timer 0 time-base counter decrement."]
60    #[inline(always)]
61    pub fn increase(&self) -> INCREASE_R {
62        INCREASE_R::new(((self.bits >> 30) & 1) != 0)
63    }
64    #[doc = "Bit 31 - When set timer 0 time-base counter is enabled"]
65    #[inline(always)]
66    pub fn en(&self) -> EN_R {
67        EN_R::new(((self.bits >> 31) & 1) != 0)
68    }
69}
70#[cfg(feature = "impl-register-debug")]
71impl core::fmt::Debug for R {
72    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
73        f.debug_struct("CONFIG")
74            .field("alarm_en", &self.alarm_en())
75            .field("level_int_en", &self.level_int_en())
76            .field("edge_int_en", &self.edge_int_en())
77            .field("divider", &self.divider())
78            .field("autoreload", &self.autoreload())
79            .field("increase", &self.increase())
80            .field("en", &self.en())
81            .finish()
82    }
83}
84impl W {
85    #[doc = "Bit 10 - When set alarm is enabled"]
86    #[inline(always)]
87    pub fn alarm_en(&mut self) -> ALARM_EN_W<CONFIG_SPEC> {
88        ALARM_EN_W::new(self, 10)
89    }
90    #[doc = "Bit 11 - When set level type interrupt will be generated during alarm"]
91    #[inline(always)]
92    pub fn level_int_en(&mut self) -> LEVEL_INT_EN_W<CONFIG_SPEC> {
93        LEVEL_INT_EN_W::new(self, 11)
94    }
95    #[doc = "Bit 12 - When set edge type interrupt will be generated during alarm"]
96    #[inline(always)]
97    pub fn edge_int_en(&mut self) -> EDGE_INT_EN_W<CONFIG_SPEC> {
98        EDGE_INT_EN_W::new(self, 12)
99    }
100    #[doc = "Bits 13:28 - Timer 0 clock (T0_clk) prescale value."]
101    #[inline(always)]
102    pub fn divider(&mut self) -> DIVIDER_W<CONFIG_SPEC> {
103        DIVIDER_W::new(self, 13)
104    }
105    #[doc = "Bit 29 - When set timer 0 auto-reload at alarming is enabled"]
106    #[inline(always)]
107    pub fn autoreload(&mut self) -> AUTORELOAD_W<CONFIG_SPEC> {
108        AUTORELOAD_W::new(self, 29)
109    }
110    #[doc = "Bit 30 - When set timer 0 time-base counter increment. When cleared timer 0 time-base counter decrement."]
111    #[inline(always)]
112    pub fn increase(&mut self) -> INCREASE_W<CONFIG_SPEC> {
113        INCREASE_W::new(self, 30)
114    }
115    #[doc = "Bit 31 - When set timer 0 time-base counter is enabled"]
116    #[inline(always)]
117    pub fn en(&mut self) -> EN_W<CONFIG_SPEC> {
118        EN_W::new(self, 31)
119    }
120}
121#[doc = "\n\nYou can [`read`](crate::Reg::read) this register and get [`config::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`config::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
122pub struct CONFIG_SPEC;
123impl crate::RegisterSpec for CONFIG_SPEC {
124    type Ux = u32;
125}
126#[doc = "`read()` method returns [`config::R`](R) reader structure"]
127impl crate::Readable for CONFIG_SPEC {}
128#[doc = "`write(|w| ..)` method takes [`config::W`](W) writer structure"]
129impl crate::Writable for CONFIG_SPEC {
130    type Safety = crate::Unsafe;
131    const ZERO_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
132    const ONE_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
133}
134#[doc = "`reset()` method sets CONFIG to value 0x6000_2000"]
135impl crate::Resettable for CONFIG_SPEC {
136    const RESET_VALUE: u32 = 0x6000_2000;
137}