Skip to content

Commit 4a5632f

Browse files
committed
Fix return type of ArduinoLEDMatrix::begin()
1 parent 3dd08de commit 4a5632f

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

libraries/Arduino_LED_Matrix/src/Arduino_LED_Matrix.h

+11-6
Original file line numberDiff line numberDiff line change
@@ -169,14 +169,19 @@ class ArduinoLEDMatrix
169169
void off(size_t pin) {
170170
turnLed(pin, false);
171171
}
172-
int begin() {
172+
bool begin() {
173+
bool rv = true;
173174
uint8_t type;
174175
uint8_t ch = FspTimer::get_available_timer(type);
175-
// TODO: avoid passing "this" argument to remove autoscroll
176-
_ledTimer.begin(TIMER_MODE_PERIODIC, type, ch, 10000.0, 50.0, turnOnLedISR, this);
177-
_ledTimer.setup_overflow_irq();
178-
_ledTimer.open();
179-
_ledTimer.start();
176+
if(ch != -1) {
177+
// TODO: avoid passing "this" argument to remove autoscroll
178+
rv &= _ledTimer.begin(TIMER_MODE_PERIODIC, type, ch, 10000.0, 50.0, turnOnLedISR, this);
179+
rv &= _ledTimer.setup_overflow_irq();
180+
rv &= _ledTimer.open();
181+
rv &= _ledTimer.start();
182+
return rv;
183+
}
184+
return false;
180185
}
181186
void next() {
182187
uint32_t frame[3];

0 commit comments

Comments
 (0)