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

HSV to RGB conversion as a trait #11

Closed
nils-van-zuijlen opened this issue Sep 12, 2019 · 2 comments
Closed

HSV to RGB conversion as a trait #11

nils-van-zuijlen opened this issue Sep 12, 2019 · 2 comments

Comments

@nils-van-zuijlen
Copy link

Why is the hsv to rgb conversion handled by the hsv2rgb function and not by an implementation of the Into<RGB8> trait ?

It would mean that we can use it directly in write function of SmartLedsWrite, which would be really useful.

https://github.com/smart-leds-rs/smart-leds-trait/blob/2a082914382fc63e07681c8df28c13fc4dd72f21/src/lib.rs#L13

@david-sawatzke
Copy link
Contributor

I think the reason was that it really isn't advisable to do the conversion in the write function, except for very fast microcontrollers. In most (i think all) implementations the iterator has to yield in under 1 μs, especially to conform to the datasheet, so doing it just in time is usually way to slow. Having it separate encourages doing the transformation beforehand.

@nils-van-zuijlen
Copy link
Author

Thank you, sounds sensible.

Could it be explained in the documentation or README then ?

david-sawatzke added a commit that referenced this issue Jan 12, 2024
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