Skip to content

Commit d6a55bb

Browse files
committed
Document new parameter + pre-commit
1 parent e2eb5ba commit d6a55bb

File tree

3 files changed

+28
-4
lines changed

3 files changed

+28
-4
lines changed

docs/environment.rst

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,3 +190,27 @@ flag has been set to 0. Currently this is primarily boards with limited flash in
190190
of the Atmel_samd boards based on the SAMD21/M0 microprocessor.
191191

192192
`boards that the terminalio core module is available on <https://docs.circuitpython.org/en/latest/shared-bindings/terminalio/>`_
193+
194+
CIRCUITPY_DISPLAY_LIMIT
195+
~~~~~~~~~~~~~~~~~~~~~~~
196+
Set the maximum supported number of displayio displays. This value overrides the
197+
CIRCUITPY_DISPLAY_LIMIT compile-time flag defined in mpconfigport.h.
198+
It specifies the maximum number of active display objects that can be supported simultaneously
199+
on a CircuitPython board. This setting is used to manage memory and resource allocation for
200+
display handling.
201+
202+
By default, the value of CIRCUITPY_DISPLAY_LIMIT is set to 1 for most boards, meaning only
203+
one display can be active at a time. Users can modify this value by adding a settings.toml entry
204+
to support additional displays, depending on the hardware capabilities and available resources.
205+
206+
The value of CIRCUITPY_DISPLAY_LIMIT should be set to a value that is supported by the
207+
hardware and does not exceed the available memory and resources on the board.
208+
209+
*** Note: Setting CIRCUITPY_DISPLAY_LIMIT to a value greater than 1 should be considered an
210+
ALPHA feature and may result in unexpected behavior or crashes. ***
211+
212+
Example: Set the maximum supported number of displayio displays to 2:
213+
214+
.. code-block::
215+
216+
CIRCUITPY_DISPLAY_LIMIT=2

main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1058,7 +1058,7 @@ int __attribute__((used)) main(void) {
10581058
reset_board();
10591059

10601060
#if CIRCUITPY_DISPLAYIO
1061-
// If number of displays has been overriden in settings.toml allocate memory and dynamic memory
1061+
// If number of displays has been overridden in settings.toml allocate memory and dynamic memory
10621062
malloc_display_memory();
10631063
#endif
10641064

shared-module/displayio/__init__.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -201,10 +201,10 @@ void malloc_display_memory(void) {
201201
#if CIRCUITPY_OS_GETENV
202202
(void)common_hal_os_getenv_int("CIRCUITPY_DISPLAY_LIMIT", &max_num_displays);
203203
if (max_num_displays > CIRCUITPY_DISPLAY_LIMIT) {
204-
display_buses = (primary_display_bus_t*)port_malloc(sizeof(primary_display_bus_t) * max_num_displays, false);
205-
displays = (primary_display_t*)port_malloc(sizeof(primary_display_t) * max_num_displays, false);
204+
display_buses = (primary_display_bus_t *)port_malloc(sizeof(primary_display_bus_t) * max_num_displays, false);
205+
displays = (primary_display_t *)port_malloc(sizeof(primary_display_t) * max_num_displays, false);
206206
memcpy(display_buses, &display_busesx[0], sizeof(primary_display_bus_t) * max_num_displays);
207-
memcpy(displays, &displaysx[0], sizeof(primary_display_t) * max_num_displays);
207+
memcpy(displays, &displaysx[0], sizeof(primary_display_t) * max_num_displays);
208208
}
209209
#endif
210210
}

0 commit comments

Comments
 (0)