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

Add physical connection type to Interface trait #167

Closed
rfuest opened this issue Jan 18, 2025 · 3 comments
Closed

Add physical connection type to Interface trait #167

rfuest opened this issue Jan 18, 2025 · 3 comments

Comments

@rfuest
Copy link
Collaborator

rfuest commented Jan 18, 2025

Some display controllers support different color depth with different connection types. The ILI9488, for example, supports different color depth for SPI and parallel connections.

We've never been able to detect if the combination between physical connection and chosen color depth is valid. But now that we no longer depend on display-interface we could add additional meta information to the Interface trait to detect these kinds of configuration errors and alert the user about them.

@almindor
Copy link
Owner

almindor commented Jan 20, 2025

How do you propose to model this? A "typeflag" const added to the Interface trait and required to be specific by Model?

@rfuest
Copy link
Collaborator Author

rfuest commented Jan 20, 2025

I hadn't really thought about the details of the implementation when I opened the issue. But I think adding a const to the Interface trait would be a good idea like:

trait Interface {
   const KIND: InterfaceKind;
   ...
}

#[non_exhaustive]
enum InterfaceKind {
   Spi,
   Parallel8080,
}

The check for valid configuration would then be performed by the Models init method. This is more flexible than trying to find a type level solution for this problem. The init method would need to be changed to return an InitError and a InvalidConfiguration variant added to that enum.

@rfuest
Copy link
Collaborator Author

rfuest commented Feb 14, 2025

This has been implemented in #169.

@rfuest rfuest closed this as completed Feb 14, 2025
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

2 participants