Skip to content

Commit

Permalink
Remove deprecated APIs for 0.6 release
Browse files Browse the repository at this point in the history
See the changelog for details.
  • Loading branch information
mciantyre committed Jul 17, 2024
1 parent 5302e9f commit 9d7765d
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 93 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@
**BREAKING** Update `imxrt-usbd` to 0.3. Users are required to update to
`usb-device` 0.3 and its compatible dependencies.

**BREAKING** Remove deprecated APIs

- `clko2::Selection::TracClk`
- `timer::*PitChan`
- `lpspi::Disabled::{set_mode, set_watermark}`

## [0.5.6] 2024-07-05

- Add LPSPI low-level clock configuration APIs.
Expand Down
12 changes: 0 additions & 12 deletions src/chip/imxrt10xx/imxrt1010.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,18 +117,6 @@ pub(crate) mod ccm {
/// SPDIF0 clock root.
Spdif0Clk = 0b11101,
}

impl Clko2Selection {
/// Trace clock root.
///
/// Prefer [`TraceClk`](Self::TraceClk), which is correctly spelled.
#[deprecated(
since = "0.5.1",
note = "Use the correctly-spelled 'TraceClk' variant."
)]
#[allow(non_upper_case_globals)]
pub const TracClk: Clko2Selection = Clko2Selection::TraceClk;
}
}

ccm_flexio!(
Expand Down
35 changes: 3 additions & 32 deletions src/common/lpspi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -556,7 +556,7 @@ impl<P, const N: u8> Lpspi<P, N> {
/// The handle to a [`Disabled`](crate::lpspi::Disabled) driver lets you modify
/// LPSPI settings that require a fully disabled peripheral.
pub fn disabled<R>(&mut self, func: impl FnOnce(&mut Disabled<N>) -> R) -> R {
let mut disabled = Disabled::new(&mut self.lpspi, &mut self.mode);
let mut disabled = Disabled::new(&mut self.lpspi);
func(&mut disabled)
}

Expand Down Expand Up @@ -1134,29 +1134,19 @@ fn set_watermark(lpspi: &ral::lpspi::RegisterBlock, direction: Direction, waterm
/// An LPSPI peripheral which is temporarily disabled.
pub struct Disabled<'a, const N: u8> {
lpspi: &'a ral::lpspi::Instance<N>,
mode: &'a mut Mode,
men: bool,
}

impl<'a, const N: u8> Disabled<'a, N> {
fn new(lpspi: &'a mut ral::lpspi::Instance<N>, mode: &'a mut Mode) -> Self {
fn new(lpspi: &'a mut ral::lpspi::Instance<N>) -> Self {
let men = ral::read_reg!(ral::lpspi, lpspi, CR, MEN == MEN_1);

// Request disable
ral::modify_reg!(ral::lpspi, lpspi, CR, MEN: MEN_0);
// Wait for the driver to finish its current transfer
// and enter disabled state
while ral::read_reg!(ral::lpspi, lpspi, CR, MEN == MEN_1) {}
Self { lpspi, mode, men }
}

/// Set the SPI mode for the peripheral
#[deprecated(
since = "0.5.5",
note = "Use Lpspi::set_mode to change modes while enabled."
)]
pub fn set_mode(&mut self, mode: Mode) {
*self.mode = mode;
Self { lpspi, men }
}

/// Set the LPSPI clock speed (Hz).
Expand All @@ -1180,25 +1170,6 @@ impl<'a, const N: u8> Disabled<'a, N> {
);
}

/// Set the watermark level for a given direction.
///
/// Returns the watermark level committed to the hardware. This may be different
/// than the supplied `watermark`, since it's limited by the hardware.
///
/// When `direction == Direction::Rx`, the receive data flag is set whenever the
/// number of words in the receive FIFO is greater than `watermark`.
///
/// When `direction == Direction::Tx`, the transmit data flag is set whenever the
/// the number of words in the transmit FIFO is less than, or equal, to `watermark`.
#[inline]
#[deprecated(
since = "0.5.5",
note = "Use Lpspi::set_watermark to change watermark while enabled"
)]
pub fn set_watermark(&mut self, direction: Direction, watermark: u8) -> u8 {
set_watermark(self.lpspi, direction, watermark)
}

/// Set the sampling point of the LPSPI peripheral.
///
/// When set to `SamplePoint::DelayedEdge`, the LPSPI will sample the input data
Expand Down
34 changes: 0 additions & 34 deletions src/common/timer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -383,29 +383,12 @@ fn prepare_gpt<const N: u8>(gpt: &mut gpt::Gpt<N>) {
/// A single PIT channel that acts as a blocking timer.
pub type BlockingPit<const N: u8, const HZ: u32> = Blocking<pit::Pit<N>, HZ>;

/// A single PIT channel that acts as a blocking timer.
///
/// Prefer [`BlockingPit`], which is easier to type. It is also more
/// distinct than [`BlockingPitChain`], which varies from `BlockingPitChan`
/// by only one letter.
#[deprecated(since = "0.5.1", note = "Use BlockingPit")]
pub type BlockingPitChan<const N: u8, const HZ: u32> = BlockingPit<N, HZ>;

impl<const N: u8, const HZ: u32> BlockingPit<N, HZ> {
/// Create a blocking adapter from a PIT channel.
pub fn from_pit(mut pit: pit::Pit<N>) -> Self {
prepare_pit(&mut pit);
Self::new(pit)
}

/// Create a blocking adapter from a PIT channel.
///
/// Prefer [`from_pit`](Self::from_pit), which is easier to type
/// and matches the name of the type we're converting.
#[deprecated(since = "0.5.1", note = "Use from_pit")]
pub fn from_pit_channel(pit: pit::Pit<N>) -> Self {
Self::from_pit(pit)
}
}

/// A chain of PIT channels that act as a blocking timer.
Expand Down Expand Up @@ -529,29 +512,12 @@ where
/// A count down timer over a PIT channel.
pub type RawCountDownPit<const N: u8> = RawCountDown<pit::Pit<N>>;

/// A count down timer over a PIT channel.
///
/// Prefer [`RawCountDownPit`], which is easier to type. It is also more
/// distinct than [`RawCountDownPitChain`], which varies from `RawCountDownPitChan`
/// by only one letter.
#[deprecated(since = "0.5.1", note = "Use RawCountDownPit")]
pub type RawCountDownPitChan<const N: u8> = RawCountDownPit<N>;

impl<const N: u8> RawCountDownPit<N> {
/// Create a count down timer from a PIT channel.
pub fn from_pit(mut pit: pit::Pit<N>) -> Self {
prepare_pit(&mut pit);
Self::new(pit)
}

/// Create a count down timer from a PIT channel.
///
/// Prefer [`from_pit`](Self::from_pit), which is easier to type
/// and matches the name of the type we're converting.
#[deprecated(since = "0.5.1", note = "Use from_pit")]
pub fn from_pit_channel(pit: pit::Pit<N>) -> Self {
Self::from_pit(pit)
}
}

/// A count down timer over two chained PIT channels.
Expand Down
15 changes: 0 additions & 15 deletions tests/1010_trace_clk_rename.rs

This file was deleted.

0 comments on commit 9d7765d

Please sign in to comment.