forked from SZV10X_Software/SZV103_FM33A0xxEV_SiZhu

jinlicong
2024-05-15 d14dd3a2106de793fbe08dc5a12cf80defd3258a
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
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
/**
  ******************************************************************************
  * @file    fm33a0xxev_lptim.c
  * @author  FM33A0XXEV Application Team
  * @version V1.0.0
  * @date    16-April-2020
  * @brief   This file provides firmware functions to manage the following 
  *          functionalities of....:
  *
*/
 
/* Includes ------------------------------------------------------------------*/
 
#include "fm33a0xxev_lptim.h"
 
/** @addtogroup fm33a0xxev_StdPeriph_Driver
  * @{
  */
 
/** @defgroup LPTIM 
  * @brief LPTIM driver modules
  * @{
  */ 
 
/* LPT_ETRÊäÈëÄ£ÄâÂ˲¨Ê¹ÄÜ(External Trigger input Analog Filter Enable)
0£º¹Ø±ÕÄ£ÄâÂ˲¨
1£ºÊ¹ÄÜÄ£ÄâÂ˲¨£¬Â˲¨¿í¶ÈÔ¼100ns Ïà¹Øº¯Êý */
void LPTIM_CFGR_ETR_AFEN_Setable(FunState NewState)
{
    if (NewState == ENABLE)
    {
        LPTIM->CFGR |= (LPTIM_CFGR_ETR_AFEN_Msk);
    }
    else
    {
        LPTIM->CFGR &= ~(LPTIM_CFGR_ETR_AFEN_Msk);
    }
}
 
FunState LPTIM_CFGR_ETR_AFEN_Getable(void)
{
    if (LPTIM->CFGR & (LPTIM_CFGR_ETR_AFEN_Msk))
    {
        return ENABLE;
    }
    else
    {
        return DISABLE;
    }
}
 
/* Ê±ÖÓÔ¤·ÖƵÊäÈëÑ¡Ôñ(Prescaler input Select)
0£ºCLKSELÑ¡ÔñµÄʱÖÓ
1£ºLPTETRF Ïà¹Øº¯Êý */
void LPTIM_CFGR_PSCSEL_Set(uint32_t SetValue)
{
    uint32_t tmpreg;
    tmpreg = LPTIM->CFGR;
    tmpreg &= ~(LPTIM_CFGR_PSCSEL_Msk);
    tmpreg |= (SetValue & LPTIM_CFGR_PSCSEL_Msk);
    LPTIM->CFGR = tmpreg;
}
 
uint32_t LPTIM_CFGR_PSCSEL_Get(void)
{
    return (LPTIM->CFGR & LPTIM_CFGR_PSCSEL_Msk);
}
 
/* ¼ÆÊýʱÖÓ·ÖÆµÑ¡Ôñ(Counter Clock Divider Select)
000£º1·ÖƵ
001£º2·ÖƵ
010£º4·ÖƵ
011£º8·ÖƵ
100£º16·ÖƵ
101£º32·ÖƵ
110£º64·ÖƵ
111£º128·ÖƵ Ïà¹Øº¯Êý */
void LPTIM_CFGR_DIVSEL_Set(uint32_t SetValue)
{
    uint32_t tmpreg;
    tmpreg = LPTIM->CFGR;
    tmpreg &= ~(LPTIM_CFGR_DIVSEL_Msk);
    tmpreg |= (SetValue & LPTIM_CFGR_DIVSEL_Msk);
    LPTIM->CFGR = tmpreg;
}
 
uint32_t LPTIM_CFGR_DIVSEL_Get(void)
{
    return (LPTIM->CFGR & LPTIM_CFGR_DIVSEL_Msk);
}
 
/* ETRÊäÈë±ßÑØÑ¡Ôñ(ETR Clock Edge Select)
0£ºLPT_ETRµÄÉÏÉýÑØ¼ÆÊý
1£ºLPT_ETRµÄϽµÑؼÆÊý Ïà¹Øº¯Êý */
void LPTIM_CFGR_EDGESEL_Set(uint32_t SetValue)
{
    uint32_t tmpreg;
    tmpreg = LPTIM->CFGR;
    tmpreg &= ~(LPTIM_CFGR_EDGESEL_Msk);
    tmpreg |= (SetValue & LPTIM_CFGR_EDGESEL_Msk);
    LPTIM->CFGR = tmpreg;
}
 
uint32_t LPTIM_CFGR_EDGESEL_Get(void)
{
    return (LPTIM->CFGR & LPTIM_CFGR_EDGESEL_Msk);
}
 
/* Íⲿ´¥·¢±ßÑØÑ¡Ôñ£¨ÐèʹÓÃÄÚ²¿Ê±ÖÓͬ²½²ÉÑùLPT_ETR£©(ETR trigger Configuration)
00: LPT_ETRÊäÈëÐźÅÉÏÉýÑØ´¥·¢
01: LPT_ETRÊäÈëÐźÅϽµÑØ´¥·¢
10/11: ÍⲿÊäÈëÐźÅÉÏÉýϽµÑØ´¥·¢ Ïà¹Øº¯Êý */
void LPTIM_CFGR_TRIGCFG_Set(uint32_t SetValue)
{
    uint32_t tmpreg;
    tmpreg = LPTIM->CFGR;
    tmpreg &= ~(LPTIM_CFGR_TRIGCFG_Msk);
    tmpreg |= (SetValue & LPTIM_CFGR_TRIGCFG_Msk);
    LPTIM->CFGR = tmpreg;
}
 
uint32_t LPTIM_CFGR_TRIGCFG_Get(void)
{
    return (LPTIM->CFGR & LPTIM_CFGR_TRIGCFG_Msk);
}
 
/* µ¥´Î¼ÆÊýģʽʹÄÜ(One State Timer)
0£ºÁ¬Ðø¼ÆÊýģʽ£º¼ÆÊýÆ÷±»´¥·¢ºó±£³ÖÔËÐУ¬Ö±µ½±»¹Ø±ÕΪֹ¡£¼ÆÊýÆ÷´ïµ½Ä¿±êÖµºó»Øµ½0ÖØÐ¿ªÊ¼¼ÆÊý£¬²¢²úÉúÒç³öÖжϡ£
1£ºµ¥´Î¼ÆÊýģʽ£º¼ÆÊýÆ÷±»´¥·¢ºó¼ÆÊýµ½Ä¿±êÖµºó»Øµ½0£¬²¢×Ô¶¯Í£Ö¹£¬²úÉúÒç³öÖжϡ£ Ïà¹Øº¯Êý */
void LPTIM_CFGR_ONST_Set(uint32_t SetValue)
{
    uint32_t tmpreg;
    tmpreg = LPTIM->CFGR;
    tmpreg &= ~(LPTIM_CFGR_ONST_Msk);
    tmpreg |= (SetValue & LPTIM_CFGR_ONST_Msk);
    LPTIM->CFGR = tmpreg;
}
 
uint32_t LPTIM_CFGR_ONST_Get(void)
{
    return (LPTIM->CFGR & LPTIM_CFGR_ONST_Msk);
}
 
/* ¹¤×÷ģʽѡÔñ(Timer operation Mode)
00£ºÆÕͨ¶¨Ê±Æ÷ģʽ
01£ºTriggerÂö³å´¥·¢¼ÆÊýģʽ
10£ºÍⲿÒì²½Âö³å¼ÆÊýģʽ
11£ºTimeoutģʽ Ïà¹Øº¯Êý */
void LPTIM_CFGR_TMODE_Set(uint32_t SetValue)
{
    uint32_t tmpreg;
    tmpreg = LPTIM->CFGR;
    tmpreg &= ~(LPTIM_CFGR_TMODE_Msk);
    tmpreg |= (SetValue & LPTIM_CFGR_TMODE_Msk);
    LPTIM->CFGR = tmpreg;
}
 
uint32_t LPTIM_CFGR_TMODE_Get(void)
{
    return (LPTIM->CFGR & LPTIM_CFGR_TMODE_Msk);
}
 
/* 32bit¼ÆÊýÆ÷µ±Ç°¼ÆÊýÖµ(Counter 32bits-wide) Ïà¹Øº¯Êý */
uint32_t LPTIM_CNTR_Read(void)
{
    return (LPTIM->CNTR);
}
 
/* Í¨µÀ1²¶×½Ô´Ñ¡Ôñ(Capture channel 1 source select)£¬½öÔÚCH1ͨµÀÅäÖÃΪÊäÈ벶׽ʱÓÐЧ
00£ºLPT_CH1ÊäÈë
01£ºXTLF
10£ºRCLP
11£ºRCMF Ïà¹Øº¯Êý */
void LPTIM_CCSR_CAP1SSEL_Set(uint32_t SetValue)
{
    uint32_t tmpreg;
    tmpreg = LPTIM->CCSR;
    tmpreg &= ~(LPTIM_CCSR_CAP1SSEL_Msk);
    tmpreg |= (SetValue & LPTIM_CCSR_CAP1SSEL_Msk);
    LPTIM->CCSR = tmpreg;
}
 
uint32_t LPTIM_CCSR_CAP1SSEL_Get(void)
{
    return (LPTIM->CCSR & LPTIM_CCSR_CAP1SSEL_Msk);
}
 
/* Í¨µÀ4µ±Ç°±»²¶×½µÄ±ßÑØ£¬ÔÚCC2IFÖÃλʱ¸üÐÂ(Channel 4 Captured Edge)
0£ºÉÏÉýÑØ
1£ºÏ½µÑØ Ïà¹Øº¯Êý */
void LPTIM_CCSR_CAP4EDGE_Set(uint32_t SetValue)
{
    uint32_t tmpreg;
    tmpreg = LPTIM->CCSR;
    tmpreg &= ~(LPTIM_CCSR_CAP4EDGE_Msk);
    tmpreg |= (SetValue & LPTIM_CCSR_CAP4EDGE_Msk);
    LPTIM->CCSR = tmpreg;
}
 
uint32_t LPTIM_CCSR_CAP4EDGE_Get(void)
{
    return (LPTIM->CCSR & LPTIM_CCSR_CAP4EDGE_Msk);
}
 
void LPTIM_CCSR_CAP3EDGE_Set(uint32_t SetValue)
{
    uint32_t tmpreg;
    tmpreg = LPTIM->CCSR;
    tmpreg &= ~(LPTIM_CCSR_CAP3EDGE_Msk);
    tmpreg |= (SetValue & LPTIM_CCSR_CAP3EDGE_Msk);
    LPTIM->CCSR = tmpreg;
}
 
uint32_t LPTIM_CCSR_CAP3EDGE_Get(void)
{
    return (LPTIM->CCSR & LPTIM_CCSR_CAP3EDGE_Msk);
}
 
void LPTIM_CCSR_CAP2EDGE_Set(uint32_t SetValue)
{
    uint32_t tmpreg;
    tmpreg = LPTIM->CCSR;
    tmpreg &= ~(LPTIM_CCSR_CAP2EDGE_Msk);
    tmpreg |= (SetValue & LPTIM_CCSR_CAP2EDGE_Msk);
    LPTIM->CCSR = tmpreg;
}
 
uint32_t LPTIM_CCSR_CAP2EDGE_Get(void)
{
    return (LPTIM->CCSR & LPTIM_CCSR_CAP2EDGE_Msk);
}
 
void LPTIM_CCSR_CAP1EDGE_Set(uint32_t SetValue)
{
    uint32_t tmpreg;
    tmpreg = LPTIM->CCSR;
    tmpreg &= ~(LPTIM_CCSR_CAP1EDGE_Msk);
    tmpreg |= (SetValue & LPTIM_CCSR_CAP1EDGE_Msk);
    LPTIM->CCSR = tmpreg;
}
 
uint32_t LPTIM_CCSR_CAP1EDGE_Get(void)
{
    return (LPTIM->CCSR & LPTIM_CCSR_CAP1EDGE_Msk);
}
 
/* Í¨µÀ4±È½ÏÊä³ö²¨Ðμ«ÐÔÑ¡Ôñ (Channel 4 compare output Polarity)
0£ºÕý¼«ÐÔ²¨ÐΣ¬ÆðʼΪµÍ£¬¼ÆÊýÖµ==±È½ÏֵʱÖøߣ¬¼ÆÊýÖµ==ARRʱ»Ö¸´ÎªµÍ
1£º¸º¼«ÐÔ²¨ÐΣ¬Õý¼«ÐÔ²¨ÐÎÈ¡·´ Ïà¹Øº¯Êý */
void LPTIM_CCSR_POLAR4_Set(uint32_t SetValue)
{
    uint32_t tmpreg;
    tmpreg = LPTIM->CCSR;
    tmpreg &= ~(LPTIM_CCSR_POLAR4_Msk);
    tmpreg |= (SetValue & LPTIM_CCSR_POLAR4_Msk);
    LPTIM->CCSR = tmpreg;
}
 
uint32_t LPTIM_CCSR_POLAR4_Get(void)
{
    return (LPTIM->CCSR & LPTIM_CCSR_POLAR4_Msk);
}
 
void LPTIM_CCSR_POLAR3_Set(uint32_t SetValue)
{
    uint32_t tmpreg;
    tmpreg = LPTIM->CCSR;
    tmpreg &= ~(LPTIM_CCSR_POLAR3_Msk);
    tmpreg |= (SetValue & LPTIM_CCSR_POLAR3_Msk);
    LPTIM->CCSR = tmpreg;
}
 
uint32_t LPTIM_CCSR_POLAR3_Get(void)
{
    return (LPTIM->CCSR & LPTIM_CCSR_POLAR3_Msk);
}
 
void LPTIM_CCSR_POLAR2_Set(uint32_t SetValue)
{
    uint32_t tmpreg;
    tmpreg = LPTIM->CCSR;
    tmpreg &= ~(LPTIM_CCSR_POLAR2_Msk);
    tmpreg |= (SetValue & LPTIM_CCSR_POLAR2_Msk);
    LPTIM->CCSR = tmpreg;
}
 
uint32_t LPTIM_CCSR_POLAR2_Get(void)
{
    return (LPTIM->CCSR & LPTIM_CCSR_POLAR2_Msk);
}
 
void LPTIM_CCSR_POLAR1_Set(uint32_t SetValue)
{
    uint32_t tmpreg;
    tmpreg = LPTIM->CCSR;
    tmpreg &= ~(LPTIM_CCSR_POLAR1_Msk);
    tmpreg |= (SetValue & LPTIM_CCSR_POLAR1_Msk);
    LPTIM->CCSR = tmpreg;
}
 
uint32_t LPTIM_CCSR_POLAR1_Get(void)
{
    return (LPTIM->CCSR & LPTIM_CCSR_POLAR1_Msk);
}
 
/* Í¨µÀ4²¶×½±ßÑØÑ¡Ôñ(Channel 4 Capture edge Config)
00£ºÉÏÉýÑØ²¶×½
01£ºÏ½µÑز¶×½
10£ºÉÏÉýϽµÑز¶×½
11£ºRFU Ïà¹Øº¯Êý */
void LPTIM_CCSR_CAPCFG4_Set(uint32_t SetValue)
{
    uint32_t tmpreg;
    tmpreg = LPTIM->CCSR;
    tmpreg &= ~(LPTIM_CCSR_CAPCFG4_Msk);
    tmpreg |= (SetValue & LPTIM_CCSR_CAPCFG4_Msk);
    LPTIM->CCSR = tmpreg;
}
 
uint32_t LPTIM_CCSR_CAPCFG4_Get(void)
{
    return (LPTIM->CCSR & LPTIM_CCSR_CAPCFG4_Msk);
}
 
void LPTIM_CCSR_CAPCFG3_Set(uint32_t SetValue)
{
    uint32_t tmpreg;
    tmpreg = LPTIM->CCSR;
    tmpreg &= ~(LPTIM_CCSR_CAPCFG3_Msk);
    tmpreg |= (SetValue & LPTIM_CCSR_CAPCFG3_Msk);
    LPTIM->CCSR = tmpreg;
}
 
uint32_t LPTIM_CCSR_CAPCFG3_Get(void)
{
    return (LPTIM->CCSR & LPTIM_CCSR_CAPCFG3_Msk);
}
 
void LPTIM_CCSR_CAPCFG2_Set(uint32_t SetValue)
{
    uint32_t tmpreg;
    tmpreg = LPTIM->CCSR;
    tmpreg &= ~(LPTIM_CCSR_CAPCFG2_Msk);
    tmpreg |= (SetValue & LPTIM_CCSR_CAPCFG2_Msk);
    LPTIM->CCSR = tmpreg;
}
 
uint32_t LPTIM_CCSR_CAPCFG2_Get(void)
{
    return (LPTIM->CCSR & LPTIM_CCSR_CAPCFG2_Msk);
}
 
void LPTIM_CCSR_CAPCFG1_Set(uint32_t SetValue)
{
    uint32_t tmpreg;
    tmpreg = LPTIM->CCSR;
    tmpreg &= ~(LPTIM_CCSR_CAPCFG1_Msk);
    tmpreg |= (SetValue & LPTIM_CCSR_CAPCFG1_Msk);
    LPTIM->CCSR = tmpreg;
}
 
uint32_t LPTIM_CCSR_CAPCFG1_Get(void)
{
    return (LPTIM->CCSR & LPTIM_CCSR_CAPCFG1_Msk);
}
 
/* Í¨µÀ4²¶×½/±È½Ï¹¦ÄÜʹÄÜ(Channel 4 Capture/Compare Select)
00,11£º½ûֹͨµÀ4²¶×½/±È½Ï¹¦ÄÜ
01£ºÊ¹ÄÜͨµÀ4²¶×½¹¦ÄÜ£¨LPT_CH4ΪÊäÈ룩
10£ºÊ¹ÄÜͨµÀ4±È½Ï¹¦ÄÜ£¨LPT_CH4ΪÊä³ö£© Ïà¹Øº¯Êý */
void LPTIM_CCSR_CC4S_Set(uint32_t SetValue)
{
    uint32_t tmpreg;
    tmpreg = LPTIM->CCSR;
    tmpreg &= ~(LPTIM_CCSR_CC4S_Msk);
    tmpreg |= (SetValue & LPTIM_CCSR_CC4S_Msk);
    LPTIM->CCSR = tmpreg;
}
 
uint32_t LPTIM_CCSR_CC4S_Get(void)
{
    return (LPTIM->CCSR & LPTIM_CCSR_CC4S_Msk);
}
 
void LPTIM_CCSR_CC3S_Set(uint32_t SetValue)
{
    uint32_t tmpreg;
    tmpreg = LPTIM->CCSR;
    tmpreg &= ~(LPTIM_CCSR_CC3S_Msk);
    tmpreg |= (SetValue & LPTIM_CCSR_CC3S_Msk);
    LPTIM->CCSR = tmpreg;
}
 
uint32_t LPTIM_CCSR_CC3S_Get(void)
{
    return (LPTIM->CCSR & LPTIM_CCSR_CC3S_Msk);
}
 
void LPTIM_CCSR_CC2S_Set(uint32_t SetValue)
{
    uint32_t tmpreg;
    tmpreg = LPTIM->CCSR;
    tmpreg &= ~(LPTIM_CCSR_CC2S_Msk);
    tmpreg |= (SetValue & LPTIM_CCSR_CC2S_Msk);
    LPTIM->CCSR = tmpreg;
}
 
uint32_t LPTIM_CCSR_CC2S_Get(void)
{
    return (LPTIM->CCSR & LPTIM_CCSR_CC2S_Msk);
}
 
void LPTIM_CCSR_CC1S_Set(uint32_t SetValue)
{
    uint32_t tmpreg;
    tmpreg = LPTIM->CCSR;
    tmpreg &= ~(LPTIM_CCSR_CC1S_Msk);
    tmpreg |= (SetValue & LPTIM_CCSR_CC1S_Msk);
    LPTIM->CCSR = tmpreg;
}
 
uint32_t LPTIM_CCSR_CC1S_Get(void)
{
    return (LPTIM->CCSR & LPTIM_CCSR_CC1S_Msk);
}
 
/* ×Ô¶¯ÖØÔØÄ¿±ê¼Ä´æÆ÷(Auto-Reload Register)
µ±¼ÆÊýÆ÷¼ÆÊýÖµµÈÓÚARRʱ£¬¼ÆÊýÆ÷»Øµ½³õÖµÖØÐ¿ªÊ¼ÏòÉϼÆÊý Ïà¹Øº¯Êý */
void LPTIM_ARR_Write(uint32_t SetValue)
{
    LPTIM->ARR = (SetValue);
}
 
uint32_t LPTIM_ARR_Read(void)
{
    return (LPTIM->ARR);
}
 
/* Í¨µÀ4²¶×½Òç³öÖжÏʹÄÜ(Channel 4 Over-Capture Interrupt Enable)
1£ºÔÊÐíÖжÏ
0£º½ûÖ¹ÖжϠÏà¹Øº¯Êý */
void LPTIM_IER_OVR4IE_Setable(FunState NewState)
{
    if (NewState == ENABLE)
    {
        LPTIM->IER |= (LPTIM_IER_OVR4IE_Msk);
    }
    else
    {
        LPTIM->IER &= ~(LPTIM_IER_OVR4IE_Msk);
    }
}
 
FunState LPTIM_IER_OVR4IE_Getable(void)
{
    if (LPTIM->IER & (LPTIM_IER_OVR4IE_Msk))
    {
        return ENABLE;
    }
    else
    {
        return DISABLE;
    }
}
 
/* Í¨µÀ3²¶×½Òç³öÖжÏʹÄÜ(Channel 3 Over-Capture Interrupt Enable)
1£ºÔÊÐíÖжÏ
0£º½ûÖ¹ÖжϠÏà¹Øº¯Êý */
void LPTIM_IER_OVR3IE_Setable(FunState NewState)
{
    if (NewState == ENABLE)
    {
        LPTIM->IER |= (LPTIM_IER_OVR3IE_Msk);
    }
    else
    {
        LPTIM->IER &= ~(LPTIM_IER_OVR3IE_Msk);
    }
}
 
FunState LPTIM_IER_OVR3IE_Getable(void)
{
    if (LPTIM->IER & (LPTIM_IER_OVR3IE_Msk))
    {
        return ENABLE;
    }
    else
    {
        return DISABLE;
    }
}
 
/* Í¨µÀ2²¶×½Òç³öÖжÏʹÄÜ(Channel 2 Over-Capture Interrupt Enable)
1£ºÔÊÐíÖжÏ
0£º½ûÖ¹ÖжϠÏà¹Øº¯Êý */
void LPTIM_IER_OVR2IE_Setable(FunState NewState)
{
    if (NewState == ENABLE)
    {
        LPTIM->IER |= (LPTIM_IER_OVR2IE_Msk);
    }
    else
    {
        LPTIM->IER &= ~(LPTIM_IER_OVR2IE_Msk);
    }
}
 
FunState LPTIM_IER_OVR2IE_Getable(void)
{
    if (LPTIM->IER & (LPTIM_IER_OVR2IE_Msk))
    {
        return ENABLE;
    }
    else
    {
        return DISABLE;
    }
}
 
/* Í¨µÀ1²¶×½Òç³öÖжÏʹÄÜ(Channel 1 Over-Capture Interrupt Enable)
1£ºÔÊÐíÖжÏ
0£º½ûÖ¹ÖжϠÏà¹Øº¯Êý */
void LPTIM_IER_OVR1IE_Setable(FunState NewState)
{
    if (NewState == ENABLE)
    {
        LPTIM->IER |= (LPTIM_IER_OVR1IE_Msk);
    }
    else
    {
        LPTIM->IER &= ~(LPTIM_IER_OVR1IE_Msk);
    }
}
 
FunState LPTIM_IER_OVR1IE_Getable(void)
{
    if (LPTIM->IER & (LPTIM_IER_OVR1IE_Msk))
    {
        return ENABLE;
    }
    else
    {
        return DISABLE;
    }
}
 
/* Íⲿ´¥·¢µ½À´ÖжÏʹÄÜλ(External Trigger Interrupt Enable)
1£ºÍⲿ´¥·¢µ½À´ÖжÏʹÄÜ
0£ºÍⲿ´¥·¢µ½À´ÖжϽûÖ¹ Ïà¹Øº¯Êý */
void LPTIM_IER_TRIGIE_Setable(FunState NewState)
{
    if (NewState == ENABLE)
    {
        LPTIM->IER |= (LPTIM_IER_TRIGIE_Msk);
    }
    else
    {
        LPTIM->IER &= ~(LPTIM_IER_TRIGIE_Msk);
    }
}
 
FunState LPTIM_IER_TRIGIE_Getable(void)
{
    if (LPTIM->IER & (LPTIM_IER_TRIGIE_Msk))
    {
        return ENABLE;
    }
    else
    {
        return DISABLE;
    }
}
 
/* ¼ÆÊýÆ÷Òç³öÖжÏʹÄÜλ(Counter Over-Flow Interrupt Enable)
1£º¼ÆÊýÆ÷Òç³öÖжÏʹÄÜ
0£º¼ÆÊýÆ÷Òç³öÖжϽûÖ¹ Ïà¹Øº¯Êý */
void LPTIM_IER_OVIE_Setable(FunState NewState)
{
    if (NewState == ENABLE)
    {
        LPTIM->IER |= (LPTIM_IER_OVIE_Msk);
    }
    else
    {
        LPTIM->IER &= ~(LPTIM_IER_OVIE_Msk);
    }
}
 
FunState LPTIM_IER_OVIE_Getable(void)
{
    if (LPTIM->IER & (LPTIM_IER_OVIE_Msk))
    {
        return ENABLE;
    }
    else
    {
        return DISABLE;
    }
}
 
/* ²¶×½/±È½ÏͨµÀ4ÖжÏʹÄÜλ(Capture/Compare channel 4 Interrupt Enable)
1£º²¶×½/±È½ÏͨµÀ2ÖжÏʹÄÜ
0£º²¶×½/±È½ÏͨµÀ2ÖжϽûÖ¹ Ïà¹Øº¯Êý */
void LPTIM_IER_CC4IE_Setable(FunState NewState)
{
    if (NewState == ENABLE)
    {
        LPTIM->IER |= (LPTIM_IER_CC4IE_Msk);
    }
    else
    {
        LPTIM->IER &= ~(LPTIM_IER_CC4IE_Msk);
    }
}
 
FunState LPTIM_IER_CC4IE_Getable(void)
{
    if (LPTIM->IER & (LPTIM_IER_CC4IE_Msk))
    {
        return ENABLE;
    }
    else
    {
        return DISABLE;
    }
}
 
/* ²¶×½/±È½ÏͨµÀ3ÖжÏʹÄÜλ(Capture/Compare channel 3 Interrupt Enable)
1£º²¶×½/±È½ÏͨµÀ1ÖжÏʹÄÜ
0£º²¶×½/±È½ÏͨµÀ1ÖжϽûÖ¹ Ïà¹Øº¯Êý */
void LPTIM_IER_CC3IE_Setable(FunState NewState)
{
    if (NewState == ENABLE)
    {
        LPTIM->IER |= (LPTIM_IER_CC3IE_Msk);
    }
    else
    {
        LPTIM->IER &= ~(LPTIM_IER_CC3IE_Msk);
    }
}
 
FunState LPTIM_IER_CC3IE_Getable(void)
{
    if (LPTIM->IER & (LPTIM_IER_CC3IE_Msk))
    {
        return ENABLE;
    }
    else
    {
        return DISABLE;
    }
}
 
/* ²¶×½/±È½ÏͨµÀ2ÖжÏʹÄÜλ(Capture/Compare channel 2 Interrupt Enable)
1£º²¶×½/±È½ÏͨµÀ2ÖжÏʹÄÜ
0£º²¶×½/±È½ÏͨµÀ2ÖжϽûÖ¹ Ïà¹Øº¯Êý */
void LPTIM_IER_CC2IE_Setable(FunState NewState)
{
    if (NewState == ENABLE)
    {
        LPTIM->IER |= (LPTIM_IER_CC2IE_Msk);
    }
    else
    {
        LPTIM->IER &= ~(LPTIM_IER_CC2IE_Msk);
    }
}
 
FunState LPTIM_IER_CC2IE_Getable(void)
{
    if (LPTIM->IER & (LPTIM_IER_CC2IE_Msk))
    {
        return ENABLE;
    }
    else
    {
        return DISABLE;
    }
}
 
/* ²¶×½/±È½ÏͨµÀ1ÖжÏʹÄÜλ(Capture/Compare channel 1 Interrupt Enable)
1£º²¶×½/±È½ÏͨµÀ1ÖжÏʹÄÜ
0£º²¶×½/±È½ÏͨµÀ1ÖжϽûÖ¹ Ïà¹Øº¯Êý */
void LPTIM_IER_CC1IE_Setable(FunState NewState)
{
    if (NewState == ENABLE)
    {
        LPTIM->IER |= (LPTIM_IER_CC1IE_Msk);
    }
    else
    {
        LPTIM->IER &= ~(LPTIM_IER_CC1IE_Msk);
    }
}
 
FunState LPTIM_IER_CC1IE_Getable(void)
{
    if (LPTIM->IER & (LPTIM_IER_CC1IE_Msk))
    {
        return ENABLE;
    }
    else
    {
        return DISABLE;
    }
}
 
void LPTIM_ISR_CAP4OVR_Clr(void)
{
    LPTIM->ISR = LPTIM_ISR_CAP4OVR_Msk;
}
 
FlagStatus LPTIM_ISR_CAP4OVR_Chk(void)
{
    if (LPTIM->ISR & LPTIM_ISR_CAP4OVR_Msk)
    {
        return SET;
    }
    else
    {
        return RESET;
    }
}
 
void LPTIM_ISR_CAP3OVR_Clr(void)
{
    LPTIM->ISR = LPTIM_ISR_CAP3OVR_Msk;
}
 
FlagStatus LPTIM_ISR_CAP3OVR_Chk(void)
{
    if (LPTIM->ISR & LPTIM_ISR_CAP3OVR_Msk)
    {
        return SET;
    }
    else
    {
        return RESET;
    }
}
 
void LPTIM_ISR_CAP2OVR_Clr(void)
{
    LPTIM->ISR = LPTIM_ISR_CAP2OVR_Msk;
}
 
FlagStatus LPTIM_ISR_CAP2OVR_Chk(void)
{
    if (LPTIM->ISR & LPTIM_ISR_CAP2OVR_Msk)
    {
        return SET;
    }
    else
    {
        return RESET;
    }
}
 
void LPTIM_ISR_CAP1OVR_Clr(void)
{
    LPTIM->ISR = LPTIM_ISR_CAP1OVR_Msk;
}
 
FlagStatus LPTIM_ISR_CAP1OVR_Chk(void)
{
    if (LPTIM->ISR & LPTIM_ISR_CAP1OVR_Msk)
    {
        return SET;
    }
    else
    {
        return RESET;
    }
}
 
void LPTIM_ISR_TRIGIF_Clr(void)
{
    LPTIM->ISR = LPTIM_ISR_TRIGIF_Msk;
}
 
FlagStatus LPTIM_ISR_TRIGIF_Chk(void)
{
    if (LPTIM->ISR & LPTIM_ISR_TRIGIF_Msk)
    {
        return SET;
    }
    else
    {
        return RESET;
    }
}
 
void LPTIM_ISR_OVIF_Clr(void)
{
    LPTIM->ISR = LPTIM_ISR_OVIF_Msk;
}
 
FlagStatus LPTIM_ISR_OVIF_Chk(void)
{
    if (LPTIM->ISR & LPTIM_ISR_OVIF_Msk)
    {
        return SET;
    }
    else
    {
        return RESET;
    }
}
 
void LPTIM_ISR_CC4IF_Clr(void)
{
    LPTIM->ISR = LPTIM_ISR_CC4IF_Msk;
}
 
FlagStatus LPTIM_ISR_CC4IF_Chk(void)
{
    if (LPTIM->ISR & LPTIM_ISR_CC4IF_Msk)
    {
        return SET;
    }
    else
    {
        return RESET;
    }
}
 
void LPTIM_ISR_CC3IF_Clr(void)
{
    LPTIM->ISR = LPTIM_ISR_CC3IF_Msk;
}
 
FlagStatus LPTIM_ISR_CC3IF_Chk(void)
{
    if (LPTIM->ISR & LPTIM_ISR_CC3IF_Msk)
    {
        return SET;
    }
    else
    {
        return RESET;
    }
}
 
void LPTIM_ISR_CC2IF_Clr(void)
{
    LPTIM->ISR = LPTIM_ISR_CC2IF_Msk;
}
 
FlagStatus LPTIM_ISR_CC2IF_Chk(void)
{
    if (LPTIM->ISR & LPTIM_ISR_CC2IF_Msk)
    {
        return SET;
    }
    else
    {
        return RESET;
    }
}
 
void LPTIM_ISR_CC1IF_Clr(void)
{
    LPTIM->ISR = LPTIM_ISR_CC1IF_Msk;
}
 
FlagStatus LPTIM_ISR_CC1IF_Chk(void)
{
    if (LPTIM->ISR & LPTIM_ISR_CC1IF_Msk)
    {
        return SET;
    }
    else
    {
        return RESET;
    }
}
 
/* LPTIMʹÄÜλ(LPTIM Enable)
1£ºÊ¹ÄܼÆÊýÆ÷¼ÆÊý
0£º½ûÖ¹¼ÆÊýÆ÷¼ÆÊý Ïà¹Øº¯Êý */
void LPTIM_CR_EN_Setable(FunState NewState)
{
    if (NewState == ENABLE)
    {
        LPTIM->CR |= (LPTIM_CR_EN_Msk);
    }
    else
    {
        LPTIM->CR &= ~(LPTIM_CR_EN_Msk);
    }
}
 
FunState LPTIM_CR_EN_Getable(void)
{
    if (LPTIM->CR & (LPTIM_CR_EN_Msk))
    {
        return ENABLE;
    }
    else
    {
        return DISABLE;
    }
}
 
/* ²¶×½/±È½ÏÖµ¼Ä´æÆ÷1 (Channel1 Capture/Compare Register) Ïà¹Øº¯Êý */
void LPTIM_CCR1_Write(uint32_t SetValue)
{
    LPTIM->CCR1 = (SetValue);
}
 
uint32_t LPTIM_CCR1_Read(void)
{
    return (LPTIM->CCR1);
}
 
/* ²¶×½/±È½ÏÖµ¼Ä´æÆ÷2 (Channel2 Capture/Compare Register) Ïà¹Øº¯Êý */
void LPTIM_CCR2_Write(uint32_t SetValue)
{
    LPTIM->CCR2 = (SetValue);
}
 
uint32_t LPTIM_CCR2_Read(void)
{
    return (LPTIM->CCR2);
}
 
/* ²¶×½/±È½ÏÖµ¼Ä´æÆ÷3 (Channel3 Capture/Compare Register) Ïà¹Øº¯Êý */
void LPTIM_CCR3_Write(uint32_t SetValue)
{
    LPTIM->CCR3 = (SetValue);
}
 
uint32_t LPTIM_CCR3_Read(void)
{
    return (LPTIM->CCR3);
}
 
/* ²¶×½/±È½ÏÖµ¼Ä´æÆ÷4 (Channel4 Capture/Compare Register) Ïà¹Øº¯Êý */
void LPTIM_CCR4_Write(uint32_t SetValue)
{
    LPTIM->CCR4 = (SetValue);
}
 
uint32_t LPTIM_CCR4_Read(void)
{
    return (LPTIM->CCR4);
}
 
void LPTIM_Deinit(void)
{
    //LPTIM->CFGR = 0x00000000;
    //LPTIM->CNTR = 0x00000000;
    //LPTIM->CCSR = ;
    //LPTIM->ARR = 0x00000000;
    //LPTIM->IER = 0x00000000;
    //LPTIM->ISR = ;
    //LPTIM->CR = 0x00000000;
    //LPTIM->CCR1 = 0x00000000;
}
 
/******END OF FILE****/