Skip to content

Commit

Permalink
Merge pull request #8786 from jepler/bitmapfilter
Browse files Browse the repository at this point in the history
Add "bitmapfilter"
  • Loading branch information
jepler authored Jan 22, 2024
2 parents 83acf49 + 152890b commit 6837e4f
Show file tree
Hide file tree
Showing 36 changed files with 2,046 additions and 21 deletions.
29 changes: 20 additions & 9 deletions locale/circuitpython.pot
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,8 @@ msgstr ""
msgid "%q must be of type %q, %q, or %q, not %q"
msgstr ""

#: py/argcheck.c shared-module/synthio/__init__.c
#: py/argcheck.c shared-bindings/bitmapfilter/__init__.c
#: shared-module/synthio/__init__.c
msgid "%q must be of type %q, not %q"
msgstr ""

Expand Down Expand Up @@ -896,10 +897,6 @@ msgstr ""
msgid "Deep sleep pins must use a rising edge with pulldown"
msgstr ""

#: shared-module/jpegio/JpegDecoder.c
msgid "Destination bitmap too small to contain image"
msgstr ""

#: shared-bindings/audiobusio/PDMIn.c
msgid "Destination capacity is smaller than destination_length."
msgstr ""
Expand Down Expand Up @@ -2539,6 +2536,10 @@ msgstr ""
msgid "binary op %q not implemented"
msgstr ""

#: shared-module/bitmapfilter/__init__.c
msgid "bitmap size and depth must match"
msgstr ""

#: shared-bindings/bitmaptools/__init__.c
msgid "bitmap sizes must match"
msgstr ""
Expand Down Expand Up @@ -3879,10 +3880,6 @@ msgstr ""
msgid "parameters must be registers in sequence r0 to r3"
msgstr ""

#: shared-bindings/bitmaptools/__init__.c
msgid "pixel coordinates out of bounds"
msgstr ""

#: extmod/vfs_posix_file.c
msgid "poll on file not available on win32"
msgstr ""
Expand Down Expand Up @@ -4277,6 +4274,10 @@ msgstr ""
msgid "unsupported Xtensa instruction '%s' with %d arguments"
msgstr ""

#: shared-module/bitmapfilter/__init__.c
msgid "unsupported bitmap depth"
msgstr ""

#: shared-module/gifio/GifWriter.c
msgid "unsupported colorspace for GifWriter"
msgstr ""
Expand Down Expand Up @@ -4323,6 +4324,16 @@ msgstr ""
msgid "wbits"
msgstr ""

#: shared-bindings/bitmapfilter/__init__.c
msgid ""
"weights must be a sequence with an odd square number of elements (usually 9 "
"or 25)"
msgstr ""

#: shared-bindings/bitmapfilter/__init__.c
msgid "weights must be an object of type %q, %q, %q, or %q, not %q "
msgstr ""

#: shared-bindings/is31fl3741/FrameBuffer.c
msgid "width must be greater than zero"
msgstr ""
Expand Down
1 change: 1 addition & 0 deletions ports/espressif/boards/deneyap_kart_1a_v2/mpconfigboard.mk
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,6 @@ CIRCUITPY_ESP_PSRAM_MODE = opi
CIRCUITPY_ESP_PSRAM_FREQ = 80m

CIRCUITPY_ESPCAMERA = 0
CIRCUITPY_BITMAPFILTER = 0

OPTIMIZATION_FLAGS = -Os
1 change: 1 addition & 0 deletions ports/espressif/boards/lolin_s3_mini/mpconfigboard.mk
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ CIRCUITPY_ESP_PSRAM_FREQ = 40m

OPTIMIZATION_FLAGS = -Os
CIRCUITPY_ESPCAMERA = 0
CIRCUITPY_BITMAPFILTER = 0

# Include these Python libraries in firmware.
FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_NeoPixel
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ CIRCUITPY_ESP_PSRAM_FREQ = 40m

OPTIMIZATION_FLAGS = -Os
CIRCUITPY_ESPCAMERA = 0
CIRCUITPY_BITMAPFILTER = 0

# Include these Python libraries in firmware.
FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_NeoPixel
1 change: 1 addition & 0 deletions ports/espressif/mpconfigport.mk
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ CIRCUITPY_ESP_USB_SERIAL_JTAG ?= 0

else ifeq ($(IDF_TARGET),esp32s3)
# Modules
CIRCUITPY_BITMAPFILTER ?= $(CIRCUITPY_ESPCAMERA)
CIRCUITPY_PARALLELDISPLAY = 0
CIRCUITPY_RGBMATRIX_USES_SUPERVISOR_ALLOCATION = 0

Expand Down
4 changes: 2 additions & 2 deletions ports/espressif/supervisor/port.c
Original file line number Diff line number Diff line change
Expand Up @@ -336,8 +336,8 @@ void port_free(void *ptr) {
heap_caps_free(ptr);
}

void port_realloc(void *ptr, size_t size) {
heap_caps_realloc(ptr, size, MALLOC_CAP_8BIT);
void *port_realloc(void *ptr, size_t size) {
return heap_caps_realloc(ptr, size, MALLOC_CAP_8BIT);
}

size_t port_heap_get_largest_free_size(void) {
Expand Down
4 changes: 4 additions & 0 deletions ports/unix/displayio_min.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@

#include "shared-bindings/displayio/__init__.h"
#include "shared-bindings/displayio/Bitmap.h"
#include "shared-bindings/displayio/ColorConverter.h"
#include "shared-bindings/displayio/Palette.h"

MAKE_ENUM_VALUE(displayio_colorspace_type, displayio_colorspace, RGB888, DISPLAYIO_COLORSPACE_RGB888);
MAKE_ENUM_VALUE(displayio_colorspace_type, displayio_colorspace, RGB565, DISPLAYIO_COLORSPACE_RGB565);
Expand Down Expand Up @@ -81,6 +83,8 @@ STATIC const mp_rom_map_elem_t displayio_module_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_displayio) },
{ MP_ROM_QSTR(MP_QSTR_Bitmap), MP_ROM_PTR(&displayio_bitmap_type) },
{ MP_ROM_QSTR(MP_QSTR_Colorspace), MP_ROM_PTR(&displayio_colorspace_type) },
{ MP_ROM_QSTR(MP_QSTR_ColorConverter), MP_ROM_PTR(&displayio_colorconverter_type) },
{ MP_ROM_QSTR(MP_QSTR_Palette), MP_ROM_PTR(&displayio_palette_type) },
};
STATIC MP_DEFINE_CONST_DICT(displayio_module_globals, displayio_module_globals_table);

Expand Down
6 changes: 5 additions & 1 deletion ports/unix/variants/coverage/mpconfigvariant.mk
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,12 @@ SRC_BITMAP := \
shared-bindings/audiomixer/__init__.c \
shared-bindings/audiomixer/Mixer.c \
shared-bindings/audiomixer/MixerVoice.c \
shared-bindings/bitmapfilter/__init__.c \
shared-bindings/bitmaptools/__init__.c \
shared-bindings/codeop/__init__.c \
shared-bindings/displayio/Bitmap.c \
shared-bindings/displayio/ColorConverter.c \
shared-bindings/displayio/Palette.c \
shared-bindings/jpegio/__init__.c \
shared-bindings/jpegio/JpegDecoder.c \
shared-bindings/locale/__init__.c \
Expand All @@ -60,11 +63,12 @@ SRC_BITMAP := \
shared-module/audiomixer/__init__.c \
shared-module/audiomixer/Mixer.c \
shared-module/audiomixer/MixerVoice.c \
shared-module/bitmapfilter/__init__.c \
shared-module/bitmaptools/__init__.c \
shared-module/displayio/area.c \
shared-module/displayio/Bitmap.c \
shared-module/displayio/ColorConverter.c \
shared-module/displayio/ColorConverter.c \
shared-module/displayio/Palette.c \
shared-module/jpegio/__init__.c \
shared-module/jpegio/JpegDecoder.c \
shared-module/os/getenv.c \
Expand Down
4 changes: 4 additions & 0 deletions py/circuitpy_defns.mk
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,9 @@ endif
ifeq ($(CIRCUITPY_BITMAPTOOLS),1)
SRC_PATTERNS += bitmaptools/%
endif
ifeq ($(CIRCUITPY_BITMAPFILTER),1)
SRC_PATTERNS += bitmapfilter/%
endif
ifeq ($(CIRCUITPY_BITOPS),1)
SRC_PATTERNS += bitops/%
endif
Expand Down Expand Up @@ -609,6 +612,7 @@ SRC_SHARED_MODULE_ALL = \
bitbangio/SPI.c \
bitbangio/__init__.c \
bitmaptools/__init__.c \
bitmapfilter/__init__.c \
bitops/__init__.c \
board/__init__.c \
adafruit_bus_device/__init__.c \
Expand Down
6 changes: 5 additions & 1 deletion py/circuitpy_mpconfig.mk
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,10 @@ CFLAGS += -DCIRCUITPY_BITBANG_APA102=$(CIRCUITPY_BITBANG_APA102)
CIRCUITPY_BITBANGIO ?= $(CIRCUITPY_FULL_BUILD)
CFLAGS += -DCIRCUITPY_BITBANGIO=$(CIRCUITPY_BITBANGIO)

# bitmapfilter also depends on displayio, but is disabled by default
CIRCUITPY_BITMAPFILTER ?= 0
CFLAGS += -DCIRCUITPY_BITMAPFILTER=$(CIRCUITPY_BITMAPFILTER)

CIRCUITPY_BITOPS ?= 0
CFLAGS += -DCIRCUITPY_BITOPS=$(CIRCUITPY_BITOPS)

Expand Down Expand Up @@ -236,7 +240,7 @@ CFLAGS += -DCIRCUITPY_DOTCLOCKFRAMEBUFFER=$(CIRCUITPY_DOTCLOCKFRAMEBUFFER)
CIRCUITPY_DOTCLOCKFRAMEBUFFER_USES_SUPERVISOR_ALLOCATION ?= 1
CFLAGS += -DCIRCUITPY_DOTCLOCKFRAMEBUFFER_USES_SUPERVISOR_ALLOCATION=$(CIRCUITPY_DOTCLOCKFRAMEBUFFER_USES_SUPERVISOR_ALLOCATION)

# bitmaptools and framebufferio rely on displayio
# bitmaptools and framebufferio rely on displayio and are not on small boards
CIRCUITPY_BITMAPTOOLS ?= $(call enable-if-all,$(CIRCUITPY_FULL_BUILD) $(CIRCUITPY_DISPLAYIO))
CIRCUITPY_FRAMEBUFFERIO ?= $(call enable-if-all,$(CIRCUITPY_FULL_BUILD) $(CIRCUITPY_DISPLAYIO))
CIRCUITPY_VECTORIO ?= $(CIRCUITPY_DISPLAYIO)
Expand Down
Loading

0 comments on commit 6837e4f

Please sign in to comment.