Skip to content

Should this crate allow reading #24

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

Open
VersBinarii opened this issue Apr 21, 2022 · 9 comments
Open

Should this crate allow reading #24

VersBinarii opened this issue Apr 21, 2022 · 9 comments

Comments

@VersBinarii
Copy link

LCD controller such as ili9341 allows for reading pixel data (and other useful things) from it.
This crate, while great great for simply sending data to display, makes it impossible to read data from it

Should it allow also for reading data

@almindor
Copy link
Collaborator

this would have to be a separate trait that the drivers would implement somehow since it's only available for some displays. What else besides pixels data itself would you consider to be useful for reading?

@therealprof
Copy link
Owner

Pixel data would be super useful to read back from a display internal framebuffer. There's still #12 which attempts to provide the ability to read back. I do think it would be feasible to add traits to allow reading back pixel or control data but the big question would be how a display driver or in extension the application via the display driver could use the data. I can see a few caveats for a truly generic and useful API so if you happen to have a specific usecase or even a complete application reading back from the display I'd really love to see and discuss it.

@VersBinarii
Copy link
Author

I'm not trying to be smart and perhaps i'm missing some nuances of driver design but if a chip offers a set of data to be read there has to be a way to get them.
@almindor I'm interested mainly in getting the pixel data. However this approach is weird to me a bit. Every register that is exposed for reading in this driver chip could be useful to someone at some stage. Driver should not "kindly" allow me to read some and not the other.

In my more specific case i'm using https://github.com/yuri91/ili9341-rs and https://github.com/VersBinarii/xpt2046.
I was thinking of experimenting with the touch driver along with getting the pixel data to build an interactive GUI. So i could read the pixel data at the touch location to handle specific action. This could potentially save me complexity of juggling all GUI elements in memory, dealing with collision detection, etc

I have read through the discussion in #12 but admit i dont fully understand @therealprof reasons for rejecting it.

Anyway thanks for your work in this area and if this crate is not usefull in this particular case its still applicable to 99% of other cases

@almindor
Copy link
Collaborator

almindor commented Apr 23, 2022

@VersBinarii I'm the author of the generic MIPIDSI rust driver. I conflated things a bit here, my main aim was to find out "generic use cases" for reading so I could implement it in the overall driver if the display-interface gets support for it in a trait.

I agree 100% that reading is paramount and that the DI should just provide a generic read function same as the write one right now.

@therealprof
Copy link
Owner

In my more specific case i'm using https://github.com/yuri91/ili9341-rs and https://github.com/VersBinarii/xpt2046. I was thinking of experimenting with the touch driver along with getting the pixel data to build an interactive GUI. So i could read the pixel data at the touch location to handle specific action. This could potentially save me complexity of juggling all GUI elements in memory, dealing with collision detection, etc

Not sure how this would work. How can you reverse engineer which GUI element the user clicked on by reading back the pixel color?

I have read through the discussion in #12 but admit i dont fully understand @therealprof reasons for rejecting it.

The problem is we need a universal trait that works with different peripheral interfaces in a useful way without complicating lives for everyone not requiring this ability.

The reason why I'm asking how you intend to use the ability to read back pixel data is because most of our users are using embedded-graphics to render graphics primitives (or even whole user interfaces) onto the display; as far as I'm aware there's no way to use an external in-display framebuffer with that.

I know a few people who would be very excited (including me) to add the ability to use a in-display framebuffer but I don't think anyone has invested the required brainpower to come up with a real use case and a high level concept to implement such a use case. This would help immensly to identify the stumble blocks.

Reading a single value might be an easy addition, but once you enter the world of iterators or sized arrays things get complicated very quickly and that's what we need.

@VersBinarii
Copy link
Author

Reading a single value might be an easy addition, but once you enter the world of iterators or sized arrays things get complicated very quickly and that's what we need.

Then maybe this could be the start which will get people to use it and see where this leads ;)
Anyway, i see your point.

@almindor I see. I misunderstood your question then.

@therealprof
Copy link
Owner

Then maybe this could be the start which will get people to use it and see where this leads ;)

It's super inefficient, I doubt people would even care about that enough to start using it.

@almindor
Copy link
Collaborator

I'm wondering if we should leave this issue open as a discussion place for this. I think reading will become required, might be a good idea to have a dedicated place to put in ideas on how to best handle it.

@therealprof
Copy link
Owner

I agree. Let's keep it open.

@therealprof therealprof reopened this Apr 24, 2022
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

No branches or pull requests

3 participants