|
| 1 | +*Modifications added to this fork and how to customize it are below* |
| 2 | + |
1 | 3 | # fastNP for STM32F103
|
2 | 4 |
|
3 | 5 | ## What is this?
|
@@ -65,3 +67,64 @@ For more info, take a look at demo_main.c.
|
65 | 67 |
|
66 | 68 |
|
67 | 69 | > Written with [StackEdit](https://stackedit.io/).
|
| 70 | +
|
| 71 | + |
| 72 | +# What's new in this fork |
| 73 | +* Modified to work as [Adalight](https://github.com/Wifsimster/adalight_ws2812) compatible with [Prismatik](https://github.com/psieg/Lightpack) |
| 74 | +* Using USB CDC code based on [philrawlings' bluepill-usb-cdc-test](https://github.com/philrawlings/bluepill-usb-cdc-test) |
| 75 | +* Added heartbeat LED code (idea inspired from ArduinISP) |
| 76 | + |
| 77 | +## How to customize |
| 78 | +The code programmed for two output channels (2 WS2812 LED ribbons), on PB0 and PB1 resp., the number of LEDs in each output is defined by NUM_LEDS_OUTPUT_1 and NUM_LEDS_OUTPUT_2 resp., the number of channels is defined by WS2812_NUM_CHANNELS. |
| 79 | + |
| 80 | +### How to remove a channel (i.e use only one output) |
| 81 | +* Change the number of channels to 1 |
| 82 | +```C++ |
| 83 | +// ws2812_led.h line 45 |
| 84 | +#define WS2812_NUM_CHANNELS 1 |
| 85 | +``` |
| 86 | +* You can optionally (since it's only on startup and won't have any further influenc) remove the definitions of the second channel and all code related to it |
| 87 | + |
| 88 | +```C++ |
| 89 | +// main.c, around line 206 |
| 90 | +#define NUM_LEDS_OUTPUT_2 80 |
| 91 | +... |
| 92 | +// main.c, line 209 |
| 93 | +struct pixel leds2[NUM_LEDS_OUTPUT_2]; |
| 94 | +... |
| 95 | +// main.c, line 216 |
| 96 | +channels[1].framebuffer = &leds2; |
| 97 | +channels[1].length = NUM_LEDS_OUTPUT_2 * sizeof(struct pixel); |
| 98 | +// main.c, line 231 |
| 99 | +FillPixels(channels[1], colors[i]); |
| 100 | +``` |
| 101 | +
|
| 102 | +### How to add another channel |
| 103 | +*The output will be PB2* |
| 104 | +
|
| 105 | +* Define the number of LEDs in this channel (let's say 50 LEDs) |
| 106 | +```C++ |
| 107 | +// main.c, around line 207 |
| 108 | +#define NUM_LEDS_OUTPUT_2 50 |
| 109 | +``` |
| 110 | +* Define another struct |
| 111 | +```C++ |
| 112 | +// main.c, around line 210 |
| 113 | +struct pixel leds3[NUM_LEDS_OUTPUT_3]; |
| 114 | +``` |
| 115 | +* Add the defined structure to channels |
| 116 | +```C++ |
| 117 | +// main.c, line 218 |
| 118 | +channels[2].framebuffer = &leds3; |
| 119 | +channels[2].length = NUM_LEDS_OUTPUT_3 * sizeof(struct pixel); |
| 120 | +``` |
| 121 | +* Change the number of channels to 3 |
| 122 | +```C++ |
| 123 | +// ws2812_led.h line 45 |
| 124 | +#define WS2812_NUM_CHANNELS 3 |
| 125 | +``` |
| 126 | +* Add initialization colors (optional) |
| 127 | +```C++ |
| 128 | +// main.c, line 232 |
| 129 | +FillPixels(channels[2], colors[i]); |
| 130 | +``` |
0 commit comments