]> sigrok.org Git - libsigrok.git/blobdiff - device.c
Add new triggering framework.
[libsigrok.git] / device.c
index b539eceea65f1013ba32d0f02e59eaf2170ec2a9..889f02df6e37ac01f4a0e9cea00564be2b8ebdda 100644 (file)
--- a/device.c
+++ b/device.c
@@ -23,7 +23,9 @@
 #include "libsigrok.h"
 #include "libsigrok-internal.h"
 
+/** @cond PRIVATE */
 #define LOG_PREFIX "device"
+/** @endcond */
 
 /**
  * @file
@@ -48,7 +50,7 @@
  *
  *  @return NULL (failure) or new struct sr_channel*.
  */
-SR_PRIV struct sr_channel *sr_probe_new(int index, int type,
+SR_PRIV struct sr_channel *sr_channel_new(int index, int type,
                gboolean enabled, const char *name)
 {
        struct sr_channel *ch;
@@ -81,9 +83,9 @@ SR_PRIV struct sr_channel *sr_probe_new(int index, int type,
  *
  * @return SR_OK on success, or SR_ERR_ARG on invalid arguments.
  *
- * @since 0.2.0
+ * @since 0.3.0
  */
-SR_API int sr_dev_probe_name_set(const struct sr_dev_inst *sdi,
+SR_API int sr_dev_channel_name_set(const struct sr_dev_inst *sdi,
                int channelnum, const char *name)
 {
        GSList *l;
@@ -120,9 +122,9 @@ SR_API int sr_dev_probe_name_set(const struct sr_dev_inst *sdi,
  *         arguments, SR_ERR_ARG is returned and the channel enabled state
  *         remains unchanged.
  *
- * @since 0.2.0
+ * @since 0.3.0
  */
-SR_API int sr_dev_probe_enable(const struct sr_dev_inst *sdi, int channelnum,
+SR_API int sr_dev_channel_enable(const struct sr_dev_inst *sdi, int channelnum,
                gboolean state)
 {
        GSList *l;
@@ -141,9 +143,9 @@ SR_API int sr_dev_probe_enable(const struct sr_dev_inst *sdi, int channelnum,
                        ch->enabled = state;
                        ret = SR_OK;
                        if (!state != !was_enabled && sdi->driver
-                                       && sdi->driver->config_probe_set) {
-                               ret = sdi->driver->config_probe_set(
-                                       sdi, ch, SR_PROBE_SET_ENABLED);
+                                       && sdi->driver->config_channel_set) {
+                               ret = sdi->driver->config_channel_set(
+                                       sdi, ch, SR_CHANNEL_SET_ENABLED);
                                /* Roll back change if it wasn't applicable. */
                                if (ret == SR_ERR_ARG)
                                        ch->enabled = was_enabled;
@@ -193,9 +195,9 @@ SR_API int sr_dev_trigger_set(const struct sr_dev_inst *sdi, int channelnum,
                        /* Set new trigger if it has changed. */
                        ch->trigger = g_strdup(trigger);
 
-                       if (sdi->driver && sdi->driver->config_probe_set) {
-                               ret = sdi->driver->config_probe_set(
-                                       sdi, ch, SR_PROBE_SET_TRIGGER);
+                       if (sdi->driver && sdi->driver->config_channel_set) {
+                               ret = sdi->driver->config_channel_set(
+                                       sdi, ch, SR_CHANNEL_SET_TRIGGER);
                                /* Roll back change if it wasn't applicable. */
                                if (ret == SR_ERR_ARG) {
                                        g_free(ch->trigger);
@@ -304,7 +306,6 @@ SR_PRIV void sr_dev_inst_free(struct sr_dev_inst *sdi)
        for (l = sdi->channels; l; l = l->next) {
                ch = l->data;
                g_free(ch->name);
-               g_free(ch->trigger);
                g_free(ch);
        }
        g_slist_free(sdi->channels);