Skip to content

Commit

Permalink
Fix unused imports lint (again) and NUM_SERCOM definitions
Browse files Browse the repository at this point in the history
  • Loading branch information
jbeaurivage committed Jan 24, 2024
1 parent 82de325 commit 08ca83c
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 5 deletions.
7 changes: 6 additions & 1 deletion hal/src/async_hal/timer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,23 @@ use crate::thumbv6m::timer;
use crate::thumbv7em::timer;

#[cfg(feature = "has-tc1")]
#[allow(unused_imports)]
use crate::pac::TC1;

#[cfg(all(feature = "has-tc2", not(feature = "samd11")))]
#[cfg(feature = "has-tc2")]
#[allow(unused_imports)]
use crate::pac::TC2;

#[cfg(feature = "has-tc3")]
#[allow(unused_imports)]
use crate::pac::TC3;

#[cfg(feature = "has-tc4")]
#[allow(unused_imports)]
use crate::pac::TC4;

#[cfg(feature = "has-tc5")]
#[allow(unused_imports)]
use crate::pac::TC5;

use timer::{Count16, TimerCounter};
Expand Down
17 changes: 13 additions & 4 deletions hal/src/sercom/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -163,19 +163,28 @@ sercom!(apbbmask: (2, 3));
sercom!(apbdmask: (4, 7));

#[allow(dead_code)]
#[cfg(feature = "samd11")]
#[cfg(all(
feature = "has-sercom1",
not(feature = "has-sercom3"),
not(feature = "has-sercom5"),
not(feature = "has-sercom7")
))]
const NUM_SERCOM: usize = 2;

#[allow(dead_code)]
#[cfg(feature = "samd21e")]
#[cfg(all(
feature = "has-sercom3",
not(feature = "has-sercom5"),
not(feature = "has-sercom7")
))]
const NUM_SERCOM: usize = 4;

#[allow(dead_code)]
#[cfg(any(feature = "periph-d21g", feature = "samd51g", feature = "samd51j"))]
#[cfg(all(feature = "has-sercom5", not(feature = "has-sercom7")))]
const NUM_SERCOM: usize = 6;

#[allow(dead_code)]
#[cfg(feature = "periph-d51n")]
#[cfg(feature = "has-sercom7")]
const NUM_SERCOM: usize = 8;

#[cfg(feature = "async")]
Expand Down

0 comments on commit 08ca83c

Please sign in to comment.