Skip to content

Commit 67f44d6

Browse files
fixed toxix whitespace
1 parent edb7617 commit 67f44d6

25 files changed

+281
-277
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,6 @@ test/
3737
.pio
3838
.vscode
3939
.travis.yml
40+
41+
# MacOS
42+
.DS_Store

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
66

77
## [Unreleased]
88
### Fixed
9-
- The row scan timing was too long on ESP32 platforms. Adjusted this timing to remove visible blinking.
9+
- The row scan timing was too long on ESP32 platforms. Adjusted this timing to remove visible blinking.
10+
- Fixed Color Gradient example so thatit propery compiles.
1011

1112
## [2.0.2]
1213
### Added

examples/10x10-matrix/color_gradient-10x10/color_gradient-10x10.ino

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@ void setup() {
1313
float dx = leds.columns() - x - 1;
1414
float dy = leds.rows()-y - 1;
1515

16-
float d_tl = max(1.0-sqrt(x*x + y*y)/MAX_DISTANCE, 0);
17-
float d_bl = max(1.0-sqrt(x*x + (leds.rows()-y)*(leds.rows()))/MAX_DISTANCE, 0);
18-
float d_br = max(1.0-sqrt(dx*dx + dy*dy)/MAX_DISTANCE, 0);
16+
float d_tl = max(1.0-sqrt(x*x + y*y)/MAX_DISTANCE, 0.0);
17+
float d_bl = max(1.0-sqrt(x*x + (leds.rows()-y)*(leds.rows()))/MAX_DISTANCE, 0.0);
18+
float d_br = max(1.0-sqrt(dx*dx + dy*dy)/MAX_DISTANCE, 0.0);
1919

2020
RGBColorType c = RGBColor::fromRGB( d_tl*255, d_br*194, d_bl*255);
2121
leds.writePixel(x, y, c);
22-
}
22+
}
2323
}
2424
leds.stopDrawing();
2525
leds.loop();

examples/16x16-matrix/color_gradient-16x16-cprg/color_gradient-16x16-cprg.ino

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@ void setup() {
1313
float dx = leds.columns() - x - 1;
1414
float dy = leds.rows()-y - 1;
1515

16-
float d_tl = max(1.0-sqrt(x*x + y*y)/MAX_DISTANCE, 0);
17-
float d_bl = max(1.0-sqrt(x*x + (leds.rows()-y)*(leds.rows()))/MAX_DISTANCE, 0);
18-
float d_br = max(1.0-sqrt(dx*dx + dy*dy)/MAX_DISTANCE, 0);
19-
16+
float d_tl = max(1.0-sqrt(x*x + y*y)/MAX_DISTANCE, 0.0);
17+
float d_bl = max(1.0-sqrt(x*x + (leds.rows()-y)*(leds.rows()))/MAX_DISTANCE, 0.0);
18+
float d_br = max(1.0-sqrt(dx*dx + dy*dy)/MAX_DISTANCE, 0.0);
19+
2020
RGBColorType c = RGBColor::fromRGB( d_tl*255, d_br*194, d_bl*255);
2121
leds.writePixel(x, y, c);
22-
}
22+
}
2323
}
2424
leds.stopDrawing();
2525
leds.loop();

examples/8x8-matrix/color_gradient-8x8/color_gradient-8x8.ino

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@ void setup() {
1313
float dx = leds.columns() - x - 1;
1414
float dy = leds.rows()-y - 1;
1515

16-
float d_tl = max(1.0-sqrt(x*x + y*y)/MAX_DISTANCE, 0);
17-
float d_bl = max(1.0-sqrt(x*x + (leds.rows()-y)*(leds.rows()))/MAX_DISTANCE, 0);
18-
float d_br = max(1.0-sqrt(dx*dx + dy*dy)/MAX_DISTANCE, 0);
16+
float d_tl = max(1.0-sqrt(x*x + y*y)/MAX_DISTANCE, 0.0);
17+
float d_bl = max(1.0-sqrt(x*x + (leds.rows()-y)*(leds.rows()))/MAX_DISTANCE, 0.0);
18+
float d_br = max(1.0-sqrt(dx*dx + dy*dy)/MAX_DISTANCE, 0.0);
1919

2020
RGBColorType c = RGBColor::fromRGB( d_tl*255, d_br*194, d_bl*255);
2121
leds.writePixel(x, y, c);
22-
}
22+
}
2323
}
2424
leds.stopDrawing();
2525
leds.loop();

platformio.ini

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
; This PlatformIO onfiguration is for development on this library only,
2-
; not for usage of this library in other projects.
1+
; This PlatformIO onfiguration is for development on this library only,
2+
; not for usage of this library in other projects.
33

44
[platformio]
55
src_dir = examples/16x16-matrix/color_gradient-16x16-cprg
66
default_envs = teensy40
77
lib_dir = .
88

99
[common]
10-
lib_deps =
10+
lib_deps =
1111
Adafruit GFX Library
1212
Adafruit BusIO
1313
SPI
@@ -17,7 +17,7 @@ lib_deps =
1717
platform = teensy
1818
board = teensy40
1919
framework = arduino
20-
lib_deps =
20+
lib_deps =
2121
TimerThree
2222
${common.lib_deps}
2323
build_flags = -Wno-unknown-pragmas
@@ -26,7 +26,7 @@ build_flags = -Wno-unknown-pragmas
2626
platform = teensy
2727
board = teensy31
2828
framework = arduino
29-
lib_deps =
29+
lib_deps =
3030
TimerThree
3131
${common.lib_deps}
3232
build_flags = -Wno-unknown-pragmas
@@ -87,6 +87,6 @@ build_flags = -Wno-unknown-pragmas
8787

8888
; SERIAL MONITOR OPTIONS
8989
; Monitor and upload port is the same by default
90-
;monitor_port =
90+
;monitor_port =
9191
; Serial monitor baud rate
9292
monitor_speed = 9600

src/BaseLEDMatrix.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,17 @@
22
// Copyright (C) 2017 Michael Kamprath
33
//
44
// This file is part of Shift Register LED Matrix Project.
5-
//
5+
//
66
// Shift Register LED Matrix Project is free software: you can redistribute it and/or modify
77
// it under the terms of the GNU General Public License as published by
88
// the Free Software Foundation, either version 3 of the License, or
99
// (at your option) any later version.
10-
//
10+
//
1111
// Shift Register LED Matrix Project is distributed in the hope that it will be useful,
1212
// but WITHOUT ANY WARRANTY; without even the implied warranty of
1313
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1414
// GNU General Public License for more details.
15-
//
15+
//
1616
// You should have received a copy of the GNU General Public License
1717
// along with Shift Register LED Matrix Project. If not, see <http://www.gnu.org/licenses/>.
1818

@@ -441,7 +441,7 @@ void BaseLEDMatrix::startScanning(void) {
441441
pmc_enable_periph_clk(ID_TC7); // enable peripheral clock TC7
442442

443443
/* we want wavesel 01 with RC */
444-
TC_Configure(/* clock */ TC2,/* channel */ 1, TC_CMR_WAVE | TC_CMR_WAVSEL_UP_RC | TC_CMR_TCCLKS_TIMER_CLOCK2);
444+
TC_Configure(/* clock */ TC2,/* channel */ 1, TC_CMR_WAVE | TC_CMR_WAVSEL_UP_RC | TC_CMR_TCCLKS_TIMER_CLOCK2);
445445
TC_SetRC(TC2, 1, 1000);
446446
TC_Start(TC2, 1);
447447

src/BaseLEDMatrix.h

Lines changed: 37 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,17 @@
22
// Copyright (C) 2017 Michael Kamprath
33
//
44
// This file is part of Shift Register LED Matrix Project.
5-
//
5+
//
66
// Shift Register LED Matrix Project is free software: you can redistribute it and/or modify
77
// it under the terms of the GNU General Public License as published by
88
// the Free Software Foundation, either version 3 of the License, or
99
// (at your option) any later version.
10-
//
10+
//
1111
// Shift Register LED Matrix Project is distributed in the hope that it will be useful,
1212
// but WITHOUT ANY WARRANTY; without even the implied warranty of
1313
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1414
// GNU General Public License for more details.
15-
//
15+
//
1616
// You should have received a copy of the GNU General Public License
1717
// along with Shift Register LED Matrix Project. If not, see <http://www.gnu.org/licenses/>.
1818

@@ -35,13 +35,13 @@ class BaseLEDMatrix : public TimerAction {
3535
typedef enum {
3636
// the left most column in the hardware and MSB in the shift register chain is column 0
3737
LED_BIG_ENDIAN,
38-
39-
// The columns are laid out in 8 column "bytes" with column 0 being the left most
40-
// bit in the right most byte. Column 8 would be the left most bit in the second
38+
39+
// The columns are laid out in 8 column "bytes" with column 0 being the left most
40+
// bit in the right most byte. Column 8 would be the left most bit in the second
4141
// to the right byte.
4242
LED_LITTLE_ENDIAN_8
4343
} DeviceBitEndian;
44-
44+
4545
private:
4646
unsigned int _rows;
4747
unsigned int _columns;
@@ -54,37 +54,37 @@ class BaseLEDMatrix : public TimerAction {
5454
unsigned int _interFrameOffTimeInterval;
5555
unsigned int _blankLevel;
5656
DeviceBitEndian _bitEndian;
57-
57+
5858
bool _columnControlBitOn;
5959
bool _rowControlBitOn;
60-
60+
6161
LEDMatrixBits **_curScreenBitFrames;
6262
LEDMatrixBits **_screenBitFrames;
6363
LEDMatrixBits *_allOffBits;
64-
64+
6565
bool _screenBitFrameToggle;
6666
bool _interFrameTransmitOffToggle;
67-
67+
6868
unsigned int _scanPass;
6969
unsigned int _scanRow;
7070
int _isDrawingCount;
7171

7272
SPIConnection _spi;
7373
int _blankPin;
74-
74+
7575
void shiftOutControlRow( int row, int scanPass );
76-
76+
7777
protected:
7878
unsigned int controlRows() const { return _controlRows; }
7979
unsigned int controlColumns() const { return _controlColumns; }
8080
unsigned int rowGroups() const { return _rowGroups; }
8181
unsigned int columnBitWidth() const { return _columnBitWidth; }
8282
virtual void action();
83-
83+
8484
virtual void generateFrameBits(LEDMatrixBits& frameBits, size_t frame ) const = 0;
8585
virtual bool matrixNeedsUpdate(void) const = 0;
8686
virtual void matrixHasBeenUpdated(void) = 0;
87-
87+
8888
virtual unsigned int baseIntervalMultiplier( size_t frame ) const;
8989
public:
9090

@@ -93,26 +93,26 @@ class BaseLEDMatrix : public TimerAction {
9393
*
9494
* @param rows the number of rows in the LED matrix.
9595
* @param columns the number of columns in the LED matrix.
96-
* @param controlRows the number of powered rows in the LED matrix. Control rows are
96+
* @param controlRows the number of powered rows in the LED matrix. Control rows are
9797
* expected to have shared power to the LEDs.
9898
* @param controlColumns the number of control columns in the LED matrix.
99-
* @param columnBitWidth the number of bits needed to represent one physical LED in
99+
* @param columnBitWidth the number of bits needed to represent one physical LED in
100100
* a column. E.g., and RGB LED needs 3 bits.
101101
* @param pwmCycleScanCount the number of row scans needed for the PWM cycle of the matrix.
102102
* @param columnControlBitOn what value a column bit should be set to to the column on.
103-
* @param rowControlBitOn what value a row bit should be set to to turn the row on.
104-
* E.g. of the row is common anode and a PNP transistor is being use
103+
* @param rowControlBitOn what value a row bit should be set to to turn the row on.
104+
* E.g. of the row is common anode and a PNP transistor is being use
105105
* to switch power to the row, the row bit likely needs to be LOW to
106106
* cause the transistor to power the row.
107107
* @param interFrameOffTimeMicros Controls whether an all-off signal is sent to the
108-
* shift registers in between row updates in order to mitigate LED
109-
* ghosting. A value of 0 indicates that no all-off signal should be
108+
* shift registers in between row updates in order to mitigate LED
109+
* ghosting. A value of 0 indicates that no all-off signal should be
110110
* sent. A value greater than 0 indicates how many microseconds should
111-
* be waited until the next row update gets shifted out. Usually a value
111+
* be waited until the next row update gets shifted out. Usually a value
112112
* less than 3 microseconds is sufficient for most slow row power
113113
* switching.
114114
* @param slavePin which pin is used for the latch signal.
115-
* @param maxSPISpeed The requested max SPI speed. The board typically picks the
115+
* @param maxSPISpeed The requested max SPI speed. The board typically picks the
116116
* smaller of this and it's own max.
117117
*/
118118
BaseLEDMatrix(
@@ -126,48 +126,48 @@ class BaseLEDMatrix : public TimerAction {
126126
bool rowControlBitOn = LOW,
127127
unsigned int interFrameOffTimeMicros = 0,
128128
#if defined( ESP8266 )
129-
int slavePin = D8
129+
int slavePin = D8
130130
#elif defined( ESP32 )
131-
int slavePin = 5
131+
int slavePin = 5
132132
#else
133-
int slavePin = 10
133+
int slavePin = 10
134134
#endif
135135
,
136136
DeviceBitEndian bitEndian = LED_BIG_ENDIAN,
137137
unsigned long maxSPISpeed = 18000000
138138
);
139139
virtual ~BaseLEDMatrix();
140-
140+
141141
/**
142142
* Should be called before any operations against this object is performed. Child
143-
* classes implementing matrix-type specific implementation should call this parent
143+
* classes implementing matrix-type specific implementation should call this parent
144144
* class implementation of setup() before doing their own setup work.
145145
*/
146-
virtual void setup();
146+
virtual void setup();
147147

148148
void enableBlanking(int blankPin = 9 );
149149
void disableBlanking( void );
150150
void blank(void);
151151
void unblank(void);
152152

153153
/**
154-
* Increments the draw lock. While a matrix has a non-zero draw lock, any changes to
154+
* Increments the draw lock. While a matrix has a non-zero draw lock, any changes to
155155
* the image() buffer will not be pass through to the matrix scan buffer.
156156
*/
157157
void startDrawing(void) { _isDrawingCount++; }
158-
158+
159159
/**
160-
* Decrements the draw lock. All calls to startDrawing() should be balanced with a
160+
* Decrements the draw lock. All calls to startDrawing() should be balanced with a
161161
* call to stopDrawing().
162162
*/
163163
void stopDrawing(void) { _isDrawingCount--; if (_isDrawingCount < 0) { _isDrawingCount = 0; }}
164-
165-
164+
165+
166166
/**
167167
* Returns true is a draw lock is active.
168168
*/
169169
bool isDrawing(void) const { return (_isDrawingCount > 0); }
170-
170+
171171
/**
172172
* Returns the number of rows in this matrix.
173173
*
@@ -183,7 +183,7 @@ class BaseLEDMatrix : public TimerAction {
183183
unsigned int columns() const { return _columns; }
184184

185185
/**
186-
* Begins the row scan timer interrupt, which in turn starts sending data through the
186+
* Begins the row scan timer interrupt, which in turn starts sending data through the
187187
* SPI interface to the LED matrix.
188188
*/
189189
void startScanning(void);
@@ -196,7 +196,7 @@ class BaseLEDMatrix : public TimerAction {
196196
DeviceBitEndian bitEndian(void) const { return _bitEndian; }
197197

198198
/**
199-
* This methods are "private" to this class but have to be declared public so
199+
* This methods are "private" to this class but have to be declared public so
200200
* the timer interrupt can access them.
201201
*/
202202
bool doInterFrameTransmitOff( void ) const;

0 commit comments

Comments
 (0)