mod01 update headers and descriptions
This commit is contained in:
15
module01/ex01/timer.h
Normal file
15
module01/ex01/timer.h
Normal file
@@ -0,0 +1,15 @@
|
||||
#ifndef TIMER_H
|
||||
#define TIMER_H
|
||||
|
||||
#define PRESCALE_VALUE 1024 // can be 1, 8, 64, 256, 1024
|
||||
// table 16-5 : prescale sets
|
||||
#define PRESCALE_SET(value) \
|
||||
((value) == 1 ? (0<<CS12 | 0<<CS11 | 1<<CS10) : \
|
||||
(value) == 8 ? (0<<CS12 | 1<<CS11 | 0<<CS10) : \
|
||||
(value) == 64 ? (0<<CS12 | 1<<CS11 | 1<<CS10) : \
|
||||
(value) == 256 ? (1<<CS12 | 0<<CS11 | 0<<CS10) : \
|
||||
(value) == 1024? (1<<CS12 | 0<<CS11 | 1<<CS10) : \
|
||||
(0<<CS12 | 0<<CS11 | 0<<CS10))
|
||||
#define TIME_MS(ms) (((F_CPU / PRESCALE_VALUE) * ms) / 1000)
|
||||
|
||||
#endif // TIMER_H
|
||||
Reference in New Issue
Block a user