japaric / stm32f103xx-hal

HAL for the STM32F103xx family of microcontrollers
Apache License 2.0
115 stars 40 forks source link

Adding support for abitrary dma transfer #120

Open aurabindo opened 5 years ago

aurabindo commented 5 years ago

At the moment DMA can be done with peripherals. One cannot use the hal to configure the dma subsystem to have arbitrary dma transfers, or transfers triggered by Timer peripherals. How about adding some configuration api to Channels in addition to listen and unlisten ? Something like pub fn configure(&mut self, config: &DmaChannelConfig)

therealprof commented 5 years ago

@aurabindo You mean as an extension of the embedded-hal traits? Sounds like a good idea, feel free to propose it over at: https://github.com/rust-embedded/embedded-hal

aurabindo commented 5 years ago

@therealprof to add it to embedded-hal, we need to analyze how other microcontrollers do it as well for arriving at a common ground right?

therealprof commented 5 years ago

@aurabindo Yes, in a way you're right but that's nothing you should have to worry about.

First I'd recommend opening a ticket describing what functionality you'd like to achieve. Then someone (e.g. you if you'd like to give it a try) could add a PR adding that functionality and people will have a closer look at it and point if it needs to be extended or changed so it can be universally applied.

Of course you're welcome to try implementing this without embedded-hal traits (or hope for someone else to do it).

therealprof commented 5 years ago

@aurabindo I didn't mean to suggest this should be closed. I think it's a reasonable request and will certainly require some implementation in this crate.

aurabindo commented 5 years ago

@therealprof I just looked at the embedded hal crate, and it doesnt have anything related to DMA. However, this crate and many other do have an implementation. Does it mean it is beyond embedded-hal's scope?

therealprof commented 5 years ago

@aurabindo It just means no one has come up with a clever idea to design those traits yet.