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

Add unidirectional SPI DMA #104

Merged
merged 1 commit into from
Oct 27, 2019
Merged

Add unidirectional SPI DMA #104

merged 1 commit into from
Oct 27, 2019

Conversation

TheZoq2
Copy link
Member

@TheZoq2 TheZoq2 commented Aug 26, 2019

This adds basic support for transmitting data over SPI using DMA.

Since this is a basic implementation, only non-circular buffers are supported. However, at the moment I don't have a need for that, and I think we might have to restructure some DMA stuff for simultaneous TX and RX support so I don't want to put too much effort into this until we get around to that.

I think RX support might be fairly easy, but it would require reconfiguring the SPI device as reads happen on writes in bidirectional mode.

Note: I have yet to test DMA over SPI2, I'll do that tomorrow but the code probably shouldn't change

@burrbull
Copy link
Contributor

Can you rebase on master and use AsSlice instead of AsRef?

@TheZoq2
Copy link
Member Author

TheZoq2 commented Aug 27, 2019

Oops, I guess I forgot to compile after rebasing yesterday 😅

@TheZoq2
Copy link
Member Author

TheZoq2 commented Sep 29, 2019

Note: I have yet to test DMA over SPI2, I'll do that tomorrow but the code probably shouldn't change

That took a bit longer than a day, but I have finally got around to testing it. Looks like it works which means that this should be ready to merge unless there are any other issues

src/spi.rs Outdated
Comment on lines 230 to 233




Copy link
Member

Choose a reason for hiding this comment

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

nit: Excess newlines

src/spi.rs Outdated
Comment on lines 247 to 249
use core::sync::atomic::{self, Ordering};

use as_slice::AsSlice;
Copy link
Member

Choose a reason for hiding this comment

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

nit: please move module-wide imports to the top

@therealprof
Copy link
Member

@TheZoq2 Mind rebasing? Otherwise looks good to go for me.

@TheZoq2
Copy link
Member Author

TheZoq2 commented Oct 27, 2019

Sure, thanks for the review

@TheZoq2 TheZoq2 merged commit 26ab9e2 into stm32-rs:master Oct 27, 2019
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.

None yet

3 participants