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 inner and inner_mut functions to peripherals where it's easy to do so #306

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

mattico
Copy link
Contributor

@mattico mattico commented Jan 4, 2022

Where the registers are owned by a single struct and not shared amongst many channels, etc.

Fixes #232

…o so

Where the registers are owned by a single struct and not shared amongst many channels, etc.
Copy link
Member

@richardeoin richardeoin left a comment

Choose a reason for hiding this comment

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

Agreed these are all reasonable and safe. Some are implemented on types that are typically consumed quickly (like FMC) and thus aren't particularly useful, but still ok to include.

I'll leave the PR open for a bit in case anyone else wants to comment

@mattico
Copy link
Contributor Author

mattico commented Jan 5, 2022

I just added methods to access the peripheral in a DMA Transfer. My first thought was that these should be unsafe since you could read/write to registers while the DMA is reading/writing the same registers. However the hardware synchronizes register access in some fashion and pause() already gives access to the peripheral while the stream is executing. Feel like I might be missing something.

@richardeoin
Copy link
Member

richardeoin commented Jan 24, 2022

I'm less keen on those methods to access the peripheral in a DMA Transfer. Whilst I see your argument, I'd like to get more experience with actually using the DMA API before deciding what to do. You're right that pause() allows access, but it also mutates the stream state (disables it) so maybe more obvious for users what the outcome will be.

@richardeoin
Copy link
Member

@mattico Do you mind if I pick only the first commit and merge that for now?

@mattico
Copy link
Contributor Author

mattico commented Mar 14, 2022

@richardeoin fine with me!

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.

inner() for more peripherals
2 participants