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

examples: st7789: Initial commit #543

Merged
merged 2 commits into from
Jun 13, 2024
Merged

Conversation

alistair23
Copy link
Collaborator

This is a basic example of displaying data on a st7789 screen using Tock.

This requires a few dependencies, which unfortunately get included for all examples. The other issue is that the example fails to build unless FEATURES=rust_embedded is passed as part of the make command. What are people's thoughts on handling this?

@alistair23
Copy link
Collaborator Author

@jrvanwhy as I hope you have some ideas

Copy link
Member

@alevy alevy left a comment

Choose a reason for hiding this comment

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

I'm pretty split on this.

On the one hand, it's a cool demo that a rather involved set of embedded-hal libraries can work in libtock-rs.

On the other hand, while it works, it's a pretty non-cannonical way of writing a Tock process---really, the translation from "draw pixel" <-> SPI commands should happen underneath something like the Screen HIL in the kernel, so the application is natively portable, the screen can be divided or switched between processes, etc.

Cargo.toml Outdated Show resolved Hide resolved
@alistair23
Copy link
Collaborator Author

On the other hand, while it works, it's a pretty non-cannonical way of writing a Tock process---really, the translation from "draw pixel" <-> SPI commands should happen underneath something like the Screen HIL in the kernel, so the application is natively portable, the screen can be divided or switched between processes, etc.

Yeah, it would be nice to do it in the kernel.

That's a huge effort though. tock/tock#3079 covers some of the things needed, which predictably have all stalled. It would also require a re-write of https://github.com/almindor/mipidsi in the kernel.

Doing it in userspace means we can handle all of graphics complexities there and also utilise the well supported rust-embedded ecosystem.

Maybe if you or someone else adds kernel support in the future we can update this to use that instead

@alevy
Copy link
Member

alevy commented Jun 6, 2024

That's a huge effort though.
...
It would also require a re-write of https://github.com/almindor/mipidsi in the kernel.

I'm not sure that's true. See for example the lvgl example in libtock-c which just uses an existing embedded graphics library, (not so different from the embedded-graphics crate).

Supporting embedded-graphics would only require implementing the DrawTarget, which is really one relatively simple method to implement.

@alevy
Copy link
Member

alevy commented Jun 6, 2024

The main problem I have, I think, is that this looks like The Right Thing(tm) to do if it's in examples. I'm similarly wary of maintaining such examples long term.

Two options that could solve both this problem and the specific problem of the dependencies living in the library's Cargo.toml:

  1. Create a new repo called, say demos, that could house things like this which are: "look what you can do!" rather than "look how you should do things!" (it's possible that some of those are the current best possible thing to do without a lot of other work, but separating what's the vision from what's currently required is useful).

  2. Create a demos subdirectory which in this library which can have a bunch of separate crates. Same basic idea as (1), just lighter weight than a totally new repo.

@alistair23
Copy link
Collaborator Author

I'm not sure that's true. See for example the lvgl example in libtock-c which just uses an existing embedded graphics library, (not so different from the embedded-graphics crate).

Ah true. There is also already a Tock port for the ST7789 that I didn't know about as well. Although there are so many displays supported by embedded-rust that we don't have in the kernel, so it doesn't help for the next display

A demos directory is fine with me. We need something different to the current examples anyway to handle all of the dependencies

@alistair23 alistair23 force-pushed the alistair/st7789 branch 4 times, most recently from 69a96b6 to 1765b89 Compare June 13, 2024 02:09
@alistair23
Copy link
Collaborator Author

Updated to implement "Idea A" with a demo directory containing a separate crate

@alistair23 alistair23 force-pushed the alistair/st7789 branch 2 times, most recently from 45effda to c258e99 Compare June 13, 2024 03:04
This is a basic example of displaying data on a st7789 screen using
Tock.

Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
@jrvanwhy jrvanwhy added this pull request to the merge queue Jun 13, 2024
Merged via the queue into tock:master with commit 4b7cba1 Jun 13, 2024
3 checks passed
@alistair23 alistair23 deleted the alistair/st7789 branch June 13, 2024 22:10
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.

3 participants