1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
|
/*******************************************************************************
* Copyright (C) 2020, Huada Semiconductor Co., Ltd. All rights reserved.
*
* This software component is licensed by HDSC under BSD 3-Clause license
* (the "License"); You may not use this file except in compliance with the
* License. You may obtain a copy of the License at:
* opensource.org/licenses/BSD-3-Clause
*/
/******************************************************************************/
/** \file hc32f460_timer4_pwm.c
**
** A detailed description is available at
** @link Timer4PwmGroup Timer4PWM description @endlink
**
** - 2018-11-02 CDT First version for Device Driver Library of Timer4PWM.
**
******************************************************************************/
/*******************************************************************************
* Include files
******************************************************************************/
#include "hc32f460_timer4_pwm.h"
#include "hc32f460_utility.h"
/**
*******************************************************************************
** \addtogroup Timer4PwmGroup
******************************************************************************/
//@{
/*******************************************************************************
* Local type definitions ('typedef')
******************************************************************************/
/*******************************************************************************
* Local pre-processor symbols/macros ('#define')
******************************************************************************/
/*!< Parameter validity check for Timer4 unit */
#define IS_VALID_TIMER4(__TMRx__) \
( (M4_TMR41 == (__TMRx__)) || \
(M4_TMR42 == (__TMRx__)) || \
(M4_TMR43 == (__TMRx__)))
/*!< Parameter validity check for PWM channel */
#define IS_VALID_PWM_CH(x) \
( (Timer4PwmU == (x)) || \
(Timer4PwmV == (x)) || \
(Timer4PwmW == (x)))
/*!< Parameter validity check for PWM mode */
#define IS_VALID_PWM_MODE(x) \
( (PwmThroughMode == (x)) || \
(PwmDeadTimerMode == (x)) || \
(PwmDeadTimerFilterMode == (x)))
/*!< Parameter valid check for PWM output state. */
#define IS_VALID_PWM_OUTPUT_STATE(x) \
( (PwmHPwmLHold == (x)) || \
(PwmHPwmLReverse == (x)) || \
(PwmHReversePwmLHold == (x)) || \
(PwmHHoldPwmLReverse == (x)))
/*!< Parameter valid check for PWM clock division. */
#define IS_VALID_PWM_CLK_DIV(x) \
( (PwmPlckDiv1 == (x)) || \
(PwmPlckDiv2 == (x)) || \
(PwmPlckDiv4 == (x)) || \
(PwmPlckDiv8 == (x)) || \
(PwmPlckDiv16 == (x)) || \
(PwmPlckDiv32 == (x)) || \
(PwmPlckDiv64 == (x)) || \
(PwmPlckDiv128 == (x)))
/*!< Get the specified register address of the specified Timer4 unit */
#define TMR4_RCSRx(__TMR4x__) ((uint32_t)&(__TMR4x__)->RCSR)
#define TMR4_POCRx(__TMR4x__, __CH__) ((uint32_t)&(__TMR4x__)->POCRU + ((uint32_t)(__CH__))*4ul)
#define TMR4_PDARx(__TMR4x__, __CH__) ((uint32_t)&(__TMR4x__)->PDARU + ((uint32_t)(__CH__))*8ul)
#define TMR4_PDBRx(__TMR4x__, __CH__) ((uint32_t)&(__TMR4x__)->PDBRU + ((uint32_t)(__CH__))*8ul)
#define TMR4_PFSRx(__TMR4x__, __CH__) ((uint32_t)&(__TMR4x__)->PFSRU + ((uint32_t)(__CH__))*8ul)
/*******************************************************************************
* Global variable definitions (declared in header file with 'extern')
******************************************************************************/
/*******************************************************************************
* Local function prototypes ('static')
******************************************************************************/
/*******************************************************************************
* Local variable definitions ('static')
******************************************************************************/
/*******************************************************************************
* Function implementation - global ('extern') and local ('static')
******************************************************************************/
/**
*******************************************************************************
** \brief Initialize a couple PWM channels
**
** \param [in] TMR4x Pointer to Timer4 instance register base
** \arg M4_TMR41 Timer4 unit 1 instance register base
** \arg M4_TMR42 Timer4 unit 2 instance register base
** \arg M4_TMR43 Timer4 unit 3 instance register base
** \param [in] enCh Channel of PWM
** \arg Timer4PwmOuhl Timer4 PWM couple channel OUH&OUL
** \arg Timer4PwmOvhl Timer4 PWM couple channel OVH&OVL
** \arg Timer4PwmOwhl Timer4 PWM couple channel OWH&OWL
** \param [in] pstcInitCfg The pointer of PWM configure structure
** \arg This parameter detail refer @ref stc_timer4_pwm_init_t
**
** \retval Ok Initialize successfully
** \retval ErrorInvalidParameter If one of following conditions are met:
** - TMR4x is invalid
** - pstcInitCfg == NULL
** - enCh is invalid
** - Other invalid configuration
**
******************************************************************************/
en_result_t TIMER4_PWM_Init(M4_TMR4_TypeDef *TMR4x,
en_timer4_pwm_ch_t enCh,
const stc_timer4_pwm_init_t *pstcInitCfg)
{
__IO stc_tmr4_pocr_field_t *pstcPOCR_f = NULL;
__IO stc_tmr4_rcsr_field_t *pstcRCSR_f = NULL;
en_result_t enRet = Ok;
/* Check TMR4x && pstcInitCfg pointer */
if ((IS_VALID_TIMER4(TMR4x)) && (NULL != pstcInitCfg))
{
/* Check parameters */
DDL_ASSERT(IS_VALID_PWM_MODE(pstcInitCfg->enMode));
DDL_ASSERT(IS_VALID_PWM_CLK_DIV(pstcInitCfg->enClkDiv));
DDL_ASSERT(IS_FUNCTIONAL_STATE(pstcInitCfg->enRtIntMaskCmd));
DDL_ASSERT(IS_VALID_PWM_OUTPUT_STATE(pstcInitCfg->enOutputState));
/* Get pointer of current channel PWM register address */
pstcRCSR_f = (__IO stc_tmr4_rcsr_field_t*)TMR4_RCSRx(TMR4x);
pstcPOCR_f = (__IO stc_tmr4_pocr_field_t*)TMR4_POCRx(TMR4x, enCh);
/* Configure PWM mode */
pstcPOCR_f->PWMMD = (uint16_t)(pstcInitCfg->enMode);
/* Configure PWM mode */
pstcPOCR_f->LVLS = (uint16_t)(pstcInitCfg->enOutputState);
/* Set timer clock division */
pstcPOCR_f->DIVCK = (uint16_t)(pstcInitCfg->enClkDiv);
/* Set interrupt mask */
switch (enCh)
{
case Timer4PwmU:
pstcRCSR_f->RTIDU = (uint16_t)(pstcInitCfg->enRtIntMaskCmd);
break;
case Timer4PwmV:
pstcRCSR_f->RTIDV = (uint16_t)(pstcInitCfg->enRtIntMaskCmd);
break;
case Timer4PwmW:
pstcRCSR_f->RTIDW = (uint16_t)(pstcInitCfg->enRtIntMaskCmd);
break;
default:
enRet = ErrorInvalidParameter;
break;
}
}
else
{
enRet = ErrorInvalidParameter;
}
return enRet;
}
/**
*******************************************************************************
** \brief De-Initialize a couple PWM channels
**
** \param [in] TMR4x Pointer to Timer4 instance register base
** \arg M4_TMR41 Timer4 unit 1 instance register base
** \arg M4_TMR42 Timer4 unit 2 instance register base
** \arg M4_TMR43 Timer4 unit 3 instance register base
** \param [in] enCh Channel of PWM
** \arg Timer4PwmOuhl Timer4 PWM couple channel OUH&OUL
** \arg Timer4PwmOvhl Timer4 PWM couple channel OVH&OVL
** \arg Timer4PwmOwhl Timer4 PWM couple channel OWH&OWL
**
** \retval Ok De-Initialize successfully.
** \retval ErrorInvalidParameter If one of following conditions are met:
** - TMR4x is invalid
** - enCh out of range
**
******************************************************************************/
en_result_t TIMER4_PWM_DeInit(M4_TMR4_TypeDef *TMR4x,
en_timer4_pwm_ch_t enCh)
{
en_result_t enRet = Ok;
__IO uint16_t *pu16PDAR = NULL;
__IO uint16_t *pu16PDBR = NULL;
__IO uint16_t *pu16PFSR = NULL;
__IO stc_tmr4_pocr_field_t *pstcPOCR_f = NULL;
__IO stc_tmr4_rcsr_field_t *pstcRCSR_f = NULL;
/* Check TMR4x pointer */
if (IS_VALID_TIMER4(TMR4x))
{
/* Get pointer of current channel PWM register address */
pu16PDAR = (__IO uint16_t*)TMR4_PDARx(TMR4x, enCh);
pu16PDBR = (__IO uint16_t*)TMR4_PDBRx(TMR4x, enCh);
pu16PFSR = (__IO uint16_t*)TMR4_PFSRx(TMR4x, enCh);
pstcRCSR_f = (__IO stc_tmr4_rcsr_field_t*)TMR4_RCSRx(TMR4x);
pstcPOCR_f = (__IO stc_tmr4_pocr_field_t*)TMR4_POCRx(TMR4x, enCh);
*pu16PDAR = (uint16_t)0u;
*pu16PDBR = (uint16_t)0u;
*pu16PFSR = (uint16_t)0u;
pstcPOCR_f->DIVCK = (uint16_t)0u;
pstcPOCR_f->LVLS = (uint16_t)0u;
pstcPOCR_f->PWMMD = (uint16_t)0u;
switch (enCh)
{
case Timer4PwmU:
pstcRCSR_f->RTIDU = (uint16_t)0u;
break;
case Timer4PwmV:
pstcRCSR_f->RTIDV = (uint16_t)0u;
break;
case Timer4PwmW:
pstcRCSR_f->RTIDW = (uint16_t)0u;
break;
default:
enRet = ErrorInvalidParameter;
break;
}
}
else
{
enRet = ErrorInvalidParameter;
}
return enRet;
}
/**
*******************************************************************************
** \brief Start PWM timer
**
** \param [in] TMR4x Pointer to Timer4 instance register base
** \arg M4_TMR41 Timer4 unit 1 instance register base
** \arg M4_TMR42 Timer4 unit 2 instance register base
** \arg M4_TMR43 Timer4 unit 3 instance register base
** \param [in] enCh Channel of PWM
** \arg Timer4PwmOuhl Timer4 PWM couple channel OUH&OUL
** \arg Timer4PwmOvhl Timer4 PWM couple channel OVH&OVL
** \arg Timer4PwmOwhl Timer4 PWM couple channel OWH&OWL
**
** \retval Ok Start timer successfully
** \retval ErrorInvalidParameter If one of following conditions are met:
** - TMR4x is invalid
** - enCh out of range
**
******************************************************************************/
en_result_t TIMER4_PWM_StartTimer(M4_TMR4_TypeDef *TMR4x,
en_timer4_pwm_ch_t enCh)
{
en_result_t enRet = ErrorInvalidParameter;
__IO stc_tmr4_rcsr_field_t *pstcRCSR_f = NULL;
/* Check TMR4x pointer */
if (IS_VALID_TIMER4(TMR4x))
{
enRet = Ok;
/* Get pointer of current channel PWM register address */
pstcRCSR_f = (__IO stc_tmr4_rcsr_field_t*)TMR4_RCSRx(TMR4x);
switch (enCh)
{
case Timer4PwmU:
pstcRCSR_f->RTEU = (uint16_t)1u;
break;
case Timer4PwmV:
pstcRCSR_f->RTEV = (uint16_t)1u;
break;
case Timer4PwmW:
pstcRCSR_f->RTEW = (uint16_t)1u;
break;
default:
enRet = ErrorInvalidParameter;
break;
}
}
return enRet;
}
/**
*******************************************************************************
** \brief Stop PWM timer
**
** \param [in] TMR4x Pointer to Timer4 instance register base
** \arg M4_TMR41 Timer4 unit 1 instance register base
** \arg M4_TMR42 Timer4 unit 2 instance register base
** \arg M4_TMR43 Timer4 unit 3 instance register base
** \param [in] enCh Channel of PWM
** \arg Timer4PwmOuhl Timer4 PWM couple channel OUH&OUL
** \arg Timer4PwmOvhl Timer4 PWM couple channel OVH&OVL
** \arg Timer4PwmOwhl Timer4 PWM couple channel OWH&OWL
**
** \retval Ok Stop timer successfully
** \retval ErrorInvalidParameter If one of following conditions are met:
** - TMR4x is invalid
** - enCh out of range
**
******************************************************************************/
en_result_t TIMER4_PWM_StopTimer(M4_TMR4_TypeDef *TMR4x,
en_timer4_pwm_ch_t enCh)
{
en_result_t enRet = ErrorInvalidParameter;
__IO stc_tmr4_rcsr_field_t *pstcRCSR_f = NULL;
/* Check parameters */
DDL_ASSERT(IS_VALID_PWM_CH(enCh));
/* Check TMR4x pointer */
if (IS_VALID_TIMER4(TMR4x))
{
enRet = Ok;
/* Get pointer of current channel PWM register address */
pstcRCSR_f = (__IO stc_tmr4_rcsr_field_t*)TMR4_RCSRx(TMR4x);
switch (enCh)
{
case Timer4PwmU:
pstcRCSR_f->RTSU = (uint16_t)1u;
break;
case Timer4PwmV:
pstcRCSR_f->RTSV = (uint16_t)1u;
break;
case Timer4PwmW:
pstcRCSR_f->RTSW = (uint16_t)1u;
break;
default:
enRet = ErrorInvalidParameter;
break;
}
}
return enRet;
}
/**
*******************************************************************************
** \brief Get PWM reload-timer interrupt flag
**
** \param [in] TMR4x Pointer to Timer4 instance register base
** \arg M4_TMR41 Timer4 unit 1 instance register base
** \arg M4_TMR42 Timer4 unit 2 instance register base
** \arg M4_TMR43 Timer4 unit 3 instance register base
** \param [in] enCh Channel of PWM
** \arg Timer4PwmOuhl Timer4 PWM couple channel OUH&OUL
** \arg Timer4PwmOvhl Timer4 PWM couple channel OVH&OVL
** \arg Timer4PwmOwhl Timer4 PWM couple channel OWH&OWL
**
** \retval Reset None interrupt request on PWM reload-timer
** \retval Set Detection interrupt request on PWM reload-timer
**
******************************************************************************/
en_flag_status_t TIMER4_PWM_GetIrqFlag(M4_TMR4_TypeDef *TMR4x,
en_timer4_pwm_ch_t enCh)
{
uint16_t u16Flag = 0u;
__IO stc_tmr4_rcsr_field_t *pstcRCSR_f = NULL;
/* Check parameters */
DDL_ASSERT(IS_VALID_PWM_CH(enCh));
DDL_ASSERT(IS_VALID_TIMER4(TMR4x));
/* Get pointer of current channel PWM register address */
pstcRCSR_f = (__IO stc_tmr4_rcsr_field_t*)TMR4_RCSRx(TMR4x);
switch (enCh)
{
case Timer4PwmU:
u16Flag = pstcRCSR_f->RTIFU;
break;
case Timer4PwmV:
u16Flag = pstcRCSR_f->RTIFV;
break;
case Timer4PwmW:
u16Flag = pstcRCSR_f->RTIFW;
break;
default:
break;
}
return (en_flag_status_t)u16Flag;
}
/**
*******************************************************************************
** \brief Clear PWM reload-timer interrupt flag
**
** \param [in] TMR4x Pointer to Timer4 instance register base
** \arg M4_TMR41 Timer4 unit 1 instance register base
** \arg M4_TMR42 Timer4 unit 2 instance register base
** \arg M4_TMR43 Timer4 unit 3 instance register base
** \param [in] enCh Channel of PWM
** \arg Timer4PwmOuhl Timer4 PWM couple channel OUH&OUL
** \arg Timer4PwmOvhl Timer4 PWM couple channel OVH&OVL
** \arg Timer4PwmOwhl Timer4 PWM couple channel OWH&OWL
**
** \retval Ok PWM reload-timer interrupt flag is clear
** \retval ErrorInvalidParameter If one of following conditions are met:
** - TMR4x is invalid
** - enCh out of range
**
******************************************************************************/
en_result_t TIMER4_PWM_ClearIrqFlag(M4_TMR4_TypeDef *TMR4x,
en_timer4_pwm_ch_t enCh)
{
en_result_t enRet = ErrorInvalidParameter;
__IO stc_tmr4_rcsr_field_t *pstcRCSR_f = NULL;
/* Check TMR4x pointer */
if (IS_VALID_TIMER4(TMR4x))
{
/* Check parameters */
DDL_ASSERT(IS_VALID_PWM_CH(enCh));
enRet = Ok;
/* Get pointer of current channel PWM register address */
pstcRCSR_f = (__IO stc_tmr4_rcsr_field_t*)TMR4_RCSRx(TMR4x);
switch (enCh)
{
case Timer4PwmU:
pstcRCSR_f->RTICU = (uint16_t)1u;
break;
case Timer4PwmV:
pstcRCSR_f->RTICV = (uint16_t)1u;
break;
case Timer4PwmW:
pstcRCSR_f->RTICW = (uint16_t)1u;
break;
default:
enRet = ErrorInvalidParameter;
break;
}
}
return enRet;
}
/**
*******************************************************************************
** \brief Write timer count cycle
**
** \param [in] TMR4x Pointer to Timer4 instance register base
** \arg M4_TMR41 Timer4 unit 1 instance register base
** \arg M4_TMR42 Timer4 unit 2 instance register base
** \arg M4_TMR43 Timer4 unit 3 instance register base
** \param [in] enCh Channel of PWM
** \arg Timer4PwmOuhl Timer4 PWM couple channel OUH&OUL
** \arg Timer4PwmOvhl Timer4 PWM couple channel OVH&OVL
** \arg Timer4PwmOwhl Timer4 PWM couple channel OWH&OWL
** \param [in] u16PDAR PDAR value
** \arg 0~65535
** \param [in] u16PDBR PDBR value
** \arg 0~65535
**
** \retval Ok Timer count cycle is written
** \retval ErrorInvalidParameter TMR4x is invalid
**
******************************************************************************/
en_result_t TIMER4_PWM_WriteDeadRegionValue(M4_TMR4_TypeDef *TMR4x,
en_timer4_pwm_ch_t enCh,
uint16_t u16PDAR,
uint16_t u16PDBR)
{
__IO uint16_t *pu16PDAR = NULL;
__IO uint16_t *pu16PDBR = NULL;
en_result_t enRet = ErrorInvalidParameter;
/* Check TMR4x pointer */
if (IS_VALID_TIMER4(TMR4x))
{
/* Check parameters */
DDL_ASSERT(IS_VALID_PWM_CH(enCh));
/* Get pointer of current channel PWM register address */
pu16PDAR = (__IO uint16_t *)TMR4_PDARx(TMR4x, enCh);
pu16PDBR = (__IO uint16_t *)TMR4_PDBRx(TMR4x, enCh);
/* set the register */
*pu16PDAR = u16PDAR;
*pu16PDBR = u16PDBR;
enRet = Ok;
}
return enRet;
}
/**
*******************************************************************************
** \brief Read dead region count value
**
** \param [in] TMR4x Pointer to Timer4 instance register base
** \arg M4_TMR41 Timer4 unit 1 instance register base
** \arg M4_TMR42 Timer4 unit 2 instance register base
** \arg M4_TMR43 Timer4 unit 3 instance register base
** \param [in] enCh Channel of PWM
** \arg Timer4PwmOuhl Timer4 PWM couple channel OUH&OUL
** \arg Timer4PwmOvhl Timer4 PWM couple channel OVH&OVL
** \arg Timer4PwmOwhl Timer4 PWM couple channel OWH&OWL
** \param [out] u16PDAR Pointer of uint16_t type
** \arg 0~65535
** \param [out] u16PDBR Pointer of uint16_t type
** \arg 0~65535
**
** \retval Ok Read successfully.
** \retval ErrorInvalidParameter TMR4x is invalid
**
******************************************************************************/
en_result_t TIMER4_PWM_ReadDeadRegionValue(M4_TMR4_TypeDef *TMR4x,
en_timer4_pwm_ch_t enCh,
uint16_t *u16PDAR,
uint16_t *u16PDBR)
{
en_result_t enRet = ErrorInvalidParameter;
/* Check TMR4x pointer */
if (IS_VALID_TIMER4(TMR4x))
{
/* Check parameters */
DDL_ASSERT(IS_VALID_PWM_CH(enCh));
/* Get pointer of current channel PWM register address */
*u16PDAR = *(__IO uint16_t *)TMR4_PDARx(TMR4x, enCh);
*u16PDBR = *(__IO uint16_t *)TMR4_PDBRx(TMR4x, enCh);
enRet = Ok;
}
return enRet;
}
/**
*******************************************************************************
** \brief Set cycle of PWM timer
**
** \param [in] TMR4x Pointer to Timer4 instance register base
** \arg M4_TMR41 Timer4 unit 1 instance register base
** \arg M4_TMR42 Timer4 unit 2 instance register base
** \arg M4_TMR43 Timer4 unit 3 instance register base
** \param [in] enCh Channel of PWM
** \arg Timer4PwmOuhl Timer4 PWM couple channel OUH&OUL
** \arg Timer4PwmOvhl Timer4 PWM couple channel OVH&OVL
** \arg Timer4PwmOwhl Timer4 PWM couple channel OWH&OWL
** \param [in] u16Count PWM pulse counter value
** \arg 0~65535
**
** \retval Ok Cycle of PWM timer is set
** \retval ErrorInvalidParameter TMR4x is invalid
**
******************************************************************************/
en_result_t TIMER4_PWM_SetFilterCountValue(M4_TMR4_TypeDef *TMR4x,
en_timer4_pwm_ch_t enCh,
uint16_t u16Count)
{
__IO uint16_t *pu16PFSR = NULL;
en_result_t enRet = ErrorInvalidParameter;
/* Check TMR4x pointer */
if (IS_VALID_TIMER4(TMR4x))
{
/* Check parameters */
DDL_ASSERT(IS_VALID_PWM_CH(enCh));
/* Get pointer of current channel PWM register address */
pu16PFSR = (__IO uint16_t*)TMR4_PFSRx(TMR4x, enCh);
*pu16PFSR =u16Count;
enRet = Ok;
}
return enRet;
}
//@} // Timer4PwmGroup
/*******************************************************************************
* EOF (not truncated)
******************************************************************************/
|