For those who tries to figure out wiring.c, pins_arduino.c... with a purpose of extending arduino capabilities (for example: making atmega32 and other to works, like atmega8 and atmega168). I started reading atmega32 datasheet (http://www.atmel.com/dyn/resources/prod_documents/doc2503.pdf), but more difficult is editing wiring.c and pins_arduino.c. While i was looking wiring.c functions i couldn't understand why using _SFR_IO8 instead _SFR_IO (only), in the piece of code:
void pinMode(int pin, int mode)
{
if (digitalPinToPort(pin) != NOT_A_PIN) {
if (mode == INPUT)
cbi(_SFR_IO8(port_to_mode[digitalPinToPort(pin)]),
digitalPinToBit(pin));
else
sbi(_SFR_IO8(port_to_mode[digitalPinToPort(pin)]),
digitalPinToBit(pin));
}
}
I hope that the people will include their posts here, to ask and to answer on these kind of questions, helping to speed up arduino development. Thank you!!