adafruit / Adafruit_DotStar

GNU General Public License v3.0
97 stars 58 forks source link

Adding onboard brightness control for SK9822 #26

Closed adammhaile closed 5 years ago

adammhaile commented 6 years ago

@PaintYourDragon - Great meeting you at the OSH Park #BringAHack after Maker Faire Bay Area! As discussed, here's the change to support the onboard brightness control for SK9822 LEDs. The juicy details of the differences and the unified protocol are here: https://cpldcpu.wordpress.com/2016/12/13/sk9822-a-clone-of-the-apa102/

I noted that there was comments to the affect of onboard brightness control pull requests would not be accepted, but as we discussed this is primarily for the SK9822, though the change does not exclude using it for the APA102 if desired. To that effect I kept the default backwards compatible with the old method and included a new method useOnboardBrightness(bool) to enable or disable using the built-in 5-bit control. I've also slightly tweaked the protocol implementation to match the unified protocol discussed in the above linked article.

I've also included updated comments that should help explain these changes and the differences between APA102 and SK9822. Using the above method to enable/disable was just what I came up with on the spot, but if you have another thought for how you would like this handled, I'm happy to oblige any requested changes.

adammhaile commented 6 years ago

@PaintYourDragon - Should I dump this? If you don't want it I understand. Just wanted to offer it up after our conversation. I've got my own fork going on and can just keep it there for my own use if you'd rather. Just trying to cleanup my open pull requests list.

digitalcircuit commented 5 years ago

I'm also interested in making use of this for greater dynamic range; it seems like a shame to not take full advantage of the improved SK9822 hardware. I might even go a step further on a personal fork to add per-pixel brightness control.

@adammhaile , as long as you find the DotStar library useful, will you be keeping your changes in adammhaile/Adafruit_DotStar, branch brightness?

adammhaile commented 5 years ago

@digitalcircuit - Yep, I still use that branch. Unfortunate they didn't want to merge it. Oh well. Per pixel would be easy since that's what it's doing already, it's just applying the same value to each pixel. If you fork it, I absolutely want to be involved and contribute / help test.