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 RegisterBlock trait #429

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Add RegisterBlock trait #429

wants to merge 1 commit into from

Conversation

burrbull
Copy link
Member

@burrbull burrbull requested a review from a team as a code owner January 12, 2020 15:10
@rust-highfive rust-highfive added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-tools labels Jan 12, 2020
TeXitoi
TeXitoi previously approved these changes Jan 12, 2020
@burrbull
Copy link
Member Author

burrbull commented Jun 2, 2020

Rebased.

cc @therealprof

We need this if we want to have generic implementation of some code (without macros), but Deref is unavailable for some reason. For example when we split USARTx on Tx and Rx.

@burrbull
Copy link
Member Author

burrbull commented Apr 17, 2021

The idea was proposed by @TeXitoi and instead of using macro let us to write something like

impl<USART> Tx<USART> where USART: RegisterBlock<RB=pac::usart1::RegisterBlock> {
    pub fn listen(&mut self) {
        unsafe { (*USART::rb()).cr1.modify(|_, w| w.txeie().set_bit()) };
    }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-tools
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants