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

return raw value from write/modify #873

Merged
merged 2 commits into from
Nov 3, 2024
Merged

return raw value from write/modify #873

merged 2 commits into from
Nov 3, 2024

Conversation

burrbull
Copy link
Member

@burrbull burrbull commented Oct 20, 2024

This looks not so beautiful like #738, but almost not breaking and allows to transfer data between writes with unsafe.

    let bits = rcc.apb1rstr().modify(|_, w| w.usart2rst().clear_bit());
    rcc.apb1rstr().write(|w| unsafe { // save on 1 read operation
        w.bits(bits).usart2rst().set_bit()
    });

@AdinAck

This comment was marked as off-topic.

@burrbull

This comment was marked as off-topic.

@AdinAck

This comment was marked as off-topic.

@AdinAck

This comment was marked as off-topic.

@burrbull

This comment was marked as off-topic.

@burrbull

This comment was marked as off-topic.

@AdinAck

This comment was marked as off-topic.

@AdinAck

This comment was marked as off-topic.

@burrbull

This comment was marked as off-topic.

@Emilgardis
Copy link
Member

Isn't this a huge change?

@burrbull
Copy link
Member Author

burrbull commented Nov 3, 2024

@Emilgardis let's merge this one too.

@Emilgardis
Copy link
Member

Hmm, I guess it shouldn't break to much, since people should have closed the expression with ;

@burrbull
Copy link
Member Author

burrbull commented Nov 3, 2024

Hmm, I guess it shouldn't break to much, since people should have closed the expression with ;

Compared to #738 this does not affect on expressions inside write, only outside.
For example in f1xx-hal there is only 18 places that require adding ;.

@burrbull burrbull added this pull request to the merge queue Nov 3, 2024
Merged via the queue into master with commit 99e3073 Nov 3, 2024
46 checks passed
@burrbull burrbull deleted the write-return-raw branch November 3, 2024 09:52
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.

3 participants