From: Uwe Hermann Date: Wed, 23 Oct 2013 16:41:13 +0000 (+0200) Subject: metex14: Add support for pF (picofarad). X-Git-Tag: libsigrok-0.2.2~34 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=c02dc3e26141a13554828be9a4ffa2def857d2b3;p=libsigrok.git metex14: Add support for pF (picofarad). This is used on some Metex DMMs. --- diff --git a/hardware/common/dmm/metex14.c b/hardware/common/dmm/metex14.c index e529727b..7f4b8905 100644 --- a/hardware/common/dmm/metex14.c +++ b/hardware/common/dmm/metex14.c @@ -128,6 +128,8 @@ static void parse_flags(const char *buf, struct metex14_info *info) info->is_kilo = info->is_ohm = TRUE; else if (!strcasecmp(u, "MOhm")) info->is_mega = info->is_ohm = TRUE; + else if (!strcasecmp(u, "pF")) + info->is_pico = info->is_farad = TRUE; else if (!strcasecmp(u, "nF")) info->is_nano = info->is_farad = TRUE; else if (!strcasecmp(u, "uF")) @@ -148,6 +150,8 @@ static void handle_flags(struct sr_datafeed_analog *analog, float *floatval, const struct metex14_info *info) { /* Factors */ + if (info->is_pico) + *floatval /= 1000000000000ULL; if (info->is_nano) *floatval /= 1000000000; if (info->is_micro) @@ -212,6 +216,7 @@ static gboolean flags_valid(const struct metex14_info *info) /* Does the packet have more than one multiplier? */ count = 0; + count += (info->is_pico) ? 1 : 0; count += (info->is_nano) ? 1 : 0; count += (info->is_micro) ? 1 : 0; count += (info->is_milli) ? 1 : 0; diff --git a/libsigrok-internal.h b/libsigrok-internal.h index 4b557bbc..a2d9a5a1 100644 --- a/libsigrok-internal.h +++ b/libsigrok-internal.h @@ -284,8 +284,9 @@ SR_PRIV void sr_fs9721_01_10_temp_f_c(struct sr_datafeed_analog *analog, void *i struct metex14_info { gboolean is_ac, is_dc, is_resistance, is_capacity, is_temperature; gboolean is_diode, is_frequency, is_ampere, is_volt, is_farad; - gboolean is_hertz, is_ohm, is_celsius, is_nano, is_micro, is_milli; - gboolean is_kilo, is_mega, is_gain, is_decibel, is_hfe, is_unitless; + gboolean is_hertz, is_ohm, is_celsius, is_pico, is_nano, is_micro; + gboolean is_milli, is_kilo, is_mega, is_gain, is_decibel, is_hfe; + gboolean is_unitless; }; SR_PRIV int sr_metex14_packet_request(struct sr_serial_dev_inst *serial);