Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions AGENTS.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
- Capture CircuitPython output by finding the matching device in `/dev/serial/by-id`
- Capture CircuitPython output by finding the matching device in `/dev/serial/by-id` or `/dev/sandbox`
- You can mount the CIRCUITPY drive by doing `udisksctl mount -b /dev/disk/by-label/CIRCUITPY` and access it via `/run/media/<user>/CIRCUITPY`.
- `circup` is a command line tool to install libraries and examples to CIRCUITPY.
- When connecting to serial devices on Linux use /dev/serial/by-id. These will be more stable than /dev/ttyACM*.
- When connecting to serial devices on Linux use /dev/serial/by-id or /dev/sandbox. These will be more stable than /dev/ttyACM*.
19 changes: 19 additions & 0 deletions ports/atmel-samd/boards/huntercat_nfc/mpconfigboard.mk
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,22 @@ EXTERNAL_FLASH_DEVICES = "W25Q16JVxQ"
LONGINT_IMPL = MPZ

CIRCUITPY_CODEOP = 0

# No display or display connector.
CIRCUITPY_DISPLAYIO = 0
CIRCUITPY_PARALLELDISPLAYBUS = 0

# No audio input, output, amplifier, microphone, or codec.
CIRCUITPY_AUDIOBUSIO = 0
CIRCUITPY_AUDIOIO = 0

# Discrete LEDs only, not NeoPixels.
CIRCUITPY_RAINBOWIO = 0
CIRCUITPY_NEOPIXEL_WRITE = 0
CIRCUITPY_PIXELBUF = 0

# No corresponding built-in peripherals.
CIRCUITPY_ONEWIREIO = 0
CIRCUITPY_PULSEIO = 0
CIRCUITPY_ROTARYIO = 0
CIRCUITPY_TOUCHIO = 0
6 changes: 0 additions & 6 deletions ports/espressif/mpconfigport.mk
Original file line number Diff line number Diff line change
Expand Up @@ -551,12 +551,6 @@ CIRCUITPY_AUDIOMIXER_USE_PORT_MIX ?= 1
endif
#### end chip-specific choices ########################################

# The LVGL compositing core replaces the legacy scanline core. EPaperDisplay still
# depends on the legacy display core, so it isn't available with LVGL yet.
ifeq ($(CIRCUITPY_DISPLAYIO_LVGL),1)
CIRCUITPY_EPAPERDISPLAY = 0
endif

# By default, load native .mpy files. Boards without the flash space turn it off.
CIRCUITPY_LOAD_NATIVE ?= 1

Expand Down
2 changes: 1 addition & 1 deletion ports/zephyr-cp/cptools/build_circuitpython.py
Original file line number Diff line number Diff line change
Expand Up @@ -765,7 +765,7 @@ async def build_circuitpython(): # noqa: C901
or s.parent.name == backend_dir
or (s.parent.name == "legacy" and s.name == "__init__.c")
]
if module.name in ("busdisplay", "framebufferio"):
if module.name in ("busdisplay", "epaperdisplay", "framebufferio"):
# These have legacy scanline implementations and LVGL ones.
backend_dir = "lvgl" if lvgl_enabled else "legacy"
backend_root = top / "shared-module" / module.name
Expand Down
4 changes: 4 additions & 0 deletions py/circuitpy_defns.mk
Original file line number Diff line number Diff line change
Expand Up @@ -698,6 +698,7 @@ $(filter $(SRC_PATTERNS), \
__future__/__init__.c \
busdisplay/BusDisplay.c \
camera/ImageFormat.c \
epaperdisplay/EPaperDisplay.c \
canio/Match.c \
codeop/__init__.c \
countio/Edge.c \
Expand Down Expand Up @@ -953,6 +954,7 @@ $(filter $(SRC_PATTERNS), \
busdisplay/lvgl/BusDisplay.c \
displayio/lvgl/TileGrid.c \
displayio/legacy/__init__.c \
epaperdisplay/lvgl/EPaperDisplay.c \
framebufferio/lvgl/FramebufferDisplay.c \
vectorio/lvgl/VectorShape.c \
videocore/lvgl/VideoBuffer.c \
Expand All @@ -969,6 +971,7 @@ $(filter $(SRC_PATTERNS), \
displayio/legacy/OnDiskBitmap.c \
displayio/legacy/Palette.c \
displayio/legacy/TileGrid.c \
epaperdisplay/legacy/EPaperDisplay.c \
framebufferio/legacy/FramebufferDisplay.c \
vectorio/legacy/VectorShape.c \
videocore/legacy/VideoBuffer.c \
Expand Down Expand Up @@ -1219,6 +1222,7 @@ $(filter $(SRC_PATTERNS), \
displayio/bus_core.c \
displayio/display_core.c \
displayio/area.c \
epaperdisplay/epaper_core.c \
epaperdisplay/lag_drive.c \
usb/utf16le.c \
)
Expand Down
4 changes: 2 additions & 2 deletions shared-bindings/epaperdisplay/EPaperDisplay.c
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,7 @@ static mp_obj_t epaperdisplay_epaperdisplay_obj_refresh(mp_obj_t self_in) {
bool ok = common_hal_epaperdisplay_epaperdisplay_refresh(self);
if (!ok) {
#if CIRCUITPY_EPAPERDISPLAY_FAST
if (self->lag.frames > 0) {
if (common_hal_epaperdisplay_epaperdisplay_has_lag_frames(self)) {
// Interrupted is not too soon: raise what interrupted it.
mp_handle_pending(true);
}
Expand Down Expand Up @@ -484,7 +484,7 @@ static mp_obj_t epaperdisplay_epaperdisplay_clean(size_t n_args, const mp_obj_t
epaperdisplay_epaperdisplay_obj_t *self = native_display(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);
if (self->lag.frames == 0) {
if (!common_hal_epaperdisplay_epaperdisplay_has_lag_frames(self)) {
mp_raise_RuntimeError(MP_ERROR_TEXT("Invalid state"));
}
mp_int_t frames = mp_arg_validate_int_range(args[ARG_frames].u_int, 0, 255, MP_QSTR_frames);
Expand Down
4 changes: 3 additions & 1 deletion shared-bindings/epaperdisplay/EPaperDisplay.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ extern const mp_obj_type_t epaperdisplay_epaperdisplay_type;

#define NO_COMMAND 0x100

typedef struct {
typedef struct epaperdisplay_construct_args_t {
mp_obj_t bus;
const uint8_t *start_sequence;
uint16_t start_sequence_len;
Expand Down Expand Up @@ -113,6 +113,8 @@ bool common_hal_epaperdisplay_epaperdisplay_refresh(epaperdisplay_epaperdisplay_
// Doesn't allocate. Holds any interrupt until it ends. Returns false, with any owed drive still
// owed, if the bus can't be had.
bool common_hal_epaperdisplay_epaperdisplay_clean(epaperdisplay_epaperdisplay_obj_t *self, uint8_t frames, bool full);
// True when lag driving is configured for the display.
bool common_hal_epaperdisplay_epaperdisplay_has_lag_frames(epaperdisplay_epaperdisplay_obj_t *self);
#endif

mp_obj_t common_hal_epaperdisplay_epaperdisplay_get_root_group(epaperdisplay_epaperdisplay_obj_t *self);
Expand Down
16 changes: 1 addition & 15 deletions shared-module/busdisplay/legacy/BusDisplay.c
Original file line number Diff line number Diff line change
Expand Up @@ -313,21 +313,7 @@ static void _refresh_display(busdisplay_busdisplay_obj_t *self) {
}

void common_hal_busdisplay_busdisplay_set_rotation(busdisplay_busdisplay_obj_t *self, int rotation) {
bool transposed = (self->core.rotation == 90 || self->core.rotation == 270);
bool will_transposed = (rotation == 90 || rotation == 270);
if (transposed != will_transposed) {
int tmp = self->core.width;
self->core.width = self->core.height;
self->core.height = tmp;
}
displayio_display_core_set_rotation(&self->core, rotation);
if (self == &displays[0].display) {
supervisor_stop_terminal();
supervisor_start_terminal(self->core.width, self->core.height);
}
if (self->core.current_group != NULL) {
displayio_group_update_transform(self->core.current_group, &self->core.transform);
}
displayio_display_core_set_rotation_and_update(&self->core, rotation, &self->base);
}

uint16_t common_hal_busdisplay_busdisplay_get_rotation(busdisplay_busdisplay_obj_t *self) {
Expand Down
22 changes: 22 additions & 0 deletions shared-module/displayio/display_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,28 @@ void displayio_display_core_set_rotation(displayio_display_core_t *self,
#endif
}

#if !CIRCUITPY_DISPLAYIO_LVGL
// Keep this out of line so each display implementation and its binding don't get separate copies.
MP_NOINLINE void displayio_display_core_set_rotation_and_update(displayio_display_core_t *self,
int rotation, mp_obj_base_t *display) {
bool transposed = (self->rotation == 90 || self->rotation == 270);
bool will_transposed = (rotation == 90 || rotation == 270);
if (transposed != will_transposed) {
int tmp = self->width;
self->width = self->height;
self->height = tmp;
}
displayio_display_core_set_rotation(self, rotation);
if (display == &displays[0].display_base) {
supervisor_stop_terminal();
supervisor_start_terminal(self->width, self->height);
}
if (self->current_group != NULL) {
displayio_group_update_transform(self->current_group, &self->transform);
}
}
#endif

bool displayio_display_core_set_root_group(displayio_display_core_t *self, displayio_group_t *root_group) {

if (root_group == NULL) {
Expand Down
3 changes: 3 additions & 0 deletions shared-module/displayio/display_core.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ void displayio_display_core_set_rotation(displayio_display_core_t *self, int rot
void release_display_core(displayio_display_core_t *self);

#if !CIRCUITPY_DISPLAYIO_LVGL
void displayio_display_core_set_rotation_and_update(displayio_display_core_t *self, int rotation,
mp_obj_base_t *display);

bool displayio_display_core_start_refresh(displayio_display_core_t *self);
void displayio_display_core_finish_refresh(displayio_display_core_t *self);

Expand Down
2 changes: 1 addition & 1 deletion shared-module/displayio/legacy/__init__.c
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ static mp_obj_t get_display_bus(int display_number) {
#endif
#if CIRCUITPY_EPAPERDISPLAY
} else if (display->display_base.type == &epaperdisplay_epaperdisplay_type) {
return display->epaper_display.bus.bus;
return display->epaper_display.epaper.bus.bus;
#endif
#if CIRCUITPY_FRAMEBUFFERIO
} else if (display->display_base.type == &framebufferio_framebufferdisplay_type) {
Expand Down
Loading
Loading