Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SPI: Implement more SPI traits from embedded-hal 1.0.0-alpha.8 #101

Merged
merged 25 commits into from
Aug 17, 2022

Commits on Aug 17, 2022

  1. common/spi: Turn fifo size into const

    instead of hard-coding it into the code in various places.
    har7an committed Aug 17, 2022
    Configuration menu
    Copy the full SHA
    38fb8cd View commit details
    Browse the repository at this point in the history
  2. common/spi: Alias write_bytes to send_bytes

    since they share the same interface and the same code anyway.
    har7an committed Aug 17, 2022
    Configuration menu
    Copy the full SHA
    0fdc54b View commit details
    Browse the repository at this point in the history
  3. common/spi: Implement read_bytes

    as counterpart to `send_bytes` that is responsible only for reading
    bytes received via SPI.
    har7an committed Aug 17, 2022
    Configuration menu
    Copy the full SHA
    5d198f4 View commit details
    Browse the repository at this point in the history
  4. common/spi: Rewrite transfer

    to use `send_bytes` and `read_bytes` under the hood and remove duplicate
    code.
    har7an committed Aug 17, 2022
    Configuration menu
    Copy the full SHA
    c76ba07 View commit details
    Browse the repository at this point in the history
  5. common/spi: Create submodule for embedded_hal_1

    that is re-exported when the `eh1` feature flag is active. This removes
    lots of duplicate `#[cfg(...)]` macros previously part of the code.
    har7an committed Aug 17, 2022
    Configuration menu
    Copy the full SHA
    cc9e522 View commit details
    Browse the repository at this point in the history
  6. common/spi: Implement SpiBus and SpiBusWrite

    traits from the `embedded-hal 1.0.0-alpha.8`.
    har7an committed Aug 17, 2022
    Configuration menu
    Copy the full SHA
    9a9299b View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    ba1c781 View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    38b831d View commit details
    Browse the repository at this point in the history
  9. esp32-hal/examples/spi_eh1: Add huge transfer

    and bump the SPI speed to 1 MHz.
    har7an committed Aug 17, 2022
    Configuration menu
    Copy the full SHA
    1097877 View commit details
    Browse the repository at this point in the history
  10. common/spi: Apply rustfmt

    har7an committed Aug 17, 2022
    Configuration menu
    Copy the full SHA
    45fd580 View commit details
    Browse the repository at this point in the history
  11. common/spi: Use memcpy to read from registers

    This cuts down the time between consecutive transfers from about 2 ms
    to less than 1 ms.
    har7an committed Aug 17, 2022
    Configuration menu
    Copy the full SHA
    9a26920 View commit details
    Browse the repository at this point in the history
  12. WIP: common/spi: Use ptr::copy to fill write FIFO

    cutting down the time between transfers from just below 1 ms to ~370 us.
    
    The implementation is currently broken in that it will always fill the
    entire FIFO from the input it is given, even if that isn't FIFO-sized...
    har7an committed Aug 17, 2022
    Configuration menu
    Copy the full SHA
    4ead721 View commit details
    Browse the repository at this point in the history
  13. Configuration menu
    Copy the full SHA
    83bc3b4 View commit details
    Browse the repository at this point in the history
  14. Configuration menu
    Copy the full SHA
    558b29b View commit details
    Browse the repository at this point in the history
  15. esp32/examples/spi_eh1: Add conditional compile

    and compile a dummy instead when the "eh1" feature isn't present.
    har7an committed Aug 17, 2022
    Configuration menu
    Copy the full SHA
    68a52a6 View commit details
    Browse the repository at this point in the history
  16. esp32-hal: Ignore spi_eh1 example

    in normal builds, where the feature flag "eh1" isn't given. Building the
    example directly via `cargo build --example spi_eh1_loopback` will now
    print an error that this requires a feature flag to be active.
    har7an committed Aug 17, 2022
    Configuration menu
    Copy the full SHA
    37a9d9f View commit details
    Browse the repository at this point in the history
  17. common/spi: Use write_bytes

    and drop `send_bytes` instead. Previoulsy, both served the same purpose,
    but `send_bytes` was introduced more recently and is hence less likely
    to cause breaking changes in existing code.
    har7an committed Aug 17, 2022
    Configuration menu
    Copy the full SHA
    13c5cd7 View commit details
    Browse the repository at this point in the history
  18. common/spi: Fix mosi pin setup

    har7an committed Aug 17, 2022
    Configuration menu
    Copy the full SHA
    7d95e47 View commit details
    Browse the repository at this point in the history
  19. Add SPI examples with ehal 1.0.0-alpha8 traits

    to all targets.
    har7an committed Aug 17, 2022
    Configuration menu
    Copy the full SHA
    64fd4ea View commit details
    Browse the repository at this point in the history
  20. common/spi: Fix read behavior

    The previous `read` implementation would only read the contents of the
    SPI receive FIFO and return that as data. However, the `SpiBusRead`
    trait defines that while reading, bytes should be written out to the bus
    (Because SPI is transactional, without writing nothing can be read).
    
    Reimplements the `embedded-hal` traits to correctly implement this
    behavior.
    har7an committed Aug 17, 2022
    Configuration menu
    Copy the full SHA
    fbab507 View commit details
    Browse the repository at this point in the history
  21. common/spi: Use full FIFO size on all variants

    All esp variants except for the esp32s2 have a 64 byte FIFO, whereas the
    esp32s2 has a 72 byte FIFO.
    har7an committed Aug 17, 2022
    Configuration menu
    Copy the full SHA
    dd2ad09 View commit details
    Browse the repository at this point in the history
  22. Configuration menu
    Copy the full SHA
    50a695f View commit details
    Browse the repository at this point in the history
  23. common/spi: Fix reading bytes from FIFO

    by reverting to the old method of reading 32 bytes at a time and
    assembling the return buffer from that. It turns out that the previous
    `core::slice::from_raw_parts()` doesn't work for the esp32s2 and esp32s3
    variants, returning bogus data even though the correct data is present
    in the registers.
    har7an committed Aug 17, 2022
    Configuration menu
    Copy the full SHA
    4ceffd9 View commit details
    Browse the repository at this point in the history
  24. common/spi: Fix typos

    har7an committed Aug 17, 2022
    Configuration menu
    Copy the full SHA
    2d04587 View commit details
    Browse the repository at this point in the history
  25. Configuration menu
    Copy the full SHA
    1938c90 View commit details
    Browse the repository at this point in the history