user13327: Are there board-independent functions to check pin capabilities at compile time? I.e.

Can the pin be used as output, as in digitalWrite()?
Does the pin support PWM, as in analogWrite()?
Does the pin support ADC, as in analogRead()?
Does the pin support interrupts, as in attachInterrupt()?

I'm looking for functions/macros like e.g. isDigitalOutput(pin) which would return false for input-only pins such as A6 and A7 on a 328P, but true on a Mega where those pins are input/output.

user13327: For compatibility with analogWrite() there's digitalPinHasPWM(p) macro which returns 1 when PWM is supported on pin p.
For analogRead() there's analogInputToDigitalPin() which can be used as
#if ((p-PIN_A0 < 0) || (analogInputToDigitalPin(p-PIN_A0) != p))
#error Not an analog pin!
#endif

For attachInterrupt() there is digitalPinToInterrupt(p) which returns NOT_AN_INTERRUPT if the pin p doesn't support interrupts.
I still haven't found anything to test compatibility with digitalWrite().

13327: <p>Are there board-independent functions to check pin capabilities at compile time? I.e.</p>
<ul>
<li>Can the pin be used as output, as in <code>digitalWrite()</code>?</li>
<li>Does the pin support PWM, as in <code>analogWrite()</code>?</li>
<li>Does the pin support ADC, as in <code>analogRead()</code>?</li>
<li>Does the pin support interrupts, as in <code>attachInterrupt()</code>?</li>
</ul>
<p>I'm looking for functions/macros like e.g. <code>isDigitalOutput(pin)</code> which would return false for input-only pins such as A6 and A7 on a 328P, but true on a Mega where those pins are input/output.</p>
 13327: <p>For compatibility with <code>analogWrite()</code> there's <code>digitalPinHasPWM(p)</code> macro which returns 1 when PWM is supported on pin <code>p</code>.</p>
<p>For <code>analogRead()</code> there's <code>analogInputToDigitalPin()</code> which can be used as</p>
<pre><code>#if ((p-PIN_A0 &lt; 0) || (analogInputToDigitalPin(p-PIN_A0) != p))
#error Not an analog pin!
#endif
</code></pre>
<p>For <code>attachInterrupt()</code> there is <code>digitalPinToInterrupt(p)</code> which returns <code>NOT_AN_INTERRUPT</code> if the pin <code>p</code> doesn't support interrupts.</p>
<p>I still haven't found anything to test compatibility with <code>digitalWrite()</code>.</p>
