Skip to content

Commit c9687b4

Browse files
committed
R2RConfig timer_id
1 parent 36fa3fc commit c9687b4

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/AudioLibs/R2ROutput.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ class R2RConfig : public AudioInfo {
8787
uint16_t buffer_count = 2; // double buffer
8888
R2RDriverBase *driver = &r2r_driver; // by default use Arduino driver
8989
bool is_blocking = true;
90+
int timer_id = 0;
9091
};
9192

9293
/**
@@ -137,8 +138,11 @@ class R2ROutput : public AudioOutput {
137138
}
138139
buffer.resize(rcfg.buffer_size, rcfg.buffer_count);
139140
rcfg.driver->setupPins(rcfg.channel1_pins, rcfg.channel2_pins);
141+
142+
// setup timer
140143
timer.setCallbackParameter(this);
141144
timer.setIsSave(true);
145+
timer.setTimer(rcfg.timer_id);
142146
return timer.begin(r2r_timer_callback, cfg.sample_rate, HZ);
143147
}
144148

0 commit comments

Comments
 (0)