I have defined pins for 168/328, Mega, 644/1284 (Sanguino style), Leonardo, Teensy, and Teensy++. I haven't tested Leonardo yet.
I am currently doing a lot of development on STM32 and have been thinking about digital I/O for STM32. STM32 is very different than AVR. Pins have 15 modes. and there are neat registers to safely set and clear bits in a port.
Here are the modes:
STM32 pin modes
0 - Analog input.
1 - Push Pull output 10MHz.
2 - Push Pull output 2MHz.
3 - Push Pull output 50MHz.
4 - Digital input.
5 - Open Drain output 10MHz.
6 - Open Drain output 2MHz.
7 - Open Drain output 50MHz.
8 - Digital input with PullUp or PullDown resistor depending on ODR.
9 - Alternate Push Pull output 10MHz.
A - Alternate Push Pull output 2MHz.
B - Alternate Push Pull output 50MHz.
C - Reserved.
D - Alternate Open Drain output 10MHz.
E - Alternate Open Drain output 2MHz.
F - Alternate Open Drain output 50MHz.