cmd.flags |= devc->sample_wide ? CMD_START_FLAGS_SAMPLE_16BIT :
CMD_START_FLAGS_SAMPLE_8BIT;
/* Enable CTL2 clock. */
- cmd.flags |= (devc->profile->dev_caps & DEV_CAPS_AX_ANALOG) ? CMD_START_FLAGS_CLK_CTL2 : 0;
+ cmd.flags |= (g_slist_length(devc->enabled_analog_channels) > 0) ? CMD_START_FLAGS_CLK_CTL2 : 0;
/* Send the control message. */
ret = libusb_control_transfer(usb->devhdl, LIBUSB_REQUEST_TYPE_VENDOR |
devc->num_transfers = 0;
g_free(devc->transfers);
- /* Free the deinterlace buffers if we had them */
- g_free(devc->logic_buffer);
- g_free(devc->analog_buffer);
+ /* Free the deinterlace buffers if we had them. */
+ if (g_slist_length(devc->enabled_analog_channels) > 0) {
+ g_free(devc->logic_buffer);
+ g_free(devc->analog_buffer);
+ }
if (devc->stl) {
soft_trigger_logic_free(devc->stl);
/* Send the logic */
for (i = 0; i < length; i++) {
- devc->logic_buffer[i] = data[i * 2];
+ devc->logic_buffer[i] = data[i * 2];
/* Rescale to -10V - +10V from 0-255. */
- devc->analog_buffer[i] = data[i * 2 + 1] - 128.0f / 12.8f;
+ devc->analog_buffer[i] = (data[i * 2 + 1] - 128.0f) / 12.8f;
};
const struct sr_datafeed_logic logic = {
sr_session_send(sdi, &logic_packet);
- sr_analog_init(&analog, &encoding, &meaning, &spec, 0);
+ sr_analog_init(&analog, &encoding, &meaning, &spec, 2);
analog.meaning->channels = devc->enabled_analog_channels;
analog.meaning->mq = SR_MQ_VOLTAGE;
analog.meaning->unit = SR_UNIT_VOLT;
{
unsigned int n;
+ if (devc->dslogic)
+ return dslogic_get_number_of_transfers(devc);
+
/* Total buffer size should be able to hold about 500ms of data. */
n = (500 * to_bytes_per_ms(devc->cur_samplerate) /
fx2lafw_get_buffer_size(devc));