1#[doc = "Register `CONF0` reader"]
2pub type R = crate::R<CONF0_SPEC>;
3#[doc = "Register `CONF0` writer"]
4pub type W = crate::W<CONF0_SPEC>;
5#[doc = "Field `TIMER_SEL` reader - This field is used to select one of timers for channel %s. 0: select timer 0. 1: select timer 1. 2: select timer 2. 3: select timer 3."]
6pub type TIMER_SEL_R = crate::FieldReader;
7#[doc = "Field `TIMER_SEL` writer - This field is used to select one of timers for channel %s. 0: select timer 0. 1: select timer 1. 2: select timer 2. 3: select timer 3."]
8pub type TIMER_SEL_W<'a, REG> = crate::FieldWriter<'a, REG, 2>;
9#[doc = "Field `SIG_OUT_EN` reader - Set this bit to enable signal output on channel %s."]
10pub type SIG_OUT_EN_R = crate::BitReader;
11#[doc = "Field `SIG_OUT_EN` writer - Set this bit to enable signal output on channel %s."]
12pub type SIG_OUT_EN_W<'a, REG> = crate::BitWriter<'a, REG>;
13#[doc = "Field `IDLE_LV` reader - This bit is used to control the output value when channel %s is inactive."]
14pub type IDLE_LV_R = crate::BitReader;
15#[doc = "Field `IDLE_LV` writer - This bit is used to control the output value when channel %s is inactive."]
16pub type IDLE_LV_W<'a, REG> = crate::BitWriter<'a, REG>;
17#[doc = "Field `PARA_UP` writer - This bit is used to update register LEDC_CH%s_HPOINT and LEDC_CH%s_DUTY for channel %s."]
18pub type PARA_UP_W<'a, REG> = crate::BitWriter<'a, REG>;
19#[doc = "Field `OVF_NUM` reader - This register is used to configure the maximum times of overflow minus 1. The LEDC_OVF_CNT_CH%s_INT interrupt will be triggered when channel %s overflows for (LEDC_OVF_NUM_CH%s + 1) times."]
20pub type OVF_NUM_R = crate::FieldReader<u16>;
21#[doc = "Field `OVF_NUM` writer - This register is used to configure the maximum times of overflow minus 1. The LEDC_OVF_CNT_CH%s_INT interrupt will be triggered when channel %s overflows for (LEDC_OVF_NUM_CH%s + 1) times."]
22pub type OVF_NUM_W<'a, REG> = crate::FieldWriter<'a, REG, 10, u16>;
23#[doc = "Field `OVF_CNT_EN` reader - This bit is used to enable the ovf_cnt of channel %s."]
24pub type OVF_CNT_EN_R = crate::BitReader;
25#[doc = "Field `OVF_CNT_EN` writer - This bit is used to enable the ovf_cnt of channel %s."]
26pub type OVF_CNT_EN_W<'a, REG> = crate::BitWriter<'a, REG>;
27#[doc = "Field `OVF_CNT_RESET` writer - Set this bit to reset the ovf_cnt of channel %s."]
28pub type OVF_CNT_RESET_W<'a, REG> = crate::BitWriter<'a, REG>;
29#[doc = "Field `OVF_CNT_RESET_ST` reader - This is the status bit of LEDC_OVF_CNT_RESET_CH%s."]
30pub type OVF_CNT_RESET_ST_R = crate::BitReader;
31impl R {
32 #[doc = "Bits 0:1 - This field is used to select one of timers for channel %s. 0: select timer 0. 1: select timer 1. 2: select timer 2. 3: select timer 3."]
33 #[inline(always)]
34 pub fn timer_sel(&self) -> TIMER_SEL_R {
35 TIMER_SEL_R::new((self.bits & 3) as u8)
36 }
37 #[doc = "Bit 2 - Set this bit to enable signal output on channel %s."]
38 #[inline(always)]
39 pub fn sig_out_en(&self) -> SIG_OUT_EN_R {
40 SIG_OUT_EN_R::new(((self.bits >> 2) & 1) != 0)
41 }
42 #[doc = "Bit 3 - This bit is used to control the output value when channel %s is inactive."]
43 #[inline(always)]
44 pub fn idle_lv(&self) -> IDLE_LV_R {
45 IDLE_LV_R::new(((self.bits >> 3) & 1) != 0)
46 }
47 #[doc = "Bits 5:14 - This register is used to configure the maximum times of overflow minus 1. The LEDC_OVF_CNT_CH%s_INT interrupt will be triggered when channel %s overflows for (LEDC_OVF_NUM_CH%s + 1) times."]
48 #[inline(always)]
49 pub fn ovf_num(&self) -> OVF_NUM_R {
50 OVF_NUM_R::new(((self.bits >> 5) & 0x03ff) as u16)
51 }
52 #[doc = "Bit 15 - This bit is used to enable the ovf_cnt of channel %s."]
53 #[inline(always)]
54 pub fn ovf_cnt_en(&self) -> OVF_CNT_EN_R {
55 OVF_CNT_EN_R::new(((self.bits >> 15) & 1) != 0)
56 }
57 #[doc = "Bit 17 - This is the status bit of LEDC_OVF_CNT_RESET_CH%s."]
58 #[inline(always)]
59 pub fn ovf_cnt_reset_st(&self) -> OVF_CNT_RESET_ST_R {
60 OVF_CNT_RESET_ST_R::new(((self.bits >> 17) & 1) != 0)
61 }
62}
63#[cfg(feature = "impl-register-debug")]
64impl core::fmt::Debug for R {
65 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
66 f.debug_struct("CONF0")
67 .field("timer_sel", &self.timer_sel())
68 .field("sig_out_en", &self.sig_out_en())
69 .field("idle_lv", &self.idle_lv())
70 .field("ovf_num", &self.ovf_num())
71 .field("ovf_cnt_en", &self.ovf_cnt_en())
72 .field("ovf_cnt_reset_st", &self.ovf_cnt_reset_st())
73 .finish()
74 }
75}
76impl W {
77 #[doc = "Bits 0:1 - This field is used to select one of timers for channel %s. 0: select timer 0. 1: select timer 1. 2: select timer 2. 3: select timer 3."]
78 #[inline(always)]
79 pub fn timer_sel(&mut self) -> TIMER_SEL_W<CONF0_SPEC> {
80 TIMER_SEL_W::new(self, 0)
81 }
82 #[doc = "Bit 2 - Set this bit to enable signal output on channel %s."]
83 #[inline(always)]
84 pub fn sig_out_en(&mut self) -> SIG_OUT_EN_W<CONF0_SPEC> {
85 SIG_OUT_EN_W::new(self, 2)
86 }
87 #[doc = "Bit 3 - This bit is used to control the output value when channel %s is inactive."]
88 #[inline(always)]
89 pub fn idle_lv(&mut self) -> IDLE_LV_W<CONF0_SPEC> {
90 IDLE_LV_W::new(self, 3)
91 }
92 #[doc = "Bit 4 - This bit is used to update register LEDC_CH%s_HPOINT and LEDC_CH%s_DUTY for channel %s."]
93 #[inline(always)]
94 pub fn para_up(&mut self) -> PARA_UP_W<CONF0_SPEC> {
95 PARA_UP_W::new(self, 4)
96 }
97 #[doc = "Bits 5:14 - This register is used to configure the maximum times of overflow minus 1. The LEDC_OVF_CNT_CH%s_INT interrupt will be triggered when channel %s overflows for (LEDC_OVF_NUM_CH%s + 1) times."]
98 #[inline(always)]
99 pub fn ovf_num(&mut self) -> OVF_NUM_W<CONF0_SPEC> {
100 OVF_NUM_W::new(self, 5)
101 }
102 #[doc = "Bit 15 - This bit is used to enable the ovf_cnt of channel %s."]
103 #[inline(always)]
104 pub fn ovf_cnt_en(&mut self) -> OVF_CNT_EN_W<CONF0_SPEC> {
105 OVF_CNT_EN_W::new(self, 15)
106 }
107 #[doc = "Bit 16 - Set this bit to reset the ovf_cnt of channel %s."]
108 #[inline(always)]
109 pub fn ovf_cnt_reset(&mut self) -> OVF_CNT_RESET_W<CONF0_SPEC> {
110 OVF_CNT_RESET_W::new(self, 16)
111 }
112}
113#[doc = "Configuration register 0 for channel 0\n\nYou can [`read`](crate::Reg::read) this register and get [`conf0::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`conf0::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
114pub struct CONF0_SPEC;
115impl crate::RegisterSpec for CONF0_SPEC {
116 type Ux = u32;
117}
118#[doc = "`read()` method returns [`conf0::R`](R) reader structure"]
119impl crate::Readable for CONF0_SPEC {}
120#[doc = "`write(|w| ..)` method takes [`conf0::W`](W) writer structure"]
121impl crate::Writable for CONF0_SPEC {
122 type Safety = crate::Unsafe;
123}
124#[doc = "`reset()` method sets CONF0 to value 0"]
125impl crate::Resettable for CONF0_SPEC {}