BPIO enable LED mode

I recently tore apart the LED mode drivers to make them a bit more modular in case we want to add other LED types.

Since everything needs to be tested, I thought it might be a good time to add the bpio interface.

The python library is just about complete, I will be able to push it shortly.

Onboard LED

> python LED_example.py -p COM35
Connected to Bus Pirate on COM35

=== Onboard RGB LED Test ===

Configuring for onboard RGB LED...

Onboard LED configured

Setting onboard LED to Red (R=255, G=0, B=0)
Setting onboard LED to Green (R=0, G=255, B=0)
Setting onboard LED to Blue (R=0, G=0, B=255)
Setting onboard LED to Yellow (R=255, G=255, B=0)
Setting onboard LED to Magenta (R=255, G=0, B=255)
Setting onboard LED to Cyan (R=0, G=255, B=255)
Setting onboard LED to White (R=255, G=255, B=255)
Setting onboard LED to Gray (R=128, G=128, B=128)

Breathing effect (red)...
Turning off onboard LED...

Onboard LED test complete.

WS2812 demo

> python LED_example.py -p COM35 --type ws2812
Connected to Bus Pirate on COM35

=== WS2812 External LED Test ===

Configuring for WS2812 external LEDs...

WS2812 configured

Setting LED to Red (R=255, G=0, B=0)
Setting LED to Green (R=0, G=255, B=0)
Setting LED to Blue (R=0, G=0, B=255)
Setting LED to Yellow (R=255, G=255, B=0)
Setting LED to Magenta (R=255, G=0, B=255)
Setting LED to Cyan (R=0, G=255, B=255)
Setting LED to White (R=255, G=255, B=255)

Setting rainbow pattern on 5 LEDs...
Clearing LEDs...

WS2812 test complete.

APA102 demo

> python LED_example.py -p COM35 --type apa102
Connected to Bus Pirate on COM35

=== APA102 LED Test ===

Configuring for APA102 LEDs...

APA102 configured

Testing brightness levels (red)...
  Brightness: 31/31
  Brightness: 15/31
  Brightness: 7/31
  Brightness: 3/31
  Brightness: 1/31

Cycling through colors (full brightness)...
  Red
  Green
  Blue
  White

Setting gradient on 4 LEDs (varying brightness)...
Same gradient at full brightness...
Clearing LEDs...

APA102 test complete.

flatbuffers interface

The interface is copied from the terminal, but there are some quirks that need to be documented.

  • Start/Stop do reset/start frame and stop frame depending on LED type
  • Onboard LED needs a 3 byte RGB value
  • WS2812 need a 3 byte GRB value (raw ws2912 frame format, NOT RGB)
  • APA102 needs 4 bytes: 0b111 + 5 brightness bits, BGR

Bugs bugs

APA102 has some weird artifacts after the recent refactor. I need to look into that a bit before pushing the updates.

BPIO LED support (see docs) is now in the latest firmware, and supported by the python library.