]> sigrok.org Git - libsigrok.git/commitdiff
added edge triggers
authormagnuskarlsson <redacted>
Thu, 29 May 2014 01:53:22 +0000 (18:53 -0700)
committerBert Vermeulen <redacted>
Sun, 24 Aug 2014 23:00:55 +0000 (01:00 +0200)
src/hardware/pipistrello-ols/api.c
src/hardware/pipistrello-ols/protocol.c
src/hardware/pipistrello-ols/protocol.h

index 8496557078124ca56d52b88ee6861ca13e508585..5423a320e16046df32f3ddfd15bffffc08d831ab 100644 (file)
@@ -501,6 +501,14 @@ static int set_trigger(const struct sr_dev_inst *sdi, int stage)
        if (write_longcommand(devc, cmd, arg) != SR_OK)
                return SR_ERR;
 
+       cmd = CMD_SET_TRIGGER_EDGE + stage * 4;
+       arg[0] = devc->trigger_edge[stage] & 0xff;
+       arg[1] = (devc->trigger_edge[stage] >> 8) & 0xff;
+       arg[2] = (devc->trigger_edge[stage] >> 16) & 0xff;
+       arg[3] = (devc->trigger_edge[stage] >> 24) & 0xff;
+       if (write_longcommand(devc, cmd, arg) != SR_OK)
+               return SR_ERR;
+
        return SR_OK;
 }
 
@@ -583,13 +591,13 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi,
        arg[1] = ((readcount - 1) & 0xff00) >> 8;
        arg[2] = ((readcount - 1) & 0xff0000) >> 16;
        arg[3] = ((readcount - 1) & 0xff000000) >> 24;
-       if (write_longcommand(devc, CMD_CAPTURE_COUNT, arg) != SR_OK)
+       if (write_longcommand(devc, CMD_CAPTURE_DELAY, arg) != SR_OK)
                return SR_ERR;
        arg[0] = ((delaycount - 1) & 0xff);
        arg[1] = ((delaycount - 1) & 0xff00) >> 8;
        arg[2] = ((delaycount - 1) & 0xff0000) >> 16;
        arg[3] = ((delaycount - 1) & 0xff000000) >> 24;
-       if (write_longcommand(devc, CMD_CAPTURE_DELAY, arg) != SR_OK)
+       if (write_longcommand(devc, CMD_CAPTURE_COUNT, arg) != SR_OK)
                return SR_ERR;
        /* Flag register. */
        sr_dbg("Setting intpat %s, extpat %s, RLE %s, noise_filter %s, demux %s",
index 5e8d721ff0c4b89628be16aaa5dc9a3c12830ee7..bef76fba59cfc5a37badcc2d21846c54f1b840bf 100644 (file)
@@ -167,6 +167,7 @@ SR_PRIV int p_ols_configure_channels(const struct sr_dev_inst *sdi)
        for (i = 0; i < NUM_TRIGGER_STAGES; i++) {
                devc->trigger_mask[i] = 0;
                devc->trigger_value[i] = 0;
+               devc->trigger_edge[i] = 0;
        }
 
        devc->num_stages = 0;
@@ -194,8 +195,10 @@ SR_PRIV int p_ols_configure_channels(const struct sr_dev_inst *sdi)
                stage = 0;
                for (tc = ch->trigger; tc && *tc; tc++) {
                        devc->trigger_mask[stage] |= channel_bit;
-                       if (*tc == '1')
+                       if ((*tc == '1') || (*tc == 'r'))
                                devc->trigger_value[stage] |= channel_bit;
+                       if ((*tc == 'r') || (*tc == 'f'))
+                               devc->trigger_edge[stage] |= channel_bit;
                        stage++;
                        /* Only supporting parallel mode, with up to 4 stages. */
                        if (stage > 3)
index e62d8ab2e6fa76cb03e00f3f033d9ce5c9cbe7f3..819755ed04778b4428d9022c80c06648f95eb95d 100644 (file)
@@ -39,7 +39,7 @@
 
 #define NUM_CHANNELS           32
 #define NUM_TRIGGER_STAGES     4
-#define TRIGGER_TYPE           "01"
+#define TRIGGER_TYPE           "01rf"
 #define CLOCK_RATE             SR_MHZ(100)
 #define MIN_NUM_SAMPLES        4
 #define DEFAULT_SAMPLERATE     SR_MHZ(100)
@@ -57,6 +57,7 @@
 #define CMD_SET_TRIGGER_MASK       0xc0
 #define CMD_SET_TRIGGER_VALUE      0xc1
 #define CMD_SET_TRIGGER_CONFIG     0xc2
+#define CMD_SET_TRIGGER_EDGE       0xc3
 
 /* Trigger config */
 #define TRIGGER_START              (1 << 3)
@@ -97,6 +98,7 @@ struct dev_context {
        uint32_t channel_mask;
        uint32_t trigger_mask[4];
        uint32_t trigger_value[4];
+       uint32_t trigger_edge[4];
        int num_stages;
        uint16_t flag_reg;