libsigrok
unreleased development snapshot
sigrok hardware access and backend library
|
Creating, using, or destroying triggers. More...
Functions | |
struct sr_trigger * | sr_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_stage * | sr_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... | |
Creating, using, or destroying triggers.
void sr_trigger_free | ( | struct sr_trigger * | trig | ) |
Free a previously allocated trigger.
This will also free any trigger stages/matches in this trigger.
trig | The trigger to free. Must not be NULL. |
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.
stage | The trigger stage to add the match to. Must not be NULL. |
ch | The channel for this trigger match. Must not be NULL. Must be either of type SR_CHANNEL_LOGIC or SR_CHANNEL_ANALOG. |
trigger_match | The 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. |
value | Trigger value. |
SR_OK | Success. |
SR_ERR_ARG | Invalid argument(s) were passed to this functions. |
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.
name | The trigger name to use. Can be NULL. |
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.
trig | The trigger to add a stage to. Must not be NULL. |
NULL | An invalid (NULL) trigger was passed into the function. |
other | A newly allocated trigger stage (which has also been added to the list of stages of the specified trigger). |
Definition at line 108 of file trigger.c.
References sr_trigger_stage::stage, and sr_trigger::stages.