From: Uwe Hermann Date: Mon, 31 Jul 2017 06:30:19 +0000 (+0200) Subject: drivers: Drop some unneeded voltage_/volt_ prefixes. X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=21fe5dba36bd388ed271b78b80df980ab13a63fd;p=libsigrok.git drivers: Drop some unneeded voltage_/volt_ prefixes. --- diff --git a/src/hardware/dreamsourcelab-dslogic/api.c b/src/hardware/dreamsourcelab-dslogic/api.c index 294e5d16..25fa6fe4 100644 --- a/src/hardware/dreamsourcelab-dslogic/api.c +++ b/src/hardware/dreamsourcelab-dslogic/api.c @@ -72,7 +72,7 @@ static const char *signal_edges[] = { [DS_EDGE_FALLING] = "falling", }; -static const double voltage_thresholds[][2] = { +static const double thresholds[][2] = { { 0.7, 1.4 }, { 1.4, 3.6 }, }; @@ -403,10 +403,10 @@ static int config_get(uint32_t key, GVariant **data, case SR_CONF_VOLTAGE_THRESHOLD: if (!strcmp(devc->profile->model, "DSLogic")) { if ((idx = std_double_tuple_idx_d0(devc->cur_threshold, - ARRAY_AND_SIZE(voltage_thresholds))) < 0) + ARRAY_AND_SIZE(thresholds))) < 0) return SR_ERR_BUG; - *data = std_gvar_tuple_double(voltage_thresholds[idx][0], - voltage_thresholds[idx][1]); + *data = std_gvar_tuple_double(thresholds[idx][0], + thresholds[idx][1]); } else { *data = std_gvar_tuple_double(devc->cur_threshold, devc->cur_threshold); } @@ -467,9 +467,9 @@ static int config_set(uint32_t key, GVariant *data, break; case SR_CONF_VOLTAGE_THRESHOLD: if (!strcmp(devc->profile->model, "DSLogic")) { - if ((idx = std_double_tuple_idx(data, ARRAY_AND_SIZE(voltage_thresholds))) < 0) + if ((idx = std_double_tuple_idx(data, ARRAY_AND_SIZE(thresholds))) < 0) return SR_ERR_ARG; - devc->cur_threshold = voltage_thresholds[idx][0]; + devc->cur_threshold = thresholds[idx][0]; return dslogic_fpga_firmware_upload(sdi); } else { g_variant_get(data, "(dd)", &low, &high); @@ -507,7 +507,7 @@ static int config_list(uint32_t key, GVariant **data, return STD_CONFIG_LIST(key, data, sdi, cg, scanopts, drvopts, devopts); case SR_CONF_VOLTAGE_THRESHOLD: if (!strcmp(devc->profile->model, "DSLogic")) - *data = std_gvar_thresholds(ARRAY_AND_SIZE(voltage_thresholds)); + *data = std_gvar_thresholds(ARRAY_AND_SIZE(thresholds)); else *data = std_gvar_min_max_step_thresholds(0.0, 5.0, 0.1); break; diff --git a/src/hardware/saleae-logic16/api.c b/src/hardware/saleae-logic16/api.c index 02fab9ba..dedb9a24 100644 --- a/src/hardware/saleae-logic16/api.c +++ b/src/hardware/saleae-logic16/api.c @@ -72,12 +72,12 @@ static const char *channel_names[] = { static const struct { enum voltage_range range; -} volt_thresholds_ranges[] = { +} thresholds_ranges[] = { { VOLTAGE_RANGE_18_33_V, }, { VOLTAGE_RANGE_5_V, }, }; -static const double volt_thresholds[][2] = { +static const double thresholds[][2] = { { 0.7, 1.4 }, { 1.4, 3.6 }, }; @@ -434,11 +434,10 @@ static int config_get(uint32_t key, GVariant **data, if (!sdi) return SR_ERR; devc = sdi->priv; - for (i = 0; i < ARRAY_SIZE(volt_thresholds); i++) { - if (devc->selected_voltage_range != - volt_thresholds_ranges[i].range) + for (i = 0; i < ARRAY_SIZE(thresholds); i++) { + if (devc->selected_voltage_range != thresholds_ranges[i].range) continue; - *data = std_gvar_tuple_double(volt_thresholds[i][0], volt_thresholds[i][1]); + *data = std_gvar_tuple_double(thresholds[i][0], thresholds[i][1]); return SR_OK; } return SR_ERR; @@ -470,9 +469,9 @@ static int config_set(uint32_t key, GVariant *data, devc->capture_ratio = g_variant_get_uint64(data); break; case SR_CONF_VOLTAGE_THRESHOLD: - if ((idx = std_double_tuple_idx(data, ARRAY_AND_SIZE(volt_thresholds))) < 0) + if ((idx = std_double_tuple_idx(data, ARRAY_AND_SIZE(thresholds))) < 0) return SR_ERR_ARG; - devc->selected_voltage_range = volt_thresholds_ranges[idx].range; + devc->selected_voltage_range = thresholds_ranges[idx].range; break; default: return SR_ERR_NA; @@ -492,7 +491,7 @@ static int config_list(uint32_t key, GVariant **data, *data = std_gvar_samplerates(ARRAY_AND_SIZE(samplerates)); break; case SR_CONF_VOLTAGE_THRESHOLD: - *data = std_gvar_thresholds(ARRAY_AND_SIZE(volt_thresholds)); + *data = std_gvar_thresholds(ARRAY_AND_SIZE(thresholds)); break; case SR_CONF_TRIGGER_MATCH: *data = std_gvar_array_i32(ARRAY_AND_SIZE(trigger_matches));