Skip to content

Commit b0a18c0

Browse files
KurtEpillo79
authored andcommitted
Arduino_LED_Matrix: add const to matrixWrite
This allows you to then change the sketch(s) used within the test apps for the Q to use this header file with little changes to them. Like the Weather forecast on LED matrix #include "Arduino_LED_Matrix.h" Arduino_LED_Matrix matrix; void setup() { matrix.begin(); ... Or in my test app I also then included ArduinoGraphics #include <Arduino_RouterBridge.h> #include "ArduinoGraphics.h" ...
1 parent 93ad66d commit b0a18c0

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

libraries/Arduino_LED_Matrix/src/Arduino_LED_Matrix.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44
extern "C" {
55
void matrixBegin(void);
66
void matrixEnd(void);
7-
void matrixPlay(uint8_t *buf, uint32_t len);
7+
void matrixPlay(const uint8_t *buf, uint32_t len);
88
void matrixSetGrayscaleBits(uint8_t _max);
9-
void matrixGrayscaleWrite(uint8_t *buf);
10-
void matrixWrite(uint32_t *buf);
9+
void matrixGrayscaleWrite(const uint8_t *buf);
10+
void matrixWrite(const uint32_t *buf);
1111
};
1212

1313
#if __has_include("ArduinoGraphics.h")

loader/matrix.inc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -163,12 +163,12 @@ static void timer_irq_handler_fn(const struct device *counter_dev, void *user_da
163163
i_isr = (i_isr + 1) % NUM_MATRIX_LEDS;
164164
}
165165

166-
void matrixWrite(uint32_t* buf) {
166+
void matrixWrite(const uint32_t* buf) {
167167
memcpy(framebuffer, buf, NUM_MATRIX_LEDS/8);
168168
color = false;
169169
}
170170

171-
void matrixGrayscaleWrite(uint8_t* buf) {
171+
void matrixGrayscaleWrite(const uint8_t* buf) {
172172
memcpy(framebuffer_color, buf, NUM_MATRIX_LEDS);
173173
color = true;
174174
}
@@ -201,7 +201,7 @@ void matrixEnd() {
201201
}
202202

203203

204-
void matrixPlay(uint8_t* buf, uint32_t len) {
204+
void matrixPlay(const uint8_t* buf, uint32_t len) {
205205
int i = 0;
206206
while (i < (len / 104)) {
207207
matrixGrayscaleWrite(&buf[i*104]);

0 commit comments

Comments
 (0)