MTB CAT1 Peripheral driver library

General Description

Functions

__STATIC_INLINE void Cy_TCPWM_Enable_Multiple (TCPWM_Type *base, uint32_t counters)
 Enables the counter(s) in the TCPWM block. More...
 
__STATIC_INLINE void Cy_TCPWM_Disable_Multiple (TCPWM_Type *base, uint32_t counters)
 Disables the counter(s) in the TCPWM block. More...
 
__STATIC_INLINE void Cy_TCPWM_TriggerStart (TCPWM_Type *base, uint32_t counters)
 Triggers a software start on the selected TCPWMs. More...
 
__STATIC_INLINE void Cy_TCPWM_TriggerReloadOrIndex (TCPWM_Type *base, uint32_t counters)
 Triggers a software reload event (or index in QuadDec mode). More...
 
__STATIC_INLINE void Cy_TCPWM_TriggerStopOrKill (TCPWM_Type *base, uint32_t counters)
 Triggers a stop in the Timer Counter mode, or a kill in the PWM mode. More...
 
__STATIC_INLINE void Cy_TCPWM_TriggerCaptureOrSwap (TCPWM_Type *base, uint32_t counters)
 Triggers a Capture in the Timer Counter mode, and a Swap in the PWM mode. More...
 
__STATIC_INLINE void Cy_TCPWM_Enable_Single (TCPWM_Type *base, uint32_t cntNum)
 Enables specified counter. More...
 
__STATIC_INLINE void Cy_TCPWM_Disable_Single (TCPWM_Type *base, uint32_t cntNum)
 Disable specified counter. More...
 
__STATIC_INLINE uint32_t Cy_TCPWM_GetInterruptStatus (TCPWM_Type const *base, uint32_t cntNum)
 Returns which event triggered the interrupt. More...
 
__STATIC_INLINE void Cy_TCPWM_ClearInterrupt (TCPWM_Type *base, uint32_t cntNum, uint32_t source)
 Clears Active Interrupt Source. More...
 
__STATIC_INLINE void Cy_TCPWM_SetInterrupt (TCPWM_Type *base, uint32_t cntNum, uint32_t source)
 Triggers an interrupt via a software write. More...
 
__STATIC_INLINE void Cy_TCPWM_SetInterruptMask (TCPWM_Type *base, uint32_t cntNum, uint32_t mask)
 Sets an interrupt mask. More...
 
__STATIC_INLINE uint32_t Cy_TCPWM_GetInterruptMask (TCPWM_Type const *base, uint32_t cntNum)
 Returns the interrupt mask. More...
 
__STATIC_INLINE uint32_t Cy_TCPWM_GetInterruptStatusMasked (TCPWM_Type const *base, uint32_t cntNum)
 Returns which masked interrupt triggered the interrupt. More...
 
__STATIC_INLINE void Cy_TCPWM_TriggerStart_Single (TCPWM_Type *base, uint32_t cntNum)
 Triggers a software start on the selected TCPWM. More...
 
__STATIC_INLINE void Cy_TCPWM_TriggerReloadOrIndex_Single (TCPWM_Type *base, uint32_t cntNum)
 Triggers a software reload event (or index 0 in QuadDec mode) on selected TCPWM. More...
 
__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. More...
 
__STATIC_INLINE void Cy_TCPWM_TriggerCaptureOrSwap_Single (TCPWM_Type *base, uint32_t cntNum)
 Triggers a Capture 0 in the Timer Counter mode, and a Swap in the PWM mode on selected TCPWM. More...
 
__STATIC_INLINE void Cy_TCPWM_TriggerCapture0 (TCPWM_Type *base, uint32_t cntNum)
 Triggers a Capture 0 on the selected counter. More...
 
__STATIC_INLINE void Cy_TCPWM_TriggerCapture1 (TCPWM_Type *base, uint32_t cntNum)
 Triggers a Capture 1 in Timer Counter and QuadDec Mode. More...
 
__STATIC_INLINE bool Cy_TCPWM_GetTrigPinLevel (TCPWM_Type const *base, uint32_t cntNum, cy_en_tcpwm_trigselect_t triggerSelect)
 Returns the current level of the selected input trigger. More...
 
__STATIC_INLINE void Cy_TCPWM_InputTriggerSetup (TCPWM_Type *base, uint32 cntNum, cy_en_tcpwm_trigselect_t triggerSelect, uint32_t edgeSelect, uint32_t triggerSignal)
 Sets up a trigger input signal for a specific TCPWM counter. More...
 
__STATIC_INLINE void Cy_TCPWM_OutputTriggerSetup (TCPWM_Type *base, uint32 cntNum, cy_en_tcpwm_output_trigselect_t trigger0event, cy_en_tcpwm_output_trigselect_t trigger1event)
 Sets up a trigger output signal for a specific TCPWM counter event. More...
 
__STATIC_INLINE cy_en_tcpwm_status_t Cy_TCPWM_SetDebugFreeze (TCPWM_Type *base, uint32 cntNum, bool enable)
 Enables/disables the Debug Freeze feature for the specified counter. More...
 
__STATIC_INLINE void Cy_TCPWM_Block_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...
 
__STATIC_INLINE void Cy_TCPWM_InputTriggerSetupWithGF (TCPWM_Type *base, uint32 cntNum, cy_en_tcpwm_trigselect_t triggerSelect, uint32_t edgeSelect, uint32_t triggerSignal, cy_en_gf_depth_value_t dsvalue)
 Sets up a trigger input signal for a specific TCPWM counter and Glitch filter configuration for that trigger. More...
 

Function Documentation

◆ Cy_TCPWM_Enable_Multiple()

__STATIC_INLINE void Cy_TCPWM_Enable_Multiple ( TCPWM_Type base,
uint32_t  counters 
)

Enables the counter(s) in the TCPWM block.

Multiple blocks can be started simultaneously.

Parameters
baseThe pointer to a TCPWM instance.
countersA bit field representing each counter in the TCPWM block.
Function Usage
/* Scenario: there is a need to enable counters #1, #5 and #6 in the TCPWM0
* block.
* Multiple counters will be enabled simultaneously using
* MY_TCPWM_CNT_MULT_MASK (multiple bit masks ORed together).
*/
#define MY_TCPWM_CNT_1 (1UL)
#define MY_TCPWM_CNT_5 (5UL)
#define MY_TCPWM_CNT_6 (6UL)
#define MY_TCPWM_CNT_MULT_MASK (uint32_t)((1UL << MY_TCPWM_CNT_1) |\
(1UL << MY_TCPWM_CNT_5) |\
(1UL << MY_TCPWM_CNT_6))
Cy_TCPWM_Enable_Multiple(TCPWM0, MY_TCPWM_CNT_MULT_MASK);
/* Scenario: These counters are configured to generate signals that have a phase
* dependency to each other. These must all be enabled at the same time
* to preserve this phase relationship.
*/
Cy_TCPWM_TriggerStart(TCPWM0, MY_TCPWM_CNT_MULT_MASK);
Note
supported only in TCPWM_ver1

◆ Cy_TCPWM_Disable_Multiple()

__STATIC_INLINE void Cy_TCPWM_Disable_Multiple ( TCPWM_Type base,
uint32_t  counters 
)

Disables the counter(s) in the TCPWM block.

Multiple TCPWM can be disabled simultaneously.

Parameters
baseThe pointer to a TCPWM instance.
countersA bit field representing each counter in the TCPWM block.
Function Usage
/* Scenario: there is a need to disable counters #1, #5 and #6 in the TCPWM0
* block.
*/
#define MY_TCPWM_CNT_1 (1UL)
#define MY_TCPWM_CNT_5 (5UL)
#define MY_TCPWM_CNT_6 (6UL)
#define MY_TCPWM_CNT_MULT_MASK (uint32_t)((1UL << MY_TCPWM_CNT_1) |\
(1UL << MY_TCPWM_CNT_5) |\
(1UL << MY_TCPWM_CNT_6))
Cy_TCPWM_Disable_Multiple(TCPWM0, MY_TCPWM_CNT_MULT_MASK);
Note
supported only in TCPWM_ver1

◆ Cy_TCPWM_TriggerStart()

__STATIC_INLINE void Cy_TCPWM_TriggerStart ( TCPWM_Type base,
uint32_t  counters 
)

Triggers a software start on the selected TCPWMs.

Parameters
baseThe pointer to a TCPWM instance.
countersA bit field representing each counter in the TCPWM block.
Function Usage
/* Scenario: there is a need to enable counters #1, #5 and #6 in the TCPWM0
* block.
* Multiple counters will be enabled simultaneously using
* MY_TCPWM_CNT_MULT_MASK (multiple bit masks ORed together).
*/
#define MY_TCPWM_CNT_1 (1UL)
#define MY_TCPWM_CNT_5 (5UL)
#define MY_TCPWM_CNT_6 (6UL)
#define MY_TCPWM_CNT_MULT_MASK (uint32_t)((1UL << MY_TCPWM_CNT_1) |\
(1UL << MY_TCPWM_CNT_5) |\
(1UL << MY_TCPWM_CNT_6))
Cy_TCPWM_Enable_Multiple(TCPWM0, MY_TCPWM_CNT_MULT_MASK);
/* Scenario: These counters are configured to generate signals that have a phase
* dependency to each other. These must all be enabled at the same time
* to preserve this phase relationship.
*/
Cy_TCPWM_TriggerStart(TCPWM0, MY_TCPWM_CNT_MULT_MASK);
Note
supported only in TCPWM_ver1

◆ Cy_TCPWM_TriggerReloadOrIndex()

__STATIC_INLINE void Cy_TCPWM_TriggerReloadOrIndex ( TCPWM_Type base,
uint32_t  counters 
)

Triggers a software reload event (or index in QuadDec mode).

Parameters
baseThe pointer to a TCPWM instance
countersA bit field representing each counter in the TCPWM block.
Function Usage
/* Scenario: there is a need to trigger a software reload event for
* the first (index = 0) counter of the TCPWM0 block.
* This causes the reloading of the counter register with the period value.
*/
#define MY_TCPWM_CNT_NUM (0UL)
#define MY_TCPWM_CNT_MASK (1UL << MY_TCPWM_CNT_NUM)
Cy_TCPWM_TriggerReloadOrIndex(TCPWM0, MY_TCPWM_CNT_MASK);
Note
supported only in TCPWM_ver1

◆ Cy_TCPWM_TriggerStopOrKill()

__STATIC_INLINE void Cy_TCPWM_TriggerStopOrKill ( TCPWM_Type base,
uint32_t  counters 
)

Triggers a stop in the Timer Counter mode, or a kill in the PWM mode.

Note
The kill trigger behavior for PWM is defined by the cy_stc_tcpwm_pwm_config_t::killMode field. The pins states after a kill trigger are defined by cy_stc_tcpwm_pwm_config_t::invertPWMOut and cy_stc_tcpwm_pwm_config_t::invertPWMOutN fields.
Parameters
baseThe pointer to a TCPWM instance.
countersA bit field representing each counter in the TCPWM block.
Function Usage
/* Scenario: there is a need to kill 3 PWM signals
* (PWM runs in \ref CY_TCPWM_PWM_STOP_ON_KILL mode) at the same time
* as they are all used e.g. to drive an RGB LED. So there will be a clean
* transition from white light to no light.
*/
#define MY_TCPWM_CNT_1 (1UL)
#define MY_TCPWM_CNT_5 (5UL)
#define MY_TCPWM_CNT_6 (6UL)
#define MY_TCPWM_CNT_MULT_MASK (uint32_t)((1UL << MY_TCPWM_CNT_1) |\
(1UL << MY_TCPWM_CNT_5) |\
(1UL << MY_TCPWM_CNT_6))
Cy_TCPWM_TriggerStopOrKill(TCPWM0, MY_TCPWM_CNT_MULT_MASK);
/* Then continue to operate from the point they have been stopped. */
Cy_TCPWM_TriggerStart(TCPWM0, MY_TCPWM_CNT_MULT_MASK);
Note
supported only in TCPWM_ver1

◆ Cy_TCPWM_TriggerCaptureOrSwap()

__STATIC_INLINE void Cy_TCPWM_TriggerCaptureOrSwap ( TCPWM_Type base,
uint32_t  counters 
)

Triggers a Capture in the Timer Counter mode, and a Swap in the PWM mode.

Parameters
baseThe pointer to a TCPWM instance.
countersA bit field representing each counter in the TCPWM block.
Function Usage
/* Scenario: there is a need to trigger software capture events for
* the first (index = 0) counter of the TCPWM0 block.
* Note: the counter should run in the Capture Mode.
*/
#define MY_TCPWM_CNT_NUM (0UL)
Cy_TCPWM_TriggerCaptureOrSwap_Single(TCPWM0, MY_TCPWM_CNT_NUM);
/* after some time */
Cy_TCPWM_TriggerCaptureOrSwap_Single(TCPWM0, MY_TCPWM_CNT_NUM);
/* Now we can get the latest captured value
* (captured during the second call of Cy_TCPWM_TriggerCaptureOrSwap_Single)
*/
uint32_t capture = Cy_TCPWM_Counter_GetCapture0Val(TCPWM0, MY_TCPWM_CNT_NUM);
/* Also the previous captured value
* (captured during the first call of Cy_TCPWM_TriggerCaptureOrSwap_Single)
* is available by the next way
*/
uint32_t captureBuf = Cy_TCPWM_Counter_GetCapture0BufVal(TCPWM0, MY_TCPWM_CNT_NUM);
Note
supported only in TCPWM_ver1

◆ Cy_TCPWM_Enable_Single()

__STATIC_INLINE void Cy_TCPWM_Enable_Single ( TCPWM_Type base,
uint32_t  cntNum 
)

Enables specified counter.

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

◆ Cy_TCPWM_Disable_Single()

__STATIC_INLINE void Cy_TCPWM_Disable_Single ( TCPWM_Type base,
uint32_t  cntNum 
)

Disable specified counter.

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

◆ Cy_TCPWM_GetInterruptStatus()

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

Returns which event triggered the interrupt.

Parameters
baseThe pointer to a TCPWM instance.
cntNumThe Counter instance number in the selected TCPWM.
Returns
See Interrupt Sources
Function Usage
/* Scenario: there is a need to check all the pending interrupts of
* the first (index = 0) counter of the TCPWM0 block.
*/
#define MY_TCPWM_CNT_NUM (0UL)
uint32_t interrupts = Cy_TCPWM_GetInterruptStatus(TCPWM0, MY_TCPWM_CNT_NUM);
/* Now the 'interrupts' contains all the currently pending interrupt masks */
if(0UL != (CY_TCPWM_INT_ON_TC & interrupts))
{
/* There is a pending Terminal Count interrupt */
}

◆ Cy_TCPWM_ClearInterrupt()

__STATIC_INLINE void Cy_TCPWM_ClearInterrupt ( TCPWM_Type base,
uint32_t  cntNum,
uint32_t  source 
)

Clears Active Interrupt Source.

Parameters
baseThe pointer to a TCPWM instance.
cntNumThe Counter instance number in the selected TCPWM.
sourcesource to clear. See Interrupt Sources
Function Usage
/* Scenario: inside the TCPWM interrupt handler for
* the first (index = 0) counter of the TCPWM0 block.
*/
#define MY_TCPWM_CNT_NUM (0UL)
/* Get all the enabled pending interrupts */
uint32_t interrupts = Cy_TCPWM_GetInterruptStatusMasked(TCPWM0, MY_TCPWM_CNT_NUM);
if (0UL != (CY_TCPWM_INT_ON_TC & interrupts))
{
/* Handle the Terminal Count event */
}
if (0UL != (CY_TCPWM_INT_ON_CC & interrupts))
{
/* Handle the Compare/Capture event */
}
/* Clear the interrupt */
Cy_TCPWM_ClearInterrupt(TCPWM0, MY_TCPWM_CNT_NUM, interrupts);

◆ Cy_TCPWM_SetInterrupt()

__STATIC_INLINE void Cy_TCPWM_SetInterrupt ( TCPWM_Type base,
uint32_t  cntNum,
uint32_t  source 
)

Triggers an interrupt via a software write.

Parameters
baseThe pointer to a TCPWM instance.
cntNumThe Counter instance number in the selected TCPWM.
sourceThe source to set an interrupt. See Interrupt Sources.
Function Usage
/* Scenario: there is a need to set a terminal count interrupt by SW for
* the first (index = 0) counter of the TCPWM0 block.
*/
#define MY_TCPWM_CNT_NUM (0UL)
/* Check if the desired interrupt is enabled prior to triggering */
if (0UL != (CY_TCPWM_INT_ON_TC & Cy_TCPWM_GetInterruptMask(TCPWM0, MY_TCPWM_CNT_NUM)))
{
Cy_TCPWM_SetInterrupt(TCPWM0, MY_TCPWM_CNT_NUM, CY_TCPWM_INT_ON_TC);
}
else
{
/* The terminal count interrupt is not enabled, so there is no sense to trigger it */
}

◆ Cy_TCPWM_SetInterruptMask()

__STATIC_INLINE void Cy_TCPWM_SetInterruptMask ( TCPWM_Type base,
uint32_t  cntNum,
uint32_t  mask 
)

Sets an interrupt mask.

A 1 means that when the event occurs, it will cause an interrupt; a 0 means no interrupt will be triggered.

Parameters
baseThe pointer to a TCPWM instance.
cntNumThe Counter instance number in the selected TCPWM.
mask. See Interrupt Sources
Function Usage
/* Scenario: there is a need to set the Compare/Capture interrupt mask for
* the first (index = 0) counter of the TCPWM0 block.
*/
#define MY_TCPWM_CNT_NUM (0UL)
Cy_TCPWM_SetInterruptMask(TCPWM0, MY_TCPWM_CNT_NUM,
CY_TCPWM_INT_ON_CC | Cy_TCPWM_GetInterruptMask(TCPWM0, MY_TCPWM_CNT_NUM));

◆ Cy_TCPWM_GetInterruptMask()

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

Returns the interrupt mask.

Parameters
baseThe pointer to a TCPWM instance.
cntNumThe Counter instance number in the selected TCPWM.
Returns
Interrupt Mask. See Interrupt Sources
Function Usage
/* Scenario: there is a need to set the Compare/Capture interrupt mask for
* the first (index = 0) counter of the TCPWM0 block.
*/
#define MY_TCPWM_CNT_NUM (0UL)
Cy_TCPWM_SetInterruptMask(TCPWM0, MY_TCPWM_CNT_NUM,
CY_TCPWM_INT_ON_CC | Cy_TCPWM_GetInterruptMask(TCPWM0, MY_TCPWM_CNT_NUM));

◆ Cy_TCPWM_GetInterruptStatusMasked()

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

Returns which masked interrupt triggered the interrupt.

Parameters
baseThe pointer to a TCPWM instance.
cntNumThe Counter instance number in the selected TCPWM.
Returns
Interrupt Mask. See Interrupt Sources
Function Usage
/* Scenario: inside the TCPWM interrupt handler for
* the first (index = 0) counter of the TCPWM0 block.
*/
#define MY_TCPWM_CNT_NUM (0UL)
/* Get all the enabled pending interrupts */
uint32_t interrupts = Cy_TCPWM_GetInterruptStatusMasked(TCPWM0, MY_TCPWM_CNT_NUM);
if (0UL != (CY_TCPWM_INT_ON_TC & interrupts))
{
/* Handle the Terminal Count event */
}
if (0UL != (CY_TCPWM_INT_ON_CC & interrupts))
{
/* Handle the Compare/Capture event */
}
/* Clear the interrupt */
Cy_TCPWM_ClearInterrupt(TCPWM0, MY_TCPWM_CNT_NUM, interrupts);

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

Parameters
baseThe pointer to a TCPWM instance.
cntNumThe Counter instance number in the selected TCPWM.
Function Usage
/* Scenario: Use software trigger to start Shift Register operation */
#define MY_TCPWM_SHIFTREG_NUM (0UL)
Cy_TCPWM_TriggerStart_Single(TCPWM0, MY_TCPWM_SHIFTREG_NUM);

◆ Cy_TCPWM_TriggerReloadOrIndex_Single()

__STATIC_INLINE void Cy_TCPWM_TriggerReloadOrIndex_Single ( TCPWM_Type base,
uint32_t  cntNum 
)

Triggers a software reload event (or index 0 in QuadDec mode) on selected TCPWM.

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

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

Note
The kill trigger behavior for PWM is defined by the cy_stc_tcpwm_pwm_config_t::killMode field. The pins states after a kill trigger are defined by cy_stc_tcpwm_pwm_config_t::invertPWMOut and cy_stc_tcpwm_pwm_config_t::invertPWMOutN fields.
Parameters
baseThe pointer to a TCPWM instance.
cntNumThe Counter instance number in the selected TCPWM.

◆ Cy_TCPWM_TriggerCaptureOrSwap_Single()

__STATIC_INLINE void Cy_TCPWM_TriggerCaptureOrSwap_Single ( TCPWM_Type base,
uint32_t  cntNum 
)

Triggers a Capture 0 in the Timer Counter mode, and a Swap in the PWM mode on selected TCPWM.

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

◆ Cy_TCPWM_TriggerCapture0()

__STATIC_INLINE void Cy_TCPWM_TriggerCapture0 ( TCPWM_Type base,
uint32_t  cntNum 
)

Triggers a Capture 0 on the selected counter.

Parameters
baseThe pointer to a TCPWM instance.
cntNumThe Counter instance number in the selected TCPWM.
Note
For TCPWM version 3 and above in compare mode, when external direction control is enabled and Capture0 input is disabled, user can use software capture0 trigger. While using this, User has to make sure that the external direction control is set to CY_TCPWM_COUNTER_DIRECTION_RISING

◆ Cy_TCPWM_TriggerCapture1()

__STATIC_INLINE void Cy_TCPWM_TriggerCapture1 ( TCPWM_Type base,
uint32_t  cntNum 
)

Triggers a Capture 1 in Timer Counter and QuadDec Mode.

In PWM mode this acts as a second kill input.

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

◆ Cy_TCPWM_GetTrigPinLevel()

__STATIC_INLINE bool Cy_TCPWM_GetTrigPinLevel ( TCPWM_Type const *  base,
uint32_t  cntNum,
cy_en_tcpwm_trigselect_t  triggerSelect 
)

Returns the current level of the selected input trigger.

Parameters
baseThe pointer to a TCPWM instance.
cntNumThe Counter instance number in the selected TCPWM.
triggerSelectDefines which trigger status is being checked, Start, Reload, Stop/Kill, Count, Capture 0 or Capture 1
Returns
The trigger level
Function Usage
/* Scenario: there is a need to check current level of pin connected to
* start trigger for the first (index = 0) counter of the TCPWM0 block
*/
#define MY_TCPWM_PWM_NUM (0UL)
if (Cy_TCPWM_GetTrigPinLevel(TCPWM0, MY_TCPWM_PWM_NUM, CY_TCPWM_INPUT_TR_START))
{
/* Level on pin that is connected to the Start Trigger input is High */
}
else
{
/* Level on pin that is connected to the Start Trigger input is Low */
}

◆ Cy_TCPWM_InputTriggerSetup()

__STATIC_INLINE void Cy_TCPWM_InputTriggerSetup ( TCPWM_Type base,
uint32  cntNum,
cy_en_tcpwm_trigselect_t  triggerSelect,
uint32_t  edgeSelect,
uint32_t  triggerSignal 
)

Sets up a trigger input signal for a specific TCPWM counter.

This API is used to handle software triggering of multiple counters synchronously.

Parameters
baseThe pointer to a TCPWM instance.
cntNumThe Counter instance number in the selected TCPWM.
triggerSelectDefines which trigger is being setup, Start, Reload, Stop/Kill, Count, Capture 0 or Capture 1 see cy_en_tcpwm_trigselect_t
edgeSelectSets the trigger edge detection, Rising, Falling, Both, No edge detect. see Input Modes
triggerSignalSelects what trigger signal is connected to the selected input trigger.
Note
Trigger signal for general purpose trigger is calculated as below. CY_TCPWM_INPUT_TRIG(n) = (n + TCPWM_TR_ONE_CNT_NR + 2U) For devices with more than one instance of TCPWM CY_TCPWM_INPUT_TRIG_WITH_INST(n, m) is used where m is the TCPWM instance number.
Function Usage
/* Scenario: Start multiple counters synchronously
*/
#define GRP0_CNT0_NUM (0UL)
#define GRP0_CNT1_NUM (1UL)
#define GRP0_CNT2_NUM (2UL)
#define TCPWM0_TR_IN0 (0x40000200u) /* tcpwm[0].tr_in[0] */
#if (CY_IP_MXTCPWM_VERSION >= 2U)
/* Set up input trigger start for all 3 counters to CY_TCPWM_INPUT_TRIG(0)
Trigger signal for general purpose trigger is calculated as below.
CY_TCPWM_INPUT_TRIG(n) = (n + TCPWM_TR_ONE_CNT_NR + 2U)
For devices with more than one instance of TCPWM
CY_TCPWM_INPUT_TRIG_WITH_INST(n, m) is used where m is the TCPWM instance number.
Cy_TCPWM_InputTriggerSetup(TCPWM1, GRP0_CNT2_NUM, CY_TCPWM_INPUT_TR_START, CY_TCPWM_INPUT_LEVEL, CY_TCPWM_INPUT_TRIG_WITH_INST(0,1));
*/
Cy_TCPWM_InputTriggerSetup(TCPWM0, GRP0_CNT0_NUM, CY_TCPWM_INPUT_TR_START, CY_TCPWM_INPUT_LEVEL, CY_TCPWM_INPUT_TRIG(0));
Cy_TCPWM_InputTriggerSetup(TCPWM0, GRP0_CNT1_NUM, CY_TCPWM_INPUT_TR_START, CY_TCPWM_INPUT_LEVEL, CY_TCPWM_INPUT_TRIG(0));
Cy_TCPWM_InputTriggerSetup(TCPWM0, GRP0_CNT2_NUM, CY_TCPWM_INPUT_TR_START, CY_TCPWM_INPUT_LEVEL, CY_TCPWM_INPUT_TRIG(0));
#endif /*(CY_IP_MXTCPWM_VERSION >= 2U) */
/* Trigger through Software to start all 3 counters synchronously */

◆ Cy_TCPWM_OutputTriggerSetup()

__STATIC_INLINE void Cy_TCPWM_OutputTriggerSetup ( TCPWM_Type base,
uint32  cntNum,
cy_en_tcpwm_output_trigselect_t  trigger0event,
cy_en_tcpwm_output_trigselect_t  trigger1event 
)

Sets up a trigger output signal for a specific TCPWM counter event.

Parameters
baseThe pointer to a TCPWM instance.
cntNumThe Counter instance number in the selected TCPWM.
trigger0eventSelects internal events for output trigger out0 generation. see cy_en_tcpwm_output_trigselect_t
trigger1eventSelects internal events for output trigger out1 generation. see cy_en_tcpwm_output_trigselect_t

◆ Cy_TCPWM_SetDebugFreeze()

__STATIC_INLINE cy_en_tcpwm_status_t Cy_TCPWM_SetDebugFreeze ( TCPWM_Type base,
uint32  cntNum,
bool  enable 
)

Enables/disables the Debug Freeze feature for the specified counter.

Parameters
baseThe pointer to a TCPWM instance.
cntNumThe Counter instance number in the selected TCPWM.
enabletrue: The Debug Free feature is enabled false: The Debug Freeze feature is disabled
Returns
Error / Status code. See cy_en_tcpwm_status_t.
Function Usage
/* Scenario: Enable Debug Freeze capability for the first
* (index = 0) counter of the TCPWM0 block. */
#define MY_TCPWM_CNT_NUM (0UL)
Cy_TCPWM_SetDebugFreeze (TCPWM0, MY_TCPWM_CNT_NUM, true);
/* Now the counter value will be frozen when the tr_dbg_freeze signal is activated.
* Usually the tr_dbg_freeze signal is intended to be activated from the cpuss.cti_tr_out[x] signal, for example:
*/
Cy_TrigMux_Connect(TRIG_IN_MUX_7_CTI_TR_OUT0, TRIG_OUT_MUX_7_TCPWM_DEBUG_FREEZE_TR_IN, false, TRIGGER_TYPE_LEVEL);
/* However it can be activated just with software triggering: */
Cy_TrigMux_SwTrigger(TRIG_OUT_MUX_7_TCPWM_DEBUG_FREEZE_TR_IN, CY_TRIGGER_INFINITE);
/* Get the counter value */
getVal = Cy_TCPWM_Counter_GetCounter(TCPWM0,(uint32_t)0U);
/* Observe value is not changed from previous read */
getVal = Cy_TCPWM_Counter_GetCounter(TCPWM0,(uint32_t)0U);
/* Scenario: Disable a Debug Freeze feature */
Cy_TCPWM_SetDebugFreeze (TCPWM0, MY_TCPWM_CNT_NUM, false);
/* Deactivate trigger */
Cy_TrigMux_SwTrigger(TRIG_OUT_MUX_7_TCPWM_DEBUG_FREEZE_TR_IN, CY_TRIGGER_DEACTIVATE);
/* Get the counter value */
getVal = Cy_TCPWM_Counter_GetCounter(TCPWM0,(uint32_t)0U);
/* Observe value is changed from previous read */
getVal = Cy_TCPWM_Counter_GetCounter(TCPWM0,(uint32_t)0U);

◆ Cy_TCPWM_Block_EnableSwap()

__STATIC_INLINE void Cy_TCPWM_Block_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: Swapping mechanism is enabled false: Swapping mechanism is 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. Reload is enabled/disabled with the API's Cy_TCPWM_Block_EnableCompare0Swap, Cy_TCPWM_Block_EnableCompare1Swap, Cy_TCPWM_PWM_EnablePeriodSwap
Applicable for devices with TCPWM version 3 and above and for MXTCPWM version 1 and above.

◆ Cy_TCPWM_InputTriggerSetupWithGF()

__STATIC_INLINE void Cy_TCPWM_InputTriggerSetupWithGF ( TCPWM_Type base,
uint32  cntNum,
cy_en_tcpwm_trigselect_t  triggerSelect,
uint32_t  edgeSelect,
uint32_t  triggerSignal,
cy_en_gf_depth_value_t  dsvalue 
)

Sets up a trigger input signal for a specific TCPWM counter and Glitch filter configuration for that trigger.

This API is used to handle software triggering of multiple counters synchronously.

Parameters
baseThe pointer to a TCPWM instance.
cntNumThe Counter instance number in the selected TCPWM.
triggerSelectDefines which trigger is being setup, Start, Reload, Stop/Kill, Count, Capture 0 or Capture 1 see cy_en_tcpwm_trigselect_t
edgeSelectSets the trigger edge detection, Rising, Falling, Both, No edge detect. see Input Modes
triggerSignalSelects what trigger signal is connected to the selected input trigger.
dsvalueGlitch filter depth. cy_en_gf_depth_value_t
Note
GF depth set for one to one triggers will be applied to specific trigger and GF depth set for general purpose trigger will be applicable for all general purpose triggers.