diff --git a/CHANGELOG.md b/CHANGELOG.md index 90179db..e03bc55 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,9 @@ This project adheres to [Semantic Versioning](http://semver.org/). - Add INPUTMUX and PINT peripherals - Add example using PINT + INPUTMUX to make an external interrupt on a pin +## [v0.2.1] - 2021-05-02 +Fix the "lap" naming + ## [v0.2.0] - 2021-05-02 Bump lpc55-pac and cipher Replace homegrown "time" with embedded-time diff --git a/Cargo.toml b/Cargo.toml index fa461c8..e00c369 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "lpc55-hal" -version = "0.2.0" +version = "0.2.1" edition = "2018" description = "Hardware Abstraction Layer (HAL) for the NXP LPC55S6x ARM Cortex-33 microcontrollers" repository = "https://github.com/nickray/lpc55-hal" diff --git a/examples/ctimer.rs b/examples/ctimer.rs index 5548930..83039b7 100644 --- a/examples/ctimer.rs +++ b/examples/ctimer.rs @@ -11,7 +11,7 @@ use cortex_m_semihosting::heprintln; use lpc55_hal as hal; use hal::prelude::*; -use hal::drivers::timer::Lap; +use hal::drivers::timer::Elapsed; #[macro_use(block)] extern crate nb; @@ -41,7 +41,7 @@ fn main() -> ! { loop { cdriver.start(1_000_000.microseconds()); dbg!(c * 1_000_000); - dbg!(cdriver.lap().0); + dbg!(cdriver.elapsed().0); c += 1; block!(cdriver.wait()).unwrap(); // blocks for 1 second } diff --git a/examples/measure_frequency.rs b/examples/measure_frequency.rs index e00815b..e21a9b6 100644 --- a/examples/measure_frequency.rs +++ b/examples/measure_frequency.rs @@ -14,7 +14,7 @@ use lpc55_hal as hal; use hal::{ drivers::{ Timer, - timer::Lap, + timer::Elapsed, }, prelude::*, }; @@ -54,7 +54,7 @@ fn main() -> ! { delay_cycles(10_000_000); - let us = timer.lap().0; + let us = timer.elapsed().0; timer.cancel().ok(); heprintln!("{} MHz", 10_000_000 / us).ok(); diff --git a/src/drivers/timer.rs b/src/drivers/timer.rs index 6da581f..b381367 100644 --- a/src/drivers/timer.rs +++ b/src/drivers/timer.rs @@ -12,8 +12,8 @@ use crate::{ /// Return the current time elapsed for the timer. /// If the timer has not started or stopped, this unit may not be accurate. -pub trait Lap { - fn lap(&self) -> Unit; +pub trait Elapsed: timer::CountDown { + fn elapsed(&self) -> Self::Time; } pub struct Timer @@ -40,9 +40,9 @@ where TIMER: Ctimer { type TimeUnits = Microseconds; -impl Lap for Timer +impl Elapsed for Timer where TIMER: Ctimer { - fn lap(&self) -> TimeUnits{ + fn elapsed(&self) -> Microseconds { Microseconds(self.timer.tc.read().bits()) } } diff --git a/src/drivers/touch.rs b/src/drivers/touch.rs index 8d56876..dc22b70 100644 --- a/src/drivers/touch.rs +++ b/src/drivers/touch.rs @@ -17,7 +17,7 @@ use crate::{ Pin, pins, timer, - timer::Lap, + timer::Elapsed, }, peripherals::{ ctimer, @@ -416,7 +416,7 @@ pub fn profile_touch_sensing(touch_sensor: &mut TouchSensor