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

New API Design #1

Open
JMurph2015 opened this issue Jun 18, 2018 · 0 comments
Open

New API Design #1

JMurph2015 opened this issue Jun 18, 2018 · 0 comments
Assignees

Comments

@JMurph2015
Copy link
Collaborator

So the API is pretty garbage right now. Lets figure out how to fix it.

Vision

Currently I envision a (mostly) two struct system, a Controller and a Channel, a lot like the @meh implementation from a while back, however, there are some improvements to be made there.

General usage flow

  1. Get a mutable reference to a Channel from the Controller, perhaps via the indexing traits
  2. Index on that Channel using some higher level color type and set desired color values for the LEDs
  3. Call controller.render() when finished with this frame's changes

It's not all that different from the C API, but hopefully we can integrate some of those zero cost abstractions that everyone loves, especially around the color typing and the error handling. Realistically, we're going to have to get creative if we want to store richer color types co-locally with the actual 0-255 byte representation in the driver. I'm not even sure its worth messing with in this low level of a library.

Anyway, feedback is greatly appreciated!

@JMurph2015 JMurph2015 self-assigned this Jun 18, 2018
This was referenced Aug 14, 2018
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

1 participant