atsamd icon indicating copy to clipboard operation
atsamd copied to clipboard

Async API

Open jbeaurivage opened this issue 3 years ago • 2 comments

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

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

Todo

  • [x] Document everything
  • [x] Find best API for interrupt ownership
  • [x] 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.

jbeaurivage avatar Oct 24 '22 14:10 jbeaurivage

I'm sorry this sat so long. I'm pretty sure my feather m0 board is busted after I wired up a battery to it backwards. Would you mind porting more of the examples to metro m4 so I can get a better feel for this?

sajattack avatar Jun 06 '24 19:06 sajattack

I'm sorry this sat so long. I'm pretty sure my feather m0 board is busted after I wired up a battery to it backwards. Would you mind porting more of the examples to metro m4 so I can get a better feel for this?

Of course! The feather_m0 examples are ported to metro_m4. Unfortunately they aren't yet using clock::v2 as I'm not super sure how to use it correctly. 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.

jbeaurivage avatar Jun 12 '24 22:06 jbeaurivage