Skip to content

Commit 3b076a6

Browse files
authored
Merge pull request #204 from datdenkikniet/unsafe_delaycm
Add an unsafe and unchecked constructor to DelayCM
2 parents 616b770 + bfa0f6e commit 3b076a6

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/delay.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,14 @@ impl DelayCM {
101101
sysclk: clocks.sysclk(),
102102
}
103103
}
104+
105+
/// Create a new delay that is unchecked. The user needs to know the `sysclk`.
106+
///
107+
/// # Safety
108+
/// Sysclk must be the same as the actual clock frequency of the chip
109+
pub unsafe fn new_unchecked(sysclk: Hertz) -> Self {
110+
DelayCM { sysclk }
111+
}
104112
}
105113

106114
impl DelayMs<u32> for DelayCM {

0 commit comments

Comments
 (0)