From 0c0597f775e3197b87e9370f390ccc3814b637a1 Mon Sep 17 00:00:00 2001 From: Liam Murphy Date: Tue, 29 Jun 2021 12:07:10 +1000 Subject: [PATCH] Don't include extended timer support on chips without it --- embassy-nrf/src/timer.rs | 84 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 84 insertions(+) diff --git a/embassy-nrf/src/timer.rs b/embassy-nrf/src/timer.rs index a96c6a82..0f37a6d6 100644 --- a/embassy-nrf/src/timer.rs +++ b/embassy-nrf/src/timer.rs @@ -206,7 +206,19 @@ impl<'d, T: Instance> Timer<'d, T> { 1 => w.compare1().clear(), 2 => w.compare2().clear(), 3 => w.compare3().clear(), + #[cfg(any( + feature = "nrf52805", + feature = "nrf52811", + feature = "nrf52820", + feature = "nrf52833", + ))] 4 => w.compare4().clear(), + #[cfg(any( + feature = "nrf52805", + feature = "nrf52811", + feature = "nrf52820", + feature = "nrf52833", + ))] 5 => w.compare5().clear(), _ => unreachable!("No timers have more than 6 CC registers"), }); @@ -291,7 +303,19 @@ impl<'a, T: Instance> Cc<'a, T> { 1 => w.compare1_clear().enabled(), 2 => w.compare2_clear().enabled(), 3 => w.compare3_clear().enabled(), + #[cfg(any( + feature = "nrf52805", + feature = "nrf52811", + feature = "nrf52820", + feature = "nrf52833", + ))] 4 => w.compare4_clear().enabled(), + #[cfg(any( + feature = "nrf52805", + feature = "nrf52811", + feature = "nrf52820", + feature = "nrf52833", + ))] 5 => w.compare5_clear().enabled(), _ => unreachable!("a `Cc` cannot be created with `n > 5`"), }) @@ -304,7 +328,19 @@ impl<'a, T: Instance> Cc<'a, T> { 1 => w.compare1_clear().disabled(), 2 => w.compare2_clear().disabled(), 3 => w.compare3_clear().disabled(), + #[cfg(any( + feature = "nrf52805", + feature = "nrf52811", + feature = "nrf52820", + feature = "nrf52833", + ))] 4 => w.compare4_clear().disabled(), + #[cfg(any( + feature = "nrf52805", + feature = "nrf52811", + feature = "nrf52820", + feature = "nrf52833", + ))] 5 => w.compare5_clear().disabled(), _ => unreachable!("a `Cc` cannot be created with `n > 5`"), }) @@ -321,7 +357,19 @@ impl<'a, T: Instance> Cc<'a, T> { 1 => w.compare1_stop().enabled(), 2 => w.compare2_stop().enabled(), 3 => w.compare3_stop().enabled(), + #[cfg(any( + feature = "nrf52805", + feature = "nrf52811", + feature = "nrf52820", + feature = "nrf52833", + ))] 4 => w.compare4_stop().enabled(), + #[cfg(any( + feature = "nrf52805", + feature = "nrf52811", + feature = "nrf52820", + feature = "nrf52833", + ))] 5 => w.compare5_stop().enabled(), _ => unreachable!("a `Cc` cannot be created with `n > 5`"), }) @@ -334,7 +382,19 @@ impl<'a, T: Instance> Cc<'a, T> { 1 => w.compare1_stop().disabled(), 2 => w.compare2_stop().disabled(), 3 => w.compare3_stop().disabled(), + #[cfg(any( + feature = "nrf52805", + feature = "nrf52811", + feature = "nrf52820", + feature = "nrf52833", + ))] 4 => w.compare4_stop().disabled(), + #[cfg(any( + feature = "nrf52805", + feature = "nrf52811", + feature = "nrf52820", + feature = "nrf52833", + ))] 5 => w.compare5_stop().disabled(), _ => unreachable!("a `Cc` cannot be created with `n > 5`"), }) @@ -352,7 +412,19 @@ impl<'a, T: Instance> Cc<'a, T> { 1 => w.compare1().set(), 2 => w.compare2().set(), 3 => w.compare3().set(), + #[cfg(any( + feature = "nrf52805", + feature = "nrf52811", + feature = "nrf52820", + feature = "nrf52833", + ))] 4 => w.compare4().set(), + #[cfg(any( + feature = "nrf52805", + feature = "nrf52811", + feature = "nrf52820", + feature = "nrf52833", + ))] 5 => w.compare5().set(), _ => unreachable!("a `Cc` cannot be created with `n > 5`"), }); @@ -364,7 +436,19 @@ impl<'a, T: Instance> Cc<'a, T> { 1 => w.compare1().clear(), 2 => w.compare2().clear(), 3 => w.compare3().clear(), + #[cfg(any( + feature = "nrf52805", + feature = "nrf52811", + feature = "nrf52820", + feature = "nrf52833", + ))] 4 => w.compare4().clear(), + #[cfg(any( + feature = "nrf52805", + feature = "nrf52811", + feature = "nrf52820", + feature = "nrf52833", + ))] 5 => w.compare5().clear(), _ => unreachable!("a `Cc` cannot be created with `n > 5`"), });