diff --git a/src/lib.rs b/src/lib.rs index c3862ae..8523e53 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -16,6 +16,13 @@ pub fn delay_cycles() { Delayer::::delay_impl() } +#[macro_export] +macro_rules! delay_cycles { + ($t:expr) => { + $crate::delay_cycles::<{ $t }>() + }; +} + /// Maximum value is (25_769_803_784 * 1_000_000 / CPU_FREQUENCY_HZ). /// Almost 18 minutes at 24Mhz. #[inline(always)] @@ -23,6 +30,13 @@ pub fn delay_us() { Delayer::::delay_impl() } +#[macro_export] +macro_rules! delay_us { + ($t:expr) => { + $crate::delay_us::<{ $t }>() + }; +} + /// Maximum value is (25_769_803_784 * 1_000 / CPU_FREQUENCY_HZ). /// Almost 18 minutes at 24Mhz. #[inline(always)] @@ -30,6 +44,13 @@ pub fn delay_ms() { Delayer::::delay_impl() } +#[macro_export] +macro_rules! delay_ms { + ($t:expr) => { + $crate::delay_ms::<{ $t }>() + }; +} + /// Maximum value is (25_769_803_784 * 1 / CPU_FREQUENCY_HZ). /// Almost 18 minutes at 24Mhz. #[inline(always)] @@ -37,6 +58,13 @@ pub fn delay_sec() { Delayer::::delay_impl() } +#[macro_export] +macro_rules! delay_sec { + ($t:expr) => { + $crate::delay_sec::<{ $t }>() + }; +} + #[cfg(test)] mod tests { #[test]