-
Notifications
You must be signed in to change notification settings - Fork 48
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
Experimental refactoring #81
Conversation
I like this approach. I'm also thinking (from This way Perhaps there's an easier way to allow outside crates to provide the model functionality tho? |
I can't immediately see how this could work.
But if the
I prefer to keep all models in one crate, but I agree that testing is an issue. Making it possible to implement support for new controller types externally shouldn't be to hard, by reverting |
The only thing remaining in this PR, that could be a good idea to implement at some point is to use a type attribute to distinguish between the different color formats that are supported by a controller, e.g. |
I don't disagree with doing this but I think it might be time to get the next major version out the door. I'm trying to get my hardware in order again to test this but if you say this version works fine I think we can release now. We can refactor further later, it's already a huge release and we're not promising 1.0 stability yet. |
Yes, finally getting a new release out is the reason I don't want to work on this at the moment.
I haven't done any thorough testing with the latest revision, but ST7789 did work last month, when I tried to fix the CS pin issue reported in #129. The last time I tried GC9A01 and ILI9341 displays was in February and I don't think any of the changes after that should have broken support for these displays. |
I never really liked the way the builder and
ModelOptions
worked. This PR is an experiment to improve that code a bit. At this point this is only an experiment and it might not be the best way of implementing this. The PR does only implement the changes for the ILI9341 controller at the moment and different display sizes, offsets and orientations won't work correctly.Changes:
Builder::ili9341_rgb565
.All controller types now use
Builder::new
, with an optional type annotation likeBuilder::new::<ILI9341<Rgb565>>(di)
.Builder::st7789_pico1
are no longer supported.IMO this isn't a problem and we should focus on supporting controllers and not different display modules. There are too many modules to support them all and many generic modules can be different even if they seem to have the same name. Having good documentation on how to get started with a new display module is more useful than some builtin variants. For hardware with a BSP crate the display initialization could be handled in that crate instead.
ILI9341Rgb565
andILI9341Rgb666
were replaced byILI9341<Rgb565>
andILI9341<Rgb666>
.init
and is a now a builder setting instead.I'm not sure why it was implemented this way before, but the
Display
struct does take ownership of the pin and it isn't only used byinit
(like the delay).ModelOptions
is removed and all options are now handled byDisplay
directly.The builder uses a
Display
struct internally and the controller specificinit
methods can now simply take a&mut Display
argument instead of manually passingdcs
,options
, andrst
.I would appreciate some feedback, whether you think that this is an improvement or not worth the effort.