Skip to content

Commit

Permalink
Upload vision_v2 project
Browse files Browse the repository at this point in the history
  • Loading branch information
Love4yzp committed Feb 21, 2024
1 parent 11bf616 commit 0de906f
Show file tree
Hide file tree
Showing 563 changed files with 330,611 additions and 0 deletions.
17 changes: 17 additions & 0 deletions examples/vision_v2_display/.cproject
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?fileVersion 4.0.0?><cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage">
<storageModule moduleId="org.eclipse.cdt.core.settings">
<cconfiguration id="org.eclipse.cdt.core.default.config.881765443">
<storageModule buildSystemId="org.eclipse.cdt.core.defaultConfigDataProvider" id="org.eclipse.cdt.core.default.config.881765443" moduleId="org.eclipse.cdt.core.settings" name="Configuration">
<externalSettings/>
<extensions/>
</storageModule>
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
</cconfiguration>
</storageModule>
<storageModule moduleId="org.eclipse.cdt.core.pathentry">
<pathentry kind="src" path=""/>
<pathentry excluding="**/CMakeFiles/**" kind="out" path="build"/>
</storageModule>
<storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
</cproject>
20 changes: 20 additions & 0 deletions examples/vision_v2_display/.project
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>vision_v2_wifi</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.cdt.core.cBuilder</name>
<triggers>clean,full,incremental,</triggers>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.cdt.core.cnature</nature>
<nature>org.eclipse.cdt.core.ccnature</nature>
<nature>org.eclipse.cdt.cmake.core.cmakeNature</nature>
</natures>
</projectDescription>
13 changes: 13 additions & 0 deletions examples/vision_v2_display/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# The following lines of boilerplate have to be in your project's
# CMakeLists in this exact order for cmake to work correctly
cmake_minimum_required(VERSION 3.5)

set(IDF_TARGET esp32s3)

include($ENV{IDF_PATH}/tools/cmake/project.cmake)

set(EXTRA_COMPONENT_DIRS components)

add_compile_options(-fdiagnostics-color=always -w)

project(vision_v2_wifi)
62 changes: 62 additions & 0 deletions examples/vision_v2_display/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# ESP-IDF / CMake / Eclipse / VScode project for Seeed Studio SenseCAP Indicator development-device exported by SquareLine Studio


## Prerequisites

- Get and install ESP-IDF toolchain and its dependencies.
[ESP-IDF Get started](https://docs.espressif.com/projects/esp-idf/en/latest/esp32/get-started/index.html)

- Install ESP-IDF on Windows: [Description page](https://docs.espressif.com/projects/esp-idf/en/latest/esp32/get-started/windows-setup.html)
- There's a ESP-related IDE too, made by Espressif, containing ESP-IDF, called Espressif-IDE which is based on Eclipse CDT. [Espressif-IDE](https://github.com/espressif/idf-eclipse-plugin/blob/master/docs/Espressif-IDE.md)
- Get the [ESP-IDF offline Windows installer](https://dl.espressif.com/dl/idf-installer/esp-idf-tools-setup-offline-5.1.1.exe?) or [Espressif-IDE Windows installer](https://dl.espressif.com/dl/idf-installer/espressif-ide-setup-2.11.0-with-esp-idf-5.1.1.exe)
- Install it on your Windows system accepting all offered options and default settings. This automagically installs Python, git, CMake, etc all at once under C:\Espressif folder.
- You can start building in command-line from the PowerShell/CMD entries created in the start-menu, but with the help of the included build.bat you can build on a normal commandline too
- Or you can build the project in the IDE GUI, see 'Usage' section.

- Install ESP-IDF on Linux/MacOS: [Description page](https://docs.espressif.com/projects/esp-idf/en/latest/esp32/get-started/linux-macos-setup.html)
- Get Python3, git, cmake, ninja-build, wget, flex, bison, libusb, etc
- In a directory (preferably a created $HOME/esp) type `git clone --recursive https://github.com/espressif/esp-idf.git`
- (This gets the latest version into an 'esp-idf' subfolder. In ESP-IDF v5.0 a patch is needed to set PSRAM frequency to 120MHz.)
- In the esp-idf directory run `./install.sh`, then you can add ESP32S3 support (needed for SenseCAP indicator) by `./install.sh esp32s3`
- To use ESP-IDF ('idf.py') you need to type `. ./export.sh`, but it's only active in the current shell.
- (To call it in any shell later easily, add `alias get_idf='. $HOME/esp/esp-idf/export.sh'` to your .bashrc file, so a `get_idf` command will get the IDF environment temporarily.)


## Usage

### Building the project and flashing to the device from command-line
- In this folder type `idf.py build` command to build the binaries for the SenseCAP indicator (in 'build' folder, a full `sdkconfig` file will be created if it didn't exist)
(If the compiled application .bin file doesn't fit into the 'app' partition a size-check error will follow. In this project the app partition is set to 7MB in 'partitions.csv' file, total flash of SenseCAP is 8MB)
- To flash it to the device use `idf.py flash` command, after flashing or when switched on, it will start automatically. (If you issue this command first, it will build the project beforehand, if not already built.)
- (To monitor the output of the running application you can use `idf.py monitor` command. It will restart the device. It can be used together with flashing: `idf.py flash monitor`. Press Control+] to exit the monitor-shell.)
- (The SenseCAP device port is detected automatically, but you can specify it with -p <portname> argument, e.g. `idf.py -p /dev/ttyUSB0 monitor` or `idf.py -p COM6 flash`.)

### Project customization
- ESP-IDF uses 'menuconfig' to create the 'sdkconfig' (based on Kconfig) file which holds the whole configuration of the project (including detailed component settings), use the `idf.py menuconfig` command to start it
- (sdkconfig in an ESP-IDF project has LVGL-configuration in the 'Component config' subcategory and 'lv_conf.h' as such is no longer used to configure LVGL features.)
- In this project all built-in ('montserrat') LVGL fonts are enabled. If you want to add/remove the LVGL built-infonts to select only the fonts your project needs look in submenu: Component config / LVGL configuration / Font usage / Enable built-in fonts.
- Above ESP-IDF 5.0 the 120MHz speed option for the PSRAM (necessary for SenseCAP Indicator) is selectable (no patch needed) after enabling 'Make experimental features visible', and is enabled in submenu: Components / ESP PSRAM / SPI RAM config / Set RAM clock speed
- Exit from menuconfig by Q and answer Y to save the modifications to file 'sdkconfig'.
- (If you want a clean sdkconfig file containing only the modifications you can type `idf.py save-defconfig` to get it. The resulting `sdkconfig.defaults` file will be used if `sdkconfig` file is not found.)
- (You can edit 'sdkconfig.defaults' directly by hand, and if you delete 'sdkconfig' and rebuild the project, it will be recreated. But please leave 'CONFIG_LV_MEM_CUSTOM=y' setting untouched, otherwise you might face a freeze.)


## Alternative build-methods/tools

- Command-line CMake-based building works as well, but the above-mentioned 'export.sh' or 'get_idf' should be used beforehand to pull the IDF environment into the terminal,
- You need to create a 'build' folder (to avoid littering the project-folder), cd into it then type `cmake -G "Ninja" ..` to generate the files (or `cmake ..` for the slower 'Make' based build)
- When the makefile gets generated you can build it with `ninja -j 4` command ('-j 4' tells it to use 4 CPUs if possible) and flash with `ninja flash` command
- To make this easier there's a `build.sh` and `build.bat` file which does this plus cleans build-folder before every build, and then `flash.sh` or `flash.bat` uploads the program into the device.

- For GUI-based development Visual Studio Code and Eclipse-IDE basic project files are included too so you can build in these tools too, as the project files are based on CMake.

- Eclipse CDT has a plugin described at [Eclipse Marketplace ESP-IDF plugin](https://marketplace.eclipse.org/content/esp-idf-eclipse-plugin) and [ESP-IDF plugin github-page](https://github.com/espressif/idf-eclipse-plugin)
- In 'Help' / 'Install new software' submenu you can install 'Espressif IDF' from 'https://dl.espressif.com/dl/idf-eclipse-plugin/updates/latest/' by following the instructions
- (But if you installed Espressif-IDE in the 'Prerequisites' section this will probably be most compatible with ESP-IDF development.)
- Follow the instructions at the GitHub-page (browsing existing ESP-IDF folder when asked) and you'll get an Eclipse project environment to build and flash.
- To open your exported project-template, use menu File / Import, select 'Existing IDF Project' and select the project folder. Pressing Build (hammer) button will compile the project to .elf and .bin files in 'build' folder.

- VScode has an Espressif-IDF extension that should be used, installable from within VScode.
- [Installation](https://github.com/espressif/vscode-esp-idf-extension/blob/master/docs/tutorial/install.md)
- [Basic Use](https://github.com/espressif/vscode-esp-idf-extension/blob/master/docs/tutorial/basic_use.md)

7 changes: 7 additions & 0 deletions examples/vision_v2_display/build.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
rd build /S /Q
rem md build
rem cd build
set IDF_PATH=C:\Espressif\frameworks\esp-idf-v5.1.1
C:\Espressif\idf_cmd_init.bat && idf.py build
rem cmake -G "Ninja" .. -DCMAKE_BUILD_TYPE=Release #ninja -j 4

5 changes: 5 additions & 0 deletions examples/vision_v2_display/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/sh
export IDF_PATH=~/esp/esp-idf
. $IDF_PATH/export.sh #get_idf
rm -r build #mkdir -p build #cd build
idf.py build #cmake -G "Ninja" .. -DCMAKE_BUILD_TYPE=Release #ninja -j 4
25 changes: 25 additions & 0 deletions examples/vision_v2_display/components/bsp/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@

idf_component_register(
SRC_DIRS
"src/boards"
"src/peripherals"
"src/storage"
"src/indev"
"src/codec"
"src/calibration"
"src/calibration/basic_painter"
INCLUDE_DIRS
"src/boards"
"src"
"include"
"src/calibration"
REQUIRES
iot_button
esp_hid
esp_lcd
fatfs
bus
i2c_devices
nvs_flash
spiffs
lora)
129 changes: 129 additions & 0 deletions examples/vision_v2_display/components/bsp/Kconfig.projbuild
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
menu "Board Configuration"

choice LCD_BOARD
prompt "Select LCD Board"
default LCD_BOARD_SENSECAP_INDICATOR_D1
config LCD_BOARD_EV
bool "ESP32-S3-LCD-EV-BOARD Development Board"
config LCD_BOARD_SENSECAP_INDICATOR_WXM
bool "SenseCAP Indicator for WXM"
config LCD_BOARD_SENSECAP_INDICATOR_D1
bool "SenseCAP Indicator D1/D1S"
config LCD_BOARD_SENSECAP_INDICATOR_D1L
bool "SenseCAP Indicator D1L/D1Pro ( with Lora)"
endchoice

choice LCD_SUB_BOARD
depends on LCD_BOARD_EV
prompt "Select LCD Sub Board"
default LCD_EV_SUB_BOARD2
help
Select an sub board for LCD EV mainboard
config LCD_EV_SUB_BOARD1
bool "SUB_BOARD1 128x64 & 320x240 screen"
config LCD_EV_SUB_BOARD2
bool "SUB_BOARD2 480x480 & 320x480 screen"
config LCD_EV_SUB_BOARD3
bool "SUB_BOARD3 800x480 screen"
config LCD_EV_SUB_BOARD
bool "SUB_BOARD3 800x480 screen"
endchoice

choice LCD_SUB_BOARD1_SCREEN
depends on LCD_EV_SUB_BOARD1
prompt "Select screen for Sub Board1"
default LCD_EV_SUB_BOARD1_LCD_320x240
config LCD_EV_SUB_BOARD1_OLED_128x64
bool "128x64 0.96' OLED screen"
config LCD_EV_SUB_BOARD1_LCD_320x240
bool "320x240 2.4' LCD screen"
endchoice

choice LCD_SUB_BOARD2_SCREEN
depends on LCD_EV_SUB_BOARD2
prompt "Select screen for Sub Board2"
default LCD_EV_SUB_BOARD2_LCD_480x480
config LCD_EV_SUB_BOARD2_LCD_480x480
bool "480x480 3.95' LCD screen"
config LCD_EV_SUB_BOARD2_LCD_480x320
bool "480x320 3.5' LCD screen"
endchoice

choice LCD_SUB_BOARD2_SCREEN_DATA_WIDTH
depends on LCD_EV_SUB_BOARD2_LCD_480x320
prompt "Select data width for 480x320 3.5' LCD screen"
default LCD_EV_SUB_BOARD2_LCD_480x320_8BIT
config LCD_EV_SUB_BOARD2_LCD_480x320_8BIT
bool "8Bit 8080 interface"
config LCD_EV_SUB_BOARD2_LCD_480x320_16BIT
bool "16Bit 8080 interface"
endchoice

choice SENSECAP_INDICATOR_SCREEN
depends on LCD_BOARD_SENSECAP_INDICATOR_WXM || LCD_BOARD_SENSECAP_INDICATOR_D1 || LCD_BOARD_SENSECAP_INDICATOR_D1L
prompt "Select the screen type for SenseCAP Indicator boards"
default SENSECAP_INDICATOR_SCREEN_GX
config SENSECAP_INDICATOR_SCREEN_GX
bool "GuanXian 4.0 inch RGB (SPI+RGB)"
config SENSECAP_INDICATOR_SCREEN_DX
bool "DaXian 4.0 inch RGB (RGB only)"
endchoice

config LCD_EVB_SCREEN_WIDTH
int
default 800 if LCD_EV_SUB_BOARD3
default 480 if LCD_EV_SUB_BOARD2_LCD_480x480 || SENSECAP_INDICATOR_SCREEN_GX || SENSECAP_INDICATOR_SCREEN_DX
default 320 if LCD_EV_SUB_BOARD2_LCD_480x320
default 240 if LCD_EV_SUB_BOARD1_LCD_320x240
default 128 if LCD_EV_SUB_BOARD1_OLED_128x64

config LCD_EVB_SCREEN_HEIGHT
int
default 480 if LCD_EV_SUB_BOARD3 || LCD_EV_SUB_BOARD2_LCD_480x480 || LCD_EV_SUB_BOARD2_LCD_480x320 || SENSECAP_INDICATOR_SCREEN_GX || SENSECAP_INDICATOR_SCREEN_DX
default 320 if LCD_EV_SUB_BOARD1_LCD_320x240
default 64 if LCD_EV_SUB_BOARD1_OLED_128x64

choice LCD_EVB_SCREEN_ROTATION
prompt "Set rotation of lcd and touch"
default LCD_EVB_SCREEN_ROTATION_0
config LCD_EVB_SCREEN_ROTATION_0
bool "Rotate 0"
config LCD_EVB_SCREEN_ROTATION_90
bool "Rotate 90"
config LCD_EVB_SCREEN_ROTATION_180
bool "Rotate 180"
config LCD_EVB_SCREEN_ROTATION_270
bool "Rotate 270"
endchoice

config LCD_EVB_SCREEN_FREQ
depends on LCD_EV_SUB_BOARD2_LCD_480x480 || LCD_EV_SUB_BOARD3 || SENSECAP_INDICATOR_SCREEN_GX || SENSECAP_INDICATOR_SCREEN_DX
int "Frequency of lcd pclk"
default 18

config LCD_AVOID_TEAR
depends on LCD_EV_SUB_BOARD2_LCD_480x480 || LCD_EV_SUB_BOARD3 || SENSECAP_INDICATOR_SCREEN_GX || SENSECAP_INDICATOR_SCREEN_DX
depends on LCD_EVB_SCREEN_ROTATION_0
bool "Avoid tearing effect"
default "n"

choice LCD_LVGL_MODE
depends on LCD_AVOID_TEAR
prompt "Select lvgl mode for avoiding tearing"
default LCD_LVGL_FULL_REFRESH
config LCD_LVGL_FULL_REFRESH
bool "full refresh with two frame psram buffer"
config LCD_LVGL_DIRECT_MODE
bool "direct mode with two frame psram buffer"
endchoice

config LCD_TASK_PRIORITY
depends on LCD_AVOID_TEAR
int "Priority of lcd refresh task"
default 5

config LCD_TASK_REFRESH_TIME
depends on LCD_AVOID_TEAR
int "Screen refresh period(ms)"
default 40
endmenu
Loading

0 comments on commit 0de906f

Please sign in to comment.