Simple neopixel (WS2812) library, tuned for stm32 (L432) at 80 MHz Should be compatible with any stm32, different clock speed may require timing adjustments in neopixel.c
Dependents: NEOPIXEL_SAMPLE ppd
Diff: neopixel.cpp
- Revision:
- 1:415459e3f93b
- Parent:
- 0:a81364d9a67b
--- a/neopixel.cpp Tue Mar 21 21:17:08 2017 +0000 +++ b/neopixel.cpp Thu Jan 02 07:56:44 2020 +0000 @@ -16,17 +16,17 @@ // duty cycle determines bit value if (byte & 0x80) { // one - for(int j = 0; j < 6; j++) __nop(); + for(int j = 0; j < 6; j++) __NOP(); gpio_write(&gpio, 0); - for(int j = 0; j < 2; j++) __nop(); + for(int j = 0; j < 2; j++) __NOP(); } else { // zero - for(int j = 0; j < 2; j++) __nop(); + for(int j = 0; j < 2; j++) __NOP(); gpio_write(&gpio, 0); - for(int j = 0; j < 5; j++) __nop(); + for(int j = 0; j < 5; j++) __NOP(); } byte = byte << 1; // shift to next bit