X-Git-Url: http://git.linex4red.de/pub/USBasp.git/blobdiff_plain/273d814d87242c5526dd03dc4530f605951fe0d4..refs/heads/master:/firmware/clock.h diff --git a/firmware/clock.h b/firmware/clock.h index 89eb868d8..38e4331f8 100644 --- a/firmware/clock.h +++ b/firmware/clock.h @@ -1,22 +1,28 @@ /* - clock.h - part of USBasp - - Autor..........: Thomas Fischl - Description....: Provides functions for timing/waiting - Licence........: Free under certain conditions. See Documentation. - Creation Date..: 2005-02-23 - Last change....: 2005-04-20 -*/ + * clock.h - part of USBasp + * + * Autor..........: Thomas Fischl + * 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 +#endif /* set prescaler to 64 */ -#define clockInit() TCCR0 = (1 << CS01) | (1 << CS00); +#define clockInit() TCCR0B = (1 << CS01) | (1 << CS00); /* wait time * 320 us */ void clockWait(uint8_t time);