Add MIME type handling to the Webserver project, so that files of different types...
[pub/USBasp.git] / Projects / Webserver / Lib / uip / conf / clock-arch.c
1 #include "global-conf.h"
2 #include <stdint.h>
3 #include <stdlib.h>
4 #include <stdio.h>
5 #include <avr/interrupt.h>
6 #include <avr/io.h>
7 #include <avr/sfr_defs.h>
8
9 #include "clock-arch.h"
10
11 //Counted time
12 volatile clock_time_t clock_datetime = 0;
13
14 //Overflow interrupt
15 ISR(TIMER1_COMPA_vect)
16 {
17 clock_datetime += 1;
18 }
19
20 //Initialise the clock
21 void clock_init()
22 {
23 OCR1A = ((F_CPU / 1024) / 100);
24 TCCR1B = ((1 << WGM12) | (1 << CS12) | (1 << CS10));
25 TIMSK1 = (1 << OCIE1A);
26 }
27
28 //Return time
29 clock_time_t clock_time()
30 {
31 clock_time_t time;
32
33 cli();
34 time = clock_datetime;
35 sei();
36
37 return time;
38 }