Skip to content

Commit

Permalink
write_raw
Browse files Browse the repository at this point in the history
  • Loading branch information
burrbull committed Jan 23, 2024
1 parent 869d34f commit 7ae1e97
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/).
## [Unreleased]

- Add `base-address-shift` config flag
- Add `write_raw` to all writtable registers

## [v0.31.5] - 2024-01-04

Expand Down
14 changes: 13 additions & 1 deletion src/generate/generic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,18 @@ impl<REG: Writable> Reg<REG> {
}
}

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

impl<REG: Readable + Writable> Reg<REG> {
/// Modifies the contents of the register by reading and then writing it.
///
Expand Down Expand Up @@ -550,7 +562,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

0 comments on commit 7ae1e97

Please sign in to comment.