bl616_pac/pwm/group/
config.rs1#[doc = "Register `config` reader"]
2pub struct R(crate::R<CONFIG_SPEC>);
3impl core::ops::Deref for R {
4 type Target = crate::R<CONFIG_SPEC>;
5 #[inline(always)]
6 fn deref(&self) -> &Self::Target {
7 &self.0
8 }
9}
10impl From<crate::R<CONFIG_SPEC>> for R {
11 #[inline(always)]
12 fn from(reader: crate::R<CONFIG_SPEC>) -> Self {
13 R(reader)
14 }
15}
16#[doc = "Register `config` writer"]
17pub struct W(crate::W<CONFIG_SPEC>);
18impl core::ops::Deref for W {
19 type Target = crate::W<CONFIG_SPEC>;
20 #[inline(always)]
21 fn deref(&self) -> &Self::Target {
22 &self.0
23 }
24}
25impl core::ops::DerefMut for W {
26 #[inline(always)]
27 fn deref_mut(&mut self) -> &mut Self::Target {
28 &mut self.0
29 }
30}
31impl From<crate::W<CONFIG_SPEC>> for W {
32 #[inline(always)]
33 fn from(writer: crate::W<CONFIG_SPEC>) -> Self {
34 W(writer)
35 }
36}
37#[doc = "Field `stop_on_repeat` reader - Enable or disable stop on one repeat cycle completed"]
38pub type STOP_ON_REPEAT_R = crate::BitReader<bool>;
39#[doc = "Field `stop_on_repeat` writer - Enable or disable stop on one repeat cycle completed"]
40pub type STOP_ON_REPEAT_W<'a, const O: u8> = crate::BitWriter<'a, u32, CONFIG_SPEC, bool, O>;
41#[doc = "Field `adc_trigger_source` reader - Select channel in Analog-to-Digital Converter to interact with this peripheral\n\n **This field only works with PWM0.** PWM1 does not have this feature."]
42pub type ADC_TRIGGER_SOURCE_R = crate::FieldReader<u8, u8>;
43#[doc = "Field `adc_trigger_source` writer - Select channel in Analog-to-Digital Converter to interact with this peripheral\n\n **This field only works with PWM0.** PWM1 does not have this feature."]
44pub type ADC_TRIGGER_SOURCE_W<'a, const O: u8> =
45 crate::FieldWriter<'a, u32, CONFIG_SPEC, u8, u8, 4, O>;
46#[doc = "Field `software_break` reader - Enable software signal break"]
47pub type SOFTWARE_BREAK_R = crate::BitReader<bool>;
48#[doc = "Field `software_break` writer - Enable software signal break"]
49pub type SOFTWARE_BREAK_W<'a, const O: u8> = crate::BitWriter<'a, u32, CONFIG_SPEC, bool, O>;
50#[doc = "Field `external_break` reader - Enable external pin signal break"]
51pub type EXTERNAL_BREAK_R = crate::BitReader<bool>;
52#[doc = "Field `external_break` writer - Enable external pin signal break"]
53pub type EXTERNAL_BREAK_W<'a, const O: u8> = crate::BitWriter<'a, u32, CONFIG_SPEC, bool, O>;
54#[doc = "Field `external_polarity` reader - Polarity for external pin break function"]
55pub type EXTERNAL_POLARITY_R = crate::BitReader<bool>;
56#[doc = "Field `external_polarity` writer - Polarity for external pin break function"]
57pub type EXTERNAL_POLARITY_W<'a, const O: u8> = crate::BitWriter<'a, u32, CONFIG_SPEC, bool, O>;
58#[doc = "Field `stop_function` reader - Enable or disable stop function"]
59pub type STOP_FUNCTION_R = crate::BitReader<bool>;
60#[doc = "Field `stop_function` writer - Enable or disable stop function"]
61pub type STOP_FUNCTION_W<'a, const O: u8> = crate::BitWriter<'a, u32, CONFIG_SPEC, bool, O>;
62#[doc = "Field `stop_mode` reader - Mode to stop this peripheral"]
63pub type STOP_MODE_R = crate::BitReader<bool>;
64#[doc = "Field `stop_mode` writer - Mode to stop this peripheral"]
65pub type STOP_MODE_W<'a, const O: u8> = crate::BitWriter<'a, u32, CONFIG_SPEC, bool, O>;
66#[doc = "Field `stop_state` reader - Is this peripheral stopped?"]
67pub type STOP_STATE_R = crate::BitReader<bool>;
68#[doc = "Field `stop_state` writer - Is this peripheral stopped?"]
69pub type STOP_STATE_W<'a, const O: u8> = crate::BitWriter<'a, u32, CONFIG_SPEC, bool, O>;
70#[doc = "Field `clock_select` reader - Select group clock source"]
71pub type CLOCK_SELECT_R = crate::FieldReader<u8, CLOCK_SOURCE_A>;
72#[doc = "Select group clock source\n\nValue on reset: 0"]
73#[derive(Clone, Copy, Debug, PartialEq, Eq)]
74#[repr(u8)]
75pub enum CLOCK_SOURCE_A {
76 #[doc = "0: External crystal as clock source"]
77 XTAL = 0,
78 #[doc = "1: Bus clock as clock source"]
79 BCLK = 1,
80 #[doc = "2: 32-kHz clock source"]
81 F32K = 2,
82}
83impl From<CLOCK_SOURCE_A> for u8 {
84 #[inline(always)]
85 fn from(variant: CLOCK_SOURCE_A) -> Self {
86 variant as _
87 }
88}
89impl CLOCK_SELECT_R {
90 #[doc = "Get enumerated values variant"]
91 #[inline(always)]
92 pub fn variant(&self) -> Option<CLOCK_SOURCE_A> {
93 match self.bits {
94 0 => Some(CLOCK_SOURCE_A::XTAL),
95 1 => Some(CLOCK_SOURCE_A::BCLK),
96 2 => Some(CLOCK_SOURCE_A::F32K),
97 _ => None,
98 }
99 }
100 #[doc = "Checks if the value of the field is `XTAL`"]
101 #[inline(always)]
102 pub fn is_xtal(&self) -> bool {
103 *self == CLOCK_SOURCE_A::XTAL
104 }
105 #[doc = "Checks if the value of the field is `BCLK`"]
106 #[inline(always)]
107 pub fn is_bclk(&self) -> bool {
108 *self == CLOCK_SOURCE_A::BCLK
109 }
110 #[doc = "Checks if the value of the field is `F32K`"]
111 #[inline(always)]
112 pub fn is_f32k(&self) -> bool {
113 *self == CLOCK_SOURCE_A::F32K
114 }
115}
116#[doc = "Field `clock_select` writer - Select group clock source"]
117pub type CLOCK_SELECT_W<'a, const O: u8> =
118 crate::FieldWriter<'a, u32, CONFIG_SPEC, u8, CLOCK_SOURCE_A, 2, O>;
119impl<'a, const O: u8> CLOCK_SELECT_W<'a, O> {
120 #[doc = "External crystal as clock source"]
121 #[inline(always)]
122 pub fn xtal(self) -> &'a mut W {
123 self.variant(CLOCK_SOURCE_A::XTAL)
124 }
125 #[doc = "Bus clock as clock source"]
126 #[inline(always)]
127 pub fn bclk(self) -> &'a mut W {
128 self.variant(CLOCK_SOURCE_A::BCLK)
129 }
130 #[doc = "32-kHz clock source"]
131 #[inline(always)]
132 pub fn f32k(self) -> &'a mut W {
133 self.variant(CLOCK_SOURCE_A::F32K)
134 }
135}
136impl R {
137 #[doc = "Bit 19 - Enable or disable stop on one repeat cycle completed"]
138 #[inline(always)]
139 pub fn stop_on_repeat(&self) -> STOP_ON_REPEAT_R {
140 STOP_ON_REPEAT_R::new(((self.bits >> 19) & 1) != 0)
141 }
142 #[doc = "Bits 20:23 - Select channel in Analog-to-Digital Converter to interact with this peripheral\n\n **This field only works with PWM0.** PWM1 does not have this feature."]
143 #[inline(always)]
144 pub fn adc_trigger_source(&self) -> ADC_TRIGGER_SOURCE_R {
145 ADC_TRIGGER_SOURCE_R::new(((self.bits >> 20) & 0x0f) as u8)
146 }
147 #[doc = "Bit 24 - Enable software signal break"]
148 #[inline(always)]
149 pub fn software_break(&self) -> SOFTWARE_BREAK_R {
150 SOFTWARE_BREAK_R::new(((self.bits >> 24) & 1) != 0)
151 }
152 #[doc = "Bit 25 - Enable external pin signal break"]
153 #[inline(always)]
154 pub fn external_break(&self) -> EXTERNAL_BREAK_R {
155 EXTERNAL_BREAK_R::new(((self.bits >> 25) & 1) != 0)
156 }
157 #[doc = "Bit 26 - Polarity for external pin break function"]
158 #[inline(always)]
159 pub fn external_polarity(&self) -> EXTERNAL_POLARITY_R {
160 EXTERNAL_POLARITY_R::new(((self.bits >> 26) & 1) != 0)
161 }
162 #[doc = "Bit 27 - Enable or disable stop function"]
163 #[inline(always)]
164 pub fn stop_function(&self) -> STOP_FUNCTION_R {
165 STOP_FUNCTION_R::new(((self.bits >> 27) & 1) != 0)
166 }
167 #[doc = "Bit 28 - Mode to stop this peripheral"]
168 #[inline(always)]
169 pub fn stop_mode(&self) -> STOP_MODE_R {
170 STOP_MODE_R::new(((self.bits >> 28) & 1) != 0)
171 }
172 #[doc = "Bit 29 - Is this peripheral stopped?"]
173 #[inline(always)]
174 pub fn stop_state(&self) -> STOP_STATE_R {
175 STOP_STATE_R::new(((self.bits >> 29) & 1) != 0)
176 }
177 #[doc = "Bits 30:31 - Select group clock source"]
178 #[inline(always)]
179 pub fn clock_select(&self) -> CLOCK_SELECT_R {
180 CLOCK_SELECT_R::new(((self.bits >> 30) & 3) as u8)
181 }
182}
183impl W {
184 #[doc = "Bit 19 - Enable or disable stop on one repeat cycle completed"]
185 #[inline(always)]
186 #[must_use]
187 pub fn stop_on_repeat(&mut self) -> STOP_ON_REPEAT_W<19> {
188 STOP_ON_REPEAT_W::new(self)
189 }
190 #[doc = "Bits 20:23 - Select channel in Analog-to-Digital Converter to interact with this peripheral\n\n **This field only works with PWM0.** PWM1 does not have this feature."]
191 #[inline(always)]
192 #[must_use]
193 pub fn adc_trigger_source(&mut self) -> ADC_TRIGGER_SOURCE_W<20> {
194 ADC_TRIGGER_SOURCE_W::new(self)
195 }
196 #[doc = "Bit 24 - Enable software signal break"]
197 #[inline(always)]
198 #[must_use]
199 pub fn software_break(&mut self) -> SOFTWARE_BREAK_W<24> {
200 SOFTWARE_BREAK_W::new(self)
201 }
202 #[doc = "Bit 25 - Enable external pin signal break"]
203 #[inline(always)]
204 #[must_use]
205 pub fn external_break(&mut self) -> EXTERNAL_BREAK_W<25> {
206 EXTERNAL_BREAK_W::new(self)
207 }
208 #[doc = "Bit 26 - Polarity for external pin break function"]
209 #[inline(always)]
210 #[must_use]
211 pub fn external_polarity(&mut self) -> EXTERNAL_POLARITY_W<26> {
212 EXTERNAL_POLARITY_W::new(self)
213 }
214 #[doc = "Bit 27 - Enable or disable stop function"]
215 #[inline(always)]
216 #[must_use]
217 pub fn stop_function(&mut self) -> STOP_FUNCTION_W<27> {
218 STOP_FUNCTION_W::new(self)
219 }
220 #[doc = "Bit 28 - Mode to stop this peripheral"]
221 #[inline(always)]
222 #[must_use]
223 pub fn stop_mode(&mut self) -> STOP_MODE_W<28> {
224 STOP_MODE_W::new(self)
225 }
226 #[doc = "Bit 29 - Is this peripheral stopped?"]
227 #[inline(always)]
228 #[must_use]
229 pub fn stop_state(&mut self) -> STOP_STATE_W<29> {
230 STOP_STATE_W::new(self)
231 }
232 #[doc = "Bits 30:31 - Select group clock source"]
233 #[inline(always)]
234 #[must_use]
235 pub fn clock_select(&mut self) -> CLOCK_SELECT_W<30> {
236 CLOCK_SELECT_W::new(self)
237 }
238 #[doc = "Writes raw bits to the register."]
239 #[inline(always)]
240 pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
241 self.0.bits(bits);
242 self
243 }
244}
245#[doc = "Peripheral group configuration\n\nThis register you can [`read`](crate::generic::Reg::read), [`write_with_zero`](crate::generic::Reg::write_with_zero), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`modify`](crate::generic::Reg::modify). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [config](index.html) module"]
246pub struct CONFIG_SPEC;
247impl crate::RegisterSpec for CONFIG_SPEC {
248 type Ux = u32;
249}
250#[doc = "`read()` method returns [config::R](R) reader structure"]
251impl crate::Readable for CONFIG_SPEC {
252 type Reader = R;
253}
254#[doc = "`write(|w| ..)` method takes [config::W](W) writer structure"]
255impl crate::Writable for CONFIG_SPEC {
256 type Writer = W;
257 const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
258 const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
259}
260#[doc = "`reset()` method sets config to value 0"]
261impl crate::Resettable for CONFIG_SPEC {
262 const RESET_VALUE: Self::Ux = 0;
263}