diff --git a/libraries/Arduino_LED_Matrix/src/Arduino_LED_Matrix.h b/libraries/Arduino_LED_Matrix/src/Arduino_LED_Matrix.h index 6cd4a26c9..1aba08419 100644 --- a/libraries/Arduino_LED_Matrix/src/Arduino_LED_Matrix.h +++ b/libraries/Arduino_LED_Matrix/src/Arduino_LED_Matrix.h @@ -169,14 +169,19 @@ class ArduinoLEDMatrix void off(size_t pin) { turnLed(pin, false); } - int begin() { + bool begin() { + bool rv = true; uint8_t type; uint8_t ch = FspTimer::get_available_timer(type); + if(ch == -1) { + return false; + } // TODO: avoid passing "this" argument to remove autoscroll - _ledTimer.begin(TIMER_MODE_PERIODIC, type, ch, 10000.0, 50.0, turnOnLedISR, this); - _ledTimer.setup_overflow_irq(); - _ledTimer.open(); - _ledTimer.start(); + rv &= _ledTimer.begin(TIMER_MODE_PERIODIC, type, ch, 10000.0, 50.0, turnOnLedISR, this); + rv &= _ledTimer.setup_overflow_irq(); + rv &= _ledTimer.open(); + rv &= _ledTimer.start(); + return rv; } void next() { uint32_t frame[3];