esp32p4/lp_adc/
meas1_ctrl2.rs1#[doc = "Register `MEAS1_CTRL2` reader"]
2pub type R = crate::R<MEAS1_CTRL2_SPEC>;
3#[doc = "Register `MEAS1_CTRL2` writer"]
4pub type W = crate::W<MEAS1_CTRL2_SPEC>;
5#[doc = "Field `MEAS1_DATA_SAR` reader - SAR ADC1 data."]
6pub type MEAS1_DATA_SAR_R = crate::FieldReader<u16>;
7#[doc = "Field `MEAS1_DONE_SAR` reader - SAR ADC1 conversion done indication."]
8pub type MEAS1_DONE_SAR_R = crate::BitReader;
9#[doc = "Field `MEAS1_START_SAR` reader - SAR ADC1 controller (in RTC) starts conversion."]
10pub type MEAS1_START_SAR_R = crate::BitReader;
11#[doc = "Field `MEAS1_START_SAR` writer - SAR ADC1 controller (in RTC) starts conversion."]
12pub type MEAS1_START_SAR_W<'a, REG> = crate::BitWriter<'a, REG>;
13#[doc = "Field `MEAS1_START_FORCE` reader - 1: SAR ADC1 controller (in RTC) is started by SW."]
14pub type MEAS1_START_FORCE_R = crate::BitReader;
15#[doc = "Field `MEAS1_START_FORCE` writer - 1: SAR ADC1 controller (in RTC) is started by SW."]
16pub type MEAS1_START_FORCE_W<'a, REG> = crate::BitWriter<'a, REG>;
17#[doc = "Field `SAR1_EN_PAD` reader - SAR ADC1 pad enable bitmap."]
18pub type SAR1_EN_PAD_R = crate::FieldReader<u16>;
19#[doc = "Field `SAR1_EN_PAD` writer - SAR ADC1 pad enable bitmap."]
20pub type SAR1_EN_PAD_W<'a, REG> = crate::FieldWriter<'a, REG, 12, u16>;
21#[doc = "Field `SAR1_EN_PAD_FORCE` reader - 1: SAR ADC1 pad enable bitmap is controlled by SW."]
22pub type SAR1_EN_PAD_FORCE_R = crate::BitReader;
23#[doc = "Field `SAR1_EN_PAD_FORCE` writer - 1: SAR ADC1 pad enable bitmap is controlled by SW."]
24pub type SAR1_EN_PAD_FORCE_W<'a, REG> = crate::BitWriter<'a, REG>;
25impl R {
26 #[doc = "Bits 0:15 - SAR ADC1 data."]
27 #[inline(always)]
28 pub fn meas1_data_sar(&self) -> MEAS1_DATA_SAR_R {
29 MEAS1_DATA_SAR_R::new((self.bits & 0xffff) as u16)
30 }
31 #[doc = "Bit 16 - SAR ADC1 conversion done indication."]
32 #[inline(always)]
33 pub fn meas1_done_sar(&self) -> MEAS1_DONE_SAR_R {
34 MEAS1_DONE_SAR_R::new(((self.bits >> 16) & 1) != 0)
35 }
36 #[doc = "Bit 17 - SAR ADC1 controller (in RTC) starts conversion."]
37 #[inline(always)]
38 pub fn meas1_start_sar(&self) -> MEAS1_START_SAR_R {
39 MEAS1_START_SAR_R::new(((self.bits >> 17) & 1) != 0)
40 }
41 #[doc = "Bit 18 - 1: SAR ADC1 controller (in RTC) is started by SW."]
42 #[inline(always)]
43 pub fn meas1_start_force(&self) -> MEAS1_START_FORCE_R {
44 MEAS1_START_FORCE_R::new(((self.bits >> 18) & 1) != 0)
45 }
46 #[doc = "Bits 19:30 - SAR ADC1 pad enable bitmap."]
47 #[inline(always)]
48 pub fn sar1_en_pad(&self) -> SAR1_EN_PAD_R {
49 SAR1_EN_PAD_R::new(((self.bits >> 19) & 0x0fff) as u16)
50 }
51 #[doc = "Bit 31 - 1: SAR ADC1 pad enable bitmap is controlled by SW."]
52 #[inline(always)]
53 pub fn sar1_en_pad_force(&self) -> SAR1_EN_PAD_FORCE_R {
54 SAR1_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("MEAS1_CTRL2")
61 .field(
62 "meas1_data_sar",
63 &format_args!("{}", self.meas1_data_sar().bits()),
64 )
65 .field(
66 "meas1_done_sar",
67 &format_args!("{}", self.meas1_done_sar().bit()),
68 )
69 .field(
70 "meas1_start_sar",
71 &format_args!("{}", self.meas1_start_sar().bit()),
72 )
73 .field(
74 "meas1_start_force",
75 &format_args!("{}", self.meas1_start_force().bit()),
76 )
77 .field(
78 "sar1_en_pad",
79 &format_args!("{}", self.sar1_en_pad().bits()),
80 )
81 .field(
82 "sar1_en_pad_force",
83 &format_args!("{}", self.sar1_en_pad_force().bit()),
84 )
85 .finish()
86 }
87}
88#[cfg(feature = "impl-register-debug")]
89impl core::fmt::Debug for crate::generic::Reg<MEAS1_CTRL2_SPEC> {
90 fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
91 core::fmt::Debug::fmt(&self.read(), f)
92 }
93}
94impl W {
95 #[doc = "Bit 17 - SAR ADC1 controller (in RTC) starts conversion."]
96 #[inline(always)]
97 #[must_use]
98 pub fn meas1_start_sar(&mut self) -> MEAS1_START_SAR_W<MEAS1_CTRL2_SPEC> {
99 MEAS1_START_SAR_W::new(self, 17)
100 }
101 #[doc = "Bit 18 - 1: SAR ADC1 controller (in RTC) is started by SW."]
102 #[inline(always)]
103 #[must_use]
104 pub fn meas1_start_force(&mut self) -> MEAS1_START_FORCE_W<MEAS1_CTRL2_SPEC> {
105 MEAS1_START_FORCE_W::new(self, 18)
106 }
107 #[doc = "Bits 19:30 - SAR ADC1 pad enable bitmap."]
108 #[inline(always)]
109 #[must_use]
110 pub fn sar1_en_pad(&mut self) -> SAR1_EN_PAD_W<MEAS1_CTRL2_SPEC> {
111 SAR1_EN_PAD_W::new(self, 19)
112 }
113 #[doc = "Bit 31 - 1: SAR ADC1 pad enable bitmap is controlled by SW."]
114 #[inline(always)]
115 #[must_use]
116 pub fn sar1_en_pad_force(&mut self) -> SAR1_EN_PAD_FORCE_W<MEAS1_CTRL2_SPEC> {
117 SAR1_EN_PAD_FORCE_W::new(self, 31)
118 }
119}
120#[doc = "ADC1 configuration registers.\n\nYou can [`read`](crate::generic::Reg::read) this register and get [`meas1_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 [`meas1_ctrl2::W`](W). You can also [`modify`](crate::generic::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
121pub struct MEAS1_CTRL2_SPEC;
122impl crate::RegisterSpec for MEAS1_CTRL2_SPEC {
123 type Ux = u32;
124}
125#[doc = "`read()` method returns [`meas1_ctrl2::R`](R) reader structure"]
126impl crate::Readable for MEAS1_CTRL2_SPEC {}
127#[doc = "`write(|w| ..)` method takes [`meas1_ctrl2::W`](W) writer structure"]
128impl crate::Writable for MEAS1_CTRL2_SPEC {
129 type Safety = crate::Unsafe;
130 const ZERO_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
131 const ONE_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
132}
133#[doc = "`reset()` method sets MEAS1_CTRL2 to value 0"]
134impl crate::Resettable for MEAS1_CTRL2_SPEC {
135 const RESET_VALUE: u32 = 0;
136}