For some applications I need access to the registers that control the output/input and high/low state of pins. For example pin 10 on a adalogger is PORTB
with a mask of _BV(6)
. This information can be found in pins_arduino.h
. For some boards many variants get installed. I turned on verbose compiling and looked through the output there as well as looking through boards.txt
and platform.txt
. In that output I see an include to a directory with a pins_arduino.h
file but there is nothing in that file but a definition for BUILTIN_LED
.
When I run a function like digitalWrite(13,HIGH);
how does it know which registers to use for pin 13? Since my board has this pin, and digitalWrite(13, HIGH);
makes an LED light up ... it's working.
1 Answer 1
In the boards.txt file for the core in question you have a line for each board:
xxxx.build.variant=yyyy
where yyyy is the name of the folder in variants for the board.
For instance, the Uno, has:
uno.build.variant=standard
which relates to:
variants/standard
with the pins_arduino.h
file in it for that board.
-
Thanks, I found that line and it agrees with the output from the compiler. The problem is that particular file is basically empty. Does that mean there is a default somewhere that it's using as well?Matt– Matt2017年10月30日 19:53:59 +00:00Commented Oct 30, 2017 at 19:53
-
It's far from empty on my installation. What version are you running? And what board / core is it?Majenko– Majenko2017年10月30日 19:54:23 +00:00Commented Oct 30, 2017 at 19:54
-
I have hundreds of pins_arduino.h files throughout the system. My problem is with the adafruit huzzah ESP8266. The pins_arduino.h file is basically empty.Matt– Matt2017年10月30日 19:55:50 +00:00Commented Oct 30, 2017 at 19:55
-
Well, that is down to the core. The core most likely has defaults that don't need overriding. Most ESP8266 boards just map the GPIOs 1:1 and don't need anything else. Remember: an ESP8266 is not an AVR Arduino and does not follow the same rules.Majenko– Majenko2017年10月30日 19:57:14 +00:00Commented Oct 30, 2017 at 19:57