STM32H7xx-hal SPI reconfiguration of mode

Hi,
I'm relatively new with Rust and have been stuck on an internal mutability issue.

I'm using the STM32H7xx-hal. I have a board that requires me to use one SPI port with two different devices and each device has a different SPI mode setting. Does anyone know how to re-configure/re-program an SPI port to change the mode setting.

Here is an example where the spi3 is initialized ...

I've tried various things like the following ...

spi1.inner_mut().cfg2.write(|w| w.cpha().set_bit());
spi1.inner().cfg2.write(|w| w.cpha().set_bit());

but it says multiple applicable items in scope. Is there another way to do this?

Nathan

Can you post the output from cargo check (wrapped in ``` to make a code block) ?

The error here may be that something here implement traits with conflicting method names.

// instead of:
value.method();
// do:
TraitName::method(&value);

Hi,
Here is the error when I try using the inner() syntax.

   --> src/bin/aom_driver.rs:489:14
    |
489 |         spi1.inner().cfg2.write(|w| w.cpha().set_bit());
    |              ^^^^^ multiple `inner` found
    |
    = note: candidate #1 is defined in an impl for the type `Spi<stm32h7xx_hal::stm32::SPI1, EN>`
    = note: candidate #2 is defined in an impl for the type `Spi<stm32h7xx_hal::stm32::SPI1, EN, u16>`
    = note: candidate #3 is defined in an impl for the type `Spi<stm32h7xx_hal::stm32::SPI1, EN, u32>`
    = note: candidate #4 is defined in an impl for the type `Spi<stm32h7xx_hal::stm32::SPI2, EN>`
    = note: and 14 others

For more information about this error, try `rustc --explain E0034`.

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.