Skip to content

Commit

Permalink
write_raw
Browse files Browse the repository at this point in the history
  • Loading branch information
burrbull committed Nov 5, 2024
1 parent ea02ce9 commit 4790ff4
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
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

0 comments on commit 4790ff4

Please sign in to comment.