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

WIP: Attempt at DMA traits #26

Closed
wants to merge 5 commits into from

Conversation

nikhilkalige
Copy link

This does not work in any manner.

I am working on a Persistence of vision project of mine. I somehow need DMA to get the data rate high. This is my attempt at getting it to work.

I have tried to replicate the DMA design from the bluepill crate. I liked the move semantics used there. However I am not sure to get it working when you have serial stored in a structure.

Hopefully someone who is better than me at rust, can give some ideas and suggestions.. :)

@nikhilkalige
Copy link
Author

nikhilkalige commented Dec 30, 2017

I have implemented DMA for Spi in nikhilkalige/stm32f411-bsp

I have then tried to use the Spi in a driver for TLC5955 in nikhilkalige/tlc5955

Note: I created all the 3 Dma traits and later somewhat modified the DmaWrite trait, as that was one I needed first to get stuff going..

@nikhilkalige
Copy link
Author

Hmm.. May be it would make sense to use something like a Cell or RefCell to store a reference to spi in the driver.

@homunkulus
Copy link
Contributor

☔ The latest upstream changes (presumably #27) made this pull request unmergeable. Please resolve the merge conflicts.

//! DMA Interface

/// Static alias for DMA
pub type Static<T> = &'static mut T;
Copy link

Choose a reason for hiding this comment

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

I don't see this alias being used anywhere

Copy link
Contributor

@astro astro left a comment

Choose a reason for hiding this comment

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

Thank you for your initial submission.

type Transfer: dma::Transfer + ?Sized;

/// Recieve `words` from the slave.
fn recieve_dma<Buffer, Payload>(self, words: &'static mut Buffer) -> Self::Transfer
Copy link
Contributor

Choose a reason for hiding this comment

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

Spelling: receive_dma

Buffer: Unsize<[Word]>;
}

/// DMA Write mode
Copy link
Contributor

Choose a reason for hiding this comment

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

Documentation needs to be updated

type Payload;

/// Get buffer
fn deref(&self) -> &Self::Item;
Copy link
Contributor

Choose a reason for hiding this comment

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

Does it make sense to allow access to the data while the transfer is still ongoing?

pub trait Transfer {
/// Return type
type Item;
/// Return type
Copy link
Contributor

Choose a reason for hiding this comment

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

Documentation could be more helpful. What's the difference between Item and Payload?

@astro
Copy link
Contributor

astro commented Mar 20, 2018

I'm trying to implement DMA for the STM32F429. As my use-case is (gapless) audio, I'm interested in using it in a continuous (double-buffered/circular), not one-shot mode.

@japaric
Copy link
Member

japaric commented Apr 1, 2018

Thanks for the PR @nikhilkalige.

I think we should first design an API that meets all the requirements in #37 (comment) and then test it out of tree for a bit before landing any new struct / trait in this crate so I'm going to close this PR until we have a better idea of what pieces we want to land in this crate.

@japaric japaric closed this Apr 1, 2018
peckpeck pushed a commit to peckpeck/embedded-hal that referenced this pull request Nov 10, 2022
26: Transactional WriteRead r=ryankurte a=eldruin

This fixes rust-embedded#25 by implementing a transactional write-read without STOP in the middle.
It also fixes a type cast which was the only warning present.

Co-authored-by: Diego Barrios Romero <[email protected]>
peckpeck pushed a commit to peckpeck/embedded-hal that referenced this pull request Nov 10, 2022
27: Release 0.3.0 preparation r=ryankurte a=eldruin

I updated the changelog with everything that happened since the 0.2.2 release and bumped the minor version because of the digital::v2.
I also fixed setting the embedded-hal version to 0.2.3 because that is when the digital::v2 traits were released.
This branch sits on top of rust-embedded#26 with the hopeful date of today :)

Co-authored-by: Diego Barrios Romero <[email protected]>
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.

4 participants