File: timer.h

package info (click to toggle)
avr-libc 20020203-2
  • links: PTS
  • area: main
  • in suites: woody
  • size: 1,448 kB
  • ctags: 6,562
  • sloc: ansic: 7,631; asm: 4,424; sh: 2,703; makefile: 338; pascal: 289
file content (40 lines) | stat: -rw-r--r-- 553 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#ifndef _TIMER_H_
#define _TIMER_H_

#include <io.h>

#ifdef __cplusplus
extern "C" {
#endif

enum {
  STOP             = 0,
  CK               = 1,
  CK8              = 2,
  CK64             = 3,
  CK256            = 4,
  CK1024           = 5,
  T0_FALLING_EDGE  = 6,
  T0_RISING_EDGE   = 7
};

static inline void timer0_source (unsigned int src)
{
  outb (src, TCCR0);
}

static inline void timer0_stop (void)
{
  outb (0, TCNT0);
}

static inline void timer0_start (void)
{
  outb (0x1, TCNT0);
}

#ifdef __cplusplus
}
#endif

#endif /* _TIMER_H_ */