Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of TLC5940 by
Revision 3:e5ed5650eb15, committed 2013-05-26
- Comitter:
- Spencer
- Date:
- Sun May 26 05:04:29 2013 +0000
- Parent:
- 2:69e40ccf506f
- Child:
- 4:ab6b451bbf40
- Commit message:
- A few more bug fixes
Changed in this revision
| TLC5940.h | Show annotated file Show diff for this revision Revisions of this file |
| TLC5940Mux.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/TLC5940.h Sun May 26 03:08:58 2013 +0000
+++ b/TLC5940.h Sun May 26 05:04:29 2013 +0000
@@ -28,7 +28,7 @@
* before the completion of a GSCLK cycle (4096 pulses). If you are daisy chaining multiple TLC5940s,
* divide 32Mhz by the number of chips to get a good maximum rate.
*/
-#define GSCLK_SPEED 1000000
+#define GSCLK_SPEED 2500000
/**
* This class controls a TLC5940 PWM driver IC.
@@ -233,7 +233,7 @@
void (*SetRows)(int);
// The current row
- int index;
+ volatile int currentIndex;
// Buffer containing data to be sent during each frame
unsigned short* dataBuffer;
--- a/TLC5940Mux.cpp Sun May 26 03:08:58 2013 +0000
+++ b/TLC5940Mux.cpp Sun May 26 05:04:29 2013 +0000
@@ -7,7 +7,7 @@
const int rows, void (*SetRows)(int)) : TLC5940(SCLK, MOSI, GSCLK, BLANK, XLAT, DCPRG, VPRG, number),
rows(rows),
SetRows(SetRows),
- index(0)
+ currentIndex(0)
{
// Create a data buffer to store the current LED states
@@ -40,16 +40,16 @@
void TLC5940Mux::setNextData()
{
// Move into the dataBuffer and return a pointer corresponding to the start of the correct data block
- setNewGSData(dataBuffer + (index * 16 * number));
+ setNewGSData(dataBuffer + (currentIndex * 16 * number));
// Since the data we sent on the previous reset was just latched in,
// we must enable the row for the previous index so it is displayed in the right position
// The ternary is used in case index is zero (we can't have an index of -1)
- SetRows((index ? (index - 1) : (rows - 1)));
+ SetRows((currentIndex ? (currentIndex - 1) : (rows - 1)));
// Go to next index
- if (index == (rows - 1))
- index = 0;
+ if (currentIndex == (rows - 1))
+ currentIndex = 0;
else
- index++;
+ currentIndex++;
}
\ No newline at end of file
