PSOC E8XXGP Device Support Library

| PSOC E8XXGP Device Support Library

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

## General Description

## Functions
cy_en_tcpwm_status_t | Cy_TCPWM_ShiftReg_Init (TCPWM_Type const *base, uint32_t cntNum, cy_stc_tcpwm_shiftreg_config_t const *config)
| Initializes the counter in the TCPWM block for the Shift Register operation. More...
void | Cy_TCPWM_ShiftReg_DeInit (TCPWM_Type const *base, uint32_t cntNum, cy_stc_tcpwm_shiftreg_config_t const *config)
| De-initializes the counter in the TCPWM block, returns register values to default. More...
__STATIC_INLINE void | Cy_TCPWM_ShiftReg_Enable (TCPWM_Type *base, uint32_t cntNum)
| Enables the counter in the TCPWM block for the Shift Register operation. More...
__STATIC_INLINE void | Cy_TCPWM_ShiftReg_Disable (TCPWM_Type *base, uint32_t cntNum)
| Disables the counter in the TCPWM block. More...
__STATIC_INLINE uint32_t | Cy_TCPWM_ShiftReg_GetStatus (TCPWM_Type const *base, uint32_t cntNum)
| Returns the status of the Shift Register whether it is running or not. More...
__STATIC_INLINE void | Cy_TCPWM_ShiftReg_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_ShiftReg_GetCompare0Val (TCPWM_Type const *base, uint32_t cntNum)
| Returns compare 0 value. More...
__STATIC_INLINE void | Cy_TCPWM_ShiftReg_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_ShiftReg_GetCompare0BufVal (TCPWM_Type const *base, uint32_t cntNum)
| Returns the buffered compare 0 value. More...
__STATIC_INLINE void | Cy_TCPWM_ShiftReg_EnableCompare0Swap (TCPWM_Type *base, uint32_t cntNum, bool enable)
| Enables the comparison swap of compare 0 and compareBuf 0 on corresponding command or external trigger. More...
__STATIC_INLINE void | Cy_TCPWM_ShiftReg_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_ShiftReg_GetCompare1Val (TCPWM_Type const *base, uint32_t cntNum)
| Returns compare 1 value. More...
__STATIC_INLINE void | Cy_TCPWM_ShiftReg_SetCompare1BufVal (TCPWM_Type *base, uint32_t cntNum, uint32_t compareBuf1)
| Sets the buffered compare value for Compare 1 when the compare mode enabled. More...
__STATIC_INLINE uint32_t | Cy_TCPWM_ShiftReg_GetCompare1BufVal (TCPWM_Type const *base, uint32_t cntNum)
| Returns the buffered compare 1 value. More...
__STATIC_INLINE void | Cy_TCPWM_ShiftReg_EnableCompare1Swap (TCPWM_Type *base, uint32_t cntNum, bool enable)
| Enables the comparison swap of compare 1 and compareBuf 1 on corresponding command or external trigger. More...
__STATIC_INLINE void | Cy_TCPWM_ShiftReg_SetCounter (TCPWM_Type *base, uint32_t cntNum, uint32_t count)
| Sets the value of the counter. More...
__STATIC_INLINE uint32_t | Cy_TCPWM_ShiftReg_GetCounter (TCPWM_Type const *base, uint32_t cntNum)
| Returns the value in the counter. More...
__STATIC_INLINE void | Cy_TCPWM_ShiftReg_SetTaps (TCPWM_Type *base, uint32_t cntNum, uint32_t taps)
| Sets which taps are enabled. More...
__STATIC_INLINE uint32_t | Cy_TCPWM_ShiftReg_GetTaps (TCPWM_Type const *base, uint32_t cntNum)
| Returns which taps are enabled. More...
__STATIC_INLINE uint32_t | Cy_TCPWM_ShiftReg_LineOutStatus (TCPWM_Type const *base, uint32_t cntNum, uint32_t shiftRegOutSelect)
| Returns the current level of the selected Shift Register output line. More...
__STATIC_INLINE void | Cy_TCPWM_Shiftreg_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...

## Function Documentation

## ◆ Cy_TCPWM_ShiftReg_Init()

cy_en_tcpwm_status_t Cy_TCPWM_ShiftReg_Init | ( | TCPWM_Type const * | base,
|  | uint32_t | cntNum,
|  | cy_stc_tcpwm_shiftreg_config_t const * | config
| ) |  |

Initializes the counter in the TCPWM block for the Shift Register operation.

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

Returns
  error / status code. See cy_en_tcpwm_status_t.

/* Scenario: Initialize the first (index = 0) of TCPWM 0 block
* as Shift Register with configuration settings
*/
cy_stc_tcpwm_shiftreg_config_t shiftreg_config =
{
/* .clockPrescaler = */CY_TCPWM_SHIFTREG_PRESCALER_DIVBY_1,
/* .tapsEnabled = */0x80000000UL,
/* .compare0 = */16384UL,
/* .compareBuf0 = */16384UL,
/* .enableCompare0Swap = */false,
/* .compare1 = */16384UL,
/* .compareBuf1 = */16384UL,
/* .enableCompare1Swap = */false,
/* .interruptSources = */CY_TCPWM_INT_ON_CC0, /* Interrupt will rise on CC0 Match*/
/* .invertShiftRegOut = */CY_TCPWM_SHIFTREG_INVERT_DISABLE, /* Not inverted */
/* .invertShiftRegOutN = */CY_TCPWM_SHIFTREG_INVERT_DISABLE, /* Not inverted */
/* .reloadInputMode = */CY_TCPWM_INPUT_LEVEL, /* This input is NOT used, leave it in default state (CY_TCPWM_INPUT_LEVEL) */
/* .reloadInput = */CY_TCPWM_INPUT_0,
/* .startInputMode = */CY_TCPWM_INPUT_LEVEL, /* This input is NOT used, leave it in default state (CY_TCPWM_INPUT_LEVEL) */
/* .startInput = */CY_TCPWM_INPUT_0,
/* .killInputMode = */CY_TCPWM_INPUT_LEVEL, /* This input is NOT used, leave it in default state (CY_TCPWM_INPUT_LEVEL) */
/* .killInput = */CY_TCPWM_INPUT_0,
/* .shiftInputMode = */CY_TCPWM_INPUT_LEVEL, /* Set this input to LEVEL and 1 (high logic level) */
/* .shiftInput = */CY_TCPWM_INPUT_1, /* Shift Register will run forever */
/* .serialInputMode = */CY_TCPWM_INPUT_LEVEL, /* This input is NOT used, leave it in default state (CY_TCPWM_INPUT_LEVEL) */
/* .serialInput = */CY_TCPWM_INPUT_0,
/* .shiftRegOnDisable = */CY_TCPWM_SHIFTREG_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*/
};
#define MY_TCPWM_SHIFTREG_NUM (0UL)
if (CY_TCPWM_SUCCESS != Cy_TCPWM_ShiftReg_Init(TCPWM0, MY_TCPWM_SHIFTREG_NUM, &shiftreg_config))
{
/* Handle possible errors */
}
cy_stc_tcpwm_shiftreg_config_t
Shift Register configuration structure.
Definition: cy_tcpwm_shiftreg.h:121
CY_TCPWM_SUCCESS
@ CY_TCPWM_SUCCESS
Successful.
Definition: cy_tcpwm.h:402
Cy_TCPWM_ShiftReg_Init
cy_en_tcpwm_status_t Cy_TCPWM_ShiftReg_Init(TCPWM_Type const *base, uint32_t cntNum, cy_stc_tcpwm_shiftreg_config_t const *config)
Initializes the counter in the TCPWM block for the Shift Register operation.
Definition: cy_tcpwm_shiftreg.c:55
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_CC0
#define CY_TCPWM_INT_ON_CC0
Interrupt on Compare 0/Capture 0(CC0)
Definition: cy_tcpwm.h:307
CY_TCPWM_CNT_TRIGGER_ON_DISABLED
#define CY_TCPWM_CNT_TRIGGER_ON_DISABLED
Output trigger disabled.
Definition: cy_tcpwm.h:297
CY_TCPWM_SHIFTREG_PRESCALER_DIVBY_1
#define CY_TCPWM_SHIFTREG_PRESCALER_DIVBY_1
Divide by 1.
Definition: cy_tcpwm_shiftreg.h:166
CY_TCPWM_SHIFTREG_INVERT_DISABLE
#define CY_TCPWM_SHIFTREG_INVERT_DISABLE
Do not invert the output mode.
Definition: cy_tcpwm_shiftreg.h:189
CY_TCPWM_SHIFTREG_OUTPUT_HIGHZ
#define CY_TCPWM_SHIFTREG_OUTPUT_HIGHZ
Shift Register output (default) high impedance.
Definition: cy_tcpwm_shiftreg.h:197

## ◆ Cy_TCPWM_ShiftReg_DeInit()

void Cy_TCPWM_ShiftReg_DeInit | ( | TCPWM_Type const * | base,
|  | uint32_t | cntNum,
|  | cy_stc_tcpwm_shiftreg_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_shiftreg_config_t.

/* Scenario: there is need to deinitialize the previously initialized shift register */
#define MY_TCPWM_SHIFTREG_NUM (0UL)
/* Disable the shift register prior to deinitializing */
Cy_TCPWM_ShiftReg_Disable(TCPWM0, MY_TCPWM_SHIFTREG_NUM);
Cy_TCPWM_ShiftReg_DeInit(TCPWM0, MY_TCPWM_SHIFTREG_NUM, &config);
Cy_TCPWM_ShiftReg_DeInit
void Cy_TCPWM_ShiftReg_DeInit(TCPWM_Type const *base, uint32_t cntNum, cy_stc_tcpwm_shiftreg_config_t const *config)
De-initializes the counter in the TCPWM block, returns register values to default.
Definition: cy_tcpwm_shiftreg.c:147
Cy_TCPWM_ShiftReg_Disable
__STATIC_INLINE void Cy_TCPWM_ShiftReg_Disable(TCPWM_Type *base, uint32_t cntNum)
Disables the counter in the TCPWM block.
Definition: cy_tcpwm_shiftreg.h:293

## ◆ Cy_TCPWM_ShiftReg_Enable()

__STATIC_INLINE void Cy_TCPWM_ShiftReg_Enable | ( | TCPWM_Type * | base,
|  | uint32_t | cntNum
| ) |  |

Enables the counter in the TCPWM block for the Shift Register operation.

Parameters

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

/* Scenario: Enable Shift Register */
#define MY_TCPWM_SHIFTREG_NUM (0UL)
Cy_TCPWM_ShiftReg_Enable(TCPWM0, MY_TCPWM_SHIFTREG_NUM);
Cy_TCPWM_ShiftReg_Enable
__STATIC_INLINE void Cy_TCPWM_ShiftReg_Enable(TCPWM_Type *base, uint32_t cntNum)
Enables the counter in the TCPWM block for the Shift Register operation.
Definition: cy_tcpwm_shiftreg.h:273

## ◆ Cy_TCPWM_ShiftReg_Disable()

__STATIC_INLINE void Cy_TCPWM_ShiftReg_Disable | ( | TCPWM_Type * | base,
|  | uint32_t | cntNum
| ) |  |

Disables the counter in the TCPWM block.

Parameters

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

/* Scenario: Disable Shift Register */
#define MY_TCPWM_SHIFTREG_NUM (0UL)
Cy_TCPWM_ShiftReg_Disable(TCPWM0, MY_TCPWM_SHIFTREG_NUM);

## ◆ Cy_TCPWM_ShiftReg_GetStatus()

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

Returns the status of the Shift Register whether it is running or not.

Parameters

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

Returns
  The status. See Shift Register Status

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

/* Scenario: there is a need to check if
* the first (index = 0) Shift Register of the TCPWM0 block is running or not.
*/
#define MY_TCPWM_SHIFTREG_NUM (0UL)
if (0UL != (CY_TCPWM_SHIFTREG_STATUS_RUNNING &
Cy_TCPWM_ShiftReg_GetStatus(TCPWM0, MY_TCPWM_SHIFTREG_NUM)))
{
/* Shift Register is running */
}
Cy_TCPWM_ShiftReg_GetStatus
__STATIC_INLINE uint32_t Cy_TCPWM_ShiftReg_GetStatus(TCPWM_Type const *base, uint32_t cntNum)
Returns the status of the Shift Register whether it is running or not.
Definition: cy_tcpwm_shiftreg.h:319
CY_TCPWM_SHIFTREG_STATUS_RUNNING
#define CY_TCPWM_SHIFTREG_STATUS_RUNNING
Shift Register is running.
Definition: cy_tcpwm_shiftreg.h:207

## ◆ Cy_TCPWM_ShiftReg_SetCompare0Val()

__STATIC_INLINE void Cy_TCPWM_ShiftReg_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.

/* Scenario: there is a need to set the Compare 0 value of
* the first (index = 0) Shift Register of the TCPWM0 block.
*/
#define MY_TCPWM_SHIFTREG_NUM (0UL)
/* Get the currently existing compare value */
uint32_t compare = Cy_TCPWM_ShiftReg_GetCompare0Val(TCPWM0, MY_TCPWM_SHIFTREG_NUM);
/* Modify the compare value here */
Cy_TCPWM_ShiftReg_SetCompare0Val(TCPWM0, MY_TCPWM_SHIFTREG_NUM, compare);
Cy_TCPWM_ShiftReg_SetCompare0Val
__STATIC_INLINE void Cy_TCPWM_ShiftReg_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_shiftreg.h:347
Cy_TCPWM_ShiftReg_GetCompare0Val
__STATIC_INLINE uint32_t Cy_TCPWM_ShiftReg_GetCompare0Val(TCPWM_Type const *base, uint32_t cntNum)
Returns compare 0 value.
Definition: cy_tcpwm_shiftreg.h:371

## ◆ Cy_TCPWM_ShiftReg_GetCompare0Val()

__STATIC_INLINE uint32_t Cy_TCPWM_ShiftReg_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.

/* Scenario: there is a need to set the Compare 0 value of
* the first (index = 0) Shift Register of the TCPWM0 block.
*/
#define MY_TCPWM_SHIFTREG_NUM (0UL)
/* Get the currently existing compare value */
uint32_t compare = Cy_TCPWM_ShiftReg_GetCompare0Val(TCPWM0, MY_TCPWM_SHIFTREG_NUM);
/* Modify the compare value here */
Cy_TCPWM_ShiftReg_SetCompare0Val(TCPWM0, MY_TCPWM_SHIFTREG_NUM, compare);

## ◆ Cy_TCPWM_ShiftReg_SetCompare0BufVal()

__STATIC_INLINE void Cy_TCPWM_ShiftReg_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.

/* Scenario: there is a need to modify buffered compare 0 value
* for the first (index = 0) Shift Register 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_SHIFTREG_NUM (0UL)
/* Get the currently existing compare value */
uint32_t compare = Cy_TCPWM_ShiftReg_GetCompare0BufVal(TCPWM0, MY_TCPWM_SHIFTREG_NUM);
/* Modify the compare value here */
Cy_TCPWM_ShiftReg_SetCompare0BufVal(TCPWM0, MY_TCPWM_SHIFTREG_NUM, compare);
/* Now the compare 0 and buffered compare 0 values can be swapped using either HW input or Cy_TCPWM_TriggerCaptureOrSwap_Single */
Cy_TCPWM_ShiftReg_SetCompare0BufVal
__STATIC_INLINE void Cy_TCPWM_ShiftReg_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_shiftreg.h:395
Cy_TCPWM_ShiftReg_GetCompare0BufVal
__STATIC_INLINE uint32_t Cy_TCPWM_ShiftReg_GetCompare0BufVal(TCPWM_Type const *base, uint32_t cntNum)
Returns the buffered compare 0 value.
Definition: cy_tcpwm_shiftreg.h:419

## ◆ Cy_TCPWM_ShiftReg_GetCompare0BufVal()

__STATIC_INLINE uint32_t Cy_TCPWM_ShiftReg_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.

/* Scenario: there is a need to modify buffered compare 0 value
* for the first (index = 0) Shift Register 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_SHIFTREG_NUM (0UL)
/* Get the currently existing compare value */
uint32_t compare = Cy_TCPWM_ShiftReg_GetCompare0BufVal(TCPWM0, MY_TCPWM_SHIFTREG_NUM);
/* Modify the compare value here */
Cy_TCPWM_ShiftReg_SetCompare0BufVal(TCPWM0, MY_TCPWM_SHIFTREG_NUM, compare);
/* Now the compare 0 and buffered compare 0 values can be swapped using either HW input or Cy_TCPWM_TriggerCaptureOrSwap_Single */

## ◆ Cy_TCPWM_ShiftReg_EnableCompare0Swap()

__STATIC_INLINE void Cy_TCPWM_ShiftReg_EnableCompare0Swap | ( | TCPWM_Type * | base,
|  | uint32_t | cntNum,
|  | bool | enable
| ) |  |

Enables the comparison swap of compare 0 and compareBuf 0 on corresponding command or external trigger.

Parameters

  base | The pointer to a TCPWM instance.
  cntNum | The Counter instance number in the selected TCPWM.
  enable | true = swap enabled; false = swap disabled

/* Scenario: There is a need to enable the compare swapping feature for
* the first (index = 0) Shift Register 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_SHIFTREG_NUM (0UL)
Cy_TCPWM_ShiftReg_EnableCompare0Swap(TCPWM0, MY_TCPWM_SHIFTREG_NUM, true);
/* Now the compare 0 and 1 values can be swapped using either HW input or Cy_TCPWM_TriggerCaptureOrSwap_Single */
Cy_TCPWM_ShiftReg_EnableCompare0Swap
__STATIC_INLINE void Cy_TCPWM_ShiftReg_EnableCompare0Swap(TCPWM_Type *base, uint32_t cntNum, bool enable)
Enables the comparison swap of compare 0 and compareBuf 0 on corresponding command or external trigge...
Definition: cy_tcpwm_shiftreg.h:532

## ◆ Cy_TCPWM_ShiftReg_SetCompare1Val()

__STATIC_INLINE void Cy_TCPWM_ShiftReg_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 Compare 1 value.

## ◆ Cy_TCPWM_ShiftReg_GetCompare1Val()

__STATIC_INLINE uint32_t Cy_TCPWM_ShiftReg_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_ShiftReg_SetCompare1BufVal()

__STATIC_INLINE void Cy_TCPWM_ShiftReg_SetCompare1BufVal | ( | TCPWM_Type * | base,
|  | uint32_t | cntNum,
|  | uint32_t | compareBuf1
| ) |  |

Sets the buffered 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.
  compareBuf1 | The buffered Compare 1 value.

## ◆ Cy_TCPWM_ShiftReg_GetCompare1BufVal()

__STATIC_INLINE uint32_t Cy_TCPWM_ShiftReg_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_ShiftReg_EnableCompare1Swap()

__STATIC_INLINE void Cy_TCPWM_ShiftReg_EnableCompare1Swap | ( | TCPWM_Type * | base,
|  | uint32_t | cntNum,
|  | bool | enable
| ) |  |

Enables the comparison swap of compare 1 and compareBuf 1 on corresponding command or external trigger.

Parameters

  base | The pointer to a TCPWM instance.
  cntNum | The Counter instance number in the selected TCPWM.
  enable | true = swap enabled; false = swap disabled

## ◆ Cy_TCPWM_ShiftReg_SetCounter()

__STATIC_INLINE void Cy_TCPWM_ShiftReg_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.

/* Scenario: there is a need to set the counter value for
* the first (index = 0) counter of the TCPWM0 block
*/
#define MY_TCPWM_SHIFTREG_NUM (0UL)
#define MY_TCPWM_SHIFTREG_MASK (1UL << MY_TCPWM_SHIFTREG_NUM)
#define MY_TCPWM_SHIFTREG_VAL (100UL)
uint32_t count;
Cy_TCPWM_TriggerStopOrKill_Single(TCPWM0, MY_TCPWM_SHIFTREG_NUM);
Cy_TCPWM_ShiftReg_SetCounter(TCPWM0, MY_TCPWM_SHIFTREG_NUM, MY_TCPWM_SHIFTREG_VAL);
count = Cy_TCPWM_ShiftReg_GetCounter(TCPWM0, MY_TCPWM_SHIFTREG_NUM);
if( count == MY_TCPWM_SHIFTREG_VAL)
{
/* Counter value is set correctly */
}
Cy_TCPWM_TriggerStart_Single(TCPWM0, MY_TCPWM_SHIFTREG_NUM);
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_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_ShiftReg_GetCounter
__STATIC_INLINE uint32_t Cy_TCPWM_ShiftReg_GetCounter(TCPWM_Type const *base, uint32_t cntNum)
Returns the value in the counter.
Definition: cy_tcpwm_shiftreg.h:603
Cy_TCPWM_ShiftReg_SetCounter
__STATIC_INLINE void Cy_TCPWM_ShiftReg_SetCounter(TCPWM_Type *base, uint32_t cntNum, uint32_t count)
Sets the value of the counter.
Definition: cy_tcpwm_shiftreg.h:579

## ◆ Cy_TCPWM_ShiftReg_GetCounter()

__STATIC_INLINE uint32_t Cy_TCPWM_ShiftReg_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.

/* Scenario: there is a need to set the counter value for
* the first (index = 0) counter of the TCPWM0 block
*/
#define MY_TCPWM_SHIFTREG_NUM (0UL)
#define MY_TCPWM_SHIFTREG_MASK (1UL << MY_TCPWM_SHIFTREG_NUM)
#define MY_TCPWM_SHIFTREG_VAL (100UL)
uint32_t count;
Cy_TCPWM_TriggerStopOrKill_Single(TCPWM0, MY_TCPWM_SHIFTREG_NUM);
Cy_TCPWM_ShiftReg_SetCounter(TCPWM0, MY_TCPWM_SHIFTREG_NUM, MY_TCPWM_SHIFTREG_VAL);
count = Cy_TCPWM_ShiftReg_GetCounter(TCPWM0, MY_TCPWM_SHIFTREG_NUM);
if( count == MY_TCPWM_SHIFTREG_VAL)
{
/* Counter value is set correctly */
}
Cy_TCPWM_TriggerStart_Single(TCPWM0, MY_TCPWM_SHIFTREG_NUM);

## ◆ Cy_TCPWM_ShiftReg_SetTaps()

__STATIC_INLINE void Cy_TCPWM_ShiftReg_SetTaps | ( | TCPWM_Type * | base,
|  | uint32_t | cntNum,
|  | uint32_t | taps
| ) |  |

Sets which taps are enabled.

Parameters

  base | The pointer to a TCPWM instance.
  cntNum | The Counter instance number in the selected TCPWM.
  taps | The taps that will be enabled.

/* Scenario: there is a need to set the taps value for
* the first (index = 0) counter of the TCPWM0 block
*/
#define MY_TCPWM_SHIFTREG_NUM (0UL)
#define MY_TCPWM_SHIFTREG_MASK (1UL << MY_TCPWM_SHIFTREG_NUM)
#define MY_TCPWM_SHIFTREG_TAPS (1UL)
uint32_t tapsEnabled;
Cy_TCPWM_TriggerStopOrKill_Single(TCPWM0, MY_TCPWM_SHIFTREG_NUM);
Cy_TCPWM_ShiftReg_SetTaps(TCPWM0, MY_TCPWM_SHIFTREG_NUM, MY_TCPWM_SHIFTREG_VAL);
tapsEnabled = Cy_TCPWM_ShiftReg_GetTaps(TCPWM0, MY_TCPWM_SHIFTREG_NUM);
if( tapsEnabled == MY_TCPWM_SHIFTREG_TAPS)
{
/* taps value is set correctly */
}
Cy_TCPWM_TriggerStart_Single(TCPWM0, MY_TCPWM_SHIFTREG_NUM);
Cy_TCPWM_ShiftReg_GetTaps
__STATIC_INLINE uint32_t Cy_TCPWM_ShiftReg_GetTaps(TCPWM_Type const *base, uint32_t cntNum)
Returns which taps are enabled.
Definition: cy_tcpwm_shiftreg.h:651
Cy_TCPWM_ShiftReg_SetTaps
__STATIC_INLINE void Cy_TCPWM_ShiftReg_SetTaps(TCPWM_Type *base, uint32_t cntNum, uint32_t taps)
Sets which taps are enabled.
Definition: cy_tcpwm_shiftreg.h:627

## ◆ Cy_TCPWM_ShiftReg_GetTaps()

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

Returns which taps are enabled.

Parameters

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

Returns
  Returns which taps are enabled.

/* Scenario: there is a need to set the taps value for
* the first (index = 0) counter of the TCPWM0 block
*/
#define MY_TCPWM_SHIFTREG_NUM (0UL)
#define MY_TCPWM_SHIFTREG_MASK (1UL << MY_TCPWM_SHIFTREG_NUM)
#define MY_TCPWM_SHIFTREG_TAPS (1UL)
uint32_t tapsEnabled;
Cy_TCPWM_TriggerStopOrKill_Single(TCPWM0, MY_TCPWM_SHIFTREG_NUM);
Cy_TCPWM_ShiftReg_SetTaps(TCPWM0, MY_TCPWM_SHIFTREG_NUM, MY_TCPWM_SHIFTREG_VAL);
tapsEnabled = Cy_TCPWM_ShiftReg_GetTaps(TCPWM0, MY_TCPWM_SHIFTREG_NUM);
if( tapsEnabled == MY_TCPWM_SHIFTREG_TAPS)
{
/* taps value is set correctly */
}
Cy_TCPWM_TriggerStart_Single(TCPWM0, MY_TCPWM_SHIFTREG_NUM);

## ◆ Cy_TCPWM_ShiftReg_LineOutStatus()

__STATIC_INLINE uint32_t Cy_TCPWM_ShiftReg_LineOutStatus | ( | TCPWM_Type const * | base,
|  | uint32_t | cntNum,
|  | uint32_t | shiftRegOutSelect
| ) |  |

Returns the current level of the selected Shift Register output line.

Parameters

  base | The pointer to a TCPWM instance.
  cntNum | The Counter instance number in the selected TCPWM.
  shiftRegOutSelect | Defines which Shift Register output line is being checked: line_out or line_out_inv.

Returns
  The current Shift Register output line level.

/* Scenario: there is a need to check current level of
* Shift Register Line output for the first (index = 0) counter of the TCPWM0 block
*/
#define MY_TCPWM_SHIFTREG_NUM (0UL)
if (Cy_TCPWM_ShiftReg_LineOutStatus(TCPWM0, MY_TCPWM_SHIFTREG_NUM, CY_TCPWM_SHIFTREG_LINE_OUT))
{
/* Shift Register Line is High */
}
else
{
/* Shift Register Line is Low */
}
Cy_TCPWM_ShiftReg_LineOutStatus
__STATIC_INLINE uint32_t Cy_TCPWM_ShiftReg_LineOutStatus(TCPWM_Type const *base, uint32_t cntNum, uint32_t shiftRegOutSelect)
Returns the current level of the selected Shift Register output line.
Definition: cy_tcpwm_shiftreg.h:681
CY_TCPWM_SHIFTREG_LINE_OUT
#define CY_TCPWM_SHIFTREG_LINE_OUT
Shift Register Line output.
Definition: cy_tcpwm_shiftreg.h:180

## ◆ Cy_TCPWM_Shiftreg_EnableSwap()

__STATIC_INLINE void Cy_TCPWM_Shiftreg_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