porting code from DIP Atmega168 to TQFP Atmega168

I made arduino code for a project that was using Atmega168 dip format. The people in the project got some boards manufactured and they used Atmega168 TQFP format instead.

The TQFP atmegas have 32 pins and more ports than the DIP version. How do I compile Arduino code to work with the TQFP version? How do I access the extra ports?

There is a page for the Diecemila that maps all of the 168dip puns to arduino ports. Is there something equivalent?

I think I am missing something obvious/dumb so please excuse my ignorance if I am misunderstanding something simple.

For example:

If I use digitalWrite(2, HIGH);

then physical pin 4 of the Atmega168 dip is written high and it is PD2. However on the TQFP package the same pin/port is on pin 32.

So in the arduino library it is taking the function digitalwrite and writing based on port name and number not specific pins right?

If this is the case, can I access the the extra i/o the TQFP package has while still using the standard arduino library?

The arduino mini is the TQFP 32 package; its documentation may answer some of your questions.

So in the arduino library it is taking the function digitalwrite and writing based on port name and number not specific pins right?

That is correct - Arduino pins are mapped to PORTx bit Y, not to a physical pin, so the physical pins will be different between DIP and TQFP packages.

I've built several boards with the DIP ATmegas. I created a pin mapping header file, so I do things like

#define ATMEGA_DIP_11 5
...
digitalWrite(ATMEGA_DIP_11, HIGH);

I have found that carefully crafting this header file (once) and using these aliases results in fewer errors in my code and circuits, and less time debugging.

-j