Closed andrewwatkin closed 6 months ago
I don't know the correct github was to reopen this issue. See #1082
I don't think 2dad406f43 has fixed the problem which is that ADC_ENABLE disables the ADC and ADC_DISABLE enables it.
To make sense the code in wiring_analog.c around line 419 requires that
ADC_ENABLE == _ADC_ENABLE_CTRL | _ADC_ENABLE_VAL
.
But this is not the case in Arduino.h around line 224.
There is the same problem for the series-0 / series-1 code.
Firstly, thank you for the monumental effort of providing megaTinyCore.
My tests on megaTinyCore ef7b7870ee695b show that ADCPowerOptions(ADC_DISABLE) enabled the ADC and ADCPowerOptions(ADC_ENABLE) disables it. This is the opposite of what I expected.
I am using an ATtiny826. So, for a series-2 device:
contains
from Arduino.h for series-2, the relevant options can be
temp.bit0 needs to be 1 to run the ADC according to spec 30.5.1 for ADC.CTRLA Following the code,
Tested with a 10R resistor in the ATtiny826 VDD line:
Code is