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

Analyze and improve public APIs for most common peripheral drivers #1318

Closed
jessebraham opened this issue Mar 20, 2024 · 3 comments
Closed
Assignees
Labels
status:long-term This task will be around a while

Comments

@jessebraham
Copy link
Member

I will likely update this issue with more information once we have discussed our plans a bit more, but in short I think it's time we start doing some top-down design of how we want our public APIs to look for the most common peripherals such as GPIO, I2C, SPI, UART, etc.

We should provide concrete methods for using these peripherals which do not rely on third-party traits. These traits should be implemented in addition to our native APIs, and should be feature gated.

@jessebraham jessebraham added the status:needs-attention This should be prioritized label Apr 3, 2024
@MabezDev MabezDev self-assigned this Apr 15, 2024
@MabezDev
Copy link
Member

I think I've found one area we can look at where we'll get good returns on our effort: timers.

We currently have no shared API between timers, i.e TIMG and SYSTIMER are completely different and cannot be abstracted over, but in reality they both do the same things:

  1. Count (clock)
  2. One-shot alarm
  3. Periodic alarm

If we can abstract over this, I see several benefits:

  1. esp-wifi can be decoupled from specific timers, and in general it will be possible to write code that can be abstract over timers. Thanks to runtime interrupt binding, we can even create a InterruptHandler in esp-wifi and assign it to the chosen timer.
  2. We might be able remove the embassy time features, though this is still unclear it might need some runtime selection because of how embassy_time_driver::time_driver_impl! works
  3. De duplicate code between systimer and timg

We can discuss this in a meeting and begin to hash out a design, I already have some ideas.

On top of that, I noticed that whilst we can initialize Systimer as async, it makes all the alarms async or blocking, in reality there is no technical reason the alarms cannot be mixed and matched as blocking async. There are also Delay impls on the systimer alarms.

@MabezDev MabezDev added status:long-term This task will be around a while and removed status:needs-attention This should be prioritized labels May 2, 2024
@bugadani
Copy link
Contributor

bugadani commented Sep 3, 2024

I'm picking up GPIO

@MabezDev
Copy link
Member

Closing in favour of #2010

@github-project-automation github-project-automation bot moved this from Todo to Done in esp-rs Sep 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status:long-term This task will be around a while
Projects
Archived in project
Development

No branches or pull requests

3 participants