From 102f482d8e40e8a1a9a80e8c7be813577b9b9dbd Mon Sep 17 00:00:00 2001 From: john stone Date: Mon, 6 Aug 2012 13:25:33 +0200 Subject: [PATCH] all sample and legacy code thrown out of main --- firmware/main.c | 86 +++++++++++++++++++++---------------------------- 1 file changed, 36 insertions(+), 50 deletions(-) diff --git a/firmware/main.c b/firmware/main.c index 5a759e9..04da2ca 100644 --- a/firmware/main.c +++ b/firmware/main.c @@ -10,42 +10,51 @@ static void init_sampletimer(void) { - // Timer 0 - // set timer0 to CTC & prescaler 64 == 125k + /* + * Timer 0 + */ + + /* set timer0 to CTC & prescaler 64 → 125kHz increment */ TCCR0A = (1 << WGM01); TCCR0B = (1 << CS00) | (1 << CS01); - // count up to 5 : - OCR0A = 3; + + OCR0A = 3; /* TOP */ TCNT0 = 0; - // enable interrupt + /*enable interrupt*/ TIMSK0 |= (1< maxcounter){ - counter = 0; - }; - - pulsecounter++; - if (pulsecounter > 0x300){ - pulsecounter = 0; - pulsewidth++; - if (pulsewidth > maxcounter){ - pulsewidth = 0; - } - } - OCR1B = ((counter > pulsewidth) ? 0xff : 0x00); - */ - - + /* calculate next analog sample value in synth mixer:*/ OCR1B = synth_mix(); - }