esp32c3/apb_saradc/
arb_ctrl.rs

1#[doc = "Register `ARB_CTRL` reader"]
2pub type R = crate::R<ARB_CTRL_SPEC>;
3#[doc = "Register `ARB_CTRL` writer"]
4pub type W = crate::W<ARB_CTRL_SPEC>;
5#[doc = "Field `APB_FORCE` reader - adc2 arbiter force to enableapb controller"]
6pub type APB_FORCE_R = crate::BitReader;
7#[doc = "Field `APB_FORCE` writer - adc2 arbiter force to enableapb controller"]
8pub type APB_FORCE_W<'a, REG> = crate::BitWriter<'a, REG>;
9#[doc = "Field `RTC_FORCE` reader - adc2 arbiter force to enable rtc controller"]
10pub type RTC_FORCE_R = crate::BitReader;
11#[doc = "Field `RTC_FORCE` writer - adc2 arbiter force to enable rtc controller"]
12pub type RTC_FORCE_W<'a, REG> = crate::BitWriter<'a, REG>;
13#[doc = "Field `WIFI_FORCE` reader - adc2 arbiter force to enable wifi controller"]
14pub type WIFI_FORCE_R = crate::BitReader;
15#[doc = "Field `WIFI_FORCE` writer - adc2 arbiter force to enable wifi controller"]
16pub type WIFI_FORCE_W<'a, REG> = crate::BitWriter<'a, REG>;
17#[doc = "Field `GRANT_FORCE` reader - adc2 arbiter force grant"]
18pub type GRANT_FORCE_R = crate::BitReader;
19#[doc = "Field `GRANT_FORCE` writer - adc2 arbiter force grant"]
20pub type GRANT_FORCE_W<'a, REG> = crate::BitWriter<'a, REG>;
21#[doc = "Field `APB_PRIORITY` reader - Set adc2 arbiterapb priority"]
22pub type APB_PRIORITY_R = crate::FieldReader;
23#[doc = "Field `APB_PRIORITY` writer - Set adc2 arbiterapb priority"]
24pub type APB_PRIORITY_W<'a, REG> = crate::FieldWriter<'a, REG, 2>;
25#[doc = "Field `RTC_PRIORITY` reader - Set adc2 arbiter rtc priority"]
26pub type RTC_PRIORITY_R = crate::FieldReader;
27#[doc = "Field `RTC_PRIORITY` writer - Set adc2 arbiter rtc priority"]
28pub type RTC_PRIORITY_W<'a, REG> = crate::FieldWriter<'a, REG, 2>;
29#[doc = "Field `WIFI_PRIORITY` reader - Set adc2 arbiter wifi priority"]
30pub type WIFI_PRIORITY_R = crate::FieldReader;
31#[doc = "Field `WIFI_PRIORITY` writer - Set adc2 arbiter wifi priority"]
32pub type WIFI_PRIORITY_W<'a, REG> = crate::FieldWriter<'a, REG, 2>;
33#[doc = "Field `FIX_PRIORITY` reader - adc2 arbiter uses fixed priority"]
34pub type FIX_PRIORITY_R = crate::BitReader;
35#[doc = "Field `FIX_PRIORITY` writer - adc2 arbiter uses fixed priority"]
36pub type FIX_PRIORITY_W<'a, REG> = crate::BitWriter<'a, REG>;
37impl R {
38    #[doc = "Bit 2 - adc2 arbiter force to enableapb controller"]
39    #[inline(always)]
40    pub fn apb_force(&self) -> APB_FORCE_R {
41        APB_FORCE_R::new(((self.bits >> 2) & 1) != 0)
42    }
43    #[doc = "Bit 3 - adc2 arbiter force to enable rtc controller"]
44    #[inline(always)]
45    pub fn rtc_force(&self) -> RTC_FORCE_R {
46        RTC_FORCE_R::new(((self.bits >> 3) & 1) != 0)
47    }
48    #[doc = "Bit 4 - adc2 arbiter force to enable wifi controller"]
49    #[inline(always)]
50    pub fn wifi_force(&self) -> WIFI_FORCE_R {
51        WIFI_FORCE_R::new(((self.bits >> 4) & 1) != 0)
52    }
53    #[doc = "Bit 5 - adc2 arbiter force grant"]
54    #[inline(always)]
55    pub fn grant_force(&self) -> GRANT_FORCE_R {
56        GRANT_FORCE_R::new(((self.bits >> 5) & 1) != 0)
57    }
58    #[doc = "Bits 6:7 - Set adc2 arbiterapb priority"]
59    #[inline(always)]
60    pub fn apb_priority(&self) -> APB_PRIORITY_R {
61        APB_PRIORITY_R::new(((self.bits >> 6) & 3) as u8)
62    }
63    #[doc = "Bits 8:9 - Set adc2 arbiter rtc priority"]
64    #[inline(always)]
65    pub fn rtc_priority(&self) -> RTC_PRIORITY_R {
66        RTC_PRIORITY_R::new(((self.bits >> 8) & 3) as u8)
67    }
68    #[doc = "Bits 10:11 - Set adc2 arbiter wifi priority"]
69    #[inline(always)]
70    pub fn wifi_priority(&self) -> WIFI_PRIORITY_R {
71        WIFI_PRIORITY_R::new(((self.bits >> 10) & 3) as u8)
72    }
73    #[doc = "Bit 12 - adc2 arbiter uses fixed priority"]
74    #[inline(always)]
75    pub fn fix_priority(&self) -> FIX_PRIORITY_R {
76        FIX_PRIORITY_R::new(((self.bits >> 12) & 1) != 0)
77    }
78}
79#[cfg(feature = "impl-register-debug")]
80impl core::fmt::Debug for R {
81    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
82        f.debug_struct("ARB_CTRL")
83            .field("apb_force", &self.apb_force())
84            .field("rtc_force", &self.rtc_force())
85            .field("wifi_force", &self.wifi_force())
86            .field("grant_force", &self.grant_force())
87            .field("apb_priority", &self.apb_priority())
88            .field("rtc_priority", &self.rtc_priority())
89            .field("wifi_priority", &self.wifi_priority())
90            .field("fix_priority", &self.fix_priority())
91            .finish()
92    }
93}
94impl W {
95    #[doc = "Bit 2 - adc2 arbiter force to enableapb controller"]
96    #[inline(always)]
97    pub fn apb_force(&mut self) -> APB_FORCE_W<ARB_CTRL_SPEC> {
98        APB_FORCE_W::new(self, 2)
99    }
100    #[doc = "Bit 3 - adc2 arbiter force to enable rtc controller"]
101    #[inline(always)]
102    pub fn rtc_force(&mut self) -> RTC_FORCE_W<ARB_CTRL_SPEC> {
103        RTC_FORCE_W::new(self, 3)
104    }
105    #[doc = "Bit 4 - adc2 arbiter force to enable wifi controller"]
106    #[inline(always)]
107    pub fn wifi_force(&mut self) -> WIFI_FORCE_W<ARB_CTRL_SPEC> {
108        WIFI_FORCE_W::new(self, 4)
109    }
110    #[doc = "Bit 5 - adc2 arbiter force grant"]
111    #[inline(always)]
112    pub fn grant_force(&mut self) -> GRANT_FORCE_W<ARB_CTRL_SPEC> {
113        GRANT_FORCE_W::new(self, 5)
114    }
115    #[doc = "Bits 6:7 - Set adc2 arbiterapb priority"]
116    #[inline(always)]
117    pub fn apb_priority(&mut self) -> APB_PRIORITY_W<ARB_CTRL_SPEC> {
118        APB_PRIORITY_W::new(self, 6)
119    }
120    #[doc = "Bits 8:9 - Set adc2 arbiter rtc priority"]
121    #[inline(always)]
122    pub fn rtc_priority(&mut self) -> RTC_PRIORITY_W<ARB_CTRL_SPEC> {
123        RTC_PRIORITY_W::new(self, 8)
124    }
125    #[doc = "Bits 10:11 - Set adc2 arbiter wifi priority"]
126    #[inline(always)]
127    pub fn wifi_priority(&mut self) -> WIFI_PRIORITY_W<ARB_CTRL_SPEC> {
128        WIFI_PRIORITY_W::new(self, 10)
129    }
130    #[doc = "Bit 12 - adc2 arbiter uses fixed priority"]
131    #[inline(always)]
132    pub fn fix_priority(&mut self) -> FIX_PRIORITY_W<ARB_CTRL_SPEC> {
133        FIX_PRIORITY_W::new(self, 12)
134    }
135}
136#[doc = "digital saradc configure register\n\nYou can [`read`](crate::Reg::read) this register and get [`arb_ctrl::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`arb_ctrl::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
137pub struct ARB_CTRL_SPEC;
138impl crate::RegisterSpec for ARB_CTRL_SPEC {
139    type Ux = u32;
140}
141#[doc = "`read()` method returns [`arb_ctrl::R`](R) reader structure"]
142impl crate::Readable for ARB_CTRL_SPEC {}
143#[doc = "`write(|w| ..)` method takes [`arb_ctrl::W`](W) writer structure"]
144impl crate::Writable for ARB_CTRL_SPEC {
145    type Safety = crate::Unsafe;
146    const ZERO_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
147    const ONE_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
148}
149#[doc = "`reset()` method sets ARB_CTRL to value 0x0900"]
150impl crate::Resettable for ARB_CTRL_SPEC {
151    const RESET_VALUE: u32 = 0x0900;
152}