├── .gitignore ├── CHANGELOG.md ├── LICENSE ├── README.md ├── docs ├── .buildinfo ├── .nojekyll ├── _images │ ├── alien.jpg │ ├── boxlines.jpg │ ├── chango.jpg │ ├── color_test.jpg │ ├── colorbars.jpg │ ├── feathers.jpg │ ├── fonts.jpg │ ├── hello.jpg │ ├── noto_fonts.jpg │ ├── proverbs.jpg │ ├── roids.jpg │ ├── rotations.jpg │ ├── scroll.jpg │ ├── tiny_hello.jpg │ ├── tiny_toasters.jpg │ ├── vga1_16x16.png │ ├── vga1_16x32.png │ ├── vga1_8x16.png │ ├── vga1_8x8.png │ ├── vga1_bold_16x16.png │ ├── vga1_bold_16x32.png │ ├── vga2_16x16.png │ ├── vga2_16x32.png │ ├── vga2_8x16.png │ ├── vga2_8x8.png │ ├── vga2_bold_16x16.png │ └── vga2_bold_16x32.png ├── _modules │ ├── index.html │ └── st7789py.html ├── _sources │ ├── configs.rst.txt │ ├── configs │ │ ├── atom_s3.rst.txt │ │ ├── esp32_320x240.rst.txt │ │ ├── m5stack_core.rst.txt │ │ ├── m5stack_core2.rst.txt │ │ ├── m5stack_core3.rst.txt │ │ ├── rp2040_touch_lcd_128.rst.txt │ │ ├── t-dongle-s3.rst.txt │ │ ├── t-embed.rst.txt │ │ ├── t_qt_pro.rst.txt │ │ ├── ttgo_tdisplay.rst.txt │ │ ├── ttgo_tdisplay_rp2040.rst.txt │ │ ├── waveshare_114.rst.txt │ │ ├── waveshare_13.rst.txt │ │ └── waveshare_2.rst.txt │ ├── examples.rst.txt │ ├── examples │ │ ├── alien.rst.txt │ │ ├── boxlines.rst.txt │ │ ├── chango.rst.txt │ │ ├── color_test.rst.txt │ │ ├── colorbars.rst.txt │ │ ├── feathers.rst.txt │ │ ├── fonts.rst.txt │ │ ├── hello.rst.txt │ │ ├── noto_fonts.rst.txt │ │ ├── proverbs.rst.txt │ │ ├── roids.rst.txt │ │ ├── rotations.rst.txt │ │ ├── scroll.rst.txt │ │ ├── tiny_hello.rst.txt │ │ └── tiny_toasters.rst.txt │ ├── fonts.rst.txt │ ├── genindex.rst.txt │ ├── index.rst.txt │ ├── st7789py.rst.txt │ ├── utilities.rst.txt │ └── utilities │ │ ├── create_png_examples.rst.txt │ │ ├── image_converter.rst.txt │ │ ├── make_colorbars_bitmap.rst.txt │ │ ├── sprites_converter.rst.txt │ │ ├── text_font_converter.rst.txt │ │ └── write_font_converter.rst.txt ├── _static │ ├── _sphinx_javascript_frameworks_compat.js │ ├── alien.jpg │ ├── basic.css │ ├── boxlines.jpg │ ├── chango.jpg │ ├── color_test.jpg │ ├── colorbars.jpg │ ├── css │ │ ├── badge_only.css │ │ ├── fonts │ │ │ ├── Roboto-Slab-Bold.woff │ │ │ ├── Roboto-Slab-Bold.woff2 │ │ │ ├── Roboto-Slab-Regular.woff │ │ │ ├── Roboto-Slab-Regular.woff2 │ │ │ ├── fontawesome-webfont.eot │ │ │ ├── fontawesome-webfont.svg │ │ │ ├── fontawesome-webfont.ttf │ │ │ ├── fontawesome-webfont.woff │ │ │ ├── fontawesome-webfont.woff2 │ │ │ ├── lato-bold-italic.woff │ │ │ ├── lato-bold-italic.woff2 │ │ │ ├── lato-bold.woff │ │ │ ├── lato-bold.woff2 │ │ │ ├── lato-normal-italic.woff │ │ │ ├── lato-normal-italic.woff2 │ │ │ ├── lato-normal.woff │ │ │ └── lato-normal.woff2 │ │ └── theme.css │ ├── doctools.js │ ├── documentation_options.js │ ├── feathers.jpg │ ├── file.png │ ├── fonts.jpg │ ├── hello.jpg │ ├── jquery.js │ ├── js │ │ ├── badge_only.js │ │ ├── html5shiv-printshiv.min.js │ │ ├── html5shiv.min.js │ │ └── theme.js │ ├── language_data.js │ ├── minus.png │ ├── noto_fonts.jpg │ ├── plus.png │ ├── proverbs.jpg │ ├── pygments.css │ ├── roids.jpg │ ├── rotation.jpg │ ├── rotations.jpg │ ├── scroll.jpg │ ├── searchtools.js │ ├── sphinx_highlight.js │ ├── tiny_hello.jpg │ ├── tiny_toasters.jpg │ ├── vga1_16x16.png │ ├── vga1_16x32.png │ ├── vga1_8x16.png │ ├── vga1_8x8.png │ ├── vga1_bold_16x16.png │ ├── vga1_bold_16x32.png │ ├── vga2_16x16.png │ ├── vga2_16x32.png │ ├── vga2_8x16.png │ ├── vga2_8x8.png │ ├── vga2_bold_16x16.png │ └── vga2_bold_16x32.png ├── configs.html ├── configs │ ├── atom_s3.html │ ├── esp32_320x240.html │ ├── m5stack_core.html │ ├── m5stack_core2.html │ ├── m5stack_core3.html │ ├── rp2040_touch_lcd_128.html │ ├── t-dongle-s3.html │ ├── t-embed.html │ ├── t_qt_pro.html │ ├── ttgo_tdisplay.html │ ├── ttgo_tdisplay_rp2040.html │ ├── waveshare_114.html │ ├── waveshare_13.html │ └── waveshare_2.html ├── examples.html ├── examples │ ├── alien.html │ ├── boxlines.html │ ├── chango.html │ ├── color_test.html │ ├── colorbars.html │ ├── feathers.html │ ├── fonts.html │ ├── hello.html │ ├── noto_fonts.html │ ├── proverbs.html │ ├── roids.html │ ├── rotations.html │ ├── scroll.html │ ├── tiny_hello.html │ └── tiny_toasters.html ├── fonts.html ├── genindex.html ├── index.html ├── objects.inv ├── py-modindex.html ├── search.html ├── searchindex.js ├── st7789py.html ├── utilities.html └── utilities │ ├── create_png_examples.html │ ├── image_converter.html │ ├── make_colorbars_bitmap.html │ ├── sprites_converter.html │ ├── text_font_converter.html │ └── write_font_converter.html ├── examples ├── alien │ ├── alien.png │ ├── alien.py │ ├── alien_bitmap.py │ └── make_alien_bitmap.sh ├── boxlines.py ├── chango │ ├── chango.py │ ├── chango_16.py │ ├── chango_32.py │ └── chango_64.py ├── color_test.py ├── colorbars │ ├── colorbars.py │ ├── colorbars_160x80.py │ ├── colorbars_170x320.py │ ├── colorbars_240x320.py │ ├── colorbars_320x170.py │ ├── colorbars_320x240.py │ └── colorbars_80x160.py ├── feathers.py ├── fonts.py ├── hello.py ├── noto_fonts │ ├── NotoSansMono_32.py │ ├── NotoSans_32.py │ ├── NotoSerif_32.py │ └── noto_fonts.py ├── proverbs │ ├── NotoSansSC-Regular.otf │ ├── make_proverbs_fonts.sh │ ├── proverbs.py │ ├── proverbs_20.py │ └── proverbs_30.py ├── roids.py ├── rotations.py ├── run_all.sh ├── scroll.py ├── tiny_hello.py ├── tiny_toasters │ ├── make_tiny_toast_bitmaps.sh │ ├── tiny_toasters.bmp │ ├── tiny_toasters.py │ └── tiny_toasters_bitmaps.py └── upload_all.sh ├── lib ├── __init__.py └── st7789py.py ├── romfonts ├── __init__.py ├── compile_upload.sh ├── vga1_16x16.py ├── vga1_16x32.py ├── vga1_8x16.py ├── vga1_8x8.py ├── vga1_bold_16x16.py ├── vga1_bold_16x32.py ├── vga2_16x16.py ├── vga2_16x32.py ├── vga2_8x16.py ├── vga2_8x8.py ├── vga2_bold_16x16.py └── vga2_bold_16x32.py ├── sphinx ├── Makefile ├── make-examples.sh ├── requirements.txt ├── source │ ├── _static │ │ ├── alien.jpg │ │ ├── boxlines.jpg │ │ ├── chango.jpg │ │ ├── color_test.jpg │ │ ├── colorbars.jpg │ │ ├── feathers.jpg │ │ ├── fonts.jpg │ │ ├── hello.jpg │ │ ├── noto_fonts.jpg │ │ ├── proverbs.jpg │ │ ├── roids.jpg │ │ ├── rotation.jpg │ │ ├── rotations.jpg │ │ ├── scroll.jpg │ │ ├── tiny_hello.jpg │ │ ├── tiny_toasters.jpg │ │ ├── vga1_16x16.png │ │ ├── vga1_16x32.png │ │ ├── vga1_8x16.png │ │ ├── vga1_8x8.png │ │ ├── vga1_bold_16x16.png │ │ ├── vga1_bold_16x32.png │ │ ├── vga2_16x16.png │ │ ├── vga2_16x32.png │ │ ├── vga2_8x16.png │ │ ├── vga2_8x8.png │ │ ├── vga2_bold_16x16.png │ │ └── vga2_bold_16x32.png │ ├── conf.py │ ├── configs.rst │ ├── configs │ │ ├── atom_s3.rst │ │ ├── esp32_320x240.rst │ │ ├── m5stack_core.rst │ │ ├── m5stack_core2.rst │ │ ├── m5stack_core3.rst │ │ ├── rp2040_touch_lcd_128.rst │ │ ├── t-dongle-s3.rst │ │ ├── t-embed.rst │ │ ├── t_qt_pro.rst │ │ ├── ttgo_tdisplay.rst │ │ ├── ttgo_tdisplay_rp2040.rst │ │ ├── waveshare_114.rst │ │ ├── waveshare_13.rst │ │ └── waveshare_2.rst │ ├── examples.rst │ ├── examples │ │ ├── alien.rst │ │ ├── boxlines.rst │ │ ├── chango.rst │ │ ├── color_test.rst │ │ ├── colorbars.rst │ │ ├── feathers.rst │ │ ├── fonts.rst │ │ ├── hello.rst │ │ ├── noto_fonts.rst │ │ ├── proverbs.rst │ │ ├── roids.rst │ │ ├── rotations.rst │ │ ├── scroll.rst │ │ ├── tiny_hello.rst │ │ └── tiny_toasters.rst │ ├── fonts.rst │ ├── genindex.rst │ ├── index.rst │ ├── romfont.py │ ├── st7789py.rst │ ├── truetype.py │ ├── utilities.rst │ └── utilities │ │ ├── create_png_examples.rst │ │ ├── image_converter.rst │ │ ├── make_colorbars_bitmap.rst │ │ ├── sprites_converter.rst │ │ ├── text_font_converter.rst │ │ └── write_font_converter.rst └── update.sh ├── tft_configs ├── atom_s3 │ ├── tft_buttons.py │ └── tft_config.py ├── esp32-2432S028r_st7789 │ └── tft_config.py ├── esp32_320x240 │ ├── tft_buttons.py │ └── tft_config.py ├── m5stack_core │ ├── tft_buttons.py │ └── tft_config.py ├── m5stack_core2 │ ├── axp202c.py │ ├── tft_buttons.py │ └── tft_config.py ├── m5stack_core3 │ ├── m5cores3.py │ ├── tft_buttons.py │ └── tft_config.py ├── rp2040_touch_lcd_128 │ ├── tft_buttons.py │ └── tft_config.py ├── t-dongle-s3 │ ├── tft_buttons.py │ └── tft_config.py ├── t-embed │ ├── tft_buttons.py │ └── tft_config.py ├── t_qt_pro │ ├── tft_buttons.py │ └── tft_config.py ├── ttgo_tdisplay │ ├── tft_buttons.py │ └── tft_config.py ├── ttgo_tdisplay_rp2040 │ ├── tft_buttons.py │ └── tft_config.py ├── waveshare_114 │ ├── tft_buttons.py │ └── tft_config.py ├── waveshare_13 │ ├── tft_buttons.py │ └── tft_config.py └── waveshare_2 │ ├── tft_buttons.py │ └── tft_config.py └── utils ├── README.md ├── color_bars.png ├── color_sprites.png ├── create_png_examples.py ├── image_converter.py ├── make_colorbars_bitmap.py ├── requirements.txt ├── sprites.png ├── sprites_converter.py ├── text_font_converter.py ├── vga8x8.py └── write_font_converter.py /.gitignore: -------------------------------------------------------------------------------- 1 | .vscode 2 | .idea 3 | __pycache__ 4 | *~ 5 | *.pyc 6 | *.o 7 | *.P 8 | .history 9 | *.mpy 10 | sphinx/source/_build 11 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | 2023-11-29 2 | ---------- 3 | 4 | - Changed examples to use the same source code, with different 5 | `tft_config.py` and `tft_buttons.py` modules. This is to make it easier to support additional devices and configurations. 6 | - Added `tft_buttons.py` modules to support the buttons. 7 | - Added `tft_config.py` modules to support different configurations. 8 | - Added examples to demonstrate and test new features. 9 | - Changed `text()` method to user micropython.viper to improve performance. 10 | - Added `polygon()` method to draw polygons with optional rotation. This is not fast, but it works. 11 | - Added `make-example.py` script to generate documentation for examples, configs and utilities. 12 | - Added documentation for examples, configs and utilities extracted from docstrings using `make-example.py`. 13 | - Added color_order parameter to st7789py to allow different color orders. 14 | - Added custom_init parameter to st7789py to allow custom initialization of the display. 15 | - Added custom_rotation parameter to st7789py to allow custom display sizes, rotations and byte swapping for color data. 16 | - Added `pbitmap` method to support drawing bitmap graphics one line at a time. 17 | - Added `examples/upload_all.sh` script to upload all examples to the board. 18 | - Added `run_all.sh` script to run all examples on the board. 19 | - Updated and improved documentation. 20 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020-2023 Russ Hughes 4 | Copyright (c) 2019 Ivan Belokobylskiy 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in all 14 | copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | MicroPython LCD Driver in Python 2 | ================================ 3 | 4 | This is a fork of devbis' st7789py_mpy module from 5 | https://github.com/devbis/st7789py_mpy. 6 | 7 | This driver has support for: 8 | 9 | - 320x240, 240x240, 135x240, and 128x128 pixel and other displays 10 | - RGB and BGR Color Orders 11 | - Display rotation 12 | - Hardware based scrolling 13 | - Drawing text using converted PC BIOS bitmap fonts 14 | - Drawing text using converted TrueType fonts. 15 | - Drawing converted bitmaps 16 | 17 | This is a work in progress. Documentation can be found in the docs directory 18 | and at https://russhughes.github.io/st7789py_mpy/ 19 | 20 | 21 | Examples 22 | -------- 23 | 24 | See the examples directory for example programs that run on: 25 | 26 | - ESP32 27 | - Generic ESP32 320x240 28 | - LilyGo T-DISPLAY 135x240 29 | - LilyGo T-Dongle-S3 80x160 (ST7735) 30 | - LilyGo T-embed 170x320 31 | - LILYGO T-QT Pro 128x128 (GC9107) 32 | - M5STACK AtomS3 128x128 (GC9107) 33 | - M5STACK CORE2 320x240 (ILI9342) 34 | - M5STACK CORE 320x240 (ILI9342) 35 | - M5STACK CoreS3 320x240 (ILI9342) 36 | 37 | - RP2040 38 | - LilyGo T-DISPLAY RP2040 135x240 39 | - RP2040-Touch-LCD-1.28 240x240 (GC9A01) 40 | - Waveshare Pico LCD 1.14 135x240 41 | - Waveshare Pico LCD 1.3 240x240 42 | - Waveshare Pico LCD 2 240x320 43 | -------------------------------------------------------------------------------- /docs/.buildinfo: -------------------------------------------------------------------------------- 1 | # Sphinx build info version 1 2 | # This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done. 3 | config: 10d3fe7b78c477da90fd28fc9c006e17 4 | tags: 645f666f9bcd5a90fca523b33c5a78b7 5 | -------------------------------------------------------------------------------- /docs/.nojekyll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/russhughes/st7789py_mpy/7265925bd0c092e8105200d18b2dba9dfbc12c27/docs/.nojekyll -------------------------------------------------------------------------------- /docs/_images/alien.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/russhughes/st7789py_mpy/7265925bd0c092e8105200d18b2dba9dfbc12c27/docs/_images/alien.jpg -------------------------------------------------------------------------------- /docs/_images/boxlines.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/russhughes/st7789py_mpy/7265925bd0c092e8105200d18b2dba9dfbc12c27/docs/_images/boxlines.jpg -------------------------------------------------------------------------------- /docs/_images/chango.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/russhughes/st7789py_mpy/7265925bd0c092e8105200d18b2dba9dfbc12c27/docs/_images/chango.jpg -------------------------------------------------------------------------------- /docs/_images/color_test.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/russhughes/st7789py_mpy/7265925bd0c092e8105200d18b2dba9dfbc12c27/docs/_images/color_test.jpg -------------------------------------------------------------------------------- /docs/_images/colorbars.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/russhughes/st7789py_mpy/7265925bd0c092e8105200d18b2dba9dfbc12c27/docs/_images/colorbars.jpg -------------------------------------------------------------------------------- /docs/_images/feathers.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/russhughes/st7789py_mpy/7265925bd0c092e8105200d18b2dba9dfbc12c27/docs/_images/feathers.jpg -------------------------------------------------------------------------------- /docs/_images/fonts.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/russhughes/st7789py_mpy/7265925bd0c092e8105200d18b2dba9dfbc12c27/docs/_images/fonts.jpg -------------------------------------------------------------------------------- /docs/_images/hello.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/russhughes/st7789py_mpy/7265925bd0c092e8105200d18b2dba9dfbc12c27/docs/_images/hello.jpg -------------------------------------------------------------------------------- /docs/_images/noto_fonts.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/russhughes/st7789py_mpy/7265925bd0c092e8105200d18b2dba9dfbc12c27/docs/_images/noto_fonts.jpg -------------------------------------------------------------------------------- /docs/_images/proverbs.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/russhughes/st7789py_mpy/7265925bd0c092e8105200d18b2dba9dfbc12c27/docs/_images/proverbs.jpg -------------------------------------------------------------------------------- /docs/_images/roids.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/russhughes/st7789py_mpy/7265925bd0c092e8105200d18b2dba9dfbc12c27/docs/_images/roids.jpg -------------------------------------------------------------------------------- /docs/_images/rotations.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/russhughes/st7789py_mpy/7265925bd0c092e8105200d18b2dba9dfbc12c27/docs/_images/rotations.jpg -------------------------------------------------------------------------------- /docs/_images/scroll.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/russhughes/st7789py_mpy/7265925bd0c092e8105200d18b2dba9dfbc12c27/docs/_images/scroll.jpg -------------------------------------------------------------------------------- /docs/_images/tiny_hello.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/russhughes/st7789py_mpy/7265925bd0c092e8105200d18b2dba9dfbc12c27/docs/_images/tiny_hello.jpg -------------------------------------------------------------------------------- /docs/_images/tiny_toasters.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/russhughes/st7789py_mpy/7265925bd0c092e8105200d18b2dba9dfbc12c27/docs/_images/tiny_toasters.jpg -------------------------------------------------------------------------------- /docs/_images/vga1_16x16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/russhughes/st7789py_mpy/7265925bd0c092e8105200d18b2dba9dfbc12c27/docs/_images/vga1_16x16.png -------------------------------------------------------------------------------- /docs/_images/vga1_16x32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/russhughes/st7789py_mpy/7265925bd0c092e8105200d18b2dba9dfbc12c27/docs/_images/vga1_16x32.png -------------------------------------------------------------------------------- /docs/_images/vga1_8x16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/russhughes/st7789py_mpy/7265925bd0c092e8105200d18b2dba9dfbc12c27/docs/_images/vga1_8x16.png -------------------------------------------------------------------------------- /docs/_images/vga1_8x8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/russhughes/st7789py_mpy/7265925bd0c092e8105200d18b2dba9dfbc12c27/docs/_images/vga1_8x8.png -------------------------------------------------------------------------------- /docs/_images/vga1_bold_16x16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/russhughes/st7789py_mpy/7265925bd0c092e8105200d18b2dba9dfbc12c27/docs/_images/vga1_bold_16x16.png -------------------------------------------------------------------------------- /docs/_images/vga1_bold_16x32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/russhughes/st7789py_mpy/7265925bd0c092e8105200d18b2dba9dfbc12c27/docs/_images/vga1_bold_16x32.png -------------------------------------------------------------------------------- /docs/_images/vga2_16x16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/russhughes/st7789py_mpy/7265925bd0c092e8105200d18b2dba9dfbc12c27/docs/_images/vga2_16x16.png -------------------------------------------------------------------------------- /docs/_images/vga2_16x32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/russhughes/st7789py_mpy/7265925bd0c092e8105200d18b2dba9dfbc12c27/docs/_images/vga2_16x32.png -------------------------------------------------------------------------------- /docs/_images/vga2_8x16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/russhughes/st7789py_mpy/7265925bd0c092e8105200d18b2dba9dfbc12c27/docs/_images/vga2_8x16.png -------------------------------------------------------------------------------- /docs/_images/vga2_8x8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/russhughes/st7789py_mpy/7265925bd0c092e8105200d18b2dba9dfbc12c27/docs/_images/vga2_8x8.png -------------------------------------------------------------------------------- /docs/_images/vga2_bold_16x16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/russhughes/st7789py_mpy/7265925bd0c092e8105200d18b2dba9dfbc12c27/docs/_images/vga2_bold_16x16.png -------------------------------------------------------------------------------- /docs/_images/vga2_bold_16x32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/russhughes/st7789py_mpy/7265925bd0c092e8105200d18b2dba9dfbc12c27/docs/_images/vga2_bold_16x32.png -------------------------------------------------------------------------------- /docs/_sources/configs.rst.txt: -------------------------------------------------------------------------------- 1 | .. toctree:: 2 | :glob: 3 | 4 | configs/* 5 | -------------------------------------------------------------------------------- /docs/_sources/configs/atom_s3.rst.txt: -------------------------------------------------------------------------------- 1 | .. _../tft_configs/atom_s3: 2 | 3 | M5STACK AtomS3 128x128 (GC9107) 4 | =============================== 5 | 6 | 7 | https://docs.m5stack.com/en/core/AtomS3 8 | 9 | tft_configs/atom_s3/tft_config.py 10 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 11 | 12 | .. literalinclude:: ../../../tft_configs/atom_s3/tft_config.py 13 | :language: python 14 | :linenos: 15 | :lines: 1- 16 | 17 | 18 | tft_configs/atom_s3/tft_buttons.py 19 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 20 | 21 | M5STACK AtomS3 buttons 22 | 23 | .. literalinclude:: ../../../tft_configs/atom_s3/tft_buttons.py 24 | :language: python 25 | :linenos: 26 | :lines: 1- 27 | 28 | -------------------------------------------------------------------------------- /docs/_sources/configs/esp32_320x240.rst.txt: -------------------------------------------------------------------------------- 1 | .. _../tft_configs/esp32_320x240: 2 | 3 | Generic ESP32 320x240 4 | ===================== 5 | 6 | 7 | 8 | tft_configs/esp32_320x240/tft_config.py 9 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 10 | 11 | .. literalinclude:: ../../../tft_configs/esp32_320x240/tft_config.py 12 | :language: python 13 | :linenos: 14 | :lines: 1- 15 | 16 | 17 | tft_configs/esp32_320x240/tft_buttons.py 18 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 19 | 20 | Generic ESP32 with Two buttons 21 | 22 | .. literalinclude:: ../../../tft_configs/esp32_320x240/tft_buttons.py 23 | :language: python 24 | :linenos: 25 | :lines: 1- 26 | 27 | -------------------------------------------------------------------------------- /docs/_sources/configs/m5stack_core.rst.txt: -------------------------------------------------------------------------------- 1 | .. _../tft_configs/m5stack_core: 2 | 3 | M5STACK CORE 320x240 (ILI9342) 4 | ============================== 5 | 6 | 7 | 8 | tft_configs/m5stack_core/tft_config.py 9 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 10 | 11 | .. literalinclude:: ../../../tft_configs/m5stack_core/tft_config.py 12 | :language: python 13 | :linenos: 14 | :lines: 1- 15 | 16 | 17 | tft_configs/m5stack_core/tft_buttons.py 18 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 19 | 20 | Buttons class for examples, modify for your device. 21 | 22 | Attributes: 23 | name (str): The name of the device. 24 | left (Pin): The Pin object representing the left button. 25 | right (Pin): The Pin object representing the right button. 26 | fire (Pin): The Pin object representing the fire button. 27 | thrust (Pin): The Pin object representing the thrust button. 28 | hyper (Pin): The Pin object representing the hyper button. 29 | 30 | .. literalinclude:: ../../../tft_configs/m5stack_core/tft_buttons.py 31 | :language: python 32 | :linenos: 33 | :lines: 1- 34 | 35 | -------------------------------------------------------------------------------- /docs/_sources/configs/m5stack_core2.rst.txt: -------------------------------------------------------------------------------- 1 | .. _../tft_configs/m5stack_core2: 2 | 3 | M5STACK CORE2 320x240 (ILI9342) 4 | =============================== 5 | 6 | 7 | 8 | tft_configs/m5stack_core2/tft_config.py 9 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 10 | 11 | .. literalinclude:: ../../../tft_configs/m5stack_core2/tft_config.py 12 | :language: python 13 | :linenos: 14 | :lines: 1- 15 | 16 | 17 | tft_configs/m5stack_core2/tft_buttons.py 18 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 19 | 20 | 21 | from machine import Pin 22 | 23 | 24 | class Buttons: 25 | 26 | .. literalinclude:: ../../../tft_configs/m5stack_core2/tft_buttons.py 27 | :language: python 28 | :linenos: 29 | :lines: 1- 30 | 31 | -------------------------------------------------------------------------------- /docs/_sources/configs/m5stack_core3.rst.txt: -------------------------------------------------------------------------------- 1 | .. _../tft_configs/m5stack_core3: 2 | 3 | M5STACK CoreS3 320x240 (ILI9342) 4 | ================================ 5 | 6 | 7 | 8 | tft_configs/m5stack_core3/tft_config.py 9 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 10 | 11 | .. literalinclude:: ../../../tft_configs/m5stack_core3/tft_config.py 12 | :language: python 13 | :linenos: 14 | :lines: 1- 15 | 16 | 17 | tft_configs/m5stack_core3/tft_buttons.py 18 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 19 | 20 | Buttons class for examples, modify for your device. 21 | 22 | Attributes: 23 | name (str): The name of the device. 24 | left (Pin): The Pin object representing the left button. 25 | right (Pin): The Pin object representing the right button. 26 | fire (Pin): The Pin object representing the fire button. 27 | thrust (Pin): The Pin object representing the thrust button. 28 | hyper (Pin): The Pin object representing the hyper button. 29 | 30 | .. literalinclude:: ../../../tft_configs/m5stack_core3/tft_buttons.py 31 | :language: python 32 | :linenos: 33 | :lines: 1- 34 | 35 | -------------------------------------------------------------------------------- /docs/_sources/configs/rp2040_touch_lcd_128.rst.txt: -------------------------------------------------------------------------------- 1 | .. _../tft_configs/rp2040_touch_lcd_128: 2 | 3 | RP2040-Touch-LCD-1.28 240x240 (GC9A01) 4 | ====================================== 5 | 6 | 7 | 8 | tft_configs/rp2040_touch_lcd_128/tft_config.py 9 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 10 | 11 | .. literalinclude:: ../../../tft_configs/rp2040_touch_lcd_128/tft_config.py 12 | :language: python 13 | :linenos: 14 | :lines: 1- 15 | 16 | 17 | tft_configs/rp2040_touch_lcd_128/tft_buttons.py 18 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 19 | 20 | 21 | from machine import Pin 22 | 23 | 24 | class Buttons: 25 | 26 | .. literalinclude:: ../../../tft_configs/rp2040_touch_lcd_128/tft_buttons.py 27 | :language: python 28 | :linenos: 29 | :lines: 1- 30 | 31 | -------------------------------------------------------------------------------- /docs/_sources/configs/t-dongle-s3.rst.txt: -------------------------------------------------------------------------------- 1 | .. _../tft_configs/t-dongle-s3: 2 | 3 | LilyGo T-Dongle-S3 80x160 (ST7735) 4 | ================================== 5 | 6 | 7 | 8 | tft_configs/t-dongle-s3/tft_config.py 9 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 10 | 11 | .. literalinclude:: ../../../tft_configs/t-dongle-s3/tft_config.py 12 | :language: python 13 | :linenos: 14 | :lines: 1- 15 | 16 | 17 | tft_configs/t-dongle-s3/tft_buttons.py 18 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 19 | 20 | 21 | 22 | .. literalinclude:: ../../../tft_configs/t-dongle-s3/tft_buttons.py 23 | :language: python 24 | :linenos: 25 | :lines: 1- 26 | 27 | -------------------------------------------------------------------------------- /docs/_sources/configs/t-embed.rst.txt: -------------------------------------------------------------------------------- 1 | .. _../tft_configs/t-embed: 2 | 3 | LilyGo T-embed 170x320 4 | ====================== 5 | 6 | 7 | 8 | tft_configs/t-embed/tft_config.py 9 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 10 | 11 | .. literalinclude:: ../../../tft_configs/t-embed/tft_config.py 12 | :language: python 13 | :linenos: 14 | :lines: 1- 15 | 16 | 17 | tft_configs/t-embed/tft_buttons.py 18 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 19 | 20 | Buttons class for examples, modify for your device. 21 | 22 | Attributes: 23 | name (str): The name of the device. 24 | left (Pin): The Pin object representing the left button. 25 | right (Pin): The Pin object representing the right button. 26 | fire (Pin): The Pin object representing the fire button. 27 | thrust (Pin): The Pin object representing the thrust button. 28 | hyper (Pin): The Pin object representing the hyper button. 29 | 30 | .. literalinclude:: ../../../tft_configs/t-embed/tft_buttons.py 31 | :language: python 32 | :linenos: 33 | :lines: 1- 34 | 35 | -------------------------------------------------------------------------------- /docs/_sources/configs/t_qt_pro.rst.txt: -------------------------------------------------------------------------------- 1 | .. _../tft_configs/t_qt_pro: 2 | 3 | LilyGo T-QT Pro 128x128 (GC9107) 4 | ================================ 5 | 6 | 7 | https://www.lilygo.cc/products/t-qt-pro 8 | 9 | tft_configs/t_qt_pro/tft_config.py 10 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 11 | 12 | .. literalinclude:: ../../../tft_configs/t_qt_pro/tft_config.py 13 | :language: python 14 | :linenos: 15 | :lines: 1- 16 | 17 | 18 | tft_configs/t_qt_pro/tft_buttons.py 19 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 20 | 21 | LILYGO® T-QT Pro buttons 22 | 23 | .. literalinclude:: ../../../tft_configs/t_qt_pro/tft_buttons.py 24 | :language: python 25 | :linenos: 26 | :lines: 1- 27 | 28 | -------------------------------------------------------------------------------- /docs/_sources/configs/ttgo_tdisplay.rst.txt: -------------------------------------------------------------------------------- 1 | .. _../tft_configs/ttgo_tdisplay: 2 | 3 | LilyGo T-DISPLAY 135x240 4 | ======================== 5 | 6 | 7 | https://www.lilygo.cc/products/lilygo%C2%AE-ttgo-t-display-1-14-inch-lcd-esp32-control-board 8 | 9 | tft_configs/ttgo_tdisplay/tft_config.py 10 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 11 | 12 | .. literalinclude:: ../../../tft_configs/ttgo_tdisplay/tft_config.py 13 | :language: python 14 | :linenos: 15 | :lines: 1- 16 | 17 | 18 | tft_configs/ttgo_tdisplay/tft_buttons.py 19 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 20 | 21 | T-Display ESP32 Buttons. 22 | 23 | .. literalinclude:: ../../../tft_configs/ttgo_tdisplay/tft_buttons.py 24 | :language: python 25 | :linenos: 26 | :lines: 1- 27 | 28 | -------------------------------------------------------------------------------- /docs/_sources/configs/ttgo_tdisplay_rp2040.rst.txt: -------------------------------------------------------------------------------- 1 | .. _../tft_configs/ttgo_tdisplay_rp2040: 2 | 3 | LilyGo T-DISPLAY RP2040 135x240 4 | =============================== 5 | 6 | 7 | https://www.lilygo.cc/products/t-display-rp2040 8 | 9 | tft_configs/ttgo_tdisplay_rp2040/tft_config.py 10 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 11 | 12 | .. literalinclude:: ../../../tft_configs/ttgo_tdisplay_rp2040/tft_config.py 13 | :language: python 14 | :linenos: 15 | :lines: 1- 16 | 17 | 18 | tft_configs/ttgo_tdisplay_rp2040/tft_buttons.py 19 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 20 | 21 | T-Display RP2040 Buttons configuration. 22 | 23 | .. literalinclude:: ../../../tft_configs/ttgo_tdisplay_rp2040/tft_buttons.py 24 | :language: python 25 | :linenos: 26 | :lines: 1- 27 | 28 | -------------------------------------------------------------------------------- /docs/_sources/configs/waveshare_114.rst.txt: -------------------------------------------------------------------------------- 1 | .. _../tft_configs/waveshare_114: 2 | 3 | Waveshare Pico LCD 1.14 135x240 4 | =============================== 5 | 6 | 7 | https://www.waveshare.com/wiki/Pico-LCD-1.14 8 | 9 | tft_configs/waveshare_114/tft_config.py 10 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 11 | 12 | .. literalinclude:: ../../../tft_configs/waveshare_114/tft_config.py 13 | :language: python 14 | :linenos: 15 | :lines: 1- 16 | 17 | 18 | tft_configs/waveshare_114/tft_buttons.py 19 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 20 | 21 | Waveshare Pico LCD 1.14 Buttons 22 | 23 | .. literalinclude:: ../../../tft_configs/waveshare_114/tft_buttons.py 24 | :language: python 25 | :linenos: 26 | :lines: 1- 27 | 28 | -------------------------------------------------------------------------------- /docs/_sources/configs/waveshare_13.rst.txt: -------------------------------------------------------------------------------- 1 | .. _../tft_configs/waveshare_13: 2 | 3 | Waveshare Pico LCD 1.3 240x240 4 | ============================== 5 | 6 | 7 | https://www.waveshare.com/wiki/Pico-LCD-1.3 8 | 9 | tft_configs/waveshare_13/tft_config.py 10 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 11 | 12 | .. literalinclude:: ../../../tft_configs/waveshare_13/tft_config.py 13 | :language: python 14 | :linenos: 15 | :lines: 1- 16 | 17 | 18 | tft_configs/waveshare_13/tft_buttons.py 19 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 20 | 21 | Waveshare 1.3" TFT display with ST7789 controller 22 | 23 | .. literalinclude:: ../../../tft_configs/waveshare_13/tft_buttons.py 24 | :language: python 25 | :linenos: 26 | :lines: 1- 27 | 28 | -------------------------------------------------------------------------------- /docs/_sources/configs/waveshare_2.rst.txt: -------------------------------------------------------------------------------- 1 | .. _../tft_configs/waveshare_2: 2 | 3 | Waveshare Pico LCD 2 240x320 4 | ============================ 5 | 6 | 7 | https://www.waveshare.com/wiki/Pico-LCD-2 8 | 9 | tft_configs/waveshare_2/tft_config.py 10 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 11 | 12 | .. literalinclude:: ../../../tft_configs/waveshare_2/tft_config.py 13 | :language: python 14 | :linenos: 15 | :lines: 1- 16 | 17 | 18 | tft_configs/waveshare_2/tft_buttons.py 19 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 20 | 21 | input pins for ws_pico_2 22 | 23 | .. literalinclude:: ../../../tft_configs/waveshare_2/tft_buttons.py 24 | :language: python 25 | :linenos: 26 | :lines: 1- 27 | 28 | -------------------------------------------------------------------------------- /docs/_sources/examples.rst.txt: -------------------------------------------------------------------------------- 1 | **************** 2 | Example Programs 3 | **************** 4 | 5 | 6 | Configuration modules 7 | ===================== 8 | 9 | To run the examples, you need two modules that set up the display and buttons for the example MicroPython programs: **tft_config.py** and **tft_buttons.py**. These modules configure the display and manage button interactions, ensuring compatibility with various processors and displays. The provided modules located in the tft_configs folder are specific to the devices I used during testing; use them as a reference to create configuration modules for your device if it's not one of those included. 10 | 11 | 12 | .. include:: configs.rst 13 | 14 | Examples 15 | ======== 16 | 17 | .. toctree:: 18 | :glob: 19 | 20 | examples/* 21 | 22 | -------------------------------------------------------------------------------- /docs/_sources/examples/alien.rst.txt: -------------------------------------------------------------------------------- 1 | .. _alien: 2 | 3 | alien.py 4 | ========= 5 | 6 | .. figure:: ../_static/alien.jpg 7 | :align: center 8 | 9 | Bounce a bitmap of an alien around the display. 10 | 11 | The alien_bitmap module was created using the :ref:`image_converter.py` utility. 12 | 13 | .. literalinclude:: ../../../examples/alien/make_alien_bitmap.sh 14 | 15 | .. note:: This example requires the following modules: 16 | 17 | .. hlist:: 18 | :columns: 3 19 | 20 | - `st7789py` 21 | - `tft_config` 22 | - `alien_bitmap` 23 | 24 | The alien.png PNG file is from the Erik Flowers Weather Icons available from 25 | https://github.com/erikflowers/weather-icons and is licensed under SIL OFL 1.1 26 | (http://scripts.sil.org/OFL). 27 | 28 | .. literalinclude:: ../../../examples/alien/alien.py 29 | :language: python 30 | :linenos: 31 | :lines: 1- 32 | 33 | -------------------------------------------------------------------------------- /docs/_sources/examples/boxlines.rst.txt: -------------------------------------------------------------------------------- 1 | .. _boxlines: 2 | 3 | boxlines.py 4 | =========== 5 | 6 | .. figure:: ../_static/boxlines.jpg 7 | :align: center 8 | 9 | Test for lines and rectangles. 10 | 11 | Draws lines and rectangles in random colors at random locations on the display. 12 | 13 | .. note:: This example requires the following modules: 14 | 15 | .. hlist:: 16 | :columns: 3 17 | 18 | - `st7789py` 19 | - `tft_config` 20 | 21 | .. literalinclude:: ../../../examples/boxlines.py 22 | :language: python 23 | :linenos: 24 | :lines: 1- 25 | 26 | -------------------------------------------------------------------------------- /docs/_sources/examples/chango.rst.txt: -------------------------------------------------------------------------------- 1 | .. _chango: 2 | 3 | chango.py 4 | ========= 5 | 6 | .. figure:: ../_static/chango.jpg 7 | :align: center 8 | 9 | Test for TrueType write_font_converter. 10 | 11 | See the :ref:`write_font_converter.py` program in the utils directory. 12 | 13 | .. note:: This example requires the following modules: 14 | 15 | .. hlist:: 16 | :columns: 3 17 | 18 | - `st7789py` 19 | - `tft_config` 20 | - `chango_16` 21 | - `chango_32` 22 | - `chango_64` 23 | 24 | .. literalinclude:: ../../../examples/chango/chango.py 25 | :language: python 26 | :linenos: 27 | :lines: 1- 28 | 29 | -------------------------------------------------------------------------------- /docs/_sources/examples/color_test.rst.txt: -------------------------------------------------------------------------------- 1 | .. _color_test: 2 | 3 | color_test.py 4 | ============= 5 | 6 | .. figure:: ../_static/color_test.jpg 7 | :align: center 8 | 9 | Test color with gradients. 10 | 11 | Draws Red, Green and Blues gradients on the display and writes the color name centered in the 12 | gradient. Then repeatedly draws a borders around the display in the same colors. 13 | 14 | .. note:: This example requires the following modules: 15 | 16 | .. hlist:: 17 | :columns: 3 18 | 19 | - `st7789py` 20 | - `tft_config` 21 | - `vga2_bold_16x32` 22 | 23 | .. literalinclude:: ../../../examples/color_test.py 24 | :language: python 25 | :linenos: 26 | :lines: 1- 27 | 28 | -------------------------------------------------------------------------------- /docs/_sources/examples/colorbars.rst.txt: -------------------------------------------------------------------------------- 1 | .. _colorbars: 2 | 3 | .. _colorbars.py: 4 | 5 | colorbars.py 6 | ============= 7 | 8 | .. figure:: ../_static/colorbars.jpg 9 | :align: center 10 | 11 | Test bitmap colors. 12 | 13 | Displays WHITE, YELLOW, CYAN, GREEN, MAGENTA, RED, and BLUE color bar bitmap named 14 | colorbars_{WIDTH}x(HEIGHT) on the display. Custom sized bitmap modules can be created 15 | using the :ref:`make_colorbars_bitmap.py` utility. 16 | 17 | .. note:: This example requires the following modules: 18 | 19 | .. hlist:: 20 | :columns: 3 21 | 22 | - `st7789py` 23 | - `tft_config` 24 | - `colorbars_{WIDTH}x{HEIGHT}` 25 | 26 | .. literalinclude:: ../../../examples/colorbars/colorbars.py 27 | :language: python 28 | :linenos: 29 | :lines: 1- 30 | 31 | -------------------------------------------------------------------------------- /docs/_sources/examples/feathers.rst.txt: -------------------------------------------------------------------------------- 1 | .. _feathers: 2 | 3 | feathers.py 4 | =========== 5 | 6 | .. figure:: ../_static/feathers.jpg 7 | :align: center 8 | 9 | Test hardware scrolling. 10 | 11 | Smoothly scrolls mirrored rainbow colored random curves across the display. 12 | 13 | .. note:: This example requires the following modules: 14 | 15 | .. hlist:: 16 | :columns: 3 17 | 18 | - `st7789py` 19 | - `tft_config` 20 | 21 | .. literalinclude:: ../../../examples/feathers.py 22 | :language: python 23 | :linenos: 24 | :lines: 1- 25 | 26 | -------------------------------------------------------------------------------- /docs/_sources/examples/fonts.rst.txt: -------------------------------------------------------------------------------- 1 | .. _fonts: 2 | 3 | fonts.py 4 | ======== 5 | 6 | .. figure:: ../_static/fonts.jpg 7 | :align: center 8 | 9 | Test text_font_converter.py 10 | 11 | Pages through all characters of four fonts on the Display. 12 | https://www.youtube.com/watch?v=2cnAhEucPD4 13 | 14 | .. note:: This example requires the following modules: 15 | 16 | .. hlist:: 17 | :columns: 3 18 | 19 | - `st7789py` 20 | - `tft_config` 21 | - `vga2_8x8` 22 | - `vga2_8x16` 23 | - `vga2_bold_16x16` 24 | - `vga2_bold_16x32` 25 | 26 | .. literalinclude:: ../../../examples/fonts.py 27 | :language: python 28 | :linenos: 29 | :lines: 1- 30 | 31 | -------------------------------------------------------------------------------- /docs/_sources/examples/hello.rst.txt: -------------------------------------------------------------------------------- 1 | .. _hello: 2 | 3 | hello.py 4 | ======== 5 | 6 | .. figure:: ../_static/hello.jpg 7 | :align: center 8 | 9 | Test for text_font_converter. 10 | 11 | Writes "Hello!" in random colors at random locations on the Display. 12 | https://www.youtube.com/watch?v=atBa0BYPAAc 13 | 14 | .. note:: This example requires the following modules: 15 | 16 | .. hlist:: 17 | :columns: 3 18 | 19 | - `st7789py` 20 | - `tft_config` 21 | - `vga2_bold_16x32` 22 | 23 | .. literalinclude:: ../../../examples/hello.py 24 | :language: python 25 | :linenos: 26 | :lines: 1- 27 | 28 | -------------------------------------------------------------------------------- /docs/_sources/examples/noto_fonts.rst.txt: -------------------------------------------------------------------------------- 1 | .. _noto_fonts: 2 | 3 | noto_fonts.py 4 | ============= 5 | 6 | .. figure:: ../_static/noto_fonts.jpg 7 | :align: center 8 | 9 | Test for TrueType write_font_converter. 10 | 11 | Writes the names of three Noto fonts centered on the display using the font. 12 | The fonts were converted from True Type fonts using the 13 | :ref:`write_font_converter.py` utility. 14 | 15 | .. note:: This example requires the following modules: 16 | 17 | .. hlist:: 18 | :columns: 3 19 | 20 | - `st7789py` 21 | - `tft_config` 22 | - `NotoSans_32` 23 | - `NotoSerif_32` 24 | - `NotoSansMono_32` 25 | 26 | .. literalinclude:: ../../../examples/noto_fonts/noto_fonts.py 27 | :language: python 28 | :linenos: 29 | :lines: 1- 30 | 31 | -------------------------------------------------------------------------------- /docs/_sources/examples/proverbs.rst.txt: -------------------------------------------------------------------------------- 1 | .. _proverbs: 2 | 3 | proverbs.py 4 | =========== 5 | 6 | .. figure:: ../_static/proverbs.jpg 7 | :align: center 8 | 9 | Test for TrueType write_font_converter. 10 | 11 | Displays what I hope are chinese proverbs in simplified chinese to test UTF-8 font support. 12 | The fonts were converted from True Type fonts using the 13 | :ref:`write_font_converter.py` utility. 14 | 15 | .. literalinclude:: ../../../examples/proverbs/make_proverbs_fonts.sh 16 | 17 | 18 | .. note:: This example requires the following modules: 19 | 20 | .. hlist:: 21 | :columns: 3 22 | 23 | - `st7789py` 24 | - `tft_config` 25 | - `proverbs_20` 26 | - `proverbs_30` 27 | 28 | .. literalinclude:: ../../../examples/proverbs/proverbs.py 29 | :language: python 30 | :linenos: 31 | :lines: 1- 32 | 33 | -------------------------------------------------------------------------------- /docs/_sources/examples/roids.rst.txt: -------------------------------------------------------------------------------- 1 | .. _roids: 2 | 3 | roids.py 4 | ======== 5 | 6 | .. figure:: ../_static/roids.jpg 7 | :align: center 8 | 9 | Test for polygons. 10 | 11 | Asteroids style game demo using polygons. 12 | 13 | .. note:: This example requires the following modules: 14 | 15 | .. hlist:: 16 | :columns: 3 17 | 18 | - `st7789py` 19 | - `tft_config` 20 | - `tft_buttons` 21 | 22 | .. literalinclude:: ../../../examples/roids.py 23 | :language: python 24 | :linenos: 25 | :lines: 1- 26 | 27 | -------------------------------------------------------------------------------- /docs/_sources/examples/rotations.rst.txt: -------------------------------------------------------------------------------- 1 | .. _rotations: 2 | 3 | rotations.py 4 | ============ 5 | 6 | .. figure:: ../_static/rotations.jpg 7 | :align: center 8 | 9 | Test for rotations and colors. 10 | 11 | Rotates the display 0, 90, 180, and 270 degrees and displays the rotation 12 | number and the color of the display background. 13 | 14 | .. note:: This example requires the following modules: 15 | 16 | .. hlist:: 17 | :columns: 3 18 | 19 | - `st7789py` 20 | - `tft_config` 21 | - vga1_16x16 22 | 23 | .. literalinclude:: ../../../examples/rotations.py 24 | :language: python 25 | :linenos: 26 | :lines: 1- 27 | 28 | -------------------------------------------------------------------------------- /docs/_sources/examples/scroll.rst.txt: -------------------------------------------------------------------------------- 1 | .. _scroll: 2 | 3 | scroll.py 4 | ========= 5 | 6 | .. figure:: ../_static/scroll.jpg 7 | :align: center 8 | 9 | Test for hardware scrolling. 10 | 11 | Smoothly scrolls all font characters up the screen. 12 | Only works with fonts with heights that are even multiples of the screen height, 13 | (i.e. 8 or 16 pixels high) 14 | 15 | .. note:: This example requires the following modules: 16 | 17 | .. hlist:: 18 | :columns: 3 19 | 20 | - `st7789py` 21 | - `tft_config` 22 | - `vga2_bold_16x16` 23 | 24 | .. literalinclude:: ../../../examples/scroll.py 25 | :language: python 26 | :linenos: 27 | :lines: 1- 28 | 29 | -------------------------------------------------------------------------------- /docs/_sources/examples/tiny_hello.rst.txt: -------------------------------------------------------------------------------- 1 | .. _tiny_hello: 2 | 3 | tiny_hello.py 4 | ============= 5 | 6 | .. figure:: ../_static/tiny_hello.jpg 7 | :align: center 8 | 9 | Test text_font_converter on small displays. 10 | 11 | Writes "Hello!" in a tiny font in random colors at random locations on the Display. 12 | 13 | .. note:: This example requires the following modules: 14 | 15 | .. hlist:: 16 | :columns: 3 17 | 18 | - `st7789py` 19 | - `tft_config` 20 | - `vga1_8x8` 21 | 22 | .. literalinclude:: ../../../examples/tiny_hello.py 23 | :language: python 24 | :linenos: 25 | :lines: 1- 26 | 27 | -------------------------------------------------------------------------------- /docs/_sources/examples/tiny_toasters.rst.txt: -------------------------------------------------------------------------------- 1 | .. _tiny_toasters: 2 | 3 | tiny_toasters.py 4 | ================ 5 | 6 | .. figure:: ../_static/tiny_toasters.jpg 7 | :align: center 8 | 9 | Test sprites_converter. 10 | 11 | Tiny Flying Toasters for smaller displays using a converted BMP spritesheet module using: 12 | 13 | .. code-block:: console 14 | 15 | `sprites_converter.py ttoasters.bmp 32 32 4 > ttoast_bitmaps.py` 16 | 17 | .. rubric:: The tiny_toasters.py example uses the spritesheet from CircuitPython_Flying_Toasters pendant 18 | project https://learn.adafruit.com/circuitpython-sprite-animation-pendant-mario-clouds-flying-toasters 19 | 20 | 21 | .. note:: This example requires the following modules: 22 | 23 | .. hlist:: 24 | :columns: 3 25 | 26 | - `st7789py` 27 | - `tft_config` 28 | - `tiny_toasters` 29 | 30 | .. literalinclude:: ../../../examples/tiny_toasters/tiny_toasters.py 31 | :language: python 32 | :linenos: 33 | :lines: 1- 34 | 35 | -------------------------------------------------------------------------------- /docs/_sources/genindex.rst.txt: -------------------------------------------------------------------------------- 1 | Index 2 | ##### 3 | 4 | -------------------------------------------------------------------------------- /docs/_sources/index.rst.txt: -------------------------------------------------------------------------------- 1 | st7789py Driver 2 | =============== 3 | 4 | This is a fork of devbis' st7789py_mpy module from 5 | https://github.com/devbis/st7789py_mpy. 6 | 7 | This driver has support for: 8 | 9 | - 320x240, 240x240, 135x240, and 128x128 pixel displays 10 | - RGB and BGR Color Orders 11 | - Display rotation 12 | - Hardware based scrolling 13 | - Drawing text using converted PC BIOS bitmap fonts 14 | - Drawing text using converted TrueType fonts. 15 | - Drawing converted bitmaps 16 | 17 | This is a work in progress. Documentation can be found in the docs directory 18 | and at https://russhughes.github.io/st7789py_mpy. 19 | 20 | 21 | .. toctree:: 22 | :maxdepth: 3 23 | :caption: Contents: 24 | 25 | self 26 | st7789py 27 | examples 28 | fonts 29 | utilities 30 | genindex 31 | -------------------------------------------------------------------------------- /docs/_sources/st7789py.rst.txt: -------------------------------------------------------------------------------- 1 | st7789py Reference 2 | ================== 3 | 4 | .. automodule:: st7789py 5 | :members: 6 | 7 | -------------------------------------------------------------------------------- /docs/_sources/utilities.rst.txt: -------------------------------------------------------------------------------- 1 | Utilities 2 | ========= 3 | 4 | .. toctree:: 5 | :glob: 6 | 7 | utilities/* 8 | -------------------------------------------------------------------------------- /docs/_sources/utilities/create_png_examples.rst.txt: -------------------------------------------------------------------------------- 1 | .. _create_png_examples: 2 | 3 | create_png_examples.py 4 | ---------------------- 5 | Reads all font-bin files from the specified `input` directory and writes png images to t 6 | he specified `output` directory. Optionally limiting the characters included to -first-char 7 | (-f) thru -last-char (-l). This is the program I used to create the png font samples in the 8 | documentation. 9 | 10 | .. seealso:: 11 | - :ref:`Bitmap Font Samples`. 12 | 13 | Example 14 | ^^^^^^^ 15 | 16 | .. code-block:: console 17 | 18 | - create_png_examples.py font_directory png_directory 19 | 20 | Usage 21 | ^^^^^ 22 | 23 | .. code-block:: console 24 | 25 | usage: create_png_examples.py [-h] input output 26 | 27 | Creates png samples of each text font file from the input directoryto the output directory. 28 | 29 | positional arguments: 30 | input input directory containing font-bin files 31 | output output directory to create pngs 32 | 33 | optional arguments: 34 | -h, --help show this help message and exit 35 | 36 | -------------------------------------------------------------------------------- /docs/_sources/utilities/image_converter.rst.txt: -------------------------------------------------------------------------------- 1 | .. _image_converter: 2 | 3 | image_converter.py 4 | ------------------ 5 | Convert an image file to a python module for use with the bitmap method. Use redirection to save the 6 | output to a file. The image is converted to a bitmap using the number of bits per pixel you specify. 7 | The bitmap is saved as a python module that can be imported and used with the bitmap method. 8 | 9 | .. seealso:: 10 | - :ref:`alien.py`. 11 | 12 | Example 13 | ^^^^^^^ 14 | 15 | .. code-block:: console 16 | 17 | ./create_png_examples.py cat.png 4 > cat_bitmap.py 18 | 19 | The python file can be imported and displayed with the bitmap method. For example: 20 | 21 | .. code-block:: python 22 | 23 | import tft_config 24 | import cat_bitmap 25 | tft = tft_config.config(1) 26 | tft.bitmap(cat_bitmap, 0, 0) 27 | 28 | Usage 29 | ^^^^^ 30 | 31 | .. code-block:: console 32 | 33 | usage: image_converter.py [-h] image_file bits_per_pixel 34 | 35 | Convert image file to python module for use with bitmap method. 36 | 37 | positional arguments: image_file Name of file containing image to convert bits_per_pixel 38 | The number of bits to use per pixel (1..8) 39 | 40 | optional arguments: -h, --help show this help message and exit 41 | 42 | -------------------------------------------------------------------------------- /docs/_sources/utilities/make_colorbars_bitmap.rst.txt: -------------------------------------------------------------------------------- 1 | .. _make_colorbars_bitmap: 2 | 3 | make_colorbars_bitmap.py 4 | ------------------------ 5 | Create a MicroPython bitmap module with WHITE, YELLOW, CYAN, GREEN, MAGENTA, RED, and BLUE 6 | color bars for testing. Use redirection to save the output to a file. The bitmap is saved 7 | as a python module that can be imported and used with the bitmap method. 8 | 9 | .. seealso:: 10 | :ref:`colorbars.py`. 11 | 12 | Example 13 | ^^^^^^^ 14 | 15 | .. code-block:: console 16 | 17 | ./make_colorbars_bitmap.py 320 240 3 > colorbars_bitmap320x240.py 18 | 19 | The python file can be imported and displayed with the bitmap method. For example: 20 | 21 | .. code-block:: python 22 | 23 | import tft_config 24 | import colorbars_bitmap320x240 25 | tft = tft_config.config(1) 26 | tft.bitmap(colorbars_bitmap320x240, 0, 0) 27 | 28 | Usage 29 | ^^^^^ 30 | 31 | .. code-block:: console 32 | 33 | usage: make_colorbars_bitmap.py [-h] [--png png] width height bits_per_pixel 34 | 35 | Create a bitmap module with color bars for use with the bitmap method. 36 | 37 | positional arguments: 38 | width The width of the image in pixels 39 | height The height of the image in pixels 40 | bits_per_pixel The number of bits to use per pixel (1..8) 41 | 42 | optional arguments: 43 | -h, --help show this help message and exit 44 | --png png Optionally create png file 45 | 46 | -------------------------------------------------------------------------------- /docs/_sources/utilities/sprites_converter.rst.txt: -------------------------------------------------------------------------------- 1 | .. _sprites_converter: 2 | 3 | sprites_converter.py 4 | -------------------- 5 | Convert a sprite sheet image to python a module for use with indexed bitmap method. The Sprite sheet 6 | width and height should be a multiple of sprite width and height. There should be no extra pixels 7 | between sprites. All sprites will share the same palette. 8 | 9 | .. seealso:: 10 | - :ref:`tiny_toasters.py`. 11 | 12 | Example 13 | ^^^^^^^ 14 | 15 | .. code-block:: console 16 | 17 | # create a sprite sheet with 7 colored sprites 32x32 pixels each 18 | ./make_colorbars_bitmap.py 227 32 3 --png sprites.png 19 | 20 | # convert the sprite sheet to a python module with 7 sprites 21 | ./sprites_converter.py sprites.png 32 32 4 > sprites.py 22 | 23 | .. code-block:: python 24 | 25 | import tft_config 26 | import sprites 27 | tft = tft_config.config(1) 28 | for i in range(sprites.BITMAPS): 29 | tft.bitmap(sprites, 0, 0, i) 30 | 31 | Usage 32 | ^^^^^ 33 | 34 | .. code-block:: console 35 | 36 | usage: sprites_converter.py [-h] image_file sprite_width sprite_height bits_per_pixel 37 | 38 | Convert image file to python module for use with bitmap method. 39 | 40 | positional arguments: 41 | image_file Name of file containing image to convert 42 | sprite_width Width of sprites in pixels 43 | sprite_height Height of sprites in pixels 44 | bits_per_pixel The number of bits to use per pixel (1..8) 45 | 46 | optional arguments: 47 | -h, --help show this help message and exit 48 | 49 | -------------------------------------------------------------------------------- /docs/_sources/utilities/text_font_converter.rst.txt: -------------------------------------------------------------------------------- 1 | .. _text_font_converter: 2 | 3 | text_font_converter.py 4 | ---------------------- 5 | Convert fonts from the font-bin directory of spacerace's https://github.com/spacerace/romfont 6 | VGA and BIOS rom font repo. Optionally limiting the characters included to -first-char (-f) thru 7 | -last-char (-l). 8 | 9 | Input can be a file or a directory containing multiple font files. If input is a directory, output 10 | must also be a directory. If input is a file, output can be a file or a directory. 11 | 12 | .. seealso:: 13 | - :ref:`color_test.py`. 14 | - :ref:`fonts.py`. 15 | - :ref:`hello.py`. 16 | - :ref:`rotations.py`. 17 | - :ref:`scroll.py`. 18 | - :ref:`tiny_toasters.py`. 19 | 20 | Example 21 | ^^^^^^^ 22 | 23 | .. code-block:: console 24 | 25 | # convert the IBM_VGA_8x8.bin font to a python module with 8x8 characters 26 | text_font_converter.py romfont/font-bin/IBM_VGA_8x8.bin vga_8x8.py -f 32 -l 127 27 | 28 | .. code-block:: python 29 | 30 | import tft_config 31 | import vga_8x8 32 | tft = tft_config.config(1) 33 | tft.bitmap(vga_8x8, "Hello World!", 0, 0) 34 | 35 | Usage 36 | ^^^^^ 37 | 38 | .. code-block:: console 39 | 40 | usage: text_font_converter.py [-h] [-f FIRST_CHAR] [-l LAST_CHAR] input output 41 | 42 | Convert romfont.bin file or directory to python module(s). 43 | 44 | positional arguments: 45 | input file or directory containing binary font file(s). 46 | output file or directory to contain python font file(s). 47 | 48 | optional arguments: 49 | -h, --help show this help message and exit 50 | -f FIRST_CHAR, --first-char FIRST_CHAR 51 | The first character code to include in the conversion (default: 0x20). 52 | -l LAST_CHAR, --last-char LAST_CHAR 53 | The last character code to include in the conversion (default: 0x7F). 54 | 55 | -------------------------------------------------------------------------------- /docs/_sources/utilities/write_font_converter.rst.txt: -------------------------------------------------------------------------------- 1 | .. _write_font_converter: 2 | 3 | write_font_converter.py 4 | ----------------------- 5 | Convert characters from a truetype font to a python bitmap for use with the bitmap or write method. 6 | The chango, noto_fonts and proverbs examples use converted TrueType fonts. 7 | 8 | .. seealso:: 9 | - :ref:`chango.py`. 10 | - :ref:`noto_fonts.py`. 11 | - :ref:`proverbs.py`. 12 | 13 | Example 14 | ^^^^^^^ 15 | 16 | .. code-block:: console 17 | 18 | # convert the Chango-Regular.ttf to a python bitmap module with approximately 32 pixel high characters 19 | ./write_font_converter.py Chango-Regular.ttf 32 -c 0x20-0x7f > chango_32.py 20 | 21 | .. code-block:: python 22 | 23 | import tft_config 24 | import chango_32 25 | tft = tft_config.config(1) 26 | tft.write(chango_32, "Hello World!", 0, 0) 27 | 28 | Usage 29 | ^^^^^ 30 | 31 | .. code-block:: console 32 | 33 | usage: write_font_converter.py [-h] [-width FONT_WIDTH] (-c CHARACTERS | -s STRING) font_file font_height 34 | 35 | Convert characters from a truetype font to a python bitmap for use with the bitmap method in the st7789 and ili9342 drivers. 36 | 37 | positional arguments: 38 | font_file name of font file to convert. 39 | font_height size of font to create bitmaps from. 40 | 41 | optional arguments: 42 | -h, --help show this help message and exit 43 | -width FONT_WIDTH, --font_width FONT_WIDTH 44 | width of font to create bitmaps from. 45 | 46 | character selection: 47 | characters from the font to include in the bitmap. 48 | 49 | -c CHARACTERS, --characters CHARACTERS 50 | integer or hex character values and/or ranges to include. For example: "65, 66, 67" or "32-127" or "0x30-0x39, 51 | 0x41-0x5a" 52 | -s STRING, --string STRING 53 | string of characters to include For example: "1234567890-." 54 | 55 | -------------------------------------------------------------------------------- /docs/_static/alien.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/russhughes/st7789py_mpy/7265925bd0c092e8105200d18b2dba9dfbc12c27/docs/_static/alien.jpg -------------------------------------------------------------------------------- /docs/_static/boxlines.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/russhughes/st7789py_mpy/7265925bd0c092e8105200d18b2dba9dfbc12c27/docs/_static/boxlines.jpg -------------------------------------------------------------------------------- /docs/_static/chango.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/russhughes/st7789py_mpy/7265925bd0c092e8105200d18b2dba9dfbc12c27/docs/_static/chango.jpg -------------------------------------------------------------------------------- /docs/_static/color_test.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/russhughes/st7789py_mpy/7265925bd0c092e8105200d18b2dba9dfbc12c27/docs/_static/color_test.jpg -------------------------------------------------------------------------------- /docs/_static/colorbars.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/russhughes/st7789py_mpy/7265925bd0c092e8105200d18b2dba9dfbc12c27/docs/_static/colorbars.jpg -------------------------------------------------------------------------------- /docs/_static/css/badge_only.css: -------------------------------------------------------------------------------- 1 | .clearfix{*zoom:1}.clearfix:after,.clearfix:before{display:table;content:""}.clearfix:after{clear:both}@font-face{font-family:FontAwesome;font-style:normal;font-weight:400;src:url(fonts/fontawesome-webfont.eot?674f50d287a8c48dc19ba404d20fe713?#iefix) format("embedded-opentype"),url(fonts/fontawesome-webfont.woff2?af7ae505a9eed503f8b8e6982036873e) format("woff2"),url(fonts/fontawesome-webfont.woff?fee66e712a8a08eef5805a46892932ad) format("woff"),url(fonts/fontawesome-webfont.ttf?b06871f281fee6b241d60582ae9369b9) format("truetype"),url(fonts/fontawesome-webfont.svg?912ec66d7572ff821749319396470bde#FontAwesome) format("svg")}.fa:before{font-family:FontAwesome;font-style:normal;font-weight:400;line-height:1}.fa:before,a .fa{text-decoration:inherit}.fa:before,a .fa,li .fa{display:inline-block}li .fa-large:before{width:1.875em}ul.fas{list-style-type:none;margin-left:2em;text-indent:-.8em}ul.fas li .fa{width:.8em}ul.fas li .fa-large:before{vertical-align:baseline}.fa-book:before,.icon-book:before{content:"\f02d"}.fa-caret-down:before,.icon-caret-down:before{content:"\f0d7"}.fa-caret-up:before,.icon-caret-up:before{content:"\f0d8"}.fa-caret-left:before,.icon-caret-left:before{content:"\f0d9"}.fa-caret-right:before,.icon-caret-right:before{content:"\f0da"}.rst-versions{position:fixed;bottom:0;left:0;width:300px;color:#fcfcfc;background:#1f1d1d;font-family:Lato,proxima-nova,Helvetica Neue,Arial,sans-serif;z-index:400}.rst-versions a{color:#2980b9;text-decoration:none}.rst-versions .rst-badge-small{display:none}.rst-versions .rst-current-version{padding:12px;background-color:#272525;display:block;text-align:right;font-size:90%;cursor:pointer;color:#27ae60}.rst-versions .rst-current-version:after{clear:both;content:"";display:block}.rst-versions .rst-current-version .fa{color:#fcfcfc}.rst-versions .rst-current-version .fa-book,.rst-versions .rst-current-version .icon-book{float:left}.rst-versions .rst-current-version.rst-out-of-date{background-color:#e74c3c;color:#fff}.rst-versions .rst-current-version.rst-active-old-version{background-color:#f1c40f;color:#000}.rst-versions.shift-up{height:auto;max-height:100%;overflow-y:scroll}.rst-versions.shift-up .rst-other-versions{display:block}.rst-versions .rst-other-versions{font-size:90%;padding:12px;color:grey;display:none}.rst-versions .rst-other-versions hr{display:block;height:1px;border:0;margin:20px 0;padding:0;border-top:1px solid #413d3d}.rst-versions .rst-other-versions dd{display:inline-block;margin:0}.rst-versions .rst-other-versions dd a{display:inline-block;padding:6px;color:#fcfcfc}.rst-versions.rst-badge{width:auto;bottom:20px;right:20px;left:auto;border:none;max-width:300px;max-height:90%}.rst-versions.rst-badge .fa-book,.rst-versions.rst-badge .icon-book{float:none;line-height:30px}.rst-versions.rst-badge.shift-up .rst-current-version{text-align:right}.rst-versions.rst-badge.shift-up .rst-current-version .fa-book,.rst-versions.rst-badge.shift-up .rst-current-version .icon-book{float:left}.rst-versions.rst-badge>.rst-current-version{width:auto;height:30px;line-height:30px;padding:0 6px;display:block;text-align:center}@media screen and (max-width:768px){.rst-versions{width:85%;display:none}.rst-versions.shift{display:block}} -------------------------------------------------------------------------------- /docs/_static/css/fonts/Roboto-Slab-Bold.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/russhughes/st7789py_mpy/7265925bd0c092e8105200d18b2dba9dfbc12c27/docs/_static/css/fonts/Roboto-Slab-Bold.woff -------------------------------------------------------------------------------- /docs/_static/css/fonts/Roboto-Slab-Bold.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/russhughes/st7789py_mpy/7265925bd0c092e8105200d18b2dba9dfbc12c27/docs/_static/css/fonts/Roboto-Slab-Bold.woff2 -------------------------------------------------------------------------------- /docs/_static/css/fonts/Roboto-Slab-Regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/russhughes/st7789py_mpy/7265925bd0c092e8105200d18b2dba9dfbc12c27/docs/_static/css/fonts/Roboto-Slab-Regular.woff -------------------------------------------------------------------------------- /docs/_static/css/fonts/Roboto-Slab-Regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/russhughes/st7789py_mpy/7265925bd0c092e8105200d18b2dba9dfbc12c27/docs/_static/css/fonts/Roboto-Slab-Regular.woff2 -------------------------------------------------------------------------------- /docs/_static/css/fonts/fontawesome-webfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/russhughes/st7789py_mpy/7265925bd0c092e8105200d18b2dba9dfbc12c27/docs/_static/css/fonts/fontawesome-webfont.eot -------------------------------------------------------------------------------- /docs/_static/css/fonts/fontawesome-webfont.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/russhughes/st7789py_mpy/7265925bd0c092e8105200d18b2dba9dfbc12c27/docs/_static/css/fonts/fontawesome-webfont.ttf -------------------------------------------------------------------------------- /docs/_static/css/fonts/fontawesome-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/russhughes/st7789py_mpy/7265925bd0c092e8105200d18b2dba9dfbc12c27/docs/_static/css/fonts/fontawesome-webfont.woff -------------------------------------------------------------------------------- /docs/_static/css/fonts/fontawesome-webfont.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/russhughes/st7789py_mpy/7265925bd0c092e8105200d18b2dba9dfbc12c27/docs/_static/css/fonts/fontawesome-webfont.woff2 -------------------------------------------------------------------------------- /docs/_static/css/fonts/lato-bold-italic.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/russhughes/st7789py_mpy/7265925bd0c092e8105200d18b2dba9dfbc12c27/docs/_static/css/fonts/lato-bold-italic.woff -------------------------------------------------------------------------------- /docs/_static/css/fonts/lato-bold-italic.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/russhughes/st7789py_mpy/7265925bd0c092e8105200d18b2dba9dfbc12c27/docs/_static/css/fonts/lato-bold-italic.woff2 -------------------------------------------------------------------------------- /docs/_static/css/fonts/lato-bold.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/russhughes/st7789py_mpy/7265925bd0c092e8105200d18b2dba9dfbc12c27/docs/_static/css/fonts/lato-bold.woff -------------------------------------------------------------------------------- /docs/_static/css/fonts/lato-bold.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/russhughes/st7789py_mpy/7265925bd0c092e8105200d18b2dba9dfbc12c27/docs/_static/css/fonts/lato-bold.woff2 -------------------------------------------------------------------------------- /docs/_static/css/fonts/lato-normal-italic.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/russhughes/st7789py_mpy/7265925bd0c092e8105200d18b2dba9dfbc12c27/docs/_static/css/fonts/lato-normal-italic.woff -------------------------------------------------------------------------------- /docs/_static/css/fonts/lato-normal-italic.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/russhughes/st7789py_mpy/7265925bd0c092e8105200d18b2dba9dfbc12c27/docs/_static/css/fonts/lato-normal-italic.woff2 -------------------------------------------------------------------------------- /docs/_static/css/fonts/lato-normal.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/russhughes/st7789py_mpy/7265925bd0c092e8105200d18b2dba9dfbc12c27/docs/_static/css/fonts/lato-normal.woff -------------------------------------------------------------------------------- /docs/_static/css/fonts/lato-normal.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/russhughes/st7789py_mpy/7265925bd0c092e8105200d18b2dba9dfbc12c27/docs/_static/css/fonts/lato-normal.woff2 -------------------------------------------------------------------------------- /docs/_static/documentation_options.js: -------------------------------------------------------------------------------- 1 | const DOCUMENTATION_OPTIONS = { 2 | VERSION: '0.1.0', 3 | LANGUAGE: 'en', 4 | COLLAPSE_INDEX: false, 5 | BUILDER: 'html', 6 | FILE_SUFFIX: '.html', 7 | LINK_SUFFIX: '.html', 8 | HAS_SOURCE: true, 9 | SOURCELINK_SUFFIX: '.txt', 10 | NAVIGATION_WITH_KEYS: false, 11 | SHOW_SEARCH_SUMMARY: true, 12 | ENABLE_SEARCH_SHORTCUTS: true, 13 | }; -------------------------------------------------------------------------------- /docs/_static/feathers.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/russhughes/st7789py_mpy/7265925bd0c092e8105200d18b2dba9dfbc12c27/docs/_static/feathers.jpg -------------------------------------------------------------------------------- /docs/_static/file.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/russhughes/st7789py_mpy/7265925bd0c092e8105200d18b2dba9dfbc12c27/docs/_static/file.png -------------------------------------------------------------------------------- /docs/_static/fonts.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/russhughes/st7789py_mpy/7265925bd0c092e8105200d18b2dba9dfbc12c27/docs/_static/fonts.jpg -------------------------------------------------------------------------------- /docs/_static/hello.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/russhughes/st7789py_mpy/7265925bd0c092e8105200d18b2dba9dfbc12c27/docs/_static/hello.jpg -------------------------------------------------------------------------------- /docs/_static/js/badge_only.js: -------------------------------------------------------------------------------- 1 | !function(e){var t={};function r(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)r.d(n,o,function(t){return e[t]}.bind(null,o));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=4)}({4:function(e,t,r){}}); -------------------------------------------------------------------------------- /docs/_static/js/html5shiv-printshiv.min.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @preserve HTML5 Shiv 3.7.3-pre | @afarkas @jdalton @jon_neal @rem | MIT/GPL2 Licensed 3 | */ 4 | !function(a,b){function c(a,b){var c=a.createElement("p"),d=a.getElementsByTagName("head")[0]||a.documentElement;return c.innerHTML="x",d.insertBefore(c.lastChild,d.firstChild)}function d(){var a=y.elements;return"string"==typeof a?a.split(" "):a}function e(a,b){var c=y.elements;"string"!=typeof c&&(c=c.join(" ")),"string"!=typeof a&&(a=a.join(" ")),y.elements=c+" "+a,j(b)}function f(a){var b=x[a[v]];return b||(b={},w++,a[v]=w,x[w]=b),b}function g(a,c,d){if(c||(c=b),q)return c.createElement(a);d||(d=f(c));var e;return e=d.cache[a]?d.cache[a].cloneNode():u.test(a)?(d.cache[a]=d.createElem(a)).cloneNode():d.createElem(a),!e.canHaveChildren||t.test(a)||e.tagUrn?e:d.frag.appendChild(e)}function h(a,c){if(a||(a=b),q)return a.createDocumentFragment();c=c||f(a);for(var e=c.frag.cloneNode(),g=0,h=d(),i=h.length;i>g;g++)e.createElement(h[g]);return e}function i(a,b){b.cache||(b.cache={},b.createElem=a.createElement,b.createFrag=a.createDocumentFragment,b.frag=b.createFrag()),a.createElement=function(c){return y.shivMethods?g(c,a,b):b.createElem(c)},a.createDocumentFragment=Function("h,f","return function(){var n=f.cloneNode(),c=n.createElement;h.shivMethods&&("+d().join().replace(/[\w\-:]+/g,function(a){return b.createElem(a),b.frag.createElement(a),'c("'+a+'")'})+");return n}")(y,b.frag)}function j(a){a||(a=b);var d=f(a);return!y.shivCSS||p||d.hasCSS||(d.hasCSS=!!c(a,"article,aside,dialog,figcaption,figure,footer,header,hgroup,main,nav,section{display:block}mark{background:#FF0;color:#000}template{display:none}")),q||i(a,d),a}function k(a){for(var b,c=a.getElementsByTagName("*"),e=c.length,f=RegExp("^(?:"+d().join("|")+")$","i"),g=[];e--;)b=c[e],f.test(b.nodeName)&&g.push(b.applyElement(l(b)));return g}function l(a){for(var b,c=a.attributes,d=c.length,e=a.ownerDocument.createElement(A+":"+a.nodeName);d--;)b=c[d],b.specified&&e.setAttribute(b.nodeName,b.nodeValue);return e.style.cssText=a.style.cssText,e}function m(a){for(var b,c=a.split("{"),e=c.length,f=RegExp("(^|[\\s,>+~])("+d().join("|")+")(?=[[\\s,>+~#.:]|$)","gi"),g="$1"+A+"\\:$2";e--;)b=c[e]=c[e].split("}"),b[b.length-1]=b[b.length-1].replace(f,g),c[e]=b.join("}");return c.join("{")}function n(a){for(var b=a.length;b--;)a[b].removeNode()}function o(a){function b(){clearTimeout(g._removeSheetTimer),d&&d.removeNode(!0),d=null}var d,e,g=f(a),h=a.namespaces,i=a.parentWindow;return!B||a.printShived?a:("undefined"==typeof h[A]&&h.add(A),i.attachEvent("onbeforeprint",function(){b();for(var f,g,h,i=a.styleSheets,j=[],l=i.length,n=Array(l);l--;)n[l]=i[l];for(;h=n.pop();)if(!h.disabled&&z.test(h.media)){try{f=h.imports,g=f.length}catch(o){g=0}for(l=0;g>l;l++)n.push(f[l]);try{j.push(h.cssText)}catch(o){}}j=m(j.reverse().join("")),e=k(a),d=c(a,j)}),i.attachEvent("onafterprint",function(){n(e),clearTimeout(g._removeSheetTimer),g._removeSheetTimer=setTimeout(b,500)}),a.printShived=!0,a)}var p,q,r="3.7.3",s=a.html5||{},t=/^<|^(?:button|map|select|textarea|object|iframe|option|optgroup)$/i,u=/^(?:a|b|code|div|fieldset|h1|h2|h3|h4|h5|h6|i|label|li|ol|p|q|span|strong|style|table|tbody|td|th|tr|ul)$/i,v="_html5shiv",w=0,x={};!function(){try{var a=b.createElement("a");a.innerHTML="",p="hidden"in a,q=1==a.childNodes.length||function(){b.createElement("a");var a=b.createDocumentFragment();return"undefined"==typeof a.cloneNode||"undefined"==typeof a.createDocumentFragment||"undefined"==typeof a.createElement}()}catch(c){p=!0,q=!0}}();var y={elements:s.elements||"abbr article aside audio bdi canvas data datalist details dialog figcaption figure footer header hgroup main mark meter nav output picture progress section summary template time video",version:r,shivCSS:s.shivCSS!==!1,supportsUnknownElements:q,shivMethods:s.shivMethods!==!1,type:"default",shivDocument:j,createElement:g,createDocumentFragment:h,addElements:e};a.html5=y,j(b);var z=/^$|\b(?:all|print)\b/,A="html5shiv",B=!q&&function(){var c=b.documentElement;return!("undefined"==typeof b.namespaces||"undefined"==typeof b.parentWindow||"undefined"==typeof c.applyElement||"undefined"==typeof c.removeNode||"undefined"==typeof a.attachEvent)}();y.type+=" print",y.shivPrint=o,o(b),"object"==typeof module&&module.exports&&(module.exports=y)}("undefined"!=typeof window?window:this,document); -------------------------------------------------------------------------------- /docs/_static/js/html5shiv.min.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @preserve HTML5 Shiv 3.7.3 | @afarkas @jdalton @jon_neal @rem | MIT/GPL2 Licensed 3 | */ 4 | !function(a,b){function c(a,b){var c=a.createElement("p"),d=a.getElementsByTagName("head")[0]||a.documentElement;return c.innerHTML="x",d.insertBefore(c.lastChild,d.firstChild)}function d(){var a=t.elements;return"string"==typeof a?a.split(" "):a}function e(a,b){var c=t.elements;"string"!=typeof c&&(c=c.join(" ")),"string"!=typeof a&&(a=a.join(" ")),t.elements=c+" "+a,j(b)}function f(a){var b=s[a[q]];return b||(b={},r++,a[q]=r,s[r]=b),b}function g(a,c,d){if(c||(c=b),l)return c.createElement(a);d||(d=f(c));var e;return e=d.cache[a]?d.cache[a].cloneNode():p.test(a)?(d.cache[a]=d.createElem(a)).cloneNode():d.createElem(a),!e.canHaveChildren||o.test(a)||e.tagUrn?e:d.frag.appendChild(e)}function h(a,c){if(a||(a=b),l)return a.createDocumentFragment();c=c||f(a);for(var e=c.frag.cloneNode(),g=0,h=d(),i=h.length;i>g;g++)e.createElement(h[g]);return e}function i(a,b){b.cache||(b.cache={},b.createElem=a.createElement,b.createFrag=a.createDocumentFragment,b.frag=b.createFrag()),a.createElement=function(c){return t.shivMethods?g(c,a,b):b.createElem(c)},a.createDocumentFragment=Function("h,f","return function(){var n=f.cloneNode(),c=n.createElement;h.shivMethods&&("+d().join().replace(/[\w\-:]+/g,function(a){return b.createElem(a),b.frag.createElement(a),'c("'+a+'")'})+");return n}")(t,b.frag)}function j(a){a||(a=b);var d=f(a);return!t.shivCSS||k||d.hasCSS||(d.hasCSS=!!c(a,"article,aside,dialog,figcaption,figure,footer,header,hgroup,main,nav,section{display:block}mark{background:#FF0;color:#000}template{display:none}")),l||i(a,d),a}var k,l,m="3.7.3-pre",n=a.html5||{},o=/^<|^(?:button|map|select|textarea|object|iframe|option|optgroup)$/i,p=/^(?:a|b|code|div|fieldset|h1|h2|h3|h4|h5|h6|i|label|li|ol|p|q|span|strong|style|table|tbody|td|th|tr|ul)$/i,q="_html5shiv",r=0,s={};!function(){try{var a=b.createElement("a");a.innerHTML="",k="hidden"in a,l=1==a.childNodes.length||function(){b.createElement("a");var a=b.createDocumentFragment();return"undefined"==typeof a.cloneNode||"undefined"==typeof a.createDocumentFragment||"undefined"==typeof a.createElement}()}catch(c){k=!0,l=!0}}();var t={elements:n.elements||"abbr article aside audio bdi canvas data datalist details dialog figcaption figure footer header hgroup main mark meter nav output picture progress section summary template time video",version:m,shivCSS:n.shivCSS!==!1,supportsUnknownElements:l,shivMethods:n.shivMethods!==!1,type:"default",shivDocument:j,createElement:g,createDocumentFragment:h,addElements:e};a.html5=t,j(b),"object"==typeof module&&module.exports&&(module.exports=t)}("undefined"!=typeof window?window:this,document); -------------------------------------------------------------------------------- /docs/_static/minus.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/russhughes/st7789py_mpy/7265925bd0c092e8105200d18b2dba9dfbc12c27/docs/_static/minus.png -------------------------------------------------------------------------------- /docs/_static/noto_fonts.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/russhughes/st7789py_mpy/7265925bd0c092e8105200d18b2dba9dfbc12c27/docs/_static/noto_fonts.jpg -------------------------------------------------------------------------------- /docs/_static/plus.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/russhughes/st7789py_mpy/7265925bd0c092e8105200d18b2dba9dfbc12c27/docs/_static/plus.png -------------------------------------------------------------------------------- /docs/_static/proverbs.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/russhughes/st7789py_mpy/7265925bd0c092e8105200d18b2dba9dfbc12c27/docs/_static/proverbs.jpg -------------------------------------------------------------------------------- /docs/_static/roids.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/russhughes/st7789py_mpy/7265925bd0c092e8105200d18b2dba9dfbc12c27/docs/_static/roids.jpg -------------------------------------------------------------------------------- /docs/_static/rotation.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/russhughes/st7789py_mpy/7265925bd0c092e8105200d18b2dba9dfbc12c27/docs/_static/rotation.jpg -------------------------------------------------------------------------------- /docs/_static/rotations.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/russhughes/st7789py_mpy/7265925bd0c092e8105200d18b2dba9dfbc12c27/docs/_static/rotations.jpg -------------------------------------------------------------------------------- /docs/_static/scroll.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/russhughes/st7789py_mpy/7265925bd0c092e8105200d18b2dba9dfbc12c27/docs/_static/scroll.jpg -------------------------------------------------------------------------------- /docs/_static/tiny_hello.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/russhughes/st7789py_mpy/7265925bd0c092e8105200d18b2dba9dfbc12c27/docs/_static/tiny_hello.jpg -------------------------------------------------------------------------------- /docs/_static/tiny_toasters.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/russhughes/st7789py_mpy/7265925bd0c092e8105200d18b2dba9dfbc12c27/docs/_static/tiny_toasters.jpg -------------------------------------------------------------------------------- /docs/_static/vga1_16x16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/russhughes/st7789py_mpy/7265925bd0c092e8105200d18b2dba9dfbc12c27/docs/_static/vga1_16x16.png -------------------------------------------------------------------------------- /docs/_static/vga1_16x32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/russhughes/st7789py_mpy/7265925bd0c092e8105200d18b2dba9dfbc12c27/docs/_static/vga1_16x32.png -------------------------------------------------------------------------------- /docs/_static/vga1_8x16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/russhughes/st7789py_mpy/7265925bd0c092e8105200d18b2dba9dfbc12c27/docs/_static/vga1_8x16.png -------------------------------------------------------------------------------- /docs/_static/vga1_8x8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/russhughes/st7789py_mpy/7265925bd0c092e8105200d18b2dba9dfbc12c27/docs/_static/vga1_8x8.png -------------------------------------------------------------------------------- /docs/_static/vga1_bold_16x16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/russhughes/st7789py_mpy/7265925bd0c092e8105200d18b2dba9dfbc12c27/docs/_static/vga1_bold_16x16.png -------------------------------------------------------------------------------- /docs/_static/vga1_bold_16x32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/russhughes/st7789py_mpy/7265925bd0c092e8105200d18b2dba9dfbc12c27/docs/_static/vga1_bold_16x32.png -------------------------------------------------------------------------------- /docs/_static/vga2_16x16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/russhughes/st7789py_mpy/7265925bd0c092e8105200d18b2dba9dfbc12c27/docs/_static/vga2_16x16.png -------------------------------------------------------------------------------- /docs/_static/vga2_16x32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/russhughes/st7789py_mpy/7265925bd0c092e8105200d18b2dba9dfbc12c27/docs/_static/vga2_16x32.png -------------------------------------------------------------------------------- /docs/_static/vga2_8x16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/russhughes/st7789py_mpy/7265925bd0c092e8105200d18b2dba9dfbc12c27/docs/_static/vga2_8x16.png -------------------------------------------------------------------------------- /docs/_static/vga2_8x8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/russhughes/st7789py_mpy/7265925bd0c092e8105200d18b2dba9dfbc12c27/docs/_static/vga2_8x8.png -------------------------------------------------------------------------------- /docs/_static/vga2_bold_16x16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/russhughes/st7789py_mpy/7265925bd0c092e8105200d18b2dba9dfbc12c27/docs/_static/vga2_bold_16x16.png -------------------------------------------------------------------------------- /docs/_static/vga2_bold_16x32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/russhughes/st7789py_mpy/7265925bd0c092e8105200d18b2dba9dfbc12c27/docs/_static/vga2_bold_16x32.png -------------------------------------------------------------------------------- /docs/objects.inv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/russhughes/st7789py_mpy/7265925bd0c092e8105200d18b2dba9dfbc12c27/docs/objects.inv -------------------------------------------------------------------------------- /examples/alien/alien.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/russhughes/st7789py_mpy/7265925bd0c092e8105200d18b2dba9dfbc12c27/examples/alien/alien.png -------------------------------------------------------------------------------- /examples/alien/alien.py: -------------------------------------------------------------------------------- 1 | """ 2 | alien.py 3 | ========= 4 | 5 | .. figure:: ../_static/alien.jpg 6 | :align: center 7 | 8 | Bounce a bitmap of an alien around the display. 9 | 10 | The alien_bitmap module was created using the :ref:`image_converter.py` utility. 11 | 12 | .. literalinclude:: ../../../examples/alien/make_alien_bitmap.sh 13 | 14 | .. note:: This example requires the following modules: 15 | 16 | .. hlist:: 17 | :columns: 3 18 | 19 | - `st7789py` 20 | - `tft_config` 21 | - `alien_bitmap` 22 | 23 | The alien.png PNG file is from the Erik Flowers Weather Icons available from 24 | https://github.com/erikflowers/weather-icons and is licensed under SIL OFL 1.1 25 | (http://scripts.sil.org/OFL). 26 | 27 | """ 28 | 29 | import time 30 | import st7789py as st7789 31 | import tft_config 32 | import alien_bitmap as alien 33 | 34 | SPEED_X = 3 35 | SPEED_Y = 2 36 | TICKS = 100 37 | 38 | 39 | def main(): 40 | """ 41 | Runs the main loop for the bounce animation. 42 | """ 43 | 44 | tft = tft_config.config(tft_config.WIDE) 45 | width, height = tft.width, tft.height 46 | col, row = width // 2 - alien.WIDTH // 2, height // 2 - alien.HEIGHT // 2 47 | xd, yd = SPEED_X, SPEED_Y 48 | last_col, old_row = col, row 49 | 50 | while True: 51 | last = time.ticks_ms() 52 | tft.fill_rect(last_col, old_row, alien.WIDTH, alien.HEIGHT, 0) 53 | tft.bitmap(alien, col, row) 54 | last_col, old_row = col, row 55 | col, row = col + xd, row + yd 56 | xd = -xd if col <= 0 or col >= width - alien.WIDTH else xd 57 | yd = -yd if row <= 0 or row >= height - alien.HEIGHT else yd 58 | 59 | if time.ticks_ms() - last < TICKS: 60 | time.sleep_ms(TICKS - (time.ticks_ms() - last)) 61 | 62 | 63 | main() 64 | -------------------------------------------------------------------------------- /examples/alien/alien_bitmap.py: -------------------------------------------------------------------------------- 1 | HEIGHT = 30 2 | WIDTH = 30 3 | COLORS = 2 4 | BITS = 1800 5 | BPP = 2 6 | PALETTE = [0xfff8,0x0000] 7 | _bitmap =\ 8 | b'\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55'\ 9 | b'\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55'\ 10 | b'\x55\x55\x55\x55\x55\x55\x55\x55\x54\x01\x55\x55\x55\x55\x55\x54'\ 11 | b'\x15\x41\x55\x55\x55\x55\x55\x15\x55\x45\x55\x55\x55\x55\x45\x55'\ 12 | b'\x55\x15\x55\x55\x55\x51\x55\x55\x54\x55\x55\x55\x54\x55\x55\x55'\ 13 | b'\x51\x55\x55\x55\x45\x55\x55\x55\x15\x55\x55\x54\x55\x55\x55\x51'\ 14 | b'\x55\x55\x55\x44\x55\x55\x51\x15\x55\x55\x54\x40\x55\x50\x11\x55'\ 15 | b'\x55\x55\x45\x01\x54\x05\x15\x55\x55\x54\x54\x05\x01\x51\x55\x55'\ 16 | b'\x55\x51\x50\x50\x54\x55\x55\x55\x55\x45\x55\x55\x15\x55\x55\x55'\ 17 | b'\x55\x15\x55\x45\x55\x55\x55\x55\x54\x55\x51\x55\x55\x55\x55\x55'\ 18 | b'\x51\x54\x55\x55\x55\x55\x55\x55\x45\x15\x55\x55\x55\x55\x55\x55'\ 19 | b'\x05\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55'\ 20 | b'\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55'\ 21 | b'\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55'\ 22 | b'\x55' 23 | BITMAP = memoryview(_bitmap) 24 | -------------------------------------------------------------------------------- /examples/alien/make_alien_bitmap.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | ../../utils/image_converter.py alien.png 1 >alien_bitmap.py 4 | 5 | # mpy-cross alien_bitmap.py 6 | # mpremote cp alien_bitmap.mpy : 7 | # mpremote run alien.py 8 | -------------------------------------------------------------------------------- /examples/boxlines.py: -------------------------------------------------------------------------------- 1 | """ 2 | boxlines.py 3 | =========== 4 | 5 | .. figure:: ../_static/boxlines.jpg 6 | :align: center 7 | 8 | Test for lines and rectangles. 9 | 10 | Draws lines and rectangles in random colors at random locations on the display. 11 | 12 | .. note:: This example requires the following modules: 13 | 14 | .. hlist:: 15 | :columns: 3 16 | 17 | - `st7789py` 18 | - `tft_config` 19 | 20 | """ 21 | 22 | import random 23 | import tft_config 24 | import st7789py as st7789 25 | 26 | 27 | def main(): 28 | """ main """ 29 | tft = tft_config.config(tft_config.WIDE) 30 | 31 | while True: 32 | color = st7789.color565( 33 | random.getrandbits(8), random.getrandbits(8), random.getrandbits(8) 34 | ) 35 | 36 | tft.line( 37 | random.randint(0, tft.width), 38 | random.randint(0, tft.height), 39 | random.randint(0, tft.width), 40 | random.randint(0, tft.height), 41 | color, 42 | ) 43 | 44 | width = random.randint(0, tft.width // 2) 45 | height = random.randint(0, tft.height // 2) 46 | col = random.randint(0, tft.width - width) 47 | row = random.randint(0, tft.height - height) 48 | tft.fill_rect( 49 | col, 50 | row, 51 | width, 52 | height, 53 | st7789.color565( 54 | random.getrandbits(8), random.getrandbits(8), random.getrandbits(8) 55 | ), 56 | ) 57 | 58 | 59 | main() 60 | -------------------------------------------------------------------------------- /examples/chango/chango.py: -------------------------------------------------------------------------------- 1 | """ 2 | chango.py 3 | ========= 4 | 5 | .. figure:: ../_static/chango.jpg 6 | :align: center 7 | 8 | Test for TrueType write_font_converter. 9 | 10 | See the :ref:`write_font_converter.py` program in the utils directory. 11 | 12 | .. note:: This example requires the following modules: 13 | 14 | .. hlist:: 15 | :columns: 3 16 | 17 | - `st7789py` 18 | - `tft_config` 19 | - `chango_16` 20 | - `chango_32` 21 | - `chango_64` 22 | 23 | """ 24 | 25 | import gc 26 | import chango_16 as font_16 27 | import chango_32 as font_32 28 | import chango_64 as font_64 29 | import tft_config 30 | import st7789py as st7789 31 | 32 | gc.collect() 33 | 34 | 35 | def main(): 36 | """ main """ 37 | # enable display and clear screen 38 | tft = tft_config.config(tft_config.WIDE) 39 | 40 | row = 0 41 | tft.write(font_16, "abcdefghijklmnopqrst", 0, row, st7789.RED) 42 | row += font_16.HEIGHT 43 | 44 | tft.write(font_32, "abcdefghij", 0, row, st7789.GREEN) 45 | row += font_32.HEIGHT 46 | 47 | tft.write(font_64, "abcd", 0, row, st7789.BLUE) 48 | row += font_64.HEIGHT 49 | 50 | 51 | main() 52 | -------------------------------------------------------------------------------- /examples/color_test.py: -------------------------------------------------------------------------------- 1 | """ 2 | color_test.py 3 | ============= 4 | 5 | .. figure:: ../_static/color_test.jpg 6 | :align: center 7 | 8 | Test color with gradients. 9 | 10 | Draws Red, Green and Blues gradients on the display and writes the color name centered in the 11 | gradient. Then repeatedly draws a borders around the display in the same colors. 12 | 13 | .. note:: This example requires the following modules: 14 | 15 | .. hlist:: 16 | :columns: 3 17 | 18 | - `st7789py` 19 | - `tft_config` 20 | - `vga2_bold_16x32` 21 | 22 | """ 23 | 24 | import random 25 | from machine import Pin, SoftSPI 26 | from time import sleep 27 | import st7789py as st7789 28 | import tft_config 29 | import vga2_bold_16x32 as font 30 | 31 | 32 | def interpolate(value1, value2, position, total_range): 33 | """ 34 | Perform linear interpolation between two values based on a position within a range. 35 | 36 | Args: 37 | value1 (float): Starting value. 38 | value2 (float): Ending value. 39 | position (float): Current position within the range. 40 | total_range (float): Total range of positions. 41 | 42 | Returns: 43 | float: Interpolated value. 44 | """ 45 | return value1 + (value2 - value1) * position / total_range 46 | 47 | 48 | def main(): 49 | tft = tft_config.config(tft_config.WIDE) 50 | 51 | names = ["Red", "Green", "Blue"] 52 | 53 | color_values = (255, 255, 255) 54 | height_division = tft.height // len(color_values) 55 | for i, color_value in enumerate(color_values): 56 | start_row = i * height_division 57 | end_row = (i + 1) * height_division 58 | for row in range(start_row, end_row): 59 | rgb_color = [0 if idx != i else int(interpolate(0, color_value, row - start_row, height_division)) for idx in range(3)] 60 | color = st7789.color565(rgb_color) 61 | tft.hline(0, row, tft.width, color) 62 | 63 | name = names[i] 64 | text_x = (tft.width - font.WIDTH * len(name)) // 2 65 | text_y = start_row + (end_row - start_row - font.HEIGHT) // 2 66 | tft.text(font, name, text_x, text_y, st7789.WHITE, color) 67 | 68 | while True: 69 | for color in [st7789.RED, st7789.GREEN, st7789.BLUE]: 70 | for x in range(tft.width): 71 | tft.pixel(x, 0, color) 72 | tft.pixel(x, tft.height - 1, color) 73 | 74 | for y in range(tft.height): 75 | tft.pixel(0 , y, color) 76 | tft.pixel(tft.width - 1, y, color) 77 | 78 | sleep(1) 79 | main() 80 | -------------------------------------------------------------------------------- /examples/colorbars/colorbars.py: -------------------------------------------------------------------------------- 1 | """ 2 | .. _colorbars.py: 3 | 4 | colorbars.py 5 | ============= 6 | 7 | .. figure:: ../_static/colorbars.jpg 8 | :align: center 9 | 10 | Test bitmap colors. 11 | 12 | Displays WHITE, YELLOW, CYAN, GREEN, MAGENTA, RED, and BLUE color bar bitmap named 13 | colorbars_{WIDTH}x(HEIGHT) on the display. Custom sized bitmap modules can be created 14 | using the :ref:`make_colorbars_bitmap.py` utility. 15 | 16 | .. note:: This example requires the following modules: 17 | 18 | .. hlist:: 19 | :columns: 3 20 | 21 | - `st7789py` 22 | - `tft_config` 23 | - `colorbars_{WIDTH}x{HEIGHT}` 24 | 25 | """ 26 | 27 | import st7789py as st7789 28 | import tft_config 29 | 30 | tft = tft_config.config(tft_config.WIDE) 31 | mod_name = f"colorbars_{tft.width}x{tft.height}" 32 | colorbars = __import__(mod_name) 33 | tft.pbitmap(colorbars, 0, 0) 34 | -------------------------------------------------------------------------------- /examples/feathers.py: -------------------------------------------------------------------------------- 1 | """ 2 | feathers.py 3 | =========== 4 | 5 | .. figure:: ../_static/feathers.jpg 6 | :align: center 7 | 8 | Test hardware scrolling. 9 | 10 | Smoothly scrolls mirrored rainbow colored random curves across the display. 11 | 12 | .. note:: This example requires the following modules: 13 | 14 | .. hlist:: 15 | :columns: 3 16 | 17 | - `st7789py` 18 | - `tft_config` 19 | 20 | """ 21 | 22 | import random 23 | import math 24 | import time 25 | import st7789py as st7789 26 | import tft_config 27 | 28 | 29 | def between(left, right, along): 30 | """returns a point along the curve from left to right""" 31 | dist = (1 - math.cos(along * math.pi)) / 2 32 | return left * (1 - dist) + right * dist 33 | 34 | 35 | def color_wheel(position): 36 | """returns a 565 color from the given position of the color wheel""" 37 | position = (255 - position) % 255 38 | 39 | if position < 85: 40 | return st7789.color565(255 - position * 3, 0, position * 3) 41 | 42 | if position < 170: 43 | position -= 85 44 | return st7789.color565(0, position * 3, 255 - position * 3) 45 | 46 | position -= 170 47 | return st7789.color565(position * 3, 255 - position * 3, 0) 48 | 49 | 50 | def main(): 51 | ''' 52 | The big show! 53 | ''' 54 | #enable display and clear screen 55 | 56 | tft = tft_config.config(tft_config.FEATHERS) 57 | 58 | height = tft.height # height of display in pixels 59 | width = tft.width # width if display in pixels 60 | 61 | tfa = tft_config.TFA # top free area when scrolling 62 | bfa = tft_config.BFA # bottom free area when scrolling 63 | 64 | scroll = 0 # scroll position 65 | wheel = 0 # color wheel position 66 | 67 | tft.vscrdef(tfa, width, bfa) # set scroll area 68 | tft.vscsad(scroll + tfa) # set scroll position 69 | tft.fill(st7789.BLACK) # clear screen 70 | 71 | half = (height >> 1) - 1 # half the height of the dislay 72 | interval = 0 # steps between new points 73 | increment = 0 # increment per step 74 | counter = 1 # step counter, overflow to start 75 | current_y = 0 # current_y value (right point) 76 | last_y = 0 # last_y value (left point) 77 | 78 | # segment offsets 79 | x_offsets = [x * (width // 8) -1 for x in range(2,9)] 80 | 81 | while True: 82 | # when the counter exceeds the interval, save current_y to last_y, 83 | # choose a new random value for current_y between 0 and 1/2 the 84 | # height of the display, choose a new random interval then reset 85 | # the counter to 0 86 | 87 | if counter > interval: 88 | last_y = current_y 89 | current_y = random.randint(0, half) 90 | counter = 0 91 | interval = random.randint(10, 100) 92 | increment = 1/interval # increment per step 93 | 94 | # clear the first column of the display and scroll it 95 | tft.vline(scroll, 0, height, st7789.BLACK) 96 | tft.vscsad(scroll + tfa) 97 | 98 | # get the next point between last_y and current_y 99 | tween = int(between(last_y, current_y, counter * increment)) 100 | 101 | # draw mirrored pixels across the display at the offsets using the color_wheel effect 102 | for i, x_offset in enumerate(x_offsets): 103 | tft.pixel((scroll + x_offset) % width, half + tween, color_wheel(wheel+(i<<2))) 104 | tft.pixel((scroll + x_offset) % width, half - tween, color_wheel(wheel+(i<<2))) 105 | 106 | # increment scroll, counter, and wheel 107 | scroll = (scroll + 1) % width 108 | wheel = (wheel + 1) % 256 109 | counter += 1 110 | 111 | 112 | main() 113 | -------------------------------------------------------------------------------- /examples/fonts.py: -------------------------------------------------------------------------------- 1 | """ 2 | fonts.py 3 | ======== 4 | 5 | .. figure:: ../_static/fonts.jpg 6 | :align: center 7 | 8 | Test text_font_converter.py 9 | 10 | Pages through all characters of four fonts on the Display. 11 | https://www.youtube.com/watch?v=2cnAhEucPD4 12 | 13 | .. note:: This example requires the following modules: 14 | 15 | .. hlist:: 16 | :columns: 3 17 | 18 | - `st7789py` 19 | - `tft_config` 20 | - `vga2_8x8` 21 | - `vga2_8x16` 22 | - `vga2_bold_16x16` 23 | - `vga2_bold_16x32` 24 | 25 | """ 26 | 27 | import utime 28 | import st7789py as st7789 29 | import tft_config 30 | import vga2_8x8 as font1 31 | import vga2_8x16 as font2 32 | import vga2_bold_16x16 as font3 33 | import vga2_bold_16x32 as font4 34 | 35 | 36 | def main(): 37 | tft = tft_config.config(tft_config.WIDE) 38 | tft.vscrdef(40, 240, 40) 39 | 40 | while True: 41 | for font in (font1, font2, font3, font4): 42 | tft.fill(st7789.BLUE) 43 | line = 0 44 | col = 0 45 | 46 | for char in range(font.FIRST, font.LAST): 47 | tft.text(font, chr(char), col, line, st7789.WHITE, st7789.BLUE) 48 | col += font.WIDTH 49 | if col > tft.width - font.WIDTH: 50 | col = 0 51 | line += font.HEIGHT 52 | 53 | if line > tft.height-font.HEIGHT: 54 | utime.sleep(3) 55 | tft.fill(st7789.BLUE) 56 | line = 0 57 | col = 0 58 | 59 | utime.sleep(3) 60 | 61 | 62 | main() 63 | -------------------------------------------------------------------------------- /examples/hello.py: -------------------------------------------------------------------------------- 1 | """ 2 | hello.py 3 | ======== 4 | 5 | .. figure:: ../_static/hello.jpg 6 | :align: center 7 | 8 | Test for text_font_converter. 9 | 10 | Writes "Hello!" in random colors at random locations on the Display. 11 | https://www.youtube.com/watch?v=atBa0BYPAAc 12 | 13 | .. note:: This example requires the following modules: 14 | 15 | .. hlist:: 16 | :columns: 3 17 | 18 | - `st7789py` 19 | - `tft_config` 20 | - `vga2_bold_16x32` 21 | 22 | """ 23 | 24 | import random 25 | import st7789py as st7789 26 | import tft_config 27 | import vga2_bold_16x32 as font 28 | 29 | 30 | def main(): 31 | """ 32 | The big show! 33 | """ 34 | tft = tft_config.config(tft_config.WIDE) 35 | 36 | while True: 37 | for rotation in range(4): 38 | tft.rotation(rotation) 39 | tft.fill(0) 40 | col_max = tft.width - font.WIDTH * 5 41 | row_max = tft.height - font.HEIGHT 42 | if col_max < 0 or row_max < 0: 43 | raise RuntimeError( 44 | "This font is too big to display on this screen." 45 | ) 46 | 47 | for _ in range(100): 48 | tft.text( 49 | font, 50 | "Hello", 51 | random.randint(0, col_max), 52 | random.randint(0, row_max), 53 | st7789.color565( 54 | random.getrandbits(8), 55 | random.getrandbits(8), 56 | random.getrandbits(8), 57 | ), 58 | st7789.color565( 59 | random.getrandbits(8), 60 | random.getrandbits(8), 61 | random.getrandbits(8), 62 | ), 63 | ) 64 | 65 | 66 | main() 67 | -------------------------------------------------------------------------------- /examples/noto_fonts/noto_fonts.py: -------------------------------------------------------------------------------- 1 | """ 2 | noto_fonts.py 3 | ============= 4 | 5 | .. figure:: ../_static/noto_fonts.jpg 6 | :align: center 7 | 8 | Test for TrueType write_font_converter. 9 | 10 | Writes the names of three Noto fonts centered on the display using the font. 11 | The fonts were converted from True Type fonts using the 12 | :ref:`write_font_converter.py` utility. 13 | 14 | .. note:: This example requires the following modules: 15 | 16 | .. hlist:: 17 | :columns: 3 18 | 19 | - `st7789py` 20 | - `tft_config` 21 | - `NotoSans_32` 22 | - `NotoSerif_32` 23 | - `NotoSansMono_32` 24 | 25 | """ 26 | 27 | import tft_config 28 | import st7789py as st7789 29 | import NotoSans_32 as noto_sans 30 | import NotoSerif_32 as noto_serif 31 | import NotoSansMono_32 as noto_mono 32 | 33 | 34 | def main(): 35 | """ main """ 36 | 37 | def center(font, string, row, color=st7789.WHITE): 38 | """ 39 | Centers the given string horizontally on the screen at the specified row. 40 | 41 | Args: 42 | font: The font to use for rendering the string. 43 | string: The string to be centered. 44 | row: The row where the string will be displayed. 45 | color: The color of the string (default: st7789.WHITE). 46 | 47 | Returns: 48 | None 49 | """ 50 | 51 | screen = tft.width # get screen width 52 | width = tft.write_width(font, string) # get the width of the string 53 | col = tft.width // 2 - width // 2 if width and width < screen else 0 54 | tft.write(font, string, col, row, color) # and write the string 55 | 56 | # initialize the display 57 | tft = tft_config.config(tft_config.WIDE) 58 | row = 16 59 | 60 | # center the name of the first font, using the font 61 | center(noto_sans, "NotoSans", row, st7789.RED) 62 | row += noto_sans.HEIGHT 63 | 64 | # center the name of the second font, using the font 65 | center(noto_serif, "NotoSerif", row, st7789.GREEN) 66 | row += noto_serif.HEIGHT 67 | 68 | # center the name of the third font, using the font 69 | center(noto_mono, "NotoSansMono", row, st7789.BLUE) 70 | row += noto_mono.HEIGHT 71 | 72 | 73 | main() 74 | -------------------------------------------------------------------------------- /examples/proverbs/NotoSansSC-Regular.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/russhughes/st7789py_mpy/7265925bd0c092e8105200d18b2dba9dfbc12c27/examples/proverbs/NotoSansSC-Regular.otf -------------------------------------------------------------------------------- /examples/proverbs/make_proverbs_fonts.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | ../../utils/write_font_converter.py \ 4 | -s "万事起头难。熟能生巧。冰冻三尺,非一日之寒。三个臭皮匠,胜过诸葛亮。今日事,今日毕。师父领进门,修行在个人。一口吃不成胖子。欲速则不达。百闻不如一见。不入虎穴,焉得虎子。" \ 5 | NotoSansSC-Regular.otf 20 >proverbs_20.py 6 | 7 | ../../utils/write_font_converter.py \ 8 | -s "万事起头难。熟能生巧。冰冻三尺,非一日之寒。三个臭皮匠,胜过诸葛亮。今日事,今日毕。师父领进门,修行在个人。一口吃不成胖子。欲速则不达。百闻不如一见。不入虎穴,焉得虎子。" \ 9 | NotoSansSC-Regular.otf 30 >proverbs_30.py 10 | -------------------------------------------------------------------------------- /examples/proverbs/proverbs.py: -------------------------------------------------------------------------------- 1 | """ 2 | proverbs.py 3 | =========== 4 | 5 | .. figure:: ../_static/proverbs.jpg 6 | :align: center 7 | 8 | Test for TrueType write_font_converter. 9 | 10 | Displays what I hope are chinese proverbs in simplified chinese to test UTF-8 font support. 11 | The fonts were converted from True Type fonts using the 12 | :ref:`write_font_converter.py` utility. 13 | 14 | .. literalinclude:: ../../../examples/proverbs/make_proverbs_fonts.sh 15 | 16 | 17 | .. note:: This example requires the following modules: 18 | 19 | .. hlist:: 20 | :columns: 3 21 | 22 | - `st7789py` 23 | - `tft_config` 24 | - `proverbs_20` 25 | - `proverbs_30` 26 | 27 | """ 28 | 29 | import utime 30 | import st7789py as st7789 31 | import tft_config 32 | import proverbs_20 as font20 33 | import proverbs_30 as font30 34 | 35 | 36 | tft = tft_config.config(tft_config.WIDE) 37 | 38 | 39 | def color_wheel(WheelPos): 40 | """returns a 565 color from the given position of the color wheel""" 41 | WheelPos = (255 - WheelPos) % 255 42 | 43 | if WheelPos < 85: 44 | return st7789.color565(255 - WheelPos * 3, 0, WheelPos * 3) 45 | 46 | if WheelPos < 170: 47 | WheelPos -= 85 48 | return st7789.color565(0, WheelPos * 3, 255 - WheelPos * 3) 49 | 50 | WheelPos -= 170 51 | return st7789.color565(WheelPos * 3, 255 - WheelPos * 3, 0) 52 | 53 | 54 | def main(): 55 | proverbs = [ 56 | "万事起头难", 57 | "熟能生巧", 58 | "冰冻三尺,非一日之寒", 59 | "三个臭皮匠,胜过诸葛亮", 60 | "今日事,今日毕", 61 | "师父领进门,修行在个人", 62 | "一口吃不成胖子", 63 | "欲速则不达", 64 | "百闻不如一见", 65 | "不入虎穴,焉得虎子", 66 | ] 67 | 68 | font = font20 if tft.width < 239 else font30 69 | line_height = font.HEIGHT + 8 70 | half_height = tft.height // 2 71 | half_width = tft.width // 2 72 | wheel = 0 73 | 74 | while True: 75 | for proverb in proverbs: 76 | proverb_lines = proverb.split(",") 77 | half_lines_height = len(proverb_lines) * line_height // 2 78 | 79 | tft.fill(st7789.BLACK) 80 | 81 | for count, proverb_line in enumerate(proverb_lines): 82 | half_length = tft.write_width(font, proverb_line) // 2 83 | 84 | tft.write( 85 | font, 86 | proverb_line, 87 | half_width - half_length, 88 | half_height - half_lines_height + count * line_height, 89 | color_wheel(wheel), 90 | ) 91 | 92 | wheel = (wheel + 5) % 256 93 | 94 | # pause to slow down scrolling 95 | utime.sleep(5) 96 | 97 | 98 | main() 99 | -------------------------------------------------------------------------------- /examples/rotations.py: -------------------------------------------------------------------------------- 1 | """ 2 | rotations.py 3 | ============ 4 | 5 | .. figure:: ../_static/rotations.jpg 6 | :align: center 7 | 8 | Test for rotations and colors. 9 | 10 | Rotates the display 0, 90, 180, and 270 degrees and displays the rotation 11 | number and the color of the display background. 12 | 13 | .. note:: This example requires the following modules: 14 | 15 | .. hlist:: 16 | :columns: 3 17 | 18 | - `st7789py` 19 | - `tft_config` 20 | - vga1_16x16 21 | 22 | """ 23 | 24 | import time 25 | import tft_config 26 | import st7789py as st7789 27 | import vga1_16x16 as font 28 | 29 | 30 | def center_on(display, using_font, text, y, fg, bg): 31 | """ 32 | Center the text on the display 33 | """ 34 | x = (display.width - len(text) * font.WIDTH) // 2 35 | display.text(using_font, text, x, y, fg, bg) 36 | 37 | def clear_screen(display, color): 38 | """ 39 | Clear the screen by drawing rectangles starting from the center of the display 40 | and working towards the edges. 41 | 42 | Args: 43 | display: The display object to clear. 44 | """ 45 | width = display.width 46 | height = display.height 47 | x_center = width // 2 48 | y_center = height // 2 49 | 50 | for i in range(min(x_center, y_center)): 51 | x = x_center - i 52 | y = y_center - i 53 | rect_width = 2 * i + 1 54 | rect_height = 2 * i + 1 55 | display.rect(x, y, rect_width, rect_height, color) 56 | 57 | def main(): 58 | """ 59 | The big show! 60 | """ 61 | # enable display and clear screen 62 | 63 | tft = tft_config.config(tft_config.WIDE) 64 | 65 | colors = ( 66 | ("Red", st7789.RED, st7789.WHITE), 67 | ("Green", st7789.GREEN, st7789.BLACK), 68 | ("Blue", st7789.BLUE, st7789.WHITE), 69 | ("Black", st7789.BLACK, st7789.WHITE), 70 | ("White", st7789.WHITE, st7789.BLACK), 71 | ("Yellow", st7789.YELLOW, st7789.BLACK), 72 | ("Cyan", st7789.CYAN, st7789.BLACK), 73 | ("Magenta", st7789.MAGENTA, st7789.BLACK), 74 | ) 75 | 76 | color_idx = 0 77 | while True: 78 | for rotation in range(4): 79 | tft.rotation(rotation) 80 | height = tft.height 81 | width = tft.width 82 | fg = colors[color_idx][2] 83 | bg = colors[color_idx][1] 84 | 85 | tft.fill(bg) 86 | 87 | tft.rect(0, 0, width, height, st7789.WHITE) 88 | center_on(tft, font, "Rotation", height // 3 - font.HEIGHT // 2, fg, bg) 89 | center_on(tft, font, str(rotation), height // 2 - font.HEIGHT // 2, fg, bg) 90 | center_on( 91 | tft, 92 | font, 93 | colors[color_idx][0], 94 | height // 3 * 2 - font.HEIGHT // 2, 95 | fg, 96 | bg, 97 | ) 98 | color_idx = (color_idx + 1) % len(colors) 99 | time.sleep(2) 100 | 101 | main() 102 | -------------------------------------------------------------------------------- /examples/run_all.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # 4 | # Runs all the examples for 5 seconds each 5 | # 6 | 7 | function runfor() { 8 | echo "Running for $1 $2" 9 | local duration=$1 10 | shift 11 | local command="$@" 12 | 13 | # Run the command in the background 14 | mpremote run $command & 15 | 16 | # Get the process ID of the command 17 | local pid=$! 18 | 19 | # Sleep for the specified duration 20 | sleep "$duration" 21 | 22 | # Terminate the command process 23 | kill "$pid" >/dev/null 2>&1 24 | 25 | } 26 | 27 | runfor 5 alien/alien.py 28 | runfor 5 feathers.py 29 | runfor 5 rotations.py 30 | runfor 5 scroll.py 31 | runfor 5 fonts.py 32 | runfor 5 hello.py 33 | runfor 5 color_test.py 34 | runfor 5 tiny_toasters/tiny_toasters.py 35 | runfor 5 boxlines.py 36 | runfor 5 proverbs/proverbs.py 37 | runfor 5 roids.py 38 | runfor 5 chango/chango.py 39 | runfor 5 noto_fonts/noto_fonts.py 40 | runfor 5 tiny_hello.py 41 | -------------------------------------------------------------------------------- /examples/scroll.py: -------------------------------------------------------------------------------- 1 | """ 2 | scroll.py 3 | ========= 4 | 5 | .. figure:: ../_static/scroll.jpg 6 | :align: center 7 | 8 | Test for hardware scrolling. 9 | 10 | Smoothly scrolls all font characters up the screen. 11 | Only works with fonts with heights that are even multiples of the screen height, 12 | (i.e. 8 or 16 pixels high) 13 | 14 | .. note:: This example requires the following modules: 15 | 16 | .. hlist:: 17 | :columns: 3 18 | 19 | - `st7789py` 20 | - `tft_config` 21 | - `vga2_bold_16x16` 22 | 23 | """ 24 | 25 | import utime 26 | import random 27 | import st7789py as st7789 28 | import tft_config 29 | import vga2_bold_16x16 as font 30 | 31 | 32 | def main(): 33 | """ main """ 34 | tft = tft_config.config(tft_config.SCROLL) 35 | last_line = tft.height - font.HEIGHT 36 | tfa = tft_config.TFA # top free area when scrolling 37 | bfa = tft_config.BFA # bottom free area when scrolling 38 | tft.vscrdef(tfa, 240, bfa) 39 | 40 | tft.fill(st7789.BLUE) 41 | scroll = 0 42 | character = 0 43 | col = tft.width // 2 - 5 * font.WIDTH // 2 44 | 45 | while True: 46 | tft.fill_rect(0, scroll, tft.width, 1, st7789.BLUE) 47 | 48 | if scroll % font.HEIGHT == 0: 49 | tft.text( 50 | font, 51 | f'x{character:02x} {chr(character)}', 52 | col, 53 | (scroll + last_line) % tft.height, 54 | st7789.WHITE, 55 | st7789.BLUE) 56 | 57 | character = character + 1 if character < 256 else 0 58 | 59 | tft.vscsad(scroll + tfa) 60 | scroll += 1 61 | 62 | if scroll == tft.height: 63 | scroll = 0 64 | 65 | utime.sleep(0.01) 66 | 67 | 68 | main() 69 | -------------------------------------------------------------------------------- /examples/tiny_hello.py: -------------------------------------------------------------------------------- 1 | """ 2 | tiny_hello.py 3 | ============= 4 | 5 | .. figure:: ../_static/tiny_hello.jpg 6 | :align: center 7 | 8 | Test text_font_converter on small displays. 9 | 10 | Writes "Hello!" in a tiny font in random colors at random locations on the Display. 11 | 12 | .. note:: This example requires the following modules: 13 | 14 | .. hlist:: 15 | :columns: 3 16 | 17 | - `st7789py` 18 | - `tft_config` 19 | - `vga1_8x8` 20 | 21 | """ 22 | 23 | import random 24 | import time 25 | 26 | import st7789py as st7789 27 | import tft_config 28 | import vga1_8x8 as font 29 | 30 | tft = tft_config.config(tft_config.WIDE) 31 | 32 | 33 | def center(text, fg=st7789.WHITE, bg=st7789.BLACK): 34 | """ 35 | Centers the given text on the display. 36 | """ 37 | length = len(text) 38 | tft.text( 39 | font, 40 | text, 41 | tft.width // 2 - length // 2 * font.WIDTH, 42 | tft.height // 2 - font.HEIGHT, 43 | fg, 44 | bg, 45 | ) 46 | 47 | 48 | def main(): 49 | """ 50 | The big show! 51 | """ 52 | for color in [st7789.RED, st7789.GREEN, st7789.BLUE]: 53 | tft.fill(color) 54 | tft.rect(0, 0, tft.width, tft.height, st7789.WHITE) 55 | center("Hello!", st7789.WHITE, color) 56 | time.sleep(1) 57 | 58 | while True: 59 | for rotation in range(4): 60 | tft.rotation(rotation) 61 | tft.fill(0) 62 | col_max = tft.width - font.WIDTH * 6 63 | row_max = tft.height - font.HEIGHT 64 | 65 | for _ in range(128): 66 | tft.text( 67 | font, 68 | "Hello!", 69 | random.randint(0, col_max), 70 | random.randint(0, row_max), 71 | st7789.color565( 72 | random.getrandbits(8), 73 | random.getrandbits(8), 74 | random.getrandbits(8), 75 | ), 76 | st7789.color565( 77 | random.getrandbits(8), 78 | random.getrandbits(8), 79 | random.getrandbits(8), 80 | ), 81 | ) 82 | 83 | 84 | main() 85 | -------------------------------------------------------------------------------- /examples/tiny_toasters/make_tiny_toast_bitmaps.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | ../../utils/sprites_converter.py tiny_toasters.bmp 32 32 3 > tiny_toasters_bitmaps.py 4 | # mpy-cross tiny_toasters_bitmaps.py 5 | # mpremote cp tiny_toasters_bitmaps.mpy : 6 | -------------------------------------------------------------------------------- /examples/tiny_toasters/tiny_toasters.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/russhughes/st7789py_mpy/7265925bd0c092e8105200d18b2dba9dfbc12c27/examples/tiny_toasters/tiny_toasters.bmp -------------------------------------------------------------------------------- /examples/upload_all.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # 4 | # This script uploads all the files to the device 5 | # 6 | 7 | if ! command -v mpremote >/dev/null 2>&1; then 8 | echo "This script requires the mpremote command. You can install it with:" 9 | echo "pip3 install --user mpremote" 10 | exit 1 11 | fi 12 | 13 | if ! command -v mpy-cross >/dev/null 2>&1; then 14 | echo "This script requires the mpy-cross command. You can install it with:" 15 | echo "pip3 install --user mpy-cross" 16 | exit 1 17 | fi 18 | 19 | upload_fonts () { 20 | cd ../romfonts 21 | rm -f *.mpy 22 | for font in *.py 23 | do 24 | compile $font 25 | done 26 | cd .. 27 | mpremote cp romfonts/*.mpy : 28 | cd examples 29 | } 30 | 31 | upload () { 32 | echo "Uploading $1" 33 | mpremote cp $1 : 34 | } 35 | 36 | compile () { 37 | echo "Compiling $1" 38 | mpy-cross $1 39 | } 40 | 41 | compile_upload () { 42 | source="$1" 43 | compiled="${source%.py}.mpy" 44 | compile ${source} 45 | upload ${compiled} 46 | } 47 | 48 | select_menu() { 49 | local subdirectories=() 50 | directory="$2" 51 | selection="" 52 | 53 | # Display the title 54 | echo -e "\n$1\n" 55 | 56 | # Populate the subdirectories array 57 | while IFS= read -r subdirectory; do 58 | subdirectories+=("$subdirectory") 59 | done < <(find "$directory" -mindepth 1 -type d -printf "%f\n") 60 | 61 | # Display the menu 62 | PS3="Select a subdirectory (enter 0 to cancel): " 63 | select subdirectory in "${subdirectories[@]}"; do 64 | if [[ "$REPLY" == "0" ]]; then 65 | echo "Canceled." 66 | exit 1 67 | elif [[ -n "$subdirectory" ]]; then 68 | selection="$subdirectory" 69 | break 70 | else 71 | echo "Invalid selection. Please try again." 72 | fi 73 | done 74 | 75 | echo "Selected subdirectory: ${directory}/${selection}" 76 | } 77 | 78 | select_menu "Select a configuration to upload:" "../tft_configs" 79 | upload "${directory}/${selection}/*.py" 80 | 81 | # Driver 82 | upload "../lib/st7789py.py" 83 | 84 | # Fonts 85 | upload_fonts 86 | 87 | compile_upload alien/alien_bitmap.py 88 | upload alien/alien.py 89 | 90 | upload feathers.py 91 | upload rotations.py 92 | upload scroll.py 93 | upload fonts.py 94 | upload hello.py 95 | upload color_test.py 96 | 97 | upload tiny_toasters/tiny_toasters.py 98 | compile_upload tiny_toasters/tiny_toasters_bitmaps.py 99 | 100 | upload boxlines.py 101 | 102 | upload proverbs/proverbs.py 103 | compile_upload proverbs/proverbs_20.py 104 | compile_upload proverbs/proverbs_30.py 105 | 106 | upload roids.py 107 | 108 | upload chango/chango.py 109 | compile_upload chango/chango_16.py 110 | compile_upload chango/chango_32.py 111 | compile_upload chango/chango_64.py 112 | 113 | upload noto_fonts/noto_fonts.py 114 | compile_upload noto_fonts/NotoSans_32.py 115 | compile_upload noto_fonts/NotoSansMono_32.py 116 | compile_upload noto_fonts/NotoSerif_32.py 117 | 118 | upload tiny_hello.py 119 | -------------------------------------------------------------------------------- /lib/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/russhughes/st7789py_mpy/7265925bd0c092e8105200d18b2dba9dfbc12c27/lib/__init__.py -------------------------------------------------------------------------------- /romfonts/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/russhughes/st7789py_mpy/7265925bd0c092e8105200d18b2dba9dfbc12c27/romfonts/__init__.py -------------------------------------------------------------------------------- /romfonts/compile_upload.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | mpy-cross vga1_16x16.py 3 | mpy-cross vga1_16x32.py 4 | mpy-cross vga1_8x16.py 5 | mpy-cross vga1_8x8.py 6 | mpy-cross vga1_bold_16x16.py 7 | mpy-cross vga1_bold_16x32.py 8 | mpy-cross vga2_16x16.py 9 | mpy-cross vga2_16x32.py 10 | mpy-cross vga2_8x16.py 11 | mpy-cross vga2_8x8.py 12 | mpy-cross vga2_bold_16x16.py 13 | mpy-cross vga2_bold_16x32.py 14 | 15 | cd .. 16 | mpremote cp -r romfonts/*.mpy : 17 | -------------------------------------------------------------------------------- /romfonts/vga1_8x8.py: -------------------------------------------------------------------------------- 1 | """converted from vga_8x8.bin """ 2 | WIDTH = 8 3 | HEIGHT = 8 4 | FIRST = 0x20 5 | LAST = 0x7f 6 | _FONT =\ 7 | b'\x00\x00\x00\x00\x00\x00\x00\x00'\ 8 | b'\x18\x3c\x3c\x18\x18\x00\x18\x00'\ 9 | b'\x66\x66\x24\x00\x00\x00\x00\x00'\ 10 | b'\x6c\x6c\xfe\x6c\xfe\x6c\x6c\x00'\ 11 | b'\x18\x3e\x60\x3c\x06\x7c\x18\x00'\ 12 | b'\x00\xc6\xcc\x18\x30\x66\xc6\x00'\ 13 | b'\x38\x6c\x38\x76\xdc\xcc\x76\x00'\ 14 | b'\x18\x18\x30\x00\x00\x00\x00\x00'\ 15 | b'\x0c\x18\x30\x30\x30\x18\x0c\x00'\ 16 | b'\x30\x18\x0c\x0c\x0c\x18\x30\x00'\ 17 | b'\x00\x66\x3c\xff\x3c\x66\x00\x00'\ 18 | b'\x00\x18\x18\x7e\x18\x18\x00\x00'\ 19 | b'\x00\x00\x00\x00\x00\x18\x18\x30'\ 20 | b'\x00\x00\x00\x7e\x00\x00\x00\x00'\ 21 | b'\x00\x00\x00\x00\x00\x18\x18\x00'\ 22 | b'\x06\x0c\x18\x30\x60\xc0\x80\x00'\ 23 | b'\x38\x6c\xc6\xd6\xc6\x6c\x38\x00'\ 24 | b'\x18\x38\x18\x18\x18\x18\x7e\x00'\ 25 | b'\x7c\xc6\x06\x1c\x30\x66\xfe\x00'\ 26 | b'\x7c\xc6\x06\x3c\x06\xc6\x7c\x00'\ 27 | b'\x1c\x3c\x6c\xcc\xfe\x0c\x1e\x00'\ 28 | b'\xfe\xc0\xc0\xfc\x06\xc6\x7c\x00'\ 29 | b'\x38\x60\xc0\xfc\xc6\xc6\x7c\x00'\ 30 | b'\xfe\xc6\x0c\x18\x30\x30\x30\x00'\ 31 | b'\x7c\xc6\xc6\x7c\xc6\xc6\x7c\x00'\ 32 | b'\x7c\xc6\xc6\x7e\x06\x0c\x78\x00'\ 33 | b'\x00\x18\x18\x00\x00\x18\x18\x00'\ 34 | b'\x00\x18\x18\x00\x00\x18\x18\x30'\ 35 | b'\x06\x0c\x18\x30\x18\x0c\x06\x00'\ 36 | b'\x00\x00\x7e\x00\x00\x7e\x00\x00'\ 37 | b'\x60\x30\x18\x0c\x18\x30\x60\x00'\ 38 | b'\x7c\xc6\x0c\x18\x18\x00\x18\x00'\ 39 | b'\x7c\xc6\xde\xde\xde\xc0\x78\x00'\ 40 | b'\x38\x6c\xc6\xfe\xc6\xc6\xc6\x00'\ 41 | b'\xfc\x66\x66\x7c\x66\x66\xfc\x00'\ 42 | b'\x3c\x66\xc0\xc0\xc0\x66\x3c\x00'\ 43 | b'\xf8\x6c\x66\x66\x66\x6c\xf8\x00'\ 44 | b'\xfe\x62\x68\x78\x68\x62\xfe\x00'\ 45 | b'\xfe\x62\x68\x78\x68\x60\xf0\x00'\ 46 | b'\x3c\x66\xc0\xc0\xce\x66\x3a\x00'\ 47 | b'\xc6\xc6\xc6\xfe\xc6\xc6\xc6\x00'\ 48 | b'\x3c\x18\x18\x18\x18\x18\x3c\x00'\ 49 | b'\x1e\x0c\x0c\x0c\xcc\xcc\x78\x00'\ 50 | b'\xe6\x66\x6c\x78\x6c\x66\xe6\x00'\ 51 | b'\xf0\x60\x60\x60\x62\x66\xfe\x00'\ 52 | b'\xc6\xee\xfe\xfe\xd6\xc6\xc6\x00'\ 53 | b'\xc6\xe6\xf6\xde\xce\xc6\xc6\x00'\ 54 | b'\x7c\xc6\xc6\xc6\xc6\xc6\x7c\x00'\ 55 | b'\xfc\x66\x66\x7c\x60\x60\xf0\x00'\ 56 | b'\x7c\xc6\xc6\xc6\xc6\xce\x7c\x0e'\ 57 | b'\xfc\x66\x66\x7c\x6c\x66\xe6\x00'\ 58 | b'\x3c\x66\x30\x18\x0c\x66\x3c\x00'\ 59 | b'\x7e\x7e\x5a\x18\x18\x18\x3c\x00'\ 60 | b'\xc6\xc6\xc6\xc6\xc6\xc6\x7c\x00'\ 61 | b'\xc6\xc6\xc6\xc6\xc6\x6c\x38\x00'\ 62 | b'\xc6\xc6\xc6\xd6\xd6\xfe\x6c\x00'\ 63 | b'\xc6\xc6\x6c\x38\x6c\xc6\xc6\x00'\ 64 | b'\x66\x66\x66\x3c\x18\x18\x3c\x00'\ 65 | b'\xfe\xc6\x8c\x18\x32\x66\xfe\x00'\ 66 | b'\x3c\x30\x30\x30\x30\x30\x3c\x00'\ 67 | b'\xc0\x60\x30\x18\x0c\x06\x02\x00'\ 68 | b'\x3c\x0c\x0c\x0c\x0c\x0c\x3c\x00'\ 69 | b'\x10\x38\x6c\xc6\x00\x00\x00\x00'\ 70 | b'\x00\x00\x00\x00\x00\x00\x00\xff'\ 71 | b'\x30\x18\x0c\x00\x00\x00\x00\x00'\ 72 | b'\x00\x00\x78\x0c\x7c\xcc\x76\x00'\ 73 | b'\xe0\x60\x7c\x66\x66\x66\xdc\x00'\ 74 | b'\x00\x00\x7c\xc6\xc0\xc6\x7c\x00'\ 75 | b'\x1c\x0c\x7c\xcc\xcc\xcc\x76\x00'\ 76 | b'\x00\x00\x7c\xc6\xfe\xc0\x7c\x00'\ 77 | b'\x3c\x66\x60\xf8\x60\x60\xf0\x00'\ 78 | b'\x00\x00\x76\xcc\xcc\x7c\x0c\xf8'\ 79 | b'\xe0\x60\x6c\x76\x66\x66\xe6\x00'\ 80 | b'\x18\x00\x38\x18\x18\x18\x3c\x00'\ 81 | b'\x06\x00\x06\x06\x06\x66\x66\x3c'\ 82 | b'\xe0\x60\x66\x6c\x78\x6c\xe6\x00'\ 83 | b'\x38\x18\x18\x18\x18\x18\x3c\x00'\ 84 | b'\x00\x00\xec\xfe\xd6\xd6\xd6\x00'\ 85 | b'\x00\x00\xdc\x66\x66\x66\x66\x00'\ 86 | b'\x00\x00\x7c\xc6\xc6\xc6\x7c\x00'\ 87 | b'\x00\x00\xdc\x66\x66\x7c\x60\xf0'\ 88 | b'\x00\x00\x76\xcc\xcc\x7c\x0c\x1e'\ 89 | b'\x00\x00\xdc\x76\x60\x60\xf0\x00'\ 90 | b'\x00\x00\x7e\xc0\x7c\x06\xfc\x00'\ 91 | b'\x30\x30\xfc\x30\x30\x36\x1c\x00'\ 92 | b'\x00\x00\xcc\xcc\xcc\xcc\x76\x00'\ 93 | b'\x00\x00\xc6\xc6\xc6\x6c\x38\x00'\ 94 | b'\x00\x00\xc6\xd6\xd6\xfe\x6c\x00'\ 95 | b'\x00\x00\xc6\x6c\x38\x6c\xc6\x00'\ 96 | b'\x00\x00\xc6\xc6\xc6\x7e\x06\xfc'\ 97 | b'\x00\x00\x7e\x4c\x18\x32\x7e\x00'\ 98 | b'\x0e\x18\x18\x70\x18\x18\x0e\x00'\ 99 | b'\x18\x18\x18\x18\x18\x18\x18\x00'\ 100 | b'\x70\x18\x18\x0e\x18\x18\x70\x00'\ 101 | b'\x76\xdc\x00\x00\x00\x00\x00\x00'\ 102 | b'\x00\x10\x38\x6c\xc6\xc6\xfe\x00'\ 103 | 104 | FONT = memoryview(_FONT) 105 | -------------------------------------------------------------------------------- /sphinx/Makefile: -------------------------------------------------------------------------------- 1 | # Minimal makefile for Sphinx documentation 2 | # 3 | 4 | # You can set these variables from the command line. 5 | SPHINXOPTS = 6 | SPHINXBUILD = sphinx-build 7 | SOURCEDIR = source 8 | BUILDDIR = build 9 | 10 | # Put it first so that "make" without argument is like "make help". 11 | help: 12 | @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) 13 | 14 | .PHONY: help Makefile 15 | 16 | # Catch-all target: route all unknown targets to Sphinx using the new 17 | # "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). 18 | %: Makefile 19 | @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) 20 | 21 | update: 22 | # update docs directory of this repo using rsync 23 | /usr/bin/rsync --progress --delete -avz build/html/ ../docs/ > /dev/null 24 | # update local webserver for testing 25 | # /usr/bin/rsync --progress --delete -avz build/html/ /htdocs/st7789py > /dev/null 26 | -------------------------------------------------------------------------------- /sphinx/requirements.txt: -------------------------------------------------------------------------------- 1 | # additional sphinx plug-ins, install using pip3 2 | sphinx 3 | sphinx-prompt 4 | sphinxcontrib.napoleon 5 | sphinxcontrib.napoleon 6 | sphinxcontrib.globalsubs 7 | sphinx_rtd_theme 8 | -------------------------------------------------------------------------------- /sphinx/source/_static/alien.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/russhughes/st7789py_mpy/7265925bd0c092e8105200d18b2dba9dfbc12c27/sphinx/source/_static/alien.jpg -------------------------------------------------------------------------------- /sphinx/source/_static/boxlines.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/russhughes/st7789py_mpy/7265925bd0c092e8105200d18b2dba9dfbc12c27/sphinx/source/_static/boxlines.jpg -------------------------------------------------------------------------------- /sphinx/source/_static/chango.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/russhughes/st7789py_mpy/7265925bd0c092e8105200d18b2dba9dfbc12c27/sphinx/source/_static/chango.jpg -------------------------------------------------------------------------------- /sphinx/source/_static/color_test.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/russhughes/st7789py_mpy/7265925bd0c092e8105200d18b2dba9dfbc12c27/sphinx/source/_static/color_test.jpg -------------------------------------------------------------------------------- /sphinx/source/_static/colorbars.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/russhughes/st7789py_mpy/7265925bd0c092e8105200d18b2dba9dfbc12c27/sphinx/source/_static/colorbars.jpg -------------------------------------------------------------------------------- /sphinx/source/_static/feathers.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/russhughes/st7789py_mpy/7265925bd0c092e8105200d18b2dba9dfbc12c27/sphinx/source/_static/feathers.jpg -------------------------------------------------------------------------------- /sphinx/source/_static/fonts.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/russhughes/st7789py_mpy/7265925bd0c092e8105200d18b2dba9dfbc12c27/sphinx/source/_static/fonts.jpg -------------------------------------------------------------------------------- /sphinx/source/_static/hello.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/russhughes/st7789py_mpy/7265925bd0c092e8105200d18b2dba9dfbc12c27/sphinx/source/_static/hello.jpg -------------------------------------------------------------------------------- /sphinx/source/_static/noto_fonts.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/russhughes/st7789py_mpy/7265925bd0c092e8105200d18b2dba9dfbc12c27/sphinx/source/_static/noto_fonts.jpg -------------------------------------------------------------------------------- /sphinx/source/_static/proverbs.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/russhughes/st7789py_mpy/7265925bd0c092e8105200d18b2dba9dfbc12c27/sphinx/source/_static/proverbs.jpg -------------------------------------------------------------------------------- /sphinx/source/_static/roids.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/russhughes/st7789py_mpy/7265925bd0c092e8105200d18b2dba9dfbc12c27/sphinx/source/_static/roids.jpg -------------------------------------------------------------------------------- /sphinx/source/_static/rotation.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/russhughes/st7789py_mpy/7265925bd0c092e8105200d18b2dba9dfbc12c27/sphinx/source/_static/rotation.jpg -------------------------------------------------------------------------------- /sphinx/source/_static/rotations.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/russhughes/st7789py_mpy/7265925bd0c092e8105200d18b2dba9dfbc12c27/sphinx/source/_static/rotations.jpg -------------------------------------------------------------------------------- /sphinx/source/_static/scroll.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/russhughes/st7789py_mpy/7265925bd0c092e8105200d18b2dba9dfbc12c27/sphinx/source/_static/scroll.jpg -------------------------------------------------------------------------------- /sphinx/source/_static/tiny_hello.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/russhughes/st7789py_mpy/7265925bd0c092e8105200d18b2dba9dfbc12c27/sphinx/source/_static/tiny_hello.jpg -------------------------------------------------------------------------------- /sphinx/source/_static/tiny_toasters.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/russhughes/st7789py_mpy/7265925bd0c092e8105200d18b2dba9dfbc12c27/sphinx/source/_static/tiny_toasters.jpg -------------------------------------------------------------------------------- /sphinx/source/_static/vga1_16x16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/russhughes/st7789py_mpy/7265925bd0c092e8105200d18b2dba9dfbc12c27/sphinx/source/_static/vga1_16x16.png -------------------------------------------------------------------------------- /sphinx/source/_static/vga1_16x32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/russhughes/st7789py_mpy/7265925bd0c092e8105200d18b2dba9dfbc12c27/sphinx/source/_static/vga1_16x32.png -------------------------------------------------------------------------------- /sphinx/source/_static/vga1_8x16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/russhughes/st7789py_mpy/7265925bd0c092e8105200d18b2dba9dfbc12c27/sphinx/source/_static/vga1_8x16.png -------------------------------------------------------------------------------- /sphinx/source/_static/vga1_8x8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/russhughes/st7789py_mpy/7265925bd0c092e8105200d18b2dba9dfbc12c27/sphinx/source/_static/vga1_8x8.png -------------------------------------------------------------------------------- /sphinx/source/_static/vga1_bold_16x16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/russhughes/st7789py_mpy/7265925bd0c092e8105200d18b2dba9dfbc12c27/sphinx/source/_static/vga1_bold_16x16.png -------------------------------------------------------------------------------- /sphinx/source/_static/vga1_bold_16x32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/russhughes/st7789py_mpy/7265925bd0c092e8105200d18b2dba9dfbc12c27/sphinx/source/_static/vga1_bold_16x32.png -------------------------------------------------------------------------------- /sphinx/source/_static/vga2_16x16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/russhughes/st7789py_mpy/7265925bd0c092e8105200d18b2dba9dfbc12c27/sphinx/source/_static/vga2_16x16.png -------------------------------------------------------------------------------- /sphinx/source/_static/vga2_16x32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/russhughes/st7789py_mpy/7265925bd0c092e8105200d18b2dba9dfbc12c27/sphinx/source/_static/vga2_16x32.png -------------------------------------------------------------------------------- /sphinx/source/_static/vga2_8x16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/russhughes/st7789py_mpy/7265925bd0c092e8105200d18b2dba9dfbc12c27/sphinx/source/_static/vga2_8x16.png -------------------------------------------------------------------------------- /sphinx/source/_static/vga2_8x8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/russhughes/st7789py_mpy/7265925bd0c092e8105200d18b2dba9dfbc12c27/sphinx/source/_static/vga2_8x8.png -------------------------------------------------------------------------------- /sphinx/source/_static/vga2_bold_16x16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/russhughes/st7789py_mpy/7265925bd0c092e8105200d18b2dba9dfbc12c27/sphinx/source/_static/vga2_bold_16x16.png -------------------------------------------------------------------------------- /sphinx/source/_static/vga2_bold_16x32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/russhughes/st7789py_mpy/7265925bd0c092e8105200d18b2dba9dfbc12c27/sphinx/source/_static/vga2_bold_16x32.png -------------------------------------------------------------------------------- /sphinx/source/configs.rst: -------------------------------------------------------------------------------- 1 | .. toctree:: 2 | :glob: 3 | 4 | configs/* 5 | -------------------------------------------------------------------------------- /sphinx/source/configs/atom_s3.rst: -------------------------------------------------------------------------------- 1 | .. _../tft_configs/atom_s3: 2 | 3 | M5STACK AtomS3 128x128 (GC9107) 4 | =============================== 5 | 6 | 7 | https://docs.m5stack.com/en/core/AtomS3 8 | 9 | tft_configs/atom_s3/tft_config.py 10 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 11 | 12 | .. literalinclude:: ../../../tft_configs/atom_s3/tft_config.py 13 | :language: python 14 | :linenos: 15 | :lines: 1- 16 | 17 | 18 | tft_configs/atom_s3/tft_buttons.py 19 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 20 | 21 | M5STACK AtomS3 buttons 22 | 23 | .. literalinclude:: ../../../tft_configs/atom_s3/tft_buttons.py 24 | :language: python 25 | :linenos: 26 | :lines: 1- 27 | 28 | -------------------------------------------------------------------------------- /sphinx/source/configs/esp32_320x240.rst: -------------------------------------------------------------------------------- 1 | .. _../tft_configs/esp32_320x240: 2 | 3 | Generic ESP32 320x240 4 | ===================== 5 | 6 | 7 | 8 | tft_configs/esp32_320x240/tft_config.py 9 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 10 | 11 | .. literalinclude:: ../../../tft_configs/esp32_320x240/tft_config.py 12 | :language: python 13 | :linenos: 14 | :lines: 1- 15 | 16 | 17 | tft_configs/esp32_320x240/tft_buttons.py 18 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 19 | 20 | Generic ESP32 with Two buttons 21 | 22 | .. literalinclude:: ../../../tft_configs/esp32_320x240/tft_buttons.py 23 | :language: python 24 | :linenos: 25 | :lines: 1- 26 | 27 | -------------------------------------------------------------------------------- /sphinx/source/configs/m5stack_core.rst: -------------------------------------------------------------------------------- 1 | .. _../tft_configs/m5stack_core: 2 | 3 | M5STACK CORE 320x240 (ILI9342) 4 | ============================== 5 | 6 | 7 | 8 | tft_configs/m5stack_core/tft_config.py 9 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 10 | 11 | .. literalinclude:: ../../../tft_configs/m5stack_core/tft_config.py 12 | :language: python 13 | :linenos: 14 | :lines: 1- 15 | 16 | 17 | tft_configs/m5stack_core/tft_buttons.py 18 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 19 | 20 | Buttons class for examples, modify for your device. 21 | 22 | Attributes: 23 | name (str): The name of the device. 24 | left (Pin): The Pin object representing the left button. 25 | right (Pin): The Pin object representing the right button. 26 | fire (Pin): The Pin object representing the fire button. 27 | thrust (Pin): The Pin object representing the thrust button. 28 | hyper (Pin): The Pin object representing the hyper button. 29 | 30 | .. literalinclude:: ../../../tft_configs/m5stack_core/tft_buttons.py 31 | :language: python 32 | :linenos: 33 | :lines: 1- 34 | 35 | -------------------------------------------------------------------------------- /sphinx/source/configs/m5stack_core2.rst: -------------------------------------------------------------------------------- 1 | .. _../tft_configs/m5stack_core2: 2 | 3 | M5STACK CORE2 320x240 (ILI9342) 4 | =============================== 5 | 6 | 7 | 8 | tft_configs/m5stack_core2/tft_config.py 9 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 10 | 11 | .. literalinclude:: ../../../tft_configs/m5stack_core2/tft_config.py 12 | :language: python 13 | :linenos: 14 | :lines: 1- 15 | 16 | 17 | tft_configs/m5stack_core2/tft_buttons.py 18 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 19 | 20 | 21 | from machine import Pin 22 | 23 | 24 | class Buttons: 25 | 26 | .. literalinclude:: ../../../tft_configs/m5stack_core2/tft_buttons.py 27 | :language: python 28 | :linenos: 29 | :lines: 1- 30 | 31 | -------------------------------------------------------------------------------- /sphinx/source/configs/m5stack_core3.rst: -------------------------------------------------------------------------------- 1 | .. _../tft_configs/m5stack_core3: 2 | 3 | M5STACK CoreS3 320x240 (ILI9342) 4 | ================================ 5 | 6 | 7 | 8 | tft_configs/m5stack_core3/tft_config.py 9 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 10 | 11 | .. literalinclude:: ../../../tft_configs/m5stack_core3/tft_config.py 12 | :language: python 13 | :linenos: 14 | :lines: 1- 15 | 16 | 17 | tft_configs/m5stack_core3/tft_buttons.py 18 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 19 | 20 | Buttons class for examples, modify for your device. 21 | 22 | Attributes: 23 | name (str): The name of the device. 24 | left (Pin): The Pin object representing the left button. 25 | right (Pin): The Pin object representing the right button. 26 | fire (Pin): The Pin object representing the fire button. 27 | thrust (Pin): The Pin object representing the thrust button. 28 | hyper (Pin): The Pin object representing the hyper button. 29 | 30 | .. literalinclude:: ../../../tft_configs/m5stack_core3/tft_buttons.py 31 | :language: python 32 | :linenos: 33 | :lines: 1- 34 | 35 | -------------------------------------------------------------------------------- /sphinx/source/configs/rp2040_touch_lcd_128.rst: -------------------------------------------------------------------------------- 1 | .. _../tft_configs/rp2040_touch_lcd_128: 2 | 3 | RP2040-Touch-LCD-1.28 240x240 (GC9A01) 4 | ====================================== 5 | 6 | 7 | 8 | tft_configs/rp2040_touch_lcd_128/tft_config.py 9 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 10 | 11 | .. literalinclude:: ../../../tft_configs/rp2040_touch_lcd_128/tft_config.py 12 | :language: python 13 | :linenos: 14 | :lines: 1- 15 | 16 | 17 | tft_configs/rp2040_touch_lcd_128/tft_buttons.py 18 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 19 | 20 | 21 | from machine import Pin 22 | 23 | 24 | class Buttons: 25 | 26 | .. literalinclude:: ../../../tft_configs/rp2040_touch_lcd_128/tft_buttons.py 27 | :language: python 28 | :linenos: 29 | :lines: 1- 30 | 31 | -------------------------------------------------------------------------------- /sphinx/source/configs/t-dongle-s3.rst: -------------------------------------------------------------------------------- 1 | .. _../tft_configs/t-dongle-s3: 2 | 3 | LilyGo T-Dongle-S3 80x160 (ST7735) 4 | ================================== 5 | 6 | 7 | 8 | tft_configs/t-dongle-s3/tft_config.py 9 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 10 | 11 | .. literalinclude:: ../../../tft_configs/t-dongle-s3/tft_config.py 12 | :language: python 13 | :linenos: 14 | :lines: 1- 15 | 16 | 17 | tft_configs/t-dongle-s3/tft_buttons.py 18 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 19 | 20 | 21 | 22 | .. literalinclude:: ../../../tft_configs/t-dongle-s3/tft_buttons.py 23 | :language: python 24 | :linenos: 25 | :lines: 1- 26 | 27 | -------------------------------------------------------------------------------- /sphinx/source/configs/t-embed.rst: -------------------------------------------------------------------------------- 1 | .. _../tft_configs/t-embed: 2 | 3 | LilyGo T-embed 170x320 4 | ====================== 5 | 6 | 7 | 8 | tft_configs/t-embed/tft_config.py 9 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 10 | 11 | .. literalinclude:: ../../../tft_configs/t-embed/tft_config.py 12 | :language: python 13 | :linenos: 14 | :lines: 1- 15 | 16 | 17 | tft_configs/t-embed/tft_buttons.py 18 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 19 | 20 | Buttons class for examples, modify for your device. 21 | 22 | Attributes: 23 | name (str): The name of the device. 24 | left (Pin): The Pin object representing the left button. 25 | right (Pin): The Pin object representing the right button. 26 | fire (Pin): The Pin object representing the fire button. 27 | thrust (Pin): The Pin object representing the thrust button. 28 | hyper (Pin): The Pin object representing the hyper button. 29 | 30 | .. literalinclude:: ../../../tft_configs/t-embed/tft_buttons.py 31 | :language: python 32 | :linenos: 33 | :lines: 1- 34 | 35 | -------------------------------------------------------------------------------- /sphinx/source/configs/t_qt_pro.rst: -------------------------------------------------------------------------------- 1 | .. _../tft_configs/t_qt_pro: 2 | 3 | LilyGo T-QT Pro 128x128 (GC9107) 4 | ================================ 5 | 6 | 7 | https://www.lilygo.cc/products/t-qt-pro 8 | 9 | tft_configs/t_qt_pro/tft_config.py 10 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 11 | 12 | .. literalinclude:: ../../../tft_configs/t_qt_pro/tft_config.py 13 | :language: python 14 | :linenos: 15 | :lines: 1- 16 | 17 | 18 | tft_configs/t_qt_pro/tft_buttons.py 19 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 20 | 21 | LILYGO® T-QT Pro buttons 22 | 23 | .. literalinclude:: ../../../tft_configs/t_qt_pro/tft_buttons.py 24 | :language: python 25 | :linenos: 26 | :lines: 1- 27 | 28 | -------------------------------------------------------------------------------- /sphinx/source/configs/ttgo_tdisplay.rst: -------------------------------------------------------------------------------- 1 | .. _../tft_configs/ttgo_tdisplay: 2 | 3 | LilyGo T-DISPLAY 135x240 4 | ======================== 5 | 6 | 7 | https://www.lilygo.cc/products/lilygo%C2%AE-ttgo-t-display-1-14-inch-lcd-esp32-control-board 8 | 9 | tft_configs/ttgo_tdisplay/tft_config.py 10 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 11 | 12 | .. literalinclude:: ../../../tft_configs/ttgo_tdisplay/tft_config.py 13 | :language: python 14 | :linenos: 15 | :lines: 1- 16 | 17 | 18 | tft_configs/ttgo_tdisplay/tft_buttons.py 19 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 20 | 21 | T-Display ESP32 Buttons. 22 | 23 | .. literalinclude:: ../../../tft_configs/ttgo_tdisplay/tft_buttons.py 24 | :language: python 25 | :linenos: 26 | :lines: 1- 27 | 28 | -------------------------------------------------------------------------------- /sphinx/source/configs/ttgo_tdisplay_rp2040.rst: -------------------------------------------------------------------------------- 1 | .. _../tft_configs/ttgo_tdisplay_rp2040: 2 | 3 | LilyGo T-DISPLAY RP2040 135x240 4 | =============================== 5 | 6 | 7 | https://www.lilygo.cc/products/t-display-rp2040 8 | 9 | tft_configs/ttgo_tdisplay_rp2040/tft_config.py 10 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 11 | 12 | .. literalinclude:: ../../../tft_configs/ttgo_tdisplay_rp2040/tft_config.py 13 | :language: python 14 | :linenos: 15 | :lines: 1- 16 | 17 | 18 | tft_configs/ttgo_tdisplay_rp2040/tft_buttons.py 19 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 20 | 21 | T-Display RP2040 Buttons configuration. 22 | 23 | .. literalinclude:: ../../../tft_configs/ttgo_tdisplay_rp2040/tft_buttons.py 24 | :language: python 25 | :linenos: 26 | :lines: 1- 27 | 28 | -------------------------------------------------------------------------------- /sphinx/source/configs/waveshare_114.rst: -------------------------------------------------------------------------------- 1 | .. _../tft_configs/waveshare_114: 2 | 3 | Waveshare Pico LCD 1.14 135x240 4 | =============================== 5 | 6 | 7 | https://www.waveshare.com/wiki/Pico-LCD-1.14 8 | 9 | tft_configs/waveshare_114/tft_config.py 10 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 11 | 12 | .. literalinclude:: ../../../tft_configs/waveshare_114/tft_config.py 13 | :language: python 14 | :linenos: 15 | :lines: 1- 16 | 17 | 18 | tft_configs/waveshare_114/tft_buttons.py 19 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 20 | 21 | Waveshare Pico LCD 1.14 Buttons 22 | 23 | .. literalinclude:: ../../../tft_configs/waveshare_114/tft_buttons.py 24 | :language: python 25 | :linenos: 26 | :lines: 1- 27 | 28 | -------------------------------------------------------------------------------- /sphinx/source/configs/waveshare_13.rst: -------------------------------------------------------------------------------- 1 | .. _../tft_configs/waveshare_13: 2 | 3 | Waveshare Pico LCD 1.3 240x240 4 | ============================== 5 | 6 | 7 | https://www.waveshare.com/wiki/Pico-LCD-1.3 8 | 9 | tft_configs/waveshare_13/tft_config.py 10 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 11 | 12 | .. literalinclude:: ../../../tft_configs/waveshare_13/tft_config.py 13 | :language: python 14 | :linenos: 15 | :lines: 1- 16 | 17 | 18 | tft_configs/waveshare_13/tft_buttons.py 19 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 20 | 21 | Waveshare 1.3" TFT display with ST7789 controller 22 | 23 | .. literalinclude:: ../../../tft_configs/waveshare_13/tft_buttons.py 24 | :language: python 25 | :linenos: 26 | :lines: 1- 27 | 28 | -------------------------------------------------------------------------------- /sphinx/source/configs/waveshare_2.rst: -------------------------------------------------------------------------------- 1 | .. _../tft_configs/waveshare_2: 2 | 3 | Waveshare Pico LCD 2 240x320 4 | ============================ 5 | 6 | 7 | https://www.waveshare.com/wiki/Pico-LCD-2 8 | 9 | tft_configs/waveshare_2/tft_config.py 10 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 11 | 12 | .. literalinclude:: ../../../tft_configs/waveshare_2/tft_config.py 13 | :language: python 14 | :linenos: 15 | :lines: 1- 16 | 17 | 18 | tft_configs/waveshare_2/tft_buttons.py 19 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 20 | 21 | input pins for ws_pico_2 22 | 23 | .. literalinclude:: ../../../tft_configs/waveshare_2/tft_buttons.py 24 | :language: python 25 | :linenos: 26 | :lines: 1- 27 | 28 | -------------------------------------------------------------------------------- /sphinx/source/examples.rst: -------------------------------------------------------------------------------- 1 | **************** 2 | Example Programs 3 | **************** 4 | 5 | 6 | Configuration modules 7 | ===================== 8 | 9 | To run the examples, you need two modules that set up the display and buttons for the example MicroPython programs: **tft_config.py** and **tft_buttons.py**. These modules configure the display and manage button interactions, ensuring compatibility with various processors and displays. The provided modules located in the tft_configs folder are specific to the devices I used during testing; use them as a reference to create configuration modules for your device if it's not one of those included. 10 | 11 | 12 | .. include:: configs.rst 13 | 14 | Examples 15 | ======== 16 | 17 | .. toctree:: 18 | :glob: 19 | 20 | examples/* 21 | 22 | -------------------------------------------------------------------------------- /sphinx/source/examples/alien.rst: -------------------------------------------------------------------------------- 1 | .. _alien: 2 | 3 | alien.py 4 | ========= 5 | 6 | .. figure:: ../_static/alien.jpg 7 | :align: center 8 | 9 | Bounce a bitmap of an alien around the display. 10 | 11 | The alien_bitmap module was created using the :ref:`image_converter.py` utility. 12 | 13 | .. literalinclude:: ../../../examples/alien/make_alien_bitmap.sh 14 | 15 | .. note:: This example requires the following modules: 16 | 17 | .. hlist:: 18 | :columns: 3 19 | 20 | - `st7789py` 21 | - `tft_config` 22 | - `alien_bitmap` 23 | 24 | The alien.png PNG file is from the Erik Flowers Weather Icons available from 25 | https://github.com/erikflowers/weather-icons and is licensed under SIL OFL 1.1 26 | (http://scripts.sil.org/OFL). 27 | 28 | .. literalinclude:: ../../../examples/alien/alien.py 29 | :language: python 30 | :linenos: 31 | :lines: 1- 32 | 33 | -------------------------------------------------------------------------------- /sphinx/source/examples/boxlines.rst: -------------------------------------------------------------------------------- 1 | .. _boxlines: 2 | 3 | boxlines.py 4 | =========== 5 | 6 | .. figure:: ../_static/boxlines.jpg 7 | :align: center 8 | 9 | Test for lines and rectangles. 10 | 11 | Draws lines and rectangles in random colors at random locations on the display. 12 | 13 | .. note:: This example requires the following modules: 14 | 15 | .. hlist:: 16 | :columns: 3 17 | 18 | - `st7789py` 19 | - `tft_config` 20 | 21 | .. literalinclude:: ../../../examples/boxlines.py 22 | :language: python 23 | :linenos: 24 | :lines: 1- 25 | 26 | -------------------------------------------------------------------------------- /sphinx/source/examples/chango.rst: -------------------------------------------------------------------------------- 1 | .. _chango: 2 | 3 | chango.py 4 | ========= 5 | 6 | .. figure:: ../_static/chango.jpg 7 | :align: center 8 | 9 | Test for TrueType write_font_converter. 10 | 11 | See the :ref:`write_font_converter.py` program in the utils directory. 12 | 13 | .. note:: This example requires the following modules: 14 | 15 | .. hlist:: 16 | :columns: 3 17 | 18 | - `st7789py` 19 | - `tft_config` 20 | - `chango_16` 21 | - `chango_32` 22 | - `chango_64` 23 | 24 | .. literalinclude:: ../../../examples/chango/chango.py 25 | :language: python 26 | :linenos: 27 | :lines: 1- 28 | 29 | -------------------------------------------------------------------------------- /sphinx/source/examples/color_test.rst: -------------------------------------------------------------------------------- 1 | .. _color_test: 2 | 3 | color_test.py 4 | ============= 5 | 6 | .. figure:: ../_static/color_test.jpg 7 | :align: center 8 | 9 | Test color with gradients. 10 | 11 | Draws Red, Green and Blues gradients on the display and writes the color name centered in the 12 | gradient. Then repeatedly draws a borders around the display in the same colors. 13 | 14 | .. note:: This example requires the following modules: 15 | 16 | .. hlist:: 17 | :columns: 3 18 | 19 | - `st7789py` 20 | - `tft_config` 21 | - `vga2_bold_16x32` 22 | 23 | .. literalinclude:: ../../../examples/color_test.py 24 | :language: python 25 | :linenos: 26 | :lines: 1- 27 | 28 | -------------------------------------------------------------------------------- /sphinx/source/examples/colorbars.rst: -------------------------------------------------------------------------------- 1 | .. _colorbars: 2 | 3 | .. _colorbars.py: 4 | 5 | colorbars.py 6 | ============= 7 | 8 | .. figure:: ../_static/colorbars.jpg 9 | :align: center 10 | 11 | Test bitmap colors. 12 | 13 | Displays WHITE, YELLOW, CYAN, GREEN, MAGENTA, RED, and BLUE color bar bitmap named 14 | colorbars_{WIDTH}x(HEIGHT) on the display. Custom sized bitmap modules can be created 15 | using the :ref:`make_colorbars_bitmap.py` utility. 16 | 17 | .. note:: This example requires the following modules: 18 | 19 | .. hlist:: 20 | :columns: 3 21 | 22 | - `st7789py` 23 | - `tft_config` 24 | - `colorbars_{WIDTH}x{HEIGHT}` 25 | 26 | .. literalinclude:: ../../../examples/colorbars/colorbars.py 27 | :language: python 28 | :linenos: 29 | :lines: 1- 30 | 31 | -------------------------------------------------------------------------------- /sphinx/source/examples/feathers.rst: -------------------------------------------------------------------------------- 1 | .. _feathers: 2 | 3 | feathers.py 4 | =========== 5 | 6 | .. figure:: ../_static/feathers.jpg 7 | :align: center 8 | 9 | Test hardware scrolling. 10 | 11 | Smoothly scrolls mirrored rainbow colored random curves across the display. 12 | 13 | .. note:: This example requires the following modules: 14 | 15 | .. hlist:: 16 | :columns: 3 17 | 18 | - `st7789py` 19 | - `tft_config` 20 | 21 | .. literalinclude:: ../../../examples/feathers.py 22 | :language: python 23 | :linenos: 24 | :lines: 1- 25 | 26 | -------------------------------------------------------------------------------- /sphinx/source/examples/fonts.rst: -------------------------------------------------------------------------------- 1 | .. _fonts: 2 | 3 | fonts.py 4 | ======== 5 | 6 | .. figure:: ../_static/fonts.jpg 7 | :align: center 8 | 9 | Test text_font_converter.py 10 | 11 | Pages through all characters of four fonts on the Display. 12 | https://www.youtube.com/watch?v=2cnAhEucPD4 13 | 14 | .. note:: This example requires the following modules: 15 | 16 | .. hlist:: 17 | :columns: 3 18 | 19 | - `st7789py` 20 | - `tft_config` 21 | - `vga2_8x8` 22 | - `vga2_8x16` 23 | - `vga2_bold_16x16` 24 | - `vga2_bold_16x32` 25 | 26 | .. literalinclude:: ../../../examples/fonts.py 27 | :language: python 28 | :linenos: 29 | :lines: 1- 30 | 31 | -------------------------------------------------------------------------------- /sphinx/source/examples/hello.rst: -------------------------------------------------------------------------------- 1 | .. _hello: 2 | 3 | hello.py 4 | ======== 5 | 6 | .. figure:: ../_static/hello.jpg 7 | :align: center 8 | 9 | Test for text_font_converter. 10 | 11 | Writes "Hello!" in random colors at random locations on the Display. 12 | https://www.youtube.com/watch?v=atBa0BYPAAc 13 | 14 | .. note:: This example requires the following modules: 15 | 16 | .. hlist:: 17 | :columns: 3 18 | 19 | - `st7789py` 20 | - `tft_config` 21 | - `vga2_bold_16x32` 22 | 23 | .. literalinclude:: ../../../examples/hello.py 24 | :language: python 25 | :linenos: 26 | :lines: 1- 27 | 28 | -------------------------------------------------------------------------------- /sphinx/source/examples/noto_fonts.rst: -------------------------------------------------------------------------------- 1 | .. _noto_fonts: 2 | 3 | noto_fonts.py 4 | ============= 5 | 6 | .. figure:: ../_static/noto_fonts.jpg 7 | :align: center 8 | 9 | Test for TrueType write_font_converter. 10 | 11 | Writes the names of three Noto fonts centered on the display using the font. 12 | The fonts were converted from True Type fonts using the 13 | :ref:`write_font_converter.py` utility. 14 | 15 | .. note:: This example requires the following modules: 16 | 17 | .. hlist:: 18 | :columns: 3 19 | 20 | - `st7789py` 21 | - `tft_config` 22 | - `NotoSans_32` 23 | - `NotoSerif_32` 24 | - `NotoSansMono_32` 25 | 26 | .. literalinclude:: ../../../examples/noto_fonts/noto_fonts.py 27 | :language: python 28 | :linenos: 29 | :lines: 1- 30 | 31 | -------------------------------------------------------------------------------- /sphinx/source/examples/proverbs.rst: -------------------------------------------------------------------------------- 1 | .. _proverbs: 2 | 3 | proverbs.py 4 | =========== 5 | 6 | .. figure:: ../_static/proverbs.jpg 7 | :align: center 8 | 9 | Test for TrueType write_font_converter. 10 | 11 | Displays what I hope are chinese proverbs in simplified chinese to test UTF-8 font support. 12 | The fonts were converted from True Type fonts using the 13 | :ref:`write_font_converter.py` utility. 14 | 15 | .. literalinclude:: ../../../examples/proverbs/make_proverbs_fonts.sh 16 | 17 | 18 | .. note:: This example requires the following modules: 19 | 20 | .. hlist:: 21 | :columns: 3 22 | 23 | - `st7789py` 24 | - `tft_config` 25 | - `proverbs_20` 26 | - `proverbs_30` 27 | 28 | .. literalinclude:: ../../../examples/proverbs/proverbs.py 29 | :language: python 30 | :linenos: 31 | :lines: 1- 32 | 33 | -------------------------------------------------------------------------------- /sphinx/source/examples/roids.rst: -------------------------------------------------------------------------------- 1 | .. _roids: 2 | 3 | roids.py 4 | ======== 5 | 6 | .. figure:: ../_static/roids.jpg 7 | :align: center 8 | 9 | Test for polygons. 10 | 11 | Asteroids style game demo using polygons. 12 | 13 | .. note:: This example requires the following modules: 14 | 15 | .. hlist:: 16 | :columns: 3 17 | 18 | - `st7789py` 19 | - `tft_config` 20 | - `tft_buttons` 21 | 22 | .. literalinclude:: ../../../examples/roids.py 23 | :language: python 24 | :linenos: 25 | :lines: 1- 26 | 27 | -------------------------------------------------------------------------------- /sphinx/source/examples/rotations.rst: -------------------------------------------------------------------------------- 1 | .. _rotations: 2 | 3 | rotations.py 4 | ============ 5 | 6 | .. figure:: ../_static/rotations.jpg 7 | :align: center 8 | 9 | Test for rotations and colors. 10 | 11 | Rotates the display 0, 90, 180, and 270 degrees and displays the rotation 12 | number and the color of the display background. 13 | 14 | .. note:: This example requires the following modules: 15 | 16 | .. hlist:: 17 | :columns: 3 18 | 19 | - `st7789py` 20 | - `tft_config` 21 | - vga1_16x16 22 | 23 | .. literalinclude:: ../../../examples/rotations.py 24 | :language: python 25 | :linenos: 26 | :lines: 1- 27 | 28 | -------------------------------------------------------------------------------- /sphinx/source/examples/scroll.rst: -------------------------------------------------------------------------------- 1 | .. _scroll: 2 | 3 | scroll.py 4 | ========= 5 | 6 | .. figure:: ../_static/scroll.jpg 7 | :align: center 8 | 9 | Test for hardware scrolling. 10 | 11 | Smoothly scrolls all font characters up the screen. 12 | Only works with fonts with heights that are even multiples of the screen height, 13 | (i.e. 8 or 16 pixels high) 14 | 15 | .. note:: This example requires the following modules: 16 | 17 | .. hlist:: 18 | :columns: 3 19 | 20 | - `st7789py` 21 | - `tft_config` 22 | - `vga2_bold_16x16` 23 | 24 | .. literalinclude:: ../../../examples/scroll.py 25 | :language: python 26 | :linenos: 27 | :lines: 1- 28 | 29 | -------------------------------------------------------------------------------- /sphinx/source/examples/tiny_hello.rst: -------------------------------------------------------------------------------- 1 | .. _tiny_hello: 2 | 3 | tiny_hello.py 4 | ============= 5 | 6 | .. figure:: ../_static/tiny_hello.jpg 7 | :align: center 8 | 9 | Test text_font_converter on small displays. 10 | 11 | Writes "Hello!" in a tiny font in random colors at random locations on the Display. 12 | 13 | .. note:: This example requires the following modules: 14 | 15 | .. hlist:: 16 | :columns: 3 17 | 18 | - `st7789py` 19 | - `tft_config` 20 | - `vga1_8x8` 21 | 22 | .. literalinclude:: ../../../examples/tiny_hello.py 23 | :language: python 24 | :linenos: 25 | :lines: 1- 26 | 27 | -------------------------------------------------------------------------------- /sphinx/source/examples/tiny_toasters.rst: -------------------------------------------------------------------------------- 1 | .. _tiny_toasters: 2 | 3 | tiny_toasters.py 4 | ================ 5 | 6 | .. figure:: ../_static/tiny_toasters.jpg 7 | :align: center 8 | 9 | Test sprites_converter. 10 | 11 | Tiny Flying Toasters for smaller displays using a converted BMP spritesheet module using: 12 | 13 | .. code-block:: console 14 | 15 | `sprites_converter.py ttoasters.bmp 32 32 4 > ttoast_bitmaps.py` 16 | 17 | .. rubric:: The tiny_toasters.py example uses the spritesheet from CircuitPython_Flying_Toasters pendant 18 | project https://learn.adafruit.com/circuitpython-sprite-animation-pendant-mario-clouds-flying-toasters 19 | 20 | 21 | .. note:: This example requires the following modules: 22 | 23 | .. hlist:: 24 | :columns: 3 25 | 26 | - `st7789py` 27 | - `tft_config` 28 | - `tiny_toasters` 29 | 30 | .. literalinclude:: ../../../examples/tiny_toasters/tiny_toasters.py 31 | :language: python 32 | :linenos: 33 | :lines: 1- 34 | 35 | -------------------------------------------------------------------------------- /sphinx/source/genindex.rst: -------------------------------------------------------------------------------- 1 | Index 2 | ##### 3 | 4 | -------------------------------------------------------------------------------- /sphinx/source/index.rst: -------------------------------------------------------------------------------- 1 | st7789py Driver 2 | =============== 3 | 4 | This is a fork of devbis' st7789py_mpy module from 5 | https://github.com/devbis/st7789py_mpy. 6 | 7 | This driver has support for: 8 | 9 | - 320x240, 240x240, 135x240, and 128x128 pixel displays 10 | - RGB and BGR Color Orders 11 | - Display rotation 12 | - Hardware based scrolling 13 | - Drawing text using converted PC BIOS bitmap fonts 14 | - Drawing text using converted TrueType fonts. 15 | - Drawing converted bitmaps 16 | 17 | This is a work in progress. Documentation can be found in the docs directory 18 | and at https://russhughes.github.io/st7789py_mpy. 19 | 20 | 21 | .. toctree:: 22 | :maxdepth: 3 23 | :caption: Contents: 24 | 25 | self 26 | st7789py 27 | examples 28 | fonts 29 | utilities 30 | genindex 31 | -------------------------------------------------------------------------------- /sphinx/source/romfont.py: -------------------------------------------------------------------------------- 1 | """converted from vga_8x8.bin """ 2 | 3 | # font width 4 | WIDTH = 8 5 | 6 | # font height 7 | HEIGHT = 8 8 | 9 | # first character in front 10 | FIRST = 0x20 11 | 12 | # last character in font 13 | LAST = 0x7f 14 | 15 | # bitmap of each character from FIRST to LAST 16 | _FONT =\ 17 | b'\x00\x00\x00\x00\x00\x00\x00\x00'\ 18 | b'\x18\x3c\x3c\x18\x18\x00\x18\x00'\ 19 | b'\x66\x66\x24\x00\x00\x00\x00\x00'\ 20 | 21 | ... many more lines of data... 22 | 23 | b'\x70\x18\x18\x0e\x18\x18\x70\x00'\ 24 | b'\x76\xdc\x00\x00\x00\x00\x00\x00'\ 25 | b'\x00\x10\x38\x6c\xc6\xc6\xfe\x00'\ 26 | 27 | FONT = memoryview(_FONT) 28 | -------------------------------------------------------------------------------- /sphinx/source/st7789py.rst: -------------------------------------------------------------------------------- 1 | st7789py Reference 2 | ================== 3 | 4 | .. automodule:: st7789py 5 | :members: 6 | 7 | -------------------------------------------------------------------------------- /sphinx/source/truetype.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # Converted from Chango-Regular.ttf using: 3 | # ./write_font_converter.py Chango-Regular.ttf 16 -c 0x20-0x7f 4 | 5 | # Maps the order of the character data 6 | MAP = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~" 7 | 8 | # Number of color bits per pixel, currently only 1 is used but could be 9 | # increased to support antialiased or smoothed fonts in the future. 10 | BPP = 1 11 | 12 | # Font height 13 | HEIGHT = 17 14 | 15 | # Font max width 16 | MAX_WIDTH = 24 17 | 18 | # one byte per character table of widths in the same order as the MAP string 19 | _WIDTHS = \ 20 | b'\x06\x08\x0a\x0e\x0d\x18\x10\x06\x08\x08\x0a\x0d\x06\x08\x06\x0b'\ 21 | 22 | ... more lines of data... 23 | 24 | b'\x0d\x0d\x0b\x0a\x0b\x0e\x0c\x12\x0d\x0c\x0b\x09\x06\x09\x0e\x0b' 25 | 26 | # OFFSET_WIDTH bytes per character in the same order as the MAP string 27 | # to the start of each character in bits. 28 | OFFSET_WIDTH = 2 29 | _OFFSETS = \ 30 | b'\x00\x00\x00\x66\x00\xee\x01\x98\x02\x86\x03\x63\x04\xfb\x06\x0b'\ 31 | 32 | ... more lines of data... 33 | 34 | b'\x49\x94\x4a\x71\x4b\x3d\x4b\xf8\x4c\x91\x4c\xf7\x4d\x90\x4e\x7e' 35 | 36 | # character bitmaps per character in the same order as the MAP string. 37 | # Note: character data may not start on byte boundaries 38 | _BITMAPS =\ 39 | b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x61'\ 40 | 41 | ... many more lines of data... 42 | 43 | b'\x3d\xe3\xfc\x00\x00\x00\x00\x00' 44 | 45 | WIDTHS = memoryview(_WIDTHS) 46 | OFFSETS = memoryview(_OFFSETS) 47 | BITMAPS = memoryview(_BITMAPS) 48 | -------------------------------------------------------------------------------- /sphinx/source/utilities.rst: -------------------------------------------------------------------------------- 1 | Utilities 2 | ========= 3 | 4 | .. toctree:: 5 | :glob: 6 | 7 | utilities/* 8 | -------------------------------------------------------------------------------- /sphinx/source/utilities/create_png_examples.rst: -------------------------------------------------------------------------------- 1 | .. _create_png_examples: 2 | 3 | create_png_examples.py 4 | ---------------------- 5 | Reads all font-bin files from the specified `input` directory and writes png images to t 6 | he specified `output` directory. Optionally limiting the characters included to -first-char 7 | (-f) thru -last-char (-l). This is the program I used to create the png font samples in the 8 | documentation. 9 | 10 | .. seealso:: 11 | - :ref:`Bitmap Font Samples`. 12 | 13 | Example 14 | ^^^^^^^ 15 | 16 | .. code-block:: console 17 | 18 | - create_png_examples.py font_directory png_directory 19 | 20 | Usage 21 | ^^^^^ 22 | 23 | .. code-block:: console 24 | 25 | usage: create_png_examples.py [-h] input output 26 | 27 | Creates png samples of each text font file from the input directoryto the output directory. 28 | 29 | positional arguments: 30 | input input directory containing font-bin files 31 | output output directory to create pngs 32 | 33 | optional arguments: 34 | -h, --help show this help message and exit 35 | 36 | -------------------------------------------------------------------------------- /sphinx/source/utilities/image_converter.rst: -------------------------------------------------------------------------------- 1 | .. _image_converter: 2 | 3 | image_converter.py 4 | ------------------ 5 | Convert an image file to a python module for use with the bitmap method. Use redirection to save the 6 | output to a file. The image is converted to a bitmap using the number of bits per pixel you specify. 7 | The bitmap is saved as a python module that can be imported and used with the bitmap method. 8 | 9 | .. seealso:: 10 | - :ref:`alien.py`. 11 | 12 | Example 13 | ^^^^^^^ 14 | 15 | .. code-block:: console 16 | 17 | ./create_png_examples.py cat.png 4 > cat_bitmap.py 18 | 19 | The python file can be imported and displayed with the bitmap method. For example: 20 | 21 | .. code-block:: python 22 | 23 | import tft_config 24 | import cat_bitmap 25 | tft = tft_config.config(1) 26 | tft.bitmap(cat_bitmap, 0, 0) 27 | 28 | Usage 29 | ^^^^^ 30 | 31 | .. code-block:: console 32 | 33 | usage: image_converter.py [-h] image_file bits_per_pixel 34 | 35 | Convert image file to python module for use with bitmap method. 36 | 37 | positional arguments: image_file Name of file containing image to convert bits_per_pixel 38 | The number of bits to use per pixel (1..8) 39 | 40 | optional arguments: -h, --help show this help message and exit 41 | 42 | -------------------------------------------------------------------------------- /sphinx/source/utilities/make_colorbars_bitmap.rst: -------------------------------------------------------------------------------- 1 | .. _make_colorbars_bitmap: 2 | 3 | make_colorbars_bitmap.py 4 | ------------------------ 5 | Create a MicroPython bitmap module with WHITE, YELLOW, CYAN, GREEN, MAGENTA, RED, and BLUE 6 | color bars for testing. Use redirection to save the output to a file. The bitmap is saved 7 | as a python module that can be imported and used with the bitmap method. 8 | 9 | .. seealso:: 10 | :ref:`colorbars.py`. 11 | 12 | Example 13 | ^^^^^^^ 14 | 15 | .. code-block:: console 16 | 17 | ./make_colorbars_bitmap.py 320 240 3 > colorbars_bitmap320x240.py 18 | 19 | The python file can be imported and displayed with the bitmap method. For example: 20 | 21 | .. code-block:: python 22 | 23 | import tft_config 24 | import colorbars_bitmap320x240 25 | tft = tft_config.config(1) 26 | tft.bitmap(colorbars_bitmap320x240, 0, 0) 27 | 28 | Usage 29 | ^^^^^ 30 | 31 | .. code-block:: console 32 | 33 | usage: make_colorbars_bitmap.py [-h] [--png png] width height bits_per_pixel 34 | 35 | Create a bitmap module with color bars for use with the bitmap method. 36 | 37 | positional arguments: 38 | width The width of the image in pixels 39 | height The height of the image in pixels 40 | bits_per_pixel The number of bits to use per pixel (1..8) 41 | 42 | optional arguments: 43 | -h, --help show this help message and exit 44 | --png png Optionally create png file 45 | 46 | -------------------------------------------------------------------------------- /sphinx/source/utilities/sprites_converter.rst: -------------------------------------------------------------------------------- 1 | .. _sprites_converter: 2 | 3 | sprites_converter.py 4 | -------------------- 5 | Convert a sprite sheet image to python a module for use with indexed bitmap method. The Sprite sheet 6 | width and height should be a multiple of sprite width and height. There should be no extra pixels 7 | between sprites. All sprites will share the same palette. 8 | 9 | .. seealso:: 10 | - :ref:`tiny_toasters.py`. 11 | 12 | Example 13 | ^^^^^^^ 14 | 15 | .. code-block:: console 16 | 17 | # create a sprite sheet with 7 colored sprites 32x32 pixels each 18 | ./make_colorbars_bitmap.py 227 32 3 --png sprites.png 19 | 20 | # convert the sprite sheet to a python module with 7 sprites 21 | ./sprites_converter.py sprites.png 32 32 4 > sprites.py 22 | 23 | .. code-block:: python 24 | 25 | import tft_config 26 | import sprites 27 | tft = tft_config.config(1) 28 | for i in range(sprites.BITMAPS): 29 | tft.bitmap(sprites, 0, 0, i) 30 | 31 | Usage 32 | ^^^^^ 33 | 34 | .. code-block:: console 35 | 36 | usage: sprites_converter.py [-h] image_file sprite_width sprite_height bits_per_pixel 37 | 38 | Convert image file to python module for use with bitmap method. 39 | 40 | positional arguments: 41 | image_file Name of file containing image to convert 42 | sprite_width Width of sprites in pixels 43 | sprite_height Height of sprites in pixels 44 | bits_per_pixel The number of bits to use per pixel (1..8) 45 | 46 | optional arguments: 47 | -h, --help show this help message and exit 48 | 49 | -------------------------------------------------------------------------------- /sphinx/source/utilities/text_font_converter.rst: -------------------------------------------------------------------------------- 1 | .. _text_font_converter: 2 | 3 | text_font_converter.py 4 | ---------------------- 5 | Convert fonts from the font-bin directory of spacerace's https://github.com/spacerace/romfont 6 | VGA and BIOS rom font repo. Optionally limiting the characters included to -first-char (-f) thru 7 | -last-char (-l). 8 | 9 | Input can be a file or a directory containing multiple font files. If input is a directory, output 10 | must also be a directory. If input is a file, output can be a file or a directory. 11 | 12 | .. seealso:: 13 | - :ref:`color_test.py`. 14 | - :ref:`fonts.py`. 15 | - :ref:`hello.py`. 16 | - :ref:`rotations.py`. 17 | - :ref:`scroll.py`. 18 | - :ref:`tiny_toasters.py`. 19 | 20 | Example 21 | ^^^^^^^ 22 | 23 | .. code-block:: console 24 | 25 | # convert the IBM_VGA_8x8.bin font to a python module with 8x8 characters 26 | text_font_converter.py romfont/font-bin/IBM_VGA_8x8.bin vga_8x8.py -f 32 -l 127 27 | 28 | .. code-block:: python 29 | 30 | import tft_config 31 | import vga_8x8 32 | tft = tft_config.config(1) 33 | tft.bitmap(vga_8x8, "Hello World!", 0, 0) 34 | 35 | Usage 36 | ^^^^^ 37 | 38 | .. code-block:: console 39 | 40 | usage: text_font_converter.py [-h] [-f FIRST_CHAR] [-l LAST_CHAR] input output 41 | 42 | Convert romfont.bin file or directory to python module(s). 43 | 44 | positional arguments: 45 | input file or directory containing binary font file(s). 46 | output file or directory to contain python font file(s). 47 | 48 | optional arguments: 49 | -h, --help show this help message and exit 50 | -f FIRST_CHAR, --first-char FIRST_CHAR 51 | The first character code to include in the conversion (default: 0x20). 52 | -l LAST_CHAR, --last-char LAST_CHAR 53 | The last character code to include in the conversion (default: 0x7F). 54 | 55 | -------------------------------------------------------------------------------- /sphinx/source/utilities/write_font_converter.rst: -------------------------------------------------------------------------------- 1 | .. _write_font_converter: 2 | 3 | write_font_converter.py 4 | ----------------------- 5 | Convert characters from a truetype font to a python bitmap for use with the bitmap or write method. 6 | The chango, noto_fonts and proverbs examples use converted TrueType fonts. 7 | 8 | .. seealso:: 9 | - :ref:`chango.py`. 10 | - :ref:`noto_fonts.py`. 11 | - :ref:`proverbs.py`. 12 | 13 | Example 14 | ^^^^^^^ 15 | 16 | .. code-block:: console 17 | 18 | # convert the Chango-Regular.ttf to a python bitmap module with approximately 32 pixel high characters 19 | ./write_font_converter.py Chango-Regular.ttf 32 -c 0x20-0x7f > chango_32.py 20 | 21 | .. code-block:: python 22 | 23 | import tft_config 24 | import chango_32 25 | tft = tft_config.config(1) 26 | tft.write(chango_32, "Hello World!", 0, 0) 27 | 28 | Usage 29 | ^^^^^ 30 | 31 | .. code-block:: console 32 | 33 | usage: write_font_converter.py [-h] [-width FONT_WIDTH] (-c CHARACTERS | -s STRING) font_file font_height 34 | 35 | Convert characters from a truetype font to a python bitmap for use with the bitmap method in the st7789 and ili9342 drivers. 36 | 37 | positional arguments: 38 | font_file name of font file to convert. 39 | font_height size of font to create bitmaps from. 40 | 41 | optional arguments: 42 | -h, --help show this help message and exit 43 | -width FONT_WIDTH, --font_width FONT_WIDTH 44 | width of font to create bitmaps from. 45 | 46 | character selection: 47 | characters from the font to include in the bitmap. 48 | 49 | -c CHARACTERS, --characters CHARACTERS 50 | integer or hex character values and/or ranges to include. For example: "65, 66, 67" or "32-127" or "0x30-0x39, 51 | 0x41-0x5a" 52 | -s STRING, --string STRING 53 | string of characters to include For example: "1234567890-." 54 | 55 | -------------------------------------------------------------------------------- /sphinx/update.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | ./make-examples.sh && make clean && make html && make update && make clean 4 | 5 | -------------------------------------------------------------------------------- /tft_configs/atom_s3/tft_buttons.py: -------------------------------------------------------------------------------- 1 | """ 2 | M5STACK AtomS3 buttons 3 | """ 4 | 5 | from machine import Pin 6 | 7 | class Buttons(): 8 | """ 9 | Buttons class for examples, modify for your device. 10 | 11 | Attributes: 12 | name (str): The name of the device. 13 | left (Pin): The Pin object representing the left button. 14 | right (Pin): The Pin object representing the right button. 15 | fire (Pin): The Pin object representing the fire button. 16 | thrust (Pin): The Pin object representing the thrust button. 17 | hyper (Pin): The Pin object representing the hyper button. 18 | """ 19 | 20 | def __init__(self): 21 | self.name = "AtomS3" 22 | self.left = None 23 | self.right = None 24 | self.fire = None 25 | self.thrust = None 26 | self.hyper = None 27 | -------------------------------------------------------------------------------- /tft_configs/atom_s3/tft_config.py: -------------------------------------------------------------------------------- 1 | """M5STACK AtomS3 128x128 (GC9107) 2 | 3 | https://docs.m5stack.com/en/core/AtomS3 4 | 5 | """ 6 | 7 | from machine import Pin, SPI 8 | import st7789py as st7789 9 | 10 | TFA = 1 11 | BFA = 3 12 | WIDE = 1 13 | TALL = 0 14 | SCROLL = 0 # orientation for scroll.py 15 | FEATHERS = 1 # orientation for feathers.py 16 | 17 | def config(rotation=0): 18 | """ 19 | Configures and returns an instance of the ST7789 display driver. 20 | 21 | Args: 22 | rotation (int): The rotation of the display (default: 0). 23 | 24 | Returns: 25 | ST7789: An instance of the ST7789 display driver. 26 | """ 27 | 28 | return st7789.ST7789( 29 | SPI(2, baudrate=40000000, sck=Pin(17), mosi=Pin(21), miso=None), 30 | 128, 31 | 128, 32 | reset=Pin(34, Pin.OUT), 33 | cs=Pin(15, Pin.OUT), 34 | dc=Pin(33, Pin.OUT), 35 | backlight=Pin(16, Pin.OUT), 36 | rotation=rotation, 37 | color_order=st7789.BGR, 38 | ) 39 | -------------------------------------------------------------------------------- /tft_configs/esp32-2432S028r_st7789/tft_config.py: -------------------------------------------------------------------------------- 1 | """ ESP32-2432S028R 320x240 st7789 display sometimes known as "Cheap Yellow Board" (CYD) - this is the v3 board 2 | 3 | """ 4 | 5 | from machine import Pin, SPI 6 | import st7789py as st7789 7 | 8 | TFA = 40 9 | BFA = 40 10 | WIDE = 1 11 | TALL = 0 12 | SCROLL = 0 # orientation for scroll.py 13 | FEATHERS = 1 # orientation for feathers.py 14 | 15 | def config(rotation=0): 16 | """ 17 | Configures and returns an instance of the ST7789 display driver. 18 | 19 | Args: 20 | rotation (int): The rotation of the display (default: 0). 21 | 22 | Returns: 23 | ST7789: An instance of the ST7789 display driver. 24 | """ 25 | 26 | return st7789.ST7789( 27 | SPI(1, baudrate=40000000, sck=Pin(14), mosi=Pin(13), miso=None), 28 | 240, 29 | 320, 30 | reset=Pin(0, Pin.OUT), 31 | cs=Pin(15, Pin.OUT), 32 | dc=Pin(2, Pin.OUT), 33 | backlight=Pin(21, Pin.OUT), 34 | rotation=rotation) 35 | -------------------------------------------------------------------------------- /tft_configs/esp32_320x240/tft_buttons.py: -------------------------------------------------------------------------------- 1 | """ 2 | Generic ESP32 with Two buttons 3 | """ 4 | 5 | from machine import Pin 6 | 7 | class Buttons(): 8 | """ 9 | Buttons class for examples, modify for your device. 10 | 11 | Attributes: 12 | name (str): The name of the device. 13 | left (Pin): The Pin object representing the left button. 14 | right (Pin): The Pin object representing the right button. 15 | fire (Pin): The Pin object representing the fire button. 16 | thrust (Pin): The Pin object representing the thrust button. 17 | hyper (Pin): The Pin object representing the hyper button. 18 | """ 19 | 20 | def __init__(self): 21 | self.name = "esp32" 22 | self.left = Pin(0, Pin.IN) 23 | self.right = Pin(35, Pin.IN) 24 | self.fire = None 25 | self.thrust = None 26 | self.hyper = None 27 | -------------------------------------------------------------------------------- /tft_configs/esp32_320x240/tft_config.py: -------------------------------------------------------------------------------- 1 | """Generic ESP32 320x240 2 | 3 | """ 4 | 5 | from machine import Pin, SPI 6 | import st7789py as st7789 7 | 8 | TFA = 40 9 | BFA = 40 10 | WIDE = 1 11 | TALL = 0 12 | SCROLL = 0 # orientation for scroll.py 13 | FEATHERS = 1 # orientation for feathers.py 14 | 15 | def config(rotation=0): 16 | """ 17 | Configures and returns an instance of the ST7789 display driver. 18 | 19 | Args: 20 | rotation (int): The rotation of the display (default: 0). 21 | 22 | Returns: 23 | ST7789: An instance of the ST7789 display driver. 24 | """ 25 | 26 | return st7789.ST7789( 27 | SPI(2, baudrate=40000000, sck=Pin(18), mosi=Pin(19), miso=None), 28 | 135, 29 | 240, 30 | reset=Pin(23, Pin.OUT), 31 | cs=Pin(5, Pin.OUT), 32 | dc=Pin(16, Pin.OUT), 33 | backlight=Pin(4, Pin.OUT), 34 | rotation=rotation) 35 | -------------------------------------------------------------------------------- /tft_configs/m5stack_core/tft_buttons.py: -------------------------------------------------------------------------------- 1 | 2 | # input pins for ws_pico_13 3 | 4 | from machine import Pin 5 | 6 | 7 | class Buttons(): 8 | """ 9 | Buttons class for examples, modify for your device. 10 | 11 | Attributes: 12 | name (str): The name of the device. 13 | left (Pin): The Pin object representing the left button. 14 | right (Pin): The Pin object representing the right button. 15 | fire (Pin): The Pin object representing the fire button. 16 | thrust (Pin): The Pin object representing the thrust button. 17 | hyper (Pin): The Pin object representing the hyper button. 18 | """ 19 | 20 | def __init__(self): 21 | self.name = "m5stack_core" 22 | 23 | self.left = Pin(39, Pin.IN) # button A 24 | self.fire = Pin(38, Pin.IN) # button B 25 | self.right = Pin(37, Pin.IN) # button C 26 | self.thrust = None 27 | self.hyper = None 28 | -------------------------------------------------------------------------------- /tft_configs/m5stack_core/tft_config.py: -------------------------------------------------------------------------------- 1 | """M5STACK CORE 320x240 (ILI9342) 2 | """ 3 | 4 | from machine import Pin, SPI 5 | import st7789py as st7789 6 | 7 | TFA = 0 8 | BFA = 0 9 | WIDE = 0 10 | TALL = 1 11 | SCROLL = 0 # orientation for scroll.py 12 | FEATHERS = 1 # orientation for feathers.py 13 | 14 | def config(rotation=0): 15 | """Configure the M5Stack CORE display using a custom_init and 16 | custom_rotations since the display is ili9342c. The custom_init is a 17 | list of commands to send to the display during the init() metehod. The 18 | list contains tuples with a bytes object, optionally followed by a 19 | delay specified in ms. The first byte of the bytes object contains the 20 | command to send optionally followed by data bytes. 21 | """ 22 | 23 | custom_init = ( 24 | (b'\x11', None, 150), # exit sleep 25 | (b'\xCB', b'\x39\x2C\x00\x34\x02', 0), # power control A 26 | (b'\xCF', b'\x00\xC1\x30', 0), # power control B 27 | (b'\xE8', b'\x85\x00\x78', 0), # driver timing control A 28 | (b'\xEA', b'\x00\x00', 0), # driver timing control B 29 | (b'\xED', b'\x64\x03\x12\x81', 0), # power on sequence control 30 | (b'\xF7', b'\x20', 0), # pump ratio control 31 | (b'\xC0', b'\x23', 0), # power control,VRH[5:0] 32 | (b'\xC1', b'\x10', 0), # Power control,SAP[2:0];BT[3:0] 33 | (b'\xC5', b'\x3E\x28', 0), # vcm control 34 | (b'\xC7', b'\x86', 0), # vcm control 2 35 | (b'\x3A', b'\x55', 0), # pixel format 36 | (b'\x36', b'\x00', 0), # madctl 37 | (b'\x21', None, 0), # inversion on 38 | (b'\xB1', b'\x00\x18', 0), # frameration control,normal mode full colours 39 | (b'\xB6', b'\x08\x82\x27', 0), # display function control 40 | (b'\xF2', b'\x00', 0), # 3gamma function disable 41 | (b'\x26', b'\x01', 0), # gamma curve selected 42 | # set positive gamma correction 43 | (b'\xE0', b'\x0F\x31\x2B\x0C\x0E\x08\x4E\xF1\x37\x07\x10\x03\x0E\x09\x00', 0), 44 | # set negative gamma correction 45 | (b'\xE1', b'\x00\x0E\x14\x03\x11\x07\x31\xC1\x48\x08\x0F\x0C\x31\x36\x0F', 0), 46 | (b'\x29', None, 100), # display on 47 | ) 48 | 49 | custom_rotations = ( 50 | (0x08, 320, 240, 0, 0, False), 51 | (0x68, 240, 320, 0, 0, False), 52 | (0xc8, 320, 240, 0, 0, False), 53 | (0xa8, 240, 320, 0, 0, False), 54 | ) 55 | 56 | return st7789.ST7789( 57 | SPI(2, baudrate=40000000, sck=Pin(18), mosi=Pin(23)), 58 | 320, 59 | 240, 60 | reset=Pin(33, Pin.OUT), 61 | cs=Pin(14, Pin.OUT), 62 | dc=Pin(27, Pin.OUT), 63 | backlight=Pin(32, Pin.OUT), 64 | custom_init=custom_init, 65 | custom_rotations=custom_rotations, 66 | rotation=rotation) 67 | -------------------------------------------------------------------------------- /tft_configs/m5stack_core2/tft_buttons.py: -------------------------------------------------------------------------------- 1 | """input pins for M5Stack Core2 buttons""" 2 | 3 | from machine import Pin 4 | 5 | 6 | class Buttons: 7 | """ 8 | Buttons class for examples, modify for your device. 9 | 10 | Attributes: 11 | name (str): The name of the device. 12 | left (Pin): The Pin object representing the left button. 13 | right (Pin): The Pin object representing the right button. 14 | fire (Pin): The Pin object representing the fire button. 15 | thrust (Pin): The Pin object representing the thrust button. 16 | hyper (Pin): The Pin object representing the hyper button. 17 | """ 18 | 19 | def __init__(self): 20 | self.name = "m5stack_core2" 21 | self.left = None 22 | self.right = None 23 | self.fire = None 24 | self.thrust = None 25 | self.hyper = None 26 | -------------------------------------------------------------------------------- /tft_configs/m5stack_core2/tft_config.py: -------------------------------------------------------------------------------- 1 | """M5STACK CORE2 320x240 (ILI9342) 2 | """ 3 | 4 | from machine import Pin, SPI 5 | import st7789py as st7789 6 | import axp202c 7 | 8 | TFA = 0 9 | BFA = 0 10 | WIDE = 0 11 | TALL = 1 12 | SCROLL = 0 # orientation for scroll.py 13 | FEATHERS = 1 # orientation for feathers.py 14 | 15 | def config(rotation=0): 16 | """Configure the M5Stack CORE2 display using a custom_init and 17 | custom_rotations since the display is ili9342c. The custom_init is a 18 | list of commands to send to the display during the init() metehod. The 19 | list contains tuples with a bytes object, optionally followed by a 20 | delay specified in ms. The first byte of the bytes object contains the 21 | command to send optionally followed by data bytes. 22 | """ 23 | custom_init = [ 24 | (b'\x01', None, 150), # soft reset 25 | (b'\x11', None, 255), # exit sleep 26 | (b'\xCB', b'\x39\x2C\x00\x34\x02', 0), # power control A 27 | (b'\xCF', b'\x00\xC1\x30', 0), # power control B 28 | (b'\xE8', b'\x85\x00\x78', 0), # driver timing control A 29 | (b'\xEA', b'\x00\x00', 0), # driver timing control B 30 | (b'\xED', b'\x64\x03\x12\x81', 0), # power on sequence control 31 | (b'\xF7', b'\x20', 0), # pump ratio control 32 | (b'\xC0', b'\x23', 0), # power control,VRH[5:0] 33 | (b'\xC1', b'\x10', 0), # Power control,SAP[2:0];BT[3:0] 34 | (b'\xC5', b'\x3E\x28', 0), # vcm control 35 | (b'\xC7', b'\x86', 0), # vcm control 2 36 | (b'\x3A', b'\x55', 0), # pixel format 37 | (b'\x36', b'\x00', 0), # madctl 38 | (b'\x21', None, 0), # inversion on 39 | (b'\xB1', b'\x00\x18', 0), # frameration control,normal mode full colours 40 | (b'\xB6', b'\x08\x82\x27', 0), # display function control 41 | (b'\xF2', b'\x00', 0), # 3gamma function disable 42 | (b'\x26', b'\x01', 0), # gamma curve selected 43 | # set positive gamma correction 44 | (b'\xE0', b'\x0F\x31\x2B\x0C\x0E\x08\x4E\xF1\x37\x07\x10\x03\x0E\x09\x00', 0), 45 | # set negative gamma correction 46 | (b'\xE1', b'\x00\x0E\x14\x03\x11\x07\x31\xC1\x48\x08\x0F\x0C\x31\x36\x0F', 0), 47 | (b'\x29', None, 100), # display on 48 | ] 49 | 50 | custom_rotations = [ 51 | (0x08, 320, 240, 0, 0, False), 52 | (0x68, 240, 320, 0, 0, False), 53 | (0xc8, 320, 240, 0, 0, False), 54 | (0xa8, 240, 320, 0, 0, False), 55 | ] 56 | 57 | axp = axp202c.PMU(address=0x34) 58 | axp.enablePower(axp202c.AXP192_LDO2) 59 | # Set backlight voltage 60 | axp.setDC3Voltage(3000) 61 | 62 | return st7789.ST7789( 63 | SPI(2, baudrate=40000000, sck=Pin(18), mosi=Pin(23)), 64 | 320, 65 | 240, 66 | cs=Pin(5, Pin.OUT), 67 | dc=Pin(15, Pin.OUT), 68 | custom_init=custom_init, 69 | custom_rotations=custom_rotations, 70 | rotation=rotation, 71 | color_order=st7789.BGR) 72 | -------------------------------------------------------------------------------- /tft_configs/m5stack_core3/tft_buttons.py: -------------------------------------------------------------------------------- 1 | # M5STACK CORES3 2 | # - Not working with DUAL BUTTON unit 3 | 4 | # DIN Base 5 | # Port A 1, 2 6 | # Port B 8, 9 7 | # Port C 18, 17 8 | 9 | from machine import Pin 10 | 11 | class Buttons: 12 | """ 13 | Buttons class for examples, modify for your device. 14 | 15 | Attributes: 16 | name (str): The name of the device. 17 | left (Pin): The Pin object representing the left button. 18 | right (Pin): The Pin object representing the right button. 19 | fire (Pin): The Pin object representing the fire button. 20 | thrust (Pin): The Pin object representing the thrust button. 21 | hyper (Pin): The Pin object representing the hyper button. 22 | """ 23 | 24 | def __init__(self): 25 | self.name = "m5stack_cores3" 26 | self.left = Pin(1, Pin.IN, Pin.PULL_UP) # PORT A 27 | self.right = Pin(2, Pin.IN, Pin.PULL_UP) # PORT A 28 | self.fire = None 29 | self.thrust = None 30 | self.hyper = None 31 | -------------------------------------------------------------------------------- /tft_configs/m5stack_core3/tft_config.py: -------------------------------------------------------------------------------- 1 | """M5STACK CoreS3 320x240 (ILI9342) 2 | """ 3 | 4 | from machine import Pin, SPI 5 | import m5cores3 6 | import st7789py as st7789 7 | 8 | 9 | TFA = 0 10 | BFA = 0 11 | WIDE = 0 12 | TALL = 1 13 | SCROLL = 0 # orientation for scroll.py 14 | FEATHERS = 1 # orientation for feathers.py 15 | 16 | 17 | def config(rotation=0): 18 | """ 19 | Configures and returns an instance of the ST7789 display driver. 20 | 21 | Args: 22 | rotation (int): The rotation of the display (default: 0). 23 | 24 | Returns: 25 | ST7789: An instance of the ST7789 display driver. 26 | """ 27 | 28 | custom_init = ( 29 | (b"\x01", None, 150), # soft reset 30 | (b"\x11", None, 255), # exit sleep 31 | (b"\xCB", b"\x39\x2C\x00\x34\x02", 0), # power control A 32 | (b"\xCF", b"\x00\xC1\x30", 0), # power control B 33 | (b"\xE8", b"\x85\x00\x78", 0), # driver timing control A 34 | (b"\xEA", b"\x00\x00", 0), # driver timing control B 35 | (b"\xED", b"\x64\x03\x12\x81", 0), # power on sequence control 36 | (b"\xF7", b"\x20", 0), # pump ratio control 37 | (b"\xC0", b"\x23", 0), # power control,VRH[5:0] 38 | (b"\xC1", b"\x10", 0), # Power control,SAP[2:0];BT[3:0] 39 | (b"\xC5", b"\x3E\x28", 0), # vcm control 40 | (b"\xC7", b"\x86", 0), # vcm control 2 41 | (b"\x3A", b"\x55", 0), # pixel format 42 | (b"\x36", b"\x08", 0), # madctl 43 | (b"\x21", None, 0), # inversion on 44 | (b"\xB1", b"\x00\x18", 0), # frameration control,normal mode full colours 45 | (b"\xB6", b"\x08\x82\x27", 0), # display function control 46 | (b"\xF2", b"\x00", 0), # 3gamma function disable 47 | (b"\x26", b"\x01", 0), # gamma curve selected 48 | # set positive gamma correction 49 | (b"\xE0", b"\x0F\x31\x2B\x0C\x0E\x08\x4E\xF1\x37\x07\x10\x03\x0E\x09\x00", 0), 50 | # set negative gamma correction 51 | (b"\xE1", b"\x00\x0E\x14\x03\x11\x07\x31\xC1\x48\x08\x0F\x0C\x31\x36\x0F", 0), 52 | (b"\x29", None, 100), # display on 53 | ) 54 | 55 | custom_rotations = ( 56 | (0x08, 320, 240, 0, 0, False), 57 | (0x68, 240, 320, 0, 0, False), 58 | (0xc8, 320, 240, 0, 0, False), 59 | (0xa8, 240, 320, 0, 0, False), 60 | ) 61 | 62 | return st7789.ST7789( 63 | SPI(2, baudrate=20000000, sck=Pin(36), mosi=Pin(37), miso=None), 64 | 240, 65 | 320, 66 | cs=Pin(3, Pin.OUT), 67 | dc=Pin(35, Pin.OUT), 68 | custom_init=custom_init, 69 | custom_rotations=custom_rotations, 70 | rotation=rotation, 71 | color_order=st7789.BGR) 72 | -------------------------------------------------------------------------------- /tft_configs/rp2040_touch_lcd_128/tft_buttons.py: -------------------------------------------------------------------------------- 1 | """RP2040-Touch-LCD-1.28""" 2 | 3 | from machine import Pin 4 | 5 | 6 | class Buttons: 7 | """ 8 | Buttons class for examples, modify for your device. 9 | 10 | Attributes: 11 | name (str): The name of the device. 12 | left (Pin): The Pin object representing the left button. 13 | right (Pin): The Pin object representing the right button. 14 | fire (Pin): The Pin object representing the fire button. 15 | thrust (Pin): The Pin object representing the thrust button. 16 | hyper (Pin): The Pin object representing the hyper button. 17 | """ 18 | 19 | def __init__(self): 20 | self.name = "RP2040-Touch-LCD-1.28" 21 | self.left = None 22 | self.right = None 23 | self.fire = None 24 | self.thrust = None 25 | self.hyper = None 26 | -------------------------------------------------------------------------------- /tft_configs/rp2040_touch_lcd_128/tft_config.py: -------------------------------------------------------------------------------- 1 | """RP2040-Touch-LCD-1.28 240x240 (GC9A01) 2 | """ 3 | 4 | from machine import Pin, SPI 5 | import st7789py as st7789 6 | 7 | TFA = 0 8 | BFA = 0 9 | WIDE = 1 10 | TALL = 0 11 | SCROLL = 0 # orientation for scroll.py 12 | FEATHERS = 1 # orientation for feathers.py 13 | 14 | def config(rotation=0): 15 | """ 16 | Configures and returns an instance of the ST7789 display driver. 17 | 18 | Args: 19 | rotation (int): The rotation of the display (default: 0). 20 | 21 | Returns: 22 | ST7789: An instance of the ST7789 display driver. 23 | """ 24 | 25 | INIT_CMDS = ( 26 | (b"\xEF", None, 0), 27 | (b"\xEB", b"\x14", 0), 28 | (b"\xFE", None, 0), 29 | (b"\xEF", None, 0), 30 | (b"\xEB", b"\x14", 0), 31 | (b"\x84", b"\x40", 0), 32 | (b"\x85", b"\xFF", 0), 33 | (b"\x86", b"\xFF", 0), 34 | (b"\x87", b"\xFF", 0), 35 | (b"\x88", b"\x0A", 0), 36 | (b"\x89", b"\x21", 0), 37 | (b"\x8A", b"\x00", 0), 38 | (b"\x8B", b"\x80", 0), 39 | (b"\x8C", b"\x01", 0), 40 | (b"\x8D", b"\x01", 0), 41 | (b"\x8E", b"\xFF", 0), 42 | (b"\x8F", b"\xFF", 0), 43 | (b"\xB6", b"\x00\x00", 0), 44 | (b"\x3A", b"\x55", 0), 45 | (b"\x90", b"\x08\x08\x08\x08", 0), 46 | (b"\xBD", b"\x06", 0), 47 | (b"\xBC", b"\x00", 0), 48 | (b"\xFF", b"\x60\x01\x04", 0), 49 | (b"\xC3", b"\x13", 0), 50 | (b"\xC4", b"\x13", 0), 51 | (b"\xC9", b"\x22", 0), 52 | (b"\xBE", b"\x11", 0), 53 | (b"\xE1", b"\x10\x0E", 0), 54 | (b"\xDF", b"\x21\x0c\x02", 0), 55 | (b"\xF0", b"\x45\x09\x08\x08\x26\x2A", 0), 56 | (b"\xF1", b"\x43\x70\x72\x36\x37\x6F", 0), 57 | (b"\xF2", b"\x45\x09\x08\x08\x26\x2A", 0), 58 | (b"\xF3", b"\x43\x70\x72\x36\x37\x6F", 0), 59 | (b"\xED", b"\x1B\x0B", 0), 60 | (b"\xAE", b"\x77", 0), 61 | (b"\xCD", b"\x63", 0), 62 | (b"\x70", b"\x07\x07\x04\x0E\x0F\x09\x07\x08\x03", 0), 63 | (b"\xE8", b"\x34", 0), 64 | (b"\x62", b"\x18\x0D\x71\xED\x70\x70\x18\x0F\x71\xEF\x70\x70", 0), 65 | (b"\x63", b"\x18\x11\x71\xF1\x70\x70\x18\x13\x71\xF3\x70\x70", 0), 66 | (b"\x64", b"\x28\x29\xF1\x01\xF1\x00\x07", 0), 67 | (b"\x66", b"\x3C\x00\xCD\x67\x45\x45\x10\x00\x00\x00", 0), 68 | (b"\x67", b"\x00\x3C\x00\x00\x00\x01\x54\x10\x32\x98", 0), 69 | (b"\x74", b"\x10\x85\x80\x00\x00\x4E\x00", 0), 70 | (b"\x98", b"\x3e\x07", 0), 71 | (b"\x35", None, 0), 72 | (b"\x21", None, 0), 73 | (b"\x11", None, 120), 74 | (b"\x29", None, 120), 75 | ) 76 | 77 | DISPLAY_240x240 = ( 78 | (0x48, 240, 240, 0, 0, False), 79 | (0x28, 240, 240, 0, 0, False), 80 | (0x88, 240, 240, 0, 0, False), 81 | (0xe8, 240, 240, 0, 0, False)) 82 | 83 | spi = SPI(1, baudrate=60000000, sck=Pin(10), mosi=Pin(11)) 84 | return st7789.ST7789( 85 | spi, 86 | 240, 87 | 240, 88 | reset=Pin(13, Pin.OUT), 89 | cs=Pin(9, Pin.OUT), 90 | dc=Pin(8, Pin.OUT), 91 | backlight=Pin(25, Pin.OUT), 92 | rotation=rotation, 93 | custom_init=INIT_CMDS, 94 | custom_rotations=DISPLAY_240x240, 95 | ) 96 | -------------------------------------------------------------------------------- /tft_configs/t-dongle-s3/tft_buttons.py: -------------------------------------------------------------------------------- 1 | """esp32 T-Dongle-S3 Buttons 2 | """ 3 | 4 | from machine import Pin 5 | 6 | 7 | class Buttons: 8 | """ 9 | Buttons class for examples, modify for your device. 10 | 11 | Attributes: 12 | name (str): The name of the device. 13 | left (Pin): The Pin object representing the left button. 14 | right (Pin): The Pin object representing the right button. 15 | fire (Pin): The Pin object representing the fire button. 16 | thrust (Pin): The Pin object representing the thrust button. 17 | hyper (Pin): The Pin object representing the hyper button. 18 | """ 19 | 20 | def __init__(self): 21 | self.name = "t-dongle-s3" 22 | self.button = Pin(0, Pin.IN) 23 | self.left = self.button 24 | self.right = self.button 25 | 26 | # need more buttons for roids.py 27 | self.fire = None 28 | self.thrust = None 29 | self.hyper = None 30 | -------------------------------------------------------------------------------- /tft_configs/t-dongle-s3/tft_config.py: -------------------------------------------------------------------------------- 1 | """LilyGo T-Dongle-S3 80x160 (ST7735) 2 | """ 3 | 4 | from machine import Pin, SPI 5 | import st7789py as st7789 6 | 7 | 8 | TFA = 1 9 | BFA = 1 10 | WIDE = 1 11 | TALL = 0 12 | SCROLL = 0 # orientation for scroll.py 13 | FEATHERS = 1 # orientation for feathers.py 14 | 15 | def config(rotation=0): 16 | """ 17 | Configures and returns an instance of the ST7789 display driver. 18 | 19 | Args: 20 | rotation (int): The rotation of the display (default: 0). 21 | 22 | Returns: 23 | ST7789: An instance of the ST7789 display driver. 24 | """ 25 | 26 | init_cmds = ( 27 | (b'\xCF', b'\x00\x83\x30', 0), 28 | (b'\xED', b'\x64\x03\x12\x81', 0), 29 | (b'\xE8', b'\x85\x01\x79', 0), 30 | (b'\xCB', b'\x39\x2C\x00\x34\x02', 0), 31 | (b'\xF7', b'\x20', 0), 32 | (b'\xEA', b'\x00\x00', 0), 33 | (b'\xC0', b'\x26', 0), 34 | (b'\xC1', b'\x11', 0), 35 | (b'\xC5', b'\x35\x3E', 0), 36 | (b'\xC7', b'\xBE', 0), 37 | (b'\x3A', b'\x55', 0), 38 | (b'\xB1', b'\x00\x1B', 0), 39 | (b'\xF2', b'\x08', 0), 40 | (b'\x26', b'\x01', 0), 41 | (b'\xE0', b'\x1F\x1A\x18\x0A\x0F\x06\x45\x87\x32\x0A\x07\x02\x07\x05\x00', 0), 42 | (b'\xE1', b'\x00\x25\x27\x05\x10\x09\x3A\x78\x4D\x05\x18\x0D\x38\x3A\x1F', 0), 43 | (b'\x2A', b'\x00\x00\x00\xEF', 0), 44 | (b'\x2B', b'\x00\x00\x01\x3f', 0), 45 | (b'\x2C', None, 0), 46 | (b'\xB7', b'\x07', 0), 47 | (b'\xB6', b'\x0A\x82\x27\x00', 0), 48 | (b'\x21', None, 0), 49 | (b'\x11', None, 100), 50 | (b'\x29', None, 100) 51 | ) 52 | 53 | custom_rotations = ( 54 | (0x00, 80, 160, 26, 1, False), 55 | (0x60, 160, 80, 1, 26, False), 56 | (0xc0, 80, 160, 26, 1, False), 57 | (0xa0, 160, 80, 1, 26, False), 58 | ) 59 | 60 | return st7789.ST7789( 61 | SPI(1, baudrate=20000000, sck=Pin(5), mosi=Pin(3), miso=None), 62 | 80, 63 | 160, 64 | reset=Pin(1, Pin.OUT), 65 | cs=Pin(4, Pin.OUT), 66 | dc=Pin(2, Pin.OUT), 67 | backlight=Pin(37, Pin.OUT), 68 | rotation=rotation, 69 | color_order=st7789.BGR, 70 | custom_init=init_cmds, 71 | custom_rotations=custom_rotations, 72 | ) 73 | -------------------------------------------------------------------------------- /tft_configs/t-embed/tft_buttons.py: -------------------------------------------------------------------------------- 1 | # input pins for buttons: you will need to change these to match your wiring 2 | 3 | from machine import Pin 4 | 5 | 6 | class Buttons: 7 | """ 8 | Buttons class for examples, modify for your device. 9 | 10 | Attributes: 11 | name (str): The name of the device. 12 | left (Pin): The Pin object representing the left button. 13 | right (Pin): The Pin object representing the right button. 14 | fire (Pin): The Pin object representing the fire button. 15 | thrust (Pin): The Pin object representing the thrust button. 16 | hyper (Pin): The Pin object representing the hyper button. 17 | """ 18 | 19 | def __init__(self): 20 | self.name = "t-embed" 21 | self.left = Pin(17, Pin.IN, Pin.PULL_UP) # middle GROVE connector 22 | self.right = Pin(18, Pin.IN, Pin.PULL_UP) 23 | 24 | # need more buttons for roids.py 25 | self.fire = None 26 | self.thrust = None 27 | self.hyper = None 28 | -------------------------------------------------------------------------------- /tft_configs/t-embed/tft_config.py: -------------------------------------------------------------------------------- 1 | """LilyGo T-embed 170x320 2 | """ 3 | 4 | from machine import Pin, SPI 5 | import st7789py as st7789 6 | 7 | 8 | TFA = 0 9 | BFA = 0 10 | WIDE = 1 11 | TALL = 0 12 | SCROLL = 0 # orientation for scroll.py 13 | FEATHERS = 1 # orientation for feathers.py 14 | 15 | POWER = Pin(46, Pin.OUT, value=1) 16 | 17 | def config(rotation=0): 18 | """ 19 | Configures and returns an instance of the ST7789 display driver. 20 | 21 | Args: 22 | rotation (int): The rotation of the display (default: 0). 23 | 24 | Returns: 25 | ST7789: An instance of the ST7789 display driver. 26 | """ 27 | 28 | custom_rotations = ( 29 | (0x00, 170, 320, 35, 0, False), 30 | (0x60, 320, 170, 0, 35, False), 31 | (0xC0, 170, 320, 35, 0, False), 32 | (0xA0, 320, 170, 0, 35, False), 33 | ) 34 | 35 | return st7789.ST7789( 36 | SPI(2, baudrate=40000000, sck=Pin(12), mosi=Pin(11), miso=None), 37 | 170, 38 | 320, 39 | cs=Pin(10, Pin.OUT), 40 | dc=Pin(13, Pin.OUT), 41 | reset=Pin(9, Pin.OUT), 42 | backlight=Pin(15, Pin.OUT), 43 | custom_rotations=custom_rotations, 44 | rotation=rotation, 45 | color_order=st7789.BGR, 46 | ) 47 | -------------------------------------------------------------------------------- /tft_configs/t_qt_pro/tft_buttons.py: -------------------------------------------------------------------------------- 1 | """ 2 | LILYGO® T-QT Pro buttons 3 | """ 4 | 5 | from machine import Pin 6 | 7 | 8 | class Buttons: 9 | """ 10 | Buttons class for examples, modify for your device. 11 | 12 | Attributes: 13 | name (str): The name of the device. 14 | left (Pin): The Pin object representing the left button. 15 | right (Pin): The Pin object representing the right button. 16 | fire (Pin): The Pin object representing the fire button. 17 | thrust (Pin): The Pin object representing the thrust button. 18 | hyper (Pin): The Pin object representing the hyper button. 19 | """ 20 | 21 | def __init__(self): 22 | self.name = "t-qt-pro" 23 | self.left = Pin(0, Pin.IN) 24 | self.right = Pin(47, Pin.IN) 25 | 26 | # need more buttons for roids.py 27 | self.fire = None 28 | self.thrust = None 29 | self.hyper = None 30 | -------------------------------------------------------------------------------- /tft_configs/t_qt_pro/tft_config.py: -------------------------------------------------------------------------------- 1 | """LilyGo T-QT Pro 128x128 (GC9107) 2 | 3 | https://www.lilygo.cc/products/t-qt-pro 4 | 5 | """ 6 | 7 | from machine import Pin, SPI 8 | import st7789py as st7789 9 | 10 | TFA = 1 11 | BFA = 3 12 | WIDE = 2 13 | TALL = 3 14 | SCROLL = 0 # orientation for scroll.py 15 | FEATHERS = 1 # orientation for feathers.py 16 | 17 | def config(rotation=0): 18 | """ 19 | Configures and returns an instance of the ST7789 display driver. 20 | 21 | Args: 22 | rotation (int): The rotation of the display (default: 0). 23 | 24 | Returns: 25 | ST7789: An instance of the ST7789 display driver. 26 | """ 27 | 28 | custom_rotations = ( 29 | (0x00, 128, 128, 2, 1, False), 30 | (0x60, 128, 128, 1, 2, False), 31 | (0xc0, 128, 128, 2, 1, False), 32 | (0xa0, 128, 128, 1, 2, False), 33 | ) 34 | 35 | return st7789.ST7789( 36 | SPI(2, baudrate=40000000, sck=Pin(3), mosi=Pin(2), miso=None), 37 | 128, 38 | 128, 39 | reset=Pin(1, Pin.OUT), 40 | cs=Pin(5, Pin.OUT), 41 | dc=Pin(6, Pin.OUT), 42 | #backlight=Pin(10, Pin.OUT), 43 | rotation=rotation, 44 | custom_rotations=custom_rotations, 45 | color_order=st7789.BGR 46 | ) 47 | -------------------------------------------------------------------------------- /tft_configs/ttgo_tdisplay/tft_buttons.py: -------------------------------------------------------------------------------- 1 | """ 2 | T-Display ESP32 Buttons. 3 | """ 4 | 5 | from machine import Pin 6 | 7 | class Buttons(): 8 | """ 9 | Buttons class for examples, modify for your device. 10 | 11 | Attributes: 12 | name (str): The name of the device. 13 | left (Pin): The Pin object representing the left button. 14 | right (Pin): The Pin object representing the right button. 15 | fire (Pin): The Pin object representing the fire button. 16 | thrust (Pin): The Pin object representing the thrust button. 17 | hyper (Pin): The Pin object representing the hyper button. 18 | """ 19 | 20 | def __init__(self): 21 | self.name = "tdisplay_esp32" 22 | self.left = Pin(0, Pin.IN) 23 | self.right = Pin(35, Pin.IN) 24 | self.fire = None 25 | self.thrust = None 26 | self.hyper = None 27 | -------------------------------------------------------------------------------- /tft_configs/ttgo_tdisplay/tft_config.py: -------------------------------------------------------------------------------- 1 | """LilyGo T-DISPLAY 135x240 2 | 3 | https://www.lilygo.cc/products/lilygo%C2%AE-ttgo-t-display-1-14-inch-lcd-esp32-control-board 4 | 5 | """ 6 | 7 | from machine import Pin, SPI 8 | import st7789py as st7789 9 | 10 | TFA = 40 11 | BFA = 40 12 | WIDE = 1 13 | TALL = 0 14 | SCROLL = 0 # orientation for scroll.py 15 | FEATHERS = 1 # orientation for feathers.py 16 | 17 | def config(rotation=0): 18 | """ 19 | Configures and returns an instance of the ST7789 display driver. 20 | 21 | Args: 22 | rotation (int): The rotation of the display (default: 0). 23 | 24 | Returns: 25 | ST7789: An instance of the ST7789 display driver. 26 | """ 27 | 28 | return st7789.ST7789( 29 | SPI(2, baudrate=30000000, sck=Pin(18), mosi=Pin(19), miso=None), 30 | 135, 31 | 240, 32 | reset=Pin(23, Pin.OUT), 33 | cs=Pin(5, Pin.OUT), 34 | dc=Pin(16, Pin.OUT), 35 | backlight=Pin(4, Pin.OUT), 36 | rotation=rotation, 37 | ) 38 | -------------------------------------------------------------------------------- /tft_configs/ttgo_tdisplay_rp2040/tft_buttons.py: -------------------------------------------------------------------------------- 1 | """ 2 | T-Display RP2040 Buttons configuration. 3 | """ 4 | 5 | from machine import Pin 6 | 7 | class Buttons(): 8 | """ 9 | Buttons class for examples, modify for your device. 10 | 11 | Attributes: 12 | name (str): The name of the device. 13 | left (Pin): The Pin object representing the left button. 14 | right (Pin): The Pin object representing the right button. 15 | fire (Pin): The Pin object representing the fire button. 16 | thrust (Pin): The Pin object representing the thrust button. 17 | hyper (Pin): The Pin object representing the hyper button. 18 | """ 19 | 20 | def __init__(self): 21 | self.name = "tdisplay_rp2040" 22 | self.left = Pin(6, Pin.IN) 23 | self.right = Pin(7, Pin.IN) 24 | self.fire = None 25 | self.thrust = None 26 | self.hyper = None 27 | -------------------------------------------------------------------------------- /tft_configs/ttgo_tdisplay_rp2040/tft_config.py: -------------------------------------------------------------------------------- 1 | """LilyGo T-DISPLAY RP2040 135x240 2 | 3 | https://www.lilygo.cc/products/t-display-rp2040 4 | 5 | """ 6 | from machine import Pin, SPI 7 | import st7789py as st7789 8 | 9 | TFA = 40 10 | BFA = 40 11 | WIDE = 1 12 | TALL = 0 13 | SCROLL = 0 # orientation for scroll.py 14 | FEATHERS = 1 # orientation for feathers.py 15 | 16 | def config(rotation=0): 17 | """ 18 | Configures and returns an instance of the ST7789 display driver. 19 | 20 | Args: 21 | rotation (int): The rotation of the display (default: 0). 22 | 23 | Returns: 24 | ST7789: An instance of the ST7789 display driver. 25 | """ 26 | 27 | return st7789.ST7789( 28 | SPI(0, baudrate=60000000, sck=Pin(2), mosi=Pin(3), miso=None), 29 | 135, 30 | 240, 31 | reset=Pin(0, Pin.OUT), 32 | cs=Pin(5, Pin.OUT), 33 | dc=Pin(1, Pin.OUT), 34 | backlight=Pin(4, Pin.OUT), 35 | rotation=rotation) 36 | -------------------------------------------------------------------------------- /tft_configs/waveshare_114/tft_buttons.py: -------------------------------------------------------------------------------- 1 | """ 2 | Waveshare Pico LCD 1.14 Buttons 3 | """ 4 | 5 | from machine import Pin 6 | 7 | class Buttons(): 8 | """ 9 | Buttons class for examples, modify for your device. 10 | 11 | Attributes: 12 | name (str): The name of the device. 13 | left (Pin): The Pin object representing the left button. 14 | right (Pin): The Pin object representing the right button. 15 | fire (Pin): The Pin object representing the fire button. 16 | thrust (Pin): The Pin object representing the thrust button. 17 | hyper (Pin): The Pin object representing the hyper button. 18 | """ 19 | 20 | def __init__(self): 21 | self.name = "waveshare_114" 22 | self.left = Pin(17, Pin.IN) 23 | self.right = Pin(3, Pin.IN) 24 | self.fire = Pin(15, Pin.IN) 25 | self.thrust = Pin(2, Pin.IN) 26 | self.hyper = None 27 | -------------------------------------------------------------------------------- /tft_configs/waveshare_114/tft_config.py: -------------------------------------------------------------------------------- 1 | """Waveshare Pico LCD 1.14 135x240 2 | 3 | https://www.waveshare.com/wiki/Pico-LCD-1.14 4 | 5 | """ 6 | 7 | from machine import Pin, SPI 8 | import st7789py as st7789 9 | 10 | TFA = 40 11 | BFA = 40 12 | WIDE = 1 13 | TALL = 0 14 | SCROLL = 0 # orientation for scroll.py 15 | FEATHERS = 1 # orientation for feathers.py 16 | 17 | def config(rotation=0): 18 | """ 19 | Configures and returns an instance of the ST7789 display driver. 20 | 21 | Args: 22 | rotation (int): The rotation of the display (default: 0). 23 | 24 | Returns: 25 | ST7789: An instance of the ST7789 display driver. 26 | """ 27 | 28 | return st7789.ST7789( 29 | SPI(1, baudrate=60000000, sck=Pin(10), mosi=Pin(11), miso=None), 30 | 135, 31 | 240, 32 | reset=Pin(12, Pin.OUT), 33 | cs=Pin(9, Pin.OUT), 34 | dc=Pin(8, Pin.OUT), 35 | backlight=Pin(13, Pin.OUT), 36 | rotation=rotation) -------------------------------------------------------------------------------- /tft_configs/waveshare_13/tft_buttons.py: -------------------------------------------------------------------------------- 1 | """ 2 | Waveshare 1.3" TFT display with ST7789 controller 3 | """ 4 | 5 | from machine import Pin 6 | 7 | class Buttons(): 8 | """ 9 | Buttons class for examples, modify for your device. 10 | 11 | Attributes: 12 | name (str): The name of the device. 13 | left (Pin): The Pin object representing the left button. 14 | right (Pin): The Pin object representing the right button. 15 | fire (Pin): The Pin object representing the fire button. 16 | thrust (Pin): The Pin object representing the thrust button. 17 | hyper (Pin): The Pin object representing the hyper button. 18 | """ 19 | 20 | def __init__(self): 21 | self.name = "waveshare_13" 22 | self.left = Pin(16, Pin.IN, Pin.PULL_UP) # Joystick left 23 | self.right = Pin(20, Pin.IN, Pin.PULL_UP) # Joystick right 24 | self.fire = Pin(21, Pin.IN, Pin.PULL_UP) # Joystick press 25 | self.thrust = Pin(3, Pin.IN, Pin.PULL_UP) # Y button 26 | self.hyper = Pin(15, Pin.IN, Pin.PULL_UP) # A button 27 | -------------------------------------------------------------------------------- /tft_configs/waveshare_13/tft_config.py: -------------------------------------------------------------------------------- 1 | """Waveshare Pico LCD 1.3 240x240 2 | 3 | https://www.waveshare.com/wiki/Pico-LCD-1.3 4 | 5 | """ 6 | 7 | from machine import Pin, SPI 8 | import st7789py as st7789 9 | 10 | TFA = 0 11 | BFA = 80 12 | WIDE = 1 13 | TALL = 0 14 | SCROLL = 0 # orientation for scroll.py 15 | FEATHERS = 1 # orientation for feathers.py 16 | 17 | def config(rotation=0): 18 | """ 19 | Configures and returns an instance of the ST7789 display driver. 20 | 21 | Args: 22 | rotation (int): The rotation of the display. Defaults to 0. 23 | 24 | Returns: 25 | ST7789: An instance of the ST7789 display driver. 26 | """ 27 | 28 | return st7789.ST7789( 29 | SPI(1, baudrate=60000000, polarity=1, sck=Pin(10), mosi=Pin(11), miso=None), 30 | 240, 31 | 240, 32 | reset=Pin(12, Pin.OUT), 33 | cs=Pin(9, Pin.OUT), 34 | dc=Pin(8, Pin.OUT), 35 | backlight=Pin(13, Pin.OUT), 36 | rotation=rotation, 37 | ) 38 | -------------------------------------------------------------------------------- /tft_configs/waveshare_2/tft_buttons.py: -------------------------------------------------------------------------------- 1 | """ 2 | input pins for ws_pico_2 3 | """ 4 | 5 | from machine import Pin 6 | 7 | class Buttons(): 8 | """ 9 | Buttons class for examples, modify for your device. 10 | 11 | Attributes: 12 | name (str): The name of the device. 13 | left (Pin): The Pin object representing the left button. 14 | right (Pin): The Pin object representing the right button. 15 | fire (Pin): The Pin object representing the fire button. 16 | thrust (Pin): The Pin object representing the thrust button. 17 | hyper (Pin): The Pin object representing the hyper button. 18 | """ 19 | 20 | def __init__(self): 21 | self.name = "ws_pico_2" 22 | self.key0 = Pin(15, Pin.IN, Pin.PULL_UP) # Top Right 23 | self.key1 = Pin(17, Pin.IN, Pin.PULL_UP) # Bottom Right 24 | self.key2 = Pin(2, Pin.IN, Pin.PULL_UP) # Bottom Left 25 | self.key3 = Pin(3, Pin.IN, Pin.PULL_UP) # Top Left 26 | 27 | # for roids.py in landscape mode 28 | 29 | self.left = self.key2 30 | self.right = self.key3 31 | self.fire = self.key1 32 | self.thrust = self.key0 33 | self.hyper = None 34 | -------------------------------------------------------------------------------- /tft_configs/waveshare_2/tft_config.py: -------------------------------------------------------------------------------- 1 | """Waveshare Pico LCD 2 240x320 2 | 3 | https://www.waveshare.com/wiki/Pico-LCD-2 4 | 5 | """ 6 | 7 | from machine import Pin, SPI 8 | import st7789py as st7789 9 | 10 | TFA = 0 11 | BFA = 0 12 | WIDE = 1 13 | TALL = 0 14 | SCROLL = 0 # orientation for scroll.py 15 | FEATHERS = 1 # orientation for feathers.py 16 | 17 | 18 | def config(rotation=0): 19 | """ 20 | Configures and returns an instance of the ST7789 display driver. 21 | 22 | Args: 23 | rotation (int): The rotation of the display. Defaults to 0. 24 | 25 | Returns: 26 | ST7789: An instance of the ST7789 display driver. 27 | """ 28 | return st7789.ST7789( 29 | SPI(1, baudrate=60000000, sck=Pin(10), mosi=Pin(11)), 30 | 240, 31 | 320, 32 | reset=Pin(12, Pin.OUT), 33 | cs=Pin(9, Pin.OUT), 34 | dc=Pin(8, Pin.OUT), 35 | backlight=Pin(13, Pin.OUT), 36 | rotation=rotation, 37 | ) 38 | -------------------------------------------------------------------------------- /utils/README.md: -------------------------------------------------------------------------------- 1 | # Conversion Utilites 2 | 3 | ## text_font_converter.py 4 | 5 | Convert fonts from the font-bin directory of spacerace's https://github.com/spacerace/romfont VGA and BIOS rom font repo. 6 | 7 | Reads all font-bin files from the specified `input` directory and writes python font modules for use with the text() method to the specified `output` directory. Optionally limiting the characters included to -first-char (-f) thru -last-char (-l). 8 | 9 | ``` 10 | usage: text_font_converter.py [-h] [-f FIRST_CHAR] [-l LAST_CHAR] input output 11 | 12 | Convert fomfont.bin font files from `input` to python module(s) in `output` for use with the text() method. 13 | 14 | positional arguments: 15 | input file or directory containing binary font file(s). 16 | output file or directory to contain python font file(s). 17 | 18 | optional arguments: 19 | -h, --help show this help message and exit 20 | -f FIRST_CHAR, --first-char FIRST_CHAR The first character code to include in the conversion (default: 0x20) 21 | -l LAST_CHAR, --last-char LAST_CHAR The last character code to include in the conversion (default: 0x7F) 22 | ``` 23 | 24 | ## write_font_converter.py 25 | 26 | ``` 27 | usage: write_font_converter.py [-h] [-width FONT_WIDTH] (-c CHARACTERS | -s STRING) font_file font_height 28 | 29 | Convert characters from a truetype font to a python bitmap for use with the bitmap method in the st7789 and ili9342 drivers. 30 | 31 | positional arguments: 32 | font_file name of font file to convert. 33 | font_height size of font to create bitmaps from. 34 | 35 | optional arguments: 36 | -h, --help show this help message and exit 37 | -width FONT_WIDTH, --font_width FONT_WIDTH 38 | width of font to create bitmaps from. 39 | 40 | character selection: 41 | characters from the font to include in the bitmap. 42 | 43 | -c CHARACTERS, --characters CHARACTERS 44 | integer or hex character values and/or ranges to include. For example: "65, 66, 67" or "32-127" or "0x30-0x39, 45 | 0x41-0x5a" 46 | -s STRING, --string STRING 47 | string of characters to include For example: "1234567890-." 48 | ``` 49 | 50 | ## image_converter.py 51 | 52 | ``` 53 | usage: image_converter.py [-h] image_file bits_per_pixel 54 | 55 | Convert image file to python module for use with bitmap method. 56 | 57 | positional arguments: 58 | image_file Name of file containing image to convert 59 | bits_per_pixel The number of bits to use per pixel (1..8) 60 | 61 | optional arguments: 62 | -h, --help show this help message and exit 63 | 64 | ``` 65 | 66 | ## sprites_converter.py 67 | 68 | Convert a sprite sheet image to python a module for use with indexed bitmap method. 69 | Sprite sheet width and height should be a multiple of sprite width and height. There 70 | should be no extra pixels between sprites. All sprites will share the same palette. 71 | 72 | ``` 73 | usage: sprites_converter [-h] image_file sprite_width sprite_height bits_per_pixel 74 | 75 | Convert image file to python module for use with bitmap method. 76 | 77 | positional arguments: 78 | image_file Name of file containing image to convert 79 | sprite_width width of sprites in pixels 80 | sprite_height Height of sprites in pixels 81 | bits_per_pixel The number of bits to use per pixel (1..8) 82 | 83 | optional arguments: 84 | -h, --help show this help message and exit 85 | ``` 86 | 87 | ## create_png_examples.py 88 | 89 | ``` 90 | usage: create_png_examples.py [-h] input output 91 | 92 | Creates png samples of each text font file from the input directoryto the output directory. 93 | 94 | positional arguments: 95 | input input directory containing font-bin files 96 | output output directory to create pngs 97 | 98 | optional arguments: 99 | -h, --help show this help message and exit 100 | ``` 101 | -------------------------------------------------------------------------------- /utils/color_bars.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/russhughes/st7789py_mpy/7265925bd0c092e8105200d18b2dba9dfbc12c27/utils/color_bars.png -------------------------------------------------------------------------------- /utils/color_sprites.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/russhughes/st7789py_mpy/7265925bd0c092e8105200d18b2dba9dfbc12c27/utils/color_sprites.png -------------------------------------------------------------------------------- /utils/create_png_examples.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | """ 4 | Reads all font-bin files from the specified `input` directory and writes png images to t 5 | he specified `output` directory. Optionally limiting the characters included to -first-char 6 | (-f) thru -last-char (-l). This is the program I used to create the png font samples in the 7 | documentation. 8 | 9 | .. seealso:: 10 | - :ref:`Bitmap Font Samples`. 11 | 12 | Example 13 | ^^^^^^^ 14 | 15 | .. code-block:: console 16 | 17 | - create_png_examples.py font_directory png_directory 18 | 19 | Usage 20 | ^^^^^ 21 | 22 | .. code-block:: console 23 | 24 | usage: create_png_examples.py [-h] input output 25 | 26 | Creates png samples of each text font file from the input directoryto the output directory. 27 | 28 | positional arguments: 29 | input input directory containing font-bin files 30 | output output directory to create pngs 31 | 32 | optional arguments: 33 | -h, --help show this help message and exit 34 | 35 | """ 36 | 37 | import os 38 | import importlib 39 | import argparse 40 | import png 41 | 42 | 43 | def create_png(font_file_name, png_file_name): 44 | """ 45 | Convert image file to python module for use with bitmap method. 46 | 47 | Args: 48 | image_file (str): Name of file containing image to convert. 49 | bits_per_pixel (int): The number of bits to use per pixel (1..8). 50 | 51 | """ 52 | 53 | module_spec = importlib.util.spec_from_file_location("font", font_file_name) 54 | font = importlib.util.module_from_spec(module_spec) 55 | module_spec.loader.exec_module(font) 56 | char_count = font.LAST - font.FIRST 57 | column_count = 16 58 | row_count = char_count // column_count 59 | 60 | with open(png_file_name, "wb") as png_file: 61 | image = png.Writer( 62 | (16 + 2) * font.WIDTH, (row_count + 3) * font.HEIGHT, bitdepth=1 63 | ) 64 | image_data = [ 65 | [0 for _ in range((16 + 2) * font.WIDTH)] 66 | for _ in range((row_count + 3) * font.HEIGHT) 67 | ] 68 | #font_count = len(font.FONT) + 1 69 | for chart_row in range(row_count + 2): 70 | for chart_col in range(16): 71 | chart_idx = chart_row * 16 + chart_col 72 | for char_line in range(font.HEIGHT): 73 | for char_byte in range(font.WIDTH // 8): 74 | ch_idx = ( 75 | chart_idx * font.HEIGHT * font.WIDTH // 8 76 | + char_byte 77 | + char_line * font.WIDTH // 8 78 | ) 79 | print(chart_idx, char_count) 80 | data = font.FONT[ch_idx] if chart_idx <= char_count else 0 81 | for bit in range(8): 82 | png_row = (chart_row + 1) * font.HEIGHT + char_line 83 | png_col = (chart_col + 1) * font.WIDTH + char_byte * 8 + bit 84 | image_data[png_row][png_col] = 1 if data & 1 << 7 - bit else 0 85 | 86 | print("Creating", png_file_name) 87 | image.write(png_file, image_data) 88 | 89 | 90 | def main(): 91 | """ 92 | Creates PNG samples of each text font file from the input directory to the output directory. 93 | 94 | Args: 95 | input (str): Input directory containing font-bin files. 96 | output (str): Output directory to create PNGs. 97 | 98 | """ 99 | 100 | parser = argparse.ArgumentParser( 101 | description=( 102 | "Creates png samples of each text font file from the input directory" 103 | "to the output directory." 104 | ) 105 | ) 106 | parser.add_argument("input", help="input directory containing font-bin files") 107 | parser.add_argument("output", help="output directory to create pngs") 108 | args = parser.parse_args() 109 | 110 | for file_name in os.listdir(args.input): 111 | if file_name.endswith(".py"): 112 | font_file_name = os.path.join(args.input, file_name) 113 | png_file_name = os.path.join( 114 | args.output, f"{os.path.splitext(file_name)[0]}.png" 115 | ) 116 | create_png(font_file_name, png_file_name) 117 | 118 | 119 | if __name__ == "__main__": 120 | main() 121 | -------------------------------------------------------------------------------- /utils/requirements.txt: -------------------------------------------------------------------------------- 1 | freetype-py 2 | Pillow 3 | pypng 4 | -------------------------------------------------------------------------------- /utils/sprites.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/russhughes/st7789py_mpy/7265925bd0c092e8105200d18b2dba9dfbc12c27/utils/sprites.png -------------------------------------------------------------------------------- /utils/vga8x8.py: -------------------------------------------------------------------------------- 1 | # converted from /Volumes/MicroPython/romfont/font-bin/IBM_VGA_8x8.bin 2 | 3 | _FONT =\ 4 | b'\x00\x00\x00\x00\x00\x00\x00\x00'\ 5 | b'\x30\x78\x78\x30\x30\x00\x30\x00'\ 6 | b'\x6c\x6c\x6c\x00\x00\x00\x00\x00'\ 7 | b'\x6c\x6c\xfe\x6c\xfe\x6c\x6c\x00'\ 8 | b'\x30\x7c\xc0\x78\x0c\xf8\x30\x00'\ 9 | b'\x00\xc6\xcc\x18\x30\x66\xc6\x00'\ 10 | b'\x38\x6c\x38\x76\xdc\xcc\x76\x00'\ 11 | b'\x60\x60\xc0\x00\x00\x00\x00\x00'\ 12 | b'\x18\x30\x60\x60\x60\x30\x18\x00'\ 13 | b'\x60\x30\x18\x18\x18\x30\x60\x00'\ 14 | b'\x00\x66\x3c\xff\x3c\x66\x00\x00'\ 15 | b'\x00\x30\x30\xfc\x30\x30\x00\x00'\ 16 | b'\x00\x00\x00\x00\x00\x30\x30\x60'\ 17 | b'\x00\x00\x00\xfc\x00\x00\x00\x00'\ 18 | b'\x00\x00\x00\x00\x00\x30\x30\x00'\ 19 | b'\x06\x0c\x18\x30\x60\xc0\x80\x00'\ 20 | b'\x7c\xc6\xce\xde\xf6\xe6\x7c\x00'\ 21 | b'\x30\x70\x30\x30\x30\x30\xfc\x00'\ 22 | b'\x78\xcc\x0c\x38\x60\xcc\xfc\x00'\ 23 | b'\x78\xcc\x0c\x38\x0c\xcc\x78\x00'\ 24 | b'\x1c\x3c\x6c\xcc\xfe\x0c\x1e\x00'\ 25 | b'\xfc\xc0\xf8\x0c\x0c\xcc\x78\x00'\ 26 | b'\x38\x60\xc0\xf8\xcc\xcc\x78\x00'\ 27 | b'\xfc\xcc\x0c\x18\x30\x30\x30\x00'\ 28 | b'\x78\xcc\xcc\x78\xcc\xcc\x78\x00'\ 29 | b'\x78\xcc\xcc\x7c\x0c\x18\x70\x00'\ 30 | b'\x00\x30\x30\x00\x00\x30\x30\x00'\ 31 | b'\x00\x30\x30\x00\x00\x30\x30\x60'\ 32 | b'\x18\x30\x60\xc0\x60\x30\x18\x00'\ 33 | b'\x00\x00\xfc\x00\x00\xfc\x00\x00'\ 34 | b'\x60\x30\x18\x0c\x18\x30\x60\x00'\ 35 | b'\x78\xcc\x0c\x18\x30\x00\x30\x00'\ 36 | b'\x7c\xc6\xde\xde\xde\xc0\x78\x00'\ 37 | b'\x30\x78\xcc\xcc\xfc\xcc\xcc\x00'\ 38 | b'\xfc\x66\x66\x7c\x66\x66\xfc\x00'\ 39 | b'\x3c\x66\xc0\xc0\xc0\x66\x3c\x00'\ 40 | b'\xf8\x6c\x66\x66\x66\x6c\xf8\x00'\ 41 | b'\xfe\x62\x68\x78\x68\x62\xfe\x00'\ 42 | b'\xfe\x62\x68\x78\x68\x60\xf0\x00'\ 43 | b'\x3c\x66\xc0\xc0\xce\x66\x3e\x00'\ 44 | b'\xcc\xcc\xcc\xfc\xcc\xcc\xcc\x00'\ 45 | b'\x78\x30\x30\x30\x30\x30\x78\x00'\ 46 | b'\x1e\x0c\x0c\x0c\xcc\xcc\x78\x00'\ 47 | b'\xe6\x66\x6c\x78\x6c\x66\xe6\x00'\ 48 | b'\xf0\x60\x60\x60\x62\x66\xfe\x00'\ 49 | b'\xc6\xee\xfe\xfe\xd6\xc6\xc6\x00'\ 50 | b'\xc6\xe6\xf6\xde\xce\xc6\xc6\x00'\ 51 | b'\x38\x6c\xc6\xc6\xc6\x6c\x38\x00'\ 52 | b'\xfc\x66\x66\x7c\x60\x60\xf0\x00'\ 53 | b'\x78\xcc\xcc\xcc\xdc\x78\x1c\x00'\ 54 | b'\xfc\x66\x66\x7c\x6c\x66\xe6\x00'\ 55 | b'\x78\xcc\xe0\x70\x1c\xcc\x78\x00'\ 56 | b'\xfc\xb4\x30\x30\x30\x30\x78\x00'\ 57 | b'\xcc\xcc\xcc\xcc\xcc\xcc\xfc\x00'\ 58 | b'\xcc\xcc\xcc\xcc\xcc\x78\x30\x00'\ 59 | b'\xc6\xc6\xc6\xd6\xfe\xee\xc6\x00'\ 60 | b'\xc6\xc6\x6c\x38\x38\x6c\xc6\x00'\ 61 | b'\xcc\xcc\xcc\x78\x30\x30\x78\x00'\ 62 | b'\xfe\xc6\x8c\x18\x32\x66\xfe\x00'\ 63 | b'\x78\x60\x60\x60\x60\x60\x78\x00'\ 64 | b'\xc0\x60\x30\x18\x0c\x06\x02\x00'\ 65 | b'\x78\x18\x18\x18\x18\x18\x78\x00'\ 66 | b'\x10\x38\x6c\xc6\x00\x00\x00\x00'\ 67 | b'\x00\x00\x00\x00\x00\x00\x00\xff'\ 68 | b'\x30\x30\x18\x00\x00\x00\x00\x00'\ 69 | b'\x00\x00\x78\x0c\x7c\xcc\x76\x00'\ 70 | b'\xe0\x60\x60\x7c\x66\x66\xdc\x00'\ 71 | b'\x00\x00\x78\xcc\xc0\xcc\x78\x00'\ 72 | b'\x1c\x0c\x0c\x7c\xcc\xcc\x76\x00'\ 73 | b'\x00\x00\x78\xcc\xfc\xc0\x78\x00'\ 74 | b'\x38\x6c\x60\xf0\x60\x60\xf0\x00'\ 75 | b'\x00\x00\x76\xcc\xcc\x7c\x0c\xf8'\ 76 | b'\xe0\x60\x6c\x76\x66\x66\xe6\x00'\ 77 | b'\x30\x00\x70\x30\x30\x30\x78\x00'\ 78 | b'\x0c\x00\x0c\x0c\x0c\xcc\xcc\x78'\ 79 | b'\xe0\x60\x66\x6c\x78\x6c\xe6\x00'\ 80 | b'\x70\x30\x30\x30\x30\x30\x78\x00'\ 81 | b'\x00\x00\xcc\xfe\xfe\xd6\xc6\x00'\ 82 | b'\x00\x00\xf8\xcc\xcc\xcc\xcc\x00'\ 83 | b'\x00\x00\x78\xcc\xcc\xcc\x78\x00'\ 84 | b'\x00\x00\xdc\x66\x66\x7c\x60\xf0'\ 85 | b'\x00\x00\x76\xcc\xcc\x7c\x0c\x1e'\ 86 | b'\x00\x00\xdc\x76\x66\x60\xf0\x00'\ 87 | b'\x00\x00\x7c\xc0\x78\x0c\xf8\x00'\ 88 | b'\x10\x30\x7c\x30\x30\x34\x18\x00'\ 89 | b'\x00\x00\xcc\xcc\xcc\xcc\x76\x00'\ 90 | b'\x00\x00\xcc\xcc\xcc\x78\x30\x00'\ 91 | b'\x00\x00\xc6\xd6\xfe\xfe\x6c\x00'\ 92 | b'\x00\x00\xc6\x6c\x38\x6c\xc6\x00'\ 93 | b'\x00\x00\xcc\xcc\xcc\x7c\x0c\xf8'\ 94 | b'\x00\x00\xfc\x98\x30\x64\xfc\x00'\ 95 | b'\x1c\x30\x30\xe0\x30\x30\x1c\x00'\ 96 | b'\x18\x18\x18\x00\x18\x18\x18\x00'\ 97 | b'\xe0\x30\x30\x1c\x30\x30\xe0\x00'\ 98 | b'\x76\xdc\x00\x00\x00\x00\x00\x00'\ 99 | b'\x00\x10\x38\x6c\xc6\xc6\xfe\x00'\ 100 | 101 | WIDTH = 8 102 | HEIGHT = 8 103 | FIRST = 0x20LAST = 0x7f 104 | FONT = memoryview(_FONT) 105 | --------------------------------------------------------------------------------