|  | Dual Active Bridge Development Board (Part-No. ) |
Content |  |  |  |  |  |

Loading...
Searching...
No Matches
pwm.h
Go to the documentation of this file.
1
17/*
18© [2024] Microchip Technology Inc. and its subsidiaries.
19
20 Subject to your compliance with these terms, you may use Microchip
21 software and any derivatives exclusively with Microchip products.
22 You are responsible for complying with 3rd party license terms
23 applicable to your use of 3rd party software (including open source
24 software) that may accompany Microchip software. SOFTWARE IS ?AS IS.?
25 NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, APPLY TO THIS
26 SOFTWARE, INCLUDING ANY IMPLIED WARRANTIES OF NON-INFRINGEMENT,
27 MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT
28 WILL MICROCHIP BE LIABLE FOR ANY INDIRECT, SPECIAL, PUNITIVE,
29 INCIDENTAL OR CONSEQUENTIAL LOSS, DAMAGE, COST OR EXPENSE OF ANY
30 KIND WHATSOEVER RELATED TO THE SOFTWARE, HOWEVER CAUSED, EVEN IF
31 MICROCHIP HAS BEEN ADVISED OF THE POSSIBILITY OR THE DAMAGES ARE
32 FORESEEABLE. TO THE FULLEST EXTENT ALLOWED BY LAW, MICROCHIP?S
33 TOTAL LIABILITY ON ALL CLAIMS RELATED TO THE SOFTWARE WILL NOT
34 EXCEED AMOUNT OF FEES, IF ANY, YOU PAID DIRECTLY TO MICROCHIP FOR
35 THIS SOFTWARE.
36*/
37
38#ifndef PWM_H
39#define PWM_H
40
41// Section: Included Files
42
43#include <xc.h>
44#include <stdint.h>
45#include <stdbool.h>
46#include <stdlib.h>
47#include "pwm_hs_types.h"
48#include "pwm_hs_interface.h"
49
50// Section: Data Type Definitions
51
52
63extern const struct PWM_HS_INTERFACE PWM_HS;
64
69#define PWM_HS_Initialize PWM_Initialize
74#define PWM_HS_Deinitialize PWM_Deinitialize
79#define PWM_HS_Disable PWM_Disable
84#define PWM_HS_Enable PWM_Enable
89#define PWM_HS_MasterPeriodSet PWM_MasterPeriodSet
94#define PWM_HS_MasterDutyCycleSet PWM_MasterDutyCycleSet
99#define PWM_HS_MasterPhaseSet PWM_MasterPhaseSet
104#define PWM_HS_PeriodSet PWM_PeriodSet
109#define PWM_HS_ModeSet PWM_ModeSet
114#define PWM_HS_DutyCycleSet PWM_DutyCycleSet
119#define PWM_HS_PhaseSelect PWM_PhaseSelect
124#define PWM_HS_PhaseSet PWM_PhaseSet
129#define PWM_HS_OverrideDataSet PWM_OverrideDataSet
134#define PWM_HS_OverrideDataHighSet PWM_OverrideDataHighSet
139#define PWM_HS_OverrideDataLowSet PWM_OverrideDataLowSet
144#define PWM_HS_OverrideDataGet PWM_OverrideDataGet
149#define PWM_HS_OverrideHighEnable PWM_OverrideHighEnable
154#define PWM_HS_OverrideLowEnable PWM_OverrideLowEnable
159#define PWM_HS_OverrideHighDisable PWM_OverrideHighDisable
164#define PWM_HS_OverrideLowDisable PWM_OverrideLowDisable
169#define PWM_HS_DeadTimeLowSet PWM_DeadTimeLowSet
174#define PWM_HS_DeadTimeHighSet PWM_DeadTimeHighSet
179#define PWM_HS_DeadTimeSet PWM_DeadTimeSet
184#define PWM_HS_TriggerCompareValueSet PWM_TriggerCompareValueSet
189#define PWM_HS_GeneratorInterruptEnable PWM_GeneratorInterruptEnable
194#define PWM_HS_GeneratorInterruptDisable PWM_GeneratorInterruptDisable
199#define PWM_HS_GeneratorEventStatusGet PWM_GeneratorEventStatusGet
204#define PWM_HS_GeneratorEventStatusClear PWM_GeneratorEventStatusClear
209#define PWM_HS_GeneratorDisable PWM_GeneratorDisable
214#define PWM_HS_GeneratorEnable PWM_GeneratorEnable
219#define PWM_HS_TriggerACompareValueSet PWM_TriggerACompareValueSet
224#define PWM_HS_TriggerBCompareValueSet PWM_TriggerBCompareValueSet
229#define PWM_HS_TriggerCCompareValueSet PWM_TriggerCCompareValueSet
234#define PWM_HS_SoftwareUpdateRequest PWM_SoftwareUpdateRequest
239#define PWM_HS_SoftwareUpdatePending PWM_SoftwareUpdatePending
244#define PWM_HS_FaultModeLatchClear PWM_FaultModeLatchClear
249 #define PWM_HS_Trigger1Enable PWM_Trigger1Enable
254#define PWM_HS_Trigger1Disable PWM_Trigger1Disable
259 #define PWM_HS_Trigger2Enable PWM_Trigger2Enable
264#define PWM_HS_Trigger2Disable PWM_Trigger2Disable
269#define PWM_HS_GeneratorEOCEventCallbackRegister PWM_GeneratorEOCEventCallbackRegister
270
275#define PWM_HS_GeneratorTasks PWM_GeneratorTasks
276
277// Section: PWM Module APIs
278
285void PWM_Initialize(void);
286
293void PWM_Deinitialize(void);
294
302 inline static void PWM_GeneratorEnable(enum PWM_GENERATOR genNum)
303{
304 switch(genNum) {
305 case PWM_PRI_1:
306 PG1CONLbits.ON = 1;
307 break;
308 case PWM_SEC_1:
309 PG2CONLbits.ON = 1;
310 break;
311 case PWM_PRI_2:
312 PG3CONLbits.ON = 1;
313 break;
314 case PWM_SEC_2:
315 PG4CONLbits.ON = 1;
316 break;
317 default:break;
318 }
319}
320
328 inline static void PWM_GeneratorDisable(enum PWM_GENERATOR genNum)
329{
330 switch(genNum) {
331 case PWM_PRI_1:
332 PG1CONLbits.ON = 0;
333 break;
334 case PWM_SEC_1:
335 PG2CONLbits.ON = 0;
336 break;
337 case PWM_PRI_2:
338 PG3CONLbits.ON = 0;
339 break;
340 case PWM_SEC_2:
341 PG4CONLbits.ON = 0;
342 break;
343 default:break;
344 }
345}
346
355 inline static void PWM_ModeSet(enum PWM_GENERATOR genNum, enum PWM_MODES mode)
356{
357 switch(genNum) {
358 case PWM_PRI_1:
359 PG1CONLbits.MODSEL = mode;
360 if(mode == PWM_MODE_INDEPENDENT_EDGE_DUAL_OUTPUT)
361 {
362 PG1IOCONHbits.PMOD = 0x1;
363 }
364 else
365 {
366 PG1IOCONHbits.PMOD = 0x0;
367 }
368 break;
369 case PWM_SEC_1:
370 PG2CONLbits.MODSEL = mode;
371 if(mode == PWM_MODE_INDEPENDENT_EDGE_DUAL_OUTPUT)
372 {
373 PG2IOCONHbits.PMOD = 0x1;
374 }
375 else
376 {
377 PG2IOCONHbits.PMOD = 0x0;
378 }
379 break;
380 case PWM_PRI_2:
381 PG3CONLbits.MODSEL = mode;
382 if(mode == PWM_MODE_INDEPENDENT_EDGE_DUAL_OUTPUT)
383 {
384 PG3IOCONHbits.PMOD = 0x1;
385 }
386 else
387 {
388 PG3IOCONHbits.PMOD = 0x0;
389 }
390 break;
391 case PWM_SEC_2:
392 PG4CONLbits.MODSEL = mode;
393 if(mode == PWM_MODE_INDEPENDENT_EDGE_DUAL_OUTPUT)
394 {
395 PG4IOCONHbits.PMOD = 0x1;
396 }
397 else
398 {
399 PG4IOCONHbits.PMOD = 0x0;
400 }
401 break;
402 default:break;
403 }
404}
405
412 inline static void PWM_Enable(void)
413{
414 PG1CONLbits.ON = 1;
415 PG2CONLbits.ON = 1;
416 PG3CONLbits.ON = 1;
417 PG4CONLbits.ON = 1;
418}
419
426 inline static void PWM_Disable(void)
427{
428 PG1CONLbits.ON = 0;
429 PG2CONLbits.ON = 0;
430 PG3CONLbits.ON = 0;
431 PG4CONLbits.ON = 0;
432}
433
440 inline static void PWM_MasterPeriodSet(uint16_t masterPeriod)
441{
442 MPER = masterPeriod;
443}
444
451 inline static void PWM_MasterDutyCycleSet(uint16_t masterDutyCycle)
452{
453 MDC = masterDutyCycle;
454}
455
462 inline static void PWM_MasterPhaseSet(uint16_t masterPhase)
463{
464 MPHASE = masterPhase;
465}
466
474 inline static void PWM_PeriodSet(enum PWM_GENERATOR genNum,uint16_t period)
475{
476 switch(genNum) {
477 case PWM_PRI_1:
478 PG1PER = period;
479 break;
480 case PWM_SEC_1:
481 PG2PER = period;
482 break;
483 case PWM_PRI_2:
484 PG3PER = period;
485 break;
486 case PWM_SEC_2:
487 PG4PER = period;
488 break;
489 default:break;
490 }
491}
492
500 inline static void PWM_DutyCycleSet(enum PWM_GENERATOR genNum,uint16_t dutyCycle)
501{
502 switch(genNum) {
503 case PWM_PRI_1:
504 PG1DC = dutyCycle;
505 break;
506 case PWM_SEC_1:
507 PG2DC = dutyCycle;
508 break;
509 case PWM_PRI_2:
510 PG3DC = dutyCycle;
511 break;
512 case PWM_SEC_2:
513 PG4DC = dutyCycle;
514 break;
515 default:break;
516 }
517}
518
526 inline static void PWM_PhaseSelect(enum PWM_GENERATOR genNum,enum PWM_SOURCE_SELECT source)
527{
528 switch(genNum) {
529 case PWM_PRI_1:
530 PG1CONHbits.MPHSEL = source;
531 break;
532 case PWM_SEC_1:
533 PG2CONHbits.MPHSEL = source;
534 break;
535 case PWM_PRI_2:
536 PG3CONHbits.MPHSEL = source;
537 break;
538 case PWM_SEC_2:
539 PG4CONHbits.MPHSEL = source;
540 break;
541 default:break;
542 }
543}
544
552 inline static void PWM_PhaseSet(enum PWM_GENERATOR genNum,uint16_t phase)
553{
554 switch(genNum) {
555 case PWM_PRI_1:
556 PG1PHASE = phase;
557 break;
558 case PWM_SEC_1:
559 PG2PHASE = phase;
560 break;
561 case PWM_PRI_2:
562 PG3PHASE = phase;
563 break;
564 case PWM_SEC_2:
565 PG4PHASE = phase;
566 break;
567 default:break;
568 }
569}
570
579 inline static void PWM_OverrideDataSet(enum PWM_GENERATOR genNum,uint16_t overrideData)
580{
581 switch(genNum) {
582 case PWM_PRI_1:
583 PG1IOCONLbits.OVRDAT = overrideData;
584 break;
585 case PWM_SEC_1:
586 PG2IOCONLbits.OVRDAT = overrideData;
587 break;
588 case PWM_PRI_2:
589 PG3IOCONLbits.OVRDAT = overrideData;
590 break;
591 case PWM_SEC_2:
592 PG4IOCONLbits.OVRDAT = overrideData;
593 break;
594 default:break;
595 }
596}
597
606 inline static void PWM_OverrideDataHighSet(enum PWM_GENERATOR genNum,bool overrideDataHigh)
607{
608 switch(genNum) {
609 case PWM_PRI_1:
610 PG1IOCONLbits.OVRDAT = (PG1IOCONLbits.OVRDAT & 0x1) | ((uint8_t)overrideDataHigh << 0x1);
611 break;
612 case PWM_SEC_1:
613 PG2IOCONLbits.OVRDAT = (PG2IOCONLbits.OVRDAT & 0x1) | ((uint8_t)overrideDataHigh << 0x1);
614 break;
615 case PWM_PRI_2:
616 PG3IOCONLbits.OVRDAT = (PG3IOCONLbits.OVRDAT & 0x1) | ((uint8_t)overrideDataHigh << 0x1);
617 break;
618 case PWM_SEC_2:
619 PG4IOCONLbits.OVRDAT = (PG4IOCONLbits.OVRDAT & 0x1) | ((uint8_t)overrideDataHigh << 0x1);
620 break;
621 default:break;
622 }
623}
624
633 inline static void PWM_OverrideDataLowSet(enum PWM_GENERATOR genNum,bool overrideDataLow)
634{
635 switch(genNum) {
636 case PWM_PRI_1:
637 PG1IOCONLbits.OVRDAT = (PG1IOCONLbits.OVRDAT & 0x2) | overrideDataLow;
638 break;
639 case PWM_SEC_1:
640 PG2IOCONLbits.OVRDAT = (PG2IOCONLbits.OVRDAT & 0x2) | overrideDataLow;
641 break;
642 case PWM_PRI_2:
643 PG3IOCONLbits.OVRDAT = (PG3IOCONLbits.OVRDAT & 0x2) | overrideDataLow;
644 break;
645 case PWM_SEC_2:
646 PG4IOCONLbits.OVRDAT = (PG4IOCONLbits.OVRDAT & 0x2) | overrideDataLow;
647 break;
648 default:break;
649 }
650}
651
660 inline static uint16_t PWM_OverrideDataGet(enum PWM_GENERATOR genNum)
661{
662 uint16_t overrideData = 0x0U;
663 switch(genNum) {
664 case PWM_PRI_1:
665 overrideData = PG1IOCONLbits.OVRDAT;
666 break;
667 case PWM_SEC_1:
668 overrideData = PG2IOCONLbits.OVRDAT;
669 break;
670 case PWM_PRI_2:
671 overrideData = PG3IOCONLbits.OVRDAT;
672 break;
673 case PWM_SEC_2:
674 overrideData = PG4IOCONLbits.OVRDAT;
675 break;
676 default:break;
677 }
678 return overrideData;
679}
680
688 inline static void PWM_OverrideHighEnable(enum PWM_GENERATOR genNum)
689{
690 switch(genNum) {
691 case PWM_PRI_1:
692 PG1IOCONLbits.OVRENH = 1;
693 break;
694 case PWM_SEC_1:
695 PG2IOCONLbits.OVRENH = 1;
696 break;
697 case PWM_PRI_2:
698 PG3IOCONLbits.OVRENH = 1;
699 break;
700 case PWM_SEC_2:
701 PG4IOCONLbits.OVRENH = 1;
702 break;
703 default:break;
704 }
705}
706
714 inline static void PWM_OverrideLowEnable(enum PWM_GENERATOR genNum)
715{
716 switch(genNum) {
717 case PWM_PRI_1:
718 PG1IOCONLbits.OVRENL = 1;
719 break;
720 case PWM_SEC_1:
721 PG2IOCONLbits.OVRENL = 1;
722 break;
723 case PWM_PRI_2:
724 PG3IOCONLbits.OVRENL = 1;
725 break;
726 case PWM_SEC_2:
727 PG4IOCONLbits.OVRENL = 1;
728 break;
729 default:break;
730 }
731}
732
740 inline static void PWM_OverrideHighDisable(enum PWM_GENERATOR genNum)
741{
742 switch(genNum) {
743 case PWM_PRI_1:
744 PG1IOCONLbits.OVRENH = 0;
745 break;
746 case PWM_SEC_1:
747 PG2IOCONLbits.OVRENH = 0;
748 break;
749 case PWM_PRI_2:
750 PG3IOCONLbits.OVRENH = 0;
751 break;
752 case PWM_SEC_2:
753 PG4IOCONLbits.OVRENH = 0;
754 break;
755 default:break;
756 }
757}
758
766 inline static void PWM_OverrideLowDisable(enum PWM_GENERATOR genNum)
767{
768 switch(genNum) {
769 case PWM_PRI_1:
770 PG1IOCONLbits.OVRENL = 0;
771 break;
772 case PWM_SEC_1:
773 PG2IOCONLbits.OVRENL = 0;
774 break;
775 case PWM_PRI_2:
776 PG3IOCONLbits.OVRENL = 0;
777 break;
778 case PWM_SEC_2:
779 PG4IOCONLbits.OVRENL = 0;
780 break;
781 default:break;
782 }
783}
784
793 inline static void PWM_DeadTimeLowSet(enum PWM_GENERATOR genNum,uint16_t deadtimeLow)
794{
795 switch(genNum) {
796 case PWM_PRI_1:
797 PG1DTL = deadtimeLow;
798 break;
799 case PWM_SEC_1:
800 PG2DTL = deadtimeLow;
801 break;
802 case PWM_PRI_2:
803 PG3DTL = deadtimeLow;
804 break;
805 case PWM_SEC_2:
806 PG4DTL = deadtimeLow;
807 break;
808 default:break;
809 }
810}
811
820 inline static void PWM_DeadTimeHighSet(enum PWM_GENERATOR genNum,uint16_t deadtimeHigh)
821{
822 switch(genNum) {
823 case PWM_PRI_1:
824 PG1DTH = deadtimeHigh;
825 break;
826 case PWM_SEC_1:
827 PG2DTH = deadtimeHigh;
828 break;
829 case PWM_PRI_2:
830 PG3DTH = deadtimeHigh;
831 break;
832 case PWM_SEC_2:
833 PG4DTH = deadtimeHigh;
834 break;
835 default:break;
836 }
837}
838
847 inline static void PWM_DeadTimeSet(enum PWM_GENERATOR genNum,uint16_t deadtime)
848{
849 switch(genNum) {
850 case PWM_PRI_1:
851 PG1DTL = deadtime;
852 PG1DTH = deadtime;
853 break;
854 case PWM_SEC_1:
855 PG2DTL = deadtime;
856 PG2DTH = deadtime;
857 break;
858 case PWM_PRI_2:
859 PG3DTL = deadtime;
860 PG3DTH = deadtime;
861 break;
862 case PWM_SEC_2:
863 PG4DTL = deadtime;
864 PG4DTH = deadtime;
865 break;
866 default:break;
867 }
868}
869
878 inline static void PWM_TriggerCompareValueSet(enum PWM_GENERATOR genNum,uint16_t trigCompValue)
879{
880 switch(genNum) {
881 case PWM_PRI_1:
882 PG1TRIGA = trigCompValue;
883 break;
884 case PWM_SEC_1:
885 PG2TRIGA = trigCompValue;
886 break;
887 case PWM_PRI_2:
888 PG3TRIGA = trigCompValue;
889 break;
890 case PWM_SEC_2:
891 PG4TRIGA = trigCompValue;
892 break;
893 default:break;
894 }
895}
896
905 inline static void PWM_GeneratorInterruptEnable(enum PWM_GENERATOR genNum, enum PWM_GENERATOR_INTERRUPT interrupt)
906{
907 switch(genNum) {
908 case PWM_PRI_1:
909 switch(interrupt) {
910 case PWM_GENERATOR_INTERRUPT_FAULT:
911 PG1EVTHbits.FLTIEN = true;
912 break;
913 case PWM_GENERATOR_INTERRUPT_CURRENT_LIMIT:
914 PG1EVTHbits.CLIEN = true;
915 break;
916 case PWM_GENERATOR_INTERRUPT_FEED_FORWARD:
917 PG1EVTHbits.FFIEN = true;
918 break;
919 case PWM_GENERATOR_INTERRUPT_SYNC:
920 PG1EVTHbits.SIEN = true;
921 break;
922 default:break;
923 }
924 break;
925 case PWM_SEC_1:
926 switch(interrupt) {
927 case PWM_GENERATOR_INTERRUPT_FAULT:
928 PG2EVTHbits.FLTIEN = true;
929 break;
930 case PWM_GENERATOR_INTERRUPT_CURRENT_LIMIT:
931 PG2EVTHbits.CLIEN = true;
932 break;
933 case PWM_GENERATOR_INTERRUPT_FEED_FORWARD:
934 PG2EVTHbits.FFIEN = true;
935 break;
936 case PWM_GENERATOR_INTERRUPT_SYNC:
937 PG2EVTHbits.SIEN = true;
938 break;
939 default:break;
940 }
941 break;
942 case PWM_PRI_2:
943 switch(interrupt) {
944 case PWM_GENERATOR_INTERRUPT_FAULT:
945 PG3EVTHbits.FLTIEN = true;
946 break;
947 case PWM_GENERATOR_INTERRUPT_CURRENT_LIMIT:
948 PG3EVTHbits.CLIEN = true;
949 break;
950 case PWM_GENERATOR_INTERRUPT_FEED_FORWARD:
951 PG3EVTHbits.FFIEN = true;
952 break;
953 case PWM_GENERATOR_INTERRUPT_SYNC:
954 PG3EVTHbits.SIEN = true;
955 break;
956 default:break;
957 }
958 break;
959 case PWM_SEC_2:
960 switch(interrupt) {
961 case PWM_GENERATOR_INTERRUPT_FAULT:
962 PG4EVTHbits.FLTIEN = true;
963 break;
964 case PWM_GENERATOR_INTERRUPT_CURRENT_LIMIT:
965 PG4EVTHbits.CLIEN = true;
966 break;
967 case PWM_GENERATOR_INTERRUPT_FEED_FORWARD:
968 PG4EVTHbits.FFIEN = true;
969 break;
970 case PWM_GENERATOR_INTERRUPT_SYNC:
971 PG4EVTHbits.SIEN = true;
972 break;
973 default:break;
974 }
975 break;
976 default:break;
977 }
978}
979
988 inline static void PWM_GeneratorInterruptDisable(enum PWM_GENERATOR genNum, enum PWM_GENERATOR_INTERRUPT interrupt)
989{
990 switch(genNum) {
991 case PWM_PRI_1:
992 switch(interrupt) {
993 case PWM_GENERATOR_INTERRUPT_FAULT:
994 PG1EVTHbits.FLTIEN = false;
995 break;
996 case PWM_GENERATOR_INTERRUPT_CURRENT_LIMIT:
997 PG1EVTHbits.CLIEN = false;
998 break;
999 case PWM_GENERATOR_INTERRUPT_FEED_FORWARD:
1000 PG1EVTHbits.FFIEN = false;
1001 break;
1002 case PWM_GENERATOR_INTERRUPT_SYNC:
1003 PG1EVTHbits.SIEN = false;
1004 break;
1005 default:break;
1006 }
1007 break;
1008 case PWM_SEC_1:
1009 switch(interrupt) {
1010 case PWM_GENERATOR_INTERRUPT_FAULT:
1011 PG2EVTHbits.FLTIEN = false;
1012 break;
1013 case PWM_GENERATOR_INTERRUPT_CURRENT_LIMIT:
1014 PG2EVTHbits.CLIEN = false;
1015 break;
1016 case PWM_GENERATOR_INTERRUPT_FEED_FORWARD:
1017 PG2EVTHbits.FFIEN = false;
1018 break;
1019 case PWM_GENERATOR_INTERRUPT_SYNC:
1020 PG2EVTHbits.SIEN = false;
1021 break;
1022 default:break;
1023 }
1024 break;
1025 case PWM_PRI_2:
1026 switch(interrupt) {
1027 case PWM_GENERATOR_INTERRUPT_FAULT:
1028 PG3EVTHbits.FLTIEN = false;
1029 break;
1030 case PWM_GENERATOR_INTERRUPT_CURRENT_LIMIT:
1031 PG3EVTHbits.CLIEN = false;
1032 break;
1033 case PWM_GENERATOR_INTERRUPT_FEED_FORWARD:
1034 PG3EVTHbits.FFIEN = false;
1035 break;
1036 case PWM_GENERATOR_INTERRUPT_SYNC:
1037 PG3EVTHbits.SIEN = false;
1038 break;
1039 default:break;
1040 }
1041 break;
1042 case PWM_SEC_2:
1043 switch(interrupt) {
1044 case PWM_GENERATOR_INTERRUPT_FAULT:
1045 PG4EVTHbits.FLTIEN = false;
1046 break;
1047 case PWM_GENERATOR_INTERRUPT_CURRENT_LIMIT:
1048 PG4EVTHbits.CLIEN = false;
1049 break;
1050 case PWM_GENERATOR_INTERRUPT_FEED_FORWARD:
1051 PG4EVTHbits.FFIEN = false;
1052 break;
1053 case PWM_GENERATOR_INTERRUPT_SYNC:
1054 PG4EVTHbits.SIEN = false;
1055 break;
1056 default:break;
1057 }
1058 break;
1059 default:break;
1060 }
1061}
1062
1071 inline static void PWM_GeneratorEventStatusClear(enum PWM_GENERATOR genNum, enum PWM_GENERATOR_INTERRUPT interrupt)
1072{
1073 switch(genNum) {
1074 case PWM_PRI_1:
1075 switch(interrupt) {
1076 case PWM_GENERATOR_INTERRUPT_FAULT:
1077 PG1STATbits.FLTEVT = 0;
1078 break;
1079 case PWM_GENERATOR_INTERRUPT_CURRENT_LIMIT:
1080 PG1STATbits.CLEVT = 0;
1081 break;
1082 case PWM_GENERATOR_INTERRUPT_FEED_FORWARD:
1083 PG1STATbits.FFEVT = 0;
1084 break;
1085 case PWM_GENERATOR_INTERRUPT_SYNC:
1086 PG1STATbits.SEVT = 0;
1087 break;
1088 default:break;
1089 }
1090 break;
1091 case PWM_SEC_1:
1092 switch(interrupt) {
1093 case PWM_GENERATOR_INTERRUPT_FAULT:
1094 PG2STATbits.FLTEVT = 0;
1095 break;
1096 case PWM_GENERATOR_INTERRUPT_CURRENT_LIMIT:
1097 PG2STATbits.CLEVT = 0;
1098 break;
1099 case PWM_GENERATOR_INTERRUPT_FEED_FORWARD:
1100 PG2STATbits.FFEVT = 0;
1101 break;
1102 case PWM_GENERATOR_INTERRUPT_SYNC:
1103 PG2STATbits.SEVT = 0;
1104 break;
1105 default:break;
1106 }
1107 break;
1108 case PWM_PRI_2:
1109 switch(interrupt) {
1110 case PWM_GENERATOR_INTERRUPT_FAULT:
1111 PG3STATbits.FLTEVT = 0;
1112 break;
1113 case PWM_GENERATOR_INTERRUPT_CURRENT_LIMIT:
1114 PG3STATbits.CLEVT = 0;
1115 break;
1116 case PWM_GENERATOR_INTERRUPT_FEED_FORWARD:
1117 PG3STATbits.FFEVT = 0;
1118 break;
1119 case PWM_GENERATOR_INTERRUPT_SYNC:
1120 PG3STATbits.SEVT = 0;
1121 break;
1122 default:break;
1123 }
1124 break;
1125 case PWM_SEC_2:
1126 switch(interrupt) {
1127 case PWM_GENERATOR_INTERRUPT_FAULT:
1128 PG4STATbits.FLTEVT = 0;
1129 break;
1130 case PWM_GENERATOR_INTERRUPT_CURRENT_LIMIT:
1131 PG4STATbits.CLEVT = 0;
1132 break;
1133 case PWM_GENERATOR_INTERRUPT_FEED_FORWARD:
1134 PG4STATbits.FFEVT = 0;
1135 break;
1136 case PWM_GENERATOR_INTERRUPT_SYNC:
1137 PG4STATbits.SEVT = 0;
1138 break;
1139 default:break;
1140 }
1141 break;
1142 default:break;
1143 }
1144}
1145
1155 inline static bool PWM_GeneratorEventStatusGet(enum PWM_GENERATOR genNum, enum PWM_GENERATOR_INTERRUPT interrupt)
1156{
1157 bool status = false;
1158 switch(genNum) {
1159 case PWM_PRI_1:
1160 switch(interrupt) {
1161 case PWM_GENERATOR_INTERRUPT_FAULT:
1162 status = PG1STATbits.FLTEVT;
1163 break;
1164 case PWM_GENERATOR_INTERRUPT_CURRENT_LIMIT:
1165 status = PG1STATbits.CLEVT;
1166 break;
1167 case PWM_GENERATOR_INTERRUPT_FEED_FORWARD:
1168 status = PG1STATbits.FFEVT;
1169 break;
1170 case PWM_GENERATOR_INTERRUPT_SYNC:
1171 status = PG1STATbits.SEVT;
1172 break;
1173 default:break;
1174 }
1175 break;
1176 case PWM_SEC_1:
1177 switch(interrupt) {
1178 case PWM_GENERATOR_INTERRUPT_FAULT:
1179 status = PG2STATbits.FLTEVT;
1180 break;
1181 case PWM_GENERATOR_INTERRUPT_CURRENT_LIMIT:
1182 status = PG2STATbits.CLEVT;
1183 break;
1184 case PWM_GENERATOR_INTERRUPT_FEED_FORWARD:
1185 status = PG2STATbits.FFEVT;
1186 break;
1187 case PWM_GENERATOR_INTERRUPT_SYNC:
1188 status = PG2STATbits.SEVT;
1189 break;
1190 default:break;
1191 }
1192 break;
1193 case PWM_PRI_2:
1194 switch(interrupt) {
1195 case PWM_GENERATOR_INTERRUPT_FAULT:
1196 status = PG3STATbits.FLTEVT;
1197 break;
1198 case PWM_GENERATOR_INTERRUPT_CURRENT_LIMIT:
1199 status = PG3STATbits.CLEVT;
1200 break;
1201 case PWM_GENERATOR_INTERRUPT_FEED_FORWARD:
1202 status = PG3STATbits.FFEVT;
1203 break;
1204 case PWM_GENERATOR_INTERRUPT_SYNC:
1205 status = PG3STATbits.SEVT;
1206 break;
1207 default:break;
1208 }
1209 break;
1210 case PWM_SEC_2:
1211 switch(interrupt) {
1212 case PWM_GENERATOR_INTERRUPT_FAULT:
1213 status = PG4STATbits.FLTEVT;
1214 break;
1215 case PWM_GENERATOR_INTERRUPT_CURRENT_LIMIT:
1216 status = PG4STATbits.CLEVT;
1217 break;
1218 case PWM_GENERATOR_INTERRUPT_FEED_FORWARD:
1219 status = PG4STATbits.FFEVT;
1220 break;
1221 case PWM_GENERATOR_INTERRUPT_SYNC:
1222 status = PG4STATbits.SEVT;
1223 break;
1224 default:break;
1225 }
1226 break;
1227 default:break;
1228 }
1229 return status;
1230}
1231
1239 inline static void PWM_SoftwareUpdateRequest(enum PWM_GENERATOR genNum)
1240{
1241 switch(genNum) {
1242 case PWM_PRI_1:
1243 PG1STATbits.UPDREQ = 1;
1244 break;
1245 case PWM_SEC_1:
1246 PG2STATbits.UPDREQ = 1;
1247 break;
1248 case PWM_PRI_2:
1249 PG3STATbits.UPDREQ = 1;
1250 break;
1251 case PWM_SEC_2:
1252 PG4STATbits.UPDREQ = 1;
1253 break;
1254 default:break;
1255 }
1256
1257}
1258
1267 inline static bool PWM_SoftwareUpdatePending(enum PWM_GENERATOR genNum)
1268{
1269 bool status = false;
1270 switch(genNum) {
1271 case PWM_PRI_1:
1272 status = PG1STATbits.UPDATE;
1273 break;
1274 case PWM_SEC_1:
1275 status = PG2STATbits.UPDATE;
1276 break;
1277 case PWM_PRI_2:
1278 status = PG3STATbits.UPDATE;
1279 break;
1280 case PWM_SEC_2:
1281 status = PG4STATbits.UPDATE;
1282 break;
1283 default:break;
1284 }
1285 return status;
1286}
1287
1296 inline static void PWM_TriggerACompareValueSet(enum PWM_GENERATOR genNum,uint16_t trigA)
1297{
1298 switch(genNum) {
1299 case PWM_PRI_1:
1300 PG1TRIGA = trigA;
1301 break;
1302 case PWM_SEC_1:
1303 PG2TRIGA = trigA;
1304 break;
1305 case PWM_PRI_2:
1306 PG3TRIGA = trigA;
1307 break;
1308 case PWM_SEC_2:
1309 PG4TRIGA = trigA;
1310 break;
1311 default:break;
1312 }
1313}
1314
1323 inline static void PWM_TriggerBCompareValueSet(enum PWM_GENERATOR genNum,uint16_t trigB)
1324{
1325 switch(genNum) {
1326 case PWM_PRI_1:
1327 PG1TRIGB = trigB;
1328 break;
1329 case PWM_SEC_1:
1330 PG2TRIGB = trigB;
1331 break;
1332 case PWM_PRI_2:
1333 PG3TRIGB = trigB;
1334 break;
1335 case PWM_SEC_2:
1336 PG4TRIGB = trigB;
1337 break;
1338 default:break;
1339 }
1340}
1341
1350 inline static void PWM_TriggerCCompareValueSet(enum PWM_GENERATOR genNum,uint16_t trigC)
1351{
1352 switch(genNum) {
1353 case PWM_PRI_1:
1354 PG1TRIGC = trigC;
1355 break;
1356 case PWM_SEC_1:
1357 PG2TRIGC = trigC;
1358 break;
1359 case PWM_PRI_2:
1360 PG3TRIGC = trigC;
1361 break;
1362 case PWM_SEC_2:
1363 PG4TRIGC = trigC;
1364 break;
1365 default:break;
1366 }
1367}
1368
1380 inline static void PWM_Trigger1Enable(enum PWM_GENERATOR genNum, enum PWM_TRIGGER_COMPARE compareRegister)
1381{
1382 switch(genNum) {
1383 case PWM_PRI_1:
1384 switch(compareRegister) {
1385 case PWM_TRIGGER_COMPARE_A:
1386 PG1EVTLbits.ADTR1EN1 = 1;
1387 break;
1388 case PWM_TRIGGER_COMPARE_B:
1389 PG1EVTLbits.ADTR1EN2 = 1;
1390 break;
1391 case PWM_TRIGGER_COMPARE_C:
1392 PG1EVTLbits.ADTR1EN3 = 1;
1393 break;
1394 default:break;
1395 }
1396 break;
1397 case PWM_SEC_1:
1398 switch(compareRegister) {
1399 case PWM_TRIGGER_COMPARE_A:
1400 PG2EVTLbits.ADTR1EN1 = 1;
1401 break;
1402 case PWM_TRIGGER_COMPARE_B:
1403 PG2EVTLbits.ADTR1EN2 = 1;
1404 break;
1405 case PWM_TRIGGER_COMPARE_C:
1406 PG2EVTLbits.ADTR1EN3 = 1;
1407 break;
1408 default:break;
1409 }
1410 break;
1411 case PWM_PRI_2:
1412 switch(compareRegister) {
1413 case PWM_TRIGGER_COMPARE_A:
1414 PG3EVTLbits.ADTR1EN1 = 1;
1415 break;
1416 case PWM_TRIGGER_COMPARE_B:
1417 PG3EVTLbits.ADTR1EN2 = 1;
1418 break;
1419 case PWM_TRIGGER_COMPARE_C:
1420 PG3EVTLbits.ADTR1EN3 = 1;
1421 break;
1422 default:break;
1423 }
1424 break;
1425 case PWM_SEC_2:
1426 switch(compareRegister) {
1427 case PWM_TRIGGER_COMPARE_A:
1428 PG4EVTLbits.ADTR1EN1 = 1;
1429 break;
1430 case PWM_TRIGGER_COMPARE_B:
1431 PG4EVTLbits.ADTR1EN2 = 1;
1432 break;
1433 case PWM_TRIGGER_COMPARE_C:
1434 PG4EVTLbits.ADTR1EN3 = 1;
1435 break;
1436 default:break;
1437 }
1438 break;
1439 default:break;
1440 }
1441
1442}
1443
1452 inline static void PWM_Trigger1Disable(enum PWM_GENERATOR genNum, enum PWM_TRIGGER_COMPARE compareRegister)
1453{
1454 switch(genNum) {
1455 case PWM_PRI_1:
1456 switch(compareRegister) {
1457 case PWM_TRIGGER_COMPARE_A:
1458 PG1EVTLbits.ADTR1EN1 = 0;
1459 break;
1460 case PWM_TRIGGER_COMPARE_B:
1461 PG1EVTLbits.ADTR1EN2 = 0;
1462 break;
1463 case PWM_TRIGGER_COMPARE_C:
1464 PG1EVTLbits.ADTR1EN3 = 0;
1465 break;
1466 default:break;
1467 }
1468 break;
1469 case PWM_SEC_1:
1470 switch(compareRegister) {
1471 case PWM_TRIGGER_COMPARE_A:
1472 PG2EVTLbits.ADTR1EN1 = 0;
1473 break;
1474 case PWM_TRIGGER_COMPARE_B:
1475 PG2EVTLbits.ADTR1EN2 = 0;
1476 break;
1477 case PWM_TRIGGER_COMPARE_C:
1478 PG2EVTLbits.ADTR1EN3 = 0;
1479 break;
1480 default:break;
1481 }
1482 break;
1483 case PWM_PRI_2:
1484 switch(compareRegister) {
1485 case PWM_TRIGGER_COMPARE_A:
1486 PG3EVTLbits.ADTR1EN1 = 0;
1487 break;
1488 case PWM_TRIGGER_COMPARE_B:
1489 PG3EVTLbits.ADTR1EN2 = 0;
1490 break;
1491 case PWM_TRIGGER_COMPARE_C:
1492 PG3EVTLbits.ADTR1EN3 = 0;
1493 break;
1494 default:break;
1495 }
1496 break;
1497 case PWM_SEC_2:
1498 switch(compareRegister) {
1499 case PWM_TRIGGER_COMPARE_A:
1500 PG4EVTLbits.ADTR1EN1 = 0;
1501 break;
1502 case PWM_TRIGGER_COMPARE_B:
1503 PG4EVTLbits.ADTR1EN2 = 0;
1504 break;
1505 case PWM_TRIGGER_COMPARE_C:
1506 PG4EVTLbits.ADTR1EN3 = 0;
1507 break;
1508 default:break;
1509 }
1510 break;
1511 default:break;
1512 }
1513
1514}
1515
1527 inline static void PWM_Trigger2Enable(enum PWM_GENERATOR genNum, enum PWM_TRIGGER_COMPARE compareRegister)
1528{
1529 switch(genNum) {
1530 case PWM_PRI_1:
1531 switch(compareRegister) {
1532 case PWM_TRIGGER_COMPARE_A:
1533 PG1EVTHbits.ADTR2EN1 = 1;
1534 break;
1535 case PWM_TRIGGER_COMPARE_B:
1536 PG1EVTHbits.ADTR2EN2 = 1;
1537 break;
1538 case PWM_TRIGGER_COMPARE_C:
1539 PG1EVTHbits.ADTR2EN3 = 1;
1540 break;
1541 default:break;
1542 }
1543 break;
1544 case PWM_SEC_1:
1545 switch(compareRegister) {
1546 case PWM_TRIGGER_COMPARE_A:
1547 PG2EVTHbits.ADTR2EN1 = 1;
1548 break;
1549 case PWM_TRIGGER_COMPARE_B:
1550 PG2EVTHbits.ADTR2EN2 = 1;
1551 break;
1552 case PWM_TRIGGER_COMPARE_C:
1553 PG2EVTHbits.ADTR2EN3 = 1;
1554 break;
1555 default:break;
1556 }
1557 break;
1558 case PWM_PRI_2:
1559 switch(compareRegister) {
1560 case PWM_TRIGGER_COMPARE_A:
1561 PG3EVTHbits.ADTR2EN1 = 1;
1562 break;
1563 case PWM_TRIGGER_COMPARE_B:
1564 PG3EVTHbits.ADTR2EN2 = 1;
1565 break;
1566 case PWM_TRIGGER_COMPARE_C:
1567 PG3EVTHbits.ADTR2EN3 = 1;
1568 break;
1569 default:break;
1570 }
1571 break;
1572 case PWM_SEC_2:
1573 switch(compareRegister) {
1574 case PWM_TRIGGER_COMPARE_A:
1575 PG4EVTHbits.ADTR2EN1 = 1;
1576 break;
1577 case PWM_TRIGGER_COMPARE_B:
1578 PG4EVTHbits.ADTR2EN2 = 1;
1579 break;
1580 case PWM_TRIGGER_COMPARE_C:
1581 PG4EVTHbits.ADTR2EN3 = 1;
1582 break;
1583 default:break;
1584 }
1585 break;
1586 default:break;
1587 }
1588
1589}
1590
1599 inline static void PWM_Trigger2Disable(enum PWM_GENERATOR genNum, enum PWM_TRIGGER_COMPARE compareRegister)
1600{
1601 switch(genNum) {
1602 case PWM_PRI_1:
1603 switch(compareRegister) {
1604 case PWM_TRIGGER_COMPARE_A:
1605 PG1EVTHbits.ADTR2EN1 = 0;
1606 break;
1607 case PWM_TRIGGER_COMPARE_B:
1608 PG1EVTHbits.ADTR2EN2 = 0;
1609 break;
1610 case PWM_TRIGGER_COMPARE_C:
1611 PG1EVTHbits.ADTR2EN3 = 0;
1612 break;
1613 default:break;
1614 }
1615 break;
1616 case PWM_SEC_1:
1617 switch(compareRegister) {
1618 case PWM_TRIGGER_COMPARE_A:
1619 PG2EVTHbits.ADTR2EN1 = 0;
1620 break;
1621 case PWM_TRIGGER_COMPARE_B:
1622 PG2EVTHbits.ADTR2EN2 = 0;
1623 break;
1624 case PWM_TRIGGER_COMPARE_C:
1625 PG2EVTHbits.ADTR2EN3 = 0;
1626 break;
1627 default:break;
1628 }
1629 break;
1630 case PWM_PRI_2:
1631 switch(compareRegister) {
1632 case PWM_TRIGGER_COMPARE_A:
1633 PG3EVTHbits.ADTR2EN1 = 0;
1634 break;
1635 case PWM_TRIGGER_COMPARE_B:
1636 PG3EVTHbits.ADTR2EN2 = 0;
1637 break;
1638 case PWM_TRIGGER_COMPARE_C:
1639 PG3EVTHbits.ADTR2EN3 = 0;
1640 break;
1641 default:break;
1642 }
1643 break;
1644 case PWM_SEC_2:
1645 switch(compareRegister) {
1646 case PWM_TRIGGER_COMPARE_A:
1647 PG4EVTHbits.ADTR2EN1 = 0;
1648 break;
1649 case PWM_TRIGGER_COMPARE_B:
1650 PG4EVTHbits.ADTR2EN2 = 0;
1651 break;
1652 case PWM_TRIGGER_COMPARE_C:
1653 PG4EVTHbits.ADTR2EN3 = 0;
1654 break;
1655 default:break;
1656 }
1657 break;
1658 default:break;
1659 }
1660
1661}
1662
1670 inline static void PWM_FaultModeLatchClear(enum PWM_GENERATOR genNum)
1671{
1672 switch(genNum) {
1673 case PWM_PRI_1:
1674 PG1FPCILbits.SWTERM = 1;
1675 break;
1676 case PWM_SEC_1:
1677 PG2FPCILbits.SWTERM = 1;
1678 break;
1679 case PWM_PRI_2:
1680 PG3FPCILbits.SWTERM = 1;
1681 break;
1682 case PWM_SEC_2:
1683 PG4FPCILbits.SWTERM = 1;
1684 break;
1685 default:break;
1686 }
1687}
1688
1697void PWM_GeneratorEOCEventCallbackRegister(void (*callback)(enum PWM_GENERATOR genNum));
1698
1707 void PWM_GeneratorEOCEventCallback(enum PWM_GENERATOR genNum);
1708
1709
1716void PWM_GeneratorTasks(enum PWM_GENERATOR intGen);
1717
1718
1719#endif //PWM_H
1720
pwm_hs_types.h
This is the generated driver types header file for the PWM driver.
PWM_GENERATOR_INTERRUPT
PWM_GENERATOR_INTERRUPT
Definition pwm_hs_types.h:68
PWM_GENERATOR_INTERRUPT_FEED_FORWARD
@ PWM_GENERATOR_INTERRUPT_FEED_FORWARD
Definition pwm_hs_types.h:71
PWM_GENERATOR_INTERRUPT_SYNC
@ PWM_GENERATOR_INTERRUPT_SYNC
Definition pwm_hs_types.h:72
PWM_GENERATOR_INTERRUPT_CURRENT_LIMIT
@ PWM_GENERATOR_INTERRUPT_CURRENT_LIMIT
Definition pwm_hs_types.h:70
PWM_GENERATOR_INTERRUPT_FAULT
@ PWM_GENERATOR_INTERRUPT_FAULT
Definition pwm_hs_types.h:69
PWM_TRIGGER_COMPARE
PWM_TRIGGER_COMPARE
Definition pwm_hs_types.h:98
PWM_TRIGGER_COMPARE_A
@ PWM_TRIGGER_COMPARE_A
Definition pwm_hs_types.h:99
PWM_TRIGGER_COMPARE_B
@ PWM_TRIGGER_COMPARE_B
Definition pwm_hs_types.h:100
PWM_TRIGGER_COMPARE_C
@ PWM_TRIGGER_COMPARE_C
Definition pwm_hs_types.h:101
PWM_MODES
PWM_MODES
Definition pwm_hs_types.h:110
PWM_MODE_INDEPENDENT_EDGE_DUAL_OUTPUT
@ PWM_MODE_INDEPENDENT_EDGE_DUAL_OUTPUT
Definition pwm_hs_types.h:113
PWM_GENERATOR
PWM_GENERATOR
Definition pwm_hs_types.h:54
PWM_SEC_1
@ PWM_SEC_1
Definition pwm_hs_types.h:56
PWM_PRI_1
@ PWM_PRI_1
Definition pwm_hs_types.h:55
PWM_SEC_2
@ PWM_SEC_2
Definition pwm_hs_types.h:58
PWM_PRI_2
@ PWM_PRI_2
Definition pwm_hs_types.h:57
PWM_SOURCE_SELECT
PWM_SOURCE_SELECT
Definition pwm_hs_types.h:126
status
size_t status
Definition uart1.c:99
PWM_Trigger2Enable
static void PWM_Trigger2Enable(enum PWM_GENERATOR genNum, enum PWM_TRIGGER_COMPARE compareRegister)
This inline function enables ADC trigger 2 for the specific compare register selected by the argument...
Definition pwm.h:1527
PWM_MasterPhaseSet
static void PWM_MasterPhaseSet(uint16_t masterPhase)
This inline function sets the phase value in count for the Master Time Base generator.
Definition pwm.h:462
PWM_GeneratorInterruptDisable
static void PWM_GeneratorInterruptDisable(enum PWM_GENERATOR genNum, enum PWM_GENERATOR_INTERRUPT interrupt)
This inline function disables interrupt requests for the PWM Generator selected by the argument PWM_G...
Definition pwm.h:988
PWM_DeadTimeLowSet
static void PWM_DeadTimeLowSet(enum PWM_GENERATOR genNum, uint16_t deadtimeLow)
This inline function updates PWM Deadtime low register with the requested value for a specific PWM ge...
Definition pwm.h:793
PWM_OverrideDataHighSet
static void PWM_OverrideDataHighSet(enum PWM_GENERATOR genNum, bool overrideDataHigh)
This inline function updates PWM override high data bit with the requested value for a specific PWM g...
Definition pwm.h:606
PWM_Trigger1Disable
static void PWM_Trigger1Disable(enum PWM_GENERATOR genNum, enum PWM_TRIGGER_COMPARE compareRegister)
This inline function disables ADC trigger 1 for the specific compare register selected by the argumen...
Definition pwm.h:1452
PWM_OverrideDataGet
static uint16_t PWM_OverrideDataGet(enum PWM_GENERATOR genNum)
This inline function gets PWM override value for the PWM Generator selected by the argument PWM_GENER...
Definition pwm.h:660
PWM_OverrideLowEnable
static void PWM_OverrideLowEnable(enum PWM_GENERATOR genNum)
This inline function enables PWM override on PWML output for specific PWM generator selected by the a...
Definition pwm.h:714
PWM_HS
const struct PWM_HS_INTERFACE PWM_HS
Structure object of type PWM_HS_INTERFACE with the custom name given by the user in the Melody Driver...
Definition pwm.c:50
PWM_Initialize
void PWM_Initialize(void)
Initializes PWM module, using the given initialization data.
Definition pwm.c:108
PWM_MasterPeriodSet
static void PWM_MasterPeriodSet(uint16_t masterPeriod)
This inline function sets the period value in count for the Master Time Base generator.
Definition pwm.h:440
PWM_TriggerACompareValueSet
static void PWM_TriggerACompareValueSet(enum PWM_GENERATOR genNum, uint16_t trigA)
This inline function sets the Trigger A compare value in count for a specific PWM generator selected ...
Definition pwm.h:1296
PWM_TriggerBCompareValueSet
static void PWM_TriggerBCompareValueSet(enum PWM_GENERATOR genNum, uint16_t trigB)
This inline function sets the Trigger B compare value in count for a specific PWM generator selected ...
Definition pwm.h:1323
PWM_DutyCycleSet
static void PWM_DutyCycleSet(enum PWM_GENERATOR genNum, uint16_t dutyCycle)
This inline function sets the PWM generator specific duty cycle register.
Definition pwm.h:500
PWM_GeneratorEOCEventCallback
void PWM_GeneratorEOCEventCallback(enum PWM_GENERATOR genNum)
This is the default callback with weak attribute. The user can override and implement the default cal...
PWM_Deinitialize
void PWM_Deinitialize(void)
Deinitializes the PWM to POR values.
Definition pwm.c:375
PWM_TriggerCompareValueSet
static void PWM_TriggerCompareValueSet(enum PWM_GENERATOR genNum, uint16_t trigCompValue)
This inline function sets the PWM trigger compare value in count for the PWM Generator selected by th...
Definition pwm.h:878
PWM_OverrideHighEnable
static void PWM_OverrideHighEnable(enum PWM_GENERATOR genNum)
This inline function enables PWM override on PWMH output for specific PWM generator selected by the a...
Definition pwm.h:688
PWM_GeneratorDisable
static void PWM_GeneratorDisable(enum PWM_GENERATOR genNum)
This inline function disables the specific PWM generator selected by the argument PWM_GENERATOR.
Definition pwm.h:328
PWM_Disable
static void PWM_Disable(void)
This inline function will disable all the generators of PWM module.
Definition pwm.h:426
PWM_PhaseSet
static void PWM_PhaseSet(enum PWM_GENERATOR genNum, uint16_t phase)
This inline function sets the phase value in count for the PWM generator specific Time Base.
Definition pwm.h:552
PWM_GeneratorEventStatusGet
static bool PWM_GeneratorEventStatusGet(enum PWM_GENERATOR genNum, enum PWM_GENERATOR_INTERRUPT interrupt)
This inline function gets the PWM interrupt status for the PWM Generator selected by the argument PWM...
Definition pwm.h:1155
PWM_FaultModeLatchClear
static void PWM_FaultModeLatchClear(enum PWM_GENERATOR genNum)
This inline function clears the status of PWM latched fault mode for the PWM Generator selected by th...
Definition pwm.h:1670
PWM_ModeSet
static void PWM_ModeSet(enum PWM_GENERATOR genNum, enum PWM_MODES mode)
This inline function sets the operating mode of specific PWM generator selected by the argument PWM...
Definition pwm.h:355
PWM_SoftwareUpdateRequest
static void PWM_SoftwareUpdateRequest(enum PWM_GENERATOR genNum)
This inline function requests to update the data registers for specific PWM generator selected by the...
Definition pwm.h:1239
PWM_MasterDutyCycleSet
static void PWM_MasterDutyCycleSet(uint16_t masterDutyCycle)
This inline function sets the PWM master duty cycle register.
Definition pwm.h:451
PWM_OverrideDataLowSet
static void PWM_OverrideDataLowSet(enum PWM_GENERATOR genNum, bool overrideDataLow)
This inline function updates PWM override low data bit with the requested value for a specific PWM ge...
Definition pwm.h:633
PWM_OverrideHighDisable
static void PWM_OverrideHighDisable(enum PWM_GENERATOR genNum)
This inline function disables PWM override on PWMH output for specific PWM generator selected by the ...
Definition pwm.h:740
PWM_OverrideDataSet
static void PWM_OverrideDataSet(enum PWM_GENERATOR genNum, uint16_t overrideData)
This inline function updates PWM override data bits with the requested value for a specific PWM gener...
Definition pwm.h:579
PWM_DeadTimeSet
static void PWM_DeadTimeSet(enum PWM_GENERATOR genNum, uint16_t deadtime)
This inline function updates PWM Deadtime low and high register with the requested value for a specif...
Definition pwm.h:847
PWM_SoftwareUpdatePending
static bool PWM_SoftwareUpdatePending(enum PWM_GENERATOR genNum)
This inline function gets the status of the update request for specific PWM generator selected by the...
Definition pwm.h:1267
PWM_GeneratorTasks
void PWM_GeneratorTasks(enum PWM_GENERATOR intGen)
This is a tasks function for PWM1.
Definition pwm.c:525
PWM_Trigger2Disable
static void PWM_Trigger2Disable(enum PWM_GENERATOR genNum, enum PWM_TRIGGER_COMPARE compareRegister)
This inline function disables ADC trigger 2 for the specific compare register selected by the argumen...
Definition pwm.h:1599
PWM_GeneratorEventStatusClear
static void PWM_GeneratorEventStatusClear(enum PWM_GENERATOR genNum, enum PWM_GENERATOR_INTERRUPT interrupt)
This inline function clears the PWM interrupt status for the PWM Generator selected by the argument P...
Definition pwm.h:1071
PWM_OverrideLowDisable
static void PWM_OverrideLowDisable(enum PWM_GENERATOR genNum)
This inline function disables PWM override on PWML output for specific PWM generator selected by the ...
Definition pwm.h:766
PWM_GeneratorInterruptEnable
static void PWM_GeneratorInterruptEnable(enum PWM_GENERATOR genNum, enum PWM_GENERATOR_INTERRUPT interrupt)
This inline function enables interrupt requests for the PWM Generator selected by the argument PWM_GE...
Definition pwm.h:905
PWM_TriggerCCompareValueSet
static void PWM_TriggerCCompareValueSet(enum PWM_GENERATOR genNum, uint16_t trigC)
This inline function sets the Trigger C compare value in count for a specific PWM generator selected ...
Definition pwm.h:1350
PWM_PhaseSelect
static void PWM_PhaseSelect(enum PWM_GENERATOR genNum, enum PWM_SOURCE_SELECT source)
This inline function selects the PWM generator source for Phase.
Definition pwm.h:526
PWM_Trigger1Enable
static void PWM_Trigger1Enable(enum PWM_GENERATOR genNum, enum PWM_TRIGGER_COMPARE compareRegister)
This inline function enables ADC trigger 1 for the specific compare register selected by the argument...
Definition pwm.h:1380
PWM_PeriodSet
static void PWM_PeriodSet(enum PWM_GENERATOR genNum, uint16_t period)
This inline function sets the period value in count for the PWM generator specific Time Base.
Definition pwm.h:474
PWM_GeneratorEnable
static void PWM_GeneratorEnable(enum PWM_GENERATOR genNum)
This inline function enables the specific PWM generator selected by the argument PWM_GENERATOR.
Definition pwm.h:302
PWM_DeadTimeHighSet
static void PWM_DeadTimeHighSet(enum PWM_GENERATOR genNum, uint16_t deadtimeHigh)
This inline function updates PWM Deadtime high register with the requested value for a specific PWM g...
Definition pwm.h:820
PWM_Enable
static void PWM_Enable(void)
This inline function will enable all the generators of PWM module.
Definition pwm.h:412
PWM_GeneratorEOCEventCallbackRegister
void PWM_GeneratorEOCEventCallbackRegister(void(*callback)(enum PWM_GENERATOR genNum))
This function can be used to override default callback PWM_GeneratorEOCEventCallback and to define cu...
Definition pwm.c:511
PWM_HS_INTERFACE
Structure containing the function pointers of PWM driver.
Definition pwm_hs_interface.h:56