Skip to content

Deprecated APIs in ADC class #27

@josiahdelange

Description

@josiahdelange

Hi,

I noticed some errors in power.cpp (in PowerMonitor::PowerMonitor(...)) that seem to be due to some recent commits to the ADC class (see: here and here).

My workaround is using the "set" methods of each ADC module (adc.adc0 or adc.adc1), i.e., changing

adc.setReference(ADC_REFERENCE::REF_1V2, ADC_0);
adc.setAveraging(1, ADC_0);                                       // set number of averages
adc.setResolution(16, ADC_0);                                     // set bits of resolution
adc.setConversionSpeed(ADC_CONVERSION_SPEED::HIGH_SPEED, ADC_0);  // change the conversion speed
adc.setSamplingSpeed(ADC_SAMPLING_SPEED::HIGH_SPEED, ADC_0);      // change the sampling speed

adc.setReference(BOARD_ADC_REF, ADC_1);
adc.setAveraging(1, ADC_1);                                       // set number of averages
adc.setResolution(16, ADC_1);                                     // set bits of resolution
adc.setConversionSpeed(ADC_CONVERSION_SPEED::HIGH_SPEED, ADC_1);  // change the conversion speed
adc.setSamplingSpeed(ADC_SAMPLING_SPEED::HIGH_SPEED, ADC_1);      // change the sampling speed

to

adc.adc0->setReference(ADC_REFERENCE::REF_1V2);
adc.adc0->setAveraging(1);                                       // set number of averages
adc.adc0->setResolution(16);                                     // set bits of resolution
adc.adc0->setConversionSpeed(ADC_CONVERSION_SPEED::HIGH_SPEED);  // change the conversion speed
adc.adc0->setSamplingSpeed(ADC_SAMPLING_SPEED::HIGH_SPEED);      // change the sampling speed

adc.adc1->setReference(BOARD_ADC_REF);
adc.adc1->setAveraging(1);                                       // set number of averages
adc.adc1->setResolution(16);                                     // set bits of resolution
adc.adc1->setConversionSpeed(ADC_CONVERSION_SPEED::HIGH_SPEED);  // change the conversion speed
adc.adc1->setSamplingSpeed(ADC_SAMPLING_SPEED::HIGH_SPEED);      // change the sampling speed

Curious if anyone else has seen this yet - may be something to roll into the development branch, if possible.

Thanks!
-Josiah

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions