new ISR, WIP

master
Paul Goeser 14 years ago
parent 5a4fe6ec84
commit 5d407a1cd0

@ -9,7 +9,6 @@
- 11bit-pwm-emu
- drumherum
- data-streaming von sdcard
- ringbuf (ryx)
- testen
- sdcard

25
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;
}
}
}

@ -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;

Loading…
Cancel
Save