Device Selection

This project is developed to work for two different devices (ATmega64 and ATmega328PB). The code has conditional compilation macros to use appropriate code based on device selection. The firmware for respective device shall be compiled by just selecting the appropriate device in Atmel Studio IDE. This is done in the device.h header file. This file acts as a wrapper between the application and the device register access.

There are some minor differences in the register names between the two devices and hence the segregation is necessary. Depending upon the device selected, the macro DEVICE_ATMEGA328PB or DEVICE_ATMEGA64 gets defined. Based on the macro that gets defined, further definitions ensure error free compilation. The macro also limits the user to select either of the two devices, failing which a compilation error message is displayed. Application can be made to support more AVR devices with no change or minimal, if any. This can be handled by modifying the device.h file.