4.18 WEX - Waveform Extension
4.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.
4.18.2 Supported Device Families
AVR® EB |
4.18.3 Required header files:
#include "mcc_generated_files/timer/wex[X].h"
4.18.4 Module Documentation
4.18.4.1 WEX0
This document contains the implementation of the public and private functions for the Waveform Extension (WEX0) module.
4.18.4.1.1 Module description
This document contains the implementation of the public and private functions for the Waveform Extension (WEX0) module.
This document contains the API prototypes and the data types for the WEX0 driver.
Typedefs
typedef void(* WEX0_cb_t) (void)
This is the function pointer that accesses the callback function, whenever an interrupt occurs or a fault is detected.
Definitions
#define WEX0_NS_TO_TICKS(VALUE, F_CLOCK, WEX_PRESCALER) (uint8_t)( (float)(VALUE) / ( (1000000000.0 / (F_CLOCK) ) * (WEX_PRESCALER) ) + 0.5)
Defines the macro associated with the conversion from ns(nanoseconds) to clock increments.
Used for setting the dead time or blanking time. The user must specify the desired value in ns(nanoseconds), the clock speed and the prescaler.
Functions
ISR (WEX0_FAULT_vect)
Fault Interrupt Service Routine (ISR) routine.
void WEX0_FAULTIsrCallbackRegister (WEX0_cb_t cb)
Function used to register the ISR callback function.
void WEX0_Initialize (void)
Initializes the WEX0 module.
void WEX0_Deinitialize (void)
Deinitializes the WEX0 module.
uint8_t WEX0_StatusRegisterGet (void)
Used to get the status of the WEX0's blanking/fault detection.
void WEX0_PatternGenerationMode (bool mode)
Sets the Pattern Generation mode of the WEX0 interface.
bool WEX0_IsPatternGenerationSet (void)
Checks the Pattern Generation mode status of the WEX0 interface.
void WEX0_InputMatrixSet (WEX_INMX_t config)
Selects the Input Matrix mode of the WEX0 interface.
void WEX0_DeadTimeInsertionSet (uint8_t channels)
Used to enable 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 peripheral. This can be a PWM update or a condition where no hardware update is required.
void WEX0_SoftwareCommand (WEX_CMD_t command)
Gives software commands to the WEX0 peripheral. Commands can be: None, Update, FaultSet, FaultCLR, BlankSet, BlankCLR.
void WEX0_FaultAEventFilter (WEX_FILTER_t samples)
Filters event input A of the WEX0 peripheral.
void WEX0_FaultAEventBlankingEnable (bool en)
Enables fault blanking time on event A for the WEX0 peripheral.
void WEX0_FaultAEventInputEnable (bool en)
Enables event input A for the WEX0 peripheral.
void WEX0_FaultBEventFilter (WEX_FILTER_t samples)
Filters event input B of the WEX0 peripheral.
void WEX0_FaultBEventBlankingEnable (bool en)
Enables fault blanking time on event B for the WEX0 peripheral.
void WEX0_FaultBEventInputEnable (bool en)
Enables event input B for the WEX0 peripheral.
void WEX0_FaultCEventFilter (WEX_FILTER_t samples)
Filters event input C of the WEX0 peripheral.
void WEX0_FaultCEventBlankingEnable (bool en)
Enables fault blanking time on event C for the WEX0 peripheral.
void WEX0_FaultCEventInputEnable (bool en)
Enables event input C for the WEX0 peripheral.
void WEX0_BlankingPrescaler (WEX_BLANKPRESC_t prescaler)
Sets the blanking prescaler for the WEX0 peripheral.
void WEX0_BlankingTrigger (WEX_BLANKTRIG_t trig)
Sets the blanking trigger command for the WEX0 peripheral. It can be software of hardware.
void WEX0_BlankingTriggerSource (WEX_BLANKSRC_t source)
Sets the blanking trigger source for the WEX0 peripheral.
void WEX0_BlankingTimeSet (uint8_t cnt)
Sets the blanking time for the WEX0 peripheral. If prescaler is used this time can be extended.
uint8_t WEX0_BlankingTimeGet (void)
Gets the blanking time for the WEX0 peripheral.
void WEX0_FaultDetectionDebugBreak (WEX_FDDBD_t mode)
Sets fault detect on debug break detect for the WEX0 peripheral.
void WEX0_FaultDetectionRestartMode (WEX_FDMODE_t mode)
Resets the WEX0 peripheral from Fault mode.
void WEX0_FaultDetectionAction (WEX_FDACT_t action)
Selects the action to be taken when a fault detect occurs.
void WEX0_FaultDriveSet (uint8_t channels)
Selects if an output signal is in tri-state 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 signals in case of a fault detection.
void WEX0_FaultEnable (void)
Enables fault interrupt on the WEX0 interface.
bool WEX0_IsFaultEnabled (void)
Checks if fault interrupt is enabled on the WEX0 interface.
void WEX0_FaultDisable (void)
Disables fault interrupt on the WEX0 interface.
void WEX0_FaultFlagsClear (uint8_t flags)
Clears interrupt flags on the WEX0 interface.
uint8_t WEX0_FaultFlagsGet (void)
Checks which interrupt flags are set on the WEX0 interface.
void WEX0_DeadTimeLowSideSet (uint8_t cnt)
Sets the dead time on the low side of the output signals on the WEX0 interface.
void WEX0_DeadTimeHighSideSet (uint8_t cnt)
Sets the dead time on the high side of the output signals on the WEX0 interface.
void WEX0_DeadTimeBothSidesSet (uint8_t cnt)
Sets the dead time on both sides of the side output signals on the WEX0 interface.
void WEX0_SwapChannelSet (uint8_t channels)
Swaps the high-side and low side output signals from a complementary waveform pair of signals on the WEX0 interface.
void WEX0_PatternGenerationOverrideSet (uint8_t channels)
Selects which output waveform signals can be overridden in Pattern Generation mode on the WEX0 interface.
void WEX0_PatternGenerationOutputSet (uint8_t channels)
Sets the output values of the signals in Pattern Generation mode.
void WEX0_OutputOverrideEnable (uint8_t channels)
Enables output signals and allows them to be overridden.
void WEX0_DeadTimeLowSideBufferSet (uint8_t buff)
Sets the dead time on the low side of the output signals using a buffer register on the WEX0 interface.
void WEX0_DeadTimeHighSideBufferSet (uint8_t buff)
Sets the dead time on the high side of the output signals using a buffer register on the WEX0 interface.
void WEX0_DeadTimeBothSidesBufferSet (uint8_t buff)
Sets the dead time on both sides of the output signals using a buffer register on the WEX0 interface.
void WEX0_SwapChannelBufferSet (uint8_t buff)
Sets the swap buffer of the output signal pairs on the WEX0 interface.
void WEX0_PatternGenerationOverrideBufferSet (uint8_t buff)
Sets the Pattern Generation mode override buffer on the WEX0 interface.
void WEX0_PatternGenerationOutputBufferSet (uint8_t buff)
Sets the Pattern Generation mode output values buffer on the WEX0 interface.
Variables
static WEX0_cb_t WEX0_FAULT_isr_cb = NULL
This is the function pointer that accesses the callback, when an interrupt occurs or a fault is detected.
4.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)
Defines the macro associated with the conversion from ns(nanoseconds) to clock increments.
Used for setting the dead time or blanking time. The user must specify the desired value in ns(nanoseconds), the clock speed and the prescaler.-
VALUE must be a constant number rather than a variable
-
F_CLOCK is the WEX peripheral clock
-
WEX_PRESCALER can be 1, 2, 4, 8, 16, 64, 256, 1024
4.18.4.1.3 Typedef Documentation
WEX0_cb_t
void * WEX0_cb_t
This is the function pointer that accesses the callback function, whenever an interrupt occurs or a fault is detected.
4.18.4.1.4 Function Documentation
ISR()
ISR (WEX0_FAULT_vect )
Fault Interrupt Service Routine (ISR) routine.
WEX0_BlankingPrescaler()
void WEX0_BlankingPrescaler (WEX_BLANKPRESC_t prescaler)
Sets the blanking prescaler for the WEX0 peripheral.
None. |
WEX_BLANKPRESC_t |
pre - enum that specifies the value of the prescaler, which can be 1, 4, 16 or 64. |
None. |
WEX0_BlankingTimeGet()
uint8_t WEX0_BlankingTimeGet (void )
Gets the blanking time for the WEX0 peripheral.
None. |
None. |
uint8_t - the blanking time that was previously set. |
WEX0_BlankingTimeSet()
void WEX0_BlankingTimeSet (uint8_t cnt)
Sets the blanking time for the WEX0 peripheral. If prescaler is used this time can be extended.
None. |
uint8_t |
cnt - uint8_t that represents the blanking time given in a number of clock ticks, with a range between 0 and 255. |
None. |
WEX0_BlankingTrigger()
void WEX0_BlankingTrigger (WEX_BLANKTRIG_t trig)
Sets the blanking trigger command for the WEX0 peripheral. It can be software of hardware.
None. |
WEX_BLANKTRIG_t |
trig - enum that specifies the blanking trigger source, which can be on timer update condition, on compare channels match, or software. |
None. |
WEX0_BlankingTriggerSource()
void WEX0_BlankingTriggerSource (WEX_BLANKSRC_t source)
Sets the blanking trigger source for the WEX0 peripheral.
None. |
WEX_BLANKSRC_t |
source - enum that specifies the blanking trigger source - source is PWM0, false - source is PWM1. |
None. |
WEX0_DeadTimeBothSidesBufferSet()
void WEX0_DeadTimeBothSidesBufferSet (uint8_t buff)
Sets the dead time on both sides of the output signals using a buffer register on the WEX0 interface.
None. |
uint8_t |
buff - specifies the value of the dead time inserted on both sides of the output signals using a buffer given in clock ticks. |
None. |
WEX0_DeadTimeBothSidesSet()
void WEX0_DeadTimeBothSidesSet (uint8_t cnt)
Sets the dead time on both sides of the side output signals on the WEX0 interface.
None. |
uint8_t |
cnt - represents the value of the dead time on both sides, with a range between 0 and 255. |
None. |
WEX0_DeadTimeHighSideBufferSet()
void WEX0_DeadTimeHighSideBufferSet (uint8_t buff)
Sets the dead time on the high side of the output signals using a buffer register on the WEX0 interface.
None. |
uint8_t |
buff - specifies the value of the dead time inserted on the high side of the output signals using a buffer, given in clock ticks. |
None. |
WEX0_DeadTimeHighSideSet()
void WEX0_DeadTimeHighSideSet (uint8_t cnt)
Sets the dead time on the high side of the output signals on the WEX0 interface.
None. |
uint8_t |
cnt - represents the value of the dead time on the high side, with a range between 0 and 255. |
None. |
WEX0_DeadTimeInsertionSet()
void WEX0_DeadTimeInsertionSet (uint8_t channels)
Used to enable the dead time insertion on each of the waveform output channels.
None. |
uint8_t |
channels - represents the channels that will have the dead time insertion enabled. |
None. |
WEX0_DeadTimeLowSideBufferSet()
void WEX0_DeadTimeLowSideBufferSet (uint8_t buff)
Sets the dead time on the low side of the output signals using a buffer register on the WEX0 interface.
None. |
uint8_t |
buff - specifies the value of the dead time inserted on the low side of the output signals using a buffer, given in clock ticks. |
None. |
WEX0_DeadTimeLowSideSet()
void WEX0_DeadTimeLowSideSet (uint8_t cnt)
Sets the dead time on the low side of the output signals on the WEX0 interface.
None. |
uint8_t |
cnt - represents the value of the dead time on the low side, with a range between 0 and 255. |
None. |
WEX0_Deinitialize()
void WEX0_Deinitialize (void )
Deinitializes the WEX0 module.
None. |
None. |
None. |
WEX0_FaultAEventBlankingEnable()
void WEX0_FaultAEventBlankingEnable (bool en)
Enables fault blanking time on event A for the WEX0 peripheral.
None. |
bool |
en - boolean value is true if enabled, and false if disabled. |
None. |
WEX0_FaultAEventFilter()
void WEX0_FaultAEventFilter (WEX_FILTER_t samples)
Filters event input A of the WEX0 peripheral.
None. |
WEX_FILTER_t |
samples - enum that represents the number of samples filtered for an event to go through, with a range between 0 and 7 samples. |
None. |
WEX0_FaultAEventInputEnable()
void WEX0_FaultAEventInputEnable (bool en)
Enables event input A for the WEX0 peripheral.
None. |
bool |
en - boolean that has value true if enabled, false if disabled. |
None. |
WEX0_FaultBEventBlankingEnable()
void WEX0_FaultBEventBlankingEnable (bool en)
Enables fault blanking time on event B for the WEX0 peripheral.
None. |
bool |
en - boolean value is true if enabled, and false if disabled. |
None. |
WEX0_FaultBEventFilter()
void WEX0_FaultBEventFilter (WEX_FILTER_t samples)
Filters event input B of the WEX0 peripheral.
None. |
WEX_FILTER_t |
samples - enum that represents the number of samples filtered for an event to go through, with a range between 0 and 7 samples. |
None. |
WEX0_FaultBEventInputEnable()
void WEX0_FaultBEventInputEnable (bool en)
Enables event input B for the WEX0 peripheral.
None. |
bool |
en - boolean that has value true if enabled, false if disabled. |
None. |
WEX0_FaultCEventBlankingEnable()
void WEX0_FaultCEventBlankingEnable (bool en)
Enables fault blanking time on event C for the WEX0 peripheral.
None. |
bool |
en - boolean value is true if enabled, and false if disabled. |
None. |
WEX0_FaultCEventFilter()
void WEX0_FaultCEventFilter (WEX_FILTER_t samples)
Filters event input C of the WEX0 peripheral.
None. |
WEX_FILTER_t |
samples - enum that represents the number of samples filtered for an event to go through, with a range between 0 and 7 samples. |
None. |
WEX0_FaultCEventInputEnable()
void WEX0_FaultCEventInputEnable (bool en)
Enables event input C for the WEX0 peripheral.
None. |
bool |
en - boolean that has value true if enabled, false if disabled. |
None. |
WEX0_FaultDetectionAction()
void WEX0_FaultDetectionAction (WEX_FDACT_t action)
Selects the action to be taken when a fault detect occurs.
None. |
WEX_FDACT_t |
act - enum that specifies how are the output signals driven in case of a fault. |
None. |
WEX0_FaultDetectionDebugBreak()
void WEX0_FaultDetectionDebugBreak (WEX_FDDBD_t mode)
Sets fault detect on debug break detect for the WEX0 peripheral.
None. |
WEX_FDDBD_t |
mode - enum that specifies the fault detection on debug break detection. |
None. |
WEX0_FaultDetectionRestartMode()
void WEX0_FaultDetectionRestartMode (WEX_FDMODE_t mode)
Resets the WEX0 peripheral from Fault mode.
None. |
WEX_FDMODE_t |
mode - enum that specifies the Restart mode from fault, it can be latched or cycle-by-cycle. |
None. |
WEX0_FaultDisable()
void WEX0_FaultDisable (void )
Disables fault interrupt on the WEX0 interface.
None. |
None. |
None. |
WEX0_FaultDriveSet()
void WEX0_FaultDriveSet (uint8_t channels)
Selects if an output signal is in tri-state or overwritten by the custom fault value defined by the user in case a fault is detected.
None. |
uint8_t |
channels - represents which of the 8 waveform signals are affected by fault drive, the bits between 0 and 7 have a one-to-one relationship with the waveform signals from 0 to 7. |
None. |
WEX0_FaultEnable()
void WEX0_FaultEnable (void )
Enables fault interrupt on the WEX0 interface.
None. |
None. |
None. |
WEX0_FaultFlagsClear()
void WEX0_FaultFlagsClear (uint8_t flags)
Clears interrupt flags on the WEX0 interface.
None. |
flags |
- uint8_t that represents the 4 fault flags, which are the fault interrupt flags, and the fault event input detection flags . |
None. |
WEX0_FaultFlagsGet()
uint8_t WEX0_FaultFlagsGet (void )
Checks which interrupt flags are set on the WEX0 interface.
None. |
None. |
uint8_t - using only the bits 0, 2, 3 and 4, the bit 0 is the fault interrupt flag, the bit 2 is event input A flag, the bit 3 is event input B flag, and the bit 4 is event input C flag. |
WEX0_FAULTIsrCallbackRegister()
void WEX0_FAULTIsrCallbackRegister (WEX0_cb_t cb)
Function used to register the ISR callback function.
None. |
WEX0_cb_t |
cb - a function pointer. |
None. |
WEX0_FaultOutputSet()
void WEX0_FaultOutputSet (uint8_t channels)
Sets the output values of the signals in case of a fault detection.
None. |
uint8_t |
channels - represents which value will have each of the waveform signals if the custom drive option is selected,the bits between 0 and 7 have a one-to-one relationship with the waveform signals from 0 to 7 . |
None. |
WEX0_Initialize()
void WEX0_Initialize (void )
Initializes the WEX0 module.
None. |
None. |
None. |
WEX0_InputMatrixSet()
void WEX0_InputMatrixSet (WEX_INMX_t config)
Selects the Input Matrix mode of the WEX0 interface.
None. |
WEX_INMX_t |
config - enum that specifies the routing matrix for the waveform generation outputs to the port pins. |
None. |
WEX0_IsFaultEnabled()
bool WEX0_IsFaultEnabled (void )
Checks if fault interrupt is enabled on the WEX0 interface.
None. |
None. |
bool - true if enabled, false if disabled. |
WEX0_IsPatternGenerationSet()
bool WEX0_IsPatternGenerationSet (void )
Checks the Pattern Generation mode status of the WEX0 interface.
None. |
None. |
bool - true if enabled, false if disabled. |
WEX0_OutputOverrideEnable()
void WEX0_OutputOverrideEnable (uint8_t channels)
Enables output signals and allows them to be overridden.
None. |
uint8_t |
channels - specifies which of the output signals can be overridden, can change their state, the bits between 0 and 7 have a one-to-one relationship with the waveform output signals from 0 to 7. |
None. |
WEX0_PatternGenerationMode()
void WEX0_PatternGenerationMode (bool mode)
Sets the Pattern Generation mode of the WEX0 interface.
None. |
bool |
mode - boolean that has value true if enabled, false if disabled. |
None. |
WEX0_PatternGenerationOutputBufferSet()
void WEX0_PatternGenerationOutputBufferSet (uint8_t buff)
Sets the Pattern Generation mode output values buffer on the WEX0 interface.
None. |
uint8_t |
buff - specifies the value each waveform output signal will have, the bits between 0 and 7 have a one-to-one relationship with the waveform output signals from 0 to 7. |
None. |
WEX0_PatternGenerationOutputSet()
void WEX0_PatternGenerationOutputSet (uint8_t channels)
Sets the output values of the signals in Pattern Generation mode.
None. |
uint8_t |
channels - specifies the value each waveform output signal will have, the bits between 0 and 7 have a one-to-one relationship with the waveform output signals from 0 to 7. |
None. |
WEX0_PatternGenerationOverrideBufferSet()
void WEX0_PatternGenerationOverrideBufferSet (uint8_t buff)
Sets the Pattern Generation mode override buffer on the WEX0 interface.
None. |
uint8_t |
buff - represents which of the 8 waveform signals can be enabled to be overriden, the bits between 0 and 7 have a one-to-one relationship with the waveform output signals from 0 to 7. |
None. |
WEX0_PatternGenerationOverrideSet()
void WEX0_PatternGenerationOverrideSet (uint8_t channels)
Selects which output waveform signals can be overridden in Pattern Generation mode on the WEX0 interface.
None. |
uint8_t |
channels - represents which of the 8 waveform signals can be enabled to be overriden, the bits between 0 and 7 have a one-to-one relationship with the waveform output signals from 0 to 7. |
None. |
WEX0_SoftwareCommand()
void WEX0_SoftwareCommand (WEX_CMD_t command)
Gives software commands to the WEX0 peripheral. Commands can be: None, Update, FaultSet, FaultCLR, BlankSet, BlankCLR.
None. |
WEX_CMD_t |
com - enum that specify software commands used by WEX0 peripheral. |
None. |
WEX0_StatusRegisterGet()
uint8_t WEX0_StatusRegisterGet (void )
Used to get the status of the WEX0's blanking/fault detection.
None. |
None. |
uint8_t - the WEX0's running status. |
WEX0_SwapChannelBufferSet()
void WEX0_SwapChannelBufferSet (uint8_t buff)
Sets the swap buffer of the output signal pairs on the WEX0 interface.
None. |
uint8_t |
buff - specifies the desired channels to swap their low side and high side signals, the first 0-3 bits are used and they have a one-to-one relatioship with the 0-3 channels. |
None. |
WEX0_SwapChannelSet()
void WEX0_SwapChannelSet (uint8_t channels)
Swaps the high-side and low side output signals from a complementary waveform pair of signals on the WEX0 interface.
None. |
uint8_t |
channels - specifies the desired channels to swap their low side and high-side signals, the first 0-3 bits are used and they have a one-to-one relatioship with the 0-3 channels. |
None. |
WEX0_UpdateSourceSet()
void WEX0_UpdateSourceSet (WEX_UPDSRC_t config)
Selects the update source for the WEX0 peripheral. This can be a PWM update or a condition where no hardware update is required.
None. |
WEX_UPDSRC_t |
config - enum that specifies the trigger source for the update condition. |
None. |
4.18.4.1.5 Variable Documentation
WEX0_FAULT_isr_cb
WEX0_cb_t WEX0_FAULT_isr_cb = NULL[static]
This is the function pointer that accesses the callback, when an interrupt occurs or a fault is detected.
Section: Included files
4.18.5 File Documentation
4.18.5.1 source/wex0.c File Reference
#include <stddef.h> #include <avr/interrupt.h> #include <util/atomic.h> #include "wex0.h"
4.18.5.1.1 Functions
ISR (WEX0_FAULT_vect)
Fault Interrupt Service Routine (ISR) routine.
void WEX0_FAULTIsrCallbackRegister (WEX0_cb_t cb)
Function used to register the ISR callback function.
void WEX0_Initialize (void)
Initializes the WEX0 module.
void WEX0_Deinitialize (void)
Deinitializes the WEX0 module.
uint8_t WEX0_StatusRegisterGet (void)
Used to get the status of the WEX0's blanking/fault detection.
void WEX0_PatternGenerationMode (bool mode)
Sets the Pattern Generation mode of the WEX0 interface.
bool WEX0_IsPatternGenerationSet (void)
Checks the Pattern Generation mode status of the WEX0 interface.
void WEX0_InputMatrixSet (WEX_INMX_t config)
Selects the Input Matrix mode of the WEX0 interface.
void WEX0_DeadTimeInsertionSet (uint8_t channels)
Used to enable 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 peripheral. This can be a PWM update or a condition where no hardware update is required.
void WEX0_SoftwareCommand (WEX_CMD_t command)
Gives software commands to the WEX0 peripheral. Commands can be: None, Update, FaultSet, FaultCLR, BlankSet, BlankCLR.
void WEX0_FaultAEventFilter (WEX_FILTER_t samples)
Filters event input A of the WEX0 peripheral.
void WEX0_FaultAEventBlankingEnable (bool en)
Enables fault blanking time on event A for the WEX0 peripheral.
void WEX0_FaultAEventInputEnable (bool en)
Enables event input A for the WEX0 peripheral.
void WEX0_FaultBEventFilter (WEX_FILTER_t samples)
Filters event input B of the WEX0 peripheral.
void WEX0_FaultBEventBlankingEnable (bool en)
Enables fault blanking time on event B for the WEX0 peripheral.
void WEX0_FaultBEventInputEnable (bool en)
Enables event input B for the WEX0 peripheral.
void WEX0_FaultCEventFilter (WEX_FILTER_t samples)
Filters event input C of the WEX0 peripheral.
void WEX0_FaultCEventBlankingEnable (bool en)
Enables fault blanking time on event C for the WEX0 peripheral.
void WEX0_FaultCEventInputEnable (bool en)
Enables event input C for the WEX0 peripheral.
void WEX0_BlankingPrescaler (WEX_BLANKPRESC_t prescaler)
Sets the blanking prescaler for the WEX0 peripheral.
void WEX0_BlankingTrigger (WEX_BLANKTRIG_t trig)
Sets the blanking trigger command for the WEX0 peripheral. It can be software of hardware.
void WEX0_BlankingTriggerSource (WEX_BLANKSRC_t source)
Sets the blanking trigger source for the WEX0 peripheral.
void WEX0_BlankingTimeSet (uint8_t cnt)
Sets the blanking time for the WEX0 peripheral. If prescaler is used this time can be extended.
uint8_t WEX0_BlankingTimeGet (void)
Gets the blanking time for the WEX0 peripheral.
void WEX0_FaultDetectionDebugBreak (WEX_FDDBD_t mode)
Sets fault detect on debug break detect for the WEX0 peripheral.
void WEX0_FaultDetectionRestartMode (WEX_FDMODE_t mode)
Resets the WEX0 peripheral from Fault mode.
void WEX0_FaultDetectionAction (WEX_FDACT_t action)
Selects the action to be taken when a fault detect occurs.
void WEX0_FaultDriveSet (uint8_t channels)
Selects if an output signal is in tri-state 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 signals in case of a fault detection.
void WEX0_FaultEnable (void)
Enables fault interrupt on the WEX0 interface.
bool WEX0_IsFaultEnabled (void)
Checks if fault interrupt is enabled on the WEX0 interface.
void WEX0_FaultDisable (void)
Disables fault interrupt on the WEX0 interface.
void WEX0_FaultFlagsClear (uint8_t flags)
Clears interrupt flags on the WEX0 interface.
uint8_t WEX0_FaultFlagsGet (void)
Checks which interrupt flags are set on the WEX0 interface.
void WEX0_DeadTimeLowSideSet (uint8_t cnt)
Sets the dead time on the low side of the output signals on the WEX0 interface.
void WEX0_DeadTimeHighSideSet (uint8_t cnt)
Sets the dead time on the high side of the output signals on the WEX0 interface.
void WEX0_DeadTimeBothSidesSet (uint8_t cnt)
Sets the dead time on both sides of the side output signals on the WEX0 interface.
void WEX0_SwapChannelSet (uint8_t channels)
Swaps the high-side and low side output signals from a complementary waveform pair of signals on the WEX0 interface.
void WEX0_PatternGenerationOverrideSet (uint8_t channels)
Selects which output waveform signals can be overridden in Pattern Generation mode on the WEX0 interface.
void WEX0_PatternGenerationOutputSet (uint8_t channels)
Sets the output values of the signals in Pattern Generation mode.
void WEX0_OutputOverrideEnable (uint8_t channels)
Enables output signals and allows them to be overridden.
void WEX0_DeadTimeLowSideBufferSet (uint8_t buff)
Sets the dead time on the low side of the output signals using a buffer register on the WEX0 interface.
void WEX0_DeadTimeHighSideBufferSet (uint8_t buff)
Sets the dead time on the high side of the output signals using a buffer register on the WEX0 interface.
void WEX0_DeadTimeBothSidesBufferSet (uint8_t buff)
Sets the dead time on both sides of the output signals using a buffer register on the WEX0 interface.
void WEX0_SwapChannelBufferSet (uint8_t buff)
Sets the swap buffer of the output signal pairs on the WEX0 interface.
void WEX0_PatternGenerationOverrideBufferSet (uint8_t buff)
Sets the Pattern Generation mode override buffer on the WEX0 interface.
void WEX0_PatternGenerationOutputBufferSet (uint8_t buff)
Sets the Pattern Generation mode output values buffer on the WEX0 interface.
4.18.5.1.2 Variables
static WEX0_cb_t WEX0_FAULT_isr_cb = NULL
This is the function pointer that accesses the callback, when an interrupt occurs or a fault is detected.
4.18.5.1.3 Detailed Description
WEX0 Generated Driver API SOURCE File
4.18.5.2 source/wex0.h File Reference
#include <stdbool.h> #include <stdint.h> #include <avr/io.h>
4.18.5.2.1 Functions
void WEX0_FAULTIsrCallbackRegister (WEX0_cb_t cb)
Function used to register the ISR callback function.
void WEX0_Initialize (void)
Initializes the WEX0 module.
void WEX0_Deinitialize (void)
Deinitializes the WEX0 module.
uint8_t WEX0_StatusRegisterGet (void)
Used to get the status of the WEX0's blanking/fault detection.
void WEX0_PatternGenerationMode (bool mode)
Sets the Pattern Generation mode of the WEX0 interface.
bool WEX0_IsPatternGenerationSet (void)
Checks the Pattern Generation mode status of the WEX0 interface.
void WEX0_InputMatrixSet (WEX_INMX_t config)
Selects the Input Matrix mode of the WEX0 interface.
void WEX0_DeadTimeInsertionSet (uint8_t channels)
Used to enable 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 peripheral. This can be a PWM update or a condition where no hardware update is required.
void WEX0_SoftwareCommand (WEX_CMD_t command)
Gives software commands to the WEX0 peripheral. Commands can be: None, Update, FaultSet, FaultCLR, BlankSet, BlankCLR.
void WEX0_FaultAEventFilter (WEX_FILTER_t samples)
Filters event input A of the WEX0 peripheral.
void WEX0_FaultAEventBlankingEnable (bool en)
Enables fault blanking time on event A for the WEX0 peripheral.
void WEX0_FaultAEventInputEnable (bool en)
Enables event input A for the WEX0 peripheral.
void WEX0_FaultBEventFilter (WEX_FILTER_t samples)
Filters event input B of the WEX0 peripheral.
void WEX0_FaultBEventBlankingEnable (bool en)
Enables fault blanking time on event B for the WEX0 peripheral.
void WEX0_FaultBEventInputEnable (bool en)
Enables event input B for the WEX0 peripheral.
void WEX0_FaultCEventFilter (WEX_FILTER_t samples)
Filters event input C of the WEX0 peripheral.
void WEX0_FaultCEventBlankingEnable (bool en)
Enables fault blanking time on event C for the WEX0 peripheral.
void WEX0_FaultCEventInputEnable (bool en)
Enables event input C for the WEX0 peripheral.
void WEX0_BlankingPrescaler (WEX_BLANKPRESC_t prescaler)
Sets the blanking prescaler for the WEX0 peripheral.
void WEX0_BlankingTrigger (WEX_BLANKTRIG_t trig)
Sets the blanking trigger command for the WEX0 peripheral. It can be software of hardware.
void WEX0_BlankingTriggerSource (WEX_BLANKSRC_t source)
Sets the blanking trigger source for the WEX0 peripheral.
void WEX0_BlankingTimeSet (uint8_t cnt)
Sets the blanking time for the WEX0 peripheral. If prescaler is used this time can be extended.
uint8_t WEX0_BlankingTimeGet (void)
Gets the blanking time for the WEX0 peripheral.
void WEX0_FaultDetectionDebugBreak (WEX_FDDBD_t mode)
Sets fault detect on debug break detect for the WEX0 peripheral.
void WEX0_FaultDetectionRestartMode (WEX_FDMODE_t mode)
Resets the WEX0 peripheral from Fault mode.
void WEX0_FaultDetectionAction (WEX_FDACT_t action)
Selects the action to be taken when a fault detect occurs.
void WEX0_FaultDriveSet (uint8_t channels)
Selects if an output signal is in tri-state 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 signals in case of a fault detection.
void WEX0_FaultEnable (void)
Enables fault interrupt on the WEX0 interface.
bool WEX0_IsFaultEnabled (void)
Checks if fault interrupt is enabled on the WEX0 interface.
void WEX0_FaultDisable (void)
Disables fault interrupt on the WEX0 interface.
void WEX0_FaultFlagsClear (uint8_t flags)
Clears interrupt flags on the WEX0 interface.
uint8_t WEX0_FaultFlagsGet (void)
Checks which interrupt flags are set on the WEX0 interface.
void WEX0_DeadTimeLowSideSet (uint8_t cnt)
Sets the dead time on the low side of the output signals on the WEX0 interface.
void WEX0_DeadTimeHighSideSet (uint8_t cnt)
Sets the dead time on the high side of the output signals on the WEX0 interface.
void WEX0_DeadTimeBothSidesSet (uint8_t cnt)
Sets the dead time on both sides of the side output signals on the WEX0 interface.
void WEX0_SwapChannelSet (uint8_t channels)
Swaps the high-side and low side output signals from a complementary waveform pair of signals on the WEX0 interface.
void WEX0_PatternGenerationOverrideSet (uint8_t channels)
Selects which output waveform signals can be overridden in Pattern Generation mode on the WEX0 interface.
void WEX0_PatternGenerationOutputSet (uint8_t channels)
Sets the output values of the signals in Pattern Generation mode.
void WEX0_OutputOverrideEnable (uint8_t channels)
Enables output signals and allows them to be overridden.
void WEX0_DeadTimeLowSideBufferSet (uint8_t buff)
Sets the dead time on the low side of the output signals using a buffer register on the WEX0 interface.
void WEX0_DeadTimeHighSideBufferSet (uint8_t buff)
Sets the dead time on the high side of the output signals using a buffer register on the WEX0 interface.
void WEX0_DeadTimeBothSidesBufferSet (uint8_t buff)
Sets the dead time on both sides of the output signals using a buffer register on the WEX0 interface.
void WEX0_SwapChannelBufferSet (uint8_t buff)
Sets the swap buffer of the output signal pairs on the WEX0 interface.
void WEX0_PatternGenerationOverrideBufferSet (uint8_t buff)
Sets the Pattern Generation mode override buffer on the WEX0 interface.
void WEX0_PatternGenerationOutputBufferSet (uint8_t buff)
Sets the Pattern Generation mode output values buffer on the WEX0 interface.
4.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)
Defines the macro associated with the conversion from ns(nanoseconds) to clock increments.
Used for setting the dead time or blanking time. The user must specify the desired value in ns(nanoseconds), the clock speed and the prescaler.
4.18.5.2.3 Typedefs
typedef void(* WEX0_cb_t) (void)
This is the function pointer that accesses the callback function, whenever an interrupt occurs or a fault is detected.
4.18.5.2.4 Detailed Description
WEX0 Generated Driver API Header File