esp32c6_lp/lp_apm/
func_ctrl.rs

1#[doc = "Register `FUNC_CTRL` reader"]
2pub type R = crate::R<FUNC_CTRL_SPEC>;
3#[doc = "Register `FUNC_CTRL` writer"]
4pub type W = crate::W<FUNC_CTRL_SPEC>;
5#[doc = "Field `M_PMS_FUNC_EN(0-1)` reader - PMS M%s function enable"]
6pub type M_PMS_FUNC_EN_R = crate::BitReader;
7#[doc = "Field `M_PMS_FUNC_EN(0-1)` writer - PMS M%s function enable"]
8pub type M_PMS_FUNC_EN_W<'a, REG> = crate::BitWriter<'a, REG>;
9impl R {
10    #[doc = "PMS M(0-1) function enable"]
11    #[doc = ""]
12    #[doc = "<div class=\"warning\">`n` is number of field in register. `n == 0` corresponds to `M0_PMS_FUNC_EN` field.</div>"]
13    #[inline(always)]
14    pub fn m_pms_func_en(&self, n: u8) -> M_PMS_FUNC_EN_R {
15        #[allow(clippy::no_effect)]
16        [(); 2][n as usize];
17        M_PMS_FUNC_EN_R::new(((self.bits >> n) & 1) != 0)
18    }
19    #[doc = "Iterator for array of:"]
20    #[doc = "PMS M(0-1) function enable"]
21    #[inline(always)]
22    pub fn m_pms_func_en_iter(&self) -> impl Iterator<Item = M_PMS_FUNC_EN_R> + '_ {
23        (0..2).map(move |n| M_PMS_FUNC_EN_R::new(((self.bits >> n) & 1) != 0))
24    }
25    #[doc = "Bit 0 - PMS M0 function enable"]
26    #[inline(always)]
27    pub fn m0_pms_func_en(&self) -> M_PMS_FUNC_EN_R {
28        M_PMS_FUNC_EN_R::new((self.bits & 1) != 0)
29    }
30    #[doc = "Bit 1 - PMS M1 function enable"]
31    #[inline(always)]
32    pub fn m1_pms_func_en(&self) -> M_PMS_FUNC_EN_R {
33        M_PMS_FUNC_EN_R::new(((self.bits >> 1) & 1) != 0)
34    }
35}
36#[cfg(feature = "impl-register-debug")]
37impl core::fmt::Debug for R {
38    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
39        f.debug_struct("FUNC_CTRL")
40            .field("m0_pms_func_en", &self.m0_pms_func_en())
41            .field("m1_pms_func_en", &self.m1_pms_func_en())
42            .finish()
43    }
44}
45impl W {
46    #[doc = "PMS M(0-1) function enable"]
47    #[doc = ""]
48    #[doc = "<div class=\"warning\">`n` is number of field in register. `n == 0` corresponds to `M0_PMS_FUNC_EN` field.</div>"]
49    #[inline(always)]
50    #[must_use]
51    pub fn m_pms_func_en(&mut self, n: u8) -> M_PMS_FUNC_EN_W<FUNC_CTRL_SPEC> {
52        #[allow(clippy::no_effect)]
53        [(); 2][n as usize];
54        M_PMS_FUNC_EN_W::new(self, n)
55    }
56    #[doc = "Bit 0 - PMS M0 function enable"]
57    #[inline(always)]
58    #[must_use]
59    pub fn m0_pms_func_en(&mut self) -> M_PMS_FUNC_EN_W<FUNC_CTRL_SPEC> {
60        M_PMS_FUNC_EN_W::new(self, 0)
61    }
62    #[doc = "Bit 1 - PMS M1 function enable"]
63    #[inline(always)]
64    #[must_use]
65    pub fn m1_pms_func_en(&mut self) -> M_PMS_FUNC_EN_W<FUNC_CTRL_SPEC> {
66        M_PMS_FUNC_EN_W::new(self, 1)
67    }
68}
69#[doc = "PMS function control register\n\nYou can [`read`](crate::Reg::read) this register and get [`func_ctrl::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`func_ctrl::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
70pub struct FUNC_CTRL_SPEC;
71impl crate::RegisterSpec for FUNC_CTRL_SPEC {
72    type Ux = u32;
73}
74#[doc = "`read()` method returns [`func_ctrl::R`](R) reader structure"]
75impl crate::Readable for FUNC_CTRL_SPEC {}
76#[doc = "`write(|w| ..)` method takes [`func_ctrl::W`](W) writer structure"]
77impl crate::Writable for FUNC_CTRL_SPEC {
78    type Safety = crate::Unsafe;
79    const ZERO_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
80    const ONE_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
81}
82#[doc = "`reset()` method sets FUNC_CTRL to value 0x03"]
83impl crate::Resettable for FUNC_CTRL_SPEC {
84    const RESET_VALUE: u32 = 0x03;
85}