{ 100, 1 },
};
-#define NUM_TIMEBASE ARRAY_SIZE(timebases)
-#define NUM_VDIV ARRAY_SIZE(vdivs)
-
static const char *trigger_sources[] = {
"CH1", "CH2", "Ext", "Ext /5", "AC Line",
"D0", "D1", "D2", "D3", "D4", "D5", "D6", "D7",
SDS2000X,
};
-/* short name, full name, USB name */
+/* short name, full name */
static const struct siglent_sds_vendor supported_vendors[] = {
- [SIGLENT] = {
- "Siglent", "Siglent Technologies", "Siglent Technologies Co,. Ltd.",
- },
+ [SIGLENT] = {"Siglent", "Siglent Technologies"},
};
#define VENDOR(x) &supported_vendors[x]
devc->digital_group);
}
- for (i = 0; i < NUM_TIMEBASE; i++) {
+ for (i = 0; i < ARRAY_SIZE(timebases); i++) {
if (!memcmp(&devc->model->min_timebase, &timebases[i], sizeof(uint64_t[2])))
devc->timebases = &timebases[i];
devc->num_timebases = &timebases[i] - devc->timebases + 1;
}
- for (i = 0; i < NUM_VDIV; i++) {
+ for (i = 0; i < ARRAY_SIZE(vdivs); i++) {
devc->vdivs = &vdivs[i];
if (!memcmp(&devc->model->series->min_vdiv,
&vdivs[i], sizeof(uint64_t[2]))) {
devc->vdivs = &vdivs[i];
- devc->num_vdivs = NUM_VDIV - i;
+ devc->num_vdivs = ARRAY_SIZE(vdivs) - i;
break;
}
}
break;
case SR_CONF_SAMPLERATE:
siglent_sds_get_dev_cfg_horizontal(sdi);
- *data = g_variant_new_uint64(devc->sampleRate);
+ *data = g_variant_new_uint64(devc->samplerate);
break;
case SR_CONF_TRIGGER_SOURCE:
if (!strcmp(devc->trigger_source, "ACL"))
devc->trigger_level = t_dbl;
break;
case SR_CONF_TIMEBASE:
- sr_dbg("Setting device Timebase");
g_variant_get(data, "(tt)", &p, &q);
for (i = 0; i < devc->num_timebases; i++) {
char *cmd;
break;
case SR_CONF_SAMPLERATE:
siglent_sds_get_dev_cfg_horizontal(sdi);
- data = g_variant_new_uint64(devc->sampleRate);
+ data = g_variant_new_uint64(devc->samplerate);
break;
default:
return SR_ERR_NA;
struct sr_channel *ch;
struct sr_datafeed_packet packet;
gboolean some_digital;
- GSList *l;
- GSList *d;
+ GSList *l, *d;
if (sdi->status != SR_ST_ACTIVE)
return SR_ERR_DEV_CLOSED;
}
memcpy(&framecount, buf + 40, 4);
if (devc->limit_frames > framecount)
- sr_err("Frame limit higher that frames in buffer of device!");
+ sr_err("Frame limit higher than frames in buffer of device!");
else if (devc->limit_frames == 0)
devc->limit_frames = framecount;
sr_dbg("Starting data capture for history frameset %" PRIu64 " of %" PRIu64,
struct sr_scpi_dev_inst *scpi = sdi->conn;
struct dev_context *devc = sdi->priv;
char *buf = (char *)devc->buffer;
- int ret;
- int descLength;
- int blockOffset = 15; /* Offset for descriptor block. */
+ int ret, desc_length;
+ int block_offset = 15; /* Offset for descriptor block. */
long dataLength = 0;
/* Read header from device. */
}
sr_dbg("Device returned %i bytes.", ret);
devc->num_header_bytes += ret;
- buf += blockOffset; /* Skip to start descriptor block. */
+ buf += block_offset; /* Skip to start descriptor block. */
/* Parse WaveDescriptor header. */
- memcpy(&descLength, buf + 36, 4); /* Descriptor block length */
+ memcpy(&desc_length, buf + 36, 4); /* Descriptor block length */
memcpy(&dataLength, buf + 60, 4); /* Data block length */
devc->vdiv[channelIndex] = 2;
devc->vert_offset[channelIndex] = 0;
- devc->blockHeaderSize = descLength + 15;
+ devc->block_header_size = desc_length + 15;
ret = dataLength;
- sr_dbg("Received data block header: '%s' -> block length %d", buf, ret);
+ sr_dbg("Received data block header: '%s' -> block length %d.", buf, ret);
return ret;
}
len = ACQ_BUFFER_SIZE;
/* Offset the data block buffer past the IEEE header and description header. */
- devc->buffer += devc->blockHeaderSize;
+ devc->buffer += devc->block_header_size;
if (len == -1) {
sr_err("Read error, aborting capture.");
float offset = devc->vert_offset[ch->index];
GArray *float_data;
static GArray *data;
- float voltage;
- float vdivlog;
+ float voltage, vdivlog;
int digits;
data = g_array_sized_new(FALSE, FALSE, sizeof(uint8_t), len);
{
struct dev_context *devc;
struct sr_channel *ch;
- char *cmd;
+ char *cmd, *response;
unsigned int i;
- int res;
- char *response;
+ int res, num_tokens;
gchar **tokens;
- int num_tokens;
devc = sdi->priv;
struct dev_context *devc;
char *cmd;
int res;
- char *samplePointsString;
- float samplerateScope;
- float fvalue;
+ char *sample_points_string;
+ float samplerate_scope, fvalue;
char *first, *concat;
devc = sdi->priv;
cmd = g_strdup_printf("SANU? C1");
- res = sr_scpi_get_string(sdi->conn, cmd, &samplePointsString);
+ res = sr_scpi_get_string(sdi->conn, cmd, &sample_points_string);
g_free(cmd);
if (res != SR_OK)
return SR_ERR;
- if (g_strstr_len(samplePointsString, -1, "Mpts") != NULL) {
- samplePointsString[strlen(samplePointsString) - 4] = '\0';
+ if (g_strstr_len(sample_points_string, -1, "Mpts") != NULL) {
+ sample_points_string[strlen(sample_points_string) - 4] = '\0';
- if (g_strstr_len(samplePointsString, -1, ".") != NULL) {
- first = strtok(samplePointsString, ".");
+ if (g_strstr_len(sample_points_string, -1, ".") != NULL) {
+ first = strtok(sample_points_string, ".");
concat = strcat(first, strtok(NULL, "."));
if (sr_atof_ascii(concat, &fvalue) != SR_OK || fvalue == 0.0) {
sr_dbg("Invalid float converted from scope response.");
return SR_ERR;
}
} else {
- if (sr_atof_ascii(samplePointsString, &fvalue) != SR_OK || fvalue == 0.0) {
+ if (sr_atof_ascii(sample_points_string, &fvalue) != SR_OK || fvalue == 0.0) {
sr_dbg("Invalid float converted from scope response.");
return SR_ERR;
}
}
- samplerateScope = fvalue * 100000;
+ samplerate_scope = fvalue * 100000;
} else {
- samplePointsString[strlen(samplePointsString) - 4] = '\0';
- if (sr_atof_ascii(samplePointsString, &fvalue) != SR_OK || fvalue == 0.0) {
+ sample_points_string[strlen(sample_points_string) - 4] = '\0';
+ if (sr_atof_ascii(sample_points_string, &fvalue) != SR_OK || fvalue == 0.0) {
sr_dbg("Invalid float converted from scope response.");
return SR_ERR;
}
- samplerateScope = fvalue * 1000;
+ samplerate_scope = fvalue * 1000;
}
/* Get the timebase. */
if (sr_scpi_get_float(sdi->conn, ":TDIV?", &devc->timebase) != SR_OK)
return SR_ERR;
sr_dbg("Current timebase: %g.", devc->timebase);
- devc->sampleRate = samplerateScope / (devc->timebase * devc->model->series->num_horizontal_divs);
+ devc->samplerate = samplerate_scope / (devc->timebase * devc->model->series->num_horizontal_divs);
return SR_OK;
}