Skip to content

Commit

Permalink
modulate pulse gets its own ISR.
Browse files Browse the repository at this point in the history
  • Loading branch information
anarkiwi committed Aug 16, 2022
1 parent 8fe84a9 commit bf82b7a
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions chime_red2.ino
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,13 @@ void slipTickISR() {
isrPtr = &nextISR;
}

void modulateISR() {
cr_fp_t p = crmidi.Modulate(oc.audibleOscillator);
crio.schedulePulse(p);
oc.Triggered();
isrPtr = &nextISR;
}

void nextISR() {
// This ISR period was used to output pulse less than the ISR period - catch up on next ISR.
if (crio.handlePulse()) {
Expand All @@ -93,8 +100,7 @@ void nextISR() {
}
if (oc.Triggered()) {
if (oc.audibleOscillator) {
cr_fp_t p = crmidi.Modulate(oc.audibleOscillator);
crio.schedulePulse(p);
isrPtr = &modulateISR;
}
return;
}
Expand Down

0 comments on commit bf82b7a

Please sign in to comment.