Something is not working in my installation of the ADC library

Status
Not open for further replies.

tarnerich

Member
This issue was encountered in Teensyduino 1.41 in combination with Arduino 1.8.5, both freshly installed yesterday. The chip is a Teensy 3.5.

The example code I'm trying to compile are the provided examples adc_pdb (which fails), and analogRead (which works).

adc_pdb:45: error: 'ADC_VERY_LOW_SPEED' was not declared in this scope
adc->setConversionSpeed(ADC_VERY_LOW_SPEED, ADC_1); // change the conversion speed

analogRead's version of that line compiles and functions quite well:
adc->setConversionSpeed(ADC_CONVERSION_SPEED::VERY_LOW_SPEED); // change the conversion speed

Is something missing from my development environment? I searched through the .cpp's and .h's but I found no definitions of "ADC_VERY_LOW_SPEED"
 
OS version

This issue was encountered in Teensyduino 1.41 in combination with Arduino 1.8.5, both freshly installed yesterday. The chip is a Teensy 3.5.

The example code I'm trying to compile are the provided examples adc_pdb (which fails), and analogRead (which works).

adc_pdb:45: error: 'ADC_VERY_LOW_SPEED' was not declared in this scope
adc->setConversionSpeed(ADC_VERY_LOW_SPEED, ADC_1); // change the conversion speed

analogRead's version of that line compiles and functions quite well:
adc->setConversionSpeed(ADC_CONVERSION_SPEED::VERY_LOW_SPEED); // change the conversion speed

Is something missing from my development environment? I searched through the .cpp's and .h's but I found no definitions of "ADC_VERY_LOW_SPEED"

Forgot to mention: Windows 7 64-bit on my PC.
 
remove simply the leading ADC_
according to ADC_Module.h
Code:
// Settings for the power/speed of conversions/sampling

/*! ADC conversion speed.
*   Common set of options to select the ADC clock speed F_ADCK, which depends on F_BUS, except for the ADACK_X_Y options that are independent.
*   This selection affects the sampling speed too.
*   Note: the F_ADCK speed is not equal to the conversion speed; any measurement takes several F_ADCK cycles to complete including the sampling and conversion steps.
*/

enum class ADC_CONVERSION_SPEED : uint8_t {
    VERY_LOW_SPEED, /*!< is guaranteed to be the lowest possible speed within specs for resolutions less than 16 bits (higher than 1 MHz). */
    LOW_SPEED, /*!< is guaranteed to be the lowest possible speed within specs for all resolutions (higher than 2 MHz). */
    MED_SPEED, /*!< is always >= LOW_SPEED and <= HIGH_SPEED. */
    HIGH_SPEED_16BITS, /*!< is guaranteed to be the highest possible speed within specs for all resolutions (lower than or equal to 12 MHz). */
    HIGH_SPEED, /*!< is guaranteed to be the highest possible speed within specs for resolutions less than 16 bits (lower than or equal to 18 MHz),
                            except for Teensy 3.6 (NOT 3.5), for which the maximum is 24 MHz. */
    VERY_HIGH_SPEED, /*!< may be out of specs */

    ADACK_2_4, /*!< 2.4 MHz asynchronous ADC clock (independent of the global clocks F_CPU or F_BUS) */
    ADACK_4_0, /*!< 4.0 MHz asynchronous ADC clock (independent of the global clocks F_CPU or F_BUS) */
    ADACK_5_2, /*!< 5.2 MHz asynchronous ADC clock (independent of the global clocks F_CPU or F_BUS) */
    ADACK_6_2 /*!< 6.2 MHz asynchronous ADC clock (independent of the global clocks F_CPU or F_BUS) */
};

/*! ADC sampling speed.
*   It selects how many ADCK clock cycles to add.
*/
enum class ADC_SAMPLING_SPEED : uint8_t {
    VERY_LOW_SPEED, /*!< is the lowest possible sampling speed (+24 ADCK). */
    LOW_SPEED, /*!< adds +16 ADCK. */
    MED_SPEED, /*!< adds +10 ADCK. */
    HIGH_SPEED, /*!< adds +6 ADCK. */
    VERY_HIGH_SPEED, /*!< is the highest possible sampling speed (0 ADCK added). */
};
 
remove simply the leading ADC_
according to ADC_Module.h
Code:
// Settings for the power/speed of conversions/sampling


adc_pdb:45: error: 'VERY_LOW_SPEED' was not declared in this scope
     adc->setConversionSpeed(VERY_LOW_SPEED, ADC_1); // change the conversion speed

It would be interesting to know if it works for you when you make that simple change. Then we'll get an idea if it's an issue with my installation specifically, or if the older construct became obsolete for everyone.

The compiler here doesn't appear to be having any trouble finding ADC_Module.h. The analogRead example compiles and loads without error.
 
Last edited:
remove simply the leading ADC_
according to ADC_Module.h
Code:
// Settings for the power/speed of conversions/sampling


adc_pdb:45: error: 'VERY_LOW_SPEED' was not declared in this scope
     adc->setConversionSpeed(VERY_LOW_SPEED, ADC_1); // change the conversion speed

It would be interesting to know if it works for you when you make that simple change. Then we'll get an idea if it's an issue with my installation specifically, or if the older construct became obsolete for everyone.

The compiler here doesn't appear to be having any trouble finding ADC_Module.h. The analogRead example compiles and loads without error.[/QUOTE]

I'm not using the ADC library,
but maybe ADC_CONVERSION_SPEED::VERY_LOW _SPEED would work as done in analogRead could work.

Don't ask me why there are examples in the distribution that do not compile. 
maybe you complain at the GitHub page of the originator   https://github.com/pedvide/ADC
 
ADC library contents

This is what is in place here for ADC after installing Teensyduino 1.41:

ADC library.jpg
 
This is what is in place here for ADC after installing Teensyduino 1.41:

I know
but I was referring to

Code:
adc_pdb:45: error: 'ADC_VERY_LOW_SPEED' was not declared in this scope
adc->setConversionSpeed(ADC_VERY_LOW_SPEED, ADC_1); // change the conversion speed

analogRead's version of that line compiles and functions quite well:
adc->setConversionSpeed(ADC_CONVERSION_SPEED::VERY_LOW _SPEED); // change the conversion speed

You see the version with
Code:
ADC_CONVERSION_SPEED::VERY_LOW _SPEED
works according to your own words

so, replace in adc_pdb
Code:
adc->setConversionSpeed(ADC_VERY_LOW_SPEED, ADC_1); // change the conversion speed
by
Code:
adc->setConversionSpeed(ADC_CONVERSION_SPEED::VERY_LOW _SPEED, ADC_1); // change the conversion speed

would you agree?
 
so, replace in adc_pdb
Code:
adc->setConversionSpeed(ADC_VERY_LOW_SPEED, ADC_1); // change the conversion speed
by
Code:
adc->setConversionSpeed(ADC_CONVERSION_SPEED::VERY_LOW _SPEED, ADC_1); // change the conversion speed

would you agree?

Well, yes, and indeed I have already applied that exact change to my own code, which had been perfectly able to be compiled several dozens of times... that is, until I updated Teensyduino a few days ago. So this thread is not a request for help with just my project.

The very much larger question is, have the projects of many other people also been recently broken because of a "fix" to the ADC library?

I'm headed over to the bug report forum now.
 
Status
Not open for further replies.
Back
Top