esp32s3/sens/
sar_meas2_ctrl2.rs

1#[doc = "Register `SAR_MEAS2_CTRL2` reader"]
2pub type R = crate::R<SAR_MEAS2_CTRL2_SPEC>;
3#[doc = "Register `SAR_MEAS2_CTRL2` writer"]
4pub type W = crate::W<SAR_MEAS2_CTRL2_SPEC>;
5#[doc = "Field `MEAS2_DATA_SAR` reader - SAR ADC2 data"]
6pub type MEAS2_DATA_SAR_R = crate::FieldReader<u16>;
7#[doc = "Field `MEAS2_DONE_SAR` reader - SAR ADC2 conversion done indication"]
8pub type MEAS2_DONE_SAR_R = crate::BitReader;
9#[doc = "Field `MEAS2_START_SAR` reader - SAR ADC2 controller (in RTC) starts conversion"]
10pub type MEAS2_START_SAR_R = crate::BitReader;
11#[doc = "Field `MEAS2_START_SAR` writer - SAR ADC2 controller (in RTC) starts conversion"]
12pub type MEAS2_START_SAR_W<'a, REG> = crate::BitWriter<'a, REG>;
13#[doc = "Field `MEAS2_START_FORCE` reader - 1: SAR ADC2 controller (in RTC) is started by SW"]
14pub type MEAS2_START_FORCE_R = crate::BitReader;
15#[doc = "Field `MEAS2_START_FORCE` writer - 1: SAR ADC2 controller (in RTC) is started by SW"]
16pub type MEAS2_START_FORCE_W<'a, REG> = crate::BitWriter<'a, REG>;
17#[doc = "Field `SAR2_EN_PAD` reader - SAR ADC2 pad enable bitmap"]
18pub type SAR2_EN_PAD_R = crate::FieldReader<u16>;
19#[doc = "Field `SAR2_EN_PAD` writer - SAR ADC2 pad enable bitmap"]
20pub type SAR2_EN_PAD_W<'a, REG> = crate::FieldWriter<'a, REG, 12, u16>;
21#[doc = "Field `SAR2_EN_PAD_FORCE` reader - 1: SAR ADC2 pad enable bitmap is controlled by SW"]
22pub type SAR2_EN_PAD_FORCE_R = crate::BitReader;
23#[doc = "Field `SAR2_EN_PAD_FORCE` writer - 1: SAR ADC2 pad enable bitmap is controlled by SW"]
24pub type SAR2_EN_PAD_FORCE_W<'a, REG> = crate::BitWriter<'a, REG>;
25impl R {
26    #[doc = "Bits 0:15 - SAR ADC2 data"]
27    #[inline(always)]
28    pub fn meas2_data_sar(&self) -> MEAS2_DATA_SAR_R {
29        MEAS2_DATA_SAR_R::new((self.bits & 0xffff) as u16)
30    }
31    #[doc = "Bit 16 - SAR ADC2 conversion done indication"]
32    #[inline(always)]
33    pub fn meas2_done_sar(&self) -> MEAS2_DONE_SAR_R {
34        MEAS2_DONE_SAR_R::new(((self.bits >> 16) & 1) != 0)
35    }
36    #[doc = "Bit 17 - SAR ADC2 controller (in RTC) starts conversion"]
37    #[inline(always)]
38    pub fn meas2_start_sar(&self) -> MEAS2_START_SAR_R {
39        MEAS2_START_SAR_R::new(((self.bits >> 17) & 1) != 0)
40    }
41    #[doc = "Bit 18 - 1: SAR ADC2 controller (in RTC) is started by SW"]
42    #[inline(always)]
43    pub fn meas2_start_force(&self) -> MEAS2_START_FORCE_R {
44        MEAS2_START_FORCE_R::new(((self.bits >> 18) & 1) != 0)
45    }
46    #[doc = "Bits 19:30 - SAR ADC2 pad enable bitmap"]
47    #[inline(always)]
48    pub fn sar2_en_pad(&self) -> SAR2_EN_PAD_R {
49        SAR2_EN_PAD_R::new(((self.bits >> 19) & 0x0fff) as u16)
50    }
51    #[doc = "Bit 31 - 1: SAR ADC2 pad enable bitmap is controlled by SW"]
52    #[inline(always)]
53    pub fn sar2_en_pad_force(&self) -> SAR2_EN_PAD_FORCE_R {
54        SAR2_EN_PAD_FORCE_R::new(((self.bits >> 31) & 1) != 0)
55    }
56}
57#[cfg(feature = "impl-register-debug")]
58impl core::fmt::Debug for R {
59    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
60        f.debug_struct("SAR_MEAS2_CTRL2")
61            .field("meas2_data_sar", &self.meas2_data_sar())
62            .field("meas2_done_sar", &self.meas2_done_sar())
63            .field("meas2_start_sar", &self.meas2_start_sar())
64            .field("meas2_start_force", &self.meas2_start_force())
65            .field("sar2_en_pad", &self.sar2_en_pad())
66            .field("sar2_en_pad_force", &self.sar2_en_pad_force())
67            .finish()
68    }
69}
70impl W {
71    #[doc = "Bit 17 - SAR ADC2 controller (in RTC) starts conversion"]
72    #[inline(always)]
73    pub fn meas2_start_sar(&mut self) -> MEAS2_START_SAR_W<SAR_MEAS2_CTRL2_SPEC> {
74        MEAS2_START_SAR_W::new(self, 17)
75    }
76    #[doc = "Bit 18 - 1: SAR ADC2 controller (in RTC) is started by SW"]
77    #[inline(always)]
78    pub fn meas2_start_force(&mut self) -> MEAS2_START_FORCE_W<SAR_MEAS2_CTRL2_SPEC> {
79        MEAS2_START_FORCE_W::new(self, 18)
80    }
81    #[doc = "Bits 19:30 - SAR ADC2 pad enable bitmap"]
82    #[inline(always)]
83    pub fn sar2_en_pad(&mut self) -> SAR2_EN_PAD_W<SAR_MEAS2_CTRL2_SPEC> {
84        SAR2_EN_PAD_W::new(self, 19)
85    }
86    #[doc = "Bit 31 - 1: SAR ADC2 pad enable bitmap is controlled by SW"]
87    #[inline(always)]
88    pub fn sar2_en_pad_force(&mut self) -> SAR2_EN_PAD_FORCE_W<SAR_MEAS2_CTRL2_SPEC> {
89        SAR2_EN_PAD_FORCE_W::new(self, 31)
90    }
91}
92#[doc = "configure saradc2 controller\n\nYou can [`read`](crate::Reg::read) this register and get [`sar_meas2_ctrl2::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`sar_meas2_ctrl2::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
93pub struct SAR_MEAS2_CTRL2_SPEC;
94impl crate::RegisterSpec for SAR_MEAS2_CTRL2_SPEC {
95    type Ux = u32;
96}
97#[doc = "`read()` method returns [`sar_meas2_ctrl2::R`](R) reader structure"]
98impl crate::Readable for SAR_MEAS2_CTRL2_SPEC {}
99#[doc = "`write(|w| ..)` method takes [`sar_meas2_ctrl2::W`](W) writer structure"]
100impl crate::Writable for SAR_MEAS2_CTRL2_SPEC {
101    type Safety = crate::Unsafe;
102    const ZERO_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
103    const ONE_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
104}
105#[doc = "`reset()` method sets SAR_MEAS2_CTRL2 to value 0"]
106impl crate::Resettable for SAR_MEAS2_CTRL2_SPEC {
107    const RESET_VALUE: u32 = 0;
108}