Skip to content

Commit 6df88ac

Browse files
authored
Merge pull request #7825 from jepler/better-synthio
Better synthio
2 parents a8ea8ea + f2e26e8 commit 6df88ac

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+915
-145
lines changed

locale/circuitpython.pot

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,10 @@ msgstr ""
193193
msgid "%q must be array of type 'H'"
194194
msgstr ""
195195

196+
#: shared-bindings/synthio/MidiTrack.c shared-bindings/synthio/__init__.c
197+
msgid "%q must be array of type 'h'"
198+
msgstr ""
199+
196200
#: ports/raspberrypi/bindings/cyw43/__init__.c py/argcheck.c py/objexcept.c
197201
#: shared-bindings/canio/CAN.c shared-bindings/digitalio/Pull.c
198202
msgid "%q must be of type %q or %q, not %q"

ports/atmel-samd/boards/pewpew_m4/mpconfigboard.mk

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ CIRCUITPY_AUDIOIO = 1
4444
CIRCUITPY_AUDIOMIXER = 1
4545
CIRCUITPY_DISPLAYIO = 1
4646
CIRCUITPY_KEYPAD = 1
47+
CIRCUITPY_KEYPAD_SHIFTREGISTERKEYS = 0
48+
CIRCUITPY_KEYPAD_KEYMATRIX = 0
4749
CIRCUITPY_MATH = 1
4850
CIRCUITPY_STAGE = 1
4951
CIRCUITPY_SYNTHIO = 1

ports/mimxrt10xx/Makefile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ INC += \
3838
-Iboards/$(BOARD) \
3939
-Iperipherals/ \
4040
-Iperipherals/mimxrt10xx/ \
41-
-Isdk/CMSIS/Include \
4241
-Isdk/devices/$(CHIP_FAMILY) \
4342
-Isdk/devices/$(CHIP_FAMILY)/drivers \
4443
-Isdk/drivers/common

ports/mimxrt10xx/mpconfigport.mk

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ CIRCUITPY_AUDIOIO = 0
1818
CIRCUITPY_AUDIOMIXER = 1
1919
CIRCUITPY_AUDIOMP3 = 1
2020
CIRCUITPY_AUDIOPWMIO = 1
21+
CIRCUITPY_SYNTHIO_MAX_CHANNELS = 12
2122
CIRCUITPY_BUSDEVICE = 1
2223
CIRCUITPY_COUNTIO = 0
2324
CIRCUITPY_FREQUENCYIO = 0

ports/raspberrypi/mpconfigport.mk

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ CIRCUITPY_PWMIO ?= 1
1919
CIRCUITPY_RGBMATRIX ?= $(CIRCUITPY_DISPLAYIO)
2020
CIRCUITPY_ROTARYIO ?= 1
2121
CIRCUITPY_ROTARYIO_SOFTENCODER = 1
22+
CIRCUITPY_SYNTHIO_MAX_CHANNELS = 12
2223

2324
# Things that need to be implemented.
2425
# Use PWM internally

ports/unix/variants/coverage/mpconfigvariant.mk

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,30 @@ SRC_BITMAP := \
3030
displayio_min.c \
3131
shared-bindings/aesio/aes.c \
3232
shared-bindings/aesio/__init__.c \
33+
shared-bindings/audiocore/__init__.c \
34+
shared-bindings/audiocore/RawSample.c \
35+
shared-bindings/audiocore/WaveFile.c \
36+
shared-bindings/audiomixer/__init__.c \
37+
shared-bindings/audiomixer/Mixer.c \
38+
shared-bindings/audiomixer/MixerVoice.c \
3339
shared-bindings/bitmaptools/__init__.c \
3440
shared-bindings/displayio/Bitmap.c \
3541
shared-bindings/rainbowio/__init__.c \
3642
shared-bindings/struct/__init__.c \
43+
shared-bindings/synthio/__init__.c \
44+
shared-bindings/synthio/MidiTrack.c \
45+
shared-bindings/synthio/Synthesizer.c \
3746
shared-bindings/traceback/__init__.c \
3847
shared-bindings/util.c \
3948
shared-bindings/zlib/__init__.c \
4049
shared-module/aesio/aes.c \
4150
shared-module/aesio/__init__.c \
51+
shared-module/audiocore/__init__.c \
52+
shared-module/audiocore/RawSample.c \
53+
shared-module/audiocore/WaveFile.c \
54+
shared-module/audiomixer/__init__.c \
55+
shared-module/audiomixer/Mixer.c \
56+
shared-module/audiomixer/MixerVoice.c \
4257
shared-module/bitmaptools/__init__.c \
4358
shared-module/displayio/area.c \
4459
shared-module/displayio/Bitmap.c \
@@ -47,19 +62,27 @@ SRC_BITMAP := \
4762
shared-module/os/getenv.c \
4863
shared-module/rainbowio/__init__.c \
4964
shared-module/struct/__init__.c \
65+
shared-module/synthio/__init__.c \
66+
shared-module/synthio/MidiTrack.c \
67+
shared-module/synthio/Synthesizer.c \
5068
shared-module/traceback/__init__.c \
5169
shared-module/zlib/__init__.c \
5270

5371
SRC_C += $(SRC_BITMAP)
5472

5573
CFLAGS += \
5674
-DCIRCUITPY_AESIO=1 \
75+
-DCIRCUITPY_AUDIOCORE=1 \
76+
-DCIRCUITPY_AUDIOMIXER=1 \
77+
-DCIRCUITPY_AUDIOCORE_DEBUG=1 \
5778
-DCIRCUITPY_BITMAPTOOLS=1 \
5879
-DCIRCUITPY_DISPLAYIO_UNIX=1 \
59-
-DCIRCUITPY_OS_GETENV=1 \
6080
-DCIRCUITPY_GIFIO=1 \
81+
-DCIRCUITPY_OS_GETENV=1 \
6182
-DCIRCUITPY_RAINBOWIO=1 \
6283
-DCIRCUITPY_STRUCT=1 \
84+
-DCIRCUITPY_SYNTHIO=1 \
85+
-DCIRCUITPY_SYNTHIO_MAX_CHANNELS=14 \
6386
-DCIRCUITPY_TRACEBACK=1 \
6487
-DCIRCUITPY_ZLIB=1
6588

py/circuitpy_defns.mk

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -648,6 +648,7 @@ SRC_SHARED_MODULE_ALL = \
648648
supervisor/__init__.c \
649649
supervisor/StatusBar.c \
650650
synthio/MidiTrack.c \
651+
synthio/Synthesizer.c \
651652
synthio/__init__.c \
652653
terminalio/Terminal.c \
653654
terminalio/__init__.c \

py/circuitpy_mpconfig.mk

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,11 @@ CFLAGS += -DCIRCUITPY_AUDIOCORE=$(CIRCUITPY_AUDIOCORE)
107107
CIRCUITPY_AUDIOMIXER ?= $(CIRCUITPY_AUDIOIO)
108108
CFLAGS += -DCIRCUITPY_AUDIOMIXER=$(CIRCUITPY_AUDIOMIXER)
109109

110+
ifndef CIRCUITPY_AUDIOCORE_DEBUG
111+
CIRCUITPY_AUDIOCORE_DEBUG ?= 0
112+
endif
113+
CFLAGS += -DCIRCUITPY_AUDIOCORE_DEBUG=$(CIRCUITPY_AUDIOCORE_DEBUG)
114+
110115
ifndef CIRCUITPY_AUDIOMP3
111116
ifeq ($(CIRCUITPY_FULL_BUILD),1)
112117
CIRCUITPY_AUDIOMP3 = $(CIRCUITPY_AUDIOCORE)
@@ -286,6 +291,15 @@ CFLAGS += -DCIRCUITPY_JSON=$(CIRCUITPY_JSON)
286291
CIRCUITPY_KEYPAD ?= $(CIRCUITPY_FULL_BUILD)
287292
CFLAGS += -DCIRCUITPY_KEYPAD=$(CIRCUITPY_KEYPAD)
288293

294+
CIRCUITPY_KEYPAD_KEYS ?= $(CIRCUITPY_KEYPAD)
295+
CFLAGS += -DCIRCUITPY_KEYPAD_KEYS=$(CIRCUITPY_KEYPAD_KEYS)
296+
297+
CIRCUITPY_KEYPAD_KEYMATRIX ?= $(CIRCUITPY_KEYPAD)
298+
CFLAGS += -DCIRCUITPY_KEYPAD_KEYMATRIX=$(CIRCUITPY_KEYPAD_KEYMATRIX)
299+
300+
CIRCUITPY_KEYPAD_SHIFTREGISTERKEYS ?= $(CIRCUITPY_KEYPAD)
301+
CFLAGS += -DCIRCUITPY_KEYPAD_SHIFTREGISTERKEYS=$(CIRCUITPY_KEYPAD_SHIFTREGISTERKEYS)
302+
289303
CIRCUITPY_MATH ?= 1
290304
CFLAGS += -DCIRCUITPY_MATH=$(CIRCUITPY_MATH)
291305

@@ -437,6 +451,10 @@ CFLAGS += -DCIRCUITPY_SUPERVISOR=$(CIRCUITPY_SUPERVISOR)
437451
CIRCUITPY_SYNTHIO ?= $(CIRCUITPY_AUDIOCORE)
438452
CFLAGS += -DCIRCUITPY_SYNTHIO=$(CIRCUITPY_SYNTHIO)
439453

454+
CIRCUITPY_SYNTHIO_MAX_CHANNELS ?= 2
455+
CFLAGS += -DCIRCUITPY_SYNTHIO_MAX_CHANNELS=$(CIRCUITPY_SYNTHIO_MAX_CHANNELS)
456+
457+
440458
CIRCUITPY_SYS ?= 1
441459
CFLAGS += -DCIRCUITPY_SYS=$(CIRCUITPY_SYS)
442460

shared-bindings/audiobusio/I2SOut.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@
9797
//| ...
9898
STATIC mp_obj_t audiobusio_i2sout_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) {
9999
#if !CIRCUITPY_AUDIOBUSIO_I2SOUT
100-
mp_raise_NotImplementedError(translate("I2SOut not available"));
100+
mp_raise_NotImplementedError_varg(translate("%q"), MP_QSTR_I2SOut);
101101
return NULL; // Not reachable.
102102
#else
103103
enum { ARG_bit_clock, ARG_word_select, ARG_data, ARG_left_justified };

shared-bindings/audiobusio/PDMIn.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@
9494
//| ...
9595
STATIC mp_obj_t audiobusio_pdmin_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) {
9696
#if !CIRCUITPY_AUDIOBUSIO_PDMIN
97-
mp_raise_NotImplementedError(translate("PDMIn not available"));
97+
mp_raise_NotImplementedError_varg(translate("%q"), MP_QSTR_PDMIn);
9898
#else
9999
enum { ARG_clock_pin, ARG_data_pin, ARG_sample_rate, ARG_bit_depth, ARG_mono, ARG_oversample, ARG_startup_delay };
100100
static const mp_arg_t allowed_args[] = {

shared-bindings/audiocore/RawSample.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
//| def __init__(
4141
//| self, buffer: ReadableBuffer, *, channel_count: int = 1, sample_rate: int = 8000
4242
//| ) -> None:
43-
//| """Create a RawSample based on the given buffer of signed values. If channel_count is more than
43+
//| """Create a RawSample based on the given buffer of values. If channel_count is more than
4444
//| 1 then each channel's samples should alternate. In other words, for a two channel buffer, the
4545
//| first sample will be for channel 1, the second sample will be for channel two, the third for
4646
//| channel 1 and so on.

shared-bindings/audiocore/WaveFile.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
#include "shared-bindings/audiocore/WaveFile.h"
3333
#include "shared-bindings/util.h"
3434
#include "supervisor/shared/translate/translate.h"
35+
#include "extmod/vfs_posix.h"
3536

3637
//| class WaveFile:
3738
//| """Load a wave file for audio playback

shared-bindings/audiocore/__init__.c

Lines changed: 47 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,18 +29,64 @@
2929
#include "py/obj.h"
3030
#include "py/runtime.h"
3131

32-
#include "shared-bindings/microcontroller/Pin.h"
3332
#include "shared-bindings/audiocore/__init__.h"
3433
#include "shared-bindings/audiocore/RawSample.h"
3534
#include "shared-bindings/audiocore/WaveFile.h"
3635
// #include "shared-bindings/audiomixer/Mixer.h"
3736

3837
//| """Support for audio samples"""
3938

39+
#if CIRCUITPY_AUDIOCORE_DEBUG
40+
// (no docstrings so that the debug functions are not shown on docs.circuitpython.org)
41+
STATIC mp_obj_t audiocore_get_buffer(mp_obj_t sample_in) {
42+
uint8_t *buffer = NULL;
43+
uint32_t buffer_length = 0;
44+
audioio_get_buffer_result_t gbr = audiosample_get_buffer(sample_in, false, 0, &buffer, &buffer_length);
45+
46+
mp_obj_t result[2] = {mp_obj_new_int_from_uint(gbr), mp_const_none};
47+
48+
if (gbr != GET_BUFFER_ERROR) {
49+
// copies the data because the gc semantics of get_buffer are unclear
50+
result[1] = mp_obj_new_bytes(buffer, buffer_length);
51+
}
52+
53+
return mp_obj_new_tuple(2, result);
54+
}
55+
STATIC MP_DEFINE_CONST_FUN_OBJ_1(audiocore_get_buffer_obj, audiocore_get_buffer);
56+
57+
STATIC mp_obj_t audiocore_get_structure(mp_obj_t sample_in) {
58+
bool single_buffer, samples_signed;
59+
uint32_t max_buffer_length;
60+
uint8_t spacing;
61+
62+
audiosample_get_buffer_structure(sample_in, false, &single_buffer, &samples_signed, &max_buffer_length, &spacing);
63+
mp_obj_t result[4] = {
64+
mp_obj_new_int_from_uint(single_buffer),
65+
mp_obj_new_int_from_uint(samples_signed),
66+
mp_obj_new_int_from_uint(max_buffer_length),
67+
mp_obj_new_int_from_uint(spacing),
68+
};
69+
return mp_obj_new_tuple(4, result);
70+
}
71+
STATIC MP_DEFINE_CONST_FUN_OBJ_1(audiocore_get_structure_obj, audiocore_get_structure);
72+
73+
STATIC mp_obj_t audiocore_reset_buffer(mp_obj_t sample_in) {
74+
audiosample_reset_buffer(sample_in, false, 0);
75+
return mp_const_none;
76+
}
77+
STATIC MP_DEFINE_CONST_FUN_OBJ_1(audiocore_reset_buffer_obj, audiocore_reset_buffer);
78+
79+
#endif
80+
4081
STATIC const mp_rom_map_elem_t audiocore_module_globals_table[] = {
4182
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_audiocore) },
4283
{ MP_ROM_QSTR(MP_QSTR_RawSample), MP_ROM_PTR(&audioio_rawsample_type) },
4384
{ MP_ROM_QSTR(MP_QSTR_WaveFile), MP_ROM_PTR(&audioio_wavefile_type) },
85+
#if CIRCUITPY_AUDIOCORE_DEBUG
86+
{ MP_ROM_QSTR(MP_QSTR_get_buffer), MP_ROM_PTR(&audiocore_get_buffer_obj) },
87+
{ MP_ROM_QSTR(MP_QSTR_reset_buffer), MP_ROM_PTR(&audiocore_reset_buffer_obj) },
88+
{ MP_ROM_QSTR(MP_QSTR_get_structure), MP_ROM_PTR(&audiocore_get_structure_obj) },
89+
#endif
4490
};
4591

4692
STATIC MP_DEFINE_CONST_DICT(audiocore_module_globals, audiocore_module_globals_table);

shared-bindings/audiomixer/Mixer.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,6 @@
3333
#include "py/binary.h"
3434
#include "py/objproperty.h"
3535
#include "py/runtime.h"
36-
#include "shared-bindings/microcontroller/Pin.h"
37-
#include "shared-bindings/audiocore/RawSample.h"
3836
#include "shared-bindings/util.h"
3937
#include "supervisor/shared/translate/translate.h"
4038

shared-bindings/audiomixer/Mixer.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,7 @@
2727
#ifndef MICROPY_INCLUDED_SHARED_BINDINGS_AUDIOMIXER_MIXER_H
2828
#define MICROPY_INCLUDED_SHARED_BINDINGS_AUDIOMIXER_MIXER_H
2929

30-
#include "common-hal/microcontroller/Pin.h"
3130
#include "shared-module/audiomixer/Mixer.h"
32-
#include "shared-bindings/audiocore/RawSample.h"
3331

3432
extern const mp_obj_type_t audiomixer_mixer_type;
3533
extern const mp_obj_type_t audiomixer_mixervoice_type;

shared-bindings/audiomixer/MixerVoice.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,6 @@
3232
#include "py/binary.h"
3333
#include "py/objproperty.h"
3434
#include "py/runtime.h"
35-
#include "shared-bindings/microcontroller/Pin.h"
36-
#include "shared-bindings/audiocore/RawSample.h"
3735
#include "shared-bindings/util.h"
3836
#include "supervisor/shared/translate/translate.h"
3937

@@ -115,7 +113,7 @@ STATIC mp_obj_t audiomixer_mixervoice_obj_set_level(size_t n_args, const mp_obj_
115113
mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)];
116114
mp_arg_parse_all(n_args - 1, pos_args + 1, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args);
117115

118-
float level = mp_obj_get_float(args[ARG_level].u_obj);
116+
mp_float_t level = mp_obj_get_float(args[ARG_level].u_obj);
119117

120118
if (level > 1 || level < 0) {
121119
mp_raise_ValueError(translate("level must be between 0 and 1"));

shared-bindings/audiomixer/MixerVoice.h

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,6 @@
2626
#ifndef SHARED_BINDINGS_AUDIOMIXER_MIXERVOICE_H_
2727
#define SHARED_BINDINGS_AUDIOMIXER_MIXERVOICE_H_
2828

29-
#include "common-hal/microcontroller/Pin.h"
30-
#include "shared-bindings/audiocore/RawSample.h"
31-
3229
#include "shared-module/audiomixer/MixerVoice.h"
3330
#include "shared-module/audiomixer/Mixer.h"
3431

@@ -39,8 +36,8 @@ void common_hal_audiomixer_mixervoice_construct(audiomixer_mixervoice_obj_t *sel
3936
void common_hal_audiomixer_mixervoice_set_parent(audiomixer_mixervoice_obj_t *self, audiomixer_mixer_obj_t *parent);
4037
void common_hal_audiomixer_mixervoice_play(audiomixer_mixervoice_obj_t *self, mp_obj_t sample, bool loop);
4138
void common_hal_audiomixer_mixervoice_stop(audiomixer_mixervoice_obj_t *self);
42-
float common_hal_audiomixer_mixervoice_get_level(audiomixer_mixervoice_obj_t *self);
43-
void common_hal_audiomixer_mixervoice_set_level(audiomixer_mixervoice_obj_t *self, float gain);
39+
mp_float_t common_hal_audiomixer_mixervoice_get_level(audiomixer_mixervoice_obj_t *self);
40+
void common_hal_audiomixer_mixervoice_set_level(audiomixer_mixervoice_obj_t *self, mp_float_t gain);
4441

4542
bool common_hal_audiomixer_mixervoice_get_playing(audiomixer_mixervoice_obj_t *self);
4643

shared-bindings/audiomixer/__init__.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
#include "py/obj.h"
3030
#include "py/runtime.h"
3131

32-
#include "shared-bindings/microcontroller/Pin.h"
3332
#include "shared-bindings/audiomixer/Mixer.h"
3433

3534
//| """Support for audio mixing"""

shared-bindings/keypad/Event.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,9 +167,9 @@ STATIC mp_obj_t keypad_event_unary_op(mp_unary_op_t op, mp_obj_t self_in) {
167167

168168
STATIC void keypad_event_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
169169
keypad_event_obj_t *self = MP_OBJ_TO_PTR(self_in);
170-
mp_printf(print, "<Event: key_number %d %s>",
170+
mp_printf(print, "<Event: key_number %d %q>",
171171
common_hal_keypad_event_get_key_number(self),
172-
common_hal_keypad_event_get_pressed(self) ? "pressed" : "released");
172+
common_hal_keypad_event_get_pressed(self) ? MP_QSTR_pressed : MP_QSTR_released);
173173
}
174174

175175
STATIC const mp_rom_map_elem_t keypad_event_locals_dict_table[] = {

shared-bindings/keypad/KeyMatrix.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@
7171
//| ...
7272

7373
STATIC mp_obj_t keypad_keymatrix_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) {
74+
#if CIRCUITPY_KEYPAD_KEYMATRIX
7475
keypad_keymatrix_obj_t *self = m_new_obj(keypad_keymatrix_obj_t);
7576
self->base.type = &keypad_keymatrix_type;
7677
enum { ARG_row_pins, ARG_column_pins, ARG_columns_to_anodes, ARG_interval, ARG_max_events };
@@ -114,8 +115,13 @@ STATIC mp_obj_t keypad_keymatrix_make_new(const mp_obj_type_t *type, size_t n_ar
114115

115116
common_hal_keypad_keymatrix_construct(self, num_row_pins, row_pins_array, num_column_pins, column_pins_array, args[ARG_columns_to_anodes].u_bool, interval, max_events);
116117
return MP_OBJ_FROM_PTR(self);
118+
#else
119+
mp_raise_NotImplementedError_varg(translate("%q"), MP_QSTR_KeyMatrix);
120+
121+
#endif
117122
}
118123

124+
#if CIRCUITPY_KEYPAD_KEYMATRIX
119125
//| def deinit(self) -> None:
120126
//| """Stop scanning and release the pins."""
121127
//| ...
@@ -228,9 +234,13 @@ STATIC const mp_rom_map_elem_t keypad_keymatrix_locals_dict_table[] = {
228234

229235
STATIC MP_DEFINE_CONST_DICT(keypad_keymatrix_locals_dict, keypad_keymatrix_locals_dict_table);
230236

237+
#endif
238+
231239
const mp_obj_type_t keypad_keymatrix_type = {
232240
{ &mp_type_type },
233241
.name = MP_QSTR_KeyMatrix,
234242
.make_new = keypad_keymatrix_make_new,
243+
#if CIRCUITPY_KEYPAD_KEYMATRIX
235244
.locals_dict = (mp_obj_t)&keypad_keymatrix_locals_dict,
245+
#endif
236246
};

0 commit comments

Comments
 (0)