Commit 9030b06e authored by Federico Vaga's avatar Federico Vaga

tool: move voltage range unit to microvolts

Signed-off-by: Federico Vaga's avatarFederico Vaga <federico.vaga@cern.ch>
parent 8267c532
......@@ -82,7 +82,7 @@ static const char *help_msg_opt_desc =
" <n-shots>\n"
" number of consecutive acquisitions\n"
" <offset>*\n"
" offset to apply on input channel\n"
" offset to apply on input channel in micro Volts (the offset range depends on the target board)\n"
" <polarity>\n"
" positive edge/slope: 0, negative edge/slope: 1\n"
" <post-sample>\n"
......@@ -90,7 +90,7 @@ static const char *help_msg_opt_desc =
" <pre-sample>\n"
" number of samples to be acquired before trigger\n"
" <range>*\n"
" voltage range to use\n"
" voltage range to use in micro Volts (the value depends on the target board)\n"
" <saturation>*\n"
" saturation value for an input channel\n"
" <seconds>\n"
......@@ -515,18 +515,22 @@ static int fald_acq_channel_configuration(struct adc_dev *adc, char *param)
* 0x00 (0): Open input
*/
switch (range) {
case 100:
case 100000:
range = ADC_CONF_100M14B4CHA_CHN_RANGE_100mV;
bit_scale = 0.05/(1<<15);
break;
case 1:
case 1000000:
range = ADC_CONF_100M14B4CHA_CHN_RANGE_1V;
bit_scale = 0.5/(1<<15);
break;
case 10:
case 10000000:
range = ADC_CONF_100M14B4CHA_CHN_RANGE_10V;
bit_scale = 5.0/(1<<15);
break;
default:
fprintf(stderr, "Invalid range value %d\n", range);
errno = EINVAL;
return -1;
}
adc_set_conf(&cfg, ADC_CONF_CHN_RANGE, range);
case 2:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment