Skip to content

Commit

Permalink
Rename AlreadyCancled to AlreadyCanceled
Browse files Browse the repository at this point in the history
  • Loading branch information
sunsided committed Jun 29, 2024
1 parent b0cead1 commit 19ec071
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 9 deletions.
4 changes: 2 additions & 2 deletions src/syscfg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,10 @@ impl SysCfg {
///
/// This means, that only on of `PA1`, `PB1`, `PC1`, ... can be activated.
///
/// For example, if first [`crate::gpio::gpioa::PA1`] and than [`crate::gpio::gpiob::PB1`]
/// For example, if first [`crate::gpio::gpioa::PA1`] and then [`crate::gpio::gpiob::PB1`]
/// would be configured, the former configuration would be overwritten.
///
/// But configuring `PA1` and and `PB2` works!
/// But configuring `PA1` and `PB2` works!
#[doc(alias = "enable_interrupt")]
pub fn select_exti_interrupt_source<Gpio, Index, Mode>(&mut self, pin: &Pin<Gpio, Index, Mode>)
where
Expand Down
14 changes: 9 additions & 5 deletions src/timer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ where
}

/// Wait until [`Event::Update`] / the timer has elapsed
/// and than clear the event.
/// and then clear the event.
fn wait(&mut self) -> nb::Result<(), Void> {
if self.tim.is_sr_uief_set() {
self.clear_event(Event::Update);
Expand All @@ -328,20 +328,24 @@ where
}
}

/// Error if a [`Cancel`]-ble [`Timer`] was cancled already or never been started.
/// Error if a [`Cancel`]-ble [`Timer`] was canceled already or never been started.
#[deprecated(note = "Use `AlreadyCanceled` instead of `AlreadyCancled`.")]
pub type AlreadyCancled = AlreadyCanceled;

/// Error if a [`Cancel`]-ble [`Timer`] was canceled already or never been started.
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub struct AlreadyCancled;
pub struct AlreadyCanceled;

impl<TIM> Cancel for Timer<TIM>
where
TIM: Instance,
{
type Error = AlreadyCancled;
type Error = AlreadyCanceled;
fn cancel(&mut self) -> Result<(), Self::Error> {
// If timer is already stopped.
if !self.tim.is_cr1_cen_set() {
return Err(AlreadyCancled);
return Err(AlreadyCanceled);
}
self.stop();
Ok(())
Expand Down
4 changes: 2 additions & 2 deletions testsuite/tests/timer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ use hal::hal::timer::Cancel;
use hal::interrupts::InterruptNumber;
use hal::rcc::{Clocks, APB1};
use hal::time::{duration, fixed_point::FixedPoint};
use hal::timer::{AlreadyCancled, Event, MonoTimer, Timer};
use hal::timer::{AlreadyCanceled, Event, MonoTimer, Timer};
use hal::{interrupt, pac, prelude::*};

use pac::TIM2;
Expand Down Expand Up @@ -125,7 +125,7 @@ mod tests {
state.delay.delay_ms(5u32);

assert_eq!(timer.cancel(), Ok(()));
assert_eq!(timer.cancel(), Err(AlreadyCancled));
assert_eq!(timer.cancel(), Err(AlreadyCanceled));
state.timer = Some(timer);
}

Expand Down

0 comments on commit 19ec071

Please sign in to comment.