esp32p4/lp_tsens/
ctrl2.rs

1#[doc = "Register `CTRL2` reader"]
2pub type R = crate::R<CTRL2_SPEC>;
3#[doc = "Register `CTRL2` writer"]
4pub type W = crate::W<CTRL2_SPEC>;
5#[doc = "Field `XPD_WAIT` reader - N/A"]
6pub type XPD_WAIT_R = crate::FieldReader<u16>;
7#[doc = "Field `XPD_WAIT` writer - N/A"]
8pub type XPD_WAIT_W<'a, REG> = crate::FieldWriter<'a, REG, 12, u16>;
9#[doc = "Field `XPD_FORCE` reader - N/A"]
10pub type XPD_FORCE_R = crate::FieldReader;
11#[doc = "Field `XPD_FORCE` writer - N/A"]
12pub type XPD_FORCE_W<'a, REG> = crate::FieldWriter<'a, REG, 2>;
13#[doc = "Field `CLK_INV` reader - N/A"]
14pub type CLK_INV_R = crate::BitReader;
15#[doc = "Field `CLK_INV` writer - N/A"]
16pub type CLK_INV_W<'a, REG> = crate::BitWriter<'a, REG>;
17impl R {
18    #[doc = "Bits 0:11 - N/A"]
19    #[inline(always)]
20    pub fn xpd_wait(&self) -> XPD_WAIT_R {
21        XPD_WAIT_R::new((self.bits & 0x0fff) as u16)
22    }
23    #[doc = "Bits 12:13 - N/A"]
24    #[inline(always)]
25    pub fn xpd_force(&self) -> XPD_FORCE_R {
26        XPD_FORCE_R::new(((self.bits >> 12) & 3) as u8)
27    }
28    #[doc = "Bit 14 - N/A"]
29    #[inline(always)]
30    pub fn clk_inv(&self) -> CLK_INV_R {
31        CLK_INV_R::new(((self.bits >> 14) & 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("CTRL2")
38            .field("xpd_wait", &format_args!("{}", self.xpd_wait().bits()))
39            .field("xpd_force", &format_args!("{}", self.xpd_force().bits()))
40            .field("clk_inv", &format_args!("{}", self.clk_inv().bit()))
41            .finish()
42    }
43}
44#[cfg(feature = "impl-register-debug")]
45impl core::fmt::Debug for crate::generic::Reg<CTRL2_SPEC> {
46    fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
47        core::fmt::Debug::fmt(&self.read(), f)
48    }
49}
50impl W {
51    #[doc = "Bits 0:11 - N/A"]
52    #[inline(always)]
53    #[must_use]
54    pub fn xpd_wait(&mut self) -> XPD_WAIT_W<CTRL2_SPEC> {
55        XPD_WAIT_W::new(self, 0)
56    }
57    #[doc = "Bits 12:13 - N/A"]
58    #[inline(always)]
59    #[must_use]
60    pub fn xpd_force(&mut self) -> XPD_FORCE_W<CTRL2_SPEC> {
61        XPD_FORCE_W::new(self, 12)
62    }
63    #[doc = "Bit 14 - N/A"]
64    #[inline(always)]
65    #[must_use]
66    pub fn clk_inv(&mut self) -> CLK_INV_W<CTRL2_SPEC> {
67        CLK_INV_W::new(self, 14)
68    }
69}
70#[doc = "Tsens configuration.\n\nYou can [`read`](crate::generic::Reg::read) this register and get [`ctrl2::R`](R).  You can [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`write_with_zero`](crate::generic::Reg::write_with_zero) this register using [`ctrl2::W`](W). You can also [`modify`](crate::generic::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
71pub struct CTRL2_SPEC;
72impl crate::RegisterSpec for CTRL2_SPEC {
73    type Ux = u32;
74}
75#[doc = "`read()` method returns [`ctrl2::R`](R) reader structure"]
76impl crate::Readable for CTRL2_SPEC {}
77#[doc = "`write(|w| ..)` method takes [`ctrl2::W`](W) writer structure"]
78impl crate::Writable for CTRL2_SPEC {
79    type Safety = crate::Unsafe;
80    const ZERO_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
81    const ONE_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
82}
83#[doc = "`reset()` method sets CTRL2 to value 0x4002"]
84impl crate::Resettable for CTRL2_SPEC {
85    const RESET_VALUE: u32 = 0x4002;
86}