#include #include #include #include #include #include "main.h" #include "synth.h" static void init_sampletimer(void) { // Timer 0 // set timer0 to CTC & prescaler 64 == 125k TCCR0A = (1 << WGM01); TCCR0B = (1 << CS00) | (1 << CS01); // count up to 5 : OCR0A = 3; TCNT0 = 0; // enable interrupt TIMSK0 |= (1< maxcounter){ counter = 0; }; pulsecounter++; if (pulsecounter > 0x300){ pulsecounter = 0; pulsewidth++; if (pulsewidth > maxcounter){ pulsewidth = 0; } } OCR1B = ((counter > pulsewidth) ? 0xff : 0x00); */ OCR1B = synth_mix(); }