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

Async API #635

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

Async API #635

wants to merge 4 commits into from

Conversation

jbeaurivage
Copy link
Contributor

@jbeaurivage jbeaurivage commented Oct 24, 2022

Provide APIs to use some peripherals using async/await.

HAL features

One new feature is added to the HAL: async

MSRV

This PR bumps the HAL MSRV to rustc 1.75. However everything compiles on stable.

Peripherals implemented

  • Timer/Counter (TC)
  • I2C
  • UART
  • SPI
  • DMAC
  • GPIO interrupts (EIC)

Todo

  • Document everything
  • Find best API for interrupt ownership
  • Convert to new peripheral-feature system, especially brand new modules

Examples

Some examples are provided for feather_m0 (and a few for metro_m4). Some more examples will be added in time, perhaps in a follow-up PR.

Breaking changes

  • The EIC drivers have a slightly new API.
  • Removed wakers for sync dmac::Transfers.

@jbeaurivage jbeaurivage marked this pull request as ready for review January 8, 2024 22:08
@sajattack
Copy link
Member

sajattack commented Nov 7, 2024

One example I think will definitely need testing is async_eic, I'm not 100% sure about it yet, even though it works well on thumbv6 targets.

I tested it on metro m4. It works great.

INFO  Falling edge detected
└─ async_eic::____embassy_main_task::{async_fn#0} @ examples/async_eic.rs:59
INFO  Falling edge detected
└─ async_eic::____embassy_main_task::{async_fn#0} @ examples/async_eic.rs:59
INFO  Falling edge detected
└─ async_eic::____embassy_main_task::{async_fn#0} @ examples/async_eic.rs:59
INFO  Falling edge detected
└─ async_eic::____embassy_main_task::{async_fn#0} @ examples/async_eic.rs:59
INFO  Falling edge detected

@jbeaurivage
Copy link
Contributor Author

Branch is rebased on top of #780.

jbeaurivage added a commit to jbeaurivage/atsamd that referenced this pull request Nov 13, 2024
Adds support for async APIs for the following peripherals:

* SPI
* I2C
* UART
* DMAC
* EIC (external GPIO interrupts)
* Timer/counters

BREAKING CHANGE: Removes support for wakers in
sync `dmac::Transfers`.
Adds support for async APIs for the following peripherals:

* SPI
* I2C
* UART
* DMAC
* EIC (external GPIO interrupts)
* Timer/counters

BREAKING CHANGE: Removes support for wakers in
sync `dmac::Transfers`.
@jbeaurivage
Copy link
Contributor Author

Note to reviewers: please use "Rebase and merge" to preserve the git history.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants