USBasp 2011.05.28. for Atmega328p 16 MHz
[pub/USBasp.git] / firmware / clock.h
index 405fe2f..38e4331 100644 (file)
@@ -1,19 +1,21 @@
 /*
-  clock.h - part of USBasp
-
-  Autor..........: Thomas Fischl <tfischl@gmx.de>
-  Description....: Provides functions for timing/waiting
-  Licence........: GNU GPL v2 (see Readme.txt)
-  Creation Date..: 2005-02-23
-  Last change....: 2006-11-16
-*/
* clock.h - part of USBasp
+ *
* Autor..........: Thomas Fischl <tfischl@gmx.de>
* Description....: Provides functions for timing/waiting
* Licence........: GNU GPL v2 (see Readme.txt)
* Creation Date..: 2005-02-23
* Last change....: 2006-11-16
+ */
 
 #ifndef __clock_h_included__
 #define        __clock_h_included__
 
+#ifndef F_CPU
 #define F_CPU           12000000L   /* 12MHz */
+#endif
 #define TIMERVALUE      TCNT0
-#define CLOCK_T_320us  60
+#define CLOCK_T_320us  (320 * (F_CPU/1000000L) / 64)
 
 #ifdef __AVR_ATmega8__
 #define TCCR0B  TCCR0