pimoroni / fanshim-python

Python library for the Fan SHIM for Raspberry Pi
https://shop.pimoroni.com/products/fan-shim
MIT License
295 stars 85 forks source link

Support disabling LED/button for #70 #74

Closed Gadgetoid closed 4 years ago

Gadgetoid commented 4 years ago

This changeset adds disable_button and disable_led arguments to FanShim so that the GPIO setup for these features can be avoided.

This is mostly for issues with HyperPixel raised in #70 but any should be useful for other instances where Fan SHIM might conflict pins with another board.

This will break - https://github.com/pimoroni/fanshim-python/issues/49 Specifically - https://github.com/pimoroni/fanshim-python/commit/058ebc3f021736e2efcec60b1e6d10842cd2b857

But this is intentional, since noled is intended to avoid the LED being set up or written, for compatibility with add-on boards that require the pins. Additionally, writing the LED state once will not guarantee it actually stays that way, since the "smart" LEDs can often interpret random noise as signal and decide to turn themselves another colour.

Gadgetoid commented 4 years ago

Needs rebasing to incorporate the change to APA102, which allows pin setup to be skipped- previously legacy Plasma was setting up the LED pins on import but APA102 does not initialise them until instantiation.