Skip to content

Commit 0605447

Browse files
bors[bot]burrbull
andauthored
Merge #333
333: deprecate free in favour of release r=therealprof a=burrbull Co-authored-by: Andrey Zgarbul <zgarbul.andrey@gmail.com>
2 parents 7c944ff + a6953c6 commit 0605447

File tree

5 files changed

+22
-3
lines changed

5 files changed

+22
-3
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
3939

4040
### Changed
4141

42+
- Deprecate `free` in favour of `release`
4243
- Clean features in `serial`
4344
- Internal implementation of GPIO Pin API changed to use Const Generics
4445
- Update the sdio driver to match the changes in the PAC

src/crc32.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,12 @@ impl Crc32 {
117117
self.periph.dr.read().bits()
118118
}
119119

120-
/// Consume the HAL peripheral, returning the PAC peripheral
120+
#[deprecated(since = "0.10.0", note = "Please use release instead")]
121121
pub fn free(self) -> CRC {
122+
self.release()
123+
}
124+
/// Consume the HAL peripheral, returning the PAC peripheral
125+
pub fn release(self) -> CRC {
122126
unsafe {
123127
// NOTE(unsafe) this reference will only be used for atomic writes with no side effects.
124128
let rcc = &(*RCC::ptr());

src/delay.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,13 @@ impl Delay {
2121
Delay { clocks, syst }
2222
}
2323

24-
/// Releases the system timer (SysTick) resource
24+
#[deprecated(since = "0.10.0", note = "Please use release instead")]
2525
pub fn free(self) -> SYST {
26+
self.release()
27+
}
28+
29+
/// Releases the system timer (SysTick) resource
30+
pub fn release(self) -> SYST {
2631
self.syst
2732
}
2833
}

src/dma/mod.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1301,8 +1301,12 @@ where
13011301
self.stream.disable()
13021302
}
13031303

1304+
#[deprecated(since = "0.10.0", note = "Please use release instead")]
1305+
pub fn free(self) -> (STREAM, PERIPHERAL, BUF, Option<BUF>) {
1306+
self.release()
1307+
}
13041308
/// Stops the stream and returns the underlying resources.
1305-
pub fn free(mut self) -> (STREAM, PERIPHERAL, BUF, Option<BUF>) {
1309+
pub fn release(mut self) -> (STREAM, PERIPHERAL, BUF, Option<BUF>) {
13061310
self.stream.disable();
13071311
compiler_fence(Ordering::SeqCst);
13081312
self.stream.clear_interrupts();

src/spi.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -714,6 +714,11 @@ where
714714
self.spi.sr.read().ovr().bit_is_set()
715715
}
716716

717+
pub fn release(self) -> (SPI, PINS) {
718+
(self.spi, self.pins)
719+
}
720+
721+
#[deprecated(since = "0.10.0", note = "Please use release instead")]
717722
pub fn free(self) -> (SPI, PINS) {
718723
(self.spi, self.pins)
719724
}

0 commit comments

Comments
 (0)