diff options
| author | Scott Shawcroft <scott@adafruit.com> | 2020-11-12 14:51:53 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-11-12 14:51:53 -0800 |
| commit | 8d3a878152c7cd29871c634865dd2fe2ee8b851e (patch) | |
| tree | 24a79771e8281a0c291feef9b277aed36bb59077 | |
| parent | c9952798fb265ce50e83bfd3bbfacd2de6e6fd75 (diff) | |
| parent | 42ca57ff8f19368dff97bebd9ca0ac061b219084 (diff) | |
Merge pull request #3681 from adafruit/6.0.x
Merge protomatter update back into `main`
| m--------- | lib/protomatter | 0 | ||||
| -rw-r--r-- | locale/circuitpython.pot | 5 | ||||
| -rw-r--r-- | shared-bindings/rgbmatrix/RGBMatrix.c | 7 |
3 files changed, 11 insertions, 1 deletions
diff --git a/lib/protomatter b/lib/protomatter -Subproject de6b7704c530d886ad8dfa0fa1864764d86117e +Subproject 902c16f49197a8baf5e71ec924a812a86e733a7 diff --git a/locale/circuitpython.pot b/locale/circuitpython.pot index b4445abfb..0a4303f66 100644 --- a/locale/circuitpython.pot +++ b/locale/circuitpython.pot @@ -429,6 +429,11 @@ msgstr "" msgid "Bit clock and word select must share a clock unit" msgstr "" +#: shared-bindings/rgbmatrix/RGBMatrix.c +#, c-format +msgid "Bit depth must be from 1 to 6 inclusive, not %d" +msgstr "" + #: shared-bindings/audiobusio/PDMIn.c msgid "Bit depth must be multiple of 8." msgstr "" diff --git a/shared-bindings/rgbmatrix/RGBMatrix.c b/shared-bindings/rgbmatrix/RGBMatrix.c index 753c1c920..5f5ea4fae 100644 --- a/shared-bindings/rgbmatrix/RGBMatrix.c +++ b/shared-bindings/rgbmatrix/RGBMatrix.c @@ -197,6 +197,11 @@ STATIC mp_obj_t rgbmatrix_rgbmatrix_make_new(const mp_obj_type_t *type, size_t n uint8_t clock_pin = validate_pin(args[ARG_clock_pin].u_obj); uint8_t latch_pin = validate_pin(args[ARG_latch_pin].u_obj); uint8_t output_enable_pin = validate_pin(args[ARG_output_enable_pin].u_obj); + int bit_depth = args[ARG_bit_depth].u_int; + + if (bit_depth <= 0 || bit_depth > 6) { + mp_raise_ValueError_varg(translate("Bit depth must be from 1 to 6 inclusive, not %d"), bit_depth); + } validate_pins(MP_QSTR_rgb_pins, rgb_pins, MP_ARRAY_SIZE(self->rgb_pins), args[ARG_rgb_list].u_obj, &rgb_count); validate_pins(MP_QSTR_addr_pins, addr_pins, MP_ARRAY_SIZE(self->addr_pins), args[ARG_addr_list].u_obj, &addr_count); @@ -229,7 +234,7 @@ STATIC mp_obj_t rgbmatrix_rgbmatrix_make_new(const mp_obj_type_t *type, size_t n common_hal_rgbmatrix_rgbmatrix_construct(self, args[ARG_width].u_int, - args[ARG_bit_depth].u_int, + bit_depth, rgb_count, rgb_pins, addr_count, addr_pins, clock_pin, latch_pin, output_enable_pin, |
