8000 add spi listen callback and stop listen callback function by myrual · Pull Request #1124 · micropython/micropython · GitHub
[go: up one dir, main page]

Skip to content

add spi listen callback and stop listen callback function #1124

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

Closed
wants to merge 6 commits into from

Conversation

myrual
Copy link
Contributor
@myrual myrual commented Feb 17, 2015

Add two functions for SPI slave mode for listen SPI data without disable dma channel. Please help to check the code quality and coding style, I am not familiar with python internal code like gc and others.

@dpgeorge
Copy link
Member

Thanks for this. I will review it soon.

@dpgeorge
Copy link
Member

Sorry for the long wait to review this...

The spi.listen method that you added is essentially the same as spi.recv except that it returns before the receive finishes (if it's a DMA transfer). And then a callback gets called when the receive is actually done.

I think this functionality should be part of spi.recv, enabled with a keyword something like block=False. This would scale to the send method, and also the I2C peripheral.

But the way to handle callbacks in general is still blocked pending discussion in #1118.

@dpgeorge
Copy link
Member
dpgeorge commented May 2, 2018

Given that this PR is so old I'm going to close it.

The idea is good -- to support asynchronous SPI transfers with callbacks -- but the overall machine API is not there yet. When it is hopefully a variant of this PR will be implemented.

@dpgeorge dpgeorge closed this May 2, 2018
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.

3 participants
0