PSOC E8XXGP Device Support Library

| PSOC E8XXGP Device Support Library

Functions
Functions
PDL API Reference » TCPWM (Timer Counter PWM) » PWM (TCPWM)

## 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 SELECT. 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.
  PSOC C3 device: This API also tries to disable HRPWM wounding when this feature is available on the target device. when HRPWM feature is enabled in the configuration structure this function checks if TCPWM wounding register is accessible and if yes then activate HRPWM feature. This operation could be done only if the application is running in protection context (PCTX) = 2 and because of that HRPWM feature could be automatically enable by this function only when PC == 2. The example how to activate HRPWM feature on the device which support it is in code snippet for this function.

Parameters

  base | The pointer to a TCPWM instance.
  cntNum | The Counter instance number in the selected TCPWM.
  config | The 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);
  cy_stc_tcpwm_pwm_config_t
  PWM configuration structure.
  Definition: cy_tcpwm_pwm.h:183
  CY_TCPWM_SUCCESS
  @ CY_TCPWM_SUCCESS
  Successful.
  Definition: cy_tcpwm.h:402
  Cy_TCPWM_TriggerStart_Single
  __STATIC_INLINE void Cy_TCPWM_TriggerStart_Single(TCPWM_Type *base, uint32_t cntNum)
  Triggers a software start on the selected TCPWM.
  Definition: cy_tcpwm.h:891
  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.
  Definition: cy_tcpwm_pwm.c:76
  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.
  Definition: cy_tcpwm_pwm.h:521
  CY_TCPWM_INPUT_RISINGEDGE
  #define CY_TCPWM_INPUT_RISINGEDGE
  A rising edge triggers the event (Capture, Start, Reload, etc..)
  Definition: cy_tcpwm.h:266
  CY_TCPWM_INPUT_LEVEL
  #define CY_TCPWM_INPUT_LEVEL
  The event is triggered on each edge of the TCPWM clock if the input is high.
  Definition: cy_tcpwm.h:272
  CY_TCPWM_INPUT_1
  #define CY_TCPWM_INPUT_1
  Input is tied to logic 1.
  Definition: cy_tcpwm.h:229
  CY_TCPWM_INPUT_0
  #define CY_TCPWM_INPUT_0
  Input is tied to logic 0.
  Definition: cy_tcpwm.h:228
  CY_TCPWM_INT_ON_TC
  #define CY_TCPWM_INT_ON_TC
  Interrupt on Terminal count(TC)
  Definition: cy_tcpwm.h:306
  CY_TCPWM_PWM_LEFT_ALIGN
  #define CY_TCPWM_PWM_LEFT_ALIGN
  PWM is left aligned, meaning it starts high.
  Definition: cy_tcpwm_pwm.h:285
  CY_TCPWM_PWM_PRESCALER_DIVBY_4
  #define CY_TCPWM_PWM_PRESCALER_DIVBY_4
  Divide by 4.
  Definition: cy_tcpwm_pwm.h:328
  CY_TCPWM_PWM_STOP_ON_KILL
  #define CY_TCPWM_PWM_STOP_ON_KILL
  PWM stops counting on kill.
  Definition: cy_tcpwm_pwm.h:299
  CY_TCPWM_PWM_MODE_PWM
  #define CY_TCPWM_PWM_MODE_PWM
  Standard PWM Mode.
  Definition: cy_tcpwm_pwm.h:276
  CY_TCPWM_PWM_CONTINUOUS
  #define CY_TCPWM_PWM_CONTINUOUS
  Counter runs forever.
  Definition: cy_tcpwm_pwm.h:269
  /* 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_OUTPUT_CONSTANT_0
  @ CY_TCPWM_OUTPUT_CONSTANT_0
  Output signal is 0.
  Definition: cy_tcpwm_pwm.h:172
  CY_TCPWM_CNT_TRIGGER_ON_DISABLED
  #define CY_TCPWM_CNT_TRIGGER_ON_DISABLED
  Output trigger disabled.
  Definition: cy_tcpwm.h:297
  CY_TCPWM_PWM_OUTPUT_HIGHZ
  #define CY_TCPWM_PWM_OUTPUT_HIGHZ
  PWM output (default) high impedance.
  Definition: cy_tcpwm_pwm.h:308
  /* Scenario: there is need to initialize
  * the first (index = 0) PWM of the TCPWM0 block
  * with the below configuration settings and enable HRPWM feature
  */
  cy_stc_tcpwm_pwm_config_t tcpwm_v3_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,
  /* .hrpwm_enable = */ true,
  /* .hrpwm_input_freq = */ CY_TCPWM_HRPWM_FREQ_80MHZ_OR_100MHZ,
  };
  #define MY_TCPWM_PWM_NUM (0UL)
  #define MY_TCPWM_PWM_MASK (1UL << MY_TCPWM_PWM_NUM)
  /* PSOC C3 device: Disable HRPWM wounding on the device on which this feature is present.
  Note: Write to this register may cause a HardFault on the PSOC C3 device with disabled HRPWM feature
  This instruction should be called each time when the TCPWM block was turned off and on */
  /*
  * #if defined (CY_DEVICE_PSC3)
  * CY_SET_REG32(GET_ALIAS_ADDRESS(CY_SYSTEM_TCPWM_DISABLE_ADDR), 0);
  * #endif
  */
  if (CY_TCPWM_SUCCESS != Cy_TCPWM_PWM_Init(TCPWM0, MY_TCPWM_PWM_NUM, &tcpwm_v3_pwm_config))
  {
  /* Handle possible errors */
  }
  /* Enable the initialized PWM */
  Cy_TCPWM_PWM_Enable(TCPWM0, MY_TCPWM_PWM_NUM);
  CY_TCPWM_HRPWM_FREQ_80MHZ_OR_100MHZ
  @ CY_TCPWM_HRPWM_FREQ_80MHZ_OR_100MHZ
  HRPWM Input Frequency is 80 MHz or 100 MHz
  Definition: cy_tcpwm_pwm.h:152

## ◆ 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

  base | The pointer to a TCPWM instance.
  cntNum | The Counter instance number in the selected TCPWM.
  config | The 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_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.
  Definition: cy_tcpwm_pwm.c:396
  Cy_TCPWM_PWM_Disable
  __STATIC_INLINE void Cy_TCPWM_PWM_Disable(TCPWM_Type *base, uint32_t cntNum)
  Disables the counter in the TCPWM block.
  Definition: cy_tcpwm_pwm.h:547

## ◆ 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

  base | The pointer to a TCPWM instance.
  cntNum | The 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

  base | The pointer to a TCPWM instance.
  cntNum | The 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

  base | The pointer to a TCPWM instance.
  cntNum | The Counter instance number in the selected TCPWM.

Returns
  The status. See PWM Status. The status value is not the same as in TCPWM status register.

Note
  The status value is not the same as in TCPWM status register.

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);
  if ((CY_TCPWM_PWM_STATUS_COUNTER_RUNNING & status) && (CY_TCPWM_PWM_STATUS_UP_COUNTING & status))
  {
  /* Up Counting */
  }
  else if ((CY_TCPWM_PWM_STATUS_COUNTER_RUNNING & status) && (CY_TCPWM_PWM_STATUS_DOWN_COUNTING & status))
  {
  /* Down Counting */
  }
  else
  {
  /* PWM is not running */
  }
  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.
  Definition: cy_tcpwm_pwm.h:576
  CY_TCPWM_PWM_STATUS_COUNTER_RUNNING
  #define CY_TCPWM_PWM_STATUS_COUNTER_RUNNING
  PWM counter is running.
  Definition: cy_tcpwm_pwm.h:355
  CY_TCPWM_PWM_STATUS_DOWN_COUNTING
  #define CY_TCPWM_PWM_STATUS_DOWN_COUNTING
  PWM is down counting.
  Definition: cy_tcpwm_pwm.h:348
  CY_TCPWM_PWM_STATUS_UP_COUNTING
  #define CY_TCPWM_PWM_STATUS_UP_COUNTING
  PWM is up counting.
  Definition: cy_tcpwm_pwm.h:349

## ◆ 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

  base | The pointer to a TCPWM instance.
  cntNum | The Counter instance number in the selected TCPWM.
  compare0 | The 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.
  Definition: cy_tcpwm_pwm.h:661
  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.
  Definition: cy_tcpwm_pwm.h:636

## ◆ Cy_TCPWM_PWM_GetCompare0Val()

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

Returns compare 0 value.

Parameters

  base | The pointer to a TCPWM instance.
  cntNum | The 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

  base | The pointer to a TCPWM instance.
  cntNum | The Counter instance number in the selected TCPWM.
  compareBuf0 | The 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.
  Definition: cy_tcpwm_pwm.h:711
  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.
  Definition: cy_tcpwm_pwm.h:686

## ◆ 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

  base | The pointer to a TCPWM instance.
  cntNum | The 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

  base | The pointer to a TCPWM instance.
  cntNum | The Counter instance number in the selected TCPWM.
  enable | true = 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 */
  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 align...
  Definition: cy_tcpwm_pwm.h:830

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

  base | The pointer to a TCPWM instance.
  cntNum | The Counter instance number in the selected TCPWM.
  count | The 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_TriggerStopOrKill_Single
  __STATIC_INLINE void Cy_TCPWM_TriggerStopOrKill_Single(TCPWM_Type *base, uint32_t cntNum)
  Triggers a stop in the Timer Counter mode, or a kill in the PWM mode on selected TCPWM.
  Definition: cy_tcpwm.h:947
  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.
  Definition: cy_tcpwm_pwm.h:883

## ◆ 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

  base | The pointer to a TCPWM instance.
  cntNum | The 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_GetCounter
  __STATIC_INLINE uint32_t Cy_TCPWM_PWM_GetCounter(TCPWM_Type const *base, uint32_t cntNum)
  Returns the value in the counter.
  Definition: cy_tcpwm_pwm.h:908

## ◆ 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

  base | The pointer to a TCPWM instance.
  cntNum | The Counter instance number in the selected TCPWM.
  period0 | The 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.
  Definition: cy_tcpwm_pwm.h:958
  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.
  Definition: cy_tcpwm_pwm.h:933

## ◆ 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

  base | The pointer to a TCPWM instance.
  cntNum | The 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

  base | The pointer to a TCPWM instance.
  cntNum | The Counter instance number in the selected TCPWM.
  period1 | The 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.
  Definition: cy_tcpwm_pwm.h:1014
  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.
  Definition: cy_tcpwm_pwm.h:984

## ◆ 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

  base | The pointer to a COUNTER PWM instance.
  cntNum | The 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

  base | The pointer to a TCPWM instance.
  cntNum | The Counter instance number in the selected TCPWM.
  enable | true = 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 */
  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.
  Definition: cy_tcpwm_pwm.h:1053

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

  base | The pointer to a TCPWM instance.
  cntNum | The 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);
  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.
  Definition: cy_tcpwm_pwm.h:1101

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

  base | The pointer to a TCPWM instance.
  cntNum | The Counter instance number in the selected TCPWM.
  pwmOutSelect | Defines 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 */
  }
  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.
  Definition: cy_tcpwm_pwm.h:1135
  CY_TCPWM_PWM_LINE_PWM
  #define CY_TCPWM_PWM_LINE_PWM
  PWM Line output.
  Definition: cy_tcpwm_pwm.h:318

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

  base | The pointer to a TCPWM instance.
  cntNum | The Counter instance number in the selected TCPWM.
  deadTime | The 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.
  Definition: cy_tcpwm_pwm.h:1222
  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.
  Definition: cy_tcpwm_pwm.h:1179

## ◆ 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

  base | The pointer to a TCPWM instance.
  cntNum | The Counter instance number in the selected TCPWM.
  deadTime | The 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

  base | The pointer to a TCPWM instance.
  cntNum | The Counter instance number in the selected TCPWM.
  line_out_val | Source for the lie out signal cy_en_line_select_config_t
  line_compl_value | Source 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 SELECT.

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

Parameters

  base | The pointer to a TCPWM instance.
  cntNum | The Counter instance number in the selected TCPWM.
  line_out_val | Source for the lie out signal cy_en_line_select_config_t
  line_compl_value | Source 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

  base | The pointer to a TCPWM instance.
  cntNum | The Counter instance number in the selected TCPWM.
  enable | true = 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

  base | The pointer to a TCPWM instance.
  cntNum | The Counter instance number in the selected TCPWM.
  deadTime | The 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 Dead 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

  base | The pointer to a TCPWM instance.
  cntNum | The Counter instance number in the selected TCPWM.
  enable | true = 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

  base | The pointer to a TCPWM instance.
  cntNum | The Counter instance number in the selected TCPWM.
  mode | Dithering mode See cy_en_tcpwm_dithering_t .
  period | initial value for period LFSR. Should be non zero value.
  duty | Initial value for duty LFSR. Should be non zero value.
  limiter | Dithering 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

  base | The pointer to a TCPWM instance.
  cntNum | The Counter instance number in the selected TCPWM.
  deadTime | The 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

  base | The pointer to a TCPWM instance.
  cntNum | The Counter instance number in the selected TCPWM.
  deadTime | The 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

  base | The pointer to a TCPWM instance.
  cntNum | The Counter instance number in the selected TCPWM.
  deadTime | The 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 Dead 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

  base | The pointer to a TCPWM instance.
  cntNum | The Counter instance number in the selected TCPWM.
  compare1 | The 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

  base | The pointer to a TCPWM instance.
  cntNum | The 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

  base | The pointer to a TCPWM instance.
  cntNum | The Counter instance number in the selected TCPWM.
  compareBuf1 | The 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

  base | The pointer to a TCPWM instance.
  cntNum | The 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

  base | The pointer to a TCPWM instance.
  cntNum | The Counter instance number in the selected TCPWM.
  enable | true = 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

  base | The pointer to a TCPWM instance.
  cntNum | The Counter instance number in the selected TCPWM.
  kill_line_polarity | Kill Line polarity value cy_en_kill_line_polarity_t