JohnDoneth / hd44780-driver

Implementation of the embedded-hal traits for the HD44780.
MIT License
37 stars 40 forks source link

Non Blocking API #4

Closed jonwingfield closed 3 years ago

jonwingfield commented 5 years ago

Can you share your thoughts around the non-blocking API? I'd be willing to take a stab at it, but I'm not sure what you had in mind.

JohnDoneth commented 5 years ago

Well the API I had in mind would be to spawn a future when issuing a command as not to "block the main thread". Then wait for the busy signal from the LCD to go low and use that as the indicator that the future should be finished when polling.

I know the nb crate has some useful constructs already that could be used in the process of developing the API surface, but I have not looked into it recently.

xoviat commented 3 years ago

I'm willing to implement this. It's a simple matter of accepting an async delay, and then modifying the api to "async".

zacck-zz commented 3 years ago

Hey @xoviat would it be possible to know if any progress was made on this, considering using this library with rtic.rs

xoviat commented 3 years ago

The problem is that there are no async traits. rust-embedded/embedded-hal#206 was submitted, but that went nowhere. I had considered just adding a dependency on embassy (the async library that I'm using), but I haven't done that yet. The problem with RTIC IMO is there's no encapsulation, which is why I like embassy better.

zacck-zz commented 3 years ago

@xoviat and if you use embassy, how would you implement the solution? I'm a tad new to rust trying to figure out how to get past this more than keen to try do the work

xoviat commented 3 years ago

@zacck can you join https://app.element.io/#/room/#rust-embedded:matrix.org so that we can discuss this?

zacck-zz commented 3 years ago

Hey @JohnDoneth would you please make a new release for this, for some reason I cant reach the masync module at this moment using this as github dependency.

JohnDoneth commented 3 years ago

@zacck Sure! I will prioritize getting a release out. In the meantime did you add features = ["async"] to your git dependency? The async feature is not enabled by default.

zacck-zz commented 3 years ago

@JohnDoneth I did not do that, its likely what I need! Still learning