Skip to content
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

Feature: I2S callback on DMA read #4205

Merged
merged 23 commits into from
Mar 19, 2018
Merged

Feature: I2S callback on DMA read #4205

merged 23 commits into from
Mar 19, 2018

Conversation

Crypter
Copy link
Contributor

@Crypter Crypter commented Jan 21, 2018

This will allow to fill the DMA buffer on demand using callback function (or at least set a flag in the callback and do stuff later outside of the interrupt routine). This will save a lot of overhead because the only way to do it now is to check in a loop if there's empty buffer waiting to be filled.

@earlephilhower earlephilhower added this to the 2.5.0 milestone Jan 22, 2018
@earlephilhower
Copy link
Collaborator

The next rev is going to be bugfix, with new cool features like this for the follow-on. Thx!

Copy link
Collaborator

@earlephilhower earlephilhower left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couple little things, please.

ETS_SLC_INTR_ENABLE();
}
}

void ICACHE_FLASH_ATTR i2s_set_callback(void (*callback) (void)){
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now that 2.4.1 is out this can get into the merge queue. Only minor change I would request is to remove the ICACHE_FLASH_ATTR from the set-callback function. There's no need for this to be kept in precious IRAM.

@@ -51,6 +51,7 @@ bool i2s_write_lr(int16_t left, int16_t right);//combines both channels and call
bool i2s_is_full();//returns true if DMA is full and can not take more bytes (overflow)
bool i2s_is_empty();//returns true if DMA is empty (underflow)
int16_t i2s_available();// returns the number of samples than can be written before blocking
void i2s_set_callback(void (*callback) (void));
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(continuing prior thought)
The actual callback function passed in, though, needs to be in IRAM. A comment in the code to that effect would be appreciated here, so it's obvious to people coming into it that it's an ISR and needs to be very special...

@Crypter
Copy link
Contributor Author

Crypter commented Mar 18, 2018

The requested changes are implemented, lets hope this gets merged soon :))

Copy link
Collaborator

@earlephilhower earlephilhower left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks fine. Just updated, if it clears CI I can merge later today.

@earlephilhower earlephilhower merged commit f9110f5 into esp8266:master Mar 19, 2018
@earlephilhower
Copy link
Collaborator

Thanks, squashed and committed.

@Crypter Crypter deleted the i2s-isr branch August 21, 2018 14:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants