Consistency and whitespace fixes for switch statements.

This commit is contained in:
Uwe Hermann 2015-03-20 20:14:39 +01:00
parent d0148a506e
commit 93b118da4f
7 changed files with 118 additions and 110 deletions

View File

@ -165,7 +165,6 @@ static void process_packet(const struct sr_dev_inst *sdi)
default: default:
sr_dbg("unknown configuration 0x%.2x", mode); sr_dbg("unknown configuration 0x%.2x", mode);
return; return;
break;
} }
packet.type = SR_DF_ANALOG; packet.type = SR_DF_ANALOG;

View File

@ -212,7 +212,6 @@ static void generate_analog_pattern(struct analog_gen *ag, uint64_t sample_rate)
} }
ag->num_samples = last_end; ag->num_samples = last_end;
break; break;
case PATTERN_SINE: case PATTERN_SINE:
frequency = (double) sample_rate / ANALOG_SAMPLES_PER_PERIOD; frequency = (double) sample_rate / ANALOG_SAMPLES_PER_PERIOD;
@ -231,7 +230,6 @@ static void generate_analog_pattern(struct analog_gen *ag, uint64_t sample_rate)
ag->num_samples = num_samples; ag->num_samples = num_samples;
break; break;
case PATTERN_TRIANGLE: case PATTERN_TRIANGLE:
frequency = (double) sample_rate / ANALOG_SAMPLES_PER_PERIOD; frequency = (double) sample_rate / ANALOG_SAMPLES_PER_PERIOD;
@ -246,7 +244,6 @@ static void generate_analog_pattern(struct analog_gen *ag, uint64_t sample_rate)
ag->num_samples = num_samples; ag->num_samples = num_samples;
break; break;
case PATTERN_SAWTOOTH: case PATTERN_SAWTOOTH:
frequency = (double) sample_rate / ANALOG_SAMPLES_PER_PERIOD; frequency = (double) sample_rate / ANALOG_SAMPLES_PER_PERIOD;

View File

@ -568,22 +568,27 @@ static void decode_rs_2x_TR2(uint8_t rs, struct dev_context *devc)
case SR_MQ_CURRENT: case SR_MQ_CURRENT:
if (devc->scale1000 == -1) /* mA */ if (devc->scale1000 == -1) /* mA */
switch (range) { switch (range) {
case 0: case 1: /* 100, 300 µA */ case 0:
case 1: /* 100, 300 µA */
devc->scale *= pow(10.0, -6); devc->scale *= pow(10.0, -6);
break; break;
case 2: case 3: /* 1, 3 mA */ case 2:
case 3: /* 1, 3 mA */
devc->scale *= pow(10.0, -5); devc->scale *= pow(10.0, -5);
break; break;
case 4: case 5: /* 10, 30 mA */ case 4:
case 5: /* 10, 30 mA */
devc->scale *= pow(10.0, -4); devc->scale *= pow(10.0, -4);
break; break;
case 6: case 7: /* 100, 300 mA */ case 6:
case 7: /* 100, 300 mA */
devc->scale *= pow(10.0, -3); devc->scale *= pow(10.0, -3);
break; break;
} }
else /* A */ else /* A */
switch (range) { switch (range) {
case 0: case 1: /* 1, 3 A */ case 0:
case 1: /* 1, 3 A */
devc->scale *= pow(10.0, -5); devc->scale *= pow(10.0, -5);
break; break;
case 2: /* 10 A */ case 2: /* 10 A */

View File

@ -77,7 +77,10 @@ static void process_line(struct sr_dev_inst *sdi)
case 1: /* Waiting for data reply to request */ case 1: /* Waiting for data reply to request */
/* Convert numbers */ /* Convert numbers */
switch (devc->acq_req) { switch (devc->acq_req) {
case AQ_U1: case AQ_U2: case AQ_I1: case AQ_I2: case AQ_U1:
case AQ_U2:
case AQ_I1:
case AQ_I2:
if (sr_atod(devc->buf, &dbl) != SR_OK) { if (sr_atod(devc->buf, &dbl) != SR_OK) {
sr_err("Failed to convert '%s' to double, errno=%d %s", sr_err("Failed to convert '%s' to double, errno=%d %s",
devc->buf, errno, strerror(errno)); devc->buf, errno, strerror(errno));

View File

@ -107,8 +107,12 @@ static int capture_setup(const struct sr_dev_inst *sdi)
/* Set bits to select external TRG input edge. */ /* Set bits to select external TRG input edge. */
if (devc->cfg_trigger_source == TRIGGER_EXT_TRG) if (devc->cfg_trigger_source == TRIGGER_EXT_TRG)
switch (devc->cfg_trigger_slope) { switch (devc->cfg_trigger_slope) {
case EDGE_POSITIVE: trigger_mask |= (uint64_t)1 << 35; break; case EDGE_POSITIVE:
case EDGE_NEGATIVE: trigger_mask |= (uint64_t)1 << 34; break; trigger_mask |= (uint64_t)1 << 35;
break;
case EDGE_NEGATIVE:
trigger_mask |= (uint64_t)1 << 34;
break;
} }
command[19] = LWLA_WORD_0(trigger_mask); command[19] = LWLA_WORD_0(trigger_mask);