esp32c6/pcr/
ledc_sclk_conf.rs

1#[doc = "Register `LEDC_SCLK_CONF` reader"]
2pub type R = crate::R<LEDC_SCLK_CONF_SPEC>;
3#[doc = "Register `LEDC_SCLK_CONF` writer"]
4pub type W = crate::W<LEDC_SCLK_CONF_SPEC>;
5#[doc = "Field `LEDC_SCLK_SEL` reader - set this field to select clock-source. 0(default): do not select anyone clock, 1: 80MHz, 2: FOSC, 3: XTAL."]
6pub type LEDC_SCLK_SEL_R = crate::FieldReader;
7#[doc = "Field `LEDC_SCLK_SEL` writer - set this field to select clock-source. 0(default): do not select anyone clock, 1: 80MHz, 2: FOSC, 3: XTAL."]
8pub type LEDC_SCLK_SEL_W<'a, REG> = crate::FieldWriter<'a, REG, 2>;
9#[doc = "Field `LEDC_SCLK_EN` reader - Set 1 to enable ledc function clock"]
10pub type LEDC_SCLK_EN_R = crate::BitReader;
11#[doc = "Field `LEDC_SCLK_EN` writer - Set 1 to enable ledc function clock"]
12pub type LEDC_SCLK_EN_W<'a, REG> = crate::BitWriter<'a, REG>;
13impl R {
14    #[doc = "Bits 20:21 - set this field to select clock-source. 0(default): do not select anyone clock, 1: 80MHz, 2: FOSC, 3: XTAL."]
15    #[inline(always)]
16    pub fn ledc_sclk_sel(&self) -> LEDC_SCLK_SEL_R {
17        LEDC_SCLK_SEL_R::new(((self.bits >> 20) & 3) as u8)
18    }
19    #[doc = "Bit 22 - Set 1 to enable ledc function clock"]
20    #[inline(always)]
21    pub fn ledc_sclk_en(&self) -> LEDC_SCLK_EN_R {
22        LEDC_SCLK_EN_R::new(((self.bits >> 22) & 1) != 0)
23    }
24}
25#[cfg(feature = "impl-register-debug")]
26impl core::fmt::Debug for R {
27    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
28        f.debug_struct("LEDC_SCLK_CONF")
29            .field("ledc_sclk_sel", &self.ledc_sclk_sel())
30            .field("ledc_sclk_en", &self.ledc_sclk_en())
31            .finish()
32    }
33}
34impl W {
35    #[doc = "Bits 20:21 - set this field to select clock-source. 0(default): do not select anyone clock, 1: 80MHz, 2: FOSC, 3: XTAL."]
36    #[inline(always)]
37    pub fn ledc_sclk_sel(&mut self) -> LEDC_SCLK_SEL_W<LEDC_SCLK_CONF_SPEC> {
38        LEDC_SCLK_SEL_W::new(self, 20)
39    }
40    #[doc = "Bit 22 - Set 1 to enable ledc function clock"]
41    #[inline(always)]
42    pub fn ledc_sclk_en(&mut self) -> LEDC_SCLK_EN_W<LEDC_SCLK_CONF_SPEC> {
43        LEDC_SCLK_EN_W::new(self, 22)
44    }
45}
46#[doc = "LEDC_SCLK configuration register\n\nYou can [`read`](crate::Reg::read) this register and get [`ledc_sclk_conf::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`ledc_sclk_conf::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
47pub struct LEDC_SCLK_CONF_SPEC;
48impl crate::RegisterSpec for LEDC_SCLK_CONF_SPEC {
49    type Ux = u32;
50}
51#[doc = "`read()` method returns [`ledc_sclk_conf::R`](R) reader structure"]
52impl crate::Readable for LEDC_SCLK_CONF_SPEC {}
53#[doc = "`write(|w| ..)` method takes [`ledc_sclk_conf::W`](W) writer structure"]
54impl crate::Writable for LEDC_SCLK_CONF_SPEC {
55    type Safety = crate::Unsafe;
56}
57#[doc = "`reset()` method sets LEDC_SCLK_CONF to value 0x0040_0000"]
58impl crate::Resettable for LEDC_SCLK_CONF_SPEC {
59    const RESET_VALUE: u32 = 0x0040_0000;
60}