esp32/ledc/hsch/
conf0.rs

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 - There are four high speed timers the two bits are used to select one of them for high speed channel0. 2'b00: seletc hstimer0. 2'b01: select hstimer1. 2'b10: select hstimer2. 2'b11: select hstimer3."]
6pub type TIMER_SEL_R = crate::FieldReader;
7#[doc = "Field `TIMER_SEL` writer - There are four high speed timers the two bits are used to select one of them for high speed channel0. 2'b00: seletc hstimer0. 2'b01: select hstimer1. 2'b10: select hstimer2. 2'b11: select hstimer3."]
8pub type TIMER_SEL_W<'a, REG> = crate::FieldWriter<'a, REG, 2>;
9#[doc = "Field `SIG_OUT_EN` reader - This is the output enable control bit for high speed channel0"]
10pub type SIG_OUT_EN_R = crate::BitReader;
11#[doc = "Field `SIG_OUT_EN` writer - This is the output enable control bit for high speed channel0"]
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 high speed channel0 is off."]
14pub type IDLE_LV_R = crate::BitReader;
15#[doc = "Field `IDLE_LV` writer - This bit is used to control the output value when high speed channel0 is off."]
16pub type IDLE_LV_W<'a, REG> = crate::BitWriter<'a, REG>;
17impl R {
18    #[doc = "Bits 0:1 - There are four high speed timers the two bits are used to select one of them for high speed channel0. 2'b00: seletc hstimer0. 2'b01: select hstimer1. 2'b10: select hstimer2. 2'b11: select hstimer3."]
19    #[inline(always)]
20    pub fn timer_sel(&self) -> TIMER_SEL_R {
21        TIMER_SEL_R::new((self.bits & 3) as u8)
22    }
23    #[doc = "Bit 2 - This is the output enable control bit for high speed channel0"]
24    #[inline(always)]
25    pub fn sig_out_en(&self) -> SIG_OUT_EN_R {
26        SIG_OUT_EN_R::new(((self.bits >> 2) & 1) != 0)
27    }
28    #[doc = "Bit 3 - This bit is used to control the output value when high speed channel0 is off."]
29    #[inline(always)]
30    pub fn idle_lv(&self) -> IDLE_LV_R {
31        IDLE_LV_R::new(((self.bits >> 3) & 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("CONF0")
38            .field("timer_sel", &self.timer_sel())
39            .field("sig_out_en", &self.sig_out_en())
40            .field("idle_lv", &self.idle_lv())
41            .finish()
42    }
43}
44impl W {
45    #[doc = "Bits 0:1 - There are four high speed timers the two bits are used to select one of them for high speed channel0. 2'b00: seletc hstimer0. 2'b01: select hstimer1. 2'b10: select hstimer2. 2'b11: select hstimer3."]
46    #[inline(always)]
47    pub fn timer_sel(&mut self) -> TIMER_SEL_W<CONF0_SPEC> {
48        TIMER_SEL_W::new(self, 0)
49    }
50    #[doc = "Bit 2 - This is the output enable control bit for high speed channel0"]
51    #[inline(always)]
52    pub fn sig_out_en(&mut self) -> SIG_OUT_EN_W<CONF0_SPEC> {
53        SIG_OUT_EN_W::new(self, 2)
54    }
55    #[doc = "Bit 3 - This bit is used to control the output value when high speed channel0 is off."]
56    #[inline(always)]
57    pub fn idle_lv(&mut self) -> IDLE_LV_W<CONF0_SPEC> {
58        IDLE_LV_W::new(self, 3)
59    }
60}
61#[doc = "\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)."]
62pub struct CONF0_SPEC;
63impl crate::RegisterSpec for CONF0_SPEC {
64    type Ux = u32;
65}
66#[doc = "`read()` method returns [`conf0::R`](R) reader structure"]
67impl crate::Readable for CONF0_SPEC {}
68#[doc = "`write(|w| ..)` method takes [`conf0::W`](W) writer structure"]
69impl crate::Writable for CONF0_SPEC {
70    type Safety = crate::Unsafe;
71    const ZERO_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
72    const ONE_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
73}
74#[doc = "`reset()` method sets CONF0 to value 0"]
75impl crate::Resettable for CONF0_SPEC {
76    const RESET_VALUE: u32 = 0;
77}