Makefiles and library modified to add a new F_CLOCK constant to give the unprescaled master input clock frequency, so that the correct PLL mask can be determined even when the CPU (F_CPU) clock rate is prescaled outside the normal input range of the PLL.

Started to clean up the AVRISP Programmer project code, donated by Opendous Inc.
This commit is contained in:
Dean Camera 2009-02-26 05:48:47 +00:00
parent fa456ce531
commit 99145a8d7c
40 changed files with 632 additions and 250 deletions

View file

@ -66,7 +66,12 @@
#endif
/* Preprocessor Checks and Defines: */
#if (F_CPU == 8000000)
#if !defined(F_CLOCK)
#error F_CLOCK is not defined. You must device F_CLOCK to the frequency of the unprescaled input clock in your project makefile.
#define F_CLOCK 0
#endif
#if (F_CLOCK == 8000000)
#if (defined(__AVR_AT90USB82__) || defined(__AVR_AT90USB162__))
#define USB_PLL_PSC 0
#elif (defined(__AVR_AT90USB646__) || defined(__AVR_AT90USB647__) || \
@ -76,7 +81,7 @@
#elif (defined(__AVR_ATmega16U4__) || defined(__AVR_ATmega32U4__))
#define USB_PLL_PSC 0
#endif
#elif (F_CPU == 16000000)
#elif (F_CLOCK == 16000000)
#if (defined(__AVR_AT90USB646__) || defined(__AVR_AT90USB647__) || defined(__AVR_ATmega32U6__))
#define USB_PLL_PSC ((1 << PLLP2) | (1 << PLLP1))
#elif (defined(__AVR_AT90USB1286__) || defined(__AVR_AT90USB1287__))