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 access_banks flash accessor #489

Merged
merged 2 commits into from
Mar 21, 2024

Conversation

Abestanis
Copy link
Contributor

This adds a access_banks helper to the FlashExt, which is a middle ground between access_bank1 and split.

Problem

Right now the only way to access bank 2 is using the split method, which consumes the FLASH instance. In my usecase I want to access both flash banks but I also need to flip the banks at some point, so I need to have access to the option control register via FLASH::optcr(&self), which needs the FLASH instance.

Solution

Using the new access_banks helper I can keep the FLASH instance around and get access to both banks as well as the option control register when I need it.

@richardeoin
Copy link
Member

This looks useful, and I don't think it breaks any existing assumptions. After all it doesn't modify registers.

It would be interesting to know if similar crates (stm32-rs/stm32f4xx-hal or stm32-rs/stm32f7xx-hal perhaps) already have methods like this

@Abestanis
Copy link
Contributor Author

@richardeoin
Copy link
Member

Nice, I appreciate for the summary. Given this crate's abstraction over the banks these methods definitely make sense. Thanks again for the contribution!

@richardeoin richardeoin added this pull request to the merge queue Mar 21, 2024
Merged via the queue into stm32-rs:master with commit 0d1ab22 Mar 21, 2024
22 checks passed
@Abestanis Abestanis deleted the feature/banks_and_regs branch March 22, 2024 17:43
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.

2 participants