rgbmatrix: Check that the number of rgb pins is supported.
Having zero RGB pins may not have been caught, nor having a non-multiple-of-6 value. Generally, users will only have 6 RGB pins unless they are driving multiple matrices in parallel. No existing breakouts exist to do this, and there are probably not any efficient pinouts to be had anyway.
This commit is contained in:
parent
176b337611
commit
e4b9c16891
|
@ -8,7 +8,7 @@ msgid ""
|
|||
msgstr ""
|
||||
"Project-Id-Version: PACKAGE VERSION\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2020-09-29 11:11+0530\n"
|
||||
"POT-Creation-Date: 2020-09-29 19:54-0500\n"
|
||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
|
@ -1662,6 +1662,10 @@ msgid ""
|
|||
"exit safe mode.\n"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/rgbmatrix/RGBMatrix.c
|
||||
msgid "The length of rgb_pins must be 6, 12, 18, 24, or 30"
|
||||
msgstr ""
|
||||
|
||||
#: supervisor/shared/safe_mode.c
|
||||
msgid ""
|
||||
"The microcontroller's power dipped. Make sure your power supply provides\n"
|
||||
|
@ -3516,6 +3520,10 @@ msgstr ""
|
|||
msgid "watchdog timeout must be greater than 0"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/rgbmatrix/RGBMatrix.c
|
||||
msgid "width must be greater than zero"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/_bleio/Adapter.c
|
||||
msgid "window must be <= interval"
|
||||
msgstr ""
|
||||
|
|
|
@ -73,6 +73,10 @@ STATIC void preflight_pins_or_throw(uint8_t clock_pin, uint8_t *rgb_pins, uint8_
|
|||
uint32_t port = clock_pin / 32;
|
||||
uint32_t bit_mask = 1 << (clock_pin % 32);
|
||||
|
||||
if (rgb_pin_count <= 0 || rgb_pin_count % 6 != 0 || rgb_pin_count > 30) {
|
||||
mp_raise_ValueError_varg(translate("The length of rgb_pins must be 6, 12, 18, 24, or 30"));
|
||||
}
|
||||
|
||||
for (uint8_t i = 0; i < rgb_pin_count; i++) {
|
||||
uint32_t pin_port = rgb_pins[i] / 32;
|
||||
|
||||
|
|
Loading…
Reference in New Issue