Skip to content

Commit 3171b82

Browse files
committed
fix: led_matrix: allow coexistence with UNO R4
Needs arduino/ArduinoCore-renesas#504 to be merged
1 parent b75e38a commit 3171b82

File tree

2 files changed

+16
-10
lines changed

2 files changed

+16
-10
lines changed

src/Modulino_LED_Matrix.h

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,6 @@
1111
#define MATRIX_WITH_ARDUINOGRAPHICS
1212
#endif
1313

14-
static uint32_t reverse(uint32_t x)
15-
{
16-
x = ((x >> 1) & 0x55555555u) | ((x & 0x55555555u) << 1);
17-
x = ((x >> 2) & 0x33333333u) | ((x & 0x33333333u) << 2);
18-
x = ((x >> 4) & 0x0f0f0f0fu) | ((x & 0x0f0f0f0fu) << 4);
19-
x = ((x >> 8) & 0x00ff00ffu) | ((x & 0x00ff00ffu) << 8);
20-
x = ((x >> 16) & 0xffffu) | ((x & 0xffffu) << 16);
21-
return x;
22-
}
23-
2414
// TODO: this is dangerous, use with care
2515
#define loadSequence(frames) loadWrapper(frames, sizeof(frames))
2616
#define renderBitmap(bitmap, rows, columns) loadPixels(&bitmap[0][0], rows*columns)
@@ -208,6 +198,17 @@ class ModulinoLEDMatrix
208198
#endif
209199

210200
private:
201+
202+
static uint32_t reverse(uint32_t x)
203+
{
204+
x = ((x >> 1) & 0x55555555u) | ((x & 0x55555555u) << 1);
205+
x = ((x >> 2) & 0x33333333u) | ((x & 0x33333333u) << 2);
206+
x = ((x >> 4) & 0x0f0f0f0fu) | ((x & 0x0f0f0f0fu) << 4);
207+
x = ((x >> 8) & 0x00ff00ffu) | ((x & 0x00ff00ffu) << 8);
208+
x = ((x >> 16) & 0xffffu) | ((x & 0xffffu) << 16);
209+
return x;
210+
}
211+
211212
int _currentFrame = 0;
212213
uint32_t _frameHolder[3];
213214
uint32_t* _frames;

src/gallery.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
#ifndef _LEDMATRIX_GALLERY_H_
2+
#define _LEDMATRIX_GALLERY_H_
3+
14
/* Icons */
25
constexpr uint32_t LEDMATRIX_BLUETOOTH[] = { 0x10428, 0xa4517ff0, 0x50088104, 66 };
36
constexpr uint32_t LEDMATRIX_BOOTLOADER_ON[] = { 0x4015, 0x2482082, 0x81100e0, 66 };
@@ -595,3 +598,5 @@ constexpr uint32_t LEDMATRIX_ANIMATION_HOURGLASS[][4] = {
595598
{ 0xe0799f87, 0xf87f87f8, 0x7f99fe07, 50 },
596599
{ 0xe0799f87, 0xf83f83f8, 0x7f99fe07, 300 }
597600
};
601+
602+
#endif // _LEDMATRIX_GALLERY_H_

0 commit comments

Comments
 (0)