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: F746_projet_led_version_final
Revision 1:911fe4d70205, committed 2019-06-04
- Comitter:
- marcolasek
- Date:
- Tue Jun 04 12:44:43 2019 +0000
- Parent:
- 0:a81364d9a67b
- Commit message:
- version final;
Changed in this revision
neopixel.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r a81364d9a67b -r 911fe4d70205 neopixel.cpp --- a/neopixel.cpp Tue Mar 21 21:17:08 2017 +0000 +++ b/neopixel.cpp Tue Jun 04 12:44:43 2019 +0000 @@ -10,23 +10,23 @@ // The timing should be approximately 800ns/300ns, 300ns/800ns void NeoPixelOut::byte(register uint32_t byte) { - for (int i = 0; i < 8; i++) { + for (int i = 0; i < 8; i++) { //8 gpio_write(&gpio, 1); // duty cycle determines bit value if (byte & 0x80) { // one - for(int j = 0; j < 6; j++) __nop(); + for(int j = 0; j < 72; j++) __nop();//6 gpio_write(&gpio, 0); - for(int j = 0; j < 2; j++) __nop(); + for(int j = 0; j < 24; j++) __nop();//2 } else { // zero - for(int j = 0; j < 2; j++) __nop(); + for(int j = 0; j < 24; j++) __nop();//2 gpio_write(&gpio, 0); - for(int j = 0; j < 5; j++) __nop(); + for(int j = 0; j < 60; j++) __nop();//5 } byte = byte << 1; // shift to next bit