Skip to content

Commit 7245b99

Browse files
hannobraunYatekii
authored andcommitted
Remove ClocksExt
1 parent bb2d65e commit 7245b99

File tree

4 files changed

+8
-19
lines changed

4 files changed

+8
-19
lines changed

nrf52-hal-common/src/clocks.rs

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,6 @@ pub struct LfOscStarted;
2020
/// Low Frequency Clock Stopped
2121
pub struct LfOscStopped;
2222

23-
/// Extension trait for the CLOCK peripheral
24-
pub trait ClocksExt {
25-
fn constrain(self) -> Clocks<Internal, Internal, LfOscStopped>;
26-
}
27-
2823
/// High Frequency Clock Frequency (in Hz)
2924
pub const HFCLK_FREQ: u32 = 64_000_000;
3025
/// Low Frequency Clock Frequency (in Hz)
@@ -39,6 +34,14 @@ pub struct Clocks<H, L, LSTAT> {
3934
}
4035

4136
impl<H, L, LSTAT> Clocks<H, L, LSTAT> {
37+
pub fn new(clock: CLOCK) -> Clocks<Internal, Internal, LfOscStopped> {
38+
Clocks {
39+
hfclk: Internal,
40+
lfclk: Internal,
41+
lfstat: LfOscStopped,
42+
periph: clock,
43+
}
44+
}
4245
/// Use an external oscillator as the high frequency clock source
4346
pub fn enable_ext_hfosc(self) -> Clocks<ExternalOscillator, L, LSTAT> {
4447
self.periph.tasks_hfclkstart.write(|w| unsafe { w.bits(1) });
@@ -157,14 +160,3 @@ impl<H, L> Clocks<H, L, LfOscStopped> {
157160
}
158161
}
159162
}
160-
161-
impl ClocksExt for CLOCK {
162-
fn constrain(self) -> Clocks<Internal, Internal, LfOscStopped> {
163-
Clocks {
164-
hfclk: Internal,
165-
lfclk: Internal,
166-
lfstat: LfOscStopped,
167-
periph: self,
168-
}
169-
}
170-
}

nrf52-hal-common/src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ pub mod uarte;
2727
pub mod prelude {
2828
pub use crate::hal::prelude::*;
2929

30-
pub use crate::clocks::ClocksExt;
3130
pub use crate::gpio::GpioExt;
3231
pub use crate::time::U32Ext;
3332
}

nrf52810-hal/src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ pub mod prelude {
88
pub use crate::hal::prelude::*;
99
pub use nrf52_hal_common::prelude::*;
1010

11-
pub use crate::clocks::ClocksExt;
1211
pub use crate::gpio::GpioExt;
1312
pub use crate::time::U32Ext;
1413
}

nrf52840-hal/src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ pub mod prelude {
88
pub use crate::hal::prelude::*;
99
pub use nrf52_hal_common::prelude::*;
1010

11-
pub use crate::clocks::ClocksExt;
1211
pub use crate::gpio::GpioExt;
1312
pub use crate::time::U32Ext;
1413
}

0 commit comments

Comments
 (0)