-
Notifications
You must be signed in to change notification settings - Fork 182
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 DMA RX and RX/TX support to SPI #335
Conversation
An usage example can be found at https://github.com/Windfisch/bluepill_spidemo/blob/aa0bf2f6f24ed28cb3263e4e6f73a968538e5d70/src/main.rs#L50-L53 |
I added a |
What about add more type aliases? pub type Spi1TxDma<REMAP, PINS> = SpiTxDma<SPI1, REMAP, PINS, dma::C3>; |
And do we really need |
nope, the SpiPayload wrapper was rather useless; I have removed it and added the type aliases you suggested |
bors r+ |
Implements #200
SPI is a bit different from most other DMA-supporting peripherals, since SPI in master mode cannot receive without transmitting simultaneously. After some discussion in the #rust-embedded irc channel, we came to the conclusion that
split()
ting the device (like with serial) does not make much sense, because sending and receiving are inherently tied to each other; that made it necessary to finish the implementation of the already-existing (but unused)RxTxDma
struct fromdma.rs
and add required traits.This PR does that and adds an RxTxDma implementation to the SPI module.
Because in slave mode, this might(?) be still possible to receive without transmitting, I left the
RxDma
implementations in, but I am yet unsure about this.Please do tell me if you have any suggestions :).