Make busio.SPI be NotImplementedError on proxlight to save space

This commit is contained in:
Dan Halbert 2021-05-14 21:52:54 -04:00
parent 3d49d180d1
commit 83fcdba9c4
4 changed files with 19 additions and 3 deletions

View File

@ -28,5 +28,5 @@ SUPEROPT_GC = 0
SUPEROPT_VM = 0
# Include these Python libraries in firmware.
FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_NeoPixel
FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_HID
FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_NeoPixel

View File

@ -54,15 +54,19 @@ CIRCUITPY_USB_CDC ?= 0
CIRCUITPY_ULAB = 0
ifeq ($(TRANSLATION), ja)
ifeq ($(TRANSLATION),ja)
ifeq ($(CIRCUITPY_DISPLAYIO),1)
RELEASE_NEEDS_CLEAN_BUILD = 1
CIRCUITPY_TERMINALIO = 0
endif
endif
ifeq ($(TRANSLATION), ko)
ifeq ($(TRANSLATION),ko)
ifeq ($(CIRCUITPY_DISPLAYIO),1)
RELEASE_NEEDS_CLEAN_BUILD = 1
CIRCUITPY_TERMINALIO = 0
endif
endif
endif # samd21
######################################################################

View File

@ -121,6 +121,9 @@ CFLAGS += -DCIRCUITPY_BUILTINS_POW3=$(CIRCUITPY_BUILTINS_POW3)
CIRCUITPY_BUSIO ?= 1
CFLAGS += -DCIRCUITPY_BUSIO=$(CIRCUITPY_BUSIO)
CIRCUITPY_BUSIO_SPI ?= 1
CFLAGS += -DCIRCUITPY_BUSIO_SPI=$(CIRCUITPY_BUSIO_SPI)
CIRCUITPY_CAMERA ?= 0
CFLAGS += -DCIRCUITPY_CAMERA=$(CIRCUITPY_CAMERA)

View File

@ -81,6 +81,7 @@
// TODO(tannewt): Support LSB SPI.
STATIC mp_obj_t busio_spi_make_new(const mp_obj_type_t *type, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
#if CIRCUITPY_BUSIO_SPI
busio_spi_obj_t *self = m_new_obj(busio_spi_obj_t);
self->base.type = &busio_spi_type;
enum { ARG_clock, ARG_MOSI, ARG_MISO };
@ -102,8 +103,12 @@ STATIC mp_obj_t busio_spi_make_new(const mp_obj_type_t *type, size_t n_args, con
common_hal_busio_spi_construct(self, clock, mosi, miso);
return MP_OBJ_FROM_PTR(self);
#else
mp_raise_NotImplementedError(NULL);
#endif // CIRCUITPY_BUSIO_SPI
}
#if CIRCUITPY_BUSIO_SPI
//| def deinit(self) -> None:
//| """Turn off the SPI bus."""
//| ...
@ -399,8 +404,11 @@ const mp_obj_property_t busio_spi_frequency_obj = {
(mp_obj_t)&mp_const_none_obj,
(mp_obj_t)&mp_const_none_obj},
};
#endif // CIRCUITPY_BUSIO_SPI
STATIC const mp_rom_map_elem_t busio_spi_locals_dict_table[] = {
#if CIRCUITPY_BUSIO_SPI
{ MP_ROM_QSTR(MP_QSTR_deinit), MP_ROM_PTR(&busio_spi_deinit_obj) },
{ MP_ROM_QSTR(MP_QSTR___enter__), MP_ROM_PTR(&default___enter___obj) },
{ MP_ROM_QSTR(MP_QSTR___exit__), MP_ROM_PTR(&busio_spi_obj___exit___obj) },
@ -413,6 +421,7 @@ STATIC const mp_rom_map_elem_t busio_spi_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_write), MP_ROM_PTR(&busio_spi_write_obj) },
{ MP_ROM_QSTR(MP_QSTR_write_readinto), MP_ROM_PTR(&busio_spi_write_readinto_obj) },
{ MP_ROM_QSTR(MP_QSTR_frequency), MP_ROM_PTR(&busio_spi_frequency_obj) }
#endif // CIRCUITPY_BUSIO_SPI
};
STATIC MP_DEFINE_CONST_DICT(busio_spi_locals_dict, busio_spi_locals_dict_table);