Skip to content

Free memory we allocated and actually stop i2s. #3191

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 8, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion cores/esp8266/core_esp8266_i2s.c
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,10 @@ void ICACHE_FLASH_ATTR i2s_slc_end(){
SLCIE = 0;
SLCTXL &= ~(SLCTXLAM << SLCTXLA); // clear TX descriptor address
SLCRXL &= ~(SLCRXLAM << SLCRXLA); // clear RX descriptor address

for (int x = 0; x<SLC_BUF_CNT; x++) {
free(i2s_slc_buf_pntr[x]);
}
}

//This routine pushes a single, 32-bit sample to the I2S buffers. Call this at (on average)
Expand Down Expand Up @@ -238,8 +242,16 @@ void ICACHE_FLASH_ATTR i2s_begin(){
}

void ICACHE_FLASH_ATTR i2s_end(){
i2s_slc_end();
I2SC &= ~I2STXS;

//Reset I2S
I2SC &= ~(I2SRST);
I2SC |= I2SRST;
I2SC &= ~(I2SRST);

pinMode(2, INPUT);
pinMode(3, INPUT);
pinMode(15, INPUT);

i2s_slc_end();
}