X-Git-Url: http://git.linex4red.de/pub/USBasp.git/blobdiff_plain/5a4def747897c1c6ffbe465506d846c7c686d3e9..77a9df36a77d2523dd2bc24fa17f9f04c6c175c5:/Projects/Webserver/Lib/uip/clock.c diff --git a/Projects/Webserver/Lib/uip/clock.c b/Projects/Webserver/Lib/uip/clock.c index 86322966e..e71f7209d 100644 --- a/Projects/Webserver/Lib/uip/clock.c +++ b/Projects/Webserver/Lib/uip/clock.c @@ -1,9 +1,8 @@ #include #include #include -#include -#include -#include + +#include #include "clock.h" @@ -11,7 +10,7 @@ volatile clock_time_t clock_datetime = 0; //Overflow interrupt -ISR(TIMER1_COMPA_vect) +ISR(TIMER1_COMPA_vect, ISR_BLOCK) { clock_datetime += 1; } @@ -19,7 +18,7 @@ ISR(TIMER1_COMPA_vect) //Initialise the clock void clock_init() { - OCR1A = ((F_CPU / 1024) / 100); + OCR1A = (((F_CPU / 1024) / 100) - 1); TCCR1B = ((1 << WGM12) | (1 << CS12) | (1 << CS10)); TIMSK1 = (1 << OCIE1A); } @@ -29,10 +28,9 @@ clock_time_t clock_time() { clock_time_t time; - ATOMIC_BLOCK(ATOMIC_FORCEON) - { - time = clock_datetime; - } + GlobalInterruptDisable(); + time = clock_datetime; + GlobalInterruptEnable(); return time; }