]> sigrok.org Git - libsigrok.git/commitdiff
zeroplus-logic-cube: Enable edge-triggering capabilities.
authorJan Metzger <redacted>
Fri, 14 Feb 2020 07:38:27 +0000 (08:38 +0100)
committerUwe Hermann <redacted>
Wed, 8 Apr 2020 20:57:02 +0000 (22:57 +0200)
This fixes bug #1334.

src/hardware/zeroplus-logic-cube/analyzer.c
src/hardware/zeroplus-logic-cube/api.c

index 321b17c0ed54f11a56c2ac09cf6f8d1e0e0240ba..2130692f589dacde768663c4d0cf7857d9127e13 100644 (file)
@@ -62,7 +62,7 @@ enum {
        TRIGGER_STATUS5,
        TRIGGER_STATUS6,
        TRIGGER_STATUS7,
-       TRIGGER_STATUS8,
+       TRIGGER_EDGE,
 
        TRIGGER_COUNT0                  = 0x50,
        TRIGGER_COUNT1,
@@ -108,7 +108,8 @@ enum {
        READ_RAM_STATUS                 = 0xa0,
 };
 
-static int g_trigger_status[9] = { 0 };
+static int g_trigger_status[8] = { 0 };
+static int g_trigger_edge = 0;
 static int g_trigger_count = 1;
 static int g_filter_status[8] = { 0 };
 static int g_filter_enable = 0;
@@ -461,8 +462,9 @@ SR_PRIV void analyzer_configure(libusb_device_handle *devh)
        gl_reg_write(devh, CLOCK_SOURCE, 0x03);
 
        /* Set_Trigger_Status */
-       for (i = 0; i < 9; i++)
+       for (i = 0; i < 8; i++)
                gl_reg_write(devh, TRIGGER_STATUS0 + i, g_trigger_status[i]);
+       gl_reg_write(devh, TRIGGER_EDGE, g_trigger_edge);
 
        __analyzer_set_trigger_count(devh, g_trigger_count);
 
@@ -519,6 +521,15 @@ SR_PRIV int analyzer_add_triggers(const struct sr_dev_inst *sdi)
                        case SR_TRIGGER_ONE:
                                g_trigger_status[channel / 4] |= 1 << (channel % 4 * 2);
                                break;
+                       case SR_TRIGGER_RISING:
+                               g_trigger_edge = 0x40 | (channel & 0x1F);
+                               break;
+                       case SR_TRIGGER_FALLING:
+                               g_trigger_edge = 0x80 | (channel & 0x1F);
+                               break;
+                       case SR_TRIGGER_EDGE:
+                               g_trigger_edge = 0xc0 | (channel & 0x1F);
+                               break;
                        default:
                                sr_err("Unsupported match %d", match->match);
                                return SR_ERR;
index 7a4041a16143f7d6dc84d7b35af3d4e224692a8f..36aef79544a3bfac8f7e69492211211cd6376a76 100644 (file)
@@ -71,6 +71,9 @@ static const uint32_t devopts[] = {
 static const int32_t trigger_matches[] = {
        SR_TRIGGER_ZERO,
        SR_TRIGGER_ONE,
+       SR_TRIGGER_RISING,
+       SR_TRIGGER_FALLING,
+       SR_TRIGGER_EDGE,
 };
 
 /*