Skip to content

Commit d7efb84

Browse files
added a new bit layout mode for the RGB matrix
1 parent ad8ee99 commit d7efb84

File tree

5 files changed

+20
-4
lines changed

5 files changed

+20
-4
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
1212
### Added
1313
- Added support for the Arduino Zero and Due boards (and related)
1414
- Added method to LEDImage for drawing circles
15+
- Added a Red-Blue-Green bit layout mode for the RGB matrix object
1516

1617
## [1.0.1] - 2017-12-24
1718
### Changed

README.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,9 @@ A `TimerAction` object allows you to manage a variably timed action in a manner
7171
The basic pattern of usage is:
7272

7373
1. Create a `LEDMatrix` or `RGBLEDMatrix` matrix object passing the appropriate arguments
74-
1. In the global `setup()` method, call the `setup()` method of the matrix object to initialize all fields. This call `startScanning()` on the matrix object to cause but to be transmitted to the shift registers in the matrix.
75-
1. Draw to the `image()` object on the matrix object, but do call the `startDrawing()` matrix object method prior to any drawing, and balance the call with a call to `stopDrawing()` on the matrix object. These method prevent the image display on the matrix from being altered while you are drawing to it.
74+
1. In the global `setup()` method, call the `setup()` method of the matrix object to initialize all fields. Then call `startScanning()` on the matrix object to cause bits to be transmitted to the shift registers in the matrix.
75+
1. Draw to the `image()` object on the matrix object, but do call the `startDrawing()` matrix object method prior to any drawing, and balance the call with a call to `stopDrawing()` on the matrix object. These method prevent the image display on the matrix's LEDs from being altered while you are drawing to to the image buffer.
76+
1. Call the matrix object's `loop()` method in the global `loop()` function.
7677

7778

7879
# Notes
@@ -124,6 +125,8 @@ This driver can support either 6-bit or 12-bit color. By default, this library u
124125
* Arduino Mega 2560
125126
* Wemos D1 mini Lite
126127
* NodeMCU
128+
* Arduino Zero
129+
* Arduino Due
127130

128131
### Bit Layouts
129132
This driver can support two different bit layouts for RGB LED matrices. The default bit layout assumes each RGB LED is a single unit and each column is wired up with the RGB bits consecutively. That is, for a 4x4 matrix, the bit layout would look like this:

keywords.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,3 +68,4 @@ YELLOW_COLOR LITERAL1
6868

6969
INDIVIDUAL_LEDS LITERAL1
7070
RGB_GROUPS LITERAL1
71+
RBG_GROUPS LITERAL1

src/RGBLEDMatrix.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,11 @@ void RGBLEDMatrix::setRowBitsForFrame(
207207
greenBitOffset = this->columns();
208208
blueBitOffset = 2*this->columns();
209209
columnBitIdxIncrement = 1;
210+
} else if (_bitLayout == RBG_GROUPS) {
211+
redBitOffset = 0;
212+
greenBitOffset = 2*this->columns();
213+
blueBitOffset = this->columns();
214+
columnBitIdxIncrement = 1;
210215
}
211216
for (unsigned int col = 0; col < this->columns(); col++) {
212217
RGBColorType rgbValue = image.pixel(row, col);

src/RGBLEDMatrix.h

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,15 @@ class RGBLEDMatrix : public BaseLEDMatrix {
2929
INDIVIDUAL_LEDS,
3030

3131
// All elements of the same color are consecutive in column order. The color
32-
// are order Red, Green Blue
32+
// are order Red, Green, Blue
3333
// For a 4-column matrix, each row is ordered: RRRR-GGGG-BBBB
34-
RGB_GROUPS
34+
RGB_GROUPS,
35+
36+
// All elements of the same color are consecutive in column order. The color
37+
// are order Red, Blue, Green
38+
// For a 4-column matrix, each row is ordered: RRRR-BBBB-GGGG
39+
RBG_GROUPS
40+
3541
} RGBLEDBitLayout;
3642

3743
private:

0 commit comments

Comments
 (0)