From fadb19ac9631b61c97b7ca6375a3afe134bbc695 Mon Sep 17 00:00:00 2001 From: Alexandru Gagniuc Date: Fri, 4 Mar 2016 23:25:15 -0800 Subject: [PATCH] hwdriver: Add configuration key for number of powerline cycles High precision multimeters have a special setting, called "number of powerline cycles" (NPLC) which determines the integration time of the ADC in terms of the power line period. Some devices need their NPLC adjusted from the default value before they can measure at their full rated precision. --- include/libsigrok/libsigrok.h | 3 +++ src/hwdriver.c | 2 ++ 2 files changed, 5 insertions(+) diff --git a/include/libsigrok/libsigrok.h b/include/libsigrok/libsigrok.h index 3daf616d..31ee5dce 100644 --- a/include/libsigrok/libsigrok.h +++ b/include/libsigrok/libsigrok.h @@ -1015,6 +1015,9 @@ enum sr_configkey { /** The device supports setting a probe factor. */ SR_CONF_PROBE_FACTOR, + /** Number of powerline cycles for ADC integration time. */ + SR_CONF_ADC_POWERLINE_CYCLES, + /* Update sr_key_info_config[] (hwdriver.c) upon changes! */ /*--- Acquisition modes, sample limiting ----------------------------*/ diff --git a/src/hwdriver.c b/src/hwdriver.c index 81a86a79..b31242ad 100644 --- a/src/hwdriver.c +++ b/src/hwdriver.c @@ -189,6 +189,8 @@ static struct sr_key_info sr_key_info_config[] = { "Data source", NULL}, {SR_CONF_PROBE_FACTOR, SR_T_UINT64, "probe_factor", "Probe factor", NULL}, + {SR_CONF_ADC_POWERLINE_CYCLES, SR_T_FLOAT, "nplc", + "Number of ADC powerline cycles", NULL}, /* Acquisition modes, sample limiting */ {SR_CONF_LIMIT_MSEC, SR_T_UINT64, "limit_time",