makerbot/G3Firmware — pull request #83 by craiglink (2011-11-22 06:46:27+00:00)
Title: Optimized G3Firmware

These are some changes that optimize the AVR pin setting down to single instruction calls for Ports A-G. It also fixes an interrupt pin setting bug that existed - http://code.google.com/p/arduino/issues/detail?id=146 .
Most of this work comes from stuff I did earlier in the year on the Arduino with the digitialWriteFast macros

The core of this checkin use the use of a template class, PinTmplt, to replace the previously existing AvrPort and Pin files. The use of the template allows for the port / pin number of be determined at compile time so that a single sbi or cbi instruction can be used to set or clear the bit. The existing code used a dozen or more instructions to accomplish the same thing. It results in a 20% savings CPU in each main loop iteration while moving a stepper motor.

Additionally I abstracted the display portion of the InterfaceBoard code into an abstract Display class so that other displays could easily be added to the firmware. Included is a Modtronix interface using i2c. I made a shield that remapped the Arduino's i2c pins so that I could use them asynchronously.

Have a look and let me know if you have any questions.