Skip to content

Commit eeaaea8

Browse files
committed
Updated README.md
1 parent cc927b3 commit eeaaea8

File tree

2 files changed

+63
-12
lines changed

2 files changed

+63
-12
lines changed

README.md

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
*Modifications added to this fork and how to customize it are below*
2+
13
# fastNP for STM32F103
24

35
## What is this?
@@ -65,3 +67,64 @@ For more info, take a look at demo_main.c.
6567

6668

6769
> 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+
```

Src/main.c

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -240,18 +240,6 @@ int main(void)
240240
uint8_t prefix[] = { 'A', 'd', 'a' }, hi, lo, chk, i;
241241
while (1)
242242
{
243-
// for (int i = 0; i < WS2812_NUM_CHANNELS; i++)
244-
// {
245-
// for (int j = 0; j < channels[i].length; j++)
246-
// {
247-
// ((struct pixel*)channels[i].framebuffer)[j].r = 100;
248-
// ((struct pixel*)channels[i].framebuffer)[j].g = 50;
249-
// ((struct pixel*)channels[i].framebuffer)[j].b = 0;
250-
// }
251-
// }
252-
253-
// DisplayChannels(channels);
254-
255243
// Wait for first byte of Magic Word
256244

257245
for (i = 0; i < sizeof prefix;)

0 commit comments

Comments
 (0)