update
This commit is contained in:
36
timer.c
36
timer.c
@@ -1,36 +0,0 @@
|
||||
/*
|
||||
* Copyright 2017 Oleg Borodin <onborodin@gmail.com>
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <avr/pgmspace.h>
|
||||
#include <avr/interrupt.h>
|
||||
#include <avr/io.h>
|
||||
#include <util/delay.h>
|
||||
|
||||
#include <tool.h>
|
||||
#include <timer.h>
|
||||
|
||||
|
||||
void timer_init(void) {
|
||||
/* Disable comparators */
|
||||
REG_SETDOWN_BIT(TCCR0A, COM0A1);
|
||||
REG_SETDOWN_BIT(TCCR0A, COM0A0);
|
||||
REG_SETDOWN_BIT(TCCR0A, COM0B1);
|
||||
REG_SETDOWN_BIT(TCCR0A, COM0B0);
|
||||
/* Set normal mode */
|
||||
REG_SETDOWN_BIT(TCCR0A, WGM01);
|
||||
REG_SETDOWN_BIT(TCCR0A, WGM00);
|
||||
/* Set clock to 1/64 */
|
||||
REG_SETDOWN_BIT(TCCR0B, CS02);
|
||||
REG_SETUP_BIT(TCCR0B, CS01);
|
||||
REG_SETUP_BIT(TCCR0B, CS00);
|
||||
/* Enable timer interrupt */
|
||||
REG_SETUP_BIT(TIMSK0, TOIE0);
|
||||
REG_SETUP(TCNT0, TIMER_INITVAL);
|
||||
}
|
||||
Reference in New Issue
Block a user