3.18 WEX - Waveform Extension
3.18.1 Introduction
The Waveform Extension (WEX) provides extra functions to the timer/counter in Waveform Generation (WG) modes. It is primarily intended for use in different types of motor control and other power control applications.
3.18.2 Supported Device Families
AVR® EB |
3.18.3 Required header files:
#include "mcc_generated_files/timer/wex[X].h"
3.18.4 Module Documentation
3.18.4.1 Waveform Extension for the 16-Bit Timer/Counter Type E (WEX)
3.18.4.1.1 Module description
WEX0 Driver Version 1.0.1 |
© 2024 Microchip Technology Inc. and its subsidiaries. |
Subject to your compliance with these terms, you may use Microchip software and any derivatives exclusively with Microchip products. You're responsible for complying with 3rd party license terms applicable to your use of 3rd party software (including open source software) that may accompany Microchip software.
SOFTWARE IS "AS IS." NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, APPLY TO THIS SOFTWARE, INCLUDING ANY IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.
IN NO EVENT WILL MICROCHIP BE LIABLE FOR ANY INDIRECT, SPECIAL, PUNITIVE, INCIDENTAL OR CONSEQUENTIAL LOSS, DAMAGE, COST OR EXPENSE OF ANY KIND WHATSOEVER RELATED TO THE SOFTWARE, HOWEVER CAUSED, EVEN IF MICROCHIP HAS BEEN ADVISED OF THE POSSIBILITY OR THE DAMAGES ARE FORESEEABLE. TO THE FULLEST EXTENT ALLOWED BY LAW, MICROCHIP'S TOTAL LIABILITY ON ALL CLAIMS RELATED TO THE SOFTWARE WILL NOT EXCEED AMOUNT OF FEES, IF ANY, YOU PAID DIRECTLY TO MICROCHIP FOR THIS SOFTWARE.
Typedefs
typedef void(* WEX0_cb_t) (void)
Pointer to a function to be used as a callback handler when an interrupt event occurs.
Definitions
#define WEX0_NS_TO_TICKS(VALUE, F_CLOCK, WEX_PRESCALER) (uint8_t)( (float)(VALUE) / ( (1000000000.0 / (F_CLOCK) ) * (WEX_PRESCALER) ) + 0.5)
Converts from nanoseconds to clock increments. Used for setting the dead-time or blanking time.
Functions
-
Interrupt Service Routine (ISR) for the Fault Interrupt.
void WEX0_FAULTIsrCallbackRegister (WEX0_cb_t callback)
Sets the Fault Interrupt callback for the WEX0 module.
void WEX0_Initialize (void)
Initializes the WEX0 module.
void WEX0_Deinitialize (void)
Deinitializes the WEX0 module.
uint8_t WEX0_StatusRegisterGet (void)
Gets the status of the WEX0's blanking or fault detection.
void WEX0_PatternGenerationMode (bool mode)
Enables or disables the Pattern Generation mode of the WEX0 module.
bool WEX0_IsPatternGenerationSet (void)
Returns the Pattern Generation mode status of the WEX0 module.
void WEX0_InputMatrixSet (WEX_INMX_t config)
Selects the Input Matrix mode of the WEX0 module.
void WEX0_DeadTimeInsertionSet (uint8_t channels)
Enables the dead-time insertion on each of the Waveform Output channels.
void WEX0_UpdateSourceSet (WEX_UPDSRC_t config)
Selects the update source for the WEX0 module.
void WEX0_SoftwareCommand (WEX_CMD_t command)
Sends software commands to the WEX0 module.
void WEX0_FaultAEventFilter (WEX_FILTER_t samples)
Sets the Fault Event A Filter for the WEX0 module.
void WEX0_FaultAEventBlankingEnable (bool en)
Enables or disables Fault Event Blanking A for the WEX0 module.
void WEX0_FaultAEventInputEnable (bool en)
Enables or disables Fault Event Input A for the WEX0 module.
void WEX0_FaultBEventFilter (WEX_FILTER_t samples)
Sets the Fault Event B Filter for the WEX0 module.
void WEX0_FaultBEventBlankingEnable (bool en)
Enables or disables Fault Event Blanking B for the WEX0 module.
void WEX0_FaultBEventInputEnable (bool en)
Enables or disables Fault Event Input B for the WEX0 module.
void WEX0_FaultCEventFilter (WEX_FILTER_t samples)
Sets the Fault Event C Filter for the WEX0 module.
void WEX0_FaultCEventBlankingEnable (bool en)
Enables or disables Fault Event Blanking C for the WEX0 module.
void WEX0_FaultCEventInputEnable (bool en)
Enables or disables Fault Event Input C for the WEX0 module.
void WEX0_BlankingPrescaler (WEX_BLANKPRESC_t prescaler)
Sets the Blanking Prescaler for the WEX0 module.
void WEX0_BlankingTrigger (WEX_BLANKTRIG_t trig)
Sets the Blanking Trigger source for the WEX0 module.
void WEX0_BlankingTimeSet (uint8_t cnt)
Sets the Blanking Time for the WEX0 module.
uint8_t WEX0_BlankingTimeGet (void)
Gets the Blanking Time for the WEX0 module.
void WEX0_FaultDetectionDebugBreak (WEX_FDDBD_t mode)
Sets the Fault Detection on Debug Break Detection for the WEX0 module.
void WEX0_FaultDetectionRestartMode (WEX_FDMODE_t mode)
Sets the Fault Detection Restart Mode for the WEX0 module.
void WEX0_FaultDetectionAction (WEX_FDACT_t action)
Sets the Fault Detection Action for the WEX0 module.
void WEX0_FaultDriveSet (uint8_t channels)
Sets if an output channel is tri-stated or overwritten by the custom fault value defined by the user in case a fault is detected.
void WEX0_FaultOutputSet (uint8_t channels)
Sets the output values of the channels in case of a fault detection.
void WEX0_FaultEnable (void)
Enables the Fault Interrupt on the WEX0 module.
bool WEX0_IsFaultEnabled (void)
Returns the status of the Fault Interrupt on the WEX0 module.
void WEX0_FaultDisable (void)
Disables the Fault Interrupt on the WEX0 module.
void WEX0_FaultFlagsClear (uint8_t flags)
Clears interrupt flags on the WEX0 module.
uint8_t WEX0_FaultFlagsGet (void)
Returns the interrupt flags on the WEX0 module.
void WEX0_DeadTimeLowSideSet (uint8_t cnt)
Sets the dead-time on the low side of the output channels on the WEX0 module.
void WEX0_DeadTimeHighSideSet (uint8_t cnt)
Sets the dead-time on the high side of the output channels on the WEX0 module.
void WEX0_DeadTimeBothSidesSet (uint8_t cnt)
Sets the dead-time on both sides of the side output channels on the WEX0 module.
void WEX0_SwapChannelSet (uint8_t channels)
Sets which pair channels will have the output swapped (output [2n] with output [2n+1]) on the WEX0 module.
void WEX0_PatternGenerationOverrideSet (uint8_t channels)
Sets which channels will have the output overridden by the Pattern Generation Mode on the WEX0 module.
void WEX0_PatternGenerationOutputSet (uint8_t channels)
Sets the output values of the channels in the Pattern Generation Mode on the WEX0 module.
void WEX0_OutputOverrideEnable (uint8_t channels)
Enables or disables the output override on the WEX0 module.
void WEX0_DeadTimeLowSideBufferSet (uint8_t buff)
Sets the dead-time on the low side of the output channels using a buffer register on the WEX0 module.
void WEX0_DeadTimeHighSideBufferSet (uint8_t buff)
Sets the dead-time on the high side of the output channels using a buffer register on the WEX0 module.
void WEX0_DeadTimeBothSidesBufferSet (uint8_t buff)
Sets the dead-time on both sides of the output channels using a buffer register on the WEX0 module.
void WEX0_SwapChannelBufferSet (uint8_t buff)
Sets which pair channels will have the output swapped (output [2n] with output [2n+1]) using a buffer register on the WEX0 module.
void WEX0_PatternGenerationOverrideBufferSet (uint8_t buff)
Sets which channels will have the output overridden by the Pattern Generation Mode using a buffer register on the WEX0 module.
void WEX0_PatternGenerationOutputBufferSet (uint8_t buff)
Sets the output values of the channels in the Pattern Generation Mode using a buffer register on the WEX0 module.
Variables
static WEX0_cb_t WEX0_FAULT_isr_cb = NULL
Function pointer that stores the callback address.
3.18.4.1.2 Definition Documentation
WEX0_NS_TO_TICKS
#define WEX0_NS_TO_TICKS( VALUE, F_CLOCK, WEX_PRESCALER) (uint8_t)( (float)(VALUE) / ( (1000000000.0 / (F_CLOCK) ) * (WEX_PRESCALER) ) + 0.5)
Converts from nanoseconds to clock increments. Used for setting the dead-time or blanking time.
-
VALUE must be a constant number rather than a variable
-
F_CLOCK is the WEX Peripheral Clock Frequency
-
WEX_PRESCALER can be 1, 2, 4, 8, 16, 64, 256, or 1024
3.18.4.1.3 Typedef Documentation
WEX0_cb_t
typedef void(* WEX0_cb_t) (void)
Pointer to a function to be used as a callback handler when an interrupt event occurs.
3.18.4.1.4 Function Documentation
ISR(WEX0_FAULTDET_vect)
ISR(WEX0_FAULTDET_vect)
Interrupt Service Routine (ISR) for the Fault Interrupt.
None. |
None. |
WEX0_BlankingPrescaler()
void WEX0_BlankingPrescaler (WEX_BLANKPRESC_t prescaler)
Sets the Blanking Prescaler for the WEX0 module.
in | prescaler |
Prescaler:
|
None. |
WEX0_BlankingTimeGet()
uint8_t WEX0_BlankingTimeGet (void )
Gets the Blanking Time for the WEX0 module.
None. |
Blanking Time in clock cycles |
WEX0_BlankingTimeSet()
void WEX0_BlankingTimeSet (uint8_t cnt)
Sets the Blanking Time for the WEX0 module.
in | cnt |
Blanking Time in clock cycles |
None. |
WEX0_BlankingTrigger()
void WEX0_BlankingTrigger (WEX_BLANKTRIG_t trig)
Sets the Blanking Trigger source for the WEX0 module.
in | trig |
Blanking Trigger:
|
None. |
WEX0_DeadTimeBothSidesBufferSet()
void WEX0_DeadTimeBothSidesBufferSet (uint8_t buff)
Sets the dead-time on both sides of the output channels using a buffer register on the WEX0 module.
in | buff |
Dead-time in clock cycles |
None. |
WEX0_DeadTimeBothSidesSet()
void WEX0_DeadTimeBothSidesSet (uint8_t cnt)
Sets the dead-time on both sides of the side output channels on the WEX0 module.
in | cnt |
Dead-time in clock cycles |
None. |
WEX0_DeadTimeHighSideBufferSet()
void WEX0_DeadTimeHighSideBufferSet (uint8_t buff)
Sets the dead-time on the high side of the output channels using a buffer register on the WEX0 module.
in | buff |
Dead-time in clock cycles |
None. |
WEX0_DeadTimeHighSideSet()
void WEX0_DeadTimeHighSideSet (uint8_t cnt)
Sets the dead-time on the high side of the output channels on the WEX0 module.
in | cnt |
Dead-time in clock cycles |
None. |
WEX0_DeadTimeInsertionSet()
void WEX0_DeadTimeInsertionSet (uint8_t channels)
Enables the dead-time insertion on each of the Waveform Output channels.
in | channels |
Bitmask value for the channels |
None. |
WEX0_DeadTimeLowSideBufferSet()
void WEX0_DeadTimeLowSideBufferSet (uint8_t buff)
Sets the dead-time on the low side of the output channels using a buffer register on the WEX0 module.
in | buff |
Dead-time in clock cycles |
None. |
WEX0_DeadTimeLowSideSet()
void WEX0_DeadTimeLowSideSet (uint8_t cnt)
Sets the dead-time on the low side of the output channels on the WEX0 module.
in | cnt |
Dead-time in clock cycles |
None. |
WEX0_Deinitialize()
void WEX0_Deinitialize (void )
Deinitializes the WEX0 module.
None. |
None. |
WEX0_FaultAEventBlankingEnable()
void WEX0_FaultAEventBlankingEnable (bool en)
Enables or disables Fault Event Blanking A for the WEX0 module.
in | en |
Enable or disable:
|
None. |
WEX0_FaultAEventFilter()
void WEX0_FaultAEventFilter (WEX_FILTER_t samples)
Sets the Fault Event A Filter for the WEX0 module.
in | samples |
Number of samples:
|
None. |
WEX0_FaultAEventInputEnable()
void WEX0_FaultAEventInputEnable (bool en)
Enables or disables Fault Event Input A for the WEX0 module.
in | en |
Enable or disable:
|
None. |
WEX0_FaultBEventBlankingEnable()
void WEX0_FaultBEventBlankingEnable (bool en)
Enables or disables Fault Event Blanking B for the WEX0 module.
in | en |
Enable or disable:
|
None. |
WEX0_FaultBEventFilter()
void WEX0_FaultBEventFilter (WEX_FILTER_t samples)
Sets the Fault Event B Filter for the WEX0 module.
in | samples |
Number of samples:
|
None. |
WEX0_FaultBEventInputEnable()
void WEX0_FaultBEventInputEnable (bool en)
Enables or disables Fault Event Input B for the WEX0 module.
in | en |
Enable or disable:
|
None. |
WEX0_FaultCEventBlankingEnable()
void WEX0_FaultCEventBlankingEnable (bool en)
Enables or disables Fault Event Blanking C for the WEX0 module.
in | en |
Enable or disable:
|
None. |
WEX0_FaultCEventFilter()
void WEX0_FaultCEventFilter (WEX_FILTER_t samples)
Sets the Fault Event C Filter for the WEX0 module.
in | samples |
Number of samples:
|
None. |
WEX0_FaultCEventInputEnable()
void WEX0_FaultCEventInputEnable (bool en)
Enables or disables Fault Event Input C for the WEX0 module.
in | en |
Enable or disable:
|
None. |
WEX0_FaultDetectionAction()
void WEX0_FaultDetectionAction (WEX_FDACT_t action)
Sets the Fault Detection Action for the WEX0 module.
in | action |
Action:
|
None. |
WEX0_FaultDetectionDebugBreak()
void WEX0_FaultDetectionDebugBreak (WEX_FDDBD_t mode)
Sets the Fault Detection on Debug Break Detection for the WEX0 module.
in | mode |
Mode:
|
None. |
WEX0_FaultDetectionRestartMode()
void WEX0_FaultDetectionRestartMode (WEX_FDMODE_t mode)
Sets the Fault Detection Restart Mode for the WEX0 module.
in | mode |
Mode:
|
None. |
WEX0_FaultDisable()
void WEX0_FaultDisable (void )
Disables the Fault Interrupt on the WEX0 module.
None. |
None. |
WEX0_FaultDriveSet()
void WEX0_FaultDriveSet (uint8_t channels)
Sets if an output channel is tri-stated or overwritten by the custom fault value defined by the user in case a fault is detected.
in | channels |
Bitmask value for the channels |
None. |
WEX0_FaultEnable()
void WEX0_FaultEnable (void )
Enables the Fault Interrupt on the WEX0 module.
None. |
None. |
WEX0_FaultFlagsClear()
void WEX0_FaultFlagsClear (uint8_t flags)
Clears interrupt flags on the WEX0 module.
in | flags |
Bitmask value for the channels |
None. |
WEX0_FaultFlagsGet()
uint8_t WEX0_FaultFlagsGet (void )
Returns the interrupt flags on the WEX0 module.
None. |
Interrupt flag status:
|
WEX0_FAULTIsrCallbackRegister()
void WEX0_FAULTIsrCallbackRegister (WEX0_cb_t callback)
Sets the Fault Interrupt callback for the WEX0 module.
in | callback |
Pointer to custom callback |
None. |
WEX0_FaultOutputSet()
void WEX0_FaultOutputSet (uint8_t channels)
Sets the output values of the channels in case of a fault detection.
in | channels |
Bitmask value for the channels |
None. |
WEX0_Initialize()
void WEX0_Initialize (void )
Initializes the WEX0 module.
None. |
None. |
WEX0_InputMatrixSet()
void WEX0_InputMatrixSet (WEX_INMX_t config)
Selects the Input Matrix mode of the WEX0 module.
in | config |
Input Matrix:
|
None. |
WEX0_IsFaultEnabled()
bool WEX0_IsFaultEnabled (void )
Returns the status of the Fault Interrupt on the WEX0 module.
None. |
bool Whether the fault is enabled or not |
true |
Fault interrupt is enabled |
false |
Fault interrupt is disabled |
WEX0_IsPatternGenerationSet()
bool WEX0_IsPatternGenerationSet (void )
Returns the Pattern Generation mode status of the WEX0 module.
None. |
Whaether the Pattern Generation mode is enabled or not |
true |
Pattern Generation mode is enabled |
false |
Pattern Generation mode is disabled |
WEX0_OutputOverrideEnable()
void WEX0_OutputOverrideEnable (uint8_t channels)
Enables or disables the output override on the WEX0 module.
in | channels |
Bitmask value for the channels |
None. |
WEX0_PatternGenerationMode()
void WEX0_PatternGenerationMode (bool mode)
Enables or disables the Pattern Generation mode of the WEX0 module.
in | mode |
Enable or disable:
|
None. |
WEX0_PatternGenerationOutputBufferSet()
void WEX0_PatternGenerationOutputBufferSet (uint8_t buff)
Sets the output values of the channels in the Pattern Generation Mode using a buffer register on the WEX0 module.
in | buff |
Bitmask value for the channels |
None. |
WEX0_PatternGenerationOutputSet()
void WEX0_PatternGenerationOutputSet (uint8_t channels)
Sets the output values of the channels in the Pattern Generation Mode on the WEX0 module.
in | channels |
Bitmask value for the channels |
None. |
WEX0_PatternGenerationOverrideBufferSet()
void WEX0_PatternGenerationOverrideBufferSet (uint8_t buff)
Sets which channels will have the output overridden by the Pattern Generation Mode using a buffer register on the WEX0 module.
in | buff |
Bitmask value for the channels |
None. |
WEX0_PatternGenerationOverrideSet()
void WEX0_PatternGenerationOverrideSet (uint8_t channels)
Sets which channels will have the output overridden by the Pattern Generation Mode on the WEX0 module.
in | channels |
Bitmask value for the channels |
None. |
WEX0_SoftwareCommand()
void WEX0_SoftwareCommand (WEX_CMD_t command)
Sends software commands to the WEX0 module.
in | command |
Command:
|
None. |
WEX0_StatusRegisterGet()
uint8_t WEX0_StatusRegisterGet (void )
Gets the status of the WEX0's blanking or fault detection.
None. |
The current status |
WEX0_SwapChannelBufferSet()
void WEX0_SwapChannelBufferSet (uint8_t buff)
Sets which pair channels will have the output swapped (output [2n] with output [2n+1]) using a buffer register on the WEX0 module.
in | buff |
Bitmask value for the channels |
None. |
WEX0_SwapChannelSet()
void WEX0_SwapChannelSet (uint8_t channels)
Sets which pair channels will have the output swapped (output [2n] with output [2n+1]) on the WEX0 module.
in | channels |
Bitmask value for the channels |
None. |
WEX0_UpdateSourceSet()
void WEX0_UpdateSourceSet (WEX_UPDSRC_t config)
Selects the update source for the WEX0 module.
in | config |
Update Source:
|
None. |
3.18.4.1.5 Variable Documentation
WEX0_FAULT_isr_cb
WEX0_cb_t WEX0_FAULT_isr_cb = NULL[static]
Function pointer that stores the callback address.
3.18.5 File Documentation
3.18.5.1 source/wex0.c File Reference
Waveform Extension Driver API Header File.
#include "wex0.h" #include <stddef.h> #include <avr/interrupt.h> #include <util/atomic.h>
3.18.5.1.1 Functions
-
Interrupt Service Routine (ISR) for the Fault Interrupt.
void WEX0_FAULTIsrCallbackRegister (WEX0_cb_t callback)
Sets the Fault Interrupt callback for the WEX0 module.
void WEX0_Initialize (void)
Initializes the WEX0 module.
void WEX0_Deinitialize (void)
Deinitializes the WEX0 module.
uint8_t WEX0_StatusRegisterGet (void)
Gets the status of the WEX0's blanking or fault detection.
void WEX0_PatternGenerationMode (bool mode)
Enables or disables the Pattern Generation mode of the WEX0 module.
bool WEX0_IsPatternGenerationSet (void)
Returns the Pattern Generation mode status of the WEX0 module.
void WEX0_InputMatrixSet (WEX_INMX_t config)
Selects the Input Matrix mode of the WEX0 module.
void WEX0_DeadTimeInsertionSet (uint8_t channels)
Enables the dead-time insertion on each of the Waveform Output channels.
void WEX0_UpdateSourceSet (WEX_UPDSRC_t config)
Selects the update source for the WEX0 module.
void WEX0_SoftwareCommand (WEX_CMD_t command)
Sends software commands to the WEX0 module.
void WEX0_FaultAEventFilter (WEX_FILTER_t samples)
Sets the Fault Event A Filter for the WEX0 module.
void WEX0_FaultAEventBlankingEnable (bool en)
Enables or disables Fault Event Blanking A for the WEX0 module.
void WEX0_FaultAEventInputEnable (bool en)
Enables or disables Fault Event Input A for the WEX0 module.
void WEX0_FaultBEventFilter (WEX_FILTER_t samples)
Sets the Fault Event B Filter for the WEX0 module.
void WEX0_FaultBEventBlankingEnable (bool en)
Enables or disables Fault Event Blanking B for the WEX0 module.
void WEX0_FaultBEventInputEnable (bool en)
Enables or disables Fault Event Input B for the WEX0 module.
void WEX0_FaultCEventFilter (WEX_FILTER_t samples)
Sets the Fault Event C Filter for the WEX0 module.
void WEX0_FaultCEventBlankingEnable (bool en)
Enables or disables Fault Event Blanking C for the WEX0 module.
void WEX0_FaultCEventInputEnable (bool en)
Enables or disables Fault Event Input C for the WEX0 module.
void WEX0_BlankingPrescaler (WEX_BLANKPRESC_t prescaler)
Sets the Blanking Prescaler for the WEX0 module.
void WEX0_BlankingTrigger (WEX_BLANKTRIG_t trig)
Sets the Blanking Trigger source for the WEX0 module.
void WEX0_BlankingTimeSet (uint8_t cnt)
Sets the Blanking Time for the WEX0 module.
uint8_t WEX0_BlankingTimeGet (void)
Gets the Blanking Time for the WEX0 module.
void WEX0_FaultDetectionDebugBreak (WEX_FDDBD_t mode)
Sets the Fault Detection on Debug Break Detection for the WEX0 module.
void WEX0_FaultDetectionRestartMode (WEX_FDMODE_t mode)
Sets the Fault Detection Restart Mode for the WEX0 module.
void WEX0_FaultDetectionAction (WEX_FDACT_t action)
Sets the Fault Detection Action for the WEX0 module.
void WEX0_FaultDriveSet (uint8_t channels)
Sets if an output channel is tri-stated or overwritten by the custom fault value defined by the user in case a fault is detected.
void WEX0_FaultOutputSet (uint8_t channels)
Sets the output values of the channels in case of a fault detection.
void WEX0_FaultEnable (void)
Enables the Fault Interrupt on the WEX0 module.
bool WEX0_IsFaultEnabled (void)
Returns the status of the Fault Interrupt on the WEX0 module.
void WEX0_FaultDisable (void)
Disables the Fault Interrupt on the WEX0 module.
void WEX0_FaultFlagsClear (uint8_t flags)
Clears interrupt flags on the WEX0 module.
uint8_t WEX0_FaultFlagsGet (void)
Returns the interrupt flags on the WEX0 module.
void WEX0_DeadTimeLowSideSet (uint8_t cnt)
Sets the dead-time on the low side of the output channels on the WEX0 module.
void WEX0_DeadTimeHighSideSet (uint8_t cnt)
Sets the dead-time on the high side of the output channels on the WEX0 module.
void WEX0_DeadTimeBothSidesSet (uint8_t cnt)
Sets the dead-time on both sides of the side output channels on the WEX0 module.
void WEX0_SwapChannelSet (uint8_t channels)
Sets which pair channels will have the output swapped (output [2n] with output [2n+1]) on the WEX0 module.
void WEX0_PatternGenerationOverrideSet (uint8_t channels)
Sets which channels will have the output overridden by the Pattern Generation Mode on the WEX0 module.
void WEX0_PatternGenerationOutputSet (uint8_t channels)
Sets the output values of the channels in the Pattern Generation Mode on the WEX0 module.
void WEX0_OutputOverrideEnable (uint8_t channels)
Enables or disables the output override on the WEX0 module.
void WEX0_DeadTimeLowSideBufferSet (uint8_t buff)
Sets the dead-time on the low side of the output channels using a buffer register on the WEX0 module.
void WEX0_DeadTimeHighSideBufferSet (uint8_t buff)
Sets the dead-time on the high side of the output channels using a buffer register on the WEX0 module.
void WEX0_DeadTimeBothSidesBufferSet (uint8_t buff)
Sets the dead-time on both sides of the output channels using a buffer register on the WEX0 module.
void WEX0_SwapChannelBufferSet (uint8_t buff)
Sets which pair channels will have the output swapped (output [2n] with output [2n+1]) using a buffer register on the WEX0 module.
void WEX0_PatternGenerationOverrideBufferSet (uint8_t buff)
Sets which channels will have the output overridden by the Pattern Generation Mode using a buffer register on the WEX0 module.
void WEX0_PatternGenerationOutputBufferSet (uint8_t buff)
Sets the output values of the channels in the Pattern Generation Mode using a buffer register on the WEX0 module.
3.18.5.1.2 Variables
static WEX0_cb_t WEX0_FAULT_isr_cb = NULL
Function pointer that stores the callback address.
3.18.5.1.3 Detailed Description
Waveform Extension Driver API Header File.
WEX0 Driver Version 1.0.1 |
© 2024 Microchip Technology Inc. and its subsidiaries. |
Subject to your compliance with these terms, you may use Microchip software and any derivatives exclusively with Microchip products. You're responsible for complying with 3rd party license terms applicable to your use of 3rd party software (including open source software) that may accompany Microchip software.
SOFTWARE IS "AS IS." NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, APPLY TO THIS SOFTWARE, INCLUDING ANY IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.
IN NO EVENT WILL MICROCHIP BE LIABLE FOR ANY INDIRECT, SPECIAL, PUNITIVE, INCIDENTAL OR CONSEQUENTIAL LOSS, DAMAGE, COST OR EXPENSE OF ANY KIND WHATSOEVER RELATED TO THE SOFTWARE, HOWEVER CAUSED, EVEN IF MICROCHIP HAS BEEN ADVISED OF THE POSSIBILITY OR THE DAMAGES ARE FORESEEABLE. TO THE FULLEST EXTENT ALLOWED BY LAW, MICROCHIP'S TOTAL LIABILITY ON ALL CLAIMS RELATED TO THE SOFTWARE WILL NOT EXCEED AMOUNT OF FEES, IF ANY, YOU PAID DIRECTLY TO MICROCHIP FOR THIS SOFTWARE.
3.18.5.2 source/wex0.h File Reference
Waveform Extension Driver API Header File.
#include <stdbool.h> #include <stdint.h> #include <avr/io.h>
3.18.5.2.1 Functions
void WEX0_FAULTIsrCallbackRegister (WEX0_cb_t callback)
Sets the Fault Interrupt callback for the WEX0 module.
void WEX0_Initialize (void)
Initializes the WEX0 module.
void WEX0_Deinitialize (void)
Deinitializes the WEX0 module.
uint8_t WEX0_StatusRegisterGet (void)
Gets the status of the WEX0's blanking or fault detection.
void WEX0_PatternGenerationMode (bool mode)
Enables or disables the Pattern Generation mode of the WEX0 module.
bool WEX0_IsPatternGenerationSet (void)
Returns the Pattern Generation mode status of the WEX0 module.
void WEX0_InputMatrixSet (WEX_INMX_t config)
Selects the Input Matrix mode of the WEX0 module.
void WEX0_DeadTimeInsertionSet (uint8_t channels)
Enables the dead-time insertion on each of the Waveform Output channels.
void WEX0_UpdateSourceSet (WEX_UPDSRC_t config)
Selects the update source for the WEX0 module.
void WEX0_SoftwareCommand (WEX_CMD_t command)
Sends software commands to the WEX0 module.
void WEX0_FaultAEventFilter (WEX_FILTER_t samples)
Sets the Fault Event A Filter for the WEX0 module.
void WEX0_FaultAEventBlankingEnable (bool en)
Enables or disables Fault Event Blanking A for the WEX0 module.
void WEX0_FaultAEventInputEnable (bool en)
Enables or disables Fault Event Input A for the WEX0 module.
void WEX0_FaultBEventFilter (WEX_FILTER_t samples)
Sets the Fault Event B Filter for the WEX0 module.
void WEX0_FaultBEventBlankingEnable (bool en)
Enables or disables Fault Event Blanking B for the WEX0 module.
void WEX0_FaultBEventInputEnable (bool en)
Enables or disables Fault Event Input B for the WEX0 module.
void WEX0_FaultCEventFilter (WEX_FILTER_t samples)
Sets the Fault Event C Filter for the WEX0 module.
void WEX0_FaultCEventBlankingEnable (bool en)
Enables or disables Fault Event Blanking C for the WEX0 module.
void WEX0_FaultCEventInputEnable (bool en)
Enables or disables Fault Event Input C for the WEX0 module.
void WEX0_BlankingPrescaler (WEX_BLANKPRESC_t prescaler)
Sets the Blanking Prescaler for the WEX0 module.
void WEX0_BlankingTrigger (WEX_BLANKTRIG_t trig)
Sets the Blanking Trigger source for the WEX0 module.
void WEX0_BlankingTimeSet (uint8_t cnt)
Sets the Blanking Time for the WEX0 module.
uint8_t WEX0_BlankingTimeGet (void)
Gets the Blanking Time for the WEX0 module.
void WEX0_FaultDetectionDebugBreak (WEX_FDDBD_t mode)
Sets the Fault Detection on Debug Break Detection for the WEX0 module.
void WEX0_FaultDetectionRestartMode (WEX_FDMODE_t mode)
Sets the Fault Detection Restart Mode for the WEX0 module.
void WEX0_FaultDetectionAction (WEX_FDACT_t action)
Sets the Fault Detection Action for the WEX0 module.
void WEX0_FaultDriveSet (uint8_t channels)
Sets if an output channel is tri-stated or overwritten by the custom fault value defined by the user in case a fault is detected.
void WEX0_FaultOutputSet (uint8_t channels)
Sets the output values of the channels in case of a fault detection.
void WEX0_FaultEnable (void)
Enables the Fault Interrupt on the WEX0 module.
bool WEX0_IsFaultEnabled (void)
Returns the status of the Fault Interrupt on the WEX0 module.
void WEX0_FaultDisable (void)
Disables the Fault Interrupt on the WEX0 module.
void WEX0_FaultFlagsClear (uint8_t flags)
Clears interrupt flags on the WEX0 module.
uint8_t WEX0_FaultFlagsGet (void)
Returns the interrupt flags on the WEX0 module.
void WEX0_DeadTimeLowSideSet (uint8_t cnt)
Sets the dead-time on the low side of the output channels on the WEX0 module.
void WEX0_DeadTimeHighSideSet (uint8_t cnt)
Sets the dead-time on the high side of the output channels on the WEX0 module.
void WEX0_DeadTimeBothSidesSet (uint8_t cnt)
Sets the dead-time on both sides of the side output channels on the WEX0 module.
void WEX0_SwapChannelSet (uint8_t channels)
Sets which pair channels will have the output swapped (output [2n] with output [2n+1]) on the WEX0 module.
void WEX0_PatternGenerationOverrideSet (uint8_t channels)
Sets which channels will have the output overridden by the Pattern Generation Mode on the WEX0 module.
void WEX0_PatternGenerationOutputSet (uint8_t channels)
Sets the output values of the channels in the Pattern Generation Mode on the WEX0 module.
void WEX0_OutputOverrideEnable (uint8_t channels)
Enables or disables the output override on the WEX0 module.
void WEX0_DeadTimeLowSideBufferSet (uint8_t buff)
Sets the dead-time on the low side of the output channels using a buffer register on the WEX0 module.
void WEX0_DeadTimeHighSideBufferSet (uint8_t buff)
Sets the dead-time on the high side of the output channels using a buffer register on the WEX0 module.
void WEX0_DeadTimeBothSidesBufferSet (uint8_t buff)
Sets the dead-time on both sides of the output channels using a buffer register on the WEX0 module.
void WEX0_SwapChannelBufferSet (uint8_t buff)
Sets which pair channels will have the output swapped (output [2n] with output [2n+1]) using a buffer register on the WEX0 module.
void WEX0_PatternGenerationOverrideBufferSet (uint8_t buff)
Sets which channels will have the output overridden by the Pattern Generation Mode using a buffer register on the WEX0 module.
void WEX0_PatternGenerationOutputBufferSet (uint8_t buff)
Sets the output values of the channels in the Pattern Generation Mode using a buffer register on the WEX0 module.
3.18.5.2.2 Macros
#define WEX0_NS_TO_TICKS(VALUE, F_CLOCK, WEX_PRESCALER) (uint8_t)( (float)(VALUE) / ( (1000000000.0 / (F_CLOCK) ) * (WEX_PRESCALER) ) + 0.5)
Converts from nanoseconds to clock increments. Used for setting the dead-time or blanking time.
3.18.5.2.3 Typedefs
typedef void(* WEX0_cb_t) (void)
Pointer to a function to be used as a callback handler when an interrupt event occurs.
3.18.5.2.4 Detailed Description
Waveform Extension Driver API Header File.