Unverified Commit 5ab19e9a authored by Earle F. Philhower, III's avatar Earle F. Philhower, III Committed by GitHub

Fix I2S timing (#728)

BCLK was running at 50% of expected speed.

Fixes #714
parent 82abc76e
......@@ -78,7 +78,7 @@ bool I2S::setBuffers(size_t buffers, size_t bufferWords, int32_t silenceSample)
bool I2S::setFrequency(int newFreq) {
_freq = newFreq;
if (_running) {
float bitClk = _freq * _bps * 2.0;
float bitClk = _freq * _bps * 2.0 /* channels */ * 2.0 /* edges per clock */;
pio_sm_set_clkdiv(_pio, _sm, (float)clock_get_hz(clk_sys) / bitClk);
}
return true;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment