Skip to content

Commit

Permalink
Merge branch 'main' into mp3decoder-reopen-glitch
Browse files Browse the repository at this point in the history
  • Loading branch information
jepler authored Dec 5, 2024
2 parents 22abf2d + 2bb9fc4 commit 5e204c9
Show file tree
Hide file tree
Showing 7 changed files with 60 additions and 95 deletions.
4 changes: 2 additions & 2 deletions locale/en_GB.po
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2024-11-14 12:00+0000\n"
"PO-Revision-Date: 2024-12-04 13:00+0000\n"
"Last-Translator: Andi Chandler <[email protected]>\n"
"Language-Team: none\n"
"Language: en_GB\n"
Expand Down Expand Up @@ -2535,7 +2535,7 @@ msgstr "binary op %q not implemented"

#: ports/espressif/common-hal/audiobusio/PDMIn.c
msgid "bit_depth must be 8, 16, 24, or 32."
msgstr ""
msgstr "bit_depth must be 8, 16, 24, or 32."

#: shared-module/bitmapfilter/__init__.c
msgid "bitmap size and depth must match"
Expand Down
6 changes: 3 additions & 3 deletions locale/pt_BR.po
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-01-04 12:55-0600\n"
"PO-Revision-Date: 2024-11-11 07:05+0000\n"
"PO-Revision-Date: 2024-12-04 19:57+0000\n"
"Last-Translator: Wellington Terumi Uemura <[email protected]>\n"
"Language-Team: \n"
"Language: pt_BR\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=n > 1;\n"
"X-Generator: Weblate 5.8.2\n"
"X-Generator: Weblate 5.9-dev\n"

#: main.c
msgid ""
Expand Down Expand Up @@ -2571,7 +2571,7 @@ msgstr "a operação binário %q não foi implementada"

#: ports/espressif/common-hal/audiobusio/PDMIn.c
msgid "bit_depth must be 8, 16, 24, or 32."
msgstr ""
msgstr "o bit_depth deve ser 8, 16, 24 ou 32."

#: shared-module/bitmapfilter/__init__.c
msgid "bitmap size and depth must match"
Expand Down
10 changes: 10 additions & 0 deletions ports/atmel-samd/boards/itsybitsy_m4_express/mpconfigboard.mk
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,13 @@ CIRCUITPY_GIFIO = 0
CIRCUITPY_JPEGIO = 0

CIRCUITPY_BITBANG_APA102 = 1

# We don't have room for the fonts for terminalio for certain languages,
# so turn off terminalio, and if it's off and displayio is on,
# force a clean build.
# Note that we cannot test $(CIRCUITPY_DISPLAYIO) directly with an
# ifeq, because it's not set yet.
ifneq (,$(filter $(TRANSLATION),ja ko ru))
CIRCUITPY_TERMINALIO = 0
RELEASE_NEEDS_CLEAN_BUILD = $(CIRCUITPY_DISPLAYIO)
endif
64 changes: 16 additions & 48 deletions shared-bindings/audiodelays/Echo.c
Original file line number Diff line number Diff line change
Expand Up @@ -153,20 +153,12 @@ static mp_obj_t audiodelays_echo_obj_get_delay_ms(mp_obj_t self_in) {
}
MP_DEFINE_CONST_FUN_OBJ_1(audiodelays_echo_get_delay_ms_obj, audiodelays_echo_obj_get_delay_ms);

static mp_obj_t audiodelays_echo_obj_set_delay_ms(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
enum { ARG_delay_ms };
static const mp_arg_t allowed_args[] = {
{ MP_QSTR_delay_ms, MP_ARG_OBJ | MP_ARG_REQUIRED, {} },
};
audiodelays_echo_obj_t *self = MP_OBJ_TO_PTR(pos_args[0]);
mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)];
mp_arg_parse_all(n_args - 1, pos_args + 1, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args);

common_hal_audiodelays_echo_set_delay_ms(self, args[ARG_delay_ms].u_obj);

static mp_obj_t audiodelays_echo_obj_set_delay_ms(mp_obj_t self_in, mp_obj_t delay_ms_in) {
audiodelays_echo_obj_t *self = MP_OBJ_TO_PTR(self_in);
common_hal_audiodelays_echo_set_delay_ms(self, delay_ms_in);
return mp_const_none;
}
MP_DEFINE_CONST_FUN_OBJ_KW(audiodelays_echo_set_delay_ms_obj, 1, audiodelays_echo_obj_set_delay_ms);
MP_DEFINE_CONST_FUN_OBJ_2(audiodelays_echo_set_delay_ms_obj, audiodelays_echo_obj_set_delay_ms);

MP_PROPERTY_GETSET(audiodelays_echo_delay_ms_obj,
(mp_obj_t)&audiodelays_echo_get_delay_ms_obj,
Expand All @@ -179,20 +171,12 @@ static mp_obj_t audiodelays_echo_obj_get_decay(mp_obj_t self_in) {
}
MP_DEFINE_CONST_FUN_OBJ_1(audiodelays_echo_get_decay_obj, audiodelays_echo_obj_get_decay);

static mp_obj_t audiodelays_echo_obj_set_decay(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
enum { ARG_decay };
static const mp_arg_t allowed_args[] = {
{ MP_QSTR_decay, MP_ARG_OBJ | MP_ARG_REQUIRED, {} },
};
audiodelays_echo_obj_t *self = MP_OBJ_TO_PTR(pos_args[0]);
mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)];
mp_arg_parse_all(n_args - 1, pos_args + 1, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args);

common_hal_audiodelays_echo_set_decay(self, args[ARG_decay].u_obj);

static mp_obj_t audiodelays_echo_obj_set_decay(mp_obj_t self_in, mp_obj_t decay_in) {
audiodelays_echo_obj_t *self = MP_OBJ_TO_PTR(self_in);
common_hal_audiodelays_echo_set_decay(self, decay_in);
return mp_const_none;
}
MP_DEFINE_CONST_FUN_OBJ_KW(audiodelays_echo_set_decay_obj, 1, audiodelays_echo_obj_set_decay);
MP_DEFINE_CONST_FUN_OBJ_2(audiodelays_echo_set_decay_obj, audiodelays_echo_obj_set_decay);

MP_PROPERTY_GETSET(audiodelays_echo_decay_obj,
(mp_obj_t)&audiodelays_echo_get_decay_obj,
Expand All @@ -205,20 +189,12 @@ static mp_obj_t audiodelays_echo_obj_get_mix(mp_obj_t self_in) {
}
MP_DEFINE_CONST_FUN_OBJ_1(audiodelays_echo_get_mix_obj, audiodelays_echo_obj_get_mix);

static mp_obj_t audiodelays_echo_obj_set_mix(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
enum { ARG_mix };
static const mp_arg_t allowed_args[] = {
{ MP_QSTR_mix, MP_ARG_OBJ | MP_ARG_REQUIRED, {} },
};
audiodelays_echo_obj_t *self = MP_OBJ_TO_PTR(pos_args[0]);
mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)];
mp_arg_parse_all(n_args - 1, pos_args + 1, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args);

common_hal_audiodelays_echo_set_mix(self, args[ARG_mix].u_obj);

static mp_obj_t audiodelays_echo_obj_set_mix(mp_obj_t self_in, mp_obj_t mix_in) {
audiodelays_echo_obj_t *self = MP_OBJ_TO_PTR(self_in);
common_hal_audiodelays_echo_set_mix(self, mix_in);
return mp_const_none;
}
MP_DEFINE_CONST_FUN_OBJ_KW(audiodelays_echo_set_mix_obj, 1, audiodelays_echo_obj_set_mix);
MP_DEFINE_CONST_FUN_OBJ_2(audiodelays_echo_set_mix_obj, audiodelays_echo_obj_set_mix);

MP_PROPERTY_GETSET(audiodelays_echo_mix_obj,
(mp_obj_t)&audiodelays_echo_get_mix_obj,
Expand All @@ -233,20 +209,12 @@ static mp_obj_t audiodelays_echo_obj_get_freq_shift(mp_obj_t self_in) {
}
MP_DEFINE_CONST_FUN_OBJ_1(audiodelays_echo_get_freq_shift_obj, audiodelays_echo_obj_get_freq_shift);

static mp_obj_t audiodelays_echo_obj_set_freq_shift(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
enum { ARG_freq_shift };
static const mp_arg_t allowed_args[] = {
{ MP_QSTR_freq_shift, MP_ARG_BOOL | MP_ARG_REQUIRED, {} },
};
audiodelays_echo_obj_t *self = MP_OBJ_TO_PTR(pos_args[0]);
mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)];
mp_arg_parse_all(n_args - 1, pos_args + 1, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args);

common_hal_audiodelays_echo_set_freq_shift(self, args[ARG_freq_shift].u_bool);

static mp_obj_t audiodelays_echo_obj_set_freq_shift(mp_obj_t self_in, mp_obj_t freq_shift_in) {
audiodelays_echo_obj_t *self = MP_OBJ_TO_PTR(self_in);
common_hal_audiodelays_echo_set_freq_shift(self, mp_obj_is_true(freq_shift_in));
return mp_const_none;
}
MP_DEFINE_CONST_FUN_OBJ_KW(audiodelays_echo_set_freq_shift_obj, 1, audiodelays_echo_obj_set_freq_shift);
MP_DEFINE_CONST_FUN_OBJ_2(audiodelays_echo_set_freq_shift_obj, audiodelays_echo_obj_set_freq_shift);

MP_PROPERTY_GETSET(audiodelays_echo_freq_shift_obj,
(mp_obj_t)&audiodelays_echo_get_freq_shift_obj,
Expand Down
32 changes: 8 additions & 24 deletions shared-bindings/audiofilters/Filter.c
Original file line number Diff line number Diff line change
Expand Up @@ -139,20 +139,12 @@ static mp_obj_t audiofilters_filter_obj_get_filter(mp_obj_t self_in) {
}
MP_DEFINE_CONST_FUN_OBJ_1(audiofilters_filter_get_filter_obj, audiofilters_filter_obj_get_filter);

static mp_obj_t audiofilters_filter_obj_set_filter(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
enum { ARG_filter };
static const mp_arg_t allowed_args[] = {
{ MP_QSTR_filter, MP_ARG_OBJ | MP_ARG_REQUIRED, {} },
};
audiofilters_filter_obj_t *self = MP_OBJ_TO_PTR(pos_args[0]);
mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)];
mp_arg_parse_all(n_args - 1, pos_args + 1, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args);

common_hal_audiofilters_filter_set_filter(self, args[ARG_filter].u_obj);

static mp_obj_t audiofilters_filter_obj_set_filter(mp_obj_t self_in, mp_obj_t filter_in) {
audiofilters_filter_obj_t *self = MP_OBJ_TO_PTR(self_in);
common_hal_audiofilters_filter_set_filter(self, filter_in);
return mp_const_none;
}
MP_DEFINE_CONST_FUN_OBJ_KW(audiofilters_filter_set_filter_obj, 1, audiofilters_filter_obj_set_filter);
MP_DEFINE_CONST_FUN_OBJ_2(audiofilters_filter_set_filter_obj, audiofilters_filter_obj_set_filter);

MP_PROPERTY_GETSET(audiofilters_filter_filter_obj,
(mp_obj_t)&audiofilters_filter_get_filter_obj,
Expand All @@ -166,20 +158,12 @@ static mp_obj_t audiofilters_filter_obj_get_mix(mp_obj_t self_in) {
}
MP_DEFINE_CONST_FUN_OBJ_1(audiofilters_filter_get_mix_obj, audiofilters_filter_obj_get_mix);

static mp_obj_t audiofilters_filter_obj_set_mix(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
enum { ARG_mix };
static const mp_arg_t allowed_args[] = {
{ MP_QSTR_mix, MP_ARG_OBJ | MP_ARG_REQUIRED, {} },
};
audiofilters_filter_obj_t *self = MP_OBJ_TO_PTR(pos_args[0]);
mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)];
mp_arg_parse_all(n_args - 1, pos_args + 1, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args);

common_hal_audiofilters_filter_set_mix(self, args[ARG_mix].u_obj);

static mp_obj_t audiofilters_filter_obj_set_mix(mp_obj_t self_in, mp_obj_t mix_in) {
audiofilters_filter_obj_t *self = MP_OBJ_TO_PTR(self_in);
common_hal_audiofilters_filter_set_mix(self, mix_in);
return mp_const_none;
}
MP_DEFINE_CONST_FUN_OBJ_KW(audiofilters_filter_set_mix_obj, 1, audiofilters_filter_obj_set_mix);
MP_DEFINE_CONST_FUN_OBJ_2(audiofilters_filter_set_mix_obj, audiofilters_filter_obj_set_mix);

MP_PROPERTY_GETSET(audiofilters_filter_mix_obj,
(mp_obj_t)&audiofilters_filter_get_mix_obj,
Expand Down
21 changes: 4 additions & 17 deletions shared-bindings/audiomixer/MixerVoice.c
Original file line number Diff line number Diff line change
Expand Up @@ -82,26 +82,13 @@ static mp_obj_t audiomixer_mixervoice_obj_get_level(mp_obj_t self_in) {
}
MP_DEFINE_CONST_FUN_OBJ_1(audiomixer_mixervoice_get_level_obj, audiomixer_mixervoice_obj_get_level);

static mp_obj_t audiomixer_mixervoice_obj_set_level(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
enum { ARG_level };
static const mp_arg_t allowed_args[] = {
{ MP_QSTR_level, MP_ARG_OBJ | MP_ARG_REQUIRED, {} },
};
audiomixer_mixervoice_obj_t *self = MP_OBJ_TO_PTR(pos_args[0]);
mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)];
mp_arg_parse_all(n_args - 1, pos_args + 1, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args);

mp_float_t level = mp_obj_get_float(args[ARG_level].u_obj);

if (level > 1 || level < 0) {
mp_raise_ValueError(MP_ERROR_TEXT("level must be between 0 and 1"));
}

static mp_obj_t audiomixer_mixervoice_obj_set_level(mp_obj_t self_in, mp_obj_t level_in) {
audiomixer_mixervoice_obj_t *self = MP_OBJ_TO_PTR(self_in);
mp_float_t level = mp_arg_validate_obj_float_range(level_in, 0, 1, MP_QSTR_level);
common_hal_audiomixer_mixervoice_set_level(self, level);

return mp_const_none;
}
MP_DEFINE_CONST_FUN_OBJ_KW(audiomixer_mixervoice_set_level_obj, 1, audiomixer_mixervoice_obj_set_level);
MP_DEFINE_CONST_FUN_OBJ_2(audiomixer_mixervoice_set_level_obj, audiomixer_mixervoice_obj_set_level);

MP_PROPERTY_GETSET(audiomixer_mixervoice_level_obj,
(mp_obj_t)&audiomixer_mixervoice_get_level_obj,
Expand Down
18 changes: 17 additions & 1 deletion shared-bindings/rgbmatrix/RGBMatrix.c
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,16 @@ static void preflight_pins_or_throw(uint8_t clock_pin, uint8_t *rgb_pins, uint8_
#endif
}

typedef struct {
nlr_jump_callback_node_t callback;
mp_obj_base_t *base_ptr;
} nlr_jump_callback_node_clear_displaybus_t;

static void clear_display_bus(void *node_in) {
nlr_jump_callback_node_clear_displaybus_t *node = node_in;
node->base_ptr->type = &mp_type_NoneType;
}

//| def __init__(
//| self,
//| *,
Expand Down Expand Up @@ -217,6 +227,13 @@ static mp_obj_t rgbmatrix_rgbmatrix_make_new(const mp_obj_type_t *type, size_t n
rgbmatrix_rgbmatrix_obj_t *self = &allocate_display_bus_or_raise()->rgbmatrix;
self->base.type = &rgbmatrix_RGBMatrix_type;

// If an exception is thrown, ensure the display bus object's type is set
// back to the uninitialized/deinitialied type. **note that all other resource
// deallocations must be handled by the shared-module code**
nlr_jump_callback_node_clear_displaybus_t node;
node.base_ptr = &self->base;
nlr_push_jump_callback(&node.callback, clear_display_bus);

uint8_t rgb_count, addr_count;
uint8_t rgb_pins[MP_ARRAY_SIZE(self->rgb_pins)];
uint8_t addr_pins[MP_ARRAY_SIZE(self->addr_pins)];
Expand Down Expand Up @@ -254,7 +271,6 @@ static mp_obj_t rgbmatrix_rgbmatrix_make_new(const mp_obj_type_t *type, size_t n
clock_pin, latch_pin, output_enable_pin,
args[ARG_doublebuffer].u_bool,
args[ARG_framebuffer].u_obj, tile, args[ARG_serpentine].u_bool, NULL);

claim_and_never_reset_pins(args[ARG_rgb_list].u_obj);
claim_and_never_reset_pins(args[ARG_addr_list].u_obj);
claim_and_never_reset_pin(args[ARG_clock_pin].u_obj);
Expand Down

0 comments on commit 5e204c9

Please sign in to comment.