Routines to drive a chain of APA102 Leds.
Fork of APA102a by
Revision 8:3bb15df4903d, committed 2015-04-07
- Comitter:
- rosienej
- Date:
- Tue Apr 07 13:55:11 2015 +0000
- Parent:
- 7:629583c31cef
- Commit message:
- corrected the end condition
Changed in this revision
APA102a.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r 629583c31cef -r 3bb15df4903d APA102a.cpp --- a/APA102a.cpp Tue Apr 07 01:47:36 2015 +0000 +++ b/APA102a.cpp Tue Apr 07 13:55:11 2015 +0000 @@ -25,6 +25,7 @@ void APA102a::Repaint() { int index; + int end_count; unsigned int val; _spi.write(0X00); // Start @@ -36,10 +37,10 @@ { for(int c = off;c<(NC+off);c++) { - int cc = (WF)?(c%NS):((c<NS)?c:NS); + // int cc = (WF)?(c%NS):((c<NS)?c:NS); // if (ZF) // { if((r&0x01)>0) - index = r*NS + NC+off-cc; + // index = r*NS + NC+off-cc; // else // index = r*NS + cc;} // else @@ -52,9 +53,14 @@ _spi.write(val&0xFF); } } - _spi.write(0XFF); // Stop - _spi.write(0XFF); - _spi.write(0XFF); - _spi.write(0XFF); + + end_count = ((NR*NC)>>1); + while (end_count>0){ + _spi.write(0XFF); // Stop + end_count = end_count-8; + } + // _spi.write(0XFF); + // _spi.write(0XFF); + // _spi.write(0XFF); } \ No newline at end of file