37 lines
1,010 B
C
37 lines
1,010 B
C
|
/* Copyright © 2020 tyrolyean
|
||
|
*
|
||
|
* This program is free software: you can redistribute it and/or modify
|
||
|
* it under the terms of the GNU General Public License as published by
|
||
|
* the Free Software Foundation, either version 3 of the License, or
|
||
|
* (at your option) any later version.
|
||
|
*
|
||
|
* This program is distributed in the hope that it will be useful,
|
||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
|
* GNU General Public License for more details.
|
||
|
*
|
||
|
* You should have received a copy of the GNU General Public License
|
||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||
|
*/
|
||
|
|
||
|
#include "interrupt.h"
|
||
|
#include "dac.h"
|
||
|
#include <avr/interrupt.h>
|
||
|
|
||
|
void init_interrupts(){
|
||
|
/* Initialize the timer interrupt */
|
||
|
TCCR0A = (1 << COM0A1) | (1 << WGM11);
|
||
|
TCCR0B = (1 << CS02);
|
||
|
OCR0A = 64; /* Interrupt fires every Millisecond */
|
||
|
TIMSK0 = (1 << OCIE0A);
|
||
|
|
||
|
}
|
||
|
|
||
|
|
||
|
ISR(TIMER0_COMPA_vect)
|
||
|
{
|
||
|
update_sound();
|
||
|
}
|
||
|
|
||
|
|