Skip to content

Commit 4790ff4

Browse files
committed
write_raw
1 parent ea02ce9 commit 4790ff4

File tree

3 files changed

+12
-1
lines changed

3 files changed

+12
-1
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/).
77

88
## [Unreleased]
99

10+
- Add unsafe `write_bits` to all writtable registers
1011
- Revert #711
1112
- Add `defmt` impls for `TryFromInterruptError`, riscv interrupt enums
1213
- Fix calculating `modifiedWriteValues` bitmasks with field arrays

src/generate/generic.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -478,7 +478,7 @@ macro_rules! bit_proxy {
478478
pub const fn width(&self) -> u8 {
479479
Self::WIDTH
480480
}
481-
481+
482482
/// Field offset
483483
#[inline(always)]
484484
pub const fn offset(&self) -> u8 {

src/generate/generic_reg_vcell.rs

+10
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,16 @@ impl<REG: Writable> Reg<REG> {
179179

180180
result
181181
}
182+
183+
/// Writes raw value to register.
184+
///
185+
/// # Safety
186+
///
187+
/// Unsafe as it passes value without checks.
188+
#[inline(always)]
189+
pub unsafe fn write_bits(&self, bits: REG::Ux) {
190+
self.register.set(bits);
191+
}
182192
}
183193

184194
impl<REG: Readable + Writable> Reg<REG> {

0 commit comments

Comments
 (0)