48#include "pwm_hs_interface.h"
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
275#define PWM_HS_GeneratorTasks PWM_GeneratorTasks
347 PG1CONLbits.MODSEL = mode;
350 PG1IOCONHbits.PMOD = 0x1;
354 PG1IOCONHbits.PMOD = 0x0;
358 PG2CONLbits.MODSEL = mode;
361 PG2IOCONHbits.PMOD = 0x1;
365 PG2IOCONHbits.PMOD = 0x0;
415 MDC = masterDutyCycle;
426 MPHASE = masterPhase;
480 PG1CONHbits.MPHSEL = source;
483 PG2CONHbits.MPHSEL = source;
521 PG1IOCONLbits.OVRDAT = overrideData;
524 PG2IOCONLbits.OVRDAT = overrideData;
542 PG1IOCONLbits.OVRDAT = (PG1IOCONLbits.OVRDAT & 0x1) | ((uint8_t)overrideDataHigh << 0x1);
545 PG2IOCONLbits.OVRDAT = (PG2IOCONLbits.OVRDAT & 0x1) | ((uint8_t)overrideDataHigh << 0x1);
563 PG1IOCONLbits.OVRDAT = (PG1IOCONLbits.OVRDAT & 0x2) | overrideDataLow;
566 PG2IOCONLbits.OVRDAT = (PG2IOCONLbits.OVRDAT & 0x2) | overrideDataLow;
582 uint16_t overrideData = 0x0U;
585 overrideData = PG1IOCONLbits.OVRDAT;
588 overrideData = PG2IOCONLbits.OVRDAT;
606 PG1IOCONLbits.OVRENH = 1;
609 PG2IOCONLbits.OVRENH = 1;
626 PG1IOCONLbits.OVRENL = 1;
629 PG2IOCONLbits.OVRENL = 1;
646 PG1IOCONLbits.OVRENH = 0;
649 PG2IOCONLbits.OVRENH = 0;
666 PG1IOCONLbits.OVRENL = 0;
669 PG2IOCONLbits.OVRENL = 0;
687 PG1DTL = deadtimeLow;
690 PG2DTL = deadtimeLow;
708 PG1DTH = deadtimeHigh;
711 PG2DTH = deadtimeHigh;
752 PG1TRIGA = trigCompValue;
755 PG2TRIGA = trigCompValue;
775 PG1EVTHbits.FLTIEN =
true;
778 PG1EVTHbits.CLIEN =
true;
781 PG1EVTHbits.FFIEN =
true;
784 PG1EVTHbits.SIEN =
true;
792 PG2EVTHbits.FLTIEN =
true;
795 PG2EVTHbits.CLIEN =
true;
798 PG2EVTHbits.FFIEN =
true;
801 PG2EVTHbits.SIEN =
true;
824 PG1EVTHbits.FLTIEN =
false;
827 PG1EVTHbits.CLIEN =
false;
830 PG1EVTHbits.FFIEN =
false;
833 PG1EVTHbits.SIEN =
false;
841 PG2EVTHbits.FLTIEN =
false;
844 PG2EVTHbits.CLIEN =
false;
847 PG2EVTHbits.FFIEN =
false;
850 PG2EVTHbits.SIEN =
false;
873 PG1STATbits.FLTEVT = 0;
876 PG1STATbits.CLEVT = 0;
879 PG1STATbits.FFEVT = 0;
882 PG1STATbits.SEVT = 0;
890 PG2STATbits.FLTEVT = 0;
893 PG2STATbits.CLEVT = 0;
896 PG2STATbits.FFEVT = 0;
899 PG2STATbits.SEVT = 0;
924 status = PG1STATbits.FLTEVT;
927 status = PG1STATbits.CLEVT;
930 status = PG1STATbits.FFEVT;
933 status = PG1STATbits.SEVT;
941 status = PG2STATbits.FLTEVT;
944 status = PG2STATbits.CLEVT;
947 status = PG2STATbits.FFEVT;
950 status = PG2STATbits.SEVT;
971 PG1STATbits.UPDREQ = 1;
974 PG2STATbits.UPDREQ = 1;
994 status = PG1STATbits.UPDATE;
997 status = PG2STATbits.UPDATE;
1082 switch(compareRegister) {
1084 PG1EVTLbits.ADTR1EN1 = 1;
1087 PG1EVTLbits.ADTR1EN2 = 1;
1090 PG1EVTLbits.ADTR1EN3 = 1;
1096 switch(compareRegister) {
1098 PG2EVTLbits.ADTR1EN1 = 1;
1101 PG2EVTLbits.ADTR1EN2 = 1;
1104 PG2EVTLbits.ADTR1EN3 = 1;
1126 switch(compareRegister) {
1128 PG1EVTLbits.ADTR1EN1 = 0;
1131 PG1EVTLbits.ADTR1EN2 = 0;
1134 PG1EVTLbits.ADTR1EN3 = 0;
1140 switch(compareRegister) {
1142 PG2EVTLbits.ADTR1EN1 = 0;
1145 PG2EVTLbits.ADTR1EN2 = 0;
1148 PG2EVTLbits.ADTR1EN3 = 0;
1173 switch(compareRegister) {
1175 PG1EVTHbits.ADTR2EN1 = 1;
1178 PG1EVTHbits.ADTR2EN2 = 1;
1181 PG1EVTHbits.ADTR2EN3 = 1;
1187 switch(compareRegister) {
1189 PG2EVTHbits.ADTR2EN1 = 1;
1192 PG2EVTHbits.ADTR2EN2 = 1;
1195 PG2EVTHbits.ADTR2EN3 = 1;
1217 switch(compareRegister) {
1219 PG1EVTHbits.ADTR2EN1 = 0;
1222 PG1EVTHbits.ADTR2EN2 = 0;
1225 PG1EVTHbits.ADTR2EN3 = 0;
1231 switch(compareRegister) {
1233 PG2EVTHbits.ADTR2EN1 = 0;
1236 PG2EVTHbits.ADTR2EN2 = 0;
1239 PG2EVTHbits.ADTR2EN3 = 0;
1260 PG1FPCILbits.SWTERM = 1;
1263 PG2FPCILbits.SWTERM = 1;
This is the generated driver types header file for the PWM driver.
@ PWM_GENERATOR_INTERRUPT_FEED_FORWARD
@ PWM_GENERATOR_INTERRUPT_SYNC
@ PWM_GENERATOR_INTERRUPT_CURRENT_LIMIT
@ PWM_GENERATOR_INTERRUPT_FAULT
@ PWM_MODE_INDEPENDENT_EDGE_DUAL_OUTPUT
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...
static void PWM_MasterPhaseSet(uint16_t masterPhase)
This inline function sets the phase value in count for the Master Time Base generator.
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...
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...
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...
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...
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...
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...
PWM_GENERATOR_INTERRUPT
Defines the PWM generator interrupts that are available for the module to use.
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...
void PWM_Initialize(void)
Initializes PWM module, using the given initialization data.
static void PWM_MasterPeriodSet(uint16_t masterPeriod)
This inline function sets the period value in count for the Master Time Base generator.
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 ...
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 ...
static void PWM_DutyCycleSet(enum PWM_GENERATOR genNum, uint16_t dutyCycle)
This inline function sets the PWM generator specific duty cycle register.
void PWM_GeneratorEOCEventCallback(enum PWM_GENERATOR genNum)
This is the default callback with weak attribute. The user can override and implement the default cal...
void PWM_Deinitialize(void)
Deinitializes the PWM to POR values.
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...
PWM_TRIGGER_COMPARE
Defines the PWM generator Trigger Compare registers that are available for the module to use.
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...
static void PWM_GeneratorDisable(enum PWM_GENERATOR genNum)
This inline function disables the specific PWM generator selected by the argument PWM_GENERATOR.
static void PWM_Disable(void)
This inline function will disable all the generators of PWM module.
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.
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...
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...
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...
static void PWM_SoftwareUpdateRequest(enum PWM_GENERATOR genNum)
This inline function requests to update the data registers for specific PWM generator selected by the...
PWM_MODES
Defines the PWM generator operating modes that are available.
static void PWM_MasterDutyCycleSet(uint16_t masterDutyCycle)
This inline function sets the PWM master duty cycle register.
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...
static void PWM_OverrideHighDisable(enum PWM_GENERATOR genNum)
This inline function disables PWM override on PWMH output for specific PWM generator selected by the ...
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...
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...
PWM_GENERATOR
Defines the PWM generators that are selected from the MCC Melody User Interface for the PWM output co...
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...
void PWM_GeneratorTasks(enum PWM_GENERATOR intGen)
This is a tasks function for PWM1.
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...
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...
static void PWM_OverrideLowDisable(enum PWM_GENERATOR genNum)
This inline function disables PWM override on PWML output for specific PWM generator selected by the ...
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...
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 ...
static void PWM_PhaseSelect(enum PWM_GENERATOR genNum, enum PWM_SOURCE_SELECT source)
This inline function selects the PWM generator source for Phase.
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...
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.
static void PWM_GeneratorEnable(enum PWM_GENERATOR genNum)
This inline function enables the specific PWM generator selected by the argument PWM_GENERATOR.
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...
static void PWM_Enable(void)
This inline function will enable all the generators of PWM module.
void PWM_GeneratorEOCEventCallbackRegister(void(*callback)(enum PWM_GENERATOR genNum))
This function can be used to override default callback PWM_GeneratorEOCEventCallback and to define cu...
Structure containing the function pointers of PWM driver.