Fork of WS2812 library for experimenting with Nucleo board

Fork of WS2812 by Brian Daniels

Files at this revision

API Documentation at this revision

Comitter:
ALeggeUp
Date:
Fri Sep 23 14:57:15 2016 +0000
Parent:
2:6e647820f587
Commit message:
Initialise j in the for loops or it will not loop the expected number of times (j will start with the end value of the loop above)

Changed in this revision

WS2812.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r 6e647820f587 -r 5e65b629b49d WS2812.cpp
--- a/WS2812.cpp	Thu Feb 12 20:24:15 2015 +0000
+++ b/WS2812.cpp	Fri Sep 23 14:57:15 2016 +0000
@@ -88,23 +88,22 @@
     
     // Begin bit-banging
     for (i = 0; i < FRAME_SIZE * __size; i++) {
-        j = 0;
         if (__transmitBuf[i]){
             __gpo = 1;
-            for (; j < __oneHigh; j++) {
+            for (j = 0; j < __oneHigh; j++) {
                 __nop();
             }
             __gpo = 0;
-            for (; j < __oneLow; j++) {
+            for (j = 0; j < __oneLow; j++) {
                 __nop();
             }
         } else {
             __gpo = 1;
-            for (; j < __zeroHigh; j++) {
+            for (j = 0; j < __zeroHigh; j++) {
                 __nop();
             }
             __gpo = 0;
-            for (; j < __zeroLow; j++) {
+            for (j = 0; j < __zeroLow; j++) {
                 __nop();
             }
         }