ACMUX not declared in this scope

wondering if anyone can help. I have a homemade board with an Atmega16u2, been using it for months on two different projects with no problem.
the 16u2 has an arduino bootloader, that i installed with avrdude, called Hoodloader2 (bootloader code and board file by https://github.com/NicoHood/HoodLoader2).
i recently added some new statements in my code and i got compile errors:

#define capground A2
 error: 'A2' was not declared in this scope

ACMUX = 3
error: 'ACMUX' was not declared in this scope

i also have this statement ACSR |= (1<<7); which the compiler does recognize. The ACSR and ACMUX are registers for the analog comparator.
i'm guessing there's an error in the board file, but God knows where it is. Has anyone else ever used Hoodloader2?

is that code in the main .ino file or a separate .cpp file?

Maybe its

ADMUX?

I had the same experience in the past.
This is a mistake in the AVR toolchain. The maintainer of this is a Microchip...

Please add it yourself.

#define ACMUX _SFR_MEM8(0x7D)
#defnie CMUX0 0
#defnie CMUX1 1
#defnie CMUX2 2


1 Like

in the ino code, there aren't any included files.

"ADMUX?"
lol that's what i thought for a minute. But the chip doc says ACMUX in several places.

The ATmega16U2 doesn't have an ADC, only an analog comparator (AC).

"I had the same experience in the past. This is a mistake in the AVR toolchain"
wow. NO WAY i woulda ever figured that out. Thank God 4 ur experience :slight_smile:

"The ATmega16U2 doesn't have an ADC"
even if it did it would only have a resolution of 5mV so i would still need to use the comparator to get single mV measurements