Skip to content

Commit

Permalink
Add steal() for each peripheral
Browse files Browse the repository at this point in the history
  • Loading branch information
Jalon Huang committed May 26, 2023
1 parent e6a6d15 commit b02000d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/).
- Fix dangling implicit derives
- Fix escaping <> and & characters in doc attributes
- Add `interrupt_link_section` config parameter for controlling the `#[link_section = "..."]` attribute of `__INTERRUPTS`
- Add `steal()` for each peripheral

## [v0.28.0] - 2022-12-25

Expand Down
8 changes: 8 additions & 0 deletions src/generate/peripheral.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,10 @@ pub fn render(p_original: &Peripheral, index: &Index, config: &Config) -> Result
pub const fn ptr() -> *const #base::RegisterBlock {
Self::PTR
}

pub unsafe fn steal(&self) -> Self {
Self { _marker: PhantomData }
}
}

#feature_attribute_n
Expand Down Expand Up @@ -150,6 +154,10 @@ pub fn render(p_original: &Peripheral, index: &Index, config: &Config) -> Result
pub const fn ptr() -> *const #base::RegisterBlock {
Self::PTR
}

pub unsafe fn steal(&self) -> Self {
Self { _marker: PhantomData }
}
}

#feature_attribute
Expand Down

0 comments on commit b02000d

Please sign in to comment.