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

write_raw #802

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/).

## [Unreleased]

- Add unsafe `write_bits` to all writtable registers
- Revert #711
- Add `defmt` impls for `TryFromInterruptError`, riscv interrupt enums
- Fix calculating `modifiedWriteValues` bitmasks with field arrays
Expand Down
2 changes: 1 addition & 1 deletion src/generate/generic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -478,7 +478,7 @@ macro_rules! bit_proxy {
pub const fn width(&self) -> u8 {
Self::WIDTH
}

/// Field offset
#[inline(always)]
pub const fn offset(&self) -> u8 {
Expand Down
10 changes: 10 additions & 0 deletions src/generate/generic_reg_vcell.rs
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,16 @@ impl<REG: Writable> Reg<REG> {

result
}

/// Writes raw value to register.
///
/// # Safety
///
/// Unsafe as it passes value without checks.
#[inline(always)]
pub unsafe fn write_bits(&self, bits: REG::Ux) {
self.register.set(bits);
}
}

impl<REG: Readable + Writable> Reg<REG> {
Expand Down
Loading