pimoroni / mote

Mote - drivers for the plug and play USB APA102 controller
https://shop.pimoroni.com/products/mote
MIT License
24 stars 14 forks source link

Unify Mote and Mote pHAT APIs #21

Closed Gadgetoid closed 7 years ago

Gadgetoid commented 7 years ago

These API changes aim to bring Mote and Mote pHAT back in harmony, so that examples can easily be ported from one to another, or code can run across devices of both types.

This is a companion PR to https://github.com/pimoroni/mote-phat/pull/7

The brightness changes need to be reflected in the Mote library, replacing control over the 5-bit brightness value of Mote, with simple scaling of the R, G and B colour values. Since the global brightness feature controlls a ~582 Hz (https://cpldcpu.com/2014/08/27/apa102/) superimposed PWM gate to the underlying brightness value, it's less than optimal when it comes to visual flicker, and not demonstrably better than simply scaling the R, G, B values outside of extremely sophisticated dithering techniques that Mote/Mote pHAT can't support.

Following this tweak, optional Gamma correction can be added to both libraries and gamma-corrected values will no longer be broken by the APA102 hardware brightness. (in Unicorn HAT brightness is applied before gamma correction)