user18460: Is it possible to query the pin-out and each pin's attributes at run-time with Arduino?
If not, can it be done at compile-time?
Finally, if not, how can I incorporate this kind of information into my project to avoid completely rewriting my program for each possible Arduino model?
I am looking for something like this:
PinProperties props= getPinProperties(pinNumber);

props.supportsDigitalInput();
props.supportsDigitalOutput();
props.supportsAnalogInput();
props.supportsAnalogOutput();
props.supportsPWM();
props.analogInputBits();
props.analogOutputBits();
props.pullupResistance();
props.pulldownResistance();

etc.
NOTE: This question is similar and I might use the board model to look up a pre-stored pin-out.

user26916: pins_arduino.h has some standard macros that can be used for some of what you're looking to do. Using the arduino:standard variant used by Uno for example:
https://github.com/arduino/Arduino/blob/1.8.1/hardware/arduino/avr/variants/standard/pins_arduino.h#L35:
#define digitalPinHasPWM(p) ((p) == 3 || (p) == 5 || (p) == 6 || (p) == 9 || (p) == 10 || (p) == 11)

Or if you want to use your naming scheme:
#define supportsPWM(p) digitalPinHasPWM(p)

After that it gets a bit more sketchy:
https://github.com/arduino/Arduino/blob/1.8.1/hardware/arduino/avr/variants/standard/pins_arduino.h#L28
#define NUM_DIGITAL_PINS 20

So, assuming that Arduino digital pins will always be numbered consecutively from 0 and any pin that supports digital input also supports digital output(which is the case in any variant I'm familiar with), you could use that to write some macros:
#define supportsDigitalInput(p) ((p) < NUM_DIGITAL_PINS)
#define supportsDigitalOutput(p) supportsDigitalInput(p)

https://github.com/arduino/Arduino/blob/1.8.1/hardware/arduino/avr/variants/standard/pins_arduino.h#L29
#define NUM_ANALOG_INPUTS 6

Could be used to write this macro(with numbering assumption):
#define supportsAnalogInput(p) ((p) < NUM_ANALOG_INPUTS)

Note that this will not work for the An analog pin names(e.g. A0 vs 0).
As for:
props.supportsAnalogOutput();
props.analogInputBits();
props.analogOutputBits();
props.pullupResistance();
props.pulldownResistance();

I'm don't know of pre-existing code for those. There is probably a way to get it for the first three in an architecture specific manner. The last two you'd most likely need to get the information from datasheets for all of your target microcontrollers and define then using processor specific macros.

18460: <p>Is it possible to query the <strong>pin-out</strong> and each pin's attributes at <em>run-time</em> with Arduino?</p>

<p>If not, can it be done at compile-time?</p>

<p>Finally, if not, how can I incorporate this kind of information into my project to avoid completely rewriting my program for each possible Arduino model?</p>

<p>I am looking for something like this:</p>

<pre><code>PinProperties props= getPinProperties(pinNumber);

props.supportsDigitalInput();
props.supportsDigitalOutput();
props.supportsAnalogInput();
props.supportsAnalogOutput();
props.supportsPWM();
props.analogInputBits();
props.analogOutputBits();
props.pullupResistance();
props.pulldownResistance();
</code></pre>

<p>etc.</p>

<p>NOTE: <a href="https://electronics.stackexchange.com/questions/58386/how-can-i-detect-which-arduino-board-or-which-controller-in-software">This question</a> is similar and I might use the board model to look up a pre-stored pin-out.</p>
 26916: <p>pins_arduino.h has some standard macros that can be used for some of what you're looking to do. Using the <code>arduino:standard</code> variant used by Uno for example:</p>

<p><a href="https://github.com/arduino/Arduino/blob/1.8.1/hardware/arduino/avr/variants/standard/pins_arduino.h#L35" rel="nofollow noreferrer">https://github.com/arduino/Arduino/blob/1.8.1/hardware/arduino/avr/variants/standard/pins_arduino.h#L35</a>:</p>

<pre><code>#define digitalPinHasPWM(p) ((p) == 3 || (p) == 5 || (p) == 6 || (p) == 9 || (p) == 10 || (p) == 11)
</code></pre>

<p>Or if you want to use your naming scheme:</p>

<pre><code>#define supportsPWM(p) digitalPinHasPWM(p)
</code></pre>

<p>After that it gets a bit more sketchy:</p>

<p><a href="https://github.com/arduino/Arduino/blob/1.8.1/hardware/arduino/avr/variants/standard/pins_arduino.h#L28" rel="nofollow noreferrer">https://github.com/arduino/Arduino/blob/1.8.1/hardware/arduino/avr/variants/standard/pins_arduino.h#L28</a></p>

<pre><code>#define NUM_DIGITAL_PINS 20
</code></pre>

<p>So, assuming that Arduino digital pins will always be numbered consecutively from 0 and any pin that supports digital input also supports digital output(which is the case in any variant I'm familiar with), you could use that to write some macros:</p>

<pre><code>#define supportsDigitalInput(p) ((p) &lt; NUM_DIGITAL_PINS)
#define supportsDigitalOutput(p) supportsDigitalInput(p)
</code></pre>

<p><a href="https://github.com/arduino/Arduino/blob/1.8.1/hardware/arduino/avr/variants/standard/pins_arduino.h#L29" rel="nofollow noreferrer">https://github.com/arduino/Arduino/blob/1.8.1/hardware/arduino/avr/variants/standard/pins_arduino.h#L29</a></p>

<pre><code>#define NUM_ANALOG_INPUTS 6
</code></pre>

<p>Could be used to write this macro(with numbering assumption):</p>

<pre><code>#define supportsAnalogInput(p) ((p) &lt; NUM_ANALOG_INPUTS)
</code></pre>

<p>Note that this will not work for the <code>An</code> analog pin names(e.g. <code>A0</code> vs <code>0</code>).</p>

<p>As for:</p>

<pre><code>props.supportsAnalogOutput();
props.analogInputBits();
props.analogOutputBits();
props.pullupResistance();
props.pulldownResistance();
</code></pre>

<p>I'm don't know of pre-existing code for those. There is probably a way to get it for the first three in an architecture specific manner. The last two you'd most likely need to get the information from datasheets for all of your target microcontrollers and define then using processor specific macros.</p>
