├── ports └── esp32 │ ├── boards │ ├── M5CORE2 │ │ ├── manifest.py │ │ ├── mpconfigboard.h │ │ ├── modules │ │ │ ├── axp192.py │ │ │ ├── ft6x36.py │ │ │ ├── inisetup.py │ │ │ └── m5core2_power.py │ │ ├── sdkconfig.board │ │ ├── mpconfigboard.mk │ │ ├── mpconfigboard.cmake │ │ ├── partitions.csv │ │ └── README.md │ └── GENERIC_ULAB_LVGL_SPIRAM │ │ ├── mpconfigboard.h │ │ └── mpconfigboard.cmake │ ├── makefile_M5CORE2 │ ├── makefile_GENERIC_ULAB_LVGL_SPIRAM │ └── partitions.csv ├── tools ├── uartremote.mpy ├── install_uartremote.py └── ci.sh ├── .gitmodules ├── .github └── workflows │ ├── build_spike.yml │ ├── esp32.yml │ ├── make_uartremote.yml │ ├── commit_SPIKE.yml │ ├── esp32_ulab_lvgl.yml │ └── micropython_ulan_lvlgl_idf4.4.yml ├── README.md └── lib └── lv_bindings └── lv_conf.h /ports/esp32/boards/M5CORE2/manifest.py: -------------------------------------------------------------------------------- 1 | freeze("modules") 2 | include("$(PORT_DIR)/boards/manifest.py") 3 | -------------------------------------------------------------------------------- /tools/uartremote.mpy: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heixiaoma/micropython_ulab_lvgl/main/tools/uartremote.mpy -------------------------------------------------------------------------------- /ports/esp32/boards/M5CORE2/mpconfigboard.h: -------------------------------------------------------------------------------- 1 | #define MICROPY_HW_BOARD_NAME "M5Stack Core2" 2 | #define MICROPY_HW_MCU_NAME "ESP32" 3 | -------------------------------------------------------------------------------- /ports/esp32/boards/M5CORE2/modules/axp192.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heixiaoma/micropython_ulab_lvgl/main/ports/esp32/boards/M5CORE2/modules/axp192.py -------------------------------------------------------------------------------- /ports/esp32/boards/M5CORE2/modules/ft6x36.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heixiaoma/micropython_ulab_lvgl/main/ports/esp32/boards/M5CORE2/modules/ft6x36.py -------------------------------------------------------------------------------- /ports/esp32/boards/GENERIC_ULAB_LVGL_SPIRAM/mpconfigboard.h: -------------------------------------------------------------------------------- 1 | #define MICROPY_HW_BOARD_NAME "ESP32 module (lvgl,ulab,spiram)" 2 | #define MICROPY_HW_MCU_NAME "ESP32" 3 | -------------------------------------------------------------------------------- /ports/esp32/makefile_M5CORE2: -------------------------------------------------------------------------------- 1 | BOARD = M5CORE2 2 | USER_C_MODULES = ${GITHUB_WORKSPACE}/micropython-ulab/code/micropython.cmake 3 | LV_CFLAGS="-DLV_COLOR_DEPTH=16 -DLV_COLOR_16_SWAP=1" 4 | include Makefile 5 | -------------------------------------------------------------------------------- /ports/esp32/makefile_GENERIC_ULAB_LVGL_SPIRAM: -------------------------------------------------------------------------------- 1 | BOARD = GENERIC_ULAB_LVGL_SPIRAM 2 | USER_C_MODULES = ${GITHUB_WORKSPACE}/micropython-ulab/code/micropython.cmake 3 | LV_CFLAGS="-DLV_COLOR_DEPTH=16 -DLV_COLOR_16_SWAP=1" 4 | include Makefile 5 | -------------------------------------------------------------------------------- /ports/esp32/boards/M5CORE2/sdkconfig.board: -------------------------------------------------------------------------------- 1 | CONFIG_ESPTOOLPY_FLASHFREQ_80M=y 2 | CONFIG_SPIRAM_SPEED_80M=y 3 | CONFIG_PARTITION_TABLE_CUSTOM=y 4 | CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="boards/M5CORE2/partitions.csv" 5 | CONFIG_ESPTOOLPY_FLASHSIZE_16MB=y 6 | CONFIG_ESPTOOLPY_FLASHSIZE="16MB" 7 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "lv_micropython"] 2 | path = lv_micropython 3 | url = https://github.com/lvgl/lv_micropython 4 | [submodule "micropython-ulab"] 5 | path = micropython-ulab 6 | url = https://github.com/v923z/micropython-ulab.git 7 | [submodule "UartRemote"] 8 | path = UartRemote 9 | url = https://github.com/antonvh/UartRemote.git 10 | -------------------------------------------------------------------------------- /ports/esp32/boards/M5CORE2/mpconfigboard.mk: -------------------------------------------------------------------------------- 1 | SDKCONFIG += boards/sdkconfig.base 2 | SDKCONFIG += boards/sdkconfig.spiram 3 | SDKCONFIG += boards/sdkconfig.240mhz 4 | SDKCONFIG += boards/M5CORE2/sdkconfig.board 5 | 6 | FROZEN_MANIFEST ?= $(BOARD_DIR)/manifest.py 7 | 8 | PART_SRC = $(BOARD_DIR)/partitions.csv 9 | LV_CFLAGS = -DLV_COLOR_DEPTH=16 -DLV_COLOR_16_SWAP=1 10 | -------------------------------------------------------------------------------- /ports/esp32/boards/M5CORE2/mpconfigboard.cmake: -------------------------------------------------------------------------------- 1 | set(SDKCONFIG_DEFAULTS 2 | boards/sdkconfig.base 3 | boards/sdkconfig.ble 4 | boards/sdkconfig.240mhz 5 | boards/sdkconfig.spiram 6 | boards/M5CORE2/sdkconfig.board 7 | ) 8 | 9 | set(LV_CFLAGS -DLV_COLOR_DEPTH=16 -DLV_COLOR_16_SWAP=1) 10 | 11 | set(MICROPY_FROZEN_MANIFEST ${MICROPY_BOARD_DIR}/manifest.py) 12 | -------------------------------------------------------------------------------- /ports/esp32/partitions.csv: -------------------------------------------------------------------------------- 1 | # Notes: the offset of the partition table itself is set in 2 | # $IDF_PATH/components/partition_table/Kconfig.projbuild. 3 | # Name, Type, SubType, Offset, Size, Flags 4 | nvs, data, nvs, 0x9000, 0x6000, 5 | phy_init, data, phy, 0xf000, 0x1000, 6 | factory, app, factory, 0x10000, 0x270000, 7 | vfs, data, fat, 0x280000, 0x180000, 8 | -------------------------------------------------------------------------------- /ports/esp32/boards/GENERIC_ULAB_LVGL_SPIRAM/mpconfigboard.cmake: -------------------------------------------------------------------------------- 1 | set(SDKCONFIG_DEFAULTS 2 | boards/sdkconfig.base 3 | boards/sdkconfig.ble 4 | boards/sdkconfig.spiram 5 | boards/sdkconfig.240mhz 6 | ) 7 | 8 | set(LV_CFLAGS -DLV_COLOR_DEPTH=16 -DLV_COLOR_16_SWAP=1) 9 | 10 | if(NOT MICROPY_FROZEN_MANIFEST) 11 | set(MICROPY_FROZEN_MANIFEST ${MICROPY_PORT_DIR}/boards/manifest.py) 12 | endif() 13 | -------------------------------------------------------------------------------- /ports/esp32/boards/M5CORE2/partitions.csv: -------------------------------------------------------------------------------- 1 | # Note: 4MB factory partition for large libraries such as lvgl. 2 | # all the remaining space is used for a FAT partition containing 3 | # the user's python programs. 4 | # 5 | # Name, Type, SubType, Offset, Size, Flags 6 | nvs, data, nvs, 0x9000, 0x6000, 7 | phy_init, data, phy, 0xf000, 0x1000, 8 | factory, app, factory, 0x10000, 0x400000, 9 | vfs, data, fat, 0x410000, 0xBF0000, 10 | -------------------------------------------------------------------------------- /ports/esp32/boards/M5CORE2/README.md: -------------------------------------------------------------------------------- 1 | # Board files for M5Stack Core2 2 | 3 | To use, follow the instructions in the [root README](../../../../README.md) for this repository as well as in the [README for the ESP32 port](../../README.md) to prepare the prerequisites. Then to compile, go to the `ports/esp32` directory and execute 4 | 5 | ```text 6 | export PORT= 7 | export BOARD=M5CORE2 8 | esptool.py erase_flash && \ 9 | make submodules && \ 10 | make -j $(nproc) && \ 11 | make deploy 12 | ``` 13 | 14 | You should now see a very simple example application with just one button that does show when it's being pressed but does nothing else. The drivers are loaded in `boot.py` while `main.py` contains this simple example. Both files reside in the accessible and changeable flash filesystem. 15 | -------------------------------------------------------------------------------- /.github/workflows/build_spike.yml: -------------------------------------------------------------------------------- 1 | name: build SPIKE 2 | 3 | on: 4 | # Triggers the workflow on push or pull request events but only for the master branch 5 | push: 6 | branches: [ master ] 7 | pull_request: 8 | branches: [ master ] 9 | 10 | # Allows you to run this workflow manually from the Actions tab 11 | workflow_dispatch: 12 | 13 | 14 | jobs: 15 | uartremote: 16 | runs-on: ubuntu-20.04 17 | steps: 18 | - uses: actions/checkout@v2 19 | - name: pip install mpy-cross 20 | run: pip install mpy-cross 21 | - name: Initialize micropython-ulab submodule 22 | run: git submodule update --init --recursive UartRemote 23 | - name: run python script 24 | run: | 25 | cd UartRemote/MicroPython/SPIKE 26 | python create_install_file.py 27 | - uses: actions/upload-artifact@v2 28 | with: 29 | name: install_uartremote.py 30 | path: UartRemote/MicroPython/SPIKE/install_uartremote.py 31 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # micropython_ulab_lvgl 2 | 3 | This is an automatic build environment for building the latest MicroPython firmware haveing the following features: 4 | - Support for ESP32 SPIRAM 5 | - incorporated the ulab library https://github.com/v923z/micropython-ulab 6 | - incorporated `LVGL` for drawing GUI's on TFT screens, see https://docs.lvgl.io/master/index.html 7 | - compiled the latest version of `UartRemote` as a frozen module, see https://github.com/antonvh/UartRemote 8 | 9 | The ready to use firmware can be found in the [build directory](https://github.com/ste7anste7an/micropython_ulab_lvgl/tree/main/build) 10 | 11 | [![ESP32 ULAB_LVGL_SPIRAM](https://github.com/ste7anste7an/micropython_ulab_lvgl/actions/workflows/esp32_ulab_lvgl.yml/badge.svg)](https://github.com/ste7anste7an/micropython_ulab_lvgl/actions/workflows/esp32_ulab_lvgl.yml) 12 | 13 | ## Documentation 14 | 15 | See [uartremote.readthedocs.io](https://uartremote.readthedocs.io/en/latest/installation.html) for the installation procedure. 16 | -------------------------------------------------------------------------------- /.github/workflows/esp32.yml: -------------------------------------------------------------------------------- 1 | name: esp32 port 2 | 3 | on: 4 | # Triggers the workflow on push or pull request events but only for the master branch 5 | push: 6 | branches: [ master ] 7 | pull_request: 8 | branches: [ master ] 9 | 10 | # Allows you to run this workflow manually from the Actions tab 11 | workflow_dispatch: 12 | 13 | 14 | jobs: 15 | build_idf402: 16 | runs-on: ubuntu-20.04 17 | steps: 18 | - uses: actions/checkout@v2 19 | - name: Initialize lv_micropython submodule 20 | run: git submodule update --init --recursive 21 | working-directory: lv_micropython 22 | - name: Initialize lv_bindings submodule 23 | run: git submodule update --init --recursive lib/lv_bindings 24 | working-directory: lv_micropython 25 | - name: Install packages 26 | run: source tools/ci.sh && ci_esp32_idf402_setup 27 | working-directory: lv_micropython 28 | - name: Build 29 | run: source tools/ci.sh && ci_esp32_build 30 | working-directory: lv_micropython 31 | 32 | 33 | -------------------------------------------------------------------------------- /.github/workflows/make_uartremote.yml: -------------------------------------------------------------------------------- 1 | name: make uartremote 2 | 3 | on: 4 | # Triggers the workflow on push or pull request events but only for the master branch 5 | push: 6 | branches: [ master ] 7 | pull_request: 8 | branches: [ master ] 9 | 10 | # Allows you to run this workflow manually from the Actions tab 11 | workflow_dispatch: 12 | 13 | 14 | jobs: 15 | uartremote: 16 | runs-on: ubuntu-20.04 17 | steps: 18 | - uses: actions/checkout@v2 19 | - name: Initialize micropython mpy_cross 20 | run: git clone --depth 1 https://github.com/micropython/micropython.git 21 | - name: Initialize micropython-ulab submodule 22 | run: git submodule update --init --recursive UartRemote 23 | - name: Patch files 24 | run: | 25 | make -C micropython/mpy-cross 26 | micropython/mpy-cross/mpy-cross -march=xtensa UartRemote/MicroPython/uartremote.py -o uartremote.mpy 27 | python --version 28 | 29 | - uses: actions/upload-artifact@v2 30 | with: 31 | name: uartremote.mpy 32 | path: uartremote.mpy 33 | -------------------------------------------------------------------------------- /.github/workflows/commit_SPIKE.yml: -------------------------------------------------------------------------------- 1 | name: commit SPIKE 2 | 3 | on: 4 | # Triggers the workflow on push or pull request events but only for the master branch 5 | push: 6 | branches: [ master ] 7 | pull_request: 8 | branches: [ master ] 9 | 10 | # Allows you to run this workflow manually from the Actions tab 11 | workflow_dispatch: 12 | 13 | 14 | jobs: 15 | uartremote: 16 | runs-on: ubuntu-20.04 17 | steps: 18 | - uses: actions/checkout@v2 19 | - name: pip install mpy-cross 20 | run: pip install mpy-cross 21 | - name: Initialize micropython-ulab submodule 22 | run: git submodule update --init --recursive UartRemote 23 | - name: run python script 24 | run: | 25 | cd UartRemote/MicroPython/SPIKE 26 | python create_install_file.py 27 | - name: copy build files 28 | run: | 29 | cp UartRemote/MicroPython/SPIKE/install_uartremote.py tools/. 30 | cp UartRemote/MicroPython/SPIKE/uartremote.mpy tools/. 31 | 32 | - name: Commit report 33 | run: | 34 | git config --global user.name 'Ste7an' 35 | git config --global user.email 'ste7anste7an@users.noreply.github.com' 36 | git add . 37 | git commit -m "Automated report" 38 | git push 39 | -------------------------------------------------------------------------------- /ports/esp32/boards/M5CORE2/modules/inisetup.py: -------------------------------------------------------------------------------- 1 | import uos 2 | from flashbdev import bdev 3 | import lvgl as lv 4 | 5 | 6 | def check_bootsec(): 7 | buf = bytearray(bdev.ioctl(5, 0)) # 5 is SEC_SIZE 8 | bdev.readblocks(0, buf) 9 | empty = True 10 | for b in buf: 11 | if b != 0xFF: 12 | empty = False 13 | break 14 | if empty: 15 | return True 16 | fs_corrupted() 17 | 18 | 19 | def fs_corrupted(): 20 | import time 21 | 22 | while 1: 23 | print( 24 | """\ 25 | The filesystem appears to be corrupted. If you had important data there, you 26 | may want to make a flash snapshot to try to recover it. Otherwise, perform 27 | factory reprogramming of MicroPython firmware (completely erase flash, followed 28 | by firmware programming). 29 | """ 30 | ) 31 | time.sleep(3) 32 | 33 | 34 | def setup(): 35 | check_bootsec() 36 | print("Performing initial setup") 37 | uos.VfsLfs2.mkfs(bdev) 38 | vfs = uos.VfsLfs2(bdev) 39 | uos.mount(vfs, "/") 40 | with open("boot.py", "w") as f: 41 | f.write( 42 | """\ 43 | # This file is executed on every boot (including wake-boot from deepsleep) 44 | #import esp 45 | #esp.osdebug(None) 46 | #import webrepl 47 | #webrepl.start() 48 | 49 | # Init LVGL 50 | import lvgl as lv 51 | lv.init() 52 | 53 | # Power Management 54 | from m5core2_power import Power 55 | power = Power() 56 | 57 | # LCD screen 58 | from ili9XXX import ili9341 59 | lcd = ili9341(mosi=23, miso=38, clk=18, dc=15, cs=5, invert=True, rot=0x10, width=320, height=240, rst=-1, power=-1, backlight=-1) 60 | 61 | # Touch sensor 62 | from ft6x36 import ft6x36 63 | touch = ft6x36(width=320, height=280) 64 | """ 65 | ) 66 | 67 | with open("board.py", "w") as f: 68 | f.write( 69 | """\ 70 | name = "m5core2" 71 | """ 72 | ) 73 | 74 | with open("main.py", "w") as f: 75 | f.write( 76 | """\ 77 | import lvgl as lv 78 | 79 | scr = lv.obj() 80 | btn = lv.btn(scr) 81 | btn.align(lv.ALIGN.CENTER, 0, 0) 82 | label = lv.label(btn) 83 | label.set_text("Button") 84 | lv.scr_load(scr) 85 | """ 86 | ) 87 | 88 | return vfs 89 | -------------------------------------------------------------------------------- /.github/workflows/esp32_ulab_lvgl.yml: -------------------------------------------------------------------------------- 1 | name: ESP32 ULAB_LVGL_SPIRAM 2 | 3 | on: 4 | # Triggers the workflow on push or pull request events but only for the master branch 5 | push: 6 | branches: [ master ] 7 | pull_request: 8 | branches: [ master ] 9 | 10 | # Allows you to run this workflow manually from the Actions tab 11 | workflow_dispatch: 12 | 13 | 14 | jobs: 15 | build_idf402: 16 | runs-on: ubuntu-20.04 17 | steps: 18 | - uses: actions/checkout@v2 19 | - name: Initialize micropython-ulab submodule 20 | run: git submodule update --init --recursive micropython-ulab 21 | - name: Initialize micropython-ulab submodule 22 | run: git submodule update --init --recursive UartRemote 23 | - name: Initialize lv_micropython submodule 24 | run: git submodule update --init --recursive 25 | working-directory: lv_micropython 26 | - name: Initialize lv_bindings submodule 27 | run: git submodule update --init --recursive lib/lv_bindings 28 | working-directory: lv_micropython 29 | - name: Patch files 30 | run: | 31 | cp -a tools lv_micropython 32 | cp -a ports lv_micropython 33 | cp UartRemote/MicroPython/uartremote.py lv_micropython/ports/esp32/modules 34 | tail -n 10 lv_micropython/ports/esp32/modules/uartremote.py 35 | cp -a lib lv_micropython 36 | - name: Install packages 37 | run: source tools/ci.sh && ci_esp32_idf402_setup 38 | working-directory: lv_micropython 39 | - name: Build 40 | run: source tools/ci.sh && ci_esp32_build 41 | working-directory: lv_micropython 42 | - run: | 43 | export TIMESTAMP=`date +%Y%m%d-%H%M` 44 | export FIRMWARE=firmware_ESP32_ULAB_LVGL_SPIRAM_$TIMESTAMP.bin 45 | rm build/firmware* 46 | cp lv_micropython/ports/esp32/build-GENERIC_ULAB_LVGL_SPIRAM/firmware.bin build/$FIRMWARE 47 | git config --global user.name 'Ste7an' 48 | git config --global user.email 'ste7anste7an@users.noreply.github.com' 49 | git add build 50 | git diff --exit-code || git commit -m "compiled by GitHub Action" 51 | git push 52 | - uses: actions/upload-artifact@v2 53 | with: 54 | name: firmware_GENERIC_ULAB_LVGL_SPIRAM.bin 55 | path: lv_micropython/ports/esp32/build-GENERIC_ULAB_LVGL_SPIRAM/firmware.bin 56 | -------------------------------------------------------------------------------- /.github/workflows/micropython_ulan_lvlgl_idf4.4.yml: -------------------------------------------------------------------------------- 1 | name: ESP32 idf4.4 ULAB_LVGL_SPIRAM 2 | 3 | on: 4 | # Triggers the workflow on push or pull request events but only for the master branch 5 | push: 6 | branches: [ master ] 7 | pull_request: 8 | branches: [ master ] 9 | 10 | # Allows you to run this workflow manually from the Actions tab 11 | workflow_dispatch: 12 | 13 | 14 | jobs: 15 | build_idf44: 16 | runs-on: ubuntu-20.04 17 | steps: 18 | - uses: actions/checkout@v2 19 | - name: Initialize micropython-ulab submodule 20 | run: git submodule update --init --recursive micropython-ulab 21 | - name: Initialize micropython-ulab submodule 22 | run: git submodule update --init --recursive UartRemote 23 | - name: Initialize lv_micropython submodule 24 | run: git submodule update --init --recursive 25 | working-directory: lv_micropython 26 | - name: Initialize lv_bindings submodule 27 | run: git submodule update --init --recursive lib/lv_bindings 28 | working-directory: lv_micropython 29 | - name: Patch files 30 | run: | 31 | cp -a tools lv_micropython 32 | cp -a ports lv_micropython 33 | cp UartRemote/MicroPython/uartremote.py lv_micropython/ports/esp32/modules 34 | tail -n 10 lv_micropython/ports/esp32/modules/uartremote.py 35 | cp -a lib lv_micropython 36 | - name: Install packages 37 | run: source tools/ci.sh && ci_esp32_idf44_setup 38 | working-directory: lv_micropython 39 | - name: Build 40 | run: source tools/ci.sh && ci_esp32_build 41 | working-directory: lv_micropython 42 | - run: | 43 | export TIMESTAMP=`date +%Y%m%d-%H%M` 44 | export FIRMWARE=firmware_ESP32_ULAB_LVGL_SPIRAM_idf4.4_$TIMESTAMP.bin 45 | #rm build/firmware* 46 | cp lv_micropython/ports/esp32/build-GENERIC_ULAB_LVGL_SPIRAM/firmware.bin build/$FIRMWARE 47 | git config --global user.name 'Ste7an' 48 | git config --global user.email 'ste7anste7an@users.noreply.github.com' 49 | git add build 50 | git diff --exit-code || git commit -m "compiled by GitHub Action" 51 | git push 52 | - uses: actions/upload-artifact@v2 53 | with: 54 | name: firmware_GENERIC_ULAB_LVGL_SPIRAM_idf4.4.bin 55 | path: lv_micropython/ports/esp32/build-GENERIC_ULAB_LVGL_SPIRAM/firmware.bin 56 | -------------------------------------------------------------------------------- /ports/esp32/boards/M5CORE2/modules/m5core2_power.py: -------------------------------------------------------------------------------- 1 | import axp192 2 | from time import sleep 3 | 4 | SDA = 21 5 | SCL = 22 6 | I2C_ADDRESS = 0x34 7 | 8 | ESP_POWER = axp192.DCDC1_VOLTAGE 9 | LCD_BACKLIGHT = axp192.DCDC3_VOLTAGE 10 | LOGIC_AND_SD = axp192.LDO2_VOLTAGE 11 | VIBRATOR = axp192.LDO3_VOLTAGE 12 | 13 | class Power(): 14 | 15 | def __init__(self, i2c_dev=0, sda=SDA, scl=SCL, freq=400000, i2c_addr=I2C_ADDRESS, skip_init=False): 16 | self.axp = axp192.AXP192(i2c_dev, sda, scl, freq, i2c_addr) 17 | 18 | if skip_init: 19 | return 20 | 21 | print("Initialising M5Core2 power management") 22 | 23 | self.axp.twiddle(axp192.VBUS_IPSOUT_CHANNEL, 0b11111011, 0x02) 24 | print(" Vbus limit off") 25 | 26 | self.axp.twiddle(axp192.GPIO2_CONTROL, 0b00000111, 0x00) 27 | self.speaker(False) 28 | print(" Speaker amplifier off") 29 | 30 | self.axp.twiddle(axp192.BATTERY_CHARGE_CONTROL, 0b11100011, 0b10100010) 31 | print(" RTC battery charging enabled (3v, 200uA)") 32 | 33 | # If you set this too low or turn it off, you will need to do I2C mouth-to-mouth 34 | # with another device to get your M5Core2 to come alive again. So don't do that. 35 | self.axp.write(ESP_POWER, 3.35) 36 | print(" ESP32 power voltage set to 3.35v") 37 | 38 | self.axp.write(LCD_BACKLIGHT, 2.8) 39 | print(" LCD backlight voltage set to 2.80v") 40 | 41 | self.axp.write(LOGIC_AND_SD, 3.3) 42 | print(" LCD logic and sdcard voltage set to 3.3v") 43 | 44 | self.axp.twiddle(axp192.GPIO1_CONTROL, 0x07, 0x00) 45 | self.led(True) 46 | print(" LED on") 47 | 48 | self.axp.twiddle(axp192.CHARGE_CONTROL_1, 0x0f, 0x00) 49 | print(" Charge current set to 100 mA") 50 | 51 | print(" Battery voltage now: {}v".format(self.axp.read(axp192.BATTERY_VOLTAGE))) 52 | 53 | self.axp.twiddle(axp192.PEK, 0xff, 0x4c) 54 | print(" Power key set, 4 seconds for hard shutdown") 55 | 56 | self.axp.twiddle(axp192.ADC_ENABLE_1, 0x00, 0xff) 57 | print(" Enabled all ADC channels") 58 | 59 | self.int_5v(True) 60 | print(" USB / battery powered, 5V bus on") 61 | 62 | self.axp.twiddle(axp192.GPIO40_FUNCTION_CONTROL, 0x8d, 0x84) 63 | self.axp.twiddle(axp192.GPIO40_SIGNAL_STATUS, 0x02, 0x00) 64 | sleep(0.1) 65 | self.axp.twiddle(axp192.GPIO40_SIGNAL_STATUS, 0x02, 0x02) 66 | print(" LCD and touch reset") 67 | sleep(0.1) 68 | 69 | def led(self, state): 70 | self.axp.twiddle(axp192.GPIO20_SIGNAL_STATUS, 0x02, 0x00 if state else 0x02) 71 | 72 | def speaker(self, state): 73 | self.axp.twiddle(axp192.GPIO20_SIGNAL_STATUS, 0x04, 0x04 if state else 0x00) 74 | 75 | # True turns on at 2V, False or 0 turns off. Alternatively, specify a voltage in range 1.8 - 3.3 volts. 76 | def vibrator(self, state): 77 | if type(state) == bool and state: 78 | self.axp.write(VIBRATOR, 2.0) 79 | else: 80 | self.axp.write(VIBRATOR, state) 81 | 82 | def int_5v(self, state): 83 | if state: 84 | self.axp.twiddle(axp192.GPIO0_LDOIO0_VOLTAGE, 0xf0, 0xf0) 85 | self.axp.twiddle(axp192.GPIO0_CONTROL, 0x07, 0x02) 86 | self.axp.twiddle(axp192.DCDC13_LDO23_CONTROL, axp192.BIT_EXTEN_ENABLE, axp192.BIT_EXTEN_ENABLE) 87 | else: 88 | self.axp.twiddle(axp192.DCDC13_LDO23_CONTROL, axp192.BIT_EXTEN_ENABLE, 0) 89 | self.axp.twiddle(axp192.GPIO0_CONTROL, 0x07, 0x01) 90 | 91 | -------------------------------------------------------------------------------- /tools/install_uartremote.py: -------------------------------------------------------------------------------- 1 | import ubinascii, uos, machine,uhashlib 2 | from ubinascii import hexlify 3 | b64="""TQUCHyCWRCyIAgAHIC4uL3VhcnRyZW1vdGUucHlgICgoI3QgiQwiJSUkJSQlJCVILUNuIESFBygwMDAwLzwoMDAwcygwKDBIKDAwMygwMDAzKDAwMygwSzAoZSAAgFEbDHN0cnVjdBYBgFEbBnN5cxYBSBMAgBAASCoBGwBzHABIFgBIWUoKAFkyAxYASEoBAF0sCYEQCmxpbnV4YoIQCmVzcDMyYoMjAGKEEA5lc3A4MjY2YocjAWKHEBRPcGVuTVYzLU03YoUjAmKGEAxkYXJ3aW5iiBAMTWFpeFB5YhYScGxhdGZvcm1zEQERDxMQcGxhdGZvcm1VFhJfcGxhdGZvcm0ZB1QyBBAeVWFydFJlbW90ZUVycm9yEQAkNAMWAYAXImludGVycnVwdF9wcmVzc2VkMgUWGmVzcF9pbnRlcnJ1cHQRCYTZRGuAgBAIVUFSVCoBGw5tYWNoaW5lHAMWAVmAEAZQaW4qARsFHAMWAVmAEBBzbGVlcF9tcyoBGwp1dGltZRwDFgFZgBAOZHVwdGVybSoBGwZ1b3McAxYBWREJgBEBEwRJTjQCFgpncGlvMBEBFAZpcnEQDnRyaWdnZXIRCRMWSVJRX0ZBTExJTkcQDmhhbmRsZXIRHTaEAFlChIERHYLZREOAgBAdKgEbHRwDFgFZgBANKgEbBRwDFgFZgBAbKgEbHRwDFgFZgBAbKgEb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oC0uRwCxEgBrsBMFNAHXRAeAsBMBsVVjEiMjAjQBZVFjAQAAiQJuczFnZXRfbnRoX2NvbW1hbmQ6IGluZGV4IGV4Y2VlZHMgbnVtYmVyIG9mIGNvbW1hbmRzghxhGCZnZXRfcmVtb3RlX2NvbW1hbmRzCaAzIyonMTIAKwDBsBQVEA82AcKygEIdgFfDsBQDEA8QAkKzNgMwAsTFsRQAPLU2AVmB5Vha10Pdf1lZsWMAAACJ 4 | """ 5 | 6 | def calc_hash(b): 7 | return hexlify(uhashlib.sha256(b).digest()).decode() 8 | 9 | # this is the hash of the compiled uartremote.mpy 10 | hash_gen='13cab9bff9ce7c1eb4639c5807b14c98ea0c228a6f4e1284d6ae127ead603fac' 11 | 12 | uartremote=ubinascii.a2b_base64(b64) 13 | hash_initial=calc_hash(uartremote) 14 | 15 | try: # remove any old versions of uartremote library 16 | uos.remove('/projects/uartremote.py') 17 | uos.remove('/projects/uartremote.mpy') 18 | except OSError: 19 | pass 20 | 21 | print('writing uartremote.mpy to folder /projects') 22 | with open('/projects/uartremote.mpy','wb') as f: 23 | f.write(uartremote) 24 | print('Finished writing uartremote.mpy.') 25 | print('Checking hash.') 26 | uartremote_check=open('/projects/uartremote.mpy','rb').read() 27 | hash_check=calc_hash(uartremote_check) 28 | 29 | print('Hash generated: ',hash_gen) 30 | error=False 31 | if hash_initial != hash_gen: 32 | print('Failed hash of base64 input : '+hash_initial) 33 | error=True 34 | if hash_check != hash_gen: 35 | print('Failed hash of .mpy on SPIKE: '+hash_check) 36 | error=True 37 | 38 | if not error: 39 | print('Uartremote library written succesfully. Resetting....') 40 | machine.reset() 41 | else: 42 | print('Failure in Uartremote library!') 43 | 44 | -------------------------------------------------------------------------------- /tools/ci.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if which nproc > /dev/null; then 4 | MAKEOPTS="-j$(nproc)" 5 | else 6 | MAKEOPTS="-j$(sysctl -n hw.ncpu)" 7 | fi 8 | 9 | ######################################################################################## 10 | # general helper functions 11 | 12 | function ci_gcc_arm_setup { 13 | sudo apt-get install gcc-arm-none-eabi libnewlib-arm-none-eabi 14 | arm-none-eabi-gcc --version 15 | } 16 | 17 | ######################################################################################## 18 | # code formatting 19 | 20 | function ci_code_formatting_setup { 21 | sudo apt-add-repository --yes --update ppa:pybricks/ppa 22 | sudo apt-get install uncrustify 23 | pip3 install black 24 | uncrustify --version 25 | black --version 26 | } 27 | 28 | function ci_code_formatting_run { 29 | tools/codeformat.py -v 30 | } 31 | 32 | ######################################################################################## 33 | # commit formatting 34 | 35 | function ci_commit_formatting_run { 36 | git remote add upstream https://github.com/micropython/micropython.git 37 | git fetch --depth=100 upstream master 38 | # For a PR, upstream/master..HEAD ends with a merge commit into master, exlude that one. 39 | tools/verifygitlog.py -v upstream/master..HEAD --no-merges 40 | } 41 | 42 | ######################################################################################## 43 | # code size 44 | 45 | function ci_code_size_setup { 46 | sudo apt-get update 47 | sudo apt-get install gcc-multilib 48 | gcc --version 49 | ci_gcc_arm_setup 50 | } 51 | 52 | function ci_code_size_build { 53 | # starts off at either the ref/pull/N/merge FETCH_HEAD, or the current branch HEAD 54 | git checkout -b pull_request # save the current location 55 | git remote add upstream https://github.com/micropython/micropython.git 56 | git fetch --depth=100 upstream master 57 | # build reference, save to size0 58 | # ignore any errors with this build, in case master is failing 59 | git checkout `git merge-base --fork-point upstream/master pull_request` 60 | git show -s 61 | tools/metrics.py clean bm 62 | tools/metrics.py build bm | tee ~/size0 || true 63 | # build PR/branch, save to size1 64 | git checkout pull_request 65 | git log upstream/master..HEAD 66 | tools/metrics.py clean bm 67 | tools/metrics.py build bm | tee ~/size1 68 | } 69 | 70 | ######################################################################################## 71 | # ports/cc3200 72 | 73 | function ci_cc3200_setup { 74 | ci_gcc_arm_setup 75 | } 76 | 77 | function ci_cc3200_build { 78 | make ${MAKEOPTS} -C ports/cc3200 BTARGET=application BTYPE=release 79 | make ${MAKEOPTS} -C ports/cc3200 BTARGET=bootloader BTYPE=release 80 | } 81 | 82 | ######################################################################################## 83 | # ports/esp32 84 | 85 | function ci_esp32_setup_helper { 86 | git clone https://github.com/espressif/esp-idf.git 87 | git -C esp-idf checkout $1 88 | git -C esp-idf submodule update --init \ 89 | components/bt/host/nimble/nimble \ 90 | components/esp_wifi \ 91 | components/esptool_py/esptool \ 92 | components/lwip/lwip \ 93 | components/mbedtls/mbedtls 94 | if [ -d esp-idf/components/bt/controller/esp32 ]; then 95 | git -C esp-idf submodule update --init \ 96 | components/bt/controller/lib_esp32 \ 97 | components/bt/controller/lib_esp32c3_family 98 | else 99 | git -C esp-idf submodule update --init \ 100 | components/bt/controller/lib 101 | fi 102 | ./esp-idf/install.sh 103 | } 104 | 105 | function ci_esp32_idf402_setup { 106 | ci_esp32_setup_helper v4.0.2 107 | } 108 | 109 | function ci_esp32_idf44_setup { 110 | # This commit is just before v5.0-dev 111 | # ci_esp32_setup_helper 142bb32c50fa9875b8b69fa539a2d59559460d72 112 | ci_esp32_setup_helper v4.4 113 | 114 | } 115 | 116 | function ci_esp32_build { 117 | source esp-idf/export.sh 118 | make ${MAKEOPTS} -C mpy-cross 119 | make ${MAKEOPTS} -C ports/esp32 submodules 120 | make ${MAKEOPTS} -C ports/esp32 BOARD=GENERIC_ULAB_LVGL_SPIRAM USER_C_MODULES=${GITHUB_WORKSPACE}/micropython-ulab/code/micropython.cmake LV_CFLAGS="-DLV_COLOR_DEPTH=16 -DLV_COLOR_16_SWAP=1" FROZEN_MANIFEST=$(pwd)/ports/esp32/boards/manifest.py 121 | # if [ -d $IDF_PATH/components/esp32c3 ]; then 122 | # make ${MAKEOPTS} -C ports/esp32 BOARD=GENERIC_C3 123 | # fi 124 | # if [ -d $IDF_PATH/components/esp32s2 ]; then 125 | # make ${MAKEOPTS} -C ports/esp32 BOARD=GENERIC_S2 126 | # fi 127 | # if [ -d $IDF_PATH/components/esp32s3 ]; then 128 | # make ${MAKEOPTS} -C ports/esp32 BOARD=GENERIC_S3 129 | # fi 130 | } 131 | 132 | ######################################################################################## 133 | # ports/esp8266 134 | 135 | function ci_esp8266_setup { 136 | sudo pip install pyserial esptool 137 | wget https://github.com/jepler/esp-open-sdk/releases/download/2018-06-10/xtensa-lx106-elf-standalone.tar.gz 138 | zcat xtensa-lx106-elf-standalone.tar.gz | tar x 139 | # Remove this esptool.py so pip version is used instead 140 | rm xtensa-lx106-elf/bin/esptool.py 141 | } 142 | 143 | function ci_esp8266_path { 144 | echo $(pwd)/xtensa-lx106-elf/bin 145 | } 146 | 147 | function ci_esp8266_build { 148 | make ${MAKEOPTS} -C mpy-cross 149 | make ${MAKEOPTS} -C ports/esp8266 submodules 150 | make ${MAKEOPTS} -C ports/esp8266 151 | make ${MAKEOPTS} -C ports/esp8266 BOARD=GENERIC_512K 152 | make ${MAKEOPTS} -C ports/esp8266 BOARD=GENERIC_1M 153 | } 154 | 155 | ######################################################################################## 156 | # ports/javascript 157 | 158 | function ci_javascript_setup { 159 | git clone https://github.com/emscripten-core/emsdk.git 160 | (cd emsdk && ./emsdk install latest && ./emsdk activate latest) 161 | } 162 | 163 | function ci_javascript_build { 164 | source emsdk/emsdk_env.sh 165 | git submodule update --init --recursive lib/lv_bindings 166 | make ${MAKEOPTS} -C ports/javascript 167 | } 168 | 169 | function ci_javascript_run_tests { 170 | # This port is very slow at running, so only run a few of the tests. 171 | (cd tests && MICROPY_MICROPYTHON=../ports/javascript/node_run.sh ./run-tests.py -j1 basics/builtin_*.py) 172 | } 173 | 174 | ######################################################################################## 175 | # ports/mimxrt 176 | 177 | function ci_mimxrt_setup { 178 | ci_gcc_arm_setup 179 | } 180 | 181 | function ci_mimxrt_build { 182 | make ${MAKEOPTS} -C mpy-cross 183 | make ${MAKEOPTS} -C ports/mimxrt submodules 184 | make ${MAKEOPTS} -C ports/mimxrt BOARD=MIMXRT1020_EVK 185 | make ${MAKEOPTS} -C ports/mimxrt BOARD=TEENSY40 186 | } 187 | 188 | ######################################################################################## 189 | # ports/nrf 190 | 191 | function ci_nrf_setup { 192 | ci_gcc_arm_setup 193 | } 194 | 195 | function ci_nrf_build { 196 | ports/nrf/drivers/bluetooth/download_ble_stack.sh s140_nrf52_6_1_1 197 | make ${MAKEOPTS} -C mpy-cross 198 | make ${MAKEOPTS} -C ports/nrf submodules 199 | make ${MAKEOPTS} -C ports/nrf BOARD=pca10040 200 | make ${MAKEOPTS} -C ports/nrf BOARD=microbit 201 | make ${MAKEOPTS} -C ports/nrf BOARD=pca10056 SD=s140 202 | make ${MAKEOPTS} -C ports/nrf BOARD=pca10090 203 | } 204 | 205 | ######################################################################################## 206 | # ports/powerpc 207 | 208 | function ci_powerpc_setup { 209 | sudo apt-get update 210 | sudo apt-get install gcc-powerpc64le-linux-gnu libc6-dev-ppc64el-cross 211 | } 212 | 213 | function ci_powerpc_build { 214 | make ${MAKEOPTS} -C ports/powerpc UART=potato 215 | make ${MAKEOPTS} -C ports/powerpc UART=lpc_serial 216 | } 217 | 218 | ######################################################################################## 219 | # ports/qemu-arm 220 | 221 | function ci_qemu_arm_setup { 222 | ci_gcc_arm_setup 223 | sudo apt-get update 224 | sudo apt-get install qemu-system 225 | qemu-system-arm --version 226 | } 227 | 228 | function ci_qemu_arm_build { 229 | make ${MAKEOPTS} -C mpy-cross 230 | make ${MAKEOPTS} -C ports/qemu-arm CFLAGS_EXTRA=-DMP_ENDIANNESS_BIG=1 231 | make ${MAKEOPTS} -C ports/qemu-arm clean 232 | make ${MAKEOPTS} -C ports/qemu-arm -f Makefile.test test 233 | make ${MAKEOPTS} -C ports/qemu-arm -f Makefile.test clean 234 | make ${MAKEOPTS} -C ports/qemu-arm -f Makefile.test BOARD=sabrelite test 235 | } 236 | 237 | ######################################################################################## 238 | # ports/rp2 239 | 240 | function ci_rp2_setup { 241 | ci_gcc_arm_setup 242 | } 243 | 244 | function ci_rp2_build { 245 | make ${MAKEOPTS} -C mpy-cross 246 | git submodule update --init lib/pico-sdk lib/tinyusb 247 | make ${MAKEOPTS} -C ports/rp2 248 | make ${MAKEOPTS} -C ports/rp2 clean 249 | make ${MAKEOPTS} -C ports/rp2 USER_C_MODULES=../../examples/usercmodule/micropython.cmake 250 | } 251 | 252 | ######################################################################################## 253 | # ports/samd 254 | 255 | function ci_samd_setup { 256 | ci_gcc_arm_setup 257 | } 258 | 259 | function ci_samd_build { 260 | make ${MAKEOPTS} -C ports/samd submodules 261 | make ${MAKEOPTS} -C ports/samd 262 | } 263 | 264 | ######################################################################################## 265 | # ports/stm32 266 | 267 | function ci_stm32_setup { 268 | ci_gcc_arm_setup 269 | pip3 install pyhy 270 | } 271 | 272 | function ci_stm32_pyb_build { 273 | make ${MAKEOPTS} -C mpy-cross 274 | make ${MAKEOPTS} -C ports/stm32 submodules 275 | git submodule update --init lib/btstack 276 | git submodule update --init lib/mynewt-nimble 277 | make ${MAKEOPTS} -C ports/stm32 BOARD=PYBV11 MICROPY_PY_WIZNET5K=5200 MICROPY_PY_CC3K=1 USER_C_MODULES=../../examples/usercmodule 278 | make ${MAKEOPTS} -C ports/stm32 BOARD=PYBD_SF2 279 | make ${MAKEOPTS} -C ports/stm32 BOARD=PYBD_SF6 NANBOX=1 MICROPY_BLUETOOTH_NIMBLE=0 MICROPY_BLUETOOTH_BTSTACK=1 280 | make ${MAKEOPTS} -C ports/stm32/mboot BOARD=PYBV10 CFLAGS_EXTRA='-DMBOOT_FSLOAD=1 -DMBOOT_VFS_LFS2=1' 281 | make ${MAKEOPTS} -C ports/stm32/mboot BOARD=PYBD_SF6 282 | } 283 | 284 | function ci_stm32_nucleo_build { 285 | make ${MAKEOPTS} -C mpy-cross 286 | make ${MAKEOPTS} -C ports/stm32 submodules 287 | git submodule update --init lib/mynewt-nimble 288 | 289 | # Test building various MCU families, some with additional options. 290 | make ${MAKEOPTS} -C ports/stm32 BOARD=NUCLEO_F091RC 291 | make ${MAKEOPTS} -C ports/stm32 BOARD=NUCLEO_H743ZI CFLAGS_EXTRA='-DMICROPY_PY_THREAD=1' 292 | make ${MAKEOPTS} -C ports/stm32 BOARD=NUCLEO_L073RZ 293 | make ${MAKEOPTS} -C ports/stm32 BOARD=NUCLEO_L476RG DEBUG=1 294 | 295 | # Test building a board with mboot packing enabled (encryption, signing, compression). 296 | make ${MAKEOPTS} -C ports/stm32 BOARD=NUCLEO_WB55 USE_MBOOT=1 MBOOT_ENABLE_PACKING=1 297 | make ${MAKEOPTS} -C ports/stm32/mboot BOARD=NUCLEO_WB55 USE_MBOOT=1 MBOOT_ENABLE_PACKING=1 298 | # Test mboot_pack_dfu.py created a valid file, and that its unpack-dfu command works. 299 | BOARD_WB55=ports/stm32/boards/NUCLEO_WB55 300 | BUILD_WB55=ports/stm32/build-NUCLEO_WB55 301 | python3 ports/stm32/mboot/mboot_pack_dfu.py -k $BOARD_WB55/mboot_keys.h unpack-dfu $BUILD_WB55/firmware.pack.dfu $BUILD_WB55/firmware.unpack.dfu 302 | diff $BUILD_WB55/firmware.unpack.dfu $BUILD_WB55/firmware.dfu 303 | # Test unpack-dfu command works without a secret key 304 | tail -n +2 $BOARD_WB55/mboot_keys.h > $BOARD_WB55/mboot_keys_no_sk.h 305 | python3 ports/stm32/mboot/mboot_pack_dfu.py -k $BOARD_WB55/mboot_keys_no_sk.h unpack-dfu $BUILD_WB55/firmware.pack.dfu $BUILD_WB55/firmware.unpack_no_sk.dfu 306 | diff $BUILD_WB55/firmware.unpack.dfu $BUILD_WB55/firmware.unpack_no_sk.dfu 307 | } 308 | 309 | ######################################################################################## 310 | # ports/teensy 311 | 312 | function ci_teensy_setup { 313 | ci_gcc_arm_setup 314 | } 315 | 316 | function ci_teensy_build { 317 | make ${MAKEOPTS} -C ports/teensy 318 | } 319 | 320 | ######################################################################################## 321 | # ports/unix 322 | 323 | CI_UNIX_OPTS_SYS_SETTRACE=( 324 | MICROPY_PY_BTREE=0 325 | MICROPY_PY_FFI=0 326 | MICROPY_PY_USSL=0 327 | CFLAGS_EXTRA="-DMICROPY_PY_SYS_SETTRACE=1" 328 | ) 329 | 330 | CI_UNIX_OPTS_SYS_SETTRACE_STACKLESS=( 331 | MICROPY_PY_BTREE=0 332 | MICROPY_PY_FFI=0 333 | MICROPY_PY_USSL=0 334 | CFLAGS_EXTRA="-DMICROPY_STACKLESS=1 -DMICROPY_STACKLESS_STRICT=1 -DMICROPY_PY_SYS_SETTRACE=1" 335 | ) 336 | 337 | CI_UNIX_OPTS_QEMU_MIPS=( 338 | CROSS_COMPILE=mips-linux-gnu- 339 | VARIANT=coverage 340 | MICROPY_STANDALONE=1 341 | LDFLAGS_EXTRA="-static" 342 | ) 343 | 344 | CI_UNIX_OPTS_QEMU_ARM=( 345 | CROSS_COMPILE=arm-linux-gnueabi- 346 | VARIANT=coverage 347 | MICROPY_STANDALONE=1 348 | ) 349 | 350 | function ci_unix_build_helper { 351 | make ${MAKEOPTS} -C mpy-cross 352 | make ${MAKEOPTS} -C ports/unix "$@" submodules 353 | make ${MAKEOPTS} -C ports/unix "$@" deplibs 354 | make ${MAKEOPTS} -C ports/unix "$@" 355 | } 356 | 357 | function ci_unix_build_ffi_lib_helper { 358 | $1 $2 -shared -o tests/unix/ffi_lib.so tests/unix/ffi_lib.c 359 | } 360 | 361 | function ci_unix_run_tests_helper { 362 | make -C ports/unix "$@" test 363 | } 364 | 365 | function ci_unix_run_tests_full_helper { 366 | variant=$1 367 | shift 368 | if [ $variant = standard ]; then 369 | micropython=micropython 370 | else 371 | micropython=micropython-$variant 372 | fi 373 | make -C ports/unix VARIANT=$variant "$@" test_full 374 | (cd tests && MICROPY_CPYTHON3=python3 MICROPY_MICROPYTHON=../ports/unix/$micropython ./run-multitests.py multi_net/*.py) 375 | } 376 | 377 | function ci_native_mpy_modules_build { 378 | if [ "$1" = "" ]; then 379 | arch=x64 380 | else 381 | arch=$1 382 | fi 383 | make -C examples/natmod/features1 ARCH=$arch 384 | make -C examples/natmod/features2 ARCH=$arch 385 | make -C examples/natmod/btree ARCH=$arch 386 | make -C examples/natmod/framebuf ARCH=$arch 387 | make -C examples/natmod/uheapq ARCH=$arch 388 | make -C examples/natmod/urandom ARCH=$arch 389 | make -C examples/natmod/ure ARCH=$arch 390 | make -C examples/natmod/uzlib ARCH=$arch 391 | } 392 | 393 | function ci_native_mpy_modules_32bit_build { 394 | ci_native_mpy_modules_build x86 395 | } 396 | 397 | function ci_unix_minimal_build { 398 | make ${MAKEOPTS} -C ports/unix VARIANT=minimal 399 | } 400 | 401 | function ci_unix_minimal_run_tests { 402 | (cd tests && MICROPY_CPYTHON3=python3 MICROPY_MICROPYTHON=../ports/unix/micropython-minimal ./run-tests.py -e exception_chain -e self_type_check -e subclass_native_init -d basics) 403 | } 404 | 405 | function ci_unix_standard_build { 406 | ci_unix_build_helper VARIANT=standard 407 | ci_unix_build_ffi_lib_helper gcc 408 | } 409 | 410 | function ci_unix_standard_run_tests { 411 | ci_unix_run_tests_full_helper standard 412 | } 413 | 414 | function ci_unix_standard_run_perfbench { 415 | (cd tests && MICROPY_CPYTHON3=python3 MICROPY_MICROPYTHON=../ports/unix/micropython ./run-perfbench.py 1000 1000) 416 | } 417 | 418 | function ci_unix_dev_build { 419 | ci_unix_build_helper VARIANT=dev 420 | } 421 | 422 | function ci_unix_dev_run_tests { 423 | ci_unix_run_tests_helper VARIANT=dev 424 | } 425 | 426 | function ci_unix_coverage_setup { 427 | sudo pip3 install setuptools 428 | sudo pip3 install pyelftools 429 | gcc --version 430 | python3 --version 431 | } 432 | 433 | function ci_unix_coverage_build { 434 | ci_unix_build_helper VARIANT=coverage 435 | ci_unix_build_ffi_lib_helper gcc 436 | } 437 | 438 | function ci_unix_coverage_run_tests { 439 | ci_unix_run_tests_full_helper coverage 440 | } 441 | 442 | function ci_unix_coverage_run_native_mpy_tests { 443 | MICROPYPATH=examples/natmod/features2 ./ports/unix/micropython-coverage -m features2 444 | (cd tests && ./run-natmodtests.py "$@" extmod/{btree*,framebuf*,uheapq*,ure*,uzlib*}.py) 445 | } 446 | 447 | function ci_unix_32bit_setup { 448 | sudo dpkg --add-architecture i386 449 | sudo apt-get update 450 | sudo apt-get install gcc-multilib g++-multilib libffi-dev:i386 451 | sudo pip3 install setuptools 452 | sudo pip3 install pyelftools 453 | gcc --version 454 | python2 --version 455 | python3 --version 456 | } 457 | 458 | function ci_unix_coverage_32bit_build { 459 | ci_unix_build_helper VARIANT=coverage MICROPY_FORCE_32BIT=1 460 | ci_unix_build_ffi_lib_helper gcc -m32 461 | } 462 | 463 | function ci_unix_coverage_32bit_run_tests { 464 | ci_unix_run_tests_full_helper coverage MICROPY_FORCE_32BIT=1 465 | } 466 | 467 | function ci_unix_coverage_32bit_run_native_mpy_tests { 468 | ci_unix_coverage_run_native_mpy_tests --arch x86 469 | } 470 | 471 | function ci_unix_nanbox_build { 472 | # Use Python 2 to check that it can run the build scripts 473 | ci_unix_build_helper PYTHON=python2 VARIANT=nanbox 474 | ci_unix_build_ffi_lib_helper gcc -m32 475 | } 476 | 477 | function ci_unix_nanbox_run_tests { 478 | ci_unix_run_tests_full_helper nanbox PYTHON=python2 479 | } 480 | 481 | function ci_unix_float_build { 482 | ci_unix_build_helper VARIANT=standard CFLAGS_EXTRA="-DMICROPY_FLOAT_IMPL=MICROPY_FLOAT_IMPL_FLOAT" 483 | ci_unix_build_ffi_lib_helper gcc 484 | } 485 | 486 | function ci_unix_float_run_tests { 487 | # TODO get this working: ci_unix_run_tests_full_helper standard CFLAGS_EXTRA="-DMICROPY_FLOAT_IMPL=MICROPY_FLOAT_IMPL_FLOAT" 488 | ci_unix_run_tests_helper CFLAGS_EXTRA="-DMICROPY_FLOAT_IMPL=MICROPY_FLOAT_IMPL_FLOAT" 489 | } 490 | 491 | function ci_unix_clang_setup { 492 | sudo apt-get install clang 493 | clang --version 494 | } 495 | 496 | function ci_unix_stackless_clang_build { 497 | make ${MAKEOPTS} -C mpy-cross CC=clang 498 | make ${MAKEOPTS} -C ports/unix submodules 499 | make ${MAKEOPTS} -C ports/unix CC=clang CFLAGS_EXTRA="-DMICROPY_STACKLESS=1 -DMICROPY_STACKLESS_STRICT=1" 500 | } 501 | 502 | function ci_unix_stackless_clang_run_tests { 503 | ci_unix_run_tests_helper CC=clang 504 | } 505 | 506 | function ci_unix_float_clang_build { 507 | make ${MAKEOPTS} -C mpy-cross CC=clang 508 | make ${MAKEOPTS} -C ports/unix submodules 509 | make ${MAKEOPTS} -C ports/unix CC=clang CFLAGS_EXTRA="-DMICROPY_FLOAT_IMPL=MICROPY_FLOAT_IMPL_FLOAT" 510 | } 511 | 512 | function ci_unix_float_clang_run_tests { 513 | ci_unix_run_tests_helper CC=clang 514 | } 515 | 516 | function ci_unix_settrace_build { 517 | make ${MAKEOPTS} -C mpy-cross 518 | make ${MAKEOPTS} -C ports/unix "${CI_UNIX_OPTS_SYS_SETTRACE[@]}" 519 | } 520 | 521 | function ci_unix_settrace_run_tests { 522 | ci_unix_run_tests_helper "${CI_UNIX_OPTS_SYS_SETTRACE[@]}" 523 | } 524 | 525 | function ci_unix_settrace_stackless_build { 526 | make ${MAKEOPTS} -C mpy-cross 527 | make ${MAKEOPTS} -C ports/unix "${CI_UNIX_OPTS_SYS_SETTRACE_STACKLESS[@]}" 528 | } 529 | 530 | function ci_unix_settrace_stackless_run_tests { 531 | ci_unix_run_tests_helper "${CI_UNIX_OPTS_SYS_SETTRACE_STACKLESS[@]}" 532 | } 533 | 534 | function ci_unix_macos_build { 535 | make ${MAKEOPTS} -C mpy-cross 536 | make ${MAKEOPTS} -C ports/unix submodules 537 | #make ${MAKEOPTS} -C ports/unix deplibs 538 | make ${MAKEOPTS} -C ports/unix 539 | # check for additional compiler errors/warnings 540 | make ${MAKEOPTS} -C ports/unix VARIANT=dev submodules 541 | make ${MAKEOPTS} -C ports/unix VARIANT=dev 542 | make ${MAKEOPTS} -C ports/unix VARIANT=coverage submodules 543 | make ${MAKEOPTS} -C ports/unix VARIANT=coverage 544 | } 545 | 546 | function ci_unix_macos_run_tests { 547 | # Issues with macOS tests: 548 | # - OSX has poor time resolution and these uasyncio tests do not have correct output 549 | # - import_pkg7 has a problem with relative imports 550 | # - urandom_basic has a problem with getrandbits(0) 551 | (cd tests && ./run-tests.py --exclude 'uasyncio_(basic|heaplock|lock|wait_task)' --exclude 'import_pkg7.py' --exclude 'urandom_basic.py') 552 | } 553 | 554 | function ci_unix_qemu_mips_setup { 555 | sudo apt-get update 556 | sudo apt-get install gcc-mips-linux-gnu g++-mips-linux-gnu 557 | sudo apt-get install qemu-user 558 | qemu-mips --version 559 | } 560 | 561 | function ci_unix_qemu_mips_build { 562 | # qemu-mips on GitHub Actions will seg-fault if not linked statically 563 | ci_unix_build_helper "${CI_UNIX_OPTS_QEMU_MIPS[@]}" 564 | } 565 | 566 | function ci_unix_qemu_mips_run_tests { 567 | # Issues with MIPS tests: 568 | # - (i)listdir does not work, it always returns the empty list (it's an issue with the underlying C call) 569 | # - ffi tests do not work 570 | file ./ports/unix/micropython-coverage 571 | (cd tests && MICROPY_MICROPYTHON=../ports/unix/micropython-coverage ./run-tests.py --exclude 'vfs_posix.py' --exclude 'ffi_(callback|float|float2).py') 572 | } 573 | 574 | function ci_unix_qemu_arm_setup { 575 | sudo apt-get update 576 | sudo apt-get install gcc-arm-linux-gnueabi g++-arm-linux-gnueabi 577 | sudo apt-get install qemu-user 578 | qemu-arm --version 579 | } 580 | 581 | function ci_unix_qemu_arm_build { 582 | ci_unix_build_helper "${CI_UNIX_OPTS_QEMU_ARM[@]}" 583 | ci_unix_build_ffi_lib_helper arm-linux-gnueabi-gcc 584 | } 585 | 586 | function ci_unix_qemu_arm_run_tests { 587 | # Issues with ARM tests: 588 | # - (i)listdir does not work, it always returns the empty list (it's an issue with the underlying C call) 589 | export QEMU_LD_PREFIX=/usr/arm-linux-gnueabi 590 | file ./ports/unix/micropython-coverage 591 | (cd tests && MICROPY_MICROPYTHON=../ports/unix/micropython-coverage ./run-tests.py --exclude 'vfs_posix.py') 592 | } 593 | 594 | ######################################################################################## 595 | # ports/windows 596 | 597 | function ci_windows_setup { 598 | sudo apt-get install gcc-mingw-w64 599 | } 600 | 601 | function ci_windows_build { 602 | make ${MAKEOPTS} -C mpy-cross 603 | make ${MAKEOPTS} -C ports/windows CROSS_COMPILE=i686-w64-mingw32- 604 | } 605 | 606 | ######################################################################################## 607 | # ports/zephyr 608 | 609 | ZEPHYR_DOCKER_VERSION=v0.21.0 610 | ZEPHYR_SDK_VERSION=0.13.2 611 | ZEPHYR_VERSION=v2.7.0 612 | 613 | function ci_zephyr_setup { 614 | docker pull zephyrprojectrtos/ci:${ZEPHYR_DOCKER_VERSION} 615 | docker run --name zephyr-ci -d -it \ 616 | -v "$(pwd)":/micropython \ 617 | -e ZEPHYR_SDK_INSTALL_DIR=/opt/toolchains/zephyr-sdk-${ZEPHYR_SDK_VERSION} \ 618 | -e ZEPHYR_TOOLCHAIN_VARIANT=zephyr \ 619 | -e ZEPHYR_BASE=/zephyrproject/zephyr \ 620 | -w /micropython/ports/zephyr \ 621 | zephyrprojectrtos/ci:${ZEPHYR_DOCKER_VERSION} 622 | docker ps -a 623 | } 624 | 625 | function ci_zephyr_install { 626 | docker exec zephyr-ci west init --mr ${ZEPHYR_VERSION} /zephyrproject 627 | docker exec -w /zephyrproject zephyr-ci west update 628 | docker exec -w /zephyrproject zephyr-ci west zephyr-export 629 | } 630 | 631 | function ci_zephyr_build { 632 | docker exec zephyr-ci west build -p auto -b qemu_x86 -- -DCONF_FILE=prj_minimal.conf 633 | docker exec zephyr-ci west build -p auto -b qemu_x86 634 | docker exec zephyr-ci west build -p auto -b frdm_k64f 635 | docker exec zephyr-ci west build -p auto -b mimxrt1050_evk 636 | docker exec zephyr-ci west build -p auto -b nucleo_wb55rg # for bluetooth 637 | } 638 | -------------------------------------------------------------------------------- /lib/lv_bindings/lv_conf.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file lv_conf.h 3 | * Configuration file for v8.1.1-dev 4 | */ 5 | 6 | /* 7 | * Copy this file as `lv_conf.h` 8 | * 1. simply next to the `lvgl` folder 9 | * 2. or any other places and 10 | * - define `LV_CONF_INCLUDE_SIMPLE` 11 | * - add the path as include path 12 | */ 13 | 14 | /* clang-format off */ 15 | #if 1 /*Set it to "1" to enable content*/ 16 | 17 | #ifndef LV_CONF_H 18 | #define LV_CONF_H 19 | 20 | #include 21 | 22 | /*==================== 23 | COLOR SETTINGS 24 | *====================*/ 25 | 26 | /*Color depth: 1 (1 byte per pixel), 8 (RGB332), 16 (RGB565), 32 (ARGB8888)*/ 27 | #ifndef LV_COLOR_DEPTH 28 | #define LV_COLOR_DEPTH 32 29 | #endif 30 | 31 | /*Swap the 2 bytes of RGB565 color. Useful if the display has an 8-bit interface (e.g. SPI)*/ 32 | #ifndef LV_COLOR_16_SWAP 33 | #define LV_COLOR_16_SWAP 0 34 | #endif 35 | 36 | /*Enable more complex drawing routines to manage screens transparency. 37 | *Can be used if the UI is above another layer, e.g. an OSD menu or video player. 38 | *Requires `LV_COLOR_DEPTH = 32` colors and the screen's `bg_opa` should be set to non LV_OPA_COVER value*/ 39 | #define LV_COLOR_SCREEN_TRANSP 0 40 | 41 | /* Adjust color mix functions rounding. GPUs might calculate color mix (blending) differently. 42 | * 0: round down, 64: round up from x.75, 128: round up from half, 192: round up from x.25, 254: round up */ 43 | #define LV_COLOR_MIX_ROUND_OFS (LV_COLOR_DEPTH == 32 ? 0: 128) 44 | 45 | /*Images pixels with this color will not be drawn if they are chroma keyed)*/ 46 | #define LV_COLOR_CHROMA_KEY lv_color_hex(0x00ff00) /*pure green*/ 47 | 48 | /*========================= 49 | MEMORY SETTINGS 50 | *=========================*/ 51 | 52 | /*1: use custom malloc/free, 0: use the built-in `lv_mem_alloc()` and `lv_mem_free()`*/ 53 | #define LV_MEM_CUSTOM 1 54 | #if LV_MEM_CUSTOM == 0 55 | /*Size of the memory available for `lv_mem_alloc()` in bytes (>= 2kB)*/ 56 | #define LV_MEM_SIZE (32U * 1024U) /*[bytes]*/ 57 | 58 | /*Set an address for the memory pool instead of allocating it as a normal array. Can be in external SRAM too.*/ 59 | #define LV_MEM_ADR 0 /*0: unused*/ 60 | /*Instead of an address give a memory allocator that will be called to get a memory pool for LVGL. E.g. my_malloc*/ 61 | #if LV_MEM_ADR == 0 62 | //#define LV_MEM_POOL_INCLUDE your_alloc_library /* Uncomment if using an external allocator*/ 63 | //#define LV_MEM_POOL_ALLOC your_alloc /* Uncomment if using an external allocator*/ 64 | #endif 65 | 66 | #else /*LV_MEM_CUSTOM*/ 67 | #define LV_MEM_CUSTOM_INCLUDE "include/lv_mp_mem_custom_include.h" /*Header for the dynamic memory function*/ 68 | #define LV_MEM_CUSTOM_ALLOC m_malloc /*Wrapper to malloc*/ 69 | #define LV_MEM_CUSTOM_FREE m_free /*Wrapper to free*/ 70 | #define LV_MEM_CUSTOM_REALLOC m_realloc 71 | #endif /*LV_MEM_CUSTOM*/ 72 | 73 | /*Number of the intermediate memory buffer used during rendering and other internal processing mechanisms. 74 | *You will see an error log message if there wasn't enough buffers. */ 75 | #define LV_MEM_BUF_MAX_NUM 16 76 | 77 | /*Use the standard `memcpy` and `memset` instead of LVGL's own functions. (Might or might not be faster).*/ 78 | #define LV_MEMCPY_MEMSET_STD 0 79 | 80 | /*==================== 81 | HAL SETTINGS 82 | *====================*/ 83 | 84 | /*Default display refresh period. LVG will redraw changed areas with this period time*/ 85 | #define LV_DISP_DEF_REFR_PERIOD 30 /*[ms]*/ 86 | 87 | /*Input device read period in milliseconds*/ 88 | #define LV_INDEV_DEF_READ_PERIOD 30 /*[ms]*/ 89 | 90 | /*Use a custom tick source that tells the elapsed time in milliseconds. 91 | *It removes the need to manually update the tick with `lv_tick_inc()`)*/ 92 | #define LV_TICK_CUSTOM 0 93 | #if LV_TICK_CUSTOM 94 | #define LV_TICK_CUSTOM_INCLUDE "Arduino.h" /*Header for the system time function*/ 95 | #define LV_TICK_CUSTOM_SYS_TIME_EXPR (millis()) /*Expression evaluating to current system time in ms*/ 96 | #endif /*LV_TICK_CUSTOM*/ 97 | 98 | /*Default Dot Per Inch. Used to initialize default sizes such as widgets sized, style paddings. 99 | *(Not so important, you can adjust it to modify default sizes and spaces)*/ 100 | #define LV_DPI_DEF 130 /*[px/inch]*/ 101 | 102 | /*======================= 103 | * FEATURE CONFIGURATION 104 | *=======================*/ 105 | 106 | /*------------- 107 | * Drawing 108 | *-----------*/ 109 | 110 | /*Enable complex draw engine. 111 | *Required to draw shadow, gradient, rounded corners, circles, arc, skew lines, image transformations or any masks*/ 112 | #define LV_DRAW_COMPLEX 1 113 | #if LV_DRAW_COMPLEX != 0 114 | 115 | /*Allow buffering some shadow calculation. 116 | *LV_SHADOW_CACHE_SIZE is the max. shadow size to buffer, where shadow size is `shadow_width + radius` 117 | *Caching has LV_SHADOW_CACHE_SIZE^2 RAM cost*/ 118 | #define LV_SHADOW_CACHE_SIZE 0 119 | 120 | /* Set number of maximally cached circle data. 121 | * The circumference of 1/4 circle are saved for anti-aliasing 122 | * radius * 4 bytes are used per circle (the most often used radiuses are saved) 123 | * 0: to disable caching */ 124 | #define LV_CIRCLE_CACHE_SIZE 4 125 | 126 | #endif /*LV_DRAW_COMPLEX*/ 127 | 128 | /*Default image cache size. Image caching keeps the images opened. 129 | *If only the built-in image formats are used there is no real advantage of caching. (I.e. if no new image decoder is added) 130 | *With complex image decoders (e.g. PNG or JPG) caching can save the continuous open/decode of images. 131 | *However the opened images might consume additional RAM. 132 | *0: to disable caching*/ 133 | #define LV_IMG_CACHE_DEF_SIZE 1 134 | 135 | /*Maximum buffer size to allocate for rotation. Only used if software rotation is enabled in the display driver.*/ 136 | #define LV_DISP_ROT_MAX_BUF (10*1024) 137 | 138 | /*------------- 139 | * GPU 140 | *-----------*/ 141 | 142 | /*Use STM32's DMA2D (aka Chrom Art) GPU*/ 143 | #define LV_USE_GPU_STM32_DMA2D 0 144 | #if LV_USE_GPU_STM32_DMA2D 145 | /*Must be defined to include path of CMSIS header of target processor 146 | e.g. "stm32f769xx.h" or "stm32f429xx.h"*/ 147 | #define LV_GPU_DMA2D_CMSIS_INCLUDE 148 | #endif 149 | 150 | /*Use NXP's PXP GPU iMX RTxxx platforms*/ 151 | #define LV_USE_GPU_NXP_PXP 0 152 | #if LV_USE_GPU_NXP_PXP 153 | /*1: Add default bare metal and FreeRTOS interrupt handling routines for PXP (lv_gpu_nxp_pxp_osa.c) 154 | * and call lv_gpu_nxp_pxp_init() automatically during lv_init(). Note that symbol SDK_OS_FREE_RTOS 155 | * has to be defined in order to use FreeRTOS OSA, otherwise bare-metal implementation is selected. 156 | *0: lv_gpu_nxp_pxp_init() has to be called manually before lv_init() 157 | */ 158 | #define LV_USE_GPU_NXP_PXP_AUTO_INIT 0 159 | #endif 160 | 161 | /*Use NXP's VG-Lite GPU iMX RTxxx platforms*/ 162 | #define LV_USE_GPU_NXP_VG_LITE 0 163 | 164 | /*Use exnternal renderer*/ 165 | #define LV_USE_EXTERNAL_RENDERER 0 166 | 167 | /*Use SDL renderer API. Requires LV_USE_EXTERNAL_RENDERER*/ 168 | #define LV_USE_GPU_SDL 0 169 | #if LV_USE_GPU_SDL 170 | #define LV_GPU_SDL_INCLUDE_PATH 171 | #endif 172 | 173 | /*------------- 174 | * Logging 175 | *-----------*/ 176 | 177 | /*Enable the log module*/ 178 | #define LV_USE_LOG 1 179 | #if LV_USE_LOG 180 | 181 | /*How important log should be added: 182 | *LV_LOG_LEVEL_TRACE A lot of logs to give detailed information 183 | *LV_LOG_LEVEL_INFO Log important events 184 | *LV_LOG_LEVEL_WARN Log if something unwanted happened but didn't cause a problem 185 | *LV_LOG_LEVEL_ERROR Only critical issue, when the system may fail 186 | *LV_LOG_LEVEL_USER Only logs added by the user 187 | *LV_LOG_LEVEL_NONE Do not log anything*/ 188 | #define LV_LOG_LEVEL LV_LOG_LEVEL_WARN 189 | 190 | /*1: Print the log with 'printf'; 191 | *0: User need to register a callback with `lv_log_register_print_cb()`*/ 192 | #define LV_LOG_PRINTF 0 193 | 194 | /*Enable/disable LV_LOG_TRACE in modules that produces a huge number of logs*/ 195 | #define LV_LOG_TRACE_MEM 1 196 | #define LV_LOG_TRACE_TIMER 1 197 | #define LV_LOG_TRACE_INDEV 1 198 | #define LV_LOG_TRACE_DISP_REFR 1 199 | #define LV_LOG_TRACE_EVENT 1 200 | #define LV_LOG_TRACE_OBJ_CREATE 1 201 | #define LV_LOG_TRACE_LAYOUT 1 202 | #define LV_LOG_TRACE_ANIM 1 203 | 204 | #endif /*LV_USE_LOG*/ 205 | 206 | /*------------- 207 | * Asserts 208 | *-----------*/ 209 | 210 | /*Enable asserts if an operation is failed or an invalid data is found. 211 | *If LV_USE_LOG is enabled an error message will be printed on failure*/ 212 | #define LV_USE_ASSERT_NULL 1 /*Check if the parameter is NULL. (Very fast, recommended)*/ 213 | #define LV_USE_ASSERT_MALLOC 1 /*Checks is the memory is successfully allocated or no. (Very fast, recommended)*/ 214 | #define LV_USE_ASSERT_STYLE 0 /*Check if the styles are properly initialized. (Very fast, recommended)*/ 215 | #define LV_USE_ASSERT_MEM_INTEGRITY 0 /*Check the integrity of `lv_mem` after critical operations. (Slow)*/ 216 | #define LV_USE_ASSERT_OBJ 0 /*Check the object's type and existence (e.g. not deleted). (Slow)*/ 217 | 218 | /*Add a custom handler when assert happens e.g. to restart the MCU*/ 219 | #define LV_ASSERT_HANDLER_INCLUDE 220 | #define LV_ASSERT_HANDLER while(1); /*Halt by default*/ 221 | 222 | /*------------- 223 | * Others 224 | *-----------*/ 225 | 226 | /*1: Show CPU usage and FPS count in the right bottom corner*/ 227 | #define LV_USE_PERF_MONITOR 0 228 | #if LV_USE_PERF_MONITOR 229 | #define LV_USE_PERF_MONITOR_POS LV_ALIGN_BOTTOM_RIGHT 230 | #endif 231 | 232 | /*1: Show the used memory and the memory fragmentation in the left bottom corner 233 | * Requires LV_MEM_CUSTOM = 0*/ 234 | #define LV_USE_MEM_MONITOR 0 235 | #if LV_USE_PERF_MONITOR 236 | #define LV_USE_MEM_MONITOR_POS LV_ALIGN_BOTTOM_LEFT 237 | #endif 238 | 239 | /*1: Draw random colored rectangles over the redrawn areas*/ 240 | #define LV_USE_REFR_DEBUG 0 241 | 242 | /*Change the built in (v)snprintf functions*/ 243 | #define LV_SPRINTF_CUSTOM 1 244 | #if LV_SPRINTF_CUSTOM 245 | #define LV_SPRINTF_INCLUDE 246 | #define lv_snprintf snprintf 247 | #define lv_vsnprintf vsnprintf 248 | #else /*LV_SPRINTF_CUSTOM*/ 249 | #define LV_SPRINTF_USE_FLOAT 0 250 | #endif /*LV_SPRINTF_CUSTOM*/ 251 | 252 | #define LV_USE_USER_DATA 1 253 | 254 | /*Garbage Collector settings 255 | *Used if lvgl is bound to higher level language and the memory is managed by that language*/ 256 | #define LV_ENABLE_GC 1 /* Enable GC for Micropython */ 257 | #if LV_ENABLE_GC != 0 258 | #define LV_GC_INCLUDE "py/mpstate.h" 259 | #define LV_MEM_CUSTOM_GET_SIZE gc_nbytes /*Wrapper to lv_mem_get_size*/ 260 | #define LV_GC_ROOT(x) MP_STATE_PORT(x) 261 | #endif /*LV_ENABLE_GC*/ 262 | 263 | /*===================== 264 | * COMPILER SETTINGS 265 | *====================*/ 266 | 267 | /*For big endian systems set to 1*/ 268 | #define LV_BIG_ENDIAN_SYSTEM 0 269 | 270 | /*Define a custom attribute to `lv_tick_inc` function*/ 271 | #define LV_ATTRIBUTE_TICK_INC 272 | 273 | /*Define a custom attribute to `lv_timer_handler` function*/ 274 | #define LV_ATTRIBUTE_TIMER_HANDLER 275 | 276 | /*Define a custom attribute to `lv_disp_flush_ready` function*/ 277 | #define LV_ATTRIBUTE_FLUSH_READY 278 | 279 | /*Required alignment size for buffers*/ 280 | #define LV_ATTRIBUTE_MEM_ALIGN_SIZE 1 281 | 282 | /*Will be added where memories needs to be aligned (with -Os data might not be aligned to boundary by default). 283 | * E.g. __attribute__((aligned(4)))*/ 284 | #define LV_ATTRIBUTE_MEM_ALIGN 285 | 286 | /*Attribute to mark large constant arrays for example font's bitmaps*/ 287 | #define LV_ATTRIBUTE_LARGE_CONST 288 | 289 | /*Complier prefix for a big array declaration in RAM*/ 290 | #define LV_ATTRIBUTE_LARGE_RAM_ARRAY 291 | 292 | /*Place performance critical functions into a faster memory (e.g RAM)*/ 293 | #define LV_ATTRIBUTE_FAST_MEM 294 | 295 | /*Prefix variables that are used in GPU accelerated operations, often these need to be placed in RAM sections that are DMA accessible*/ 296 | #define LV_ATTRIBUTE_DMA 297 | 298 | /*Export integer constant to binding. This macro is used with constants in the form of LV_ that 299 | *should also appear on LVGL binding API such as Micropython.*/ 300 | #define LV_EXPORT_CONST_INT(int_value) enum {ENUM_##int_value = int_value} 301 | 302 | /*Extend the default -32k..32k coordinate range to -4M..4M by using int32_t for coordinates instead of int16_t*/ 303 | #define LV_USE_LARGE_COORD 0 304 | 305 | /*================== 306 | * FONT USAGE 307 | *===================*/ 308 | 309 | /*Montserrat fonts with ASCII range and some symbols using bpp = 4 310 | *https://fonts.google.com/specimen/Montserrat*/ 311 | #define LV_FONT_MONTSERRAT_8 0 312 | #define LV_FONT_MONTSERRAT_10 0 313 | #define LV_FONT_MONTSERRAT_12 0 314 | #define LV_FONT_MONTSERRAT_14 1 315 | #define LV_FONT_MONTSERRAT_16 1 316 | #define LV_FONT_MONTSERRAT_18 0 317 | #define LV_FONT_MONTSERRAT_20 0 318 | #define LV_FONT_MONTSERRAT_22 0 319 | #define LV_FONT_MONTSERRAT_24 0 320 | #define LV_FONT_MONTSERRAT_26 0 321 | #define LV_FONT_MONTSERRAT_28 1 322 | #define LV_FONT_MONTSERRAT_30 0 323 | #define LV_FONT_MONTSERRAT_32 0 324 | #define LV_FONT_MONTSERRAT_34 0 325 | #define LV_FONT_MONTSERRAT_36 0 326 | #define LV_FONT_MONTSERRAT_38 0 327 | #define LV_FONT_MONTSERRAT_40 0 328 | #define LV_FONT_MONTSERRAT_42 0 329 | #define LV_FONT_MONTSERRAT_44 0 330 | #define LV_FONT_MONTSERRAT_46 0 331 | #define LV_FONT_MONTSERRAT_48 0 332 | 333 | /*Demonstrate special features*/ 334 | #define LV_FONT_MONTSERRAT_12_SUBPX 0 335 | #define LV_FONT_MONTSERRAT_28_COMPRESSED 0 /*bpp = 3*/ 336 | #define LV_FONT_DEJAVU_16_PERSIAN_HEBREW 1 /*Hebrew, Arabic, Perisan letters and all their forms*/ 337 | #define LV_FONT_SIMSUN_16_CJK 0 /*1000 most common CJK radicals*/ 338 | 339 | /*Pixel perfect monospace fonts*/ 340 | #define LV_FONT_UNSCII_8 0 341 | #define LV_FONT_UNSCII_16 0 342 | 343 | /*Optionally declare custom fonts here. 344 | *You can use these fonts as default font too and they will be available globally. 345 | *E.g. #define LV_FONT_CUSTOM_DECLARE LV_FONT_DECLARE(my_font_1) LV_FONT_DECLARE(my_font_2)*/ 346 | #define LV_FONT_CUSTOM_DECLARE 347 | 348 | /*Always set a default font*/ 349 | #define LV_FONT_DEFAULT &lv_font_montserrat_14 350 | 351 | /*Enable handling large font and/or fonts with a lot of characters. 352 | *The limit depends on the font size, font face and bpp. 353 | *Compiler error will be triggered if a font needs it.*/ 354 | #define LV_FONT_FMT_TXT_LARGE 0 355 | 356 | /*Enables/disables support for compressed fonts.*/ 357 | #define LV_USE_FONT_COMPRESSED 0 358 | 359 | /*Enable subpixel rendering*/ 360 | #define LV_USE_FONT_SUBPX 0 361 | #if LV_USE_FONT_SUBPX 362 | /*Set the pixel order of the display. Physical order of RGB channels. Doesn't matter with "normal" fonts.*/ 363 | #define LV_FONT_SUBPX_BGR 0 /*0: RGB; 1:BGR order*/ 364 | #endif 365 | 366 | /*================= 367 | * TEXT SETTINGS 368 | *=================*/ 369 | 370 | /** 371 | * Select a character encoding for strings. 372 | * Your IDE or editor should have the same character encoding 373 | * - LV_TXT_ENC_UTF8 374 | * - LV_TXT_ENC_ASCII 375 | */ 376 | #define LV_TXT_ENC LV_TXT_ENC_UTF8 377 | 378 | /*Can break (wrap) texts on these chars*/ 379 | #define LV_TXT_BREAK_CHARS " ,.;:-_" 380 | 381 | /*If a word is at least this long, will break wherever "prettiest" 382 | *To disable, set to a value <= 0*/ 383 | #define LV_TXT_LINE_BREAK_LONG_LEN 0 384 | 385 | /*Minimum number of characters in a long word to put on a line before a break. 386 | *Depends on LV_TXT_LINE_BREAK_LONG_LEN.*/ 387 | #define LV_TXT_LINE_BREAK_LONG_PRE_MIN_LEN 3 388 | 389 | /*Minimum number of characters in a long word to put on a line after a break. 390 | *Depends on LV_TXT_LINE_BREAK_LONG_LEN.*/ 391 | #define LV_TXT_LINE_BREAK_LONG_POST_MIN_LEN 3 392 | 393 | /*The control character to use for signalling text recoloring.*/ 394 | #define LV_TXT_COLOR_CMD "#" 395 | 396 | /*Support bidirectional texts. Allows mixing Left-to-Right and Right-to-Left texts. 397 | *The direction will be processed according to the Unicode Bidirectional Algorithm: 398 | *https://www.w3.org/International/articles/inline-bidi-markup/uba-basics*/ 399 | #define LV_USE_BIDI 1 400 | #if LV_USE_BIDI 401 | /*Set the default direction. Supported values: 402 | *`LV_BASE_DIR_LTR` Left-to-Right 403 | *`LV_BASE_DIR_RTL` Right-to-Left 404 | *`LV_BASE_DIR_AUTO` detect texts base direction*/ 405 | #define LV_BIDI_BASE_DIR_DEF LV_BASE_DIR_AUTO 406 | #endif 407 | 408 | /*Enable Arabic/Persian processing 409 | *In these languages characters should be replaced with an other form based on their position in the text*/ 410 | #define LV_USE_ARABIC_PERSIAN_CHARS 1 411 | 412 | /*================== 413 | * WIDGET USAGE 414 | *================*/ 415 | 416 | /*Documentation of the widgets: https://docs.lvgl.io/latest/en/html/widgets/index.html*/ 417 | 418 | #define LV_USE_ARC 1 419 | 420 | #define LV_USE_ANIMIMG 1 421 | 422 | #define LV_USE_BAR 1 423 | 424 | #define LV_USE_BTN 1 425 | 426 | #define LV_USE_BTNMATRIX 1 427 | 428 | #define LV_USE_CANVAS 1 429 | 430 | #define LV_USE_CHECKBOX 1 431 | 432 | #define LV_USE_DROPDOWN 1 /*Requires: lv_label*/ 433 | 434 | #define LV_USE_IMG 1 /*Requires: lv_label*/ 435 | 436 | #define LV_USE_LABEL 1 437 | #if LV_USE_LABEL 438 | #define LV_LABEL_TEXT_SELECTION 1 /*Enable selecting text of the label*/ 439 | #define LV_LABEL_LONG_TXT_HINT 1 /*Store some extra info in labels to speed up drawing of very long texts*/ 440 | #endif 441 | 442 | #define LV_USE_LINE 1 443 | 444 | #define LV_USE_ROLLER 1 /*Requires: lv_label*/ 445 | #if LV_USE_ROLLER 446 | #define LV_ROLLER_INF_PAGES 7 /*Number of extra "pages" when the roller is infinite*/ 447 | #endif 448 | 449 | #define LV_USE_SLIDER 1 /*Requires: lv_bar*/ 450 | 451 | #define LV_USE_SWITCH 1 452 | 453 | #define LV_USE_TEXTAREA 1 /*Requires: lv_label*/ 454 | #if LV_USE_TEXTAREA != 0 455 | #define LV_TEXTAREA_DEF_PWD_SHOW_TIME 1500 /*ms*/ 456 | #endif 457 | 458 | #define LV_USE_TABLE 1 459 | 460 | /*================== 461 | * EXTRA COMPONENTS 462 | *==================*/ 463 | 464 | /*----------- 465 | * Widgets 466 | *----------*/ 467 | #define LV_USE_CALENDAR 1 468 | #if LV_USE_CALENDAR 469 | #define LV_CALENDAR_WEEK_STARTS_MONDAY 0 470 | #if LV_CALENDAR_WEEK_STARTS_MONDAY 471 | #define LV_CALENDAR_DEFAULT_DAY_NAMES {"Mo", "Tu", "We", "Th", "Fr", "Sa", "Su"} 472 | #else 473 | #define LV_CALENDAR_DEFAULT_DAY_NAMES {"Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"} 474 | #endif 475 | 476 | #define LV_CALENDAR_DEFAULT_MONTH_NAMES {"January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"} 477 | #define LV_USE_CALENDAR_HEADER_ARROW 1 478 | #define LV_USE_CALENDAR_HEADER_DROPDOWN 1 479 | #endif /*LV_USE_CALENDAR*/ 480 | 481 | #define LV_USE_CHART 1 482 | 483 | #define LV_USE_COLORWHEEL 1 484 | 485 | #define LV_USE_IMGBTN 1 486 | 487 | #define LV_USE_KEYBOARD 1 488 | 489 | #define LV_USE_LED 1 490 | 491 | #define LV_USE_LIST 1 492 | 493 | #define LV_USE_METER 1 494 | 495 | #define LV_USE_MSGBOX 1 496 | 497 | #define LV_USE_SPINBOX 1 498 | 499 | #define LV_USE_SPINNER 1 500 | 501 | #define LV_USE_TABVIEW 1 502 | 503 | #define LV_USE_TILEVIEW 1 504 | 505 | #define LV_USE_WIN 1 506 | 507 | #define LV_USE_SPAN 1 508 | #if LV_USE_SPAN 509 | /*A line text can contain maximum num of span descriptor */ 510 | #define LV_SPAN_SNIPPET_STACK_SIZE 64 511 | #endif 512 | 513 | /*----------- 514 | * Themes 515 | *----------*/ 516 | 517 | /*A simple, impressive and very complete theme*/ 518 | #define LV_USE_THEME_DEFAULT 1 519 | #if LV_USE_THEME_DEFAULT 520 | 521 | /*0: Light mode; 1: Dark mode*/ 522 | #define LV_THEME_DEFAULT_DARK 0 523 | 524 | /*1: Enable grow on press*/ 525 | #define LV_THEME_DEFAULT_GROW 1 526 | 527 | /*Default transition time in [ms]*/ 528 | #define LV_THEME_DEFAULT_TRANSITION_TIME 80 529 | #endif /*LV_USE_THEME_DEFAULT*/ 530 | 531 | /*A very simple theme that is a good starting point for a custom theme*/ 532 | #define LV_USE_THEME_BASIC 1 533 | 534 | /*A theme designed for monochrome displays*/ 535 | #define LV_USE_THEME_MONO 1 536 | 537 | /*----------- 538 | * Layouts 539 | *----------*/ 540 | 541 | /*A layout similar to Flexbox in CSS.*/ 542 | #define LV_USE_FLEX 1 543 | 544 | /*A layout similar to Grid in CSS.*/ 545 | #define LV_USE_GRID 1 546 | 547 | /*--------------------- 548 | * 3rd party libraries 549 | *--------------------*/ 550 | 551 | /*File system interfaces for common APIs 552 | *To enable set a driver letter for that API*/ 553 | #define LV_USE_FS_STDIO '\0' /*Uses fopen, fread, etc*/ 554 | //#define LV_FS_STDIO_PATH "/home/john/" /*Set the working directory. If commented it will be "./" */ 555 | 556 | #define LV_USE_FS_POSIX '\0' /*Uses open, read, etc*/ 557 | //#define LV_FS_POSIX_PATH "/home/john/" /*Set the working directory. If commented it will be "./" */ 558 | 559 | #define LV_USE_FS_WIN32 '\0' /*Uses CreateFile, ReadFile, etc*/ 560 | //#define LV_FS_WIN32_PATH "C:\\Users\\john\\" /*Set the working directory. If commented it will be ".\\" */ 561 | 562 | #define LV_USE_FS_FATFS '\0' /*Uses f_open, f_read, etc*/ 563 | 564 | /*PNG decoder library*/ 565 | #define LV_USE_PNG 0 566 | 567 | /*BMP decoder library*/ 568 | #define LV_USE_BMP 1 569 | 570 | /* JPG + split JPG decoder library. 571 | * Split JPG is a custom format optimized for embedded systems. */ 572 | #define LV_USE_SJPG 1 573 | 574 | /*GIF decoder library*/ 575 | #define LV_USE_GIF 1 576 | 577 | /*QR code library*/ 578 | #define LV_USE_QRCODE 1 579 | 580 | /*FreeType library, if available*/ 581 | #ifdef MICROPY_FREETYPE 582 | #define LV_USE_FREETYPE 1 583 | #else 584 | #define LV_USE_FREETYPE 0 585 | #endif 586 | 587 | #if LV_USE_FREETYPE 588 | /*Memory used by FreeType to cache characters [bytes] (-1: no caching)*/ 589 | #define LV_FREETYPE_CACHE_SIZE (16 * 1024) 590 | #if LV_FREETYPE_CACHE_SIZE >= 0 591 | /* 1: bitmap cache use the sbit cache, 0:bitmap cache use the image cache. */ 592 | /* sbit cache:it is much more memory efficient for small bitmaps(font size < 256) */ 593 | /* if font size >= 256, must be configured as image cache */ 594 | #define LV_FREETYPE_SBIT_CACHE 0 595 | /* Maximum number of opened FT_Face/FT_Size objects managed by this cache instance. */ 596 | /* (0:use system defaults) */ 597 | #define LV_FREETYPE_CACHE_FT_FACES 0 598 | #define LV_FREETYPE_CACHE_FT_SIZES 0 599 | #endif 600 | #endif 601 | 602 | /*Rlottie library, if available */ 603 | #ifdef MICROPY_RLOTTIE 604 | #define LV_USE_RLOTTIE 1 605 | #else 606 | #define LV_USE_RLOTTIE 0 607 | #endif 608 | 609 | /*FFmpeg library for image decoding and playing videos 610 | *Supports all major image formats so do not enable other image decoder with it*/ 611 | #define LV_USE_FFMPEG 0 612 | #if LV_USE_FFMPEG 613 | /*Dump input information to stderr*/ 614 | #define LV_FFMPEG_AV_DUMP_FORMAT 0 615 | #endif 616 | 617 | /*----------- 618 | * Others 619 | *----------*/ 620 | 621 | /*1: Enable API to take snapshot for object*/ 622 | #define LV_USE_SNAPSHOT 1 623 | 624 | 625 | /*================== 626 | * EXAMPLES 627 | *==================*/ 628 | 629 | /*Enable the examples to be built with the library*/ 630 | #define LV_BUILD_EXAMPLES 1 631 | 632 | /*--END OF LV_CONF_H--*/ 633 | 634 | #endif /*LV_CONF_H*/ 635 | 636 | #endif /*End of "Content enable"*/ 637 | --------------------------------------------------------------------------------