MTB CAT1 Peripheral driver library

General Description

Functions

cy_en_tcpwm_status_t Cy_TCPWM_PWM_Init (TCPWM_Type *base, uint32_t cntNum, cy_stc_tcpwm_pwm_config_t const *config)
 Initializes the counter in the TCPWM block for the PWM operation. More...
 
void Cy_TCPWM_PWM_DeInit (TCPWM_Type *base, uint32_t cntNum, cy_stc_tcpwm_pwm_config_t const *config)
 De-initializes the counter in the TCPWM block, returns register values to default. More...
 
__STATIC_INLINE void Cy_TCPWM_PWM_Enable (TCPWM_Type *base, uint32_t cntNum)
 Enables the counter in the TCPWM block for the PWM operation. More...
 
__STATIC_INLINE void Cy_TCPWM_PWM_Disable (TCPWM_Type *base, uint32_t cntNum)
 Disables the counter in the TCPWM block. More...
 
__STATIC_INLINE uint32_t Cy_TCPWM_PWM_GetStatus (TCPWM_Type const *base, uint32_t cntNum)
 Returns the status of the PWM whether it is running or not. More...
 
__STATIC_INLINE void Cy_TCPWM_PWM_SetCompare0Val (TCPWM_Type *base, uint32_t cntNum, uint32_t compare0)
 Sets the compare value for Compare 0 when the compare mode enabled. More...
 
__STATIC_INLINE uint32_t Cy_TCPWM_PWM_GetCompare0Val (TCPWM_Type const *base, uint32_t cntNum)
 Returns compare 0 value. More...
 
__STATIC_INLINE void Cy_TCPWM_PWM_SetCompare0BufVal (TCPWM_Type *base, uint32_t cntNum, uint32_t compareBuf0)
 Sets the buffered compare value for Compare 0 when the compare mode enabled. More...
 
__STATIC_INLINE uint32_t Cy_TCPWM_PWM_GetCompare0BufVal (TCPWM_Type const *base, uint32_t cntNum)
 Returns the buffered compare 0 value. More...
 
__STATIC_INLINE void Cy_TCPWM_PWM_EnableCompare0Swap (TCPWM_Type *base, uint32_t cntNum, bool enable)
 Enables the comparison swap of compare 0 and compareBuf 0 on OV and/or UN, depending on the PWM alignment. More...
 
__STATIC_INLINE void Cy_TCPWM_PWM_SetCounter (TCPWM_Type *base, uint32_t cntNum, uint32_t count)
 Sets the value of the counter. More...
 
__STATIC_INLINE uint32_t Cy_TCPWM_PWM_GetCounter (TCPWM_Type const *base, uint32_t cntNum)
 Returns the value in the counter. More...
 
__STATIC_INLINE void Cy_TCPWM_PWM_SetPeriod0 (TCPWM_Type *base, uint32_t cntNum, uint32_t period0)
 Sets the value of the period register. More...
 
__STATIC_INLINE uint32_t Cy_TCPWM_PWM_GetPeriod0 (TCPWM_Type const *base, uint32_t cntNum)
 Returns the value in the period register. More...
 
__STATIC_INLINE void Cy_TCPWM_PWM_SetPeriod1 (TCPWM_Type *base, uint32_t cntNum, uint32_t period1)
 Sets the value of the period register. More...
 
__STATIC_INLINE uint32_t Cy_TCPWM_PWM_GetPeriod1 (TCPWM_Type const *base, uint32_t cntNum)
 Returns the value in the period register. More...
 
__STATIC_INLINE void Cy_TCPWM_PWM_EnablePeriodSwap (TCPWM_Type *base, uint32_t cntNum, bool enable)
 Enables a period swap on OV and/or UN, depending on the PWM alignment. More...
 
__STATIC_INLINE uint32_t Cy_TCPWM_PWM_GetDtCounter (TCPWM_Type const *base, uint32_t cntNum)
 Returns the dead time count when the PWM is configured in dead time mode. More...
 
__STATIC_INLINE uint32_t Cy_TCPWM_PWM_LineOutStatus (TCPWM_Type const *base, uint32_t cntNum, uint32_t pwmOutSelect)
 Returns the current level of the selected pwm output line. More...
 
__STATIC_INLINE void Cy_TCPWM_PWM_PWMDeadTime (TCPWM_Type const *base, uint32_t cntNum, uint32_t deadTime)
 Writes the dead time value for PWM. More...
 
__STATIC_INLINE void Cy_TCPWM_PWM_PWMDeadTimeN (TCPWM_Type const *base, uint32_t cntNum, uint32_t deadTime)
 Writes the dead time value for PWM. More...
 
__STATIC_INLINE void Cy_TCPWM_PWM_Configure_LineSelect (TCPWM_Type *base, uint32_t cntNum, cy_en_line_select_config_t line_out_val, cy_en_line_select_config_t line_compl_value)
 Configures the source for the output signal "line_out" and "line_compl_out". More...
 
__STATIC_INLINE void Cy_TCPWM_PWM_Configure_LineSelectBuff (TCPWM_Type *base, uint32_t cntNum, cy_en_line_select_config_t line_out_val, cy_en_line_select_config_t line_compl_value)
 Buffer for LINE SELCT. More...
 
__STATIC_INLINE void Cy_TCPWM_PWM_EnableLineSelectSwap (TCPWM_Type *base, uint32_t cntNum, bool enable)
 Enables a Line Select swap on OV and/or UN, depending on the PWM alignment. More...
 
__STATIC_INLINE void Cy_TCPWM_PWM_SetDT (TCPWM_Type const *base, uint32_t cntNum, uint32_t deadTime)
 Writes the dead time value for PWM. More...
 
__STATIC_INLINE void Cy_TCPWM_PWM_EnableSwap (TCPWM_Type *base, uint32_t cntNum, bool enable)
 Enables/disables swapping mechanism between CC0 and buffered CC0, CC1 and buffered CC1, PERIOD and buffered PERIOD, DT and buffered DT. More...
 
cy_en_tcpwm_status_t Cy_TCPWM_PWM_Configure_Dithering (TCPWM_Type *base, uint32_t cntNum, cy_en_tcpwm_dithering_t mode, uint8_t period, uint8_t duty, cy_en_dithering_limiter_t limiter)
 configures dithering. More...
 
__STATIC_INLINE void Cy_TCPWM_PWM_PWMDeadTimeBuff (TCPWM_Type const *base, uint32_t cntNum, uint32_t deadTime)
 Writes the dead time buffered value for PWM. More...
 
__STATIC_INLINE void Cy_TCPWM_PWM_PWMDeadTimeBuffN (TCPWM_Type const *base, uint32_t cntNum, uint32_t deadTime)
 Writes the dead time buffered value for PWM. More...
 
__STATIC_INLINE void Cy_TCPWM_PWM_SetDTBuff (TCPWM_Type const *base, uint32_t cntNum, uint32_t deadTime)
 Writes the dead time buffered value for PWM. More...
 
__STATIC_INLINE void Cy_TCPWM_PWM_SetCompare1Val (TCPWM_Type *base, uint32_t cntNum, uint32_t compare1)
 Sets the compare value for Compare 1 when the compare mode enabled. More...
 
__STATIC_INLINE uint32_t Cy_TCPWM_PWM_GetCompare1Val (TCPWM_Type const *base, uint32_t cntNum)
 Returns compare 1 value. More...
 
__STATIC_INLINE void Cy_TCPWM_PWM_SetCompare1BufVal (TCPWM_Type *base, uint32_t cntNum, uint32_t compareBuf1)
 Sets the buffered compare value for Compare1 when the compare mode enabled. More...
 
__STATIC_INLINE uint32_t Cy_TCPWM_PWM_GetCompare1BufVal (TCPWM_Type const *base, uint32_t cntNum)
 Returns the buffered compare 1 value. More...
 
__STATIC_INLINE void Cy_TCPWM_PWM_EnableCompare1Swap (TCPWM_Type *base, uint32_t cntNum, bool enable)
 Enables the comparison swap of compare1 and compareBuf1 on OV and/or UN, depending on the PWM alignment. More...
 
__STATIC_INLINE void Cy_TCPWM_PWM_Set_KillLinePolarity (TCPWM_Type *base, uint32_t cntNum, cy_en_kill_line_polarity_t kill_line_polarity)
 Configures the source for the output signal "line_out" and "line_compl_out". More...
 

Function Documentation

◆ Cy_TCPWM_PWM_Init()

cy_en_tcpwm_status_t Cy_TCPWM_PWM_Init ( TCPWM_Type base,
uint32_t  cntNum,
cy_stc_tcpwm_pwm_config_t const *  config 
)

Initializes the counter in the TCPWM block for the PWM operation.

Note
After initialization, connected PWM output pins Drive modes are set to High-Z state. To set Drive modes as set by PWM output pins configuration, call the Cy_TCPWM_PWM_Enable function.
Parameters
baseThe pointer to a TCPWM instance.
cntNumThe Counter instance number in the selected TCPWM.
configThe pointer to a configuration structure. See cy_stc_tcpwm_pwm_config_t.
Returns
error / status code. See cy_en_tcpwm_status_t.
Function Usage
/* Scenario: there is need to initialize
* the first (index = 0) PWM of the TCPWM0 block
* with the below configuration settings
*/
cy_stc_tcpwm_pwm_config_t tcpwm_v1_pwm_config =
{
/* .pwmMode = */ CY_TCPWM_PWM_MODE_PWM, /* Simple PWM Mode */
/* .clockPrescaler = */ CY_TCPWM_PWM_PRESCALER_DIVBY_4, /* Clk_counter = Clk_input / 4 */
/* .pwmAlignment = */ CY_TCPWM_PWM_LEFT_ALIGN, /* PWM signal is left aligned, meaning it starts high */
/* .deadTimeClocks = */ 0UL, /* dead time feature is disabled */
/* .runMode = */ CY_TCPWM_PWM_CONTINUOUS, /* Wrap around at terminal count. */
/* .period0 = */ 99UL, /* Period of 100 (0-99). Terminal count event when rolls over back to 0. */
/* .period1 = */ 199UL, /* Period of 200 (0-199). Terminal count event when rolls over back to 0. */
/* .enablePeriodSwap = */ true, /* period swapping feature is enabled */
/* .compare0 = */ 33UL, /* duty cycle 33% (with period 100) */
/* .compare1 = */ 66UL, /* duty cycle 33% (with period 200) */
/* .enableCompareSwap = */ true, /* compare swapping feature is enabled */
/* .interruptSources = */ CY_TCPWM_INT_ON_TC, /* interrupt will rise on terminal count */
/* .invertPWMOut = */ 0UL, /* Not invert */
/* .invertPWMOutN = */ 0UL, /* Not invert */
/* .killMode = */ CY_TCPWM_PWM_STOP_ON_KILL, /* PWM stops counting on kill */
/* .swapInputMode = */ CY_TCPWM_INPUT_RISINGEDGE, /* This input is NOT used, leave it in default state (CY_TCPWM_INPUT_RISINGEDGE = 0UL) */
/* .swapInput = */ CY_TCPWM_INPUT_0,
/* .reloadInputMode = */ CY_TCPWM_INPUT_RISINGEDGE, /* This input is NOT used, leave it in default state (CY_TCPWM_INPUT_RISINGEDGE = 0UL) */
/* .reloadInput = */ CY_TCPWM_INPUT_0,
/* .startInputMode = */ CY_TCPWM_INPUT_RISINGEDGE, /* This input is NOT used, leave it in default state (CY_TCPWM_INPUT_RISINGEDGE = 0UL) */
/* .startInput = */ CY_TCPWM_INPUT_0,
/* .killInputMode = */ CY_TCPWM_INPUT_RISINGEDGE, /* This input is NOT used, leave it in default state (CY_TCPWM_INPUT_RISINGEDGE = 0UL) */
/* .killInput = */ CY_TCPWM_INPUT_0,
/* .countInputMode = */ CY_TCPWM_INPUT_LEVEL, /* Set this input to LEVEL and 1 (high logic level) */
/* .countInput = */ CY_TCPWM_INPUT_1, /* So the PWM will be enabled forever */
/* .swapOverflowUnderflow = */ false, /* Use default overflow/underflow behavior */
};
#define MY_TCPWM_PWM_NUM (0UL)
#define MY_TCPWM_PWM_MASK (1UL << MY_TCPWM_PWM_NUM)
if (CY_TCPWM_SUCCESS != Cy_TCPWM_PWM_Init(TCPWM0, MY_TCPWM_PWM_NUM, &tcpwm_v1_pwm_config))
{
/* Handle possible errors */
}
/* Enable the initialized PWM */
Cy_TCPWM_PWM_Enable(TCPWM0, MY_TCPWM_PWM_NUM);
/* Then start the PWM */
Cy_TCPWM_TriggerStart_Single(TCPWM0, MY_TCPWM_PWM_NUM);
/* Scenario: there is need to initialize
* the first (index = 0) PWM of the TCPWM0 block
* with the below configuration settings
*/
cy_stc_tcpwm_pwm_config_t tcpwm_v2_pwm_config =
{
/* .pwmMode = */ CY_TCPWM_PWM_MODE_PWM, /* Simple PWM Mode */
/* .clockPrescaler = */ CY_TCPWM_PWM_PRESCALER_DIVBY_4, /* Clk_counter = Clk_input / 4 */
/* .pwmAlignment = */ CY_TCPWM_PWM_LEFT_ALIGN, /* PWM signal is left aligned, meaning it starts high */
/* .deadTimeClocks = */ 0UL, /* dead time feature is disabled */
/* .runMode = */ CY_TCPWM_PWM_CONTINUOUS, /* Wrap around at terminal count. */
/* .period0 = */ 99UL, /* Period of 100 (0-99). Terminal count event when rolls over back to 0. */
/* .period1 = */ 199UL, /* Period of 200 (0-199). Terminal count event when rolls over back to 0. */
/* .enablePeriodSwap = */ true, /* period swapping feature is enabled */
/* .compare0 = */ 33UL, /* duty cycle 33% (with period 100) */
/* .compare1 = */ 66UL, /* duty cycle 33% (with period 200) */
/* .enableCompareSwap = */ true, /* compare swapping feature is enabled */
/* .interruptSources = */ CY_TCPWM_INT_ON_TC, /* interrupt will rise on terminal count */
/* .invertPWMOut = */ 0UL, /* Not invert */
/* .invertPWMOutN = */ 0UL, /* Not invert */
/* .killMode = */ CY_TCPWM_PWM_STOP_ON_KILL, /* PWM stops counting on kill */
/* .swapInputMode = */ CY_TCPWM_INPUT_RISINGEDGE, /* This input is NOT used, leave it in default state (CY_TCPWM_INPUT_RISINGEDGE = 0UL) */
/* .swapInput = */ CY_TCPWM_INPUT_0,
/* .reloadInputMode = */ CY_TCPWM_INPUT_RISINGEDGE, /* This input is NOT used, leave it in default state (CY_TCPWM_INPUT_RISINGEDGE = 0UL) */
/* .reloadInput = */ CY_TCPWM_INPUT_0,
/* .startInputMode = */ CY_TCPWM_INPUT_RISINGEDGE, /* This input is NOT used, leave it in default state (CY_TCPWM_INPUT_RISINGEDGE = 0UL) */
/* .startInput = */ CY_TCPWM_INPUT_0,
/* .killInputMode = */ CY_TCPWM_INPUT_RISINGEDGE, /* This input is NOT used, leave it in default state (CY_TCPWM_INPUT_RISINGEDGE = 0UL) */
/* .killInput = */ CY_TCPWM_INPUT_0,
/* .countInputMode = */ CY_TCPWM_INPUT_LEVEL, /* Set this input to LEVEL and 1 (high logic level) */
/* .countInput = */ CY_TCPWM_INPUT_1, /* So the PWM will be enabled forever */
/* .swapOverflowUnderflow = */ false, /* Use default overflow/underflow behavior */
/* .immediateKill = */ false, /* Specifies whether the kill event immediately deactivates the dt_line_out and dt_line_compl_out or with the next module clock */
/* .tapsEnabled = */ 0x00UL, /* In pseudo random mode this sets the enabled taps.*/
/* .compare2 = */ 33UL, /* duty cycle 33% (with period 100) */
/* .compare3 = */ 66UL, /* duty cycle 33% (with period 200) */
/* .enableCompare1Swap = */ true, /* Not implemented yet*/
/* .compare0MatchUp = */ true, /* Not implemented yet*/
/* .compare0MatchDown = */ true, /* Not implemented yet*/
/* .compare1MatchUp = */ true, /* Not implemented yet*/
/* .compare1MatchDown = */ true, /* Not implemented yet*/
/* .kill1InputMode = */ CY_TCPWM_INPUT_RISINGEDGE, /* This input is NOT used, leave it in default s tate (CY_TCPWM_INPUT_RISINGEDGE = 0UL) */
/* .kill1Input = */ CY_TCPWM_INPUT_0,
/* .pwmOnDisable = */ CY_TCPWM_PWM_OUTPUT_HIGHZ, /* Default High impedance mode*/
/* .trigger0Event = */ CY_TCPWM_CNT_TRIGGER_ON_DISABLED, /* Disable output trigger0 event generation*/
/* .trigger1Event = */ CY_TCPWM_CNT_TRIGGER_ON_DISABLED, /* Disable output trigger1 event generation*/
/* .reloadLineSelect = */ true, /* Configures how the reload line select */
/* line_out_sel = */ CY_TCPWM_OUTPUT_CONSTANT_0,
/* linecompl_out_sel = */ CY_TCPWM_OUTPUT_CONSTANT_0,
/* line_out_sel_buff = */ CY_TCPWM_OUTPUT_CONSTANT_0,
/* linecompl_out_sel_buff = */ CY_TCPWM_OUTPUT_CONSTANT_0,
/* deadTimeClocks_linecompl_out = */ 5U,
};
#define MY_TCPWM_PWM_NUM (0UL)
#define MY_TCPWM_PWM_MASK (1UL << MY_TCPWM_PWM_NUM)
if (CY_TCPWM_SUCCESS != Cy_TCPWM_PWM_Init(TCPWM0, MY_TCPWM_PWM_NUM, &tcpwm_v2_pwm_config))
{
/* Handle possible errors */
}
/* Enable the initialized PWM */
Cy_TCPWM_PWM_Enable(TCPWM0, MY_TCPWM_PWM_NUM);
/* Then start the PWM */
Cy_TCPWM_TriggerStart_Single(TCPWM0, MY_TCPWM_PWM_NUM);

◆ Cy_TCPWM_PWM_DeInit()

void Cy_TCPWM_PWM_DeInit ( TCPWM_Type base,
uint32_t  cntNum,
cy_stc_tcpwm_pwm_config_t const *  config 
)

De-initializes the counter in the TCPWM block, returns register values to default.

Parameters
baseThe pointer to a TCPWM instance.
cntNumThe Counter instance number in the selected TCPWM.
configThe pointer to a configuration structure. See cy_stc_tcpwm_pwm_config_t.
Function Usage
/* Scenario: there is need to deinitialize the previously initialized counter */
#define MY_TCPWM_PWM_NUM (0UL)
/* Disable the counter prior to deinitializing */
Cy_TCPWM_PWM_Disable(TCPWM0, MY_TCPWM_PWM_NUM);
Cy_TCPWM_PWM_DeInit(TCPWM0, MY_TCPWM_PWM_NUM, &config);

◆ Cy_TCPWM_PWM_Enable()

__STATIC_INLINE void Cy_TCPWM_PWM_Enable ( TCPWM_Type base,
uint32_t  cntNum 
)

Enables the counter in the TCPWM block for the PWM operation.

Parameters
baseThe pointer to a TCPWM instance.
cntNumThe Counter instance number in the selected TCPWM.
Function Usage
/* Scenario: there is need to initialize
* the first (index = 0) PWM of the TCPWM0 block
* with the below configuration settings
*/
cy_stc_tcpwm_pwm_config_t tcpwm_v1_pwm_config =
{
/* .pwmMode = */ CY_TCPWM_PWM_MODE_PWM, /* Simple PWM Mode */
/* .clockPrescaler = */ CY_TCPWM_PWM_PRESCALER_DIVBY_4, /* Clk_counter = Clk_input / 4 */
/* .pwmAlignment = */ CY_TCPWM_PWM_LEFT_ALIGN, /* PWM signal is left aligned, meaning it starts high */
/* .deadTimeClocks = */ 0UL, /* dead time feature is disabled */
/* .runMode = */ CY_TCPWM_PWM_CONTINUOUS, /* Wrap around at terminal count. */
/* .period0 = */ 99UL, /* Period of 100 (0-99). Terminal count event when rolls over back to 0. */
/* .period1 = */ 199UL, /* Period of 200 (0-199). Terminal count event when rolls over back to 0. */
/* .enablePeriodSwap = */ true, /* period swapping feature is enabled */
/* .compare0 = */ 33UL, /* duty cycle 33% (with period 100) */
/* .compare1 = */ 66UL, /* duty cycle 33% (with period 200) */
/* .enableCompareSwap = */ true, /* compare swapping feature is enabled */
/* .interruptSources = */ CY_TCPWM_INT_ON_TC, /* interrupt will rise on terminal count */
/* .invertPWMOut = */ 0UL, /* Not invert */
/* .invertPWMOutN = */ 0UL, /* Not invert */
/* .killMode = */ CY_TCPWM_PWM_STOP_ON_KILL, /* PWM stops counting on kill */
/* .swapInputMode = */ CY_TCPWM_INPUT_RISINGEDGE, /* This input is NOT used, leave it in default state (CY_TCPWM_INPUT_RISINGEDGE = 0UL) */
/* .swapInput = */ CY_TCPWM_INPUT_0,
/* .reloadInputMode = */ CY_TCPWM_INPUT_RISINGEDGE, /* This input is NOT used, leave it in default state (CY_TCPWM_INPUT_RISINGEDGE = 0UL) */
/* .reloadInput = */ CY_TCPWM_INPUT_0,
/* .startInputMode = */ CY_TCPWM_INPUT_RISINGEDGE, /* This input is NOT used, leave it in default state (CY_TCPWM_INPUT_RISINGEDGE = 0UL) */
/* .startInput = */ CY_TCPWM_INPUT_0,
/* .killInputMode = */ CY_TCPWM_INPUT_RISINGEDGE, /* This input is NOT used, leave it in default state (CY_TCPWM_INPUT_RISINGEDGE = 0UL) */
/* .killInput = */ CY_TCPWM_INPUT_0,
/* .countInputMode = */ CY_TCPWM_INPUT_LEVEL, /* Set this input to LEVEL and 1 (high logic level) */
/* .countInput = */ CY_TCPWM_INPUT_1, /* So the PWM will be enabled forever */
/* .swapOverflowUnderflow = */ false, /* Use default overflow/underflow behavior */
};
#define MY_TCPWM_PWM_NUM (0UL)
#define MY_TCPWM_PWM_MASK (1UL << MY_TCPWM_PWM_NUM)
if (CY_TCPWM_SUCCESS != Cy_TCPWM_PWM_Init(TCPWM0, MY_TCPWM_PWM_NUM, &tcpwm_v1_pwm_config))
{
/* Handle possible errors */
}
/* Enable the initialized PWM */
Cy_TCPWM_PWM_Enable(TCPWM0, MY_TCPWM_PWM_NUM);
/* Then start the PWM */
Cy_TCPWM_TriggerStart_Single(TCPWM0, MY_TCPWM_PWM_NUM);
/* Scenario: there is need to initialize
* the first (index = 0) PWM of the TCPWM0 block
* with the below configuration settings
*/
cy_stc_tcpwm_pwm_config_t tcpwm_v2_pwm_config =
{
/* .pwmMode = */ CY_TCPWM_PWM_MODE_PWM, /* Simple PWM Mode */
/* .clockPrescaler = */ CY_TCPWM_PWM_PRESCALER_DIVBY_4, /* Clk_counter = Clk_input / 4 */
/* .pwmAlignment = */ CY_TCPWM_PWM_LEFT_ALIGN, /* PWM signal is left aligned, meaning it starts high */
/* .deadTimeClocks = */ 0UL, /* dead time feature is disabled */
/* .runMode = */ CY_TCPWM_PWM_CONTINUOUS, /* Wrap around at terminal count. */
/* .period0 = */ 99UL, /* Period of 100 (0-99). Terminal count event when rolls over back to 0. */
/* .period1 = */ 199UL, /* Period of 200 (0-199). Terminal count event when rolls over back to 0. */
/* .enablePeriodSwap = */ true, /* period swapping feature is enabled */
/* .compare0 = */ 33UL, /* duty cycle 33% (with period 100) */
/* .compare1 = */ 66UL, /* duty cycle 33% (with period 200) */
/* .enableCompareSwap = */ true, /* compare swapping feature is enabled */
/* .interruptSources = */ CY_TCPWM_INT_ON_TC, /* interrupt will rise on terminal count */
/* .invertPWMOut = */ 0UL, /* Not invert */
/* .invertPWMOutN = */ 0UL, /* Not invert */
/* .killMode = */ CY_TCPWM_PWM_STOP_ON_KILL, /* PWM stops counting on kill */
/* .swapInputMode = */ CY_TCPWM_INPUT_RISINGEDGE, /* This input is NOT used, leave it in default state (CY_TCPWM_INPUT_RISINGEDGE = 0UL) */
/* .swapInput = */ CY_TCPWM_INPUT_0,
/* .reloadInputMode = */ CY_TCPWM_INPUT_RISINGEDGE, /* This input is NOT used, leave it in default state (CY_TCPWM_INPUT_RISINGEDGE = 0UL) */
/* .reloadInput = */ CY_TCPWM_INPUT_0,
/* .startInputMode = */ CY_TCPWM_INPUT_RISINGEDGE, /* This input is NOT used, leave it in default state (CY_TCPWM_INPUT_RISINGEDGE = 0UL) */
/* .startInput = */ CY_TCPWM_INPUT_0,
/* .killInputMode = */ CY_TCPWM_INPUT_RISINGEDGE, /* This input is NOT used, leave it in default state (CY_TCPWM_INPUT_RISINGEDGE = 0UL) */
/* .killInput = */ CY_TCPWM_INPUT_0,
/* .countInputMode = */ CY_TCPWM_INPUT_LEVEL, /* Set this input to LEVEL and 1 (high logic level) */
/* .countInput = */ CY_TCPWM_INPUT_1, /* So the PWM will be enabled forever */
/* .swapOverflowUnderflow = */ false, /* Use default overflow/underflow behavior */
/* .immediateKill = */ false, /* Specifies whether the kill event immediately deactivates the dt_line_out and dt_line_compl_out or with the next module clock */
/* .tapsEnabled = */ 0x00UL, /* In pseudo random mode this sets the enabled taps.*/
/* .compare2 = */ 33UL, /* duty cycle 33% (with period 100) */
/* .compare3 = */ 66UL, /* duty cycle 33% (with period 200) */
/* .enableCompare1Swap = */ true, /* Not implemented yet*/
/* .compare0MatchUp = */ true, /* Not implemented yet*/
/* .compare0MatchDown = */ true, /* Not implemented yet*/
/* .compare1MatchUp = */ true, /* Not implemented yet*/
/* .compare1MatchDown = */ true, /* Not implemented yet*/
/* .kill1InputMode = */ CY_TCPWM_INPUT_RISINGEDGE, /* This input is NOT used, leave it in default s tate (CY_TCPWM_INPUT_RISINGEDGE = 0UL) */
/* .kill1Input = */ CY_TCPWM_INPUT_0,
/* .pwmOnDisable = */ CY_TCPWM_PWM_OUTPUT_HIGHZ, /* Default High impedance mode*/
/* .trigger0Event = */ CY_TCPWM_CNT_TRIGGER_ON_DISABLED, /* Disable output trigger0 event generation*/
/* .trigger1Event = */ CY_TCPWM_CNT_TRIGGER_ON_DISABLED, /* Disable output trigger1 event generation*/
/* .reloadLineSelect = */ true, /* Configures how the reload line select */
/* line_out_sel = */ CY_TCPWM_OUTPUT_CONSTANT_0,
/* linecompl_out_sel = */ CY_TCPWM_OUTPUT_CONSTANT_0,
/* line_out_sel_buff = */ CY_TCPWM_OUTPUT_CONSTANT_0,
/* linecompl_out_sel_buff = */ CY_TCPWM_OUTPUT_CONSTANT_0,
/* deadTimeClocks_linecompl_out = */ 5U,
};
#define MY_TCPWM_PWM_NUM (0UL)
#define MY_TCPWM_PWM_MASK (1UL << MY_TCPWM_PWM_NUM)
if (CY_TCPWM_SUCCESS != Cy_TCPWM_PWM_Init(TCPWM0, MY_TCPWM_PWM_NUM, &tcpwm_v2_pwm_config))
{
/* Handle possible errors */
}
/* Enable the initialized PWM */
Cy_TCPWM_PWM_Enable(TCPWM0, MY_TCPWM_PWM_NUM);
/* Then start the PWM */
Cy_TCPWM_TriggerStart_Single(TCPWM0, MY_TCPWM_PWM_NUM);

◆ Cy_TCPWM_PWM_Disable()

__STATIC_INLINE void Cy_TCPWM_PWM_Disable ( TCPWM_Type base,
uint32_t  cntNum 
)

Disables the counter in the TCPWM block.

Note
This function sets connected PWM output pins Drive modes to High-Z state. To disable PWM without changing pins drive modes, use the Cy_TCPWM_TriggerStopOrKill or Cy_TCPWM_TriggerStopOrKill_Single function.
Parameters
baseThe pointer to a TCPWM instance.
cntNumThe Counter instance number in the selected TCPWM.
Function Usage
/* Scenario: there is need to deinitialize the previously initialized counter */
#define MY_TCPWM_PWM_NUM (0UL)
/* Disable the counter prior to deinitializing */
Cy_TCPWM_PWM_Disable(TCPWM0, MY_TCPWM_PWM_NUM);
Cy_TCPWM_PWM_DeInit(TCPWM0, MY_TCPWM_PWM_NUM, &config);

◆ Cy_TCPWM_PWM_GetStatus()

__STATIC_INLINE uint32_t Cy_TCPWM_PWM_GetStatus ( TCPWM_Type const *  base,
uint32_t  cntNum 
)

Returns the status of the PWM whether it is running or not.

In case the PWM is running, status will also provide information on counting up/down. This is useful when the PWM Alignment mode set to Center/Asymmetric Alignments.

Parameters
baseThe pointer to a TCPWM instance.
cntNumThe Counter instance number in the selected TCPWM.
Returns
The status. See PWM Status
Function Usage
/* Scenario: there is a need to check if
* the first (index = 0) counter of the TCPWM0 block is running or not.
*/
#define MY_TCPWM_PWM_NUM (0UL)
uint32_t status = Cy_TCPWM_PWM_GetStatus(TCPWM0, MY_TCPWM_CNT_NUM);
{
/* Up Counting */
}
{
/* Down Counting */
}
else
{
/* PWM is not running */
}

◆ Cy_TCPWM_PWM_SetCompare0Val()

__STATIC_INLINE void Cy_TCPWM_PWM_SetCompare0Val ( TCPWM_Type base,
uint32_t  cntNum,
uint32_t  compare0 
)

Sets the compare value for Compare 0 when the compare mode enabled.

Parameters
baseThe pointer to a TCPWM instance.
cntNumThe Counter instance number in the selected TCPWM.
compare0The Compare 0 value.
Function Usage
/* Scenario: there is a need to increment the Compare 0 value of
* the first (index = 0) PWM of the TCPWM0 block.
*/
#define MY_TCPWM_PWM_NUM (0UL)
/* Get the currently existing compare value */
uint32_t compare = Cy_TCPWM_PWM_GetCompare0Val(TCPWM0, MY_TCPWM_PWM_NUM);
/* Modify the compare value here */
Cy_TCPWM_PWM_SetCompare0Val(TCPWM0, MY_TCPWM_PWM_NUM, compare);

◆ Cy_TCPWM_PWM_GetCompare0Val()

__STATIC_INLINE uint32_t Cy_TCPWM_PWM_GetCompare0Val ( TCPWM_Type const *  base,
uint32_t  cntNum 
)

Returns compare 0 value.

Parameters
baseThe pointer to a TCPWM instance.
cntNumThe Counter instance number in the selected TCPWM.
Returns
Compare 0 value.
Function Usage
/* Scenario: there is a need to increment the Compare 0 value of
* the first (index = 0) PWM of the TCPWM0 block.
*/
#define MY_TCPWM_PWM_NUM (0UL)
/* Get the currently existing compare value */
uint32_t compare = Cy_TCPWM_PWM_GetCompare0Val(TCPWM0, MY_TCPWM_PWM_NUM);
/* Modify the compare value here */
Cy_TCPWM_PWM_SetCompare0Val(TCPWM0, MY_TCPWM_PWM_NUM, compare);

◆ Cy_TCPWM_PWM_SetCompare0BufVal()

__STATIC_INLINE void Cy_TCPWM_PWM_SetCompare0BufVal ( TCPWM_Type base,
uint32_t  cntNum,
uint32_t  compareBuf0 
)

Sets the buffered compare value for Compare 0 when the compare mode enabled.

Parameters
baseThe pointer to a TCPWM instance.
cntNumThe Counter instance number in the selected TCPWM.
compareBuf0The buffered Compare 0 value.
Function Usage
/* Scenario: there is a need to modify the alternative compare value
* (Compare 1) for the first (index = 0) counter of the TCPWM0 block.
* Note: the compare swapping feature should be enabled.
* This can be used to change the compare value on the fly without a
* modification of the compare value itself.
*/
#define MY_TCPWM_PWM_NUM (0UL)
/* Get the currently existing compare value */
uint32_t compare = Cy_TCPWM_PWM_GetCompare0BufVal(TCPWM0, MY_TCPWM_PWM_NUM);
/* Modify the compare value here */
Cy_TCPWM_PWM_SetCompare0BufVal(TCPWM0, MY_TCPWM_PWM_NUM, compare);
/* Now the compare 0 and 1 values can be swapped using either HW input or Cy_TCPWM_TriggerCaptureOrSwap_Single */

◆ Cy_TCPWM_PWM_GetCompare0BufVal()

__STATIC_INLINE uint32_t Cy_TCPWM_PWM_GetCompare0BufVal ( TCPWM_Type const *  base,
uint32_t  cntNum 
)

Returns the buffered compare 0 value.

Parameters
baseThe pointer to a TCPWM instance.
cntNumThe Counter instance number in the selected TCPWM.
Returns
Buffered compare 0 value.
Function Usage
/* Scenario: there is a need to modify the alternative compare value
* (Compare 1) for the first (index = 0) counter of the TCPWM0 block.
* Note: the compare swapping feature should be enabled.
* This can be used to change the compare value on the fly without a
* modification of the compare value itself.
*/
#define MY_TCPWM_PWM_NUM (0UL)
/* Get the currently existing compare value */
uint32_t compare = Cy_TCPWM_PWM_GetCompare0BufVal(TCPWM0, MY_TCPWM_PWM_NUM);
/* Modify the compare value here */
Cy_TCPWM_PWM_SetCompare0BufVal(TCPWM0, MY_TCPWM_PWM_NUM, compare);
/* Now the compare 0 and 1 values can be swapped using either HW input or Cy_TCPWM_TriggerCaptureOrSwap_Single */

◆ Cy_TCPWM_PWM_EnableCompare0Swap()

__STATIC_INLINE void Cy_TCPWM_PWM_EnableCompare0Swap ( TCPWM_Type base,
uint32_t  cntNum,
bool  enable 
)

Enables the comparison swap of compare 0 and compareBuf 0 on OV and/or UN, depending on the PWM alignment.

Parameters
baseThe pointer to a TCPWM instance.
cntNumThe Counter instance number in the selected TCPWM.
enabletrue = swap enabled; false = swap disabled
Function Usage
/* Scenario: there is a need to enable the compare swapping feature for
* the first (index = 0) PWM of the TCPWM0 block
* This can be used to change the compare value on the fly without a
* modification of the compare value itself.
*/
#define MY_TCPWM_PWM_NUM (0UL)
Cy_TCPWM_PWM_EnableCompare0Swap(TCPWM0, MY_TCPWM_PWM_NUM, true);
/* Now the compare 0 and 1 values can be swapped using either HW input or Cy_TCPWM_TriggerCaptureOrSwap_Single */
Note
From Version 3 of TCPWM, this feature is coupled with the swap enable feature (Cy_TCPWM_PWM_EnableSwap()). when both reload and swap are enabled then CC0 value is swapped with CC0 buff value. When only reload is enabled then CC0 buff value is copied to CC0. There is no action when reload is disabled.

◆ Cy_TCPWM_PWM_SetCounter()

__STATIC_INLINE void Cy_TCPWM_PWM_SetCounter ( TCPWM_Type base,
uint32_t  cntNum,
uint32_t  count 
)

Sets the value of the counter.

Parameters
baseThe pointer to a TCPWM instance.
cntNumThe Counter instance number in the selected TCPWM.
countThe value to write into the counter.
Function Usage
/* Scenario: there is a need to set the counter value for
* the first (index = 0) counter of the TCPWM0 block
*/
#define MY_TCPWM_PWM_NUM (0UL)
#define MY_TCPWM_PWM_MASK (1UL << MY_TCPWM_PWM_NUM)
#define MY_TCPWM_PWM_VAL (100UL)
Cy_TCPWM_TriggerStopOrKill_Single(TCPWM0, MY_TCPWM_PWM_NUM);
Cy_TCPWM_PWM_SetCounter(TCPWM0, MY_TCPWM_PWM_NUM, MY_TCPWM_PWM_VAL);
Cy_TCPWM_TriggerStart_Single(TCPWM0, MY_TCPWM_PWM_NUM);

◆ Cy_TCPWM_PWM_GetCounter()

__STATIC_INLINE uint32_t Cy_TCPWM_PWM_GetCounter ( TCPWM_Type const *  base,
uint32_t  cntNum 
)

Returns the value in the counter.

Parameters
baseThe pointer to a TCPWM instance.
cntNumThe Counter instance number in the selected TCPWM.
Returns
The current counter value.
Function Usage
/* Scenario: there is a need to get the current counter value of
* the first (index = 0) counter of the TCPWM0 block
* This can be used instead of capture mechanism,
* when the time latency is not critical, etc.
*/
#define MY_TCPWM_PWM_NUM (0UL)
uint32_t count = Cy_TCPWM_PWM_GetCounter(TCPWM0, MY_TCPWM_PWM_NUM);

◆ Cy_TCPWM_PWM_SetPeriod0()

__STATIC_INLINE void Cy_TCPWM_PWM_SetPeriod0 ( TCPWM_Type base,
uint32_t  cntNum,
uint32_t  period0 
)

Sets the value of the period register.

Parameters
baseThe pointer to a TCPWM instance.
cntNumThe Counter instance number in the selected TCPWM.
period0The value to write into a period.
Function Usage
/* Scenario: there is a need to modify the Period 0 value of
* the first (index = 0) PWM of the TCPWM0 block.
* This can be used to change the PWM signal frequency.
* Note: prior to Period 0 changing either should be done:
* - the PWM should be disabled (if the period swapping feature is not used).
* - the period swapping feature should be enabled and the current "working" period should be the Period 1.
*/
#define MY_TCPWM_PWM_NUM (0UL)
/* Get the currently existing period value */
uint32_t period = Cy_TCPWM_PWM_GetPeriod0(TCPWM0, MY_TCPWM_PWM_NUM);
/* Modify the period value here */
Cy_TCPWM_PWM_SetPeriod0(TCPWM0, MY_TCPWM_PWM_NUM, period);

◆ Cy_TCPWM_PWM_GetPeriod0()

__STATIC_INLINE uint32_t Cy_TCPWM_PWM_GetPeriod0 ( TCPWM_Type const *  base,
uint32_t  cntNum 
)

Returns the value in the period register.

Parameters
baseThe pointer to a TCPWM instance.
cntNumThe Counter instance number in the selected TCPWM.
Returns
The current period value.
Function Usage
/* Scenario: there is a need to modify the Period 0 value of
* the first (index = 0) PWM of the TCPWM0 block.
* This can be used to change the PWM signal frequency.
* Note: prior to Period 0 changing either should be done:
* - the PWM should be disabled (if the period swapping feature is not used).
* - the period swapping feature should be enabled and the current "working" period should be the Period 1.
*/
#define MY_TCPWM_PWM_NUM (0UL)
/* Get the currently existing period value */
uint32_t period = Cy_TCPWM_PWM_GetPeriod0(TCPWM0, MY_TCPWM_PWM_NUM);
/* Modify the period value here */
Cy_TCPWM_PWM_SetPeriod0(TCPWM0, MY_TCPWM_PWM_NUM, period);

◆ Cy_TCPWM_PWM_SetPeriod1()

__STATIC_INLINE void Cy_TCPWM_PWM_SetPeriod1 ( TCPWM_Type base,
uint32_t  cntNum,
uint32_t  period1 
)

Sets the value of the period register.

In pseudo random mode period 1 sets which taps are enabled.

Parameters
baseThe pointer to a TCPWM instance.
cntNumThe Counter instance number in the selected TCPWM.
period1The value to write into a period 1.
Function Usage
/* Scenario: there is a need to modify the alternative period value
* (Period 1) of the first (index = 0) PWM of the TCPWM0 block.
* Note: the period swapping feature should be enabled.
* This can be used to change the PWM signal frequency on the fly without a
* modification of the period value itself.
*/
#define MY_TCPWM_CNT_NUM (0UL)
/* Get the currently existing period value */
uint32_t period = Cy_TCPWM_PWM_GetPeriod1(TCPWM0, MY_TCPWM_PWM_NUM);
/* Modify the period value here */
Cy_TCPWM_PWM_SetPeriod1(TCPWM0, MY_TCPWM_PWM_NUM, period);
/* Now the Period 0 and 1 values can be swapped using Cy_TCPWM_TriggerCaptureOrSwap_Single */

◆ Cy_TCPWM_PWM_GetPeriod1()

__STATIC_INLINE uint32_t Cy_TCPWM_PWM_GetPeriod1 ( TCPWM_Type const *  base,
uint32_t  cntNum 
)

Returns the value in the period register.

Parameters
baseThe pointer to a COUNTER PWM instance.
cntNumThe Counter instance number in the selected TCPWM.
Returns
The current period value.
Function Usage
/* Scenario: there is a need to modify the alternative period value
* (Period 1) of the first (index = 0) PWM of the TCPWM0 block.
* Note: the period swapping feature should be enabled.
* This can be used to change the PWM signal frequency on the fly without a
* modification of the period value itself.
*/
#define MY_TCPWM_CNT_NUM (0UL)
/* Get the currently existing period value */
uint32_t period = Cy_TCPWM_PWM_GetPeriod1(TCPWM0, MY_TCPWM_PWM_NUM);
/* Modify the period value here */
Cy_TCPWM_PWM_SetPeriod1(TCPWM0, MY_TCPWM_PWM_NUM, period);
/* Now the Period 0 and 1 values can be swapped using Cy_TCPWM_TriggerCaptureOrSwap_Single */

◆ Cy_TCPWM_PWM_EnablePeriodSwap()

__STATIC_INLINE void Cy_TCPWM_PWM_EnablePeriodSwap ( TCPWM_Type base,
uint32_t  cntNum,
bool  enable 
)

Enables a period swap on OV and/or UN, depending on the PWM alignment.

Parameters
baseThe pointer to a TCPWM instance.
cntNumThe Counter instance number in the selected TCPWM.
enabletrue = swap enabled; false = swap disabled
Function Usage
/* Scenario: there is a need to enable the period swapping feature for
* the first (index = 0) PWM of the TCPWM0 block
* This can be used to change the period value on the fly without a
* modification of the period value itself.
*/
#define MY_TCPWM_PWM_NUM (0UL)
Cy_TCPWM_PWM_EnablePeriodSwap(TCPWM0, MY_TCPWM_PWM_NUM, true);
/* Now the Period 0 and 1 values can be swapped using either Swap HW input or Cy_TCPWM_TriggerCaptureOrSwap_Single */
Note
From Version 3 of TCPWM, this feature is coupled with the swap enable feature (Cy_TCPWM_PWM_EnableSwap()). when both reload and swap are enabled then period value is swapped with period buff value. When only reload is enabled then period buff value is copied to period. There is no action when reload is disabled.

◆ Cy_TCPWM_PWM_GetDtCounter()

__STATIC_INLINE uint32_t Cy_TCPWM_PWM_GetDtCounter ( TCPWM_Type const *  base,
uint32_t  cntNum 
)

Returns the dead time count when the PWM is configured in dead time mode.

Parameters
baseThe pointer to a TCPWM instance.
cntNumThe Counter instance number in the selected TCPWM.
Returns
The dead time counter.
Function Usage
/* Scenario: When the PWM is configured in dead time mode, get the dead time counter value*/
#define MY_TCPWM_PWM_NUM (0UL)
uint32_t count = Cy_TCPWM_PWM_GetDtCounter(TCPWM0, MY_TCPWM_PWM_NUM);
Note
supported only in TCPWM_ver2

◆ Cy_TCPWM_PWM_LineOutStatus()

__STATIC_INLINE uint32_t Cy_TCPWM_PWM_LineOutStatus ( TCPWM_Type const *  base,
uint32_t  cntNum,
uint32_t  pwmOutSelect 
)

Returns the current level of the selected pwm output line.

Parameters
baseThe pointer to a TCPWM instance.
cntNumThe Counter instance number in the selected TCPWM.
pwmOutSelectDefines which pwm output line is being checked pwm or pwm_n.
Returns
The current pwm output line level.
Function Usage
/* Scenario: there is a need to check current level of
* PWM Line output for the first (index = 0) counter of the TCPWM0 block
*/
#define MY_TCPWM_PWM_NUM (0UL)
if (Cy_TCPWM_PWM_LineOutStatus(TCPWM0, MY_TCPWM_PWM_NUM, CY_TCPWM_PWM_LINE_PWM))
{
/* PWM Line is High */
}
else
{
/* PWM Line is Low */
}
Note
supported only in TCPWM_ver2

◆ Cy_TCPWM_PWM_PWMDeadTime()

__STATIC_INLINE void Cy_TCPWM_PWM_PWMDeadTime ( TCPWM_Type const *  base,
uint32_t  cntNum,
uint32_t  deadTime 
)

Writes the dead time value for PWM.

This is the number of clock cycles of dead time to activate Line Out

Parameters
baseThe pointer to a TCPWM instance.
cntNumThe Counter instance number in the selected TCPWM.
deadTimeThe dead time value.
Function Usage
/* Scenario: there is a need to update deadTimeClocks for line_out
* and line_compl_out for the first (index = 0) counter of the TCPWM0 block
*/
#define MY_TCPWM_PWM_NUM (0UL)
Cy_TCPWM_PWM_PWMDeadTime(TCPWM0, MY_TCPWM_PWM_NUM, 10U);
Cy_TCPWM_PWM_PWMDeadTimeN(TCPWM0, MY_TCPWM_PWM_NUM, 10U);

◆ Cy_TCPWM_PWM_PWMDeadTimeN()

__STATIC_INLINE void Cy_TCPWM_PWM_PWMDeadTimeN ( TCPWM_Type const *  base,
uint32_t  cntNum,
uint32_t  deadTime 
)

Writes the dead time value for PWM.

This is the number of clock cycles of dead time to activate Line Compliment Out

Parameters
baseThe pointer to a TCPWM instance.
cntNumThe Counter instance number in the selected TCPWM.
deadTimeThe dead time value.
Function Usage
/* Scenario: there is a need to update deadTimeClocks for line_out
* and line_compl_out for the first (index = 0) counter of the TCPWM0 block
*/
#define MY_TCPWM_PWM_NUM (0UL)
Cy_TCPWM_PWM_PWMDeadTime(TCPWM0, MY_TCPWM_PWM_NUM, 10U);
Cy_TCPWM_PWM_PWMDeadTimeN(TCPWM0, MY_TCPWM_PWM_NUM, 10U);

◆ Cy_TCPWM_PWM_Configure_LineSelect()

__STATIC_INLINE void Cy_TCPWM_PWM_Configure_LineSelect ( TCPWM_Type base,
uint32_t  cntNum,
cy_en_line_select_config_t  line_out_val,
cy_en_line_select_config_t  line_compl_value 
)

Configures the source for the output signal "line_out" and "line_compl_out".

Parameters
baseThe pointer to a TCPWM instance.
cntNumThe Counter instance number in the selected TCPWM.
line_out_valSource for the lie out signal cy_en_line_select_config_t
line_compl_valueSource for the lie compl out signal cy_en_line_select_config_t

◆ Cy_TCPWM_PWM_Configure_LineSelectBuff()

__STATIC_INLINE void Cy_TCPWM_PWM_Configure_LineSelectBuff ( TCPWM_Type base,
uint32_t  cntNum,
cy_en_line_select_config_t  line_out_val,
cy_en_line_select_config_t  line_compl_value 
)

Buffer for LINE SELCT.

Can be exchanged with Line Select values on a terminal count event with an actively pending switch event.

Parameters
baseThe pointer to a TCPWM instance.
cntNumThe Counter instance number in the selected TCPWM.
line_out_valSource for the lie out signal cy_en_line_select_config_t
line_compl_valueSource for the lie compl out signal cy_en_line_select_config_t

◆ Cy_TCPWM_PWM_EnableLineSelectSwap()

__STATIC_INLINE void Cy_TCPWM_PWM_EnableLineSelectSwap ( TCPWM_Type base,
uint32_t  cntNum,
bool  enable 
)

Enables a Line Select swap on OV and/or UN, depending on the PWM alignment.

Parameters
baseThe pointer to a TCPWM instance.
cntNumThe Counter instance number in the selected TCPWM.
enabletrue = swap enabled; false = swap disabled
Note
From Version 3 of TCPWM, this feature is coupled with the swap enable feature (Cy_TCPWM_PWM_EnableSwap()). when both reload and swap are enabled then line select value is swapped with line select buff value. When only reload is enabled then line select buff value is copied to line select. There is no action when reload is disabled.

◆ Cy_TCPWM_PWM_SetDT()

__STATIC_INLINE void Cy_TCPWM_PWM_SetDT ( TCPWM_Type const *  base,
uint32_t  cntNum,
uint32_t  deadTime 
)

Writes the dead time value for PWM.

This is the number of clock cycles of dead time to activate Line Out and Line Compliment Out

Parameters
baseThe pointer to a TCPWM instance.
cntNumThe Counter instance number in the selected TCPWM.
deadTimeThe dead time value for both Line Out and Line Compliment Out.
Note
32 bit value with 0-15 bits to set Line out Dead Time value and 16-31 bits to set Line Compliment Out Deat Time Value.

◆ Cy_TCPWM_PWM_EnableSwap()

__STATIC_INLINE void Cy_TCPWM_PWM_EnableSwap ( TCPWM_Type base,
uint32_t  cntNum,
bool  enable 
)

Enables/disables swapping mechanism between CC0 and buffered CC0, CC1 and buffered CC1, PERIOD and buffered PERIOD, DT and buffered DT.

Parameters
baseThe pointer to a TCPWM instance.
cntNumThe Counter instance number in the selected TCPWM.
enabletrue = swap enabled; false = swap disabled
Note
This feature is coupled with the reload feature. when both reload and swap are enabled then CC0/CC1/PERIOD/DT values are swapped with CC_BUFF/CC1_BUFF/PERIOD_BUFF/DT_BUFF values respectively When only reload is enabled then CC_BUFF/CC1_BUFF/PERIOD_BUFF/DT_BUFF values are copied to CC0/CC1/PERIOD/DT respectively. There is no action when reload is disabled.

◆ Cy_TCPWM_PWM_Configure_Dithering()

cy_en_tcpwm_status_t Cy_TCPWM_PWM_Configure_Dithering ( TCPWM_Type base,
uint32_t  cntNum,
cy_en_tcpwm_dithering_t  mode,
uint8_t  period,
uint8_t  duty,
cy_en_dithering_limiter_t  limiter 
)

configures dithering.

applicable only when GRP_DITHERING_PRESENT and in PWM and PWM_DT mode

Parameters
baseThe pointer to a TCPWM instance.
cntNumThe Counter instance number in the selected TCPWM.
modeDithering mode See cy_en_tcpwm_dithering_t .
periodinitial value for period LFSR. Should be non zero value.
dutyInitial value for duty LFSR. Should be non zero value.
limiterDithering limiter values. It defines the magnitude of the pseudo-random value to be added to period/CC0/CC1 cy_en_dithering_limiter_t
Returns
Error / Status code. See cy_en_tcpwm_status_t.
Note
When PWM alignment mode set to "asymmetric CC0 and CC1", The duty width remains the same, because the same value is added to CC0 and CC1. As LFSR is updated at tc event and both CC0 match and CC1 match happen before tc event.

◆ Cy_TCPWM_PWM_PWMDeadTimeBuff()

__STATIC_INLINE void Cy_TCPWM_PWM_PWMDeadTimeBuff ( TCPWM_Type const *  base,
uint32_t  cntNum,
uint32_t  deadTime 
)

Writes the dead time buffered value for PWM.

This is the number of clock cycles of dead time to activate Line Out Data from DT_BUFF will be shallow transferred to DT (when swap enable is disabled) on a terminal count event with an actively pending switch event.

Parameters
baseThe pointer to a TCPWM instance.
cntNumThe Counter instance number in the selected TCPWM.
deadTimeThe dead time value.
Function Usage
/* Scenario: there is a need to update deadTimeClocks for line_out
* and line_compl_out for the first (index = 0) counter of the TCPWM0 block
*/
#define MY_TCPWM_PWM_NUM (0UL)
Cy_TCPWM_PWM_PWMDeadTime(TCPWM0, MY_TCPWM_PWM_NUM, 10U);
Cy_TCPWM_PWM_PWMDeadTimeN(TCPWM0, MY_TCPWM_PWM_NUM, 10U);

◆ Cy_TCPWM_PWM_PWMDeadTimeBuffN()

__STATIC_INLINE void Cy_TCPWM_PWM_PWMDeadTimeBuffN ( TCPWM_Type const *  base,
uint32_t  cntNum,
uint32_t  deadTime 
)

Writes the dead time buffered value for PWM.

This is the number of clock cycles of dead time to activate Line Compliment Out Data from DT_BUFF will be shallow transferred to DT (when swap enable is disabled) on a terminal count event with an actively pending switch event.

Parameters
baseThe pointer to a TCPWM instance.
cntNumThe Counter instance number in the selected TCPWM.
deadTimeThe dead time value.
Function Usage
/* Scenario: there is a need to update deadTimeClocks for line_out
* and line_compl_out for the first (index = 0) counter of the TCPWM0 block
*/
#define MY_TCPWM_PWM_NUM (0UL)
Cy_TCPWM_PWM_PWMDeadTime(TCPWM0, MY_TCPWM_PWM_NUM, 10U);
Cy_TCPWM_PWM_PWMDeadTimeN(TCPWM0, MY_TCPWM_PWM_NUM, 10U);

◆ Cy_TCPWM_PWM_SetDTBuff()

__STATIC_INLINE void Cy_TCPWM_PWM_SetDTBuff ( TCPWM_Type const *  base,
uint32_t  cntNum,
uint32_t  deadTime 
)

Writes the dead time buffered value for PWM.

This is the number of clock cycles of dead time to activate Line Out and Line Compliment Out Data from DT_BUFF will be shallow transferred to DT (when swap enable is disabled) on a terminal count event with an actively pending switch event.

Parameters
baseThe pointer to a TCPWM instance.
cntNumThe Counter instance number in the selected TCPWM.
deadTimeThe dead time value for both Line Out and Line Compliment Out.
Note
32 bit value with 0-15 bits to set Line out Dead Time value and 16-31 bits to set Line Compliment Out Deat Time Value.

◆ Cy_TCPWM_PWM_SetCompare1Val()

__STATIC_INLINE void Cy_TCPWM_PWM_SetCompare1Val ( TCPWM_Type base,
uint32_t  cntNum,
uint32_t  compare1 
)

Sets the compare value for Compare 1 when the compare mode enabled.

Parameters
baseThe pointer to a TCPWM instance.
cntNumThe Counter instance number in the selected TCPWM.
compare1The Compare1 value.

◆ Cy_TCPWM_PWM_GetCompare1Val()

__STATIC_INLINE uint32_t Cy_TCPWM_PWM_GetCompare1Val ( TCPWM_Type const *  base,
uint32_t  cntNum 
)

Returns compare 1 value.

Parameters
baseThe pointer to a TCPWM instance.
cntNumThe Counter instance number in the selected TCPWM.
Returns
Compare 1 value.

◆ Cy_TCPWM_PWM_SetCompare1BufVal()

__STATIC_INLINE void Cy_TCPWM_PWM_SetCompare1BufVal ( TCPWM_Type base,
uint32_t  cntNum,
uint32_t  compareBuf1 
)

Sets the buffered compare value for Compare1 when the compare mode enabled.

Parameters
baseThe pointer to a TCPWM instance.
cntNumThe Counter instance number in the selected TCPWM.
compareBuf1The buffered Compare 1 value.

◆ Cy_TCPWM_PWM_GetCompare1BufVal()

__STATIC_INLINE uint32_t Cy_TCPWM_PWM_GetCompare1BufVal ( TCPWM_Type const *  base,
uint32_t  cntNum 
)

Returns the buffered compare 1 value.

Parameters
baseThe pointer to a TCPWM instance.
cntNumThe Counter instance number in the selected TCPWM.
Returns
Buffered compare 1 value.

◆ Cy_TCPWM_PWM_EnableCompare1Swap()

__STATIC_INLINE void Cy_TCPWM_PWM_EnableCompare1Swap ( TCPWM_Type base,
uint32_t  cntNum,
bool  enable 
)

Enables the comparison swap of compare1 and compareBuf1 on OV and/or UN, depending on the PWM alignment.

Parameters
baseThe pointer to a TCPWM instance.
cntNumThe Counter instance number in the selected TCPWM.
enabletrue = swap enabled; false = swap disabled
Note
From Version 3 of TCPWM, this feature is coupled with the swap enable feature (Cy_TCPWM_PWM_EnableSwap()). when both reload and swap are enabled then CC1 value is swapped with CC1 buff value. When only reload is enabled then CC1 buff value is copied to CC1. There is no action when reload is disabled.

◆ Cy_TCPWM_PWM_Set_KillLinePolarity()

__STATIC_INLINE void Cy_TCPWM_PWM_Set_KillLinePolarity ( TCPWM_Type base,
uint32_t  cntNum,
cy_en_kill_line_polarity_t  kill_line_polarity 
)

Configures the source for the output signal "line_out" and "line_compl_out".

Parameters
baseThe pointer to a TCPWM instance.
cntNumThe Counter instance number in the selected TCPWM.
kill_line_polarityKill Line polarity value cy_en_kill_line_polarity_t