3471 |
miho |
1 |
/* |
|
|
2 |
* clock.h - part of USBasp |
|
|
3 |
* |
|
|
4 |
* Autor..........: Thomas Fischl <tfischl@gmx.de> |
|
|
5 |
* Description....: Provides functions for timing/waiting |
|
|
6 |
* Licence........: GNU GPL v2 (see Readme.txt) |
|
|
7 |
* Creation Date..: 2005-02-23 |
|
|
8 |
* Last change....: 2006-11-16 |
|
|
9 |
*/ |
|
|
10 |
|
|
|
11 |
#ifndef __clock_h_included__ |
|
|
12 |
#define __clock_h_included__ |
|
|
13 |
|
|
|
14 |
#define F_CPU 12000000L /* 12MHz */ |
|
|
15 |
#define TIMERVALUE TCNT0 |
|
|
16 |
#define CLOCK_T_320us 60 |
|
|
17 |
|
|
|
18 |
#ifdef __AVR_ATmega8__ |
|
|
19 |
#define TCCR0B TCCR0 |
|
|
20 |
#endif |
|
|
21 |
|
|
|
22 |
/* set prescaler to 64 */ |
|
|
23 |
#define clockInit() TCCR0B = (1 << CS01) | (1 << CS00); |
|
|
24 |
|
|
|
25 |
/* wait time * 320 us */ |
|
|
26 |
void clockWait(uint8_t time); |
|
|
27 |
|
|
|
28 |
#endif /* __clock_h_included__ */ |