Introducing bilekj: INPUT_ANALOG question

Post Reply
User avatar
bilekj
Posts: 2
Joined: Mon Feb 12, 2018 6:26 pm
Location: Prague, Czech Republic

Introducing bilekj: INPUT_ANALOG question

Post by bilekj » Mon Feb 12, 2018 7:18 pm

Hi,
thanks for all the amazing work with adapting Arduino IDE to STM32 MCU's. Although several features of the Arduino IDE are driving me mad (e.g. not being able to have folders in my sketch library, not being able to choose which libraries to include to my project), it is still the fastest and easiest way to begin with the STM32's and write a small application.

I spent some time in AVR world I found STM32 much more exciting and sometimes challenging, too.

Recently, I decided to build a oscilloscope with STM32F103 Blue Pill board. I built the one called Pig-O-Scope and now I am trying to bring to life the clone named multiScope (https://hackaday.io/project/20821-multiscope) that promises to be a bit more useful.

My question:
Could anybody explain to me what is the difference between the two pieces of code?

Code: Select all

pinMode(pin, INPUT);
analogRead(pin);

Code: Select all

pinMode(pin, INPUT_ANALOG);
analogRead(pin);

The difference is in setting CRL/CRH registers CNF value (00=analog, 0110=input) but it seems to me both code fragments work fine. I tested it on library TouchScreen_STM.

Thanks,
Jiri

Edit: corrected the value in the last paragraph.

User avatar
mrburnette
Posts: 2200
Joined: Mon Apr 27, 2015 12:50 pm
Location: Greater Atlanta
Contact:

Re: Introducing bilekj: INPUT_ANALOG question

Post by mrburnette » Tue Feb 13, 2018 7:38 pm

bilekj: Welcome.

Ray

Post Reply