2.21 PWM HS Driver
2.21.1 Introduction
Overview
The High-Speed PWM (HSPWM) module provides features to support many types of Motor Control (MC) and Power Control (PC) applications such as
- AC-to-DC Converters
- DC-to-DC Converters
- AC and DC Motor Control: Brushed DC, BLDC, PMSM, ACIM, SRM, Stepper, etc.
- Inverters
- Battery Chargers
- Digital Lighting
- Power Factor Correction (PFC)
Features
-
Operating modes:
- Independent Edge PWM mode, Dual Output
-
Output modes:
- Complementary
- Dead-Time Generator
- Output Override for Fault Handling
- Flexible Period/Duty Cycle Updating Options
- Advanced Triggering Options
- PWM Event Outputs
- Configurable Master Clock Source(s) using the harwadre dependent resource(PLIB) in user interface.
2.21.2 Module Documentation
2.21.2.1 PWM HS Driver
High-Resolution Pulse-Width Modulated (PWM) with Fine Edge Placement using dsPIC MCUs.
2.21.2.1.1 Module description
High-Resolution Pulse-Width Modulated (PWM) with Fine Edge Placement using dsPIC MCUs.
2.21.2.1.1.1 Data structures
struct PWM_HS_INTERFACE
Structure containing the function pointers of PWM driver.
2.21.2.1.1.2 Definitions
#define PWM_GENERATOR_MASTER_PHASE_FEATURE_AVAILABLE 1
This macro defines the PWM master phase feature availability in the PWM driver.
#define PWM_GENERATOR_ENABLE_FEATURE_AVAILABLE 1
This macro defines the PWM generator enable feature availability in the PWM driver.
#define PWM_SOFTWARE_UPDATE_FEATURE_AVAILABLE 1
This macro defines the PWM data update request feature availability in the PWM driver.
#define PWM_FAULT_LATCH_SOFTWARE_CLEAR_FEATURE_AVAILABLE 1
This macro defines the PWM fault latch clear through software feature availability in the PWM driver.
#define PWM_MULTIPLE_TRIGGER_FEATURE_AVAILABLE 1
This macro defines the PWM multiple trigger feature availability in the PWM driver.
#define PWM_TRIGGER_ENABLE_FEATURE_AVAILABLE 1
This macro defines the PWM multiple trigger enable availability in the PWM driver.
#define PWM_SPECIAL_EVENT_FEATURE_AVAILABLE 0
This macro defines the PWM special event trigger feature availability in the PWM driver.
#define PWM_FAULT_MODE_ENABLE_FEATURE_AVAILABLE 0
This macro defines the PWM fault mode enable and disable feature availability in the PWM driver.
2.21.2.1.1.3 Enumerations
enum PWM_GENERATOR { PWM_GENERATOR_1 = 1, PWM_MAX_GENERATOR }
Defines the PWM generators that are selected from the MCC Melody User Interface for the PWM output controls. Note: The enum list in the Help document might be just an illustration to show the selected PWM channel list Generated enum list is based on the configuration done by user in the MCC Melody user interface.
enum PWM_GENERATOR_INTERRUPT { PWM_GENERATOR_INTERRUPT_FAULT = 1, PWM_GENERATOR_INTERRUPT_CURRENT_LIMIT = 2, PWM_GENERATOR_INTERRUPT_FEED_FORWARD = 3, PWM_GENERATOR_INTERRUPT_SYNC = 4 }
Defines the PWM generator interrupts that are available for the module to use.
enum PWM_COMMON_EVENT { PWM_EVENT_A = 1, PWM_EVENT_B = 2, PWM_EVENT_C = 3, PWM_EVENT_D = 4, PWM_EVENT_E = 5, PWM_EVENT_F = 6 }
Defines the PWM generator Common Events that are available for the module to use.
enum PWM_TRIGGER_COMPARE { PWM_TRIGGER_COMPARE_A = 1, PWM_TRIGGER_COMPARE_B = 2, PWM_TRIGGER_COMPARE_C = 3 }
Defines the PWM generator Trigger Compare registers that are available for the module to use.
enum PWM_MODES { PWM_MODE_INDEPENDENT_EDGE = 0x0, PWM_MODE_VARIABLE_PHASE = 0x1, PWM_MODE_INDEPENDENT_EDGE_DUAL_OUTPUT = 0x2, PWM_MODE_CENTER_ALIGNED = 0x4, PWM_MODE_DOUBLE_UPDATE_CENTER_ALIGNED = 0x5, PWM_MODE_DUAL_EDGE_CENTER_ALIGNED_ONE_UPDATE_CYCLE = 0x6, PWM_MODE_DUAL_EDGE_CENTER_ALIGNED_TWO_UPDATES_CYCLE = 0x7 }
Defines the PWM generator operating modes that are available.
2.21.2.1.1.4 Functions
void PWM_Initialize (void)
Initializes PWM module, using the given initialization data.
void PWM_Deinitialize (void)
Deinitializes the PWM to POR values.
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_GeneratorDisable (enum PWM_GENERATOR genNum)
This inline function disables the specific PWM generator selected by the argument PWM_GENERATOR.
static void PWM_ModeSet (enum PWM_GENERATOR genNum, enum PWM_MODES mode)
This inline function sets the operating mode of specific PWM generator selected.
static void PWM_Enable (void)
This inline function will enable all the generators of PWM module.
static void PWM_Disable (void)
This inline function will disable all the generators of PWM module.
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_MasterDutyCycleSet (uint16_t masterDutyCycle)
This inline function sets the PWM master duty cycle register.
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_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_DutyCycleSet (enum PWM_GENERATOR genNum, uint16_t dutyCycle)
This inline function sets the PWM generator specific duty cycle register.
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_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 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 generator selected by the argument PWM_GENERATOR.
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 generator selected by the argument PWM_GENERATOR.
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 generator selected by the argument PWM_GENERATOR.
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_GENERATOR.
static void PWM_OverrideHighEnable (enum PWM_GENERATOR genNum)
This inline function enables PWM override on PWMH output for specific PWM generator selected by the argument PWM_GENERATOR.
static void PWM_OverrideLowEnable (enum PWM_GENERATOR genNum)
This inline function enables PWM override on PWML output for specific PWM generator selected by the argument PWM_GENERATOR.
static void PWM_OverrideHighDisable (enum PWM_GENERATOR genNum)
This inline function disables PWM override on PWMH output for specific PWM generator selected by the argument PWM_GENERATOR.
static void PWM_OverrideLowDisable (enum PWM_GENERATOR genNum)
This inline function disables PWM override on PWML output for specific PWM generator selected by the argument PWM_GENERATOR.
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 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 generator selected by the argument PWM_GENERATOR.
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 specific PWM generator selected by the argument PWM_GENERATOR.
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 the argument PWM_GENERATOR.
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_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_GENERATOR.
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 PWM_GENERATOR.
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_GENERATOR.
static void PWM_SoftwareUpdateRequest (enum PWM_GENERATOR genNum)
This inline function requests to update the data registers for specific PWM generator selected by the argument PWM_GENERATOR.
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 argument PWM_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 by the argument PWM_GENERATOR.
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 by the argument PWM_GENERATOR.
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 by the argument PWM_GENERATOR.
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 PWM_GENERATOR.
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 argument PWM_GENERATOR.
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 PWM_GENERATOR.
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 argument PWM_GENERATOR.
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 the argument PWM_GENERATOR.
void PWM_GeneratorEOCEventCallbackRegister (void(*callback)(enum PWM_GENERATOR genNum))
This function can be used to override default callback PWM_GeneratorEOCEventCallback and to define custom callback for PWM EOCEvent event.
void PWM_GeneratorEOCEventCallback (enum PWM_GENERATOR genNum)
This is the default callback with weak attribute. The user can override and implement the default callback without weak attribute or can register a custom callback function using PWM_EOCEventCallbackRegister.
void PWM_GeneratorTasks (enum PWM_GENERATOR intGen)
This is a tasks function for PWM1.
2.21.2.1.1.5 Variables
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 User interface.
2.21.2.1.2 Definition Documentation
2.21.2.1.2.1 PWM_FAULT_LATCH_SOFTWARE_CLEAR_FEATURE_AVAILABLE
#define PWM_FAULT_LATCH_SOFTWARE_CLEAR_FEATURE_AVAILABLE 1
This macro defines the PWM fault latch clear through software feature availability in the PWM driver.
APIs Supported:
PWM_FaultModeLatchClear(PWM_GENERATOR genNum); Refer driver header file for detailed description of the APIs.2.21.2.1.2.2 PWM_FAULT_MODE_ENABLE_FEATURE_AVAILABLE
#define PWM_FAULT_MODE_ENABLE_FEATURE_AVAILABLE 0
This macro defines the PWM fault mode enable and disable feature availability in the PWM driver.
APIs Supported:
NA2.21.2.1.2.3 PWM_GENERATOR_ENABLE_FEATURE_AVAILABLE
#define PWM_GENERATOR_ENABLE_FEATURE_AVAILABLE 1
This macro defines the PWM generator enable feature availability in the PWM driver.
APIs Supported:
PWM_GeneratorEnable(PWM_GENERATOR genNum); PWM_GeneratorDisable(PWM_GENERATOR genNum); Refer driver header file for detailed description of the APIs.2.21.2.1.2.4 PWM_GENERATOR_MASTER_PHASE_FEATURE_AVAILABLE
#define PWM_GENERATOR_MASTER_PHASE_FEATURE_AVAILABLE 1
This macro defines the PWM master phase feature availability in the PWM driver.
APIs Supported:
PWM_MasterPhaseSet(uint16_t masterPhase); Refer driver header file for detailed description of the APIs.2.21.2.1.2.5 PWM_MULTIPLE_TRIGGER_FEATURE_AVAILABLE
#define PWM_MULTIPLE_TRIGGER_FEATURE_AVAILABLE 1
This macro defines the PWM multiple trigger feature availability in the PWM driver.
APIs Supported:
PWM_TriggerACompareValueSet(PWM_GENERATOR genNum, uint16_t trigCompValue); PWM_TriggerBCompareValueSet(PWM_GENERATOR genNum, uint16_t trigCompValue); PWM_TriggerCCompareValueSet(PWM_GENERATOR genNum, uint16_t trigCompValue); Refer driver header file for detailed description of the APIs.2.21.2.1.2.6 PWM_SOFTWARE_UPDATE_FEATURE_AVAILABLE
#define PWM_SOFTWARE_UPDATE_FEATURE_AVAILABLE 1
This macro defines the PWM data update request feature availability in the PWM driver.
APIs Supported:
PWM_SoftwareUpdateRequest(PWM_GENERATOR genNum); PWM_SoftwareUpdatePending(PWM_GENERATOR genNum); Refer driver header file for detailed description of the APIs.2.21.2.1.2.7 PWM_SPECIAL_EVENT_FEATURE_AVAILABLE
#define PWM_SPECIAL_EVENT_FEATURE_AVAILABLE 0
This macro defines the PWM special event trigger feature availability in the PWM driver.
APIs Supported:
NA2.21.2.1.2.8 PWM_TRIGGER_ENABLE_FEATURE_AVAILABLE
#define PWM_TRIGGER_ENABLE_FEATURE_AVAILABLE 1
This macro defines the PWM multiple trigger enable availability in the PWM driver.
APIs Supported:
PWM_Trigger1Enable(enum PWM_GENERATOR genNum, enum PWM_TRIGGER_COMPARE compareRegister); PWM_Trigger1Disable(enum PWM_GENERATOR genNum, enum PWM_TRIGGER_COMPARE compareRegister); PWM_Trigger2Enable(enum PWM_GENERATOR genNum, enum PWM_TRIGGER_COMPARE compareRegister); PWM_Trigger2Disable(enum PWM_GENERATOR genNum, enum PWM_TRIGGER_COMPARE compareRegister); Refer driver header file for detailed description of the APIs.2.21.2.1.3 Function Documentation
2.21.2.1.3.1 PWM_DeadTimeHighSet()
inline 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 generator selected by the argument PWM_GENERATOR.
in | genNum |
- PWM generator number |
in | deadtimeHigh |
- Deadtime high value |
none |
2.21.2.1.3.2 PWM_DeadTimeLowSet()
inline 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 generator selected by the argument PWM_GENERATOR.
in | genNum |
- PWM generator number |
in | deadtimeLow |
- Deadtime low value |
none |
2.21.2.1.3.3 PWM_DeadTimeSet()
inline 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 specific PWM generator selected by the argument PWM_GENERATOR.
in | genNum |
- PWM generator number |
in | deadtimeHigh |
- Deadtime value |
none |
2.21.2.1.3.4 PWM_Deinitialize()
void PWM_Deinitialize (void )
Deinitializes the PWM to POR values.
none |
none |
2.21.2.1.3.5 PWM_Disable()
inline static void PWM_Disable (void )
This inline function will disable all the generators of PWM module.
none |
none |
2.21.2.1.3.6 PWM_DutyCycleSet()
inline static void PWM_DutyCycleSet (enum PWM_GENERATOR genNum, uint16_t dutyCycle)
This inline function sets the PWM generator specific duty cycle register.
in | genNum |
- PWM generator number |
in | dutyCycle |
- PWM generator duty cycle |
none |
2.21.2.1.3.7 PWM_Enable()
inline static void PWM_Enable (void )
This inline function will enable all the generators of PWM module.
none |
none |
2.21.2.1.3.8 PWM_FaultModeLatchClear()
inline 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 the argument PWM_GENERATOR.
in | genNum |
- PWM generator number |
none |
2.21.2.1.3.9 PWM_GeneratorDisable()
inline static void PWM_GeneratorDisable (enum PWM_GENERATOR genNum)
This inline function disables the specific PWM generator selected by the argument PWM_GENERATOR.
in | genNum |
- PWM generator number |
none |
2.21.2.1.3.10 PWM_GeneratorEnable()
inline static void PWM_GeneratorEnable (enum PWM_GENERATOR genNum)
This inline function enables the specific PWM generator selected by the argument PWM_GENERATOR.
in | genNum |
- PWM generator number |
none |
2.21.2.1.3.11 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 callback without weak attribute or can register a custom callback function using PWM_EOCEventCallbackRegister.
in | genNum |
- PWM generator number |
none |
2.21.2.1.3.12 PWM_GeneratorEOCEventCallbackRegister()
void PWM_GeneratorEOCEventCallbackRegister (void(*)(enum PWM_GENERATOR genNum) callback)
This function can be used to override default callback PWM_GeneratorEOCEventCallback and to define custom callback for PWM EOCEvent event.
in | callback |
- Address of the callback function |
none |
2.21.2.1.3.13 PWM_GeneratorEventStatusClear()
inline 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 PWM_GENERATOR.
in | genNum |
- PWM generator number |
in | interrupt |
- PWM generator interrupt source |
none |
2.21.2.1.3.14 PWM_GeneratorEventStatusGet()
inline 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_GENERATOR.
in | genNum |
- PWM generator number |
in | interrupt |
- PWM generator interrupt source |
true - Interrupt is pending false - Interrupt is not pending |
2.21.2.1.3.15 PWM_GeneratorInterruptDisable()
inline 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_GENERATOR.
in | genNum |
- PWM generator number |
in | interrupt |
- PWM generator interrupt source |
none |
2.21.2.1.3.16 PWM_GeneratorInterruptEnable()
inline 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_GENERATOR.
in | genNum |
- PWM generator number |
in | interrupt |
- PWM generator interrupt source |
none |
2.21.2.1.3.17 PWM_GeneratorTasks()
void PWM_GeneratorTasks (enum PWM_GENERATOR intGen)
This is a tasks function for PWM1.
in | intGen |
- PWM generator number |
none |
2.21.2.1.3.18 PWM_Initialize()
void PWM_Initialize (void )
Initializes PWM module, using the given initialization data.
none |
none |
2.21.2.1.3.19 PWM_MasterDutyCycleSet()
inline static void PWM_MasterDutyCycleSet (uint16_t masterDutyCycle)
This inline function sets the PWM master duty cycle register.
in | masterDutyCycle |
- Master Duty Cycle value |
none |
2.21.2.1.3.20 PWM_MasterPeriodSet()
inline static void PWM_MasterPeriodSet (uint16_t masterPeriod)
This inline function sets the period value in count for the Master Time Base generator.
in | masterPeriod |
- Period value in count |
none |
2.21.2.1.3.21 PWM_MasterPhaseSet()
inline static void PWM_MasterPhaseSet (uint16_t masterPhase)
This inline function sets the phase value in count for the Master Time Base generator.
in | masterPhase |
- Phase value in count |
none |
2.21.2.1.3.22 PWM_ModeSet()
inline 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_GENERATOR.
in | genNum |
- PWM generator number |
in | mode |
- PWM operating mode |
none |
2.21.2.1.3.23 PWM_OverrideDataGet()
inline 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_GENERATOR.
in | genNum |
- PWM generator number |
Override data for the PWM Generator selected by the argument PWM_GENERATOR. |
2.21.2.1.3.24 PWM_OverrideDataHighSet()
inline 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 generator selected by the argument PWM_GENERATOR.
in | genNum |
- PWM generator number |
in | overrideDataHigh |
- Override data |
none |
2.21.2.1.3.25 PWM_OverrideDataLowSet()
inline 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 generator selected by the argument PWM_GENERATOR.
in | genNum |
- PWM generator number |
in | overrideDataLow |
- Override data |
none |
2.21.2.1.3.26 PWM_OverrideDataSet()
inline 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 generator selected by the argument PWM_GENERATOR.
in | genNum |
- PWM generator number |
in | overrideData |
- Override data |
none |
2.21.2.1.3.27 PWM_OverrideHighDisable()
inline static void PWM_OverrideHighDisable (enum PWM_GENERATOR genNum)
This inline function disables PWM override on PWMH output for specific PWM generator selected by the argument PWM_GENERATOR.
in | genNum |
- PWM generator number |
none |
2.21.2.1.3.28 PWM_OverrideHighEnable()
inline static void PWM_OverrideHighEnable (enum PWM_GENERATOR genNum)
This inline function enables PWM override on PWMH output for specific PWM generator selected by the argument PWM_GENERATOR.
in | genNum |
- PWM generator number |
none |
2.21.2.1.3.29 PWM_OverrideLowDisable()
inline static void PWM_OverrideLowDisable (enum PWM_GENERATOR genNum)
This inline function disables PWM override on PWML output for specific PWM generator selected by the argument PWM_GENERATOR.
in | genNum |
- PWM generator number |
none |
2.21.2.1.3.30 PWM_OverrideLowEnable()
inline static void PWM_OverrideLowEnable (enum PWM_GENERATOR genNum)
This inline function enables PWM override on PWML output for specific PWM generator selected by the argument PWM_GENERATOR.
in | genNum |
- PWM generator number |
none |
2.21.2.1.3.31 PWM_PeriodSet()
inline 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.
in | genNum |
- PWM generator number |
in | period |
- PWM generator period value in count |
none |
2.21.2.1.3.32 PWM_PhaseSelect()
inline static void PWM_PhaseSelect (enum PWM_GENERATOR genNum, enum PWM_SOURCE_SELECT source)
This inline function selects the PWM generator source for Phase.
in | genNum |
- PWM generator number |
in | source |
- PWM generator source select |
none |
2.21.2.1.3.33 PWM_PhaseSet()
inline 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.
in | genNum |
- PWM generator number |
in | phase |
- PWM generator phase value in count |
none |
2.21.2.1.3.34 PWM_SoftwareUpdatePending()
inline 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 argument PWM_GENERATOR.
in | genNum |
- PWM generator number |
true - Software update is pending false - Software update is not pending |
2.21.2.1.3.35 PWM_SoftwareUpdateRequest()
inline static void PWM_SoftwareUpdateRequest (enum PWM_GENERATOR genNum)
This inline function requests to update the data registers for specific PWM generator selected by the argument PWM_GENERATOR.
in | genNum |
- PWM generator number |
none |
2.21.2.1.3.36 PWM_Trigger1Disable()
inline 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 argument PWM_GENERATOR.
in | genNum |
- PWM generator number |
in | compareRegister |
- PWM generator number |
none |
2.21.2.1.3.37 PWM_Trigger1Enable()
inline 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 PWM_GENERATOR.
Trigger value has to be set using PWM_TriggerACompareValueSet, PWM_TriggerBCompareValueSet or PWM_TriggerCCompareValueSet before calling this function. |
in | genNum |
- PWM generator number |
in | compareRegister |
- PWM generator number |
none |
2.21.2.1.3.38 PWM_Trigger2Disable()
inline 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 argument PWM_GENERATOR.
in | genNum |
- PWM generator number |
in | compareRegister |
- PWM generator number |
none |
2.21.2.1.3.39 PWM_Trigger2Enable()
inline 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 PWM_GENERATOR.
Trigger value has to be set using PWM_TriggerACompareValueSet, PWM_TriggerBCompareValueSet or PWM_TriggerCCompareValueSet before calling this function. |
in | genNum |
- PWM generator number |
in | compareRegister |
- PWM generator number |
none |
2.21.2.1.3.40 PWM_TriggerACompareValueSet()
inline 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 by the argument PWM_GENERATOR.
in | genNum |
- PWM generator number |
in | trigA |
- Trigger A compare value in count |
none |
2.21.2.1.3.41 PWM_TriggerBCompareValueSet()
inline 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 by the argument PWM_GENERATOR.
in | genNum |
- PWM generator number |
in | trigB |
- Trigger B compare value in count |
none |
2.21.2.1.3.42 PWM_TriggerCCompareValueSet()
inline 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 by the argument PWM_GENERATOR.
in | genNum |
- PWM generator number |
in | trigC |
- Trigger C compare value in count |
none |
2.21.2.1.3.43 PWM_TriggerCompareValueSet()
inline 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 the argument PWM_GENERATOR.
in | genNum |
- PWM generator number |
in | trigCompValue |
- Trigger compare value in count |
none |
2.21.2.1.4 Enumeration Type Documentation
2.21.2.1.4.1 PWM_COMMON_EVENT
enum PWM_COMMON_EVENT
Defines the PWM generator Common Events that are available for the module to use.
PWM_EVENT_A |
PWM EVENT_A Output |
PWM_EVENT_B |
PWM EVENT_B Output |
PWM_EVENT_C |
PWM EVENT_C Output |
PWM_EVENT_D |
PWM EVENT_D Output |
PWM_EVENT_E |
PWM EVENT_E Output |
PWM_EVENT_F |
PWM EVENT_F Output |
2.21.2.1.4.2 PWM_GENERATOR
enum PWM_GENERATOR
Defines the PWM generators that are selected from the MCC Melody User Interface for the PWM output controls. Note: The enum list in the Help document might be just an illustration to show the selected PWM channel list Generated enum list is based on the configuration done by user in the MCC Melody user interface.
PWM_GENERATOR_1 |
Custom name of PWM generator 1 |
PWM_MAX_GENERATOR |
2.21.2.1.4.3 PWM_GENERATOR_INTERRUPT
enum PWM_GENERATOR_INTERRUPT
Defines the PWM generator interrupts that are available for the module to use.
PWM_GENERATOR_INTERRUPT_FAULT |
PWM Generator Fault Interrupt |
PWM_GENERATOR_INTERRUPT_CURRENT_LIMIT |
PWM Generator Current Limit Interrupt |
PWM_GENERATOR_INTERRUPT_FEED_FORWARD |
PWM Generator Feed Forward Interrupt |
PWM_GENERATOR_INTERRUPT_SYNC |
PWM Generator Sync Interrupt |
2.21.2.1.4.4 PWM_MODES
enum PWM_MODES
Defines the PWM generator operating modes that are available.
PWM_MODE_INDEPENDENT_EDGE |
Independent Edge mode |
PWM_MODE_VARIABLE_PHASE |
Variable Phase mode |
PWM_MODE_INDEPENDENT_EDGE_DUAL_OUTPUT |
Independent Edge, dual output mode |
PWM_MODE_CENTER_ALIGNED |
Center-Aligned mode |
PWM_MODE_DOUBLE_UPDATE_CENTER_ALIGNED |
Double-Update Center-Aligned mode |
PWM_MODE_DUAL_EDGE_CENTER_ALIGNED_ONE_UPDATE_CYCLE |
Dual Edge Center-Aligned;one update/cycle mode |
PWM_MODE_DUAL_EDGE_CENTER_ALIGNED_TWO_UPDATES_CYCLE |
Dual Edge Center-Aligned;two updates/cycle mode |
2.21.2.1.4.5 PWM_TRIGGER_COMPARE
enum PWM_TRIGGER_COMPARE
Defines the PWM generator Trigger Compare registers that are available for the module to use.
PWM_TRIGGER_COMPARE_A |
PWM Trigger Compare A Register |
PWM_TRIGGER_COMPARE_B |
PWM Trigger Compare B Register |
PWM_TRIGGER_COMPARE_C |
PWM Trigger Compare C Register |
2.21.2.1.5 Variable Documentation
2.21.2.1.5.1 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 User interface.
The default name e.g. PWM_HS can be changed by the user in the PWM user interface. This allows defining a structure with application specific name using the 'Custom Name' field. Application specific name allows the API Portability.
2.21.3 Class Documentation
2.21.3.1 PWM_HS_INTERFACE Struct Reference
Structure containing the function pointers of PWM driver.
2.21.3.1.1 Detailed Description
Structure containing the function pointers of PWM driver.
#include <pwm_hs_interface.h>
2.21.3.1.1.1 Public Attributes
void(* Initialize )(void)
Pointer to PWM_Initialize.
void(* Deinitialize )(void)
Pointer to PWM_Deinitialize.
void(* Disable )(void)
Pointer to PWM_Disable.
void(* Enable )(void)
Pointer to PWM_Enable.
void(* MasterPeriodSet )(uint16_t period)
Pointer to PWM_MasterPeriodSet.
void(* MasterDutyCycleSet )(uint16_t masterDutyCycle)
Pointer to PWM_MasterDutyCycleSet.
void(* MasterPhaseSet )(uint16_t masterPhase)
Pointer to PWM_MasterPhaseSet (Defined if PWM_GENERATOR_MASTER_PHASE_FEATURE_AVAILABLE is 1 in PWM_features.h, else NULL)
void(* PeriodSet )(enum PWM_GENERATOR genNum, uint16_t period)
Pointer to PWM_PeriodSet.
void(* ModeSet )(enum PWM_GENERATOR genNum, enum PWM_MODES mode)
Pointer to PWM_ModeSet.
void(* DutyCycleSet )(enum PWM_GENERATOR genNum, uint16_t dutyCycle)
Pointer to PWM_DutyCycleSet.
void(* PhaseSelect )(enum PWM_GENERATOR genNum, enum PWM_SOURCE_SELECT source)
Pointer to PWM_PhaseSelect.
void(* PhaseSet )(enum PWM_GENERATOR genNum, uint16_t phase)
Pointer to PWM_PhaseSet.
void(* OverrideDataSet )(enum PWM_GENERATOR genNum, uint16_t overrideData)
Pointer to PWM_OverrideDataSet.
void(* OverrideDataHighSet )(enum PWM_GENERATOR genNum, bool overrideDataHigh)
Pointer to PWM_OverrideDataHighSet.
void(* OverrideDataLowSet )(enum PWM_GENERATOR genNum, bool overrideDataLow)
Pointer to PWM_OverrideDataLowSet.
uint16_t(* OverrideDataGet )(enum PWM_GENERATOR genNum)
Pointer to PWM_OverrideDataGet.
void(* OverrideHighEnable )(enum PWM_GENERATOR genNum)
Pointer to PWM_OverrideHighEnable.
void(* OverrideLowEnable )(enum PWM_GENERATOR genNum)
Pointer to PWM_OverrideLowEnable.
void(* OverrideHighDisable )(enum PWM_GENERATOR genNum)
Pointer to PWM_OverrideHighDisable.
void(* OverrideLowDisable )(enum PWM_GENERATOR genNum)
Pointer to PWM_OverrideLowDisable.
void(* DeadTimeLowSet )(enum PWM_GENERATOR genNum, uint16_t deadtimeLow)
Pointer to PWM_DeadTimeLowSet.
void(* DeadTimeHighSet )(enum PWM_GENERATOR genNum, uint16_t deadtimeHigh)
Pointer to PWM_DeadTimeHighSet.
void(* DeadTimeSet )(enum PWM_GENERATOR genNum, uint16_t deadtime)
Pointer to PWM_DeadTimeSet.
void(* TriggerCompareValueSet )(enum PWM_GENERATOR genNum, uint16_t trigCompValue)
Pointer to PWM_TriggerCompareValueSet.
void(* GeneratorInterruptEnable )(enum PWM_GENERATOR genNum, enum PWM_GENERATOR_INTERRUPT interrupt)
Pointer to PWM_GeneratorInterruptEnable.
void(* GeneratorInterruptDisable )(enum PWM_GENERATOR genNum, enum PWM_GENERATOR_INTERRUPT interrupt)
Pointer to PWM_GeneratorInterruptDisable.
bool(* GeneratorEventStatusGet )(enum PWM_GENERATOR genNum, enum PWM_GENERATOR_INTERRUPT interrupt)
Pointer to PWM_GeneratorEventStatusGet.
void(* GeneratorEventStatusClear )(enum PWM_GENERATOR genNum, enum PWM_GENERATOR_INTERRUPT interrupt)
Pointer to PWM_GeneratorEventStatusClear.
void(* SpecialEventPrimaryCompareValueSet )(uint16_t compareValue)
Pointer to PWM_SpecialEventPrimaryCompareValueSet (Defined if PWM_SPECIAL_EVENT_FEATURE_AVAILABLE is 1 in PWM_features.h, else NULL)
void(* SpecialEventTriggerInterruptFlagClear )(void)
Pointer to PWM_SpecialEventTriggerInterruptFlagClear (Defined if PWM_SPECIAL_EVENT_FEATURE_AVAILABLE is 1 in PWM_features.h, else NULL)
void(* SpecialEventPrimaryInterruptEnable )(void)
Pointer to PWM_SpecialEventPrimaryInterruptEnable (Defined if PWM_SPECIAL_EVENT_FEATURE_AVAILABLE is 1 in PWM_features.h, else NULL)
void(* SpecialEventPrimaryInterruptDisable )(void)
Pointer to PWM_SpecialEventPrimaryInterruptDisable (Defined if PWM_SPECIAL_EVENT_FEATURE_AVAILABLE is 1 in PWM_features.h, else NULL)
void(* FaultModeLatchDisable )(enum PWM_GENERATOR genNum)
Pointer to PWM_FaultModeLatchDisable (Defined if PWM_FAULT_MODE_FEATURE_AVAILABLE is 1 in PWM_features.h, else NULL)
void(* FaultModeLatchEnable )(enum PWM_GENERATOR genNum)
Pointer to PWM_FaultModeLatchEnable (Defined if PWM_FAULT_MODE_FEATURE_AVAILABLE is 1 in PWM_features.h, else NULL)
void(* GeneratorDisable )(enum PWM_GENERATOR genNum)
Pointer to PWM_GeneratorDisable (Defined if PWM_GENERATOR_ENABLE_FEATURE_AVAILABLE is 1 in PWM_features.h, else NULL)
void(* GeneratorEnable )(enum PWM_GENERATOR genNum)
Pointer to PWM_GeneratorEnable (Defined if PWM_GENERATOR_ENABLE_FEATURE_AVAILABLE is 1 in PWM_features.h, else NULL)
void(* TriggerACompareValueSet )(enum PWM_GENERATOR genNum, uint16_t trigCompValue)
Pointer to PWM_TriggerACompareValueSet (Defined if PWM_MULTIPLE_TRIGGER_FEATURE_AVAILABLE is 1 in PWM_features.h, else NULL)
void(* TriggerBCompareValueSet )(enum PWM_GENERATOR genNum, uint16_t trigCompValue)
Pointer to PWM_TriggerBCompareValueSet (Defined if PWM_MULTIPLE_TRIGGER_FEATURE_AVAILABLE is 1 in PWM_features.h, else NULL)
void(* TriggerCCompareValueSet )(enum PWM_GENERATOR genNum, uint16_t trigCompValue)
Pointer to PWM_TriggerCCompareValueSet (Defined if PWM_MULTIPLE_TRIGGER_FEATURE_AVAILABLE is 1 in PWM_features.h, else NULL)
void(* SoftwareUpdateRequest )(enum PWM_GENERATOR genNum)
Pointer to PWM_SoftwareUpdateRequest (Defined if PWM_SOFTWARE_UPDATE_FEATURE_AVAILABLE is 1 in PWM_features.h, else NULL)
bool(* SoftwareUpdatePending )(enum PWM_GENERATOR genNum)
Pointer to PWM_SoftwareUpdatePending (Defined if PWM_SOFTWARE_UPDATE_FEATURE_AVAILABLE is 1 in PWM_features.h, else NULL)
void(* FaultModeLatchClear )(enum PWM_GENERATOR genNum)
Pointer to PWM_FaultModeLatchClear (Defined if PWM_FAULT_LATCH_SOFTWARE_CLEAR_FEATURE_AVAILABLE is 1 in PWM_features.h, else NULL)
void(* Trigger1Enable )(enum PWM_GENERATOR genNum, enum PWM_TRIGGER_COMPARE compareRegister)
Pointer to PWM_Trigger1Enable (Defined if PWM_TRIGGER_ENABLE_FEATURE_AVAILABLE is 1 in PWM_features.h, else NULL)
void(* Trigger1Disable )(enum PWM_GENERATOR genNum, enum PWM_TRIGGER_COMPARE compareRegister)
Pointer to PWM_Trigger1Disable (Defined if PWM_TRIGGER_ENABLE_FEATURE_AVAILABLE is 1 in PWM_features.h, else NULL)
void(* Trigger2Enable )(enum PWM_GENERATOR genNum, enum PWM_TRIGGER_COMPARE compareRegister)
Pointer to PWM_Trigger2Enable (Defined if PWM_TRIGGER_ENABLE_FEATURE_AVAILABLE is 1 in PWM_features.h, else NULL)
void(* Trigger2Disable )(enum PWM_GENERATOR genNum, enum PWM_TRIGGER_COMPARE compareRegister)
Pointer to PWM_Trigger2Disable (Defined if PWM_TRIGGER_ENABLE_FEATURE_AVAILABLE is 1 in PWM_features.h, else NULL)
void(* GeneratorEOCEventCallbackRegister )(void(*callback)(enum PWM_GENERATOR genNum))
Pointer to PWM_GeneratorEOCEventCallbackRegister.
void(* CommonEventCallbackRegister )(void(*callback)(enum PWM_COMMON_EVENT event))
Pointer to PWM_CommonEventCallbackRegister.
void(* GeneratorTasks )(enum PWM_GENERATOR intGen)
Pointer to PWM_GeneratorTasks (Supported only in polling mode)
void(* CommonEventTasks )(enum PWM_COMMON_EVENT event)
Pointer to PWM_CommonEventTasks (Supported only in polling mode)
2.21.3.1.2 Member Data Documentation
2.21.3.1.2.1 CommonEventCallbackRegister
void(* CommonEventCallbackRegister) (void(*callback)(enum PWM_COMMON_EVENT event))
Pointer to PWM_CommonEventCallbackRegister.
2.21.3.1.2.2 CommonEventTasks
void(* CommonEventTasks) (enum PWM_COMMON_EVENT event)
Pointer to PWM_CommonEventTasks (Supported only in polling mode)
2.21.3.1.2.3 DeadTimeHighSet
void(* DeadTimeHighSet) (enum PWM_GENERATOR genNum, uint16_t deadtimeHigh)
Pointer to PWM_DeadTimeHighSet.
2.21.3.1.2.4 DeadTimeLowSet
void(* DeadTimeLowSet) (enum PWM_GENERATOR genNum, uint16_t deadtimeLow)
Pointer to PWM_DeadTimeLowSet.
2.21.3.1.2.5 DeadTimeSet
void(* DeadTimeSet) (enum PWM_GENERATOR genNum, uint16_t deadtime)
Pointer to PWM_DeadTimeSet.
2.21.3.1.2.6 Deinitialize
void(* Deinitialize) (void)
Pointer to PWM_Deinitialize.
2.21.3.1.2.7 Disable
void(* Disable) (void)
Pointer to PWM_Disable.
2.21.3.1.2.8 DutyCycleSet
void(* DutyCycleSet) (enum PWM_GENERATOR genNum, uint16_t dutyCycle)
Pointer to PWM_DutyCycleSet.
2.21.3.1.2.9 Enable
void(* Enable) (void)
Pointer to PWM_Enable.
2.21.3.1.2.10 FaultModeLatchClear
void(* FaultModeLatchClear) (enum PWM_GENERATOR genNum)
Pointer to PWM_FaultModeLatchClear (Defined if PWM_FAULT_LATCH_SOFTWARE_CLEAR_FEATURE_AVAILABLE is 1 in PWM_features.h, else NULL)
2.21.3.1.2.11 FaultModeLatchDisable
void(* FaultModeLatchDisable) (enum PWM_GENERATOR genNum)
Pointer to PWM_FaultModeLatchDisable (Defined if PWM_FAULT_MODE_FEATURE_AVAILABLE is 1 in PWM_features.h, else NULL)
2.21.3.1.2.12 FaultModeLatchEnable
void(* FaultModeLatchEnable) (enum PWM_GENERATOR genNum)
Pointer to PWM_FaultModeLatchEnable (Defined if PWM_FAULT_MODE_FEATURE_AVAILABLE is 1 in PWM_features.h, else NULL)
2.21.3.1.2.13 GeneratorDisable
void(* GeneratorDisable) (enum PWM_GENERATOR genNum)
Pointer to PWM_GeneratorDisable (Defined if PWM_GENERATOR_ENABLE_FEATURE_AVAILABLE is 1 in PWM_features.h, else NULL)
2.21.3.1.2.14 GeneratorEnable
void(* GeneratorEnable) (enum PWM_GENERATOR genNum)
Pointer to PWM_GeneratorEnable (Defined if PWM_GENERATOR_ENABLE_FEATURE_AVAILABLE is 1 in PWM_features.h, else NULL)
2.21.3.1.2.15 GeneratorEOCEventCallbackRegister
void(* GeneratorEOCEventCallbackRegister) (void(*callback)(enum PWM_GENERATOR genNum))
Pointer to PWM_GeneratorEOCEventCallbackRegister.
2.21.3.1.2.16 GeneratorEventStatusClear
void(* GeneratorEventStatusClear) (enum PWM_GENERATOR genNum, enum PWM_GENERATOR_INTERRUPT interrupt)
Pointer to PWM_GeneratorEventStatusClear.
2.21.3.1.2.17 GeneratorEventStatusGet
bool(* GeneratorEventStatusGet) (enum PWM_GENERATOR genNum, enum PWM_GENERATOR_INTERRUPT interrupt)
Pointer to PWM_GeneratorEventStatusGet.
2.21.3.1.2.18 GeneratorInterruptDisable
void(* GeneratorInterruptDisable) (enum PWM_GENERATOR genNum, enum PWM_GENERATOR_INTERRUPT interrupt)
Pointer to PWM_GeneratorInterruptDisable.
2.21.3.1.2.19 GeneratorInterruptEnable
void(* GeneratorInterruptEnable) (enum PWM_GENERATOR genNum, enum PWM_GENERATOR_INTERRUPT interrupt)
Pointer to PWM_GeneratorInterruptEnable.
2.21.3.1.2.20 GeneratorTasks
void(* GeneratorTasks) (enum PWM_GENERATOR intGen)
Pointer to PWM_GeneratorTasks (Supported only in polling mode)
2.21.3.1.2.21 Initialize
void(* Initialize) (void)
Pointer to PWM_Initialize.
2.21.3.1.2.22 MasterDutyCycleSet
void(* MasterDutyCycleSet) (uint16_t masterDutyCycle)
Pointer to PWM_MasterDutyCycleSet.
2.21.3.1.2.23 MasterPeriodSet
void(* MasterPeriodSet) (uint16_t period)
Pointer to PWM_MasterPeriodSet.
2.21.3.1.2.24 MasterPhaseSet
void(* MasterPhaseSet) (uint16_t masterPhase)
Pointer to PWM_MasterPhaseSet (Defined if PWM_GENERATOR_MASTER_PHASE_FEATURE_AVAILABLE is 1 in PWM_features.h, else NULL)
2.21.3.1.2.25 ModeSet
void(* ModeSet) (enum PWM_GENERATOR genNum, enum PWM_MODES mode)
Pointer to PWM_ModeSet.
2.21.3.1.2.26 OverrideDataGet
uint16_t(* OverrideDataGet) (enum PWM_GENERATOR genNum)
Pointer to PWM_OverrideDataGet.
2.21.3.1.2.27 OverrideDataHighSet
void(* OverrideDataHighSet) (enum PWM_GENERATOR genNum, bool overrideDataHigh)
Pointer to PWM_OverrideDataHighSet.
2.21.3.1.2.28 OverrideDataLowSet
void(* OverrideDataLowSet) (enum PWM_GENERATOR genNum, bool overrideDataLow)
Pointer to PWM_OverrideDataLowSet.
2.21.3.1.2.29 OverrideDataSet
void(* OverrideDataSet) (enum PWM_GENERATOR genNum, uint16_t overrideData)
Pointer to PWM_OverrideDataSet.
2.21.3.1.2.30 OverrideHighDisable
void(* OverrideHighDisable) (enum PWM_GENERATOR genNum)
Pointer to PWM_OverrideHighDisable.
2.21.3.1.2.31 OverrideHighEnable
void(* OverrideHighEnable) (enum PWM_GENERATOR genNum)
Pointer to PWM_OverrideHighEnable.
2.21.3.1.2.32 OverrideLowDisable
void(* OverrideLowDisable) (enum PWM_GENERATOR genNum)
Pointer to PWM_OverrideLowDisable.
2.21.3.1.2.33 OverrideLowEnable
void(* OverrideLowEnable) (enum PWM_GENERATOR genNum)
Pointer to PWM_OverrideLowEnable.
2.21.3.1.2.34 PeriodSet
void(* PeriodSet) (enum PWM_GENERATOR genNum, uint16_t period)
Pointer to PWM_PeriodSet.
2.21.3.1.2.35 PhaseSelect
void(* PhaseSelect) (enum PWM_GENERATOR genNum, enum PWM_SOURCE_SELECT source)
Pointer to PWM_PhaseSelect.
2.21.3.1.2.36 PhaseSet
void(* PhaseSet) (enum PWM_GENERATOR genNum, uint16_t phase)
Pointer to PWM_PhaseSet.
2.21.3.1.2.37 SoftwareUpdatePending
bool(* SoftwareUpdatePending) (enum PWM_GENERATOR genNum)
Pointer to PWM_SoftwareUpdatePending (Defined if PWM_SOFTWARE_UPDATE_FEATURE_AVAILABLE is 1 in PWM_features.h, else NULL)
2.21.3.1.2.38 SoftwareUpdateRequest
void(* SoftwareUpdateRequest) (enum PWM_GENERATOR genNum)
Pointer to PWM_SoftwareUpdateRequest (Defined if PWM_SOFTWARE_UPDATE_FEATURE_AVAILABLE is 1 in PWM_features.h, else NULL)
2.21.3.1.2.39 SpecialEventPrimaryCompareValueSet
void(* SpecialEventPrimaryCompareValueSet) (uint16_t compareValue)
Pointer to PWM_SpecialEventPrimaryCompareValueSet (Defined if PWM_SPECIAL_EVENT_FEATURE_AVAILABLE is 1 in PWM_features.h, else NULL)
2.21.3.1.2.40 SpecialEventPrimaryInterruptDisable
void(* SpecialEventPrimaryInterruptDisable) (void)
Pointer to PWM_SpecialEventPrimaryInterruptDisable (Defined if PWM_SPECIAL_EVENT_FEATURE_AVAILABLE is 1 in PWM_features.h, else NULL)
2.21.3.1.2.41 SpecialEventPrimaryInterruptEnable
void(* SpecialEventPrimaryInterruptEnable) (void)
Pointer to PWM_SpecialEventPrimaryInterruptEnable (Defined if PWM_SPECIAL_EVENT_FEATURE_AVAILABLE is 1 in PWM_features.h, else NULL)
2.21.3.1.2.42 SpecialEventTriggerInterruptFlagClear
void(* SpecialEventTriggerInterruptFlagClear) (void)
Pointer to PWM_SpecialEventTriggerInterruptFlagClear (Defined if PWM_SPECIAL_EVENT_FEATURE_AVAILABLE is 1 in PWM_features.h, else NULL)
2.21.3.1.2.43 Trigger1Disable
void(* Trigger1Disable) (enum PWM_GENERATOR genNum, enum PWM_TRIGGER_COMPARE compareRegister)
Pointer to PWM_Trigger1Disable (Defined if PWM_TRIGGER_ENABLE_FEATURE_AVAILABLE is 1 in PWM_features.h, else NULL)
2.21.3.1.2.44 Trigger1Enable
void(* Trigger1Enable) (enum PWM_GENERATOR genNum, enum PWM_TRIGGER_COMPARE compareRegister)
Pointer to PWM_Trigger1Enable (Defined if PWM_TRIGGER_ENABLE_FEATURE_AVAILABLE is 1 in PWM_features.h, else NULL)
2.21.3.1.2.45 Trigger2Disable
void(* Trigger2Disable) (enum PWM_GENERATOR genNum, enum PWM_TRIGGER_COMPARE compareRegister)
Pointer to PWM_Trigger2Disable (Defined if PWM_TRIGGER_ENABLE_FEATURE_AVAILABLE is 1 in PWM_features.h, else NULL)
2.21.3.1.2.46 Trigger2Enable
void(* Trigger2Enable) (enum PWM_GENERATOR genNum, enum PWM_TRIGGER_COMPARE compareRegister)
Pointer to PWM_Trigger2Enable (Defined if PWM_TRIGGER_ENABLE_FEATURE_AVAILABLE is 1 in PWM_features.h, else NULL)
2.21.3.1.2.47 TriggerACompareValueSet
void(* TriggerACompareValueSet) (enum PWM_GENERATOR genNum, uint16_t trigCompValue)
Pointer to PWM_TriggerACompareValueSet (Defined if PWM_MULTIPLE_TRIGGER_FEATURE_AVAILABLE is 1 in PWM_features.h, else NULL)
2.21.3.1.2.48 TriggerBCompareValueSet
void(* TriggerBCompareValueSet) (enum PWM_GENERATOR genNum, uint16_t trigCompValue)
Pointer to PWM_TriggerBCompareValueSet (Defined if PWM_MULTIPLE_TRIGGER_FEATURE_AVAILABLE is 1 in PWM_features.h, else NULL)
2.21.3.1.2.49 TriggerCCompareValueSet
void(* TriggerCCompareValueSet) (enum PWM_GENERATOR genNum, uint16_t trigCompValue)
Pointer to PWM_TriggerCCompareValueSet (Defined if PWM_MULTIPLE_TRIGGER_FEATURE_AVAILABLE is 1 in PWM_features.h, else NULL)
2.21.3.1.2.50 TriggerCompareValueSet
void(* TriggerCompareValueSet) (enum PWM_GENERATOR genNum, uint16_t trigCompValue)
Pointer to PWM_TriggerCompareValueSet.
2.21.4 File Documentation
2.21.4.1 source/pwm.h File Reference
This is the generated driver header file for the PWM driver.
#include <xc.h> #include <stdint.h> #include <stdbool.h> #include <stdlib.h> #include "pwm_hs_types.h" #include "pwm_hs_interface.h"
2.21.4.1.1 Functions
void PWM_Initialize (void)
Initializes PWM module, using the given initialization data.
void PWM_Deinitialize (void)
Deinitializes the PWM to POR values.
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_GeneratorDisable (enum PWM_GENERATOR genNum)
This inline function disables the specific PWM generator selected by the argument PWM_GENERATOR.
static void PWM_ModeSet (enum PWM_GENERATOR genNum, enum PWM_MODES mode)
This inline function sets the operating mode of specific PWM generator selected.
static void PWM_Enable (void)
This inline function will enable all the generators of PWM module.
static void PWM_Disable (void)
This inline function will disable all the generators of PWM module.
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_MasterDutyCycleSet (uint16_t masterDutyCycle)
This inline function sets the PWM master duty cycle register.
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_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_DutyCycleSet (enum PWM_GENERATOR genNum, uint16_t dutyCycle)
This inline function sets the PWM generator specific duty cycle register.
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_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 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 generator selected by the argument PWM_GENERATOR.
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 generator selected by the argument PWM_GENERATOR.
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 generator selected by the argument PWM_GENERATOR.
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_GENERATOR.
static void PWM_OverrideHighEnable (enum PWM_GENERATOR genNum)
This inline function enables PWM override on PWMH output for specific PWM generator selected by the argument PWM_GENERATOR.
static void PWM_OverrideLowEnable (enum PWM_GENERATOR genNum)
This inline function enables PWM override on PWML output for specific PWM generator selected by the argument PWM_GENERATOR.
static void PWM_OverrideHighDisable (enum PWM_GENERATOR genNum)
This inline function disables PWM override on PWMH output for specific PWM generator selected by the argument PWM_GENERATOR.
static void PWM_OverrideLowDisable (enum PWM_GENERATOR genNum)
This inline function disables PWM override on PWML output for specific PWM generator selected by the argument PWM_GENERATOR.
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 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 generator selected by the argument PWM_GENERATOR.
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 specific PWM generator selected by the argument PWM_GENERATOR.
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 the argument PWM_GENERATOR.
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_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_GENERATOR.
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 PWM_GENERATOR.
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_GENERATOR.
static void PWM_SoftwareUpdateRequest (enum PWM_GENERATOR genNum)
This inline function requests to update the data registers for specific PWM generator selected by the argument PWM_GENERATOR.
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 argument PWM_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 by the argument PWM_GENERATOR.
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 by the argument PWM_GENERATOR.
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 by the argument PWM_GENERATOR.
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 PWM_GENERATOR.
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 argument PWM_GENERATOR.
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 PWM_GENERATOR.
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 argument PWM_GENERATOR.
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 the argument PWM_GENERATOR.
void PWM_GeneratorEOCEventCallbackRegister (void(*callback)(enum PWM_GENERATOR genNum))
This function can be used to override default callback PWM_GeneratorEOCEventCallback and to define custom callback for PWM EOCEvent event.
void PWM_GeneratorEOCEventCallback (enum PWM_GENERATOR genNum)
This is the default callback with weak attribute. The user can override and implement the default callback without weak attribute or can register a custom callback function using PWM_EOCEventCallbackRegister.
void PWM_GeneratorTasks (enum PWM_GENERATOR intGen)
This is a tasks function for PWM1.
2.21.4.1.2 Variables
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 User interface.
2.21.4.1.3 Detailed Description
This is the generated driver header file for the PWM driver.
PWM Generated Driver Header File
2.21.4.2 source/pwm_features.h File Reference
This is the generated module feature header file for PWM driver. This file provides module feature list available on the selected device. The macros defined in this file provides the flexibility to easily migrate the user application to other device which might have varied feature list.
2.21.4.2.1 Macros
#define PWM_GENERATOR_MASTER_PHASE_FEATURE_AVAILABLE 1
This macro defines the PWM master phase feature availability in the PWM driver.
#define PWM_GENERATOR_ENABLE_FEATURE_AVAILABLE 1
This macro defines the PWM generator enable feature availability in the PWM driver.
#define PWM_SOFTWARE_UPDATE_FEATURE_AVAILABLE 1
This macro defines the PWM data update request feature availability in the PWM driver.
#define PWM_FAULT_LATCH_SOFTWARE_CLEAR_FEATURE_AVAILABLE 1
This macro defines the PWM fault latch clear through software feature availability in the PWM driver.
#define PWM_MULTIPLE_TRIGGER_FEATURE_AVAILABLE 1
This macro defines the PWM multiple trigger feature availability in the PWM driver.
#define PWM_TRIGGER_ENABLE_FEATURE_AVAILABLE 1
This macro defines the PWM multiple trigger enable availability in the PWM driver.
#define PWM_SPECIAL_EVENT_FEATURE_AVAILABLE 0
This macro defines the PWM special event trigger feature availability in the PWM driver.
#define PWM_FAULT_MODE_ENABLE_FEATURE_AVAILABLE 0
This macro defines the PWM fault mode enable and disable feature availability in the PWM driver.
2.21.4.2.2 Detailed Description
This is the generated module feature header file for PWM driver. This file provides module feature list available on the selected device. The macros defined in this file provides the flexibility to easily migrate the user application to other device which might have varied feature list.
PWM Generated Feature Header File
The content in this file is strictly "read only" and should not be altered
2.21.4.3 source/pwm_hs_interface.h File Reference
#include <stdbool.h> #include <stdint.h> #include "pwm_hs_types.h"
2.21.4.3.1 Data structures
struct PWM_HS_INTERFACE
Structure containing the function pointers of PWM driver.
2.21.4.3.2 Detailed Description
PWM Generated Driver Interface Header File
2.21.4.4 source/pwm_hs_types.h File Reference
This is the generated driver types header file for the PWM driver.
2.21.4.4.1 Enumerations
enum PWM_GENERATOR { PWM_GENERATOR_1 = 1, PWM_MAX_GENERATOR }
Defines the PWM generators that are selected from the MCC Melody User Interface for the PWM output controls. Note: The enum list in the Help document might be just an illustration to show the selected PWM channel list Generated enum list is based on the configuration done by user in the MCC Melody user interface.
enum PWM_GENERATOR_INTERRUPT { PWM_GENERATOR_INTERRUPT_FAULT = 1, PWM_GENERATOR_INTERRUPT_CURRENT_LIMIT = 2, PWM_GENERATOR_INTERRUPT_FEED_FORWARD = 3, PWM_GENERATOR_INTERRUPT_SYNC = 4 }
Defines the PWM generator interrupts that are available for the module to use.
enum PWM_COMMON_EVENT { PWM_EVENT_A = 1, PWM_EVENT_B = 2, PWM_EVENT_C = 3, PWM_EVENT_D = 4, PWM_EVENT_E = 5, PWM_EVENT_F = 6 }
Defines the PWM generator Common Events that are available for the module to use.
enum PWM_TRIGGER_COMPARE { PWM_TRIGGER_COMPARE_A = 1, PWM_TRIGGER_COMPARE_B = 2, PWM_TRIGGER_COMPARE_C = 3 }
Defines the PWM generator Trigger Compare registers that are available for the module to use.
enum PWM_MODES { PWM_MODE_INDEPENDENT_EDGE = 0x0, PWM_MODE_VARIABLE_PHASE = 0x1, PWM_MODE_INDEPENDENT_EDGE_DUAL_OUTPUT = 0x2, PWM_MODE_CENTER_ALIGNED = 0x4, PWM_MODE_DOUBLE_UPDATE_CENTER_ALIGNED = 0x5, PWM_MODE_DUAL_EDGE_CENTER_ALIGNED_ONE_UPDATE_CYCLE = 0x6, PWM_MODE_DUAL_EDGE_CENTER_ALIGNED_TWO_UPDATES_CYCLE = 0x7 }
Defines the PWM generator operating modes that are available.
enum PWM_SOURCE_SELECT { PWM_SOURCE_SELECT_INDEPENDENT = 0, PWM_SOURCE_SELECT_MASTER = 1 }
2.21.4.4.2 Detailed Description
This is the generated driver types header file for the PWM driver.
PWM Generated Driver Types Header File
2.21.4.4.3 Enumeration Type Documentation
2.21.4.4.3.1 PWM_SOURCE_SELECT
enum PWM_SOURCE_SELECT
PWM_SOURCE_SELECT_INDEPENDENT |
PWM select Independent PWM as source |
PWM_SOURCE_SELECT_MASTER |
PWM select Master as source |