mirror of
https://github.com/oliverschmidt/contiki.git
synced 2024-11-18 12:05:11 +00:00
Merge pull request #2131 from t-than/master
Adjust CC26xx/CC13xx ADC reading for gain and offset
This commit is contained in:
commit
b70677cce6
@ -107,7 +107,7 @@ static int
|
||||
value(int type)
|
||||
{
|
||||
if(type == ADC_SENSOR_VALUE) {
|
||||
int val;
|
||||
int val, adj_val, adj_mv;
|
||||
|
||||
if(!is_active) {
|
||||
puts("ADC not active");
|
||||
@ -119,10 +119,14 @@ value(int type)
|
||||
|
||||
ti_lib_aux_adc_gen_manual_trigger();
|
||||
val = ti_lib_aux_adc_read_fifo();
|
||||
|
||||
adj_val = ti_lib_aux_adc_adjust_value_for_gain_and_offset(
|
||||
val,
|
||||
ti_lib_aux_adc_get_adjustment_gain(AUXADC_REF_FIXED),
|
||||
ti_lib_aux_adc_get_adjustment_offset(AUXADC_REF_FIXED));
|
||||
adj_mv = ti_lib_aux_adc_value_to_microvolts(AUXADC_FIXED_REF_VOLTAGE_NORMAL, adj_val);
|
||||
ti_lib_aux_adc_disable();
|
||||
|
||||
return val;
|
||||
return adj_mv;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
Loading…
Reference in New Issue
Block a user