Only when there are technical reasons use prefix-increment.
sigma_set_register(WRITE_TRIGGER_SELECT1, 0x81, devc);
/* Find which pin to trigger on from mask. */
- for (triggerpin = 0; triggerpin < 8; ++triggerpin)
+ for (triggerpin = 0; triggerpin < 8; triggerpin++)
if ((devc->trigger.risingmask | devc->trigger.fallingmask) &
(1 << triggerpin))
break;
buf[idx++] = REG_ADDR_LOW | (reg & 0xf);
buf[idx++] = REG_ADDR_HIGH | (reg >> 4);
- for (i = 0; i < len; ++i) {
+ for (i = 0; i < len; i++) {
buf[idx++] = REG_DATA_LOW | (data[i] & 0xf);
buf[idx++] = REG_DATA_HIGH_WRITE | (data[i] >> 4);
}
buf[idx++] = REG_DRAM_BLOCK;
buf[idx++] = REG_DRAM_WAIT_ACK;
- for (i = 0; i < numchunks; ++i) {
+ for (i = 0; i < numchunks; i++) {
/* Alternate bit to copy from DRAM to cache. */
if (i != (numchunks - 1))
buf[idx++] = REG_DRAM_BLOCK | (((i + 1) % 2) << 4);
uint16_t bit;
/* Transpose the table and send to Sigma. */
- for (i = 0; i < 16; ++i) {
+ for (i = 0; i < 16; i++) {
bit = 1 << i;
tmp[0] = tmp[1] = 0;
return SR_ERR;
}
- ++trigger_set;
+ trigger_set++;
} else {
/* Simple trigger support (event). */
if (match->match == SR_TRIGGER_ONE) {
}
else if (match->match == SR_TRIGGER_FALLING) {
devc->trigger.fallingmask |= channelbit;
- ++trigger_set;
+ trigger_set++;
}
else if (match->match == SR_TRIGGER_RISING) {
devc->trigger.risingmask |= channelbit;
- ++trigger_set;
+ trigger_set++;
}
/*
int i;
uint16_t sample = 0;
- for (i = 0; i < 8; ++i) {
+ for (i = 0; i < 8; i++) {
if (i > 0)
last_sample = sample;
sample = samples[2 * i] | (samples[2 * i + 1] << 8);
int i, j, k, bit;
/* For each quad channel. */
- for (i = 0; i < 4; ++i) {
+ for (i = 0; i < 4; i++) {
entry[i] = 0xffff;
/* For each bit in LUT. */
- for (j = 0; j < 16; ++j)
+ for (j = 0; j < 16; j++)
/* For each channel in quad. */
- for (k = 0; k < 4; ++k) {
+ for (k = 0; k < 4; k++) {
bit = 1 << (i * 4 + k);
/* Set bit in entry */
- if ((mask & bit) &&
- ((!(value & bit)) !=
- (!(j & (1 << k)))))
+ if ((mask & bit) && ((!(value & bit)) !=
+ (!(j & (1 << k)))))
entry[i] &= ~(1 << j);
}
}
/* Transpose if neg is set. */
if (neg) {
- for (i = 0; i < 2; ++i) {
- for (j = 0; j < 2; ++j) {
+ for (i = 0; i < 2; i++) {
+ for (j = 0; j < 2; j++) {
tmp = x[i][j];
- x[i][j] = x[1-i][1-j];
- x[1-i][1-j] = tmp;
+ x[i][j] = x[1 - i][1 - j];
+ x[1 - i][1 - j] = tmp;
}
}
}
/* Update mask with function. */
- for (i = 0; i < 16; ++i) {
+ for (i = 0; i < 16; i++) {
a = (i >> (2 * index + 0)) & 1;
b = (i >> (2 * index + 1)) & 1;
lut->m2d);
/* Rise/fall trigger support. */
- for (i = 0, j = 0; i < 16; ++i) {
+ for (i = 0, j = 0; i < 16; i++) {
if (devc->trigger.risingmask & (1 << i) ||
devc->trigger.fallingmask & (1 << i))
masks[j++] = 1 << i;
devc = sdi->priv;
- for (i = 0; i < num_samples; i ++) {
+ for (i = 0; i < num_samples; i++) {
fbuf[i] = ((data[i * 2] & 0xf0) >> 4) * 100;
fbuf[i] += (data[i * 2] & 0x0f) * 10;
fbuf[i] += ((data[i * 2 + 1] & 0xf0) >> 4);
{
unsigned int i;
- for (i = 0; i < ARRAY_SIZE(manufacturers); ++i)
+ for (i = 0; i < ARRAY_SIZE(manufacturers); i++)
if (!strcmp(manufacturer, manufacturers[i]))
return SR_OK;
if (!cg)
return CG_NONE;
- for (i = 0; i < model->analog_channels; ++i)
+ for (i = 0; i < model->analog_channels; i++)
if (cg == devc->analog_groups[i])
return CG_ANALOG;
- for (i = 0; i < model->digital_pods; ++i)
+ for (i = 0; i < model->digital_pods; i++)
if (cg == devc->digital_groups[i])
return CG_DIGITAL;
sr_err("No channel group specified.");
return SR_ERR_CHANNEL_GROUP;
} else if (cg_type == CG_ANALOG) {
- for (i = 0; i < model->analog_channels; ++i) {
+ for (i = 0; i < model->analog_channels; i++) {
if (cg != devc->analog_groups[i])
continue;
*data = g_variant_new_int32(model->num_ydivs);
sr_err("No channel group specified.");
return SR_ERR_CHANNEL_GROUP;
} else if (cg_type == CG_ANALOG) {
- for (i = 0; i < model->analog_channels; ++i) {
+ for (i = 0; i < model->analog_channels; i++) {
if (cg != devc->analog_groups[i])
continue;
*data = g_variant_new("(tt)",
sr_err("No channel group specified.");
return SR_ERR_CHANNEL_GROUP;
} else if (cg_type == CG_ANALOG) {
- for (i = 0; i < model->analog_channels; ++i) {
+ for (i = 0; i < model->analog_channels; i++) {
if (cg != devc->analog_groups[i])
continue;
*data = g_variant_new_string((*model->coupling_options)[state->analog_channels[i].coupling]);
if (p != (*model->vdivs)[i][0] ||
q != (*model->vdivs)[i][1])
continue;
- for (j = 1; j <= model->analog_channels; ++j) {
+ for (j = 1; j <= model->analog_channels; j++) {
if (cg != devc->analog_groups[j - 1])
continue;
state->analog_channels[j - 1].vdiv = i;
for (i = 0; (*model->coupling_options)[i]; i++) {
if (strcmp(tmp, (*model->coupling_options)[i]) != 0)
continue;
- for (j = 1; j <= model->analog_channels; ++j) {
+ for (j = 1; j <= model->analog_channels; j++) {
if (cg != devc->analog_groups[j - 1])
continue;
state->analog_channels[j-1].coupling = i;
}
}
- for (i = 1; i <= model->digital_pods; ++i) {
+ for (i = 1; i <= model->digital_pods; i++) {
if (state->digital_pods[i - 1] == pod_enabled[i - 1])
continue;
g_snprintf(command, sizeof(command),
unsigned int i;
char *tmp;
- for (i = 0; i < config->analog_channels; ++i) {
+ for (i = 0; i < config->analog_channels; i++) {
tmp = sr_voltage_string((*config->vdivs)[state->analog_channels[i].vdiv][0],
(*config->vdivs)[state->analog_channels[i].vdiv][1]);
sr_info("State of analog channel %d -> %s : %s (coupling) %s (vdiv) %2.2e (offset)",
tmp, state->analog_channels[i].vertical_offset);
}
- for (i = 0; i < config->digital_channels; ++i) {
+ for (i = 0; i < config->digital_channels; i++) {
sr_info("State of digital channel %d -> %s", i,
state->digital_channels[i] ? "On" : "Off");
}
- for (i = 0; i < config->digital_pods; ++i) {
+ for (i = 0; i < config->digital_pods; i++) {
sr_info("State of digital POD %d -> %s", i,
state->digital_pods[i] ? "On" : "Off");
}
return SR_ERR;
}
- for (i = 0; (*array)[i]; ++i) {
+ for (i = 0; (*array)[i]; i++) {
if (!g_strcmp0(tmp, (*array)[i])) {
*result = i;
g_free(tmp);
float tmp_float;
char command[MAX_COMMAND_SIZE];
- for (i = 0; i < config->analog_channels; ++i) {
+ for (i = 0; i < config->analog_channels; i++) {
g_snprintf(command, sizeof(command),
(*config->scpi_dialect)[SCPI_CMD_GET_ANALOG_CHAN_STATE],
i + 1);
unsigned int i;
char command[MAX_COMMAND_SIZE];
- for (i = 0; i < config->digital_channels; ++i) {
+ for (i = 0; i < config->digital_channels; i++) {
g_snprintf(command, sizeof(command),
(*config->scpi_dialect)[SCPI_CMD_GET_DIG_CHAN_STATE],
i);
return SR_ERR;
}
- for (i = 0; i < config->digital_pods; ++i) {
+ for (i = 0; i < config->digital_pods; i++) {
g_snprintf(command, sizeof(command),
(*config->scpi_dialect)[SCPI_CMD_GET_DIG_POD_STATE],
i + 1);
state = devc->model_state;
channel_found = FALSE;
- for (i = 0; i < config->analog_channels; ++i) {
+ for (i = 0; i < config->analog_channels; i++) {
if (state->analog_channels[i].state) {
g_snprintf(chan_name, sizeof(chan_name), "CHAN%d", i + 1);
g_snprintf(tmp_str, sizeof(tmp_str),
}
/* Add digital channel groups. */
- for (i = 0; i < scope_models[model_index].digital_pods; ++i) {
+ for (i = 0; i < scope_models[model_index].digital_pods; i++) {
g_snprintf(tmp, 25, "POD%d", i);
devc->digital_groups[i] = g_malloc0(sizeof(struct sr_channel_group));
return -1;
/* Linear search is fine for very small tables. */
- for (i = 0; i < len; ++i) {
+ for (i = 0; i < len; i++) {
if (strcmp(entry, table[i]) == 0)
return i;
}
ret = SR_OK;
- for (i = 0; i < count; ++i) {
+ for (i = 0; i < count; i++) {
ret = lwla_write_reg(usb, regvals[i].reg, regvals[i].val);
if (ret != SR_OK)
unsigned int i;
gboolean opc;
- for (i = 0; i < SCPI_READ_RETRIES; ++i) {
+ for (i = 0; i < SCPI_READ_RETRIES; i++) {
sr_scpi_get_bool(scpi, SCPI_CMD_OPC, &opc);
if (opc)
return SR_OK;