functions for time measurement More...
#include <avr/io.h>Go to the source code of this file.
Typedefs | |
| typedef uint16_t | timerval_t |
| type for timer value | |
Functions | |
| void | timer1_init (void) |
| initialize timer1 | |
| void | timer1_func_start (timerval_t *tv) |
| store current timer val into variable | |
| uint16_t | timer1_func_end (timerval_t *tv) |
| get elapsed time since timer1_func_start() | |
functions for time measurement
| void timer1_init | ( | void | ) |
initialize timer1
Set up timer1 for continous counting.
The prescaler is set to 1/256. Therefore the elapsed time t can be calculated in the following way:
{
power_timer1_enable ();
TCCR1A = 0;
TCCR1B = _BV(CS12); /* prescaler 1/256 */
TIMSK1 = 0; /* no INT generation */
}
1.7.1