diff --git a/CHANGELOG.md b/CHANGELOG.md index f674a847..109d37ea 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ ## [Unreleased] +Add FlexIO clock gates for all supported 1000 and 1100 targets. + ## [0.5.2] 2023-04-26 Add LPSPI API to configure the sample point. diff --git a/src/chip/imxrt10xx/ccm/clock_gate.rs b/src/chip/imxrt10xx/ccm/clock_gate.rs index 735dc9cd..0753eb22 100644 --- a/src/chip/imxrt10xx/ccm/clock_gate.rs +++ b/src/chip/imxrt10xx/ccm/clock_gate.rs @@ -298,6 +298,23 @@ where #[allow(clippy::assertions_on_constants)] const _: () = assert!(ral::SOLE_INSTANCE == 0u8); +/// Returns the FlexIO clock gate locator. +#[inline(always)] +pub const fn flexio() -> Locator +where + ral::flexio::Instance: ral::Valid, +{ + [ + locator(CCGR5, CG1), + locator(CCGR3, CG0), + locator(CCGR7, CG6), + ][if N == ral::SOLE_INSTANCE { + N as usize + } else { + N as usize - 1 + }] +} + /// Returns the FlexPWM clock gate locator. #[inline(always)] pub const fn flexpwm() -> Locator diff --git a/src/chip/imxrt11xx/ccm/clock_gate.rs b/src/chip/imxrt11xx/ccm/clock_gate.rs index 0fe820a1..31009f2c 100644 --- a/src/chip/imxrt11xx/ccm/clock_gate.rs +++ b/src/chip/imxrt11xx/ccm/clock_gate.rs @@ -188,3 +188,14 @@ where pub const fn snvs() -> Locator { Locator::new(38) } + +/// Returns the FlexIO clock gate locator. +#[inline] +pub const fn flexio() -> Locator +where + ral::pwm::Instance: ral::Valid, +{ + // FlexIO1 -> LPCG53 + // FlexIO2 -> LPCG54 + Locator::new(N as usize + 52) +}