Skip to content

Split displayio #8493

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Oct 25, 2023
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
8 changes: 4 additions & 4 deletions BUILDING.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ To compile (or recompile) mpy-cross:

make -C mpy-cross

# Building
## Building

There a number of ports of CircuitPython! To build for your board, change to the appropriate ports directory and build.

Expand All @@ -64,7 +64,7 @@ If you aren't sure what boards exist, have a peek in the boards subdirectory of
If you have a fast computer with many cores, consider adding `-j` to your build flags, such as `-j17` on
a 6-core 12-thread machine.

# Testing
## Testing

If you are working on changes to the core language, you might find it useful to run the test suite.
The test suite in the top level `tests` directory. It needs the unix port to run.
Expand All @@ -84,7 +84,7 @@ A successful run will say something like
676 tests passed
30 tests skipped: buffered_writer builtin_help builtin_range_binop class_delattr_setattr cmd_parsetree extra_coverage framebuf1 framebuf16 framebuf2 framebuf4 framebuf8 framebuf_subclass mpy_invalid namedtuple_asdict non_compliant resource_stream schedule sys_getsizeof urandom_extra ure_groups ure_span ure_sub ure_sub_unmatched vfs_basic vfs_fat_fileio1 vfs_fat_fileio2 vfs_fat_more vfs_fat_oldproto vfs_fat_ramdisk vfs_userfs

# Debugging
## Debugging

The easiest way to debug CircuitPython on hardware is with a JLink device, JLinkGDBServer, and an appropriate GDB.
Instructions can be found at https://learn.adafruit.com/debugging-the-samd21-with-gdb
Expand All @@ -99,7 +99,7 @@ Example:
If your port/build includes `arm-none-eabi-gdb-py`, consider using it instead, as it can be used for better register
debugging with https://github.com/bnahill/PyCortexMDebug

# Code Quality Checks
## Code Quality Checks

We apply code quality checks using pre-commit. Install pre-commit once per system with

Expand Down
6 changes: 3 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ For SAMD21 debugging workflow tips check out [this learn guide](https://learn.ad
Scott Shawcroft ([@tannewt](https://github.com/tannewt)) is the lead developer of CircuitPython
and is sponsored by [Adafruit Industries LLC](https://adafruit.com). Scott is usually available
during US West Coast working hours. Dan Halbert ([@dhalbert](https://github.com/dhalbert)) and
Kattni Rembor ([@kattni](https://github.com/kattni)) are also sponsored by [Adafruit Industries
LLC](https://adafruit.com) and are usually available during US East Coast daytime hours including
some weekends.
Jeff Epler ([@jepler](https://github.com/jepler)) are also sponsored by [Adafruit Industries
LLC](https://adafruit.com) and are usually available during US daytime hours including some
weekends.

They are all reachable on [Discord](https://adafru.it/discord), GitHub issues and the [Adafruit
support forum](https://forums.adafruit.com/viewforum.php?f=60).
Expand Down
4 changes: 0 additions & 4 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,6 @@ Specifically useful documentation when starting out:
- `CircuitPython Essentials <https://learn.adafruit.com/circuitpython-essentials>`__
- `Example Code <https://github.com/adafruit/Adafruit_Learning_System_Guides/tree/master/CircuitPython_Essentials>`__

Code Search
------------
GitHub doesn't currently support code search on forks. Therefore, CircuitPython doesn't have code search through GitHub because it is a fork of MicroPython. Luckily, `SourceGraph <https://sourcegraph.com/github.com/adafruit/circuitpython>`_ has free code search for public repos like CircuitPython. So, visit `sourcegraph.com/github.com/adafruit/circuitpython <https://sourcegraph.com/github.com/adafruit/circuitpython>`_ to search the CircuitPython codebase online.

Contributing
------------

Expand Down
15 changes: 11 additions & 4 deletions conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,12 +218,12 @@ def autoapi_prepare_jinja_env(jinja_env):
"ports/nrf/usb",
"ports/raspberrypi/sdk",
"ports/raspberrypi/lib",
"ports/silabs",
"ports/silabs/gecko_sdk",
"ports/silabs/tools",
"ports/stm/st_driver",
"ports/stm/packages",
"ports/stm/peripherals",
"ports/stm/ref",
"ports/unix",
"py",
"shared/*",
"shared-bindings/util.*",
Expand Down Expand Up @@ -362,14 +362,21 @@ def autoapi_prepare_jinja_env(jinja_env):
# Additional stuff for the LaTeX preamble.
#'preamble': '',
# Include 3 levels of headers in PDF ToC
'preamble': '\setcounter{tocdepth}{2}',
'preamble': r'''
\setcounter{tocdepth}{2}
\hbadness=99999
\hfuzz=20pt
\usepackage{pdflscape}
''',
}

# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title,
# author, documentclass [howto, manual, or own class]).
latex_documents = [
(master_doc, 'CircuitPython.tex', 'CircuitPython Documentation',
("docs/pdf", 'CircuitPython.tex', 'CircuitPython Documentation',
'CircuitPython Contributors', 'manual'),
("shared-bindings/support_matrix", 'SupportMatrix.tex', 'Board Support Matrix',
'CircuitPython Contributors', 'manual'),
]

Expand Down
60 changes: 60 additions & 0 deletions docs/pdf.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
:orphan:

Adafruit CircuitPython API Reference
====================================

Welcome to the API reference documentation for Adafruit CircuitPython.
This contains low-level API reference docs which may link out to separate
*"getting started"* guides. `Adafruit <https://adafruit.com>`_ has many
excellent tutorials available through the
`Adafruit Learning System <https://learn.adafruit.com/>`_.


.. toctree::
:maxdepth: 3

../README.rst
libraries.rst
workflows
environment.rst
troubleshooting.rst
../CONTRIBUTING
../BUILDING
../WEBUSB_README
supported_ports.rst

Design and porting reference
----------------------------

.. toctree::
:maxdepth: 1

design_guide
porting
common_hal

API Reference
----------------------

.. toctree::
:glob:
:maxdepth: 3

library/index.rst
../shared-bindings/*/index
../shared-bindings/help


.. toctree::
:maxdepth: 1

reference/glossary.rst
../CODE_OF_CONDUCT
../docs/LICENSE

Indices and tables
==================

* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`
3 changes: 3 additions & 0 deletions docs/supported_ports.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,13 @@ is limited.
:maxdepth: 2

../ports/atmel-samd/README
../ports/broadcom/README
../ports/cxd56/README
../ports/espressif/README
../ports/litex/README
../ports/mimxrt10xx/README
../ports/nrf/README
../ports/raspberrypi/README
../ports/silabs/README
../ports/stm/README
../ports/unix/README
2 changes: 1 addition & 1 deletion extmod/vfs_fat.c
Original file line number Diff line number Diff line change
Expand Up @@ -540,7 +540,7 @@ STATIC const mp_vfs_proto_t fat_vfs_proto = {
MP_DEFINE_CONST_OBJ_TYPE(
mp_fat_vfs_type,
MP_QSTR_VfsFat,
MP_TYPE_FLAG_NONE,
MP_TYPE_FLAG_HAS_SPECIAL_ACCESSORS,
make_new, fat_vfs_make_new,
protocol, &fat_vfs_proto,
locals_dict, &fat_vfs_locals_dict
Expand Down
10 changes: 7 additions & 3 deletions main.c
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,10 @@
#include "shared-module/displayio/__init__.h"
#endif

#if CIRCUITPY_EPAPERDISPLAY
#include "shared-bindings/epaperdisplay/EPaperDisplay.h"
#endif

#if CIRCUITPY_KEYPAD
#include "shared-module/keypad/__init__.h"
#endif
Expand Down Expand Up @@ -534,7 +538,7 @@ STATIC bool run_code_py(safe_mode_t safe_mode, bool *simulate_reset) {

// Program has finished running.
bool printed_press_any_key = false;
#if CIRCUITPY_DISPLAYIO
#if CIRCUITPY_EPAPERDISPLAY
size_t time_to_epaper_refresh = 1;
#endif

Expand Down Expand Up @@ -682,7 +686,7 @@ STATIC bool run_code_py(safe_mode_t safe_mode, bool *simulate_reset) {
// Refresh the ePaper display if we have one. That way it'll show an error message.
// Skip if we're about to autoreload. Otherwise we may delay when user code can update
// the display.
#if CIRCUITPY_DISPLAYIO
#if CIRCUITPY_EPAPERDISPLAY
if (time_to_epaper_refresh > 0 && !autoreload_pending()) {
time_to_epaper_refresh = maybe_refresh_epaperdisplay();
}
Expand Down Expand Up @@ -724,7 +728,7 @@ STATIC bool run_code_py(safe_mode_t safe_mode, bool *simulate_reset) {
}
time_to_next_change = total_time - tick_diff;
}
#if CIRCUITPY_DISPLAYIO
#if CIRCUITPY_EPAPERDISPLAY
if (time_to_epaper_refresh > 0 && time_to_next_change > 0) {
time_to_next_change = MIN(time_to_next_change, time_to_epaper_refresh);
}
Expand Down
2 changes: 1 addition & 1 deletion ports/atmel-samd/bindings/samd/Clock.c
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ STATIC MP_DEFINE_CONST_DICT(samd_clock_locals_dict, samd_clock_locals_dict_table
MP_DEFINE_CONST_OBJ_TYPE(
samd_clock_type,
MP_QSTR_Clock,
MP_TYPE_FLAG_NONE,
MP_TYPE_FLAG_HAS_SPECIAL_ACCESSORS,
print, samd_clock_print,
locals_dict, &samd_clock_locals_dict
);
Expand Down
16 changes: 8 additions & 8 deletions ports/atmel-samd/boards/hallowing_m0_express/board.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@
#include "supervisor/board.h"

#include "shared-bindings/board/__init__.h"
#include "shared-bindings/displayio/FourWire.h"
#include "shared-bindings/fourwire/FourWire.h"
#include "shared-module/displayio/__init__.h"
#include "shared-module/displayio/mipi_constants.h"
#include "shared-bindings/busio/SPI.h"

displayio_fourwire_obj_t board_display_obj;
fourwire_fourwire_obj_t board_display_obj;

#define DELAY 0x80

Expand Down Expand Up @@ -69,11 +69,11 @@ uint8_t display_init_sequence[] = {
};

void board_init(void) {
displayio_fourwire_obj_t *bus = &allocate_display_bus()->fourwire_bus;
bus->base.type = &displayio_fourwire_type;
fourwire_fourwire_obj_t *bus = &allocate_display_bus()->fourwire_bus;
bus->base.type = &fourwire_fourwire_type;
busio_spi_obj_t *spi = common_hal_board_create_spi(0);
common_hal_busio_spi_never_reset(spi);
common_hal_displayio_fourwire_construct(bus,
common_hal_fourwire_fourwire_construct(bus,
spi,
&pin_PA28, // Command or data
&pin_PA01, // Chip select
Expand All @@ -82,9 +82,9 @@ void board_init(void) {
0, // Polarity
0); // Phase

displayio_display_obj_t *display = &allocate_display()->display;
display->base.type = &displayio_display_type;
common_hal_displayio_display_construct(display,
busdisplay_busdisplay_obj_t *display = &allocate_display()->display;
display->base.type = &busdisplay_busdisplay_type;
common_hal_busdisplay_busdisplay_construct(display,
bus,
128, // Width
128, // Height
Expand Down
17 changes: 9 additions & 8 deletions ports/atmel-samd/boards/hallowing_m4_express/board.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,12 @@
#include "mpconfigboard.h"
#include "hal/include/hal_gpio.h"
#include "shared-bindings/busio/SPI.h"
#include "shared-bindings/displayio/FourWire.h"
#include "shared-bindings/busdisplay/BusDisplay.h"
#include "shared-bindings/fourwire/FourWire.h"
#include "shared-module/displayio/__init__.h"
#include "shared-module/displayio/mipi_constants.h"

displayio_fourwire_obj_t board_display_obj;
fourwire_fourwire_obj_t board_display_obj;

#define DELAY 0x80

Expand All @@ -47,13 +48,13 @@ uint8_t display_init_sequence[] = {
};

void board_init(void) {
displayio_fourwire_obj_t *bus = &allocate_display_bus()->fourwire_bus;
fourwire_fourwire_obj_t *bus = &allocate_display_bus()->fourwire_bus;
busio_spi_obj_t *spi = &bus->inline_bus;
common_hal_busio_spi_construct(spi, &pin_PA01, &pin_PA00, NULL, false);
common_hal_busio_spi_never_reset(spi);

bus->base.type = &displayio_fourwire_type;
common_hal_displayio_fourwire_construct(bus,
bus->base.type = &fourwire_fourwire_type;
common_hal_fourwire_fourwire_construct(bus,
spi,
&pin_PB31, // TFT_DC Command or data
&pin_PA27, // TFT_CS Chip select
Expand All @@ -62,9 +63,9 @@ void board_init(void) {
0, // Polarity
0); // Phase

displayio_display_obj_t *display = &allocate_display()->display;
display->base.type = &displayio_display_type;
common_hal_displayio_display_construct(display,
busdisplay_busdisplay_obj_t *display = &allocate_display()->display;
display->base.type = &busdisplay_busdisplay_type;
common_hal_busdisplay_busdisplay_construct(display,
bus,
240, // Width (after rotation)
240, // Height (after rotation)
Expand Down
16 changes: 8 additions & 8 deletions ports/atmel-samd/boards/monster_m4sk/board.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@
#include "mpconfigboard.h"
#include "hal/include/hal_gpio.h"
#include "shared-bindings/busio/SPI.h"
#include "shared-bindings/displayio/FourWire.h"
#include "shared-bindings/fourwire/FourWire.h"
#include "shared-module/displayio/__init__.h"
#include "shared-module/displayio/mipi_constants.h"

displayio_fourwire_obj_t board_display_obj;
fourwire_fourwire_obj_t board_display_obj;

#define DELAY 0x80

Expand All @@ -48,13 +48,13 @@ uint8_t display_init_sequence[] = {
};

void board_init(void) {
displayio_fourwire_obj_t *bus = &allocate_display_bus()->fourwire_bus;
fourwire_fourwire_obj_t *bus = &allocate_display_bus()->fourwire_bus;
busio_spi_obj_t *spi = &bus->inline_bus;
common_hal_busio_spi_construct(spi, &pin_PA13, &pin_PA12, NULL, false);
common_hal_busio_spi_never_reset(spi);

bus->base.type = &displayio_fourwire_type;
common_hal_displayio_fourwire_construct(bus,
bus->base.type = &fourwire_fourwire_type;
common_hal_fourwire_fourwire_construct(bus,
spi,
&pin_PA07, // TFT_DC Command or data
&pin_PA06, // TFT_CS Chip select
Expand All @@ -63,9 +63,9 @@ void board_init(void) {
0, // Polarity
0); // Phase

displayio_display_obj_t *display = &allocate_display()->display;
display->base.type = &displayio_display_type;
common_hal_displayio_display_construct(display,
busdisplay_busdisplay_obj_t *display = &allocate_display()->display;
display->base.type = &busdisplay_busdisplay_type;
common_hal_busdisplay_busdisplay_construct(display,
bus,
240, // Width (after rotation)
240, // Height (after rotation)
Expand Down
Loading