From 29f8d54be93123259081e1a918b92afa7f073332 Mon Sep 17 00:00:00 2001 From: "Earle F. Philhower, III" Date: Sun, 24 Jan 2021 09:49:43 -0800 Subject: [PATCH] Fix I2S reported rate for 24b mode Adjust the number of bittimes when returning the real I2S rate. --- cores/esp8266/core_esp8266_i2s.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cores/esp8266/core_esp8266_i2s.cpp b/cores/esp8266/core_esp8266_i2s.cpp index a18d9a3cc4..c50d5e2d8e 100644 --- a/cores/esp8266/core_esp8266_i2s.cpp +++ b/cores/esp8266/core_esp8266_i2s.cpp @@ -502,7 +502,7 @@ void i2s_set_dividers(uint8_t div1, uint8_t div2) { } float i2s_get_real_rate(){ - return (float)I2SBASEFREQ/32/((I2SC>>I2SBD) & I2SBDM)/((I2SC >> I2SCD) & I2SCDM); + return (float)I2SBASEFREQ/(_i2s_bits * 2)/((I2SC>>I2SBD) & I2SBDM)/((I2SC >> I2SCD) & I2SCDM); } bool i2s_rxtx_begin(bool enableRx, bool enableTx) {