diff --git a/TODO b/TODO index 17b9e30..fbc2948 100644 --- a/TODO +++ b/TODO @@ -9,7 +9,6 @@ - 11bit-pwm-emu - drumherum - data-streaming von sdcard - - ringbuf (ryx) - testen - sdcard diff --git a/gg.c b/gg.c index db968ba..44f9628 100644 --- a/gg.c +++ b/gg.c @@ -40,7 +40,7 @@ uint8_t buffer[BUFFER_SIZE];/* buffer for mmc data */ uint8_t pos = 0;/* current playing position */ uint8_t refresh_buffer = 0;/* position to start buffer refreshing */ -ISR(TIMER1_OVF1_vect, ISR_NAKED) +/*ISR(TIMER1_OVF1_vect, ISR_NAKED) { __asm__("in r2, 0x3f"); // save sreg if(--cnt_to_ocr_incr){ @@ -48,13 +48,34 @@ ISR(TIMER1_OVF1_vect, ISR_NAKED) } if(--cnt_to_next){ cur_ocr = next_ocr; + OCR1A = cur_ocr; cnt_to_ocr_incr = next_cnt_to_incr; cnt_to_next = 8; needs_new_data_flag = 1; } __asm__("out 0x2f,r2"); // restore sreg reti(); -} +}//*/ + +ISR(TIMER1_OVF1_vect){ + // next try: simplistic, not too much looking at speed + uint16_t next; + + if(--cnt_to_next){ + next = ringbuf_get(ringbuf); + OCR1A = next>>8; + cnt_to_ocr_incr = 7-(next & 0x7); + cnt_to_next = 7; + } else { + if(--cnt_to_ocr_incr){ + OCR1A += 1; + } + } +} + + + + diff --git a/gg.h b/gg.h index a2f2eb1..0873956 100644 --- a/gg.h +++ b/gg.h @@ -11,3 +11,4 @@ register uint8_t next_cnt_to_incr __asm__("r6"); register uint8_t cnt_to_next __asm__("r7"); register uint8_t needs_new_data_flag __asm__("r8"); +ringbuf_t ringbuf;