3471 |
miho |
1 |
/* |
|
|
2 |
* clock.c - 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....: 2005-04-20 |
|
|
9 |
*/ |
|
|
10 |
|
|
|
11 |
#include <inttypes.h> |
|
|
12 |
#include <avr/io.h> |
|
|
13 |
#include "clock.h" |
|
|
14 |
|
|
|
15 |
/* wait time * 320 us */ |
|
|
16 |
void clockWait(uint8_t time) { |
|
|
17 |
|
|
|
18 |
uint8_t i; |
|
|
19 |
for (i = 0; i < time; i++) { |
|
|
20 |
uint8_t starttime = TIMERVALUE; |
|
|
21 |
while ((uint8_t) (TIMERVALUE - starttime) < CLOCK_T_320us) { |
|
|
22 |
} |
|
|
23 |
} |
|
|
24 |
} |