From b46ccc1618820a2cc2dd728deb3852c7d229d57e Mon Sep 17 00:00:00 2001 From: bigalex Date: Mon, 27 Aug 2012 09:43:42 +0200 Subject: [PATCH] rolled back unwanted changes (testcode) to prevoius version in main.c --- firmware/main.c | 165 +++++++++++++++++++++++++++++++++++------------- 1 file changed, 122 insertions(+), 43 deletions(-) diff --git a/firmware/main.c b/firmware/main.c index 2983152..74d57b2 100644 --- a/firmware/main.c +++ b/firmware/main.c @@ -5,7 +5,8 @@ #include #include "main.h" - +#include "synth.h" +#include "usart.h" uint16_t sw_v = 0; @@ -14,64 +15,110 @@ uint16_t darkval = 0; uint16_t last_darkval = 0; - - -void __attribute__((noreturn)) -main(void) +static void init_sampletimer(void) { + /* + * Timer 0 + */ - /* here the show begins:*/ - - DDRC = 0b00100011; - PORTC = 0b00000001; - PORTC = 0b00000000; - DDRD = 0x00; - PORTD = 0b00000011; //enable pullups - DDRB = 0xFF; - PORTB=0xFF; + /* set timer0 to CTC & prescaler 64 → 125kHz increment */ + TCCR0A = (1 << WGM01); + TCCR0B = (1 << CS00) | (1 << CS01); + + OCR0A = 6; /* TOP */ + TCNT0 = 0; + /*enable interrupt*/ + TIMSK0 |= (1<