Skip to content

Changing SPI clock is unexpectedly expensive #1666

Closed
@ProfFan

Description

@ProfFan

Changing the SPI frequency essentially goes to

self.setup(frequency, clocks);

which is a loop-based search. However in situations like multi-slave SPI bus with different clocks, this will need to be executed many times.

Don't know what is the best way, could

  1. add forced inlining to the logic
  2. add a shortcut when the clock speed is multiples of clk_spi_mst/32 as this is the most common scenario
  3. add a static cache for computed values?

XREF: rust-embedded/embedded-hal#605

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions