added steal API for RxWithInterrupt #5

Merged
muellerr merged 1 commits from rx-with-interrupt-steal into main 2025-12-08 15:06:49 +01:00
2 changed files with 19 additions and 0 deletions

View File

@@ -8,6 +8,13 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
## [unreleased]
### Added
### Changed
- Added `RxWithInterrupt::steal`.
- Improved type level support for resource management for SPI, PWM, UART.
## [v0.2.0] 2025-09-03
Renamed to `vorago-shared-hal`

View File

@@ -1306,6 +1306,18 @@ impl RxWithInterrupt {
Self(rx)
}
/// Steal the RX peripheral with interrupt support for the given UART bank.
///
/// Can be useful to retrieve an instance in an interrupt if this instance is not used in the
/// main thread after initialization time.
///
/// # Safety
///
/// Circumvents the HAL ownership and safety guarantees.
pub unsafe fn steal(id: Bank) -> Self {
Self(unsafe { Rx::steal(id) })
}
/// This function should be called once at initialization time if the regular
/// [Self::on_interrupt] is used to read the UART receiver to enable and start the receiver.
pub fn start(&mut self) {