esp32s3/timg0/t/
config.rs1#[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 `USE_XTAL` reader - 1: Use XTAL_CLK as the source clock of timer group. 0: Use APB_CLK as the source clock of timer group."]
6pub type USE_XTAL_R = crate::BitReader;
7#[doc = "Field `USE_XTAL` writer - 1: Use XTAL_CLK as the source clock of timer group. 0: Use APB_CLK as the source clock of timer group."]
8pub type USE_XTAL_W<'a, REG> = crate::BitWriter<'a, REG>;
9#[doc = "Field `ALARM_EN` reader - When set, the alarm is enabled. This bit is automatically cleared once an alarm occurs."]
10pub type ALARM_EN_R = crate::BitReader;
11#[doc = "Field `ALARM_EN` writer - When set, the alarm is enabled. This bit is automatically cleared once an alarm occurs."]
12pub type ALARM_EN_W<'a, REG> = crate::BitWriter<'a, REG>;
13#[doc = "Field `DIVIDER` reader - Timer %s clock (T%s_clk) prescaler value."]
14pub type DIVIDER_R = crate::FieldReader<u16>;
15#[doc = "Field `DIVIDER` writer - Timer %s clock (T%s_clk) prescaler value."]
16pub type DIVIDER_W<'a, REG> = crate::FieldWriter<'a, REG, 16, u16>;
17#[doc = "Field `AUTORELOAD` reader - When set, timer %s auto-reload at alarm is enabled."]
18pub type AUTORELOAD_R = crate::BitReader;
19#[doc = "Field `AUTORELOAD` writer - When set, timer %s auto-reload at alarm is enabled."]
20pub type AUTORELOAD_W<'a, REG> = crate::BitWriter<'a, REG>;
21#[doc = "Field `INCREASE` reader - When set, the timer %s time-base counter will increment every clock tick. When cleared, the timer %s time-base counter will decrement."]
22pub type INCREASE_R = crate::BitReader;
23#[doc = "Field `INCREASE` writer - When set, the timer %s time-base counter will increment every clock tick. When cleared, the timer %s time-base counter will decrement."]
24pub type INCREASE_W<'a, REG> = crate::BitWriter<'a, REG>;
25#[doc = "Field `EN` reader - When set, the timer %s time-base counter is enabled."]
26pub type EN_R = crate::BitReader;
27#[doc = "Field `EN` writer - When set, the timer %s time-base counter is enabled."]
28pub type EN_W<'a, REG> = crate::BitWriter<'a, REG>;
29impl R {
30 #[doc = "Bit 9 - 1: Use XTAL_CLK as the source clock of timer group. 0: Use APB_CLK as the source clock of timer group."]
31 #[inline(always)]
32 pub fn use_xtal(&self) -> USE_XTAL_R {
33 USE_XTAL_R::new(((self.bits >> 9) & 1) != 0)
34 }
35 #[doc = "Bit 10 - When set, the alarm is enabled. This bit is automatically cleared once an alarm occurs."]
36 #[inline(always)]
37 pub fn alarm_en(&self) -> ALARM_EN_R {
38 ALARM_EN_R::new(((self.bits >> 10) & 1) != 0)
39 }
40 #[doc = "Bits 13:28 - Timer %s clock (T%s_clk) prescaler value."]
41 #[inline(always)]
42 pub fn divider(&self) -> DIVIDER_R {
43 DIVIDER_R::new(((self.bits >> 13) & 0xffff) as u16)
44 }
45 #[doc = "Bit 29 - When set, timer %s auto-reload at alarm is enabled."]
46 #[inline(always)]
47 pub fn autoreload(&self) -> AUTORELOAD_R {
48 AUTORELOAD_R::new(((self.bits >> 29) & 1) != 0)
49 }
50 #[doc = "Bit 30 - When set, the timer %s time-base counter will increment every clock tick. When cleared, the timer %s time-base counter will decrement."]
51 #[inline(always)]
52 pub fn increase(&self) -> INCREASE_R {
53 INCREASE_R::new(((self.bits >> 30) & 1) != 0)
54 }
55 #[doc = "Bit 31 - When set, the timer %s time-base counter is enabled."]
56 #[inline(always)]
57 pub fn en(&self) -> EN_R {
58 EN_R::new(((self.bits >> 31) & 1) != 0)
59 }
60}
61#[cfg(feature = "impl-register-debug")]
62impl core::fmt::Debug for R {
63 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
64 f.debug_struct("CONFIG")
65 .field("use_xtal", &self.use_xtal())
66 .field("alarm_en", &self.alarm_en())
67 .field("divider", &self.divider())
68 .field("autoreload", &self.autoreload())
69 .field("increase", &self.increase())
70 .field("en", &self.en())
71 .finish()
72 }
73}
74impl W {
75 #[doc = "Bit 9 - 1: Use XTAL_CLK as the source clock of timer group. 0: Use APB_CLK as the source clock of timer group."]
76 #[inline(always)]
77 pub fn use_xtal(&mut self) -> USE_XTAL_W<CONFIG_SPEC> {
78 USE_XTAL_W::new(self, 9)
79 }
80 #[doc = "Bit 10 - When set, the alarm is enabled. This bit is automatically cleared once an alarm occurs."]
81 #[inline(always)]
82 pub fn alarm_en(&mut self) -> ALARM_EN_W<CONFIG_SPEC> {
83 ALARM_EN_W::new(self, 10)
84 }
85 #[doc = "Bits 13:28 - Timer %s clock (T%s_clk) prescaler value."]
86 #[inline(always)]
87 pub fn divider(&mut self) -> DIVIDER_W<CONFIG_SPEC> {
88 DIVIDER_W::new(self, 13)
89 }
90 #[doc = "Bit 29 - When set, timer %s auto-reload at alarm is enabled."]
91 #[inline(always)]
92 pub fn autoreload(&mut self) -> AUTORELOAD_W<CONFIG_SPEC> {
93 AUTORELOAD_W::new(self, 29)
94 }
95 #[doc = "Bit 30 - When set, the timer %s time-base counter will increment every clock tick. When cleared, the timer %s time-base counter will decrement."]
96 #[inline(always)]
97 pub fn increase(&mut self) -> INCREASE_W<CONFIG_SPEC> {
98 INCREASE_W::new(self, 30)
99 }
100 #[doc = "Bit 31 - When set, the timer %s time-base counter is enabled."]
101 #[inline(always)]
102 pub fn en(&mut self) -> EN_W<CONFIG_SPEC> {
103 EN_W::new(self, 31)
104 }
105}
106#[doc = "Timer 0 configuration register\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)."]
107pub struct CONFIG_SPEC;
108impl crate::RegisterSpec for CONFIG_SPEC {
109 type Ux = u32;
110}
111#[doc = "`read()` method returns [`config::R`](R) reader structure"]
112impl crate::Readable for CONFIG_SPEC {}
113#[doc = "`write(|w| ..)` method takes [`config::W`](W) writer structure"]
114impl crate::Writable for CONFIG_SPEC {
115 type Safety = crate::Unsafe;
116 const ZERO_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
117 const ONE_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
118}
119#[doc = "`reset()` method sets CONFIG to value 0x6000_2000"]
120impl crate::Resettable for CONFIG_SPEC {
121 const RESET_VALUE: u32 = 0x6000_2000;
122}