libsigrok  0.4.0
sigrok hardware access and backend library
Functions
Trigger handling

Creating, using, or destroying triggers. More...

Functions

struct sr_triggersr_trigger_new (const char *name)
 Create a new trigger. More...
 
void sr_trigger_free (struct sr_trigger *trig)
 Free a previously allocated trigger. More...
 
struct sr_trigger_stagesr_trigger_stage_add (struct sr_trigger *trig)
 Allocate a new trigger stage and add it to the specified trigger. More...
 
int sr_trigger_match_add (struct sr_trigger_stage *stage, struct sr_channel *ch, int trigger_match, float value)
 Allocate a new trigger match and add it to the specified trigger stage. More...
 

Detailed Description

Creating, using, or destroying triggers.

Function Documentation

void sr_trigger_free ( struct sr_trigger trig)

Free a previously allocated trigger.

This will also free any trigger stages/matches in this trigger.

Parameters
trigThe trigger to free. Must not be NULL.
Since
0.4.0

Definition at line 74 of file trigger.c.

References sr_trigger_stage::matches, sr_trigger::name, sr_trigger_stage::stage, and sr_trigger::stages.

int sr_trigger_match_add ( struct sr_trigger_stage stage,
struct sr_channel ch,
int  trigger_match,
float  value 
)

Allocate a new trigger match and add it to the specified trigger stage.

The caller is responsible to free the trigger (including all stages and matches) using sr_trigger_free() once it is no longer needed.

Parameters
stageThe trigger stage to add the match to. Must not be NULL.
chThe channel for this trigger match. Must not be NULL. Must be either of type SR_CHANNEL_LOGIC or SR_CHANNEL_ANALOG.
trigger_matchThe type of trigger match. Must be a valid trigger type from enum sr_trigger_matches. The trigger type must be valid for the respective channel type as well.
valueTrigger value.
Return values
SR_OKSuccess.
SR_ERR_ARGInvalid argument(s) were passed to this functions.
Since
0.4.0

Definition at line 141 of file trigger.c.

References sr_trigger_match::channel, sr_trigger_match::match, sr_trigger_stage::matches, SR_CHANNEL_ANALOG, SR_CHANNEL_LOGIC, SR_ERR_ARG, SR_OK, SR_TRIGGER_EDGE, SR_TRIGGER_FALLING, SR_TRIGGER_ONE, SR_TRIGGER_OVER, SR_TRIGGER_RISING, SR_TRIGGER_UNDER, SR_TRIGGER_ZERO, sr_channel::type, and sr_trigger_match::value.

struct sr_trigger* sr_trigger_new ( const char *  name)

Create a new trigger.

The caller is responsible to free the trigger (including all stages and matches) using sr_trigger_free() once it is no longer needed.

Parameters
nameThe trigger name to use. Can be NULL.
Returns
A newly allocated trigger.
Since
0.4.0

Definition at line 54 of file trigger.c.

References sr_trigger::name.

struct sr_trigger_stage* sr_trigger_stage_add ( struct sr_trigger trig)

Allocate a new trigger stage and add it to the specified trigger.

The caller is responsible to free the trigger (including all stages and matches) using sr_trigger_free() once it is no longer needed.

Parameters
trigThe trigger to add a stage to. Must not be NULL.
Return values
NULLAn invalid (NULL) trigger was passed into the function.
otherA newly allocated trigger stage (which has also been added to the list of stages of the specified trigger).
Since
0.4.0

Definition at line 108 of file trigger.c.

References sr_trigger_stage::stage, and sr_trigger::stages.