I/O pin header file and documentation

I’m an experienced embedded micro-controller engineer but new to the Photon Particle. In fact, my first board is currently in shipping and I’m poking around in anticipation of its arrival.

In the examples I see constructs such as:

led1 = D0;

but no header file is included that might define D0. I suppose that D0 and its companions might be predefined by the compiler but I can find no documentation to support this. It could be that a header file might be included “automatically” but, again, I find nothing to support this. In fact, I can find no “system” header files to open and inspect.

So, my questions are:

How does the compiler know the meaning of D0 and other I/O pins?
Where is the compiler documentation?
Where are “system” headers stored?

I imagine that the answers to these will not only satisfy my immediate need but will also go a long way toward my understanding of the Particle ecosystem.


When you create a source file with a .ino file extension, it invokes a Arduino-like compatibility mode. Among other things, it implicitly includes application.h which brings in the header definitions, and also relaxes some C++ rules, by automatically creating forward declarations for functions used later in the source file.

This is all optional, and if you create a .cpp file you get a regular C++ experience. The best practice currently is to

#include "Particle.h"

which will bring in most of the header files that you will need.

The source to most of the header files are in this directory, if you’re curious. All of the files are in the Github repository, but might be in other directories.

The compiler is a standard gcc C++ compiler, building for the ARM Cortex processor, gcc-arm.

1 Like

Thanks very much, Rick. That’s very helpful.

Can you point me to where the “Arduino-like compatibility mode”, that GitHub is the headers repository, and that the compiler is gcc-arm are documented?