I’m trying to use STM32F103C8 with EmonLib. STM32 has 12bits ADC. It would be good to use it.
I tried to enable it by using setup parameter
analogReadResolution(12);
However, it does not fly. I got an error
'analogReadResolution' was not declared in this scope
Seems that this command works only for Arduino Due.
I tried to change default resolution in the library Emonlib.h.
// to enable 12-bit ADC resolution on Arduino Due,
// include the following line in main sketch inside setup() function:
// analogReadResolution(ADC_BITS);
// otherwise will default to 10 bits, as in regular Arduino-based boards.
#if defined(__arm__)
#define ADC_BITS 1̶2̶ 10
#else
#define ADC_BITS 1̶0̶ 12
#endif
Is it enough?
Thanks