Skip to content

Commit 9fd3398

Browse files
committed
Octospi support for RM0455 parts
Still some work needed upstream: OCTOSPI1 is named OCTOSPI1_CONTROL_REGISTER
1 parent 1193472 commit 9fd3398

File tree

2 files changed

+17
-8
lines changed

2 files changed

+17
-8
lines changed

src/xspi/mod.rs

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -373,13 +373,21 @@ mod common {
373373
}
374374

375375
pub(super) fn get_clock(clocks: &CoreClocks) -> Option<Hertz> {
376-
let d1ccipr = unsafe { (*stm32::RCC::ptr()).d1ccipr.read() };
377-
378-
match d1ccipr.$ccip().variant() {
379-
stm32::rcc::d1ccipr::[< $ccip:upper _A >]::RCC_HCLK3 => Some(clocks.hclk()),
380-
stm32::rcc::d1ccipr::[< $ccip:upper _A >]::PLL1_Q => clocks.pll1_q_ck(),
381-
stm32::rcc::d1ccipr::[< $ccip:upper _A >]::PLL2_R => clocks.pll2_r_ck(),
382-
stm32::rcc::d1ccipr::[< $ccip:upper _A >]::PER => clocks.per_ck(),
376+
#[cfg(not(feature = "rm0455"))]
377+
use stm32::rcc::d1ccipr as ccipr;
378+
#[cfg(feature = "rm0455")]
379+
use stm32::rcc::cdccipr as ccipr;
380+
381+
#[cfg(not(feature = "rm0455"))]
382+
let ccipr = unsafe { (*stm32::RCC::ptr()).d1ccipr.read() };
383+
#[cfg(feature = "rm0455")]
384+
let ccipr = unsafe { (*stm32::RCC::ptr()).cdccipr.read() };
385+
386+
match ccipr.$ccip().variant() {
387+
ccipr::[< $ccip:upper _A >]::RCC_HCLK3 => Some(clocks.hclk()),
388+
ccipr::[< $ccip:upper _A >]::PLL1_Q => clocks.pll1_q_ck(),
389+
ccipr::[< $ccip:upper _A >]::PLL2_R => clocks.pll2_r_ck(),
390+
ccipr::[< $ccip:upper _A >]::PER => clocks.per_ck(),
383391
}
384392
}
385393

@@ -795,7 +803,7 @@ mod common {
795803
#[cfg(any(feature = "rm0433", feature = "rm0399"))]
796804
xspi_impl! { stm32::QUADSPI, rec::Qspi, qspisel }
797805

798-
#[cfg(any(feature = "rm0455", feature = "rm0468"))]
806+
#[cfg(any(feature = "rm0468"))] // TODO feature = "rm0455"
799807
xspi_impl! { stm32::OCTOSPI1, rec::Octospi1, octospisel }
800808
#[cfg(any(feature = "rm0455", feature = "rm0468"))]
801809
xspi_impl! { stm32::OCTOSPI2, rec::Octospi2, octospisel }

src/xspi/octospi.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -342,5 +342,6 @@ macro_rules! octospi_impl {
342342
};
343343
}
344344

345+
#[cfg(any(feature = "rm0468"))] // TODO feature = "rm0455"
345346
octospi_impl! { octospi1_unchecked, stm32::OCTOSPI1, rec::Octospi1 }
346347
octospi_impl! { octospi2_unchecked, stm32::OCTOSPI2, rec::Octospi2 }

0 commit comments

Comments
 (0)