Skip to content

Instantly share code, notes, and snippets.

@dagon666
Created November 8, 2013 13:16
Show Gist options
  • Save dagon666/7370906 to your computer and use it in GitHub Desktop.
Save dagon666/7370906 to your computer and use it in GitHub Desktop.
pwm playback interrupt
ISR(TIMER0_COMPA_vect, ISR_NOBLOCK) {
if (g_tail != g_head) {
OCR1AH = 0x00;
OCR1BH = 0x00;
#if MODE == MODE_8K_16B
uint16_t sample = (0x8000 + (p[(g_tail >> 6)].samples[g_tail & 0x3f]));
OCR1AL = sample >> 8 ;
OCR1BL = (sample) & 0xff;
#else
OCR1AL = p[(g_tail >> 7)].samples[g_tail & 0x7f];
#endif
g_tail = (g_tail + 1) % max_samples;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment