Skip to content

Commit

Permalink
More consistent use of release instead of free/split functions
Browse files Browse the repository at this point in the history
  • Loading branch information
Windfisch committed May 20, 2021
1 parent 01635af commit bd5e011
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Expand Up @@ -25,6 +25,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/).

### Changed
- Use `cortex-m-rtic` instead of `cortex-m-rtfm` in the examples
- Renamed `serial`'s `RxDma`/`TxDma`'s `split` method into `release`
- Renamed I2C's `free` method into `release`

## [v0.7.0]- 2020-10-17

Expand Down
7 changes: 6 additions & 1 deletion src/i2c.rs
Expand Up @@ -385,9 +385,14 @@ where
}

/// Releases the I2C peripheral and associated pins
pub fn free(self) -> (I2C, PINS) {
pub fn release(self) -> (I2C, PINS) {
(self.i2c, self.pins)
}

#[deprecated(since = "0.7.1", note = "Please use release instead")]
pub fn free(self) -> (I2C, PINS) {
self.release()
}
}

impl<I2C, PINS> BlockingI2c<I2C, PINS>
Expand Down
8 changes: 8 additions & 0 deletions src/serial.rs
Expand Up @@ -563,7 +563,11 @@ macro_rules! serialdma {
}

impl $rxdma {
#[deprecated(since = "0.7.1", note = "Please use release instead")]
pub fn split(mut self) -> (Rx<$USARTX>, $dmarxch) {
self.release()
}
pub fn release(mut self) -> (Rx<$USARTX>, $dmarxch) {
self.stop();
unsafe { (*$USARTX::ptr()).cr3.write(|w| w.dmar().clear_bit()); }
let RxDma {payload, channel} = self;
Expand All @@ -575,7 +579,11 @@ macro_rules! serialdma {
}

impl $txdma {
#[deprecated(since = "0.7.1", note = "Please use release instead")]
pub fn split(mut self) -> (Tx<$USARTX>, $dmatxch) {
self.release()
}
pub fn release(mut self) -> (Tx<$USARTX>, $dmatxch) {
self.stop();
unsafe { (*$USARTX::ptr()).cr3.write(|w| w.dmat().clear_bit()); }
let TxDma {payload, channel} = self;
Expand Down

0 comments on commit bd5e011

Please sign in to comment.