PSoC 4 Peripheral Driver Library - Alpha

General Description

Functions

cy_en_trigmux_status_t Cy_TrigMux_Connect (uint32_t inTrig, uint32_t outTrig, bool invert, en_trig_type_t trigType)
 Connects an input trigger source and output trigger. More...
 
cy_en_trigmux_status_t Cy_TrigMux_SwTrigger (uint32_t trigLine, uint32_t cycles)
 This function generates a software trigger on an input trigger line. More...
 

Function Documentation

◆ Cy_TrigMux_Connect()

cy_en_trigmux_status_t Cy_TrigMux_Connect ( uint32_t  inTrig,
uint32_t  outTrig,
bool  invert,
en_trig_type_t  trigType 
)

Connects an input trigger source and output trigger.

Parameters
inTrigAn input selection for the trigger mux.
  • Bit 30 should be cleared.
  • Bit 12 should be cleared.
  • Bits 11:8 represent the trigger group selection.
  • Bits 7:0 select the input trigger signal for the specified trigger multiplexer.
outTrigThe output of the trigger mux. This refers to the consumer of the trigger mux.
  • Bit 30 should be set.
  • Bit 12 should be cleared.
  • Bits 11:8 represent the trigger group selection.
  • Bits 6:0 select the output trigger number in the trigger group.
invert
  • Unused parameter.
trigTypeThe trigger signal type.
  • Unused parameter.
Returns
status:
  • CY_TRIGMUX_SUCCESS: The connection is made successfully.
  • CY_TRIGMUX_BAD_PARAM: Some parameter is invalid.
Function Usage
/* Scenario: Setup a trigger multiplexer connection from TCPWM counter 0 overflow output to DataWire 0 channel 0 trigger input.
* Also for trigger signal evidence setup two additional trigger multiplexer connections:
* - from the same TCPWM counter 0 overflow output to HSIOM trigger IO output 0 (GPIO port 0.4)
* - from the DataWire 0 channel 0 trigger output to HSIOM trigger IO output 1 (GPIO port 0.5)
*/
(void)Cy_TrigMux_Connect(TRIG11_IN_TCPWM0_TR_OVERFLOW0, TRIG11_OUT_TR_GROUP0_INPUT9, false, TRIGGER_TYPE_LEVEL);
(void)Cy_TrigMux_Connect(TRIG0_IN_TR_GROUP11_OUTPUT0, TRIG0_OUT_CPUSS_DW0_TR_IN0, false, TRIGGER_TYPE_EDGE);
(void)Cy_TrigMux_Connect(TRIG11_IN_TCPWM0_TR_OVERFLOW0, TRIG11_OUT_TR_GROUP8_INPUT9, false, TRIGGER_TYPE_LEVEL);
(void)Cy_TrigMux_Connect(TRIG8_IN_TR_GROUP11_OUTPUT0, TRIG8_OUT_PERI_TR_IO_OUTPUT0, false, TRIGGER_TYPE_EDGE);
(void)Cy_TrigMux_Connect(TRIG10_IN_CPUSS_DW0_TR_OUT0, TRIG10_OUT_TR_GROUP8_INPUT1, false, TRIGGER_TYPE_LEVEL);
(void)Cy_TrigMux_Connect(TRIG8_IN_TR_GROUP10_OUTPUT0, TRIG8_OUT_PERI_TR_IO_OUTPUT1, false, TRIGGER_TYPE_EDGE);
/* Note: the Cy_TrigMux_Connect return status is ignored here because the provided parameters are correct.
* It is made here just to reduce the code snippet redundancy, it is not recommended to do so in the user code.
*/
/* Now initialize the correspondent GPIO pins */
Cy_GPIO_Pin_FastInit(GPIO_PRT0, 4UL, CY_GPIO_DM_STRONG_IN_OFF, 0UL, P0_4_PERI_TR_IO_OUTPUT0);
Cy_GPIO_Pin_FastInit(GPIO_PRT0, 5UL, CY_GPIO_DM_STRONG_IN_OFF, 0UL, P0_5_PERI_TR_IO_OUTPUT1);
/* Now the TCPWM counter 0 periodically triggers the DW0 channel 0 (each time when overflow event occurs).
* Also the TCPWM and DMA output trigger signals can be observed with oscilloscope on pins P0.4 and P0.5 correspondingly.
*/

◆ Cy_TrigMux_SwTrigger()

cy_en_trigmux_status_t Cy_TrigMux_SwTrigger ( uint32_t  trigLine,
uint32_t  cycles 
)

This function generates a software trigger on an input trigger line.

All output triggers connected to this input trigger will be triggered. The function also verifies that there is no activated trigger before generating another activation.

Parameters
trigLineThe input of the trigger mux.
  • Bit 30 represents if the signal is an input/output. When this bit is set, the trigger activation is for an output trigger from the trigger multiplexer. When this bit is reset, the trigger activation is for an input trigger to the trigger multiplexer.
  • Bits 12:8 represent the trigger group selection.
    In case of output trigger line (bit 30 is set):
  • Bits 6:0 select the output trigger number in the trigger group. In case of input trigger line (bit 30 is unset):
  • Bits 7:0 select the input trigger signal for the trigger multiplexer.
cyclesThe number of "Clk_Peri" cycles during which the trigger remains activated.
The valid range of cycles is 1 ... 254.
Also there are special values:
  • CY_TRIGGER_INFINITE - trigger remains activated until the user deactivates it by calling this function with CY_TRIGGER_DEACTIVATE parameter.
  • CY_TRIGGER_DEACTIVATE - this is used to deactivate the trigger activated by calling this function with CY_TRIGGER_INFINITE parameter.
Returns
status:
  • CY_TRIGMUX_SUCCESS: The trigger is successfully activated/deactivated.
  • CY_TRIGMUX_INVALID_STATE: The trigger is already activated/not active.
  • CY_TRIGMUX_BAD_PARAM: Some parameter is invalid.
Function Usage
/* Scenario: Software Trigger the DW0 channel 0 */
if (CY_TRIGMUX_SUCCESS != Cy_TrigMux_SwTrigger(TRIG0_OUT_CPUSS_DW0_TR_IN0, CY_TRIGGER_TWO_CYCLES))
{
/* Insert error handling */
}