metex14: Add support for pF (picofarad).

This is used on some Metex DMMs.
This commit is contained in:
Uwe Hermann 2013-10-23 18:41:13 +02:00
parent ee6cb5a417
commit c02dc3e261
2 changed files with 8 additions and 2 deletions

View File

@ -128,6 +128,8 @@ static void parse_flags(const char *buf, struct metex14_info *info)
info->is_kilo = info->is_ohm = TRUE; info->is_kilo = info->is_ohm = TRUE;
else if (!strcasecmp(u, "MOhm")) else if (!strcasecmp(u, "MOhm"))
info->is_mega = info->is_ohm = TRUE; info->is_mega = info->is_ohm = TRUE;
else if (!strcasecmp(u, "pF"))
info->is_pico = info->is_farad = TRUE;
else if (!strcasecmp(u, "nF")) else if (!strcasecmp(u, "nF"))
info->is_nano = info->is_farad = TRUE; info->is_nano = info->is_farad = TRUE;
else if (!strcasecmp(u, "uF")) 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) const struct metex14_info *info)
{ {
/* Factors */ /* Factors */
if (info->is_pico)
*floatval /= 1000000000000ULL;
if (info->is_nano) if (info->is_nano)
*floatval /= 1000000000; *floatval /= 1000000000;
if (info->is_micro) 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? */ /* Does the packet have more than one multiplier? */
count = 0; count = 0;
count += (info->is_pico) ? 1 : 0;
count += (info->is_nano) ? 1 : 0; count += (info->is_nano) ? 1 : 0;
count += (info->is_micro) ? 1 : 0; count += (info->is_micro) ? 1 : 0;
count += (info->is_milli) ? 1 : 0; count += (info->is_milli) ? 1 : 0;

View File

@ -284,8 +284,9 @@ SR_PRIV void sr_fs9721_01_10_temp_f_c(struct sr_datafeed_analog *analog, void *i
struct metex14_info { struct metex14_info {
gboolean is_ac, is_dc, is_resistance, is_capacity, is_temperature; gboolean is_ac, is_dc, is_resistance, is_capacity, is_temperature;
gboolean is_diode, is_frequency, is_ampere, is_volt, is_farad; 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_hertz, is_ohm, is_celsius, is_pico, is_nano, is_micro;
gboolean is_kilo, is_mega, is_gain, is_decibel, is_hfe, is_unitless; 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); SR_PRIV int sr_metex14_packet_request(struct sr_serial_dev_inst *serial);