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

feat(embassy-arch): provide peripheral-independent I2C and SPI types #317

Draft
wants to merge 95 commits into
base: main
Choose a base branch
from

Conversation

ROMemories
Copy link
Collaborator

@ROMemories ROMemories commented Jun 12, 2024

Description

This leverages embassy-embedded-hal to provide buses instantiated once and then shared between tasks.

This is the first step in landing the WIP sensor abstraction piece by piece.

Limitations

Issues/PRs references

Depends on #322

Open Questions

The dummy module in the arch module would need to be updated, but it's unclear what we should provide in it, as the interface of other archs is not exactly the same because of different requirements (e.g., RP2040 require DMA channels for SPI, and nRF GPIO outputs require an OutputDriver parameter).

TODO

  • SPI and I2C for RP2040
  • SPI and I2C for nRF52840 and nRF5340
  • I2C for ESP32
  • SPI for ESP32 (almost supported; the driver is currently not Send because of the underlying DMA linked-list, and there is an unresolved SPI mode-related issue)
  • SPI and I2C for STM32s
  • resolve the licensing issue of stm32-data and decide how to distribute the JSON data files required for SMT32
  • decide how to handle mutually exclusive peripherals on nRF (because they share the same interrupt)
  • introduce timeouts to avoid infinitely blocking if the I2C device is not connected
  • revisit the API we expose

Change checklist

  • I have cleaned up my commit history and squashed fixup commits.
  • I have followed the Coding Conventions.
  • I have performed a self-review of my own code.
  • I have made corresponding changes to the documentation.

@ROMemories ROMemories added the arch Architecture support label Jun 12, 2024
@maribu
Copy link
Contributor

maribu commented Jun 12, 2024

Cool!

@@ -15,6 +15,8 @@ members = [
"src/riot-rs-macros",
"src/riot-rs-random",
"tests/benchmarks/bench_sched_yield",
"tests/i2c-bus",
"tests/spi-bus",
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we instead introduce another directory in tests, next to benchmarks, so that we can use a wildcard to define crates in that directory as workspace members?

@ROMemories ROMemories changed the title feat(embassy-arch): support sharing I2C and SPI buses feat(embassy-arch): provide peripheral-independent for I2C and SPI buses Jun 18, 2024
@ROMemories ROMemories changed the title feat(embassy-arch): provide peripheral-independent for I2C and SPI buses feat(embassy-arch): provide peripheral-independent I2C and SPI types Jun 18, 2024
@kaspar030 kaspar030 mentioned this pull request Jun 26, 2024
57 tasks
@ROMemories ROMemories added the UX label Jul 17, 2024
@ROMemories ROMemories force-pushed the feat/buses-in-arch branch 4 times, most recently from 91fd9e5 to e591bf0 Compare August 9, 2024 10:36
@ROMemories ROMemories force-pushed the feat/buses-in-arch branch 2 times, most recently from 703e55a to 07739d9 Compare August 22, 2024 13:10
ROMemories and others added 28 commits August 23, 2024 14:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
arch Architecture support UX
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants