-
-
Notifications
You must be signed in to change notification settings - Fork 92
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 rgb666 support #621
add rgb666 support #621
Conversation
Hey, thanks for the PR! I'm moving house at the moment but I'll get to this when I've settled in :) |
@jamwaffles ping? Also question, does it make any sense to create something like RawU18 for this? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the nudge!
does it make any sense to create something like RawU18 for this?
Yes, I think it does. The other colour types represent their exact storage so doing so with Rgb666
keeps things consistent.
p.s. please rebase from master - the CI should start passing after #619 was merged. |
Seems there one more issue still in the CI for MSRV? |
I'm also unclear how to handle Right now I do LE MCU to BE display this way: let mut iter = colors.into_iter().flat_map(|c| {
let s = c.into_storage(); // bit-packed 18bits
// we need to un-pack and pad with 2 bits each into 3 bytes of 6bit info
let red = ((s & 0x3F) as u8) << 2;
let green = (((s >> 6) & 0x3F) as u8) << 2;
let blue = (((s >> 12) & 0x3F) as u8) << 2;
[red, green, blue]
}); |
This should be good to go, the RawU18 representation is a bit funky tho when it comes to the endianness conversions, but then again it never really makes sense. |
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks for your patience while I got round to this. I agree the ToBytes
impl is a bit odd for 18 bit colours - it certainly makes more sense for multiples of 8 bits - but it might be useful for somebody, and it's consistent with the other RGB colours.
Because |
This is released in e-g-core 0.3.3. e-g itself should pick the changes up with a |
Thank you for helping out with embedded-graphics development! Please:
CHANGELOG.md
entry in the Unreleased section under the appropriate heading (Added, Fixed, etc) if your changes affect the public APIrustfmt
on the projectjust build
(Linux/macOS only) and make sure it passes. If you use Windows, check that CI passes once you've opened the PR.PR description
Adds
Rgb666
support for displays such as the ILI9486