Skip to content

Commit 7558669

Browse files
committed
Rename Lap->Elapsed
1 parent 5c70be5 commit 7558669

File tree

6 files changed

+15
-12
lines changed

6 files changed

+15
-12
lines changed

CHANGELOG.md

+3
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ This project adheres to [Semantic Versioning](http://semver.org/).
88
- Add INPUTMUX and PINT peripherals
99
- Add example using PINT + INPUTMUX to make an external interrupt on a pin
1010

11+
## [v0.2.1] - 2021-05-02
12+
Fix the "lap" naming
13+
1114
## [v0.2.0] - 2021-05-02
1215
Bump lpc55-pac and cipher
1316
Replace homegrown "time" with embedded-time

Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "lpc55-hal"
3-
version = "0.2.0"
3+
version = "0.2.1"
44
edition = "2018"
55
description = "Hardware Abstraction Layer (HAL) for the NXP LPC55S6x ARM Cortex-33 microcontrollers"
66
repository = "https://github.com/nickray/lpc55-hal"

examples/ctimer.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ use cortex_m_semihosting::heprintln;
1111
use lpc55_hal as hal;
1212
use hal::prelude::*;
1313

14-
use hal::drivers::timer::Lap;
14+
use hal::drivers::timer::Elapsed;
1515

1616
#[macro_use(block)]
1717
extern crate nb;
@@ -41,7 +41,7 @@ fn main() -> ! {
4141
loop {
4242
cdriver.start(1_000_000.microseconds());
4343
dbg!(c * 1_000_000);
44-
dbg!(cdriver.lap().0);
44+
dbg!(cdriver.elapsed().0);
4545
c += 1;
4646
block!(cdriver.wait()).unwrap(); // blocks for 1 second
4747
}

examples/measure_frequency.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ use lpc55_hal as hal;
1414
use hal::{
1515
drivers::{
1616
Timer,
17-
timer::Lap,
17+
timer::Elapsed,
1818
},
1919
prelude::*,
2020
};
@@ -54,7 +54,7 @@ fn main() -> ! {
5454

5555
delay_cycles(10_000_000);
5656

57-
let us = timer.lap().0;
57+
let us = timer.elapsed().0;
5858
timer.cancel().ok();
5959

6060
heprintln!("{} MHz", 10_000_000 / us).ok();

src/drivers/timer.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ use crate::{
1212

1313
/// Return the current time elapsed for the timer.
1414
/// If the timer has not started or stopped, this unit may not be accurate.
15-
pub trait Lap <Unit>{
16-
fn lap(&self) -> Unit;
15+
pub trait Elapsed: timer::CountDown {
16+
fn elapsed(&self) -> Self::Time;
1717
}
1818

1919
pub struct Timer<TIMER>
@@ -40,9 +40,9 @@ where TIMER: Ctimer<init_state::Enabled> {
4040

4141
type TimeUnits = Microseconds;
4242

43-
impl <TIMER> Lap<TimeUnits> for Timer<TIMER>
43+
impl <TIMER> Elapsed for Timer<TIMER>
4444
where TIMER: Ctimer<init_state::Enabled> {
45-
fn lap(&self) -> TimeUnits{
45+
fn elapsed(&self) -> Microseconds {
4646
Microseconds(self.timer.tc.read().bits())
4747
}
4848
}

src/drivers/touch.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ use crate::{
1717
Pin,
1818
pins,
1919
timer,
20-
timer::Lap,
20+
timer::Elapsed,
2121
},
2222
peripherals::{
2323
ctimer,
@@ -416,7 +416,7 @@ pub fn profile_touch_sensing(touch_sensor: &mut TouchSensor<impl PinId, impl Pin
416416
times: &mut [u32],
417417
){
418418

419-
let start = delay_timer.lap().0;
419+
let start = delay_timer.elapsed().0;
420420
let results = touch_sensor.get_results();
421421

422422
delay_timer.start(300_000.microseconds());
@@ -426,7 +426,7 @@ pub fn profile_touch_sensing(touch_sensor: &mut TouchSensor<impl PinId, impl Pin
426426
for i in 0 .. 125 {
427427
if results[i] != 0 {
428428
if times[i] == 0 {
429-
times[i] = delay_timer.lap().0 - start;
429+
times[i] = delay_timer.elapsed().0 - start;
430430
copy[i] = results[i];
431431
}
432432
}

0 commit comments

Comments
 (0)