| Nano100BN Series BSP V3.03.002 The Board Support Package for Nano100BN Series

NuEdu-Basic01_PWM_Capture.c
Go to the documentation of this file.
1 /**************************************************************************/
12 #include <stdio.h>
13 #include "NUC200Series.h"
14 #include "NuEdu-Basic01_PWM_Capture.h"
15
16 uint32_t PWM23_Clock = 1000000; //1 MHz
17 uint32_t PWM67_Clock = 1000000; //1 MHz
18 uint32_t Open_PWM6_OUT_Fail = FALSE;
19 uint32_t Open_PWM3_Capture_Fail = FALSE;
20 uint32_t Open_PWM7_Capture_Fail = FALSE;
21
22 PWM_Capture_T PWM3 = {0,0,0,0,0,0,0};
23 PWM_Capture_T PWM7 = {0,0,0,0,0,0,0};
24
25 void Open_PWM6_OUT(uint32_t PWM_Frequency, uint32_t PWM_Duty)
26 {
27 uint32_t TempPrescale;
28 uint32_t TempCounter;
29 uint32_t TempComparator;
30 uint32_t PWM_Freq_Max;
31 uint32_t PWM_Freq_Min;
32
33 Open_PWM6_OUT_Fail = FALSE;
34
35 //Initial PWM6 Function Pin
36 SYS->GPE_MFP = (SYS->GPE_MFP & ~SYS_GPE_MFP_PE0_Msk) | SYS_GPE_MFP_PE0_PWM6;
37
38 //Initial PWM67 Clock Source from XTAL's 12 MHz
39 SYS_UnlockReg();
40 if(!(SYSCLK->PWRCON&SYSCLK_PWRCON_XTL12M_EN_Msk))
41 {
42 SYSCLK->PWRCON = SYSCLK_PWRCON_XTL12M_EN_Msk; //Enable XTAL's 12 MHz
43 while(!(SYSCLK->CLKSTATUS&SYSCLK_CLKSTATUS_XTL12M_STB_Msk));
44 SystemCoreClockUpdate();
45 }
46 // SYS->IPRSTC2 |= SYS_IPRSTC2_PWM47_RST_Msk; //Donot Reset PWM, Safe for other unknown PWM device
47 // SYS->IPRSTC2 &= ~SYS_IPRSTC2_PWM47_RST_Msk;
48 SYSCLK->CLKSEL2 = (SYSCLK->CLKSEL2 & ~SYSCLK_CLKSEL2_PWM67_S_EXT_Msk) | SYSCLK_CLKSEL2_PWM67_EXT_XTAL;
49 SYSCLK->CLKSEL2 = (SYSCLK->CLKSEL2 & ~SYSCLK_CLKSEL2_PWM67_S_Msk) | SYSCLK_CLKSEL2_PWM67_XTAL;
50 SYSCLK->APBCLK |= SYSCLK_APBCLK_PWM67_EN_Msk;
51 SYS_LockReg();
52
53 //Initial PWM67 Peripheral Clock Prescale
54 TempPrescale = _PWM_Source_Clock / PWM67_Clock; //Prescale = XTAL / PWM67_Clock
55 if(TempPrescale>_PWM_Prescale_Max)
56 {
57 Open_PWM6_OUT_Fail = TRUE;
58 TempPrescale = _PWM_Prescale_Max;
59 PWM67_Clock = _PWM_Source_Clock / _PWM_Prescale_Max; //PWM67_Clock = _PWM_Source_Clock / Prescale
60 printf("\nPWM67 Clock Prescale Initial Fail!\n");
61 }
62 _PWM_SET_TIMER_PRESCALE(PWMB, PWM_CH2, (TempPrescale-1)); //Setting PWM67 Clock Prescale
63 while(PWMB->SYNCBUSY2);
64
65 //Check Local PWM6 Channel Frequency and Duty-Scale
66 PWM_Freq_Max = PWM67_Clock / _PWM_Duty_Scale;
67 PWM_Freq_Min = PWM67_Clock / _PWM_Resolution;
68 if(PWM_Frequency>PWM_Freq_Max)
69 {
70 Open_PWM6_OUT_Fail = TRUE;
71 PWM_Frequency = PWM_Freq_Max;
72 printf("\nPWM6 Frequency too High! Max are %d Hz\n", PWM_Freq_Max);
73 }
74
75 if(PWM_Frequency<PWM_Freq_Min)
76 {
77 Open_PWM6_OUT_Fail = TRUE;
78 PWM_Frequency = PWM_Freq_Min;
79 printf("\nPWM6 Frequency too Low! Min are %d Hz\n", PWM_Freq_Min);
80 }
81
82 if(PWM_Duty>_PWM_Duty_Scale)
83 {
84 Open_PWM6_OUT_Fail = TRUE;
85 PWM_Duty = _PWM_Duty_Scale;
86 printf("\nPWM6 Duty too High! Max are %d %\n", _PWM_Duty_Scale);
87 }
88
89 //Initial Local PWM6 Channel
90 _PWM_SET_TIMER_AUTO_RELOAD_MODE(PWMB, PWM_CH2);
91 while(PWMB->SYNCBUSY2);
92 PWMB->CSR = (PWMB->CSR & ~PWM_CSR_CSR2_Msk) | PWM_CSR_CSR2(PWM_CSR_DIV1); //Set PWM6 Clock Source Divider = 1
93 while(PWMB->SYNCBUSY2);
94
95 TempCounter = PWM67_Clock / PWM_Frequency;
96 TempComparator = (PWM_Duty * TempCounter) / _PWM_Duty_Scale;
97 PWMB->CNR2 = TempCounter - 1;
98 while(PWMB->SYNCBUSY2);
99 if(TempComparator==0) PWMB->CMR2 = TempComparator;
100 else PWMB->CMR2 = TempComparator - 1;
101 while(PWMB->SYNCBUSY2);
102
103 //Start PWM6_OUT
104 _PWM_ENABLE_PWM_OUT(PWMB, PWM_CH2);
105 while(PWMB->SYNCBUSY2);
106 _PWM_ENABLE_TIMER(PWMB, PWM_CH2);
107 while(PWMB->SYNCBUSY2);
108
109 // if(Open_PWM6_OUT_Fail==FALSE)
110 // printf("\nOpen PWM_OUT Success!\n");
111 }
112
113 void Close_PWM6_OUT(void)
114 {
115 //Close PWM6 Function Pin
116 SYS->GPE_MFP &= ~SYS_GPE_MFP_PE0_Msk;
117
118 //Disable PWM6 Function
119 _PWM_DISABLE_TIMER(PWMB, PWM_CH2);
120 _PWM_DISABLE_PWM_OUT(PWMB, PWM_CH2);
121
122 //Donot Cloce PWM67, Safe for other unknown PWM device
123 /* //Close PWM Clock Source
124 SYS_UnlockReg();
125 // SYS->IPRSTC2 |= SYS_IPRSTC2_PWM47_RST_Msk;
126 // SYS->IPRSTC2 &= ~SYS_IPRSTC2_PWM47_RST_Msk;
127 SYSCLK->APBCLK &= ~SYSCLK_APBCLK_PWM67_EN_Msk;
128 SYS_LockReg();
129 */
130 }
131
132 void Open_PWM7_Capture(void)
133 {
134 uint32_t TempPrescale;
135
136 Open_PWM7_Capture_Fail = FALSE;
137
138 //Initial PWM7 Function Pin
139 SYS->GPE_MFP = (SYS->GPE_MFP & ~SYS_GPE_MFP_PE1_Msk) | SYS_GPE_MFP_PE1_PWM7;
140
141 //Initial PWM67 Clock Source from XTAL's 12 MHz
142 SYS_UnlockReg();
143 if(!(SYSCLK->PWRCON&SYSCLK_PWRCON_XTL12M_EN_Msk))
144 {
145 SYSCLK->PWRCON = SYSCLK_PWRCON_XTL12M_EN_Msk; //Enable XTAL's 12 MHz
146 while(!(SYSCLK->CLKSTATUS&SYSCLK_CLKSTATUS_XTL12M_STB_Msk));
147 SystemCoreClockUpdate();
148 }
149 // SYS->IPRSTC2 |= SYS_IPRSTC2_PWM47_RST_Msk; //Donot Reset PWM, Safe for other unknown PWM device
150 // SYS->IPRSTC2 &= ~SYS_IPRSTC2_PWM47_RST_Msk;
151 SYSCLK->CLKSEL2 = (SYSCLK->CLKSEL2 & ~SYSCLK_CLKSEL2_PWM67_S_EXT_Msk) | SYSCLK_CLKSEL2_PWM67_EXT_XTAL;
152 SYSCLK->CLKSEL2 = (SYSCLK->CLKSEL2 & ~SYSCLK_CLKSEL2_PWM67_S_Msk) | SYSCLK_CLKSEL2_PWM67_XTAL;
153 SYSCLK->APBCLK |= SYSCLK_APBCLK_PWM67_EN_Msk;
154 SYS_LockReg();
155
156 //Initial PWM67 Peripheral Clock Prescale
157 TempPrescale = _PWM_Source_Clock / PWM67_Clock; //Prescale = XTAL / PWM67_Clock
158 if(TempPrescale>_PWM_Prescale_Max)
159 {
160 Open_PWM7_Capture_Fail = TRUE;
161 TempPrescale = _PWM_Prescale_Max;
162 PWM67_Clock = _PWM_Source_Clock / _PWM_Prescale_Max; //PWM67_Clock = _PWM_Source_Clock / Prescale
163 printf("\nPWM67 Clock Prescale Initial Fail!\n");
164 }
165 _PWM_SET_TIMER_PRESCALE(PWMB, PWM_CH3, (TempPrescale-1));
166 while(PWMB->SYNCBUSY3); //Setting PWM67 Clock Prescale
167
168 //Initial Local PWM7 Channel
169 _PWM_SET_TIMER_AUTO_RELOAD_MODE(PWMB, PWM_CH3);
170 while(PWMB->SYNCBUSY3);
171 _PWM_SET_TIMER_CLOCK_DIV(PWMB, PWM_CH3, PWM_CSR_DIV1);
172 while(PWMB->SYNCBUSY3); //Set PWM7 Clock Source Divider = 1
173 PWMB->CNR3 = _PWM_Resolution - 1;
174 while(PWMB->SYNCBUSY3);
175 PWMB->PBCR |= PWM_PBCR_BCn_Msk;
176
177 //Start Capture
178 _PWM_ENABLE_CAP_IN(PWMB, PWM_CH3);
179 while(PWMB->SYNCBUSY3);
180 _PWM_ENABLE_CAP_FUNC(PWMB, PWM_CH3);
181 while(PWMB->SYNCBUSY3);
182 _PWM_ENABLE_TIMER(PWMB, PWM_CH3);
183 while(PWMB->SYNCBUSY3);
184
185 // if(Open_PWM7_OUT_Fail==FALSE)
186 // printf("\nOpen PWM7_Capture Success!\n");
187 }
188
189 void Close_PWM7_Capture(void)
190 {
191 //Close PWM7 Function Pin
192 SYS->GPE_MFP &= ~SYS_GPE_MFP_PE1_Msk;
193
194 //Disable PWM7 Function
195 _PWM_DISABLE_TIMER(PWMB, PWM_CH3);
196 while(PWMB->SYNCBUSY3);
197 _PWM_DISABLE_CAP_FUNC(PWMB, PWM_CH3);
198 while(PWMB->SYNCBUSY3);
199 _PWM_DISABLE_CAP_IN(PWMB, PWM_CH3);
200 while(PWMB->SYNCBUSY3);
201
202 //Donot Cloce PWM67, Safe for other unknown PWM device
203 /* //Close PWM Clock Source
204 SYS_UnlockReg();
205 // SYS->IPRSTC2 |= SYS_IPRSTC2_PWM47_RST_Msk;
206 // SYS->IPRSTC2 &= ~SYS_IPRSTC2_PWM47_RST_Msk;
207 SYSCLK->APBCLK &= ~SYSCLK_APBCLK_PWM67_EN_Msk;
208 SYS_LockReg();
209 */
210 }
211
212 void Get_PWM7_Capture_Data(void)
213 {
214 uint32_t i;
215
216 _PWM_CLR_CAP_RISING_INDICATOR(PWMB, PWM_CH3);
217 _PWM_CLR_CAP_FALLING_INDICATOR(PWMB, PWM_CH3);
218
219 for(i=0; i<4; )
220 {
221 if(_PWM_GET_CAP_RISING_INDICATOR(PWMB, PWM_CH3))
222 {
223 PWM7.Capture_Rising[i>>1] = PWMB->CRLR3;
224 PWM7.Last_Edge = Rising;
225 _PWM_CLR_CAP_RISING_INDICATOR(PWMB, PWM_CH3);
226 i++;
227 }
228 else if(_PWM_GET_CAP_FALLING_INDICATOR(PWMB, PWM_CH3))
229 {
230 PWM7.Capture_Falling[i>>1] = PWMB->CFLR3;
231 PWM7.Last_Edge = Falling;
232 _PWM_CLR_CAP_FALLING_INDICATOR(PWMB, PWM_CH3);
233 i++;
234 }
235 }
236
237 if(PWM7.Last_Edge == Falling)
238 {
239 //Calculate Case 1:
240 if(PWM7.Capture_Rising[0]>PWM7.Capture_Rising[1])
241 {
242 PWM7.Signal_Period = PWM7.Capture_Rising[0] - PWM7.Capture_Rising[1]; //(us)
243 PWM7.High_Period = PWM7.Capture_Rising[0] - PWM7.Capture_Falling[0]; //(us)
244 }
245 //Calculate Case 2:
246 else if(PWM7.Capture_Rising[0]<PWM7.Capture_Rising[1])
247 {
248 PWM7.Signal_Period = _PWM_Resolution + PWM7.Capture_Rising[0] - PWM7.Capture_Rising[1]; //(us)
249 PWM7.High_Period = PWM7.Capture_Rising[1] - PWM7.Capture_Falling[1]; //(us)
250 }
251 PWM7.Low_Period = PWM7.Signal_Period - PWM7.High_Period; //(us)
252 PWM7.Signal_Frequency = (float) PWM67_Clock / (float) PWM7.Signal_Period; //(Hz)
253 }
254 else if(PWM7.Last_Edge == Rising)
255 {
256 //Calculate Case 3:
257 if(PWM7.Capture_Falling[0]>PWM7.Capture_Falling[1])
258 {
259 PWM7.Signal_Period = PWM7.Capture_Falling[0] - PWM7.Capture_Falling[1]; //(us)
260 PWM7.Low_Period = PWM7.Capture_Falling[0] - PWM7.Capture_Rising[0]; //(us)
261 }
262 //Calculate Case 4:
263 else if(PWM7.Capture_Rising[0]<PWM7.Capture_Rising[1])
264 {
265 PWM7.Signal_Period = _PWM_Resolution + PWM7.Capture_Falling[0] - PWM7.Capture_Falling[1]; //(us)
266 PWM7.Low_Period = PWM7.Capture_Falling[1] - PWM7.Capture_Rising[1]; //(us)
267 }
268 PWM7.High_Period = PWM7.Signal_Period - PWM7.Low_Period; //(us)
269 PWM7.Signal_Frequency = (float) PWM67_Clock / (float) PWM7.Signal_Period; //(Hz)
270 }
271 }
272
273 void Open_PWM3_Capture(void)
274 {
275 uint32_t TempPrescale;
276
277 Open_PWM3_Capture_Fail = FALSE;
278
279 //Initial PWM3 Function Pin
280 SYS->GPA_MFP = (SYS->GPA_MFP & ~SYS_GPA_MFP_PA15_Msk) | SYS_GPA_MFP_PA15_PWM3;
281 SYS->ALT_MFP = (SYS->ALT_MFP & ~SYS_ALT_MFP_PA15_Msk) | SYS_ALT_MFP_PA15_PWM3;
282 SYS->ALT_MFP1 = (SYS->ALT_MFP1 & ~SYS_ALT_MFP1_PA15_Msk) | SYS_ALT_MFP1_PA15_PWM3;
283
284 //Initial PWM23 Clock Source from XTAL's 12 MHz
285 SYS_UnlockReg();
286 if(!(SYSCLK->PWRCON&SYSCLK_PWRCON_XTL12M_EN_Msk))
287 {
288 SYSCLK->PWRCON = SYSCLK_PWRCON_XTL12M_EN_Msk; //Enable XTAL's 12 MHz
289 while(!(SYSCLK->CLKSTATUS&SYSCLK_CLKSTATUS_XTL12M_STB_Msk));
290 SystemCoreClockUpdate();
291 }
292 // SYS->IPRSTC2 |= SYS_IPRSTC2_PWM03_RST_Msk; //Donot Reset PWM, Safe for other unknown PWM device
293 // SYS->IPRSTC2 &= ~SYS_IPRSTC2_PWM03_RST_Msk;
294 SYSCLK->CLKSEL1 = (SYSCLK->CLKSEL1 & ~SYSCLK_CLKSEL1_PWM23_S_Msk) | SYSCLK_CLKSEL1_PWM23_XTAL;
295 SYSCLK->CLKSEL2 = (SYSCLK->CLKSEL2 & ~SYSCLK_CLKSEL2_PWM23_S_EXT_Msk) | SYSCLK_CLKSEL2_PWM23_EXT_XTAL;
296 SYSCLK->APBCLK |= SYSCLK_APBCLK_PWM23_EN_Msk;
297 SYS_LockReg();
298
299 //Initial PWM23 Peripheral Clock Prescale
300 TempPrescale = _PWM_Source_Clock / PWM23_Clock; //Prescale = XTAL / PWM23_Clock
301 if(TempPrescale>_PWM_Prescale_Max)
302 {
303 Open_PWM3_Capture_Fail = TRUE;
304 TempPrescale = _PWM_Prescale_Max;
305 PWM23_Clock = _PWM_Source_Clock / _PWM_Prescale_Max; //PWM23_Clock = _PWM_Source_Clock / Prescale
306 printf("\nPWM23 Clock Prescale Initial Fail!\n");
307 }
308 _PWM_SET_TIMER_PRESCALE(PWMA, PWM_CH3, (TempPrescale-1));
309 while(PWMA->SYNCBUSY3); //Setting PWM23 Clock Prescale
310
311 //Initial Local PWM3 Channel
312 _PWM_SET_TIMER_AUTO_RELOAD_MODE(PWMA, PWM_CH3);
313 while(PWMA->SYNCBUSY3);
314 _PWM_SET_TIMER_CLOCK_DIV(PWMA, PWM_CH3, PWM_CSR_DIV1);
315 while(PWMA->SYNCBUSY3); //Set PWM3 Clock Source Divider = 1
316 PWMA->CNR3 = _PWM_Resolution - 1;
317 while(PWMA->SYNCBUSY3);
318 PWMA->PBCR |= PWM_PBCR_BCn_Msk;
319
320 //Start Capture
321 _PWM_ENABLE_CAP_IN(PWMA, PWM_CH3);
322 while(PWMA->SYNCBUSY3);
323 _PWM_ENABLE_CAP_FUNC(PWMA, PWM_CH3);
324 while(PWMA->SYNCBUSY3);
325 _PWM_ENABLE_TIMER(PWMA, PWM_CH3);
326 while(PWMA->SYNCBUSY3);
327
328 // if(Open_PWM3_OUT_Fail==FALSE)
329 // printf("\nOpen PWM3_Capture Success!\n");
330 }
331
332 void Close_PWM3_Capture(void)
333 {
334 //Close PWM3 Function Pin
335 SYS->GPA_MFP &= ~SYS_GPA_MFP_PA15_Msk;
336 SYS->ALT_MFP &= ~SYS_ALT_MFP_PA15_Msk;
337 SYS->ALT_MFP1 &= ~SYS_ALT_MFP1_PA15_Msk;
338
339 //Disable PWM3 Function
340 _PWM_DISABLE_TIMER(PWMA, PWM_CH3);
341 while(PWMA->SYNCBUSY3);
342 _PWM_DISABLE_CAP_FUNC(PWMA, PWM_CH3);
343 while(PWMA->SYNCBUSY3);
344 _PWM_DISABLE_CAP_IN(PWMA, PWM_CH3);
345 while(PWMA->SYNCBUSY3);
346
347 //Donot Cloce PWM23, Safe for other unknown PWM device
348 /* //Close PWM Clock Source
349 SYS_UnlockReg();
350 // SYS->IPRSTC2 |= SYS_IPRSTC2_PWM03_RST_Msk;
351 // SYS->IPRSTC2 &= ~SYS_IPRSTC2_PWM03_RST_Msk;
352 SYSCLK->APBCLK &= ~SYSCLK_APBCLK_PWM23_EN_Msk;
353 SYS_LockReg();
354 */
355 }
356
357 void Get_PWM3_Capture_Data(void)
358 {
359 uint32_t i;
360
361 _PWM_CLR_CAP_RISING_INDICATOR(PWMA, PWM_CH3);
362 _PWM_CLR_CAP_FALLING_INDICATOR(PWMA, PWM_CH3);
363
364 for(i=0; i<4; )
365 {
366 if(_PWM_GET_CAP_RISING_INDICATOR(PWMA, PWM_CH3))
367 {
368 PWM3.Capture_Rising[i>>1] = PWMA->CRLR3;
369 PWM3.Last_Edge = Rising;
370 _PWM_CLR_CAP_RISING_INDICATOR(PWMA, PWM_CH3);
371 i++;
372 }
373 else if(_PWM_GET_CAP_FALLING_INDICATOR(PWMA, PWM_CH3))
374 {
375 PWM3.Capture_Falling[i>>1] = PWMA->CFLR3;
376 PWM3.Last_Edge = Falling;
377 _PWM_CLR_CAP_FALLING_INDICATOR(PWMA, PWM_CH3);
378 i++;
379 }
380 }
381
382 if(PWM3.Last_Edge == Falling)
383 {
384 //Calculate Case 1:
385 if(PWM3.Capture_Rising[0]>PWM3.Capture_Rising[1])
386 {
387 PWM3.Signal_Period = PWM3.Capture_Rising[0] - PWM3.Capture_Rising[1]; //(us)
388 PWM3.High_Period = PWM3.Capture_Rising[0] - PWM3.Capture_Falling[0]; //(us)
389 }
390 //Calculate Case 2:
391 else if(PWM3.Capture_Rising[0]<PWM3.Capture_Rising[1])
392 {
393 PWM3.Signal_Period = _PWM_Resolution + PWM3.Capture_Rising[0] - PWM3.Capture_Rising[1]; //(us)
394 PWM3.High_Period = PWM3.Capture_Rising[1] - PWM3.Capture_Falling[1]; //(us)
395 }
396 PWM3.Low_Period = PWM3.Signal_Period - PWM3.High_Period; //(us)
397 PWM3.Signal_Frequency = (float) PWM23_Clock / (float) PWM3.Signal_Period; //(Hz)
398 }
399 else if(PWM3.Last_Edge == Rising)
400 {
401 //Calculate Case 3:
402 if(PWM3.Capture_Falling[0]>PWM3.Capture_Falling[1])
403 {
404 PWM3.Signal_Period = PWM3.Capture_Falling[0] - PWM3.Capture_Falling[1]; //(us)
405 PWM3.Low_Period = PWM3.Capture_Falling[0] - PWM3.Capture_Rising[0]; //(us)
406 }
407 //Calculate Case 4:
408 else if(PWM3.Capture_Rising[0]<PWM3.Capture_Rising[1])
409 {
410 PWM3.Signal_Period = _PWM_Resolution + PWM3.Capture_Falling[0] - PWM3.Capture_Falling[1]; //(us)
411 PWM3.Low_Period = PWM3.Capture_Falling[1] - PWM3.Capture_Rising[1]; //(us)
412 }
413 PWM3.High_Period = PWM3.Signal_Period - PWM3.Low_Period; //(us)
414 PWM3.Signal_Frequency = (float) PWM23_Clock / (float) PWM3.Signal_Period; //(Hz)
415 }
416 }
NuEdu-Basic01_PWM_Capture.h
Nano100 series PWM and Capture driver header file.
Close_PWM3_Capture
void Close_PWM3_Capture(void)
Definition: NuEdu-Basic01_PWM_Capture.c:332
Get_PWM3_Capture_Data
void Get_PWM3_Capture_Data(void)
Definition: NuEdu-Basic01_PWM_Capture.c:357
_PWM_Resolution
#define _PWM_Resolution
Definition: NuEdu-Basic01_PWM_Capture.h:26
PWM3
PWM_Capture_T PWM3
Definition: NuEdu-Basic01_PWM_Capture.c:22
PWM_Capture_T::Capture_Rising
__IO uint32_t Capture_Rising[2]
Definition: NuEdu-Basic01_PWM_Capture.h:32
FALSE
#define FALSE
Boolean false, define to use in API parameters or return value.
Definition: Nano100Series.h:11863
PWM_CH3
#define PWM_CH3
Definition: pwm.h:36
PWM_Capture_T::Capture_Falling
__IO uint32_t Capture_Falling[2]
Definition: NuEdu-Basic01_PWM_Capture.h:33
Open_PWM3_Capture
void Open_PWM3_Capture(void)
Definition: NuEdu-Basic01_PWM_Capture.c:273
Close_PWM6_OUT
void Close_PWM6_OUT(void)
Definition: NuEdu-Basic01_PWM_Capture.c:113
PWM_Capture_T::Last_Edge
__IO uint32_t Last_Edge
Definition: NuEdu-Basic01_PWM_Capture.h:34
Open_PWM7_Capture
void Open_PWM7_Capture(void)
Definition: NuEdu-Basic01_PWM_Capture.c:132
PWM_Capture_T::Low_Period
__IO uint32_t Low_Period
Definition: NuEdu-Basic01_PWM_Capture.h:36
PWM7
PWM_Capture_T PWM7
Definition: NuEdu-Basic01_PWM_Capture.c:23
SYS_UnlockReg
__STATIC_INLINE void SYS_UnlockReg(void)
Disable register write-protection function.
Definition: sys.h:826
_PWM_Source_Clock
#define _PWM_Source_Clock
Definition: NuEdu-Basic01_PWM_Capture.h:25
_PWM_Duty_Scale
#define _PWM_Duty_Scale
Definition: NuEdu-Basic01_PWM_Capture.h:28
PWM23_Clock
uint32_t PWM23_Clock
Definition: NuEdu-Basic01_PWM_Capture.c:16
Open_PWM6_OUT
void Open_PWM6_OUT(uint32_t PWM_Frequency, uint32_t PWM_Duty)
Definition: NuEdu-Basic01_PWM_Capture.c:25
PWM_Capture_T
Definition: NuEdu-Basic01_PWM_Capture.h:30
Open_PWM7_Capture_Fail
uint32_t Open_PWM7_Capture_Fail
Definition: NuEdu-Basic01_PWM_Capture.c:20
Get_PWM7_Capture_Data
void Get_PWM7_Capture_Data(void)
Definition: NuEdu-Basic01_PWM_Capture.c:212
_PWM_Prescale_Max
#define _PWM_Prescale_Max
Definition: NuEdu-Basic01_PWM_Capture.h:27
PWM_Capture_T::High_Period
__IO uint32_t High_Period
Definition: NuEdu-Basic01_PWM_Capture.h:35
SYS_LockReg
__STATIC_INLINE void SYS_LockReg(void)
Enable register write-protection function.
Definition: sys.h:843
PWM67_Clock
uint32_t PWM67_Clock
Definition: NuEdu-Basic01_PWM_Capture.c:17
Open_PWM3_Capture_Fail
uint32_t Open_PWM3_Capture_Fail
Definition: NuEdu-Basic01_PWM_Capture.c:19
Rising
Definition: NuEdu-Basic01_PWM_Capture.h:43
Falling
Definition: NuEdu-Basic01_PWM_Capture.h:44
TRUE
#define TRUE
Boolean true, define to use in API parameters or return value.
Definition: Nano100Series.h:11862
Close_PWM7_Capture
void Close_PWM7_Capture(void)
Definition: NuEdu-Basic01_PWM_Capture.c:189
PWM_CH2
#define PWM_CH2
Definition: pwm.h:35
Open_PWM6_OUT_Fail
uint32_t Open_PWM6_OUT_Fail
Definition: NuEdu-Basic01_PWM_Capture.c:18
PWM_Capture_T::Signal_Frequency
__IO float Signal_Frequency
Definition: NuEdu-Basic01_PWM_Capture.h:38
PWM_Capture_T::Signal_Period
__IO uint32_t Signal_Period
Definition: NuEdu-Basic01_PWM_Capture.h:37
SystemCoreClockUpdate
void SystemCoreClockUpdate(void)
Updates the SystemCoreClock with current core Clock retrieved from CPU registers.
Definition: system_Nano100Series.c:106
SYS
#define SYS
Pointer to SYS register structure.
Definition: Nano100Series.h:11692