diff --git a/.github/scripts/on-release.sh b/.github/scripts/on-release.sh index 79261fd2d5c..88daf00172e 100755 --- a/.github/scripts/on-release.sh +++ b/.github/scripts/on-release.sh @@ -35,6 +35,12 @@ echo "Event: $GITHUB_EVENT_NAME, Repo: $GITHUB_REPOSITORY, Path: $GITHUB_WORKSPA echo "Action: $action, Branch: $RELEASE_BRANCH, ID: $RELEASE_ID" echo "Tag: $RELEASE_TAG, Draft: $draft, Pre-Release: $RELEASE_PRE" +# Try extracting something like a JSON with a "boards" array/element and "vendor" fields +BOARDS=`echo $RELEASE_BODY | grep -Pzo '(?s){.*}' | jq -r '.boards[]? // .boards? // empty' | xargs echo -n 2>/dev/null` +VENDOR=`echo $RELEASE_BODY | grep -Pzo '(?s){.*}' | jq -r '.vendor? // empty' | xargs echo -n 2>/dev/null` +if ! [ -z "${BOARDS}" ]; then echo "Releasing board(s): $BOARDS" ; fi +if ! [ -z "${VENDOR}" ]; then echo "Setting packager: $VENDOR" ; fi + function get_file_size(){ local file="$1" if [[ "$OSTYPE" == "darwin"* ]]; then @@ -170,12 +176,26 @@ mkdir -p "$PKG_DIR/tools" # Copy all core files to the package folder echo "Copying files for packaging ..." -cp -f "$GITHUB_WORKSPACE/boards.txt" "$PKG_DIR/" +if [ -z "${BOARDS}" ]; then + # Copy all variants + cp -f "$GITHUB_WORKSPACE/boards.txt" "$PKG_DIR/" + cp -Rf "$GITHUB_WORKSPACE/variants" "$PKG_DIR/" +else + # Remove all entries not starting with any board code or "menu." from boards.txt + cat "$GITHUB_WORKSPACE/boards.txt" | grep "^menu\." > "$PKG_DIR/boards.txt" + for board in ${BOARDS} ; do + cat "$GITHUB_WORKSPACE/boards.txt" | grep "^${board}\." >> "$PKG_DIR/boards.txt" + done + # Copy only relevant variant files + mkdir "$PKG_DIR/variants/" + for variant in `cat ${PKG_DIR}/boards.txt | grep "\.variant=" | cut -d= -f2` ; do + cp -Rf "$GITHUB_WORKSPACE/variants/${variant}" "$PKG_DIR/variants/" + done +fi cp -f "$GITHUB_WORKSPACE/package.json" "$PKG_DIR/" cp -f "$GITHUB_WORKSPACE/programmers.txt" "$PKG_DIR/" cp -Rf "$GITHUB_WORKSPACE/cores" "$PKG_DIR/" cp -Rf "$GITHUB_WORKSPACE/libraries" "$PKG_DIR/" -cp -Rf "$GITHUB_WORKSPACE/variants" "$PKG_DIR/" cp -f "$GITHUB_WORKSPACE/tools/espota.exe" "$PKG_DIR/tools/" cp -f "$GITHUB_WORKSPACE/tools/espota.py" "$PKG_DIR/tools/" cp -f "$GITHUB_WORKSPACE/tools/gen_esp32part.py" "$PKG_DIR/tools/" @@ -201,19 +221,22 @@ RVTC_NEW_NAME="esp-rv32" echo "Generating platform.txt..." cat "$GITHUB_WORKSPACE/platform.txt" | \ sed "s/version=.*/version=$RELEASE_TAG/g" | \ -sed 's/tools.esp32-arduino-libs.path={runtime.platform.path}\/tools\/esp32-arduino-libs/tools.esp32-arduino-libs.path=\{runtime.tools.esp32-arduino-libs.path\}/g' | \ -sed 's/tools.xtensa-esp32-elf-gcc.path={runtime.platform.path}\/tools\/xtensa-esp32-elf/tools.xtensa-esp32-elf-gcc.path=\{runtime.tools.xtensa-esp32-elf-gcc.path\}/g' | \ -sed 's/tools.xtensa-esp32s2-elf-gcc.path={runtime.platform.path}\/tools\/xtensa-esp32s2-elf/tools.xtensa-esp32s2-elf-gcc.path=\{runtime.tools.xtensa-esp32s2-elf-gcc.path\}/g' | \ -sed 's/tools.xtensa-esp32s3-elf-gcc.path={runtime.platform.path}\/tools\/xtensa-esp32s3-elf/tools.xtensa-esp32s3-elf-gcc.path=\{runtime.tools.xtensa-esp32s3-elf-gcc.path\}/g' | \ -sed 's/tools.xtensa-esp-elf-gdb.path={runtime.platform.path}\/tools\/xtensa-esp-elf-gdb/tools.xtensa-esp-elf-gdb.path=\{runtime.tools.xtensa-esp-elf-gdb.path\}/g' | \ -sed "s/tools.riscv32-esp-elf-gcc.path={runtime.platform.path}\\/tools\\/riscv32-esp-elf/tools.riscv32-esp-elf-gcc.path=\\{runtime.tools.$RVTC_NEW_NAME.path\\}/g" | \ -sed 's/tools.riscv32-esp-elf-gdb.path={runtime.platform.path}\/tools\/riscv32-esp-elf-gdb/tools.riscv32-esp-elf-gdb.path=\{runtime.tools.riscv32-esp-elf-gdb.path\}/g' | \ -sed 's/tools.esptool_py.path={runtime.platform.path}\/tools\/esptool/tools.esptool_py.path=\{runtime.tools.esptool_py.path\}/g' | \ -sed 's/debug.server.openocd.path={runtime.platform.path}\/tools\/openocd-esp32\/bin\/openocd/debug.server.openocd.path=\{runtime.tools.openocd-esp32.path\}\/bin\/openocd/g' | \ -sed 's/debug.server.openocd.scripts_dir={runtime.platform.path}\/tools\/openocd-esp32\/share\/openocd\/scripts\//debug.server.openocd.scripts_dir=\{runtime.tools.openocd-esp32.path\}\/share\/openocd\/scripts\//g' | \ -sed 's/debug.server.openocd.scripts_dir.windows={runtime.platform.path}\\tools\\openocd-esp32\\share\\openocd\\scripts\\/debug.server.openocd.scripts_dir.windows=\{runtime.tools.openocd-esp32.path\}\\share\\openocd\\scripts\\/g' \ +sed 's/{runtime\.platform\.path}.tools.esp32-arduino-libs/\{runtime.tools.esp32-arduino-libs.path\}/g' | \ +sed 's/{runtime\.platform\.path}.tools.xtensa-esp-elf-gdb/\{runtime.tools.xtensa-esp-elf-gdb.path\}/g' | \ +sed 's/{runtime\.platform\.path}.tools.xtensa-esp32-elf/\{runtime.tools.xtensa-esp32-elf-gcc.path\}/g' | \ +sed 's/{runtime\.platform\.path}.tools.xtensa-esp32s2-elf/\{runtime.tools.xtensa-esp32s2-elf-gcc.path\}/g' | \ +sed 's/{runtime\.platform\.path}.tools.xtensa-esp32s3-elf/\{runtime.tools.xtensa-esp32s3-elf-gcc.path\}/g' | \ +sed 's/{runtime\.platform\.path}.tools.riscv32-esp-elf-gdb/\{runtime.tools.riscv32-esp-elf-gdb.path\}/g' | \ +sed "s/{runtime\.platform\.path}.tools.riscv32-esp-elf/\\{runtime.tools.$RVTC_NEW_NAME.path\\}/g" | \ +sed 's/{runtime\.platform\.path}.tools.esptool/\{runtime.tools.esptool_py.path\}/g' | \ +sed 's/{runtime\.platform\.path}.tools.openocd-esp32/\{runtime.tools.openocd-esp32.path\}/g' \ > "$PKG_DIR/platform.txt" +if ! [ -z ${VENDOR} ]; then + # Append vendor name to platform.txt to create a separate section + sed -i "/^name=.*/s/$/ ($VENDOR)/" "$PKG_DIR/platform.txt" +fi + # Add header with version information echo "Generating core_version.h ..." ver_define=`echo $RELEASE_TAG | tr "[:lower:].\055" "[:upper:]_"` diff --git a/.github/workflows/allboards.yml b/.github/workflows/allboards.yml index 49370120339..4a2d4349ac3 100644 --- a/.github/workflows/allboards.yml +++ b/.github/workflows/allboards.yml @@ -15,7 +15,7 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: ref: ${{ github.event.client_payload.branch }} @@ -33,7 +33,7 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: ref: ${{ github.event.client_payload.branch }} @@ -66,7 +66,7 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: ref: ${{ github.event.client_payload.branch }} diff --git a/.github/workflows/boards.yml b/.github/workflows/boards.yml index 3e189231932..a16de38d5a5 100644 --- a/.github/workflows/boards.yml +++ b/.github/workflows/boards.yml @@ -18,7 +18,7 @@ jobs: steps: # This step makes the contents of the repository available to the workflow - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Setup jq uses: dcarbone/install-jq-action@v1.0.1 @@ -43,7 +43,7 @@ jobs: steps: # This step makes the contents of the repository available to the workflow - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Check if build.board is uppercase run: | diff --git a/.github/workflows/build_py_tools.yml b/.github/workflows/build_py_tools.yml index 907a3438bb8..e83f566e170 100644 --- a/.github/workflows/build_py_tools.yml +++ b/.github/workflows/build_py_tools.yml @@ -17,12 +17,12 @@ jobs: all_changed_files: ${{ steps.verify-changed-files.outputs.all_changed_files }} steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: fetch-depth: 2 ref: ${{ github.event.pull_request.head.ref }} - name: Verify Python Tools Changed - uses: tj-actions/changed-files@v36 + uses: tj-actions/changed-files@v41 id: verify-changed-files with: fetch_depth: '2' @@ -87,7 +87,7 @@ jobs: echo "tool $tool was changed" done - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: ref: ${{ github.event.pull_request.head.ref }} - name: Set up Python 3.8 diff --git a/.github/workflows/docs.yml b/.github/workflows/docs_build.yml similarity index 51% rename from .github/workflows/docs.yml rename to .github/workflows/docs_build.yml index f01fb76ee84..d5cd652f3df 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs_build.yml @@ -1,4 +1,4 @@ -name: ReadTheDocs CI +name: Documentation Build and Deploy CI on: push: @@ -7,25 +7,25 @@ on: - release/* paths: - 'docs/**' - - '.github/workflows/docs.yml' + - '.github/workflows/docs_build.yml' pull_request: paths: - 'docs/**' - - '.github/workflows/docs.yml' + - '.github/workflows/docs_build.yml' jobs: build-docs: - name: Build ReadTheDocs + name: Build ESP-Docs runs-on: ubuntu-22.04 defaults: run: shell: bash steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: submodules: true - - uses: actions/setup-python@v4 + - uses: actions/setup-python@v5 with: python-version: '3.10' - name: Build @@ -34,5 +34,11 @@ jobs: sudo apt install python3-pip python3-setuptools # GitHub CI installs pip3 and setuptools outside the path. # Update the path to include them and run. - PATH=/home/runner/.local/bin:$PATH pip3 install --user -r ./docs/requirements.txt - cd ./docs && PATH=/home/runner/.local/bin:$PATH SPHINXOPTS="-W" make html + cd ./docs + PATH=/home/runner/.local/bin:$PATH pip3 install -r requirements.txt --prefer-binary + PATH=/home/runner/.local/bin:$PATH SPHINXOPTS="-W" build-docs -l en + - name: Archive Docs + uses: actions/upload-artifact@v2 + with: + name: docs + path: docs diff --git a/.github/workflows/docs_deploy.yml b/.github/workflows/docs_deploy.yml new file mode 100644 index 00000000000..07dc03ba547 --- /dev/null +++ b/.github/workflows/docs_deploy.yml @@ -0,0 +1,51 @@ +name: Documentation Build and Production Deploy CI + +on: + release: + types: [published] + push: + branches: + - release/* + - master + paths: + - 'docs/**' + - '.github/workflows/docs_deploy.yml' + +jobs: + + deploy-prod-docs: + name: Deploy Documentation on Production + runs-on: ubuntu-22.04 + defaults: + run: + shell: bash + steps: + - uses: actions/checkout@v4 + with: + submodules: true + - uses: actions/setup-python@v5 + with: + python-version: '3.10' + - name: Deploy Documentation + env: + # Deploy to production server + # DOCS_BUILD_DIR: "./docs/_build/" + DOCS_DEPLOY_PRIVATEKEY: ${{ secrets.DOCS_KEY }} + DOCS_DEPLOY_PATH: ${{ secrets.DOCS_PATH }} + DOCS_DEPLOY_SERVER: ${{ secrets.DOCS_SERVER }} + DOCS_DEPLOY_SERVER_USER: ${{ secrets.DOCS_USER }} + DOCS_DEPLOY_URL_BASE: ${{ secrets.DOCS_URL }} + run: | + sudo apt update + sudo apt install python3-pip python3-setuptools + source ./docs/utils.sh + add_doc_server_ssh_keys $DOCS_DEPLOY_PRIVATEKEY $DOCS_DEPLOY_SERVER $DOCS_DEPLOY_SERVER_USER + export GIT_VER=$(git describe --always) + echo "PIP install requirements..." + pip3 install --user -r ./docs/requirements.txt + echo "Building the Docs..." + cd ./docs && build-docs -l en + echo "Deploy the Docs..." + export DOCS_BUILD_DIR=$GITHUB_WORKSPACE/docs/ + cd $GITHUB_WORKSPACE/docs + deploy-docs diff --git a/.github/workflows/gh-pages.yml b/.github/workflows/gh-pages.yml index cea5e1eac86..5d8e1794a8a 100644 --- a/.github/workflows/gh-pages.yml +++ b/.github/workflows/gh-pages.yml @@ -16,7 +16,7 @@ jobs: name: Build GitHub Pages runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Copy Files env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/hil.yml b/.github/workflows/hil.yml index 10c937f1bfe..0b29d4aafb9 100644 --- a/.github/workflows/hil.yml +++ b/.github/workflows/hil.yml @@ -25,7 +25,7 @@ jobs: chunks: ${{ steps.gen-chunks.outputs.chunks }} steps: - name: Checkout Repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Generate Chunks matrix id: gen-chunks @@ -51,7 +51,7 @@ jobs: chunks: ${{fromJson(needs.gen_chunks.outputs.chunks)}} steps: - name: Checkout Repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Build sketches run: | bash .github/scripts/tests_build.sh -c -t ${{matrix.chip}} -i ${{matrix.chunks}} -m ${{env.MAX_CHUNKS}} @@ -78,7 +78,7 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Download ${{matrix.chip}}-${{matrix.chunks}} artifacts uses: actions/download-artifact@v3 diff --git a/.github/workflows/lib.yml b/.github/workflows/lib.yml index 5e44e705e29..3995aaad4fd 100644 --- a/.github/workflows/lib.yml +++ b/.github/workflows/lib.yml @@ -57,7 +57,7 @@ jobs: steps: # This step makes the contents of the repository available to the workflow - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Compile sketch uses: P-R-O-C-H-Y/compile-sketches@main @@ -87,7 +87,7 @@ jobs: steps: # Check out repository - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: token: ${{ env.GITHUB_TOKEN }} fetch-depth: '0' diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index 9a0561c92cd..c7c48225ca4 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -18,7 +18,7 @@ jobs: name: Check cmake file runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - run: bash ./.github/scripts/check-cmakelists.sh # Ubuntu @@ -31,13 +31,13 @@ jobs: chunk: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14] steps: - - uses: actions/checkout@v3 - - uses: actions/setup-python@v4 + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 with: python-version: '3.x' - name: Cache tools id: cache-linux - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: | ./tools/dist @@ -58,8 +58,8 @@ jobs: os: [windows-latest, macOS-latest] steps: - - uses: actions/checkout@v3 - - uses: actions/setup-python@v4 + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 with: python-version: '3.x' - name: Build Sketches @@ -75,8 +75,8 @@ jobs: os: [ubuntu-latest, windows-latest, macOS-latest] steps: - - uses: actions/checkout@v3 - - uses: actions/setup-python@v4 + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 with: python-version: '3.x' - name: Build Sketches @@ -97,7 +97,7 @@ jobs: container: espressif/idf:${{ matrix.idf_ver }} steps: - name: Check out arduino-esp32 as a component - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: submodules: recursive path: components/arduino-esp32 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c5555027bf0..3a59d7a7dc4 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -10,10 +10,10 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: fetch-depth: 0 - - uses: actions/setup-python@v4 + - uses: actions/setup-python@v5 with: python-version: '3.x' - name: Build Release diff --git a/.github/workflows/upload-idf-component.yml b/.github/workflows/upload-idf-component.yml index 8fcebf00204..ca21361689f 100644 --- a/.github/workflows/upload-idf-component.yml +++ b/.github/workflows/upload-idf-component.yml @@ -7,7 +7,7 @@ jobs: upload_components: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: submodules: "recursive" diff --git a/CMakeLists.txt b/CMakeLists.txt index 0834ae1ec34..bba8b88b146 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -50,13 +50,14 @@ set(CORE_SRCS cores/esp32/Esp.cpp cores/esp32/FunctionalInterrupt.cpp cores/esp32/HardwareSerial.cpp + cores/esp32/HEXBuilder.cpp cores/esp32/IPAddress.cpp - cores/esp32/IPv6Address.cpp cores/esp32/libb64/cdecode.c cores/esp32/libb64/cencode.c cores/esp32/main.cpp cores/esp32/MD5Builder.cpp cores/esp32/Print.cpp + cores/esp32/SHA1Builder.cpp cores/esp32/stdlib_noniso.c cores/esp32/Stream.cpp cores/esp32/StreamString.cpp @@ -73,29 +74,85 @@ set(CORE_SRCS cores/esp32/WString.cpp ) -set(LIBRARY_SRCS - libraries/ArduinoOTA/src/ArduinoOTA.cpp - libraries/AsyncUDP/src/AsyncUDP.cpp +set(ARDUINO_ALL_LIBRARIES + ArduinoOTA + AsyncUDP + BLE + BluetoothSerial + DNSServer + EEPROM + ESP_I2S + ESP_SR + ESPmDNS + Ethernet + FFat + FS + HTTPClient + HTTPUpdate + Insights + LittleFS + NetBIOS + Preferences + RainMaker + SD_MMC + SD + SimpleBLE + SPIFFS + SPI + Ticker + Update + USB + WebServer + WiFiClientSecure + WiFi + WiFiProv + Wire + ) + +set(ARDUINO_LIBRARY_ArduinoOTA_SRCS libraries/ArduinoOTA/src/ArduinoOTA.cpp) +set(ARDUINO_LIBRARY_ArduinoOTA_REQUIRES esp_https_ota) + +set(ARDUINO_LIBRARY_AsyncUDP_SRCS libraries/AsyncUDP/src/AsyncUDP.cpp) + +set(ARDUINO_LIBRARY_BluetoothSerial_SRCS libraries/BluetoothSerial/src/BluetoothSerial.cpp libraries/BluetoothSerial/src/BTAddress.cpp libraries/BluetoothSerial/src/BTAdvertisedDeviceSet.cpp - libraries/BluetoothSerial/src/BTScanResultsSet.cpp - libraries/DNSServer/src/DNSServer.cpp - libraries/EEPROM/src/EEPROM.cpp - libraries/ESP_I2S/src/ESP_I2S.cpp + libraries/BluetoothSerial/src/BTScanResultsSet.cpp) + +set(ARDUINO_LIBRARY_DNSServer_SRCS libraries/DNSServer/src/DNSServer.cpp) + +set(ARDUINO_LIBRARY_EEPROM_SRCS libraries/EEPROM/src/EEPROM.cpp) + +set(ARDUINO_LIBRARY_ESP_I2S_SRCS libraries/ESP_I2S/src/ESP_I2S.cpp) + +set(ARDUINO_LIBRARY_ESP_SR_SRCS libraries/ESP_SR/src/ESP_SR.cpp - libraries/ESP_SR/src/esp32-hal-sr.c - libraries/ESPmDNS/src/ESPmDNS.cpp - libraries/Ethernet/src/ETH.cpp - libraries/FFat/src/FFat.cpp + libraries/ESP_SR/src/esp32-hal-sr.c) + +set(ARDUINO_LIBRARY_ESPmDNS_SRCS libraries/ESPmDNS/src/ESPmDNS.cpp) + +set(ARDUINO_LIBRARY_Ethernet_SRCS libraries/Ethernet/src/ETH.cpp) + +set(ARDUINO_LIBRARY_FFat_SRCS libraries/FFat/src/FFat.cpp) + +set(ARDUINO_LIBRARY_FS_SRCS libraries/FS/src/FS.cpp - libraries/FS/src/vfs_api.cpp - libraries/HTTPClient/src/HTTPClient.cpp - libraries/HTTPUpdate/src/HTTPUpdate.cpp - libraries/LittleFS/src/LittleFS.cpp - libraries/Insights/src/Insights.cpp - libraries/NetBIOS/src/NetBIOS.cpp - libraries/Preferences/src/Preferences.cpp + libraries/FS/src/vfs_api.cpp) + +set(ARDUINO_LIBRARY_HTTPClient_SRCS libraries/HTTPClient/src/HTTPClient.cpp) + +set(ARDUINO_LIBRARY_HTTPUpdate_SRCS libraries/HTTPUpdate/src/HTTPUpdate.cpp) + +set(ARDUINO_LIBRARY_Insights_SRCS libraries/Insights/src/Insights.cpp) + +set(ARDUINO_LIBRARY_LittleFS_SRCS libraries/LittleFS/src/LittleFS.cpp) + +set(ARDUINO_LIBRARY_NetBIOS_SRCS libraries/NetBIOS/src/NetBIOS.cpp) + +set(ARDUINO_LIBRARY_Preferences_SRCS libraries/Preferences/src/Preferences.cpp) + +set(ARDUINO_LIBRARY_RainMaker_SRCS libraries/RainMaker/src/RMaker.cpp libraries/RainMaker/src/RMakerNode.cpp libraries/RainMaker/src/RMakerParam.cpp @@ -103,17 +160,28 @@ set(LIBRARY_SRCS libraries/RainMaker/src/RMakerType.cpp libraries/RainMaker/src/RMakerQR.cpp libraries/RainMaker/src/RMakerUtils.cpp - libraries/RainMaker/src/AppInsights.cpp - libraries/SD_MMC/src/SD_MMC.cpp + libraries/RainMaker/src/AppInsights.cpp) + +set(ARDUINO_LIBRARY_SD_MMC_SRCS libraries/SD_MMC/src/SD_MMC.cpp) + +set(ARDUINO_LIBRARY_SD_SRCS libraries/SD/src/SD.cpp libraries/SD/src/sd_diskio.cpp - libraries/SD/src/sd_diskio_crc.c - libraries/SimpleBLE/src/SimpleBLE.cpp - libraries/SPIFFS/src/SPIFFS.cpp - libraries/SPI/src/SPI.cpp - libraries/Ticker/src/Ticker.cpp + libraries/SD/src/sd_diskio_crc.c) + +set(ARDUINO_LIBRARY_SimpleBLE_SRCS libraries/SimpleBLE/src/SimpleBLE.cpp) + +set(ARDUINO_LIBRARY_SPIFFS_SRCS libraries/SPIFFS/src/SPIFFS.cpp) + +set(ARDUINO_LIBRARY_SPI_SRCS libraries/SPI/src/SPI.cpp) + +set(ARDUINO_LIBRARY_Ticker_SRCS libraries/Ticker/src/Ticker.cpp) + +set(ARDUINO_LIBRARY_Update_SRCS libraries/Update/src/Updater.cpp - libraries/Update/src/HttpsOTAUpdate.cpp + libraries/Update/src/HttpsOTAUpdate.cpp) + +set(ARDUINO_LIBRARY_USB_SRCS libraries/USB/src/USBHID.cpp libraries/USB/src/USBMIDI.cpp libraries/USB/src/USBHIDMouse.cpp @@ -122,12 +190,18 @@ set(LIBRARY_SRCS libraries/USB/src/USBHIDConsumerControl.cpp libraries/USB/src/USBHIDSystemControl.cpp libraries/USB/src/USBHIDVendor.cpp - libraries/USB/src/USBVendor.cpp + libraries/USB/src/USBVendor.cpp) + +set(ARDUINO_LIBRARY_WebServer_SRCS libraries/WebServer/src/WebServer.cpp libraries/WebServer/src/Parsing.cpp - libraries/WebServer/src/detail/mimetable.cpp + libraries/WebServer/src/detail/mimetable.cpp) + +set(ARDUINO_LIBRARY_WiFiClientSecure_SRCS libraries/WiFiClientSecure/src/ssl_client.cpp - libraries/WiFiClientSecure/src/WiFiClientSecure.cpp + libraries/WiFiClientSecure/src/WiFiClientSecure.cpp) + +set(ARDUINO_LIBRARY_WiFi_SRCS libraries/WiFi/src/WiFiAP.cpp libraries/WiFi/src/WiFiClient.cpp libraries/WiFi/src/WiFi.cpp @@ -136,12 +210,13 @@ set(LIBRARY_SRCS libraries/WiFi/src/WiFiScan.cpp libraries/WiFi/src/WiFiServer.cpp libraries/WiFi/src/WiFiSTA.cpp - libraries/WiFi/src/WiFiUdp.cpp - libraries/WiFiProv/src/WiFiProv.cpp - libraries/Wire/src/Wire.cpp - ) + libraries/WiFi/src/WiFiUdp.cpp) + +set(ARDUINO_LIBRARY_WiFiProv_SRCS libraries/WiFiProv/src/WiFiProv.cpp) -set(BLE_SRCS +set(ARDUINO_LIBRARY_Wire_SRCS libraries/Wire/src/Wire.cpp) + +set(ARDUINO_LIBRARY_BLE_SRCS libraries/BLE/src/BLE2902.cpp libraries/BLE/src/BLE2904.cpp libraries/BLE/src/BLEAddress.cpp @@ -173,48 +248,28 @@ set(BLE_SRCS libraries/BLE/src/GeneralUtils.cpp ) -set(includedirs - variants/${CONFIG_ARDUINO_VARIANT}/ - cores/esp32/ - libraries/ArduinoOTA/src - libraries/AsyncUDP/src - libraries/BLE/src - libraries/BluetoothSerial/src - libraries/DNSServer/src - libraries/EEPROM/src - libraries/ESP_I2S/src - libraries/ESP_SR/src - libraries/ESP32/src - libraries/ESPmDNS/src - libraries/Ethernet/src - libraries/FFat/src - libraries/FS/src - libraries/HTTPClient/src - libraries/HTTPUpdate/src - libraries/LittleFS/src - libraries/Insights/src - libraries/NetBIOS/src - libraries/Preferences/src - libraries/RainMaker/src - libraries/SD_MMC/src - libraries/SD/src - libraries/SimpleBLE/src - libraries/SPIFFS/src - libraries/SPI/src - libraries/Ticker/src - libraries/Update/src - libraries/USB/src - libraries/WebServer/src - libraries/WiFiClientSecure/src - libraries/WiFi/src - libraries/WiFiProv/src - libraries/Wire/src - ) +set(ARDUINO_LIBRARIES_SRCS) +set(ARDUINO_LIBRARIES_REQUIRES) +set(ARDUINO_LIBRARIES_INCLUDEDIRS) +foreach(libname IN LISTS ARDUINO_ALL_LIBRARIES) + if(NOT CONFIG_ARDUINO_SELECTIVE_COMPILATION OR CONFIG_ARDUINO_SELECTIVE_${libname}) + if(ARDUINO_LIBRARY_${libname}_SRCS) + list(APPEND ARDUINO_LIBRARIES_SRCS ${ARDUINO_LIBRARY_${libname}_SRCS}) + endif() + if(ARDUINO_LIBRARY_${libname}_REQUIRES) + list(APPEND ARDUINO_LIBRARIES_REQUIRES ${ARDUINO_LIBRARY_${libname}_REQUIRES}) + endif() + if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/libraries/${libname}/src) + list(APPEND ARDUINO_LIBRARIES_INCLUDEDIRS libraries/${libname}/src) + endif() + endif() +endforeach() -set(srcs ${CORE_SRCS} ${LIBRARY_SRCS} ${BLE_SRCS}) +set(includedirs variants/${CONFIG_ARDUINO_VARIANT}/ cores/esp32/ ${ARDUINO_LIBRARIES_INCLUDEDIRS}) +set(srcs ${CORE_SRCS} ${ARDUINO_LIBRARIES_SRCS}) set(priv_includes cores/esp32/libb64) set(requires spi_flash esp_partition mbedtls wifi_provisioning wpa_supplicant esp_adc esp_eth http_parser) -set(priv_requires fatfs nvs_flash app_update spiffs bootloader_support bt esp_hid) +set(priv_requires fatfs nvs_flash app_update spiffs bootloader_support bt esp_hid ${ARDUINO_LIBRARIES_REQUIRES}) idf_component_register(INCLUDE_DIRS ${includedirs} PRIV_INCLUDE_DIRS ${priv_includes} SRCS ${srcs} REQUIRES ${requires} PRIV_REQUIRES ${priv_requires}) diff --git a/README.md b/README.md index 09556346255..83b07baedf6 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,6 @@ # Arduino core for the ESP32, ESP32-S2, ESP32-S3, ESP32-C3, ESP32-C6 and ESP32-H2 -![Build Status](https://github.com/espressif/arduino-esp32/workflows/ESP32%20Arduino%20CI/badge.svg) [![Documentation Status](https://readthedocs.com/projects/espressif-arduino-esp32/badge/?version=latest)](https://docs.espressif.com/projects/arduino-esp32/en/latest/?badge=latest) -[![External Libraries Test](https://github.com/espressif/arduino-esp32/actions/workflows/lib.yml/badge.svg?branch=master&event=schedule)](https://github.com/espressif/arduino-esp32/actions/workflows/lib.yml?link=http://https://github.com/espressif/arduino-esp32/blob/master/LIBRARIES_TEST.md) +![Build Status](https://github.com/espressif/arduino-esp32/workflows/ESP32%20Arduino%20CI/badge.svg) [![External Libraries Test](https://github.com/espressif/arduino-esp32/actions/workflows/lib.yml/badge.svg?branch=master&event=schedule)](https://github.com/espressif/arduino-esp32/actions/workflows/lib.yml?link=http://https://github.com/espressif/arduino-esp32/blob/master/LIBRARIES_TEST.md) ### Need help or have a question? Join the chat at [Gitter](https://gitter.im/espressif/arduino-esp32) or [open a new Discussion](https://github.com/espressif/arduino-esp32/discussions) @@ -37,6 +36,10 @@ You can use the [Arduino-ESP32 Online Documentation](https://docs.espressif.com/ --- +**APIs compatibility with ESP8266 and Arduino-CORE (Arduino.cc) is explained [here](https://docs.espressif.com/projects/arduino-esp32/en/latest/libraries.html#apis).** + +--- + * [Getting Started](https://docs.espressif.com/projects/arduino-esp32/en/latest/getting_started.html) * [Installing (Windows, Linux and macOS)](https://docs.espressif.com/projects/arduino-esp32/en/latest/installing.html) * [Libraries](https://docs.espressif.com/projects/arduino-esp32/en/latest/libraries.html) diff --git a/boards.txt b/boards.txt index f1256a1ed28..2da4dcd6515 100644 --- a/boards.txt +++ b/boards.txt @@ -5805,6 +5805,171 @@ sparkfun_esp32s2_thing_plus.menu.EraseFlash.all.upload.erase_cmd=-e ############################################################## +sparkfun_esp32c6_thing_plus.name=SparkFun ESP32-C6 Thing Plus +sparkfun_esp32c6_thing_plus.vid.0=0x303a +sparkfun_esp32c6_thing_plus.pid.0=0x1001 + +sparkfun_esp32c6_thing_plus.bootloader.tool=esptool_py +sparkfun_esp32c6_thing_plus.bootloader.tool.default=esptool_py + +sparkfun_esp32c6_thing_plus.upload.tool=esptool_py +sparkfun_esp32c6_thing_plus.upload.tool.default=esptool_py +sparkfun_esp32c6_thing_plus.upload.tool.network=esp_ota + +sparkfun_esp32c6_thing_plus.upload.maximum_size=1310720 +sparkfun_esp32c6_thing_plus.upload.maximum_data_size=327680 +sparkfun_esp32c6_thing_plus.upload.flags= +sparkfun_esp32c6_thing_plus.upload.extra_flags= +sparkfun_esp32c6_thing_plus.upload.use_1200bps_touch=false +sparkfun_esp32c6_thing_plus.upload.wait_for_upload_port=false + +sparkfun_esp32c6_thing_plus.serial.disableDTR=false +sparkfun_esp32c6_thing_plus.serial.disableRTS=false + +sparkfun_esp32c6_thing_plus.build.tarch=riscv32 +sparkfun_esp32c6_thing_plus.build.target=esp +sparkfun_esp32c6_thing_plus.build.mcu=esp32c6 +sparkfun_esp32c6_thing_plus.build.core=esp32 +sparkfun_esp32c6_thing_plus.build.variant=sparkfun_esp32c6_thing_plus +sparkfun_esp32c6_thing_plus.build.board=ESP32C6_THING_PLUS +sparkfun_esp32c6_thing_plus.build.bootloader_addr=0x0 + +sparkfun_esp32c6_thing_plus.build.cdc_on_boot=0 +sparkfun_esp32c6_thing_plus.build.f_cpu=160000000L +sparkfun_esp32c6_thing_plus.build.flash_size=4MB +sparkfun_esp32c6_thing_plus.build.flash_freq=80m +sparkfun_esp32c6_thing_plus.build.flash_mode=qio +sparkfun_esp32c6_thing_plus.build.boot=qio +sparkfun_esp32c6_thing_plus.build.partitions=default +sparkfun_esp32c6_thing_plus.build.defines= + +## IDE 2.0 Seems to not update the value +sparkfun_esp32c6_thing_plus.menu.JTAGAdapter.default=Disabled +sparkfun_esp32c6_thing_plus.menu.JTAGAdapter.default.build.copy_jtag_files=0 +sparkfun_esp32c6_thing_plus.menu.JTAGAdapter.builtin=Integrated USB JTAG +sparkfun_esp32c6_thing_plus.menu.JTAGAdapter.builtin.build.openocdscript=esp32c6-builtin.cfg +sparkfun_esp32c6_thing_plus.menu.JTAGAdapter.builtin.build.copy_jtag_files=1 +sparkfun_esp32c6_thing_plus.menu.JTAGAdapter.external=FTDI Adapter +sparkfun_esp32c6_thing_plus.menu.JTAGAdapter.external.build.openocdscript=esp32c6-ftdi.cfg +sparkfun_esp32c6_thing_plus.menu.JTAGAdapter.external.build.copy_jtag_files=1 +sparkfun_esp32c6_thing_plus.menu.JTAGAdapter.bridge=ESP USB Bridge +sparkfun_esp32c6_thing_plus.menu.JTAGAdapter.bridge.build.openocdscript=esp32c6-bridge.cfg +sparkfun_esp32c6_thing_plus.menu.JTAGAdapter.bridge.build.copy_jtag_files=1 + +sparkfun_esp32c6_thing_plus.menu.CDCOnBoot.default=Enabled +sparkfun_esp32c6_thing_plus.menu.CDCOnBoot.default.build.cdc_on_boot=1 +sparkfun_esp32c6_thing_plus.menu.CDCOnBoot.cdc=Disabled +sparkfun_esp32c6_thing_plus.menu.CDCOnBoot.cdc.build.cdc_on_boot=0 + +sparkfun_esp32c6_thing_plus.menu.PartitionScheme.default=Default 4MB with spiffs (1.2MB APP/1.5MB SPIFFS) +sparkfun_esp32c6_thing_plus.menu.PartitionScheme.default.build.partitions=default +sparkfun_esp32c6_thing_plus.menu.PartitionScheme.defaultffat=Default 4MB with ffat (1.2MB APP/1.5MB FATFS) +sparkfun_esp32c6_thing_plus.menu.PartitionScheme.defaultffat.build.partitions=default_ffat +sparkfun_esp32c6_thing_plus.menu.PartitionScheme.default_8MB=8M with spiffs (3MB APP/1.5MB SPIFFS) +sparkfun_esp32c6_thing_plus.menu.PartitionScheme.default_8MB.build.partitions=default_8MB +sparkfun_esp32c6_thing_plus.menu.PartitionScheme.default_8MB.upload.maximum_size=3342336 +sparkfun_esp32c6_thing_plus.menu.PartitionScheme.minimal=Minimal (1.3MB APP/700KB SPIFFS) +sparkfun_esp32c6_thing_plus.menu.PartitionScheme.minimal.build.partitions=minimal +sparkfun_esp32c6_thing_plus.menu.PartitionScheme.no_ota=No OTA (2MB APP/2MB SPIFFS) +sparkfun_esp32c6_thing_plus.menu.PartitionScheme.no_ota.build.partitions=no_ota +sparkfun_esp32c6_thing_plus.menu.PartitionScheme.no_ota.upload.maximum_size=2097152 +sparkfun_esp32c6_thing_plus.menu.PartitionScheme.noota_3g=No OTA (1MB APP/3MB SPIFFS) +sparkfun_esp32c6_thing_plus.menu.PartitionScheme.noota_3g.build.partitions=noota_3g +sparkfun_esp32c6_thing_plus.menu.PartitionScheme.noota_3g.upload.maximum_size=1048576 +sparkfun_esp32c6_thing_plus.menu.PartitionScheme.noota_ffat=No OTA (2MB APP/2MB FATFS) +sparkfun_esp32c6_thing_plus.menu.PartitionScheme.noota_ffat.build.partitions=noota_ffat +sparkfun_esp32c6_thing_plus.menu.PartitionScheme.noota_ffat.upload.maximum_size=2097152 +sparkfun_esp32c6_thing_plus.menu.PartitionScheme.noota_3gffat=No OTA (1MB APP/3MB FATFS) +sparkfun_esp32c6_thing_plus.menu.PartitionScheme.noota_3gffat.build.partitions=noota_3gffat +sparkfun_esp32c6_thing_plus.menu.PartitionScheme.noota_3gffat.upload.maximum_size=1048576 +sparkfun_esp32c6_thing_plus.menu.PartitionScheme.huge_app=Huge APP (3MB No OTA/1MB SPIFFS) +sparkfun_esp32c6_thing_plus.menu.PartitionScheme.huge_app.build.partitions=huge_app +sparkfun_esp32c6_thing_plus.menu.PartitionScheme.huge_app.upload.maximum_size=3145728 +sparkfun_esp32c6_thing_plus.menu.PartitionScheme.min_spiffs=Minimal SPIFFS (1.9MB APP with OTA/190KB SPIFFS) +sparkfun_esp32c6_thing_plus.menu.PartitionScheme.min_spiffs.build.partitions=min_spiffs +sparkfun_esp32c6_thing_plus.menu.PartitionScheme.min_spiffs.upload.maximum_size=1966080 +sparkfun_esp32c6_thing_plus.menu.PartitionScheme.fatflash=16M Flash (2MB APP/12.5MB FATFS) +sparkfun_esp32c6_thing_plus.menu.PartitionScheme.fatflash.build.partitions=ffat +sparkfun_esp32c6_thing_plus.menu.PartitionScheme.fatflash.upload.maximum_size=2097152 +sparkfun_esp32c6_thing_plus.menu.PartitionScheme.app3M_fat9M_16MB=16M Flash (3MB APP/9.9MB FATFS) +sparkfun_esp32c6_thing_plus.menu.PartitionScheme.app3M_fat9M_16MB.build.partitions=app3M_fat9M_16MB +sparkfun_esp32c6_thing_plus.menu.PartitionScheme.app3M_fat9M_16MB.upload.maximum_size=3145728 +sparkfun_esp32c6_thing_plus.menu.PartitionScheme.rainmaker=RainMaker +sparkfun_esp32c6_thing_plus.menu.PartitionScheme.rainmaker.build.partitions=rainmaker +sparkfun_esp32c6_thing_plus.menu.PartitionScheme.rainmaker.upload.maximum_size=3145728 +sparkfun_esp32c6_thing_plus.menu.PartitionScheme.custom=Custom +sparkfun_esp32c6_thing_plus.menu.PartitionScheme.custom.build.partitions= +sparkfun_esp32c6_thing_plus.menu.PartitionScheme.custom.upload.maximum_size=16777216 + +sparkfun_esp32c6_thing_plus.menu.CPUFreq.160=160MHz (WiFi) +sparkfun_esp32c6_thing_plus.menu.CPUFreq.160.build.f_cpu=160000000L +sparkfun_esp32c6_thing_plus.menu.CPUFreq.80=80MHz (WiFi) +sparkfun_esp32c6_thing_plus.menu.CPUFreq.80.build.f_cpu=80000000L +sparkfun_esp32c6_thing_plus.menu.CPUFreq.40=40MHz +sparkfun_esp32c6_thing_plus.menu.CPUFreq.40.build.f_cpu=40000000L +sparkfun_esp32c6_thing_plus.menu.CPUFreq.20=20MHz +sparkfun_esp32c6_thing_plus.menu.CPUFreq.20.build.f_cpu=20000000L +sparkfun_esp32c6_thing_plus.menu.CPUFreq.10=10MHz +sparkfun_esp32c6_thing_plus.menu.CPUFreq.10.build.f_cpu=10000000L + +sparkfun_esp32c6_thing_plus.menu.FlashMode.qio=QIO +sparkfun_esp32c6_thing_plus.menu.FlashMode.qio.build.flash_mode=dio +sparkfun_esp32c6_thing_plus.menu.FlashMode.qio.build.boot=qio +sparkfun_esp32c6_thing_plus.menu.FlashMode.dio=DIO +sparkfun_esp32c6_thing_plus.menu.FlashMode.dio.build.flash_mode=dio +sparkfun_esp32c6_thing_plus.menu.FlashMode.dio.build.boot=dio + +sparkfun_esp32c6_thing_plus.menu.FlashFreq.80=80MHz +sparkfun_esp32c6_thing_plus.menu.FlashFreq.80.build.flash_freq=80m +sparkfun_esp32c6_thing_plus.menu.FlashFreq.40=40MHz +sparkfun_esp32c6_thing_plus.menu.FlashFreq.40.build.flash_freq=40m + +sparkfun_esp32c6_thing_plus.menu.FlashSize.4M=4MB (32Mb) +sparkfun_esp32c6_thing_plus.menu.FlashSize.4M.build.flash_size=4MB +sparkfun_esp32c6_thing_plus.menu.FlashSize.8M=8MB (64Mb) +sparkfun_esp32c6_thing_plus.menu.FlashSize.8M.build.flash_size=8MB +sparkfun_esp32c6_thing_plus.menu.FlashSize.8M.build.partitions=default_8MB +sparkfun_esp32c6_thing_plus.menu.FlashSize.2M=2MB (16Mb) +sparkfun_esp32c6_thing_plus.menu.FlashSize.2M.build.flash_size=2MB +sparkfun_esp32c6_thing_plus.menu.FlashSize.2M.build.partitions=minimal +sparkfun_esp32c6_thing_plus.menu.FlashSize.16M=16MB (128Mb) +sparkfun_esp32c6_thing_plus.menu.FlashSize.16M.build.flash_size=16MB + +sparkfun_esp32c6_thing_plus.menu.UploadSpeed.921600=921600 +sparkfun_esp32c6_thing_plus.menu.UploadSpeed.921600.upload.speed=921600 +sparkfun_esp32c6_thing_plus.menu.UploadSpeed.115200=115200 +sparkfun_esp32c6_thing_plus.menu.UploadSpeed.115200.upload.speed=115200 +sparkfun_esp32c6_thing_plus.menu.UploadSpeed.256000.windows=256000 +sparkfun_esp32c6_thing_plus.menu.UploadSpeed.256000.upload.speed=256000 +sparkfun_esp32c6_thing_plus.menu.UploadSpeed.230400.windows.upload.speed=256000 +sparkfun_esp32c6_thing_plus.menu.UploadSpeed.230400=230400 +sparkfun_esp32c6_thing_plus.menu.UploadSpeed.230400.upload.speed=230400 +sparkfun_esp32c6_thing_plus.menu.UploadSpeed.460800.linux=460800 +sparkfun_esp32c6_thing_plus.menu.UploadSpeed.460800.macosx=460800 +sparkfun_esp32c6_thing_plus.menu.UploadSpeed.460800.upload.speed=460800 +sparkfun_esp32c6_thing_plus.menu.UploadSpeed.512000.windows=512000 +sparkfun_esp32c6_thing_plus.menu.UploadSpeed.512000.upload.speed=512000 + +sparkfun_esp32c6_thing_plus.menu.DebugLevel.none=None +sparkfun_esp32c6_thing_plus.menu.DebugLevel.none.build.code_debug=0 +sparkfun_esp32c6_thing_plus.menu.DebugLevel.error=Error +sparkfun_esp32c6_thing_plus.menu.DebugLevel.error.build.code_debug=1 +sparkfun_esp32c6_thing_plus.menu.DebugLevel.warn=Warn +sparkfun_esp32c6_thing_plus.menu.DebugLevel.warn.build.code_debug=2 +sparkfun_esp32c6_thing_plus.menu.DebugLevel.info=Info +sparkfun_esp32c6_thing_plus.menu.DebugLevel.info.build.code_debug=3 +sparkfun_esp32c6_thing_plus.menu.DebugLevel.debug=Debug +sparkfun_esp32c6_thing_plus.menu.DebugLevel.debug.build.code_debug=4 +sparkfun_esp32c6_thing_plus.menu.DebugLevel.verbose=Verbose +sparkfun_esp32c6_thing_plus.menu.DebugLevel.verbose.build.code_debug=5 + +sparkfun_esp32c6_thing_plus.menu.EraseFlash.none=Disabled +sparkfun_esp32c6_thing_plus.menu.EraseFlash.none.upload.erase_cmd= +sparkfun_esp32c6_thing_plus.menu.EraseFlash.all=Enabled +sparkfun_esp32c6_thing_plus.menu.EraseFlash.all.upload.erase_cmd=-e + +############################################################## + esp32micromod.name=SparkFun ESP32 MicroMod esp32micromod.bootloader.tool=esptool_py @@ -6375,6 +6540,155 @@ sparkfun_esp32c6_qwiic_pocket.menu.EraseFlash.all.upload.erase_cmd=-e ############################################################## +# SparkFun Pro Micro ESP32C3 + +sparkfun_pro_micro_esp32c3.name=SparkFun Pro Micro - ESP32C3 +sparkfun_pro_micro_esp32c3.vid.0=0x1B4F +sparkfun_pro_micro_esp32c3.pid.0=0x0035 + +sparkfun_pro_micro_esp32c3.bootloader.tool=esptool_py +sparkfun_pro_micro_esp32c3.bootloader.tool.default=esptool_py + +sparkfun_pro_micro_esp32c3.upload.tool=esptool_py +sparkfun_pro_micro_esp32c3.upload.tool.default=esptool_py +sparkfun_pro_micro_esp32c3.upload.tool.network=esp_ota + +sparkfun_pro_micro_esp32c3.upload.maximum_size=1310720 +sparkfun_pro_micro_esp32c3.upload.maximum_data_size=327680 +sparkfun_pro_micro_esp32c3.upload.flags= +sparkfun_pro_micro_esp32c3.upload.extra_flags= +sparkfun_pro_micro_esp32c3.upload.use_1200bps_touch=false +sparkfun_pro_micro_esp32c3.upload.wait_for_upload_port=false + +sparkfun_pro_micro_esp32c3.serial.disableDTR=false +sparkfun_pro_micro_esp32c3.serial.disableRTS=false + +sparkfun_pro_micro_esp32c3.build.tarch=riscv32 +sparkfun_pro_micro_esp32c3.build.bootloader_addr=0x0 +sparkfun_pro_micro_esp32c3.build.target=esp +sparkfun_pro_micro_esp32c3.build.mcu=esp32c3 +sparkfun_pro_micro_esp32c3.build.core=esp32 +sparkfun_pro_micro_esp32c3.build.variant=sparkfun_pro_micro_esp32c3 +sparkfun_pro_micro_esp32c3.build.board=SPARKFUN_PRO_MICRO_ESP32C3 + +sparkfun_pro_micro_esp32c3.build.cdc_on_boot=1 +sparkfun_pro_micro_esp32c3.build.f_cpu=160000000L +sparkfun_pro_micro_esp32c3.build.flash_size=4MB +sparkfun_pro_micro_esp32c3.build.flash_freq=80m +sparkfun_pro_micro_esp32c3.build.flash_mode=dio +sparkfun_pro_micro_esp32c3.build.boot=qio +sparkfun_pro_micro_esp32c3.build.partitions=default +sparkfun_pro_micro_esp32c3.build.defines= + +sparkfun_pro_micro_esp32c3.menu.JTAGAdapter.default=Disabled +sparkfun_pro_micro_esp32c3.menu.JTAGAdapter.default.build.copy_jtag_files=0 +sparkfun_pro_micro_esp32c3.menu.JTAGAdapter.builtin=Integrated USB JTAG +sparkfun_pro_micro_esp32c3.menu.JTAGAdapter.builtin.build.openocdscript=esp32c3-builtin.cfg +sparkfun_pro_micro_esp32c3.menu.JTAGAdapter.builtin.build.copy_jtag_files=1 +sparkfun_pro_micro_esp32c3.menu.JTAGAdapter.external=FTDI Adapter +sparkfun_pro_micro_esp32c3.menu.JTAGAdapter.external.build.openocdscript=esp32c3-ftdi.cfg +sparkfun_pro_micro_esp32c3.menu.JTAGAdapter.external.build.copy_jtag_files=1 +sparkfun_pro_micro_esp32c3.menu.JTAGAdapter.bridge=ESP USB Bridge +sparkfun_pro_micro_esp32c3.menu.JTAGAdapter.bridge.build.openocdscript=esp32c3-bridge.cfg +sparkfun_pro_micro_esp32c3.menu.JTAGAdapter.bridge.build.copy_jtag_files=1 + +sparkfun_pro_micro_esp32c3.menu.CDCOnBoot.cdc=Enabled +sparkfun_pro_micro_esp32c3.menu.CDCOnBoot.cdc.build.cdc_on_boot=1 +sparkfun_pro_micro_esp32c3.menu.CDCOnBoot.default=Enabled +sparkfun_pro_micro_esp32c3.menu.CDCOnBoot.default.build.cdc_on_boot=0 + +sparkfun_pro_micro_esp32c3.menu.PartitionScheme.default=Default 4MB with spiffs (1.2MB APP/1.5MB SPIFFS) +sparkfun_pro_micro_esp32c3.menu.PartitionScheme.default.build.partitions=default +sparkfun_pro_micro_esp32c3.menu.PartitionScheme.defaultffat=Default 4MB with ffat (1.2MB APP/1.5MB FATFS) +sparkfun_pro_micro_esp32c3.menu.PartitionScheme.defaultffat.build.partitions=default_ffat +sparkfun_pro_micro_esp32c3.menu.PartitionScheme.minimal=Minimal (1.3MB APP/700KB SPIFFS) +sparkfun_pro_micro_esp32c3.menu.PartitionScheme.minimal.build.partitions=minimal +sparkfun_pro_micro_esp32c3.menu.PartitionScheme.no_ota=No OTA (2MB APP/2MB SPIFFS) +sparkfun_pro_micro_esp32c3.menu.PartitionScheme.no_ota.build.partitions=no_ota +sparkfun_pro_micro_esp32c3.menu.PartitionScheme.no_ota.upload.maximum_size=2097152 +sparkfun_pro_micro_esp32c3.menu.PartitionScheme.noota_3g=No OTA (1MB APP/3MB SPIFFS) +sparkfun_pro_micro_esp32c3.menu.PartitionScheme.noota_3g.build.partitions=noota_3g +sparkfun_pro_micro_esp32c3.menu.PartitionScheme.noota_3g.upload.maximum_size=1048576 +sparkfun_pro_micro_esp32c3.menu.PartitionScheme.noota_ffat=No OTA (2MB APP/2MB FATFS) +sparkfun_pro_micro_esp32c3.menu.PartitionScheme.noota_ffat.build.partitions=noota_ffat +sparkfun_pro_micro_esp32c3.menu.PartitionScheme.noota_ffat.upload.maximum_size=2097152 +sparkfun_pro_micro_esp32c3.menu.PartitionScheme.noota_3gffat=No OTA (1MB APP/3MB FATFS) +sparkfun_pro_micro_esp32c3.menu.PartitionScheme.noota_3gffat.build.partitions=noota_3gffat +sparkfun_pro_micro_esp32c3.menu.PartitionScheme.noota_3gffat.upload.maximum_size=1048576 +sparkfun_pro_micro_esp32c3.menu.PartitionScheme.huge_app=Huge APP (3MB No OTA/1MB SPIFFS) +sparkfun_pro_micro_esp32c3.menu.PartitionScheme.huge_app.build.partitions=huge_app +sparkfun_pro_micro_esp32c3.menu.PartitionScheme.huge_app.upload.maximum_size=3145728 +sparkfun_pro_micro_esp32c3.menu.PartitionScheme.min_spiffs=Minimal SPIFFS (1.9MB APP with OTA/190KB SPIFFS) +sparkfun_pro_micro_esp32c3.menu.PartitionScheme.min_spiffs.build.partitions=min_spiffs +sparkfun_pro_micro_esp32c3.menu.PartitionScheme.min_spiffs.upload.maximum_size=1966080 + +sparkfun_pro_micro_esp32c3.menu.CPUFreq.160=160MHz (WiFi) +sparkfun_pro_micro_esp32c3.menu.CPUFreq.160.build.f_cpu=160000000L +sparkfun_pro_micro_esp32c3.menu.CPUFreq.80=80MHz (WiFi) +sparkfun_pro_micro_esp32c3.menu.CPUFreq.80.build.f_cpu=80000000L +sparkfun_pro_micro_esp32c3.menu.CPUFreq.40=40MHz +sparkfun_pro_micro_esp32c3.menu.CPUFreq.40.build.f_cpu=40000000L +sparkfun_pro_micro_esp32c3.menu.CPUFreq.20=20MHz +sparkfun_pro_micro_esp32c3.menu.CPUFreq.20.build.f_cpu=20000000L +sparkfun_pro_micro_esp32c3.menu.CPUFreq.10=10MHz +sparkfun_pro_micro_esp32c3.menu.CPUFreq.10.build.f_cpu=10000000L + +sparkfun_pro_micro_esp32c3.menu.FlashMode.qio=QIO +sparkfun_pro_micro_esp32c3.menu.FlashMode.qio.build.flash_mode=dio +sparkfun_pro_micro_esp32c3.menu.FlashMode.qio.build.boot=qio +sparkfun_pro_micro_esp32c3.menu.FlashMode.dio=DIO +sparkfun_pro_micro_esp32c3.menu.FlashMode.dio.build.flash_mode=dio +sparkfun_pro_micro_esp32c3.menu.FlashMode.dio.build.boot=dio +sparkfun_pro_micro_esp32c3.menu.FlashMode.qout=QOUT +sparkfun_pro_micro_esp32c3.menu.FlashMode.qout.build.flash_mode=dout +sparkfun_pro_micro_esp32c3.menu.FlashMode.qout.build.boot=qout +sparkfun_pro_micro_esp32c3.menu.FlashMode.dout=DOUT +sparkfun_pro_micro_esp32c3.menu.FlashMode.dout.build.flash_mode=dout +sparkfun_pro_micro_esp32c3.menu.FlashMode.dout.build.boot=dout + +sparkfun_pro_micro_esp32c3.menu.FlashFreq.80=80MHz +sparkfun_pro_micro_esp32c3.menu.FlashFreq.80.build.flash_freq=80m +sparkfun_pro_micro_esp32c3.menu.FlashFreq.40=40MHz +sparkfun_pro_micro_esp32c3.menu.FlashFreq.40.build.flash_freq=40m + +sparkfun_pro_micro_esp32c3.menu.FlashSize.4M=4MB (32Mb) +sparkfun_pro_micro_esp32c3.menu.FlashSize.4M.build.flash_size=4MB + +sparkfun_pro_micro_esp32c3.menu.UploadSpeed.921600=921600 +sparkfun_pro_micro_esp32c3.menu.UploadSpeed.921600.upload.speed=921600 +sparkfun_pro_micro_esp32c3.menu.UploadSpeed.115200=115200 +sparkfun_pro_micro_esp32c3.menu.UploadSpeed.115200.upload.speed=115200 +sparkfun_pro_micro_esp32c3.menu.UploadSpeed.256000.windows=256000 +sparkfun_pro_micro_esp32c3.menu.UploadSpeed.256000.upload.speed=256000 +sparkfun_pro_micro_esp32c3.menu.UploadSpeed.230400.windows.upload.speed=256000 +sparkfun_pro_micro_esp32c3.menu.UploadSpeed.230400=230400 +sparkfun_pro_micro_esp32c3.menu.UploadSpeed.230400.upload.speed=230400 +sparkfun_pro_micro_esp32c3.menu.UploadSpeed.460800.linux=460800 +sparkfun_pro_micro_esp32c3.menu.UploadSpeed.460800.macosx=460800 +sparkfun_pro_micro_esp32c3.menu.UploadSpeed.460800.upload.speed=460800 +sparkfun_pro_micro_esp32c3.menu.UploadSpeed.512000.windows=512000 +sparkfun_pro_micro_esp32c3.menu.UploadSpeed.512000.upload.speed=512000 + +sparkfun_pro_micro_esp32c3.menu.DebugLevel.none=None +sparkfun_pro_micro_esp32c3.menu.DebugLevel.none.build.code_debug=0 +sparkfun_pro_micro_esp32c3.menu.DebugLevel.error=Error +sparkfun_pro_micro_esp32c3.menu.DebugLevel.error.build.code_debug=1 +sparkfun_pro_micro_esp32c3.menu.DebugLevel.warn=Warn +sparkfun_pro_micro_esp32c3.menu.DebugLevel.warn.build.code_debug=2 +sparkfun_pro_micro_esp32c3.menu.DebugLevel.info=Info +sparkfun_pro_micro_esp32c3.menu.DebugLevel.info.build.code_debug=3 +sparkfun_pro_micro_esp32c3.menu.DebugLevel.debug=Debug +sparkfun_pro_micro_esp32c3.menu.DebugLevel.debug.build.code_debug=4 +sparkfun_pro_micro_esp32c3.menu.DebugLevel.verbose=Verbose +sparkfun_pro_micro_esp32c3.menu.DebugLevel.verbose.build.code_debug=5 + +sparkfun_pro_micro_esp32c3.menu.EraseFlash.none=Disabled +sparkfun_pro_micro_esp32c3.menu.EraseFlash.none.upload.erase_cmd= +sparkfun_pro_micro_esp32c3.menu.EraseFlash.all=Enabled +sparkfun_pro_micro_esp32c3.menu.EraseFlash.all.upload.erase_cmd=-e + +############################################################## + nina_w10.name=u-blox NINA-W10 series (ESP32) nina_w10.bootloader.tool=esptool_py @@ -9682,7 +9996,7 @@ firebeetle32.build.target=esp32 firebeetle32.build.mcu=esp32 firebeetle32.build.core=esp32 firebeetle32.build.variant=firebeetle32 -firebeetle32.build.board=ESP32_DEV +firebeetle32.build.board=DFROBOT_FIREBEETLE_ESP32 firebeetle32.build.f_cpu=240000000L firebeetle32.build.flash_mode=dio @@ -13818,6 +14132,387 @@ nodemcu-32s.menu.EraseFlash.all.upload.erase_cmd=-e ############################################################## +nologo_esp32c3_super_mini.name=Nologo ESP32C3 Super Mini +nologo_esp32c3_super_mini.vid.0=0x303a +nologo_esp32c3_super_mini.pid.0=0x1001 + +nologo_esp32c3_super_mini.upload.tool=esptool_py +nologo_esp32c3_super_mini.upload.tool.default=esptool_py +nologo_esp32c3_super_mini.upload.tool.network=esp_ota +nologo_esp32c3_super_mini.upload.maximum_size=1310720 +nologo_esp32c3_super_mini.upload.maximum_data_size=327680 +nologo_esp32c3_super_mini.upload.flags= +nologo_esp32c3_super_mini.upload.extra_flags= +nologo_esp32c3_super_mini.upload.use_1200bps_touch=false +nologo_esp32c3_super_mini.upload.wait_for_upload_port=false + +nologo_esp32c3_super_mini.serial.disableDTR=false +nologo_esp32c3_super_mini.serial.disableRTS=false + +nologo_esp32c3_super_mini.build.tarch=riscv32 +nologo_esp32c3_super_mini.build.target=esp +nologo_esp32c3_super_mini.build.mcu=esp32c3 +nologo_esp32c3_super_mini.build.core=esp32 +nologo_esp32c3_super_mini.build.variant=nologo_esp32c3_super_mini +nologo_esp32c3_super_mini.build.board=NOLOGO_ESP32C3_SUPER_MINI +nologo_esp32c3_super_mini.build.bootloader_addr=0x0 + +nologo_esp32c3_super_mini.build.usb_mode=1 +nologo_esp32c3_super_mini.build.cdc_on_boot=1 +nologo_esp32c3_super_mini.build.f_cpu=160000000L +nologo_esp32c3_super_mini.build.flash_size=4MB +nologo_esp32c3_super_mini.build.flash_freq=80m +nologo_esp32c3_super_mini.build.flash_mode=qio +nologo_esp32c3_super_mini.build.boot=qio +nologo_esp32c3_super_mini.build.partitions=default +nologo_esp32c3_super_mini.build.defines= + +nologo_esp32c3_super_mini.menu.USBMode.hwcdc=Hardware CDC and JTAG +nologo_esp32c3_super_mini.menu.USBMode.hwcdc.build.usb_mode=1 +nologo_esp32c3_super_mini.menu.USBMode.default=USB-OTG +nologo_esp32c3_super_mini.menu.USBMode.default.build.usb_mode=0 + +nologo_esp32c3_super_mini.menu.JTAGAdapter.default=Disabled +nologo_esp32c3_super_mini.menu.JTAGAdapter.default.build.copy_jtag_files=0 +nologo_esp32c3_super_mini.menu.JTAGAdapter.builtin=Integrated USB JTAG +nologo_esp32c3_super_mini.menu.JTAGAdapter.builtin.build.openocdscript=esp32c3-builtin.cfg +nologo_esp32c3_super_mini.menu.JTAGAdapter.builtin.build.copy_jtag_files=1 +nologo_esp32c3_super_mini.menu.JTAGAdapter.external=FTDI Adapter +nologo_esp32c3_super_mini.menu.JTAGAdapter.external.build.openocdscript=esp32c3-ftdi.cfg +nologo_esp32c3_super_mini.menu.JTAGAdapter.external.build.copy_jtag_files=1 +nologo_esp32c3_super_mini.menu.JTAGAdapter.bridge=ESP USB Bridge +nologo_esp32c3_super_mini.menu.JTAGAdapter.bridge.build.openocdscript=esp32c3-bridge.cfg +nologo_esp32c3_super_mini.menu.JTAGAdapter.bridge.build.copy_jtag_files=1 + +nologo_esp32c3_super_mini.menu.CDCOnBoot.default=Enabled +nologo_esp32c3_super_mini.menu.CDCOnBoot.default.build.cdc_on_boot=1 +nologo_esp32c3_super_mini.menu.CDCOnBoot.cdc=Enabled +nologo_esp32c3_super_mini.menu.CDCOnBoot.cdc.build.cdc_on_boot=1 + +nologo_esp32c3_super_mini.menu.PartitionScheme.default=Default 4MB with spiffs (1.2MB APP/1.5MB SPIFFS) +nologo_esp32c3_super_mini.menu.PartitionScheme.default.build.partitions=default +nologo_esp32c3_super_mini.menu.PartitionScheme.defaultffat=Default 4MB with ffat (1.2MB APP/1.5MB FATFS) +nologo_esp32c3_super_mini.menu.PartitionScheme.defaultffat.build.partitions=default_ffat +nologo_esp32c3_super_mini.menu.PartitionScheme.default_8MB=8M with spiffs (3MB APP/1.5MB SPIFFS) +nologo_esp32c3_super_mini.menu.PartitionScheme.default_8MB.build.partitions=default_8MB +nologo_esp32c3_super_mini.menu.PartitionScheme.default_8MB.upload.maximum_size=3342336 +nologo_esp32c3_super_mini.menu.PartitionScheme.minimal=Minimal (1.3MB APP/700KB SPIFFS) +nologo_esp32c3_super_mini.menu.PartitionScheme.minimal.build.partitions=minimal +nologo_esp32c3_super_mini.menu.PartitionScheme.no_ota=No OTA (2MB APP/2MB SPIFFS) +nologo_esp32c3_super_mini.menu.PartitionScheme.no_ota.build.partitions=no_ota +nologo_esp32c3_super_mini.menu.PartitionScheme.no_ota.upload.maximum_size=2097152 +nologo_esp32c3_super_mini.menu.PartitionScheme.noota_3g=No OTA (1MB APP/3MB SPIFFS) +nologo_esp32c3_super_mini.menu.PartitionScheme.noota_3g.build.partitions=noota_3g +nologo_esp32c3_super_mini.menu.PartitionScheme.noota_3g.upload.maximum_size=1048576 +nologo_esp32c3_super_mini.menu.PartitionScheme.noota_ffat=No OTA (2MB APP/2MB FATFS) +nologo_esp32c3_super_mini.menu.PartitionScheme.noota_ffat.build.partitions=noota_ffat +nologo_esp32c3_super_mini.menu.PartitionScheme.noota_ffat.upload.maximum_size=2097152 +nologo_esp32c3_super_mini.menu.PartitionScheme.noota_3gffat=No OTA (1MB APP/3MB FATFS) +nologo_esp32c3_super_mini.menu.PartitionScheme.noota_3gffat.build.partitions=noota_3gffat +nologo_esp32c3_super_mini.menu.PartitionScheme.noota_3gffat.upload.maximum_size=1048576 +nologo_esp32c3_super_mini.menu.PartitionScheme.huge_app=Huge APP (3MB No OTA/1MB SPIFFS) +nologo_esp32c3_super_mini.menu.PartitionScheme.huge_app.build.partitions=huge_app +nologo_esp32c3_super_mini.menu.PartitionScheme.huge_app.upload.maximum_size=3145728 + +nologo_esp32c3_super_mini.menu.CPUFreq.160=160MHz (WiFi) +nologo_esp32c3_super_mini.menu.CPUFreq.160.build.f_cpu=160000000L +nologo_esp32c3_super_mini.menu.CPUFreq.80=80MHz (WiFi) +nologo_esp32c3_super_mini.menu.CPUFreq.80.build.f_cpu=80000000L +nologo_esp32c3_super_mini.menu.CPUFreq.40=40MHz +nologo_esp32c3_super_mini.menu.CPUFreq.40.build.f_cpu=40000000L +nologo_esp32c3_super_mini.menu.CPUFreq.20=20MHz +nologo_esp32c3_super_mini.menu.CPUFreq.20.build.f_cpu=20000000L +nologo_esp32c3_super_mini.menu.CPUFreq.10=10MHz +nologo_esp32c3_super_mini.menu.CPUFreq.10.build.f_cpu=10000000L + +nologo_esp32c3_super_mini.menu.FlashMode.qio=QIO +nologo_esp32c3_super_mini.menu.FlashMode.qio.build.flash_mode=dio +nologo_esp32c3_super_mini.menu.FlashMode.qio.build.boot=qio +nologo_esp32c3_super_mini.menu.FlashMode.dio=DIO +nologo_esp32c3_super_mini.menu.FlashMode.dio.build.flash_mode=dio +nologo_esp32c3_super_mini.menu.FlashMode.dio.build.boot=dio + +nologo_esp32c3_super_mini.menu.FlashFreq.80=80MHz +nologo_esp32c3_super_mini.menu.FlashFreq.80.build.flash_freq=80m +nologo_esp32c3_super_mini.menu.FlashFreq.40=40MHz +nologo_esp32c3_super_mini.menu.FlashFreq.40.build.flash_freq=40m + +nologo_esp32c3_super_mini.menu.UploadSpeed.921600=921600 +nologo_esp32c3_super_mini.menu.UploadSpeed.921600.upload.speed=921600 +nologo_esp32c3_super_mini.menu.UploadSpeed.115200=115200 +nologo_esp32c3_super_mini.menu.UploadSpeed.115200.upload.speed=115200 +nologo_esp32c3_super_mini.menu.UploadSpeed.256000.windows=256000 +nologo_esp32c3_super_mini.menu.UploadSpeed.256000.upload.speed=256000 +nologo_esp32c3_super_mini.menu.UploadSpeed.230400.windows.upload.speed=256000 +nologo_esp32c3_super_mini.menu.UploadSpeed.230400=230400 +nologo_esp32c3_super_mini.menu.UploadSpeed.230400.upload.speed=230400 +nologo_esp32c3_super_mini.menu.UploadSpeed.460800.linux=460800 +nologo_esp32c3_super_mini.menu.UploadSpeed.460800.macosx=460800 +nologo_esp32c3_super_mini.menu.UploadSpeed.460800.upload.speed=460800 +nologo_esp32c3_super_mini.menu.UploadSpeed.512000.windows=512000 +nologo_esp32c3_super_mini.menu.UploadSpeed.512000.upload.speed=512000 + +nologo_esp32c3_super_mini.menu.DebugLevel.none=None +nologo_esp32c3_super_mini.menu.DebugLevel.none.build.code_debug=0 +nologo_esp32c3_super_mini.menu.DebugLevel.error=Error +nologo_esp32c3_super_mini.menu.DebugLevel.error.build.code_debug=1 +nologo_esp32c3_super_mini.menu.DebugLevel.warn=Warn +nologo_esp32c3_super_mini.menu.DebugLevel.warn.build.code_debug=2 +nologo_esp32c3_super_mini.menu.DebugLevel.info=Info +nologo_esp32c3_super_mini.menu.DebugLevel.info.build.code_debug=3 +nologo_esp32c3_super_mini.menu.DebugLevel.debug=Debug +nologo_esp32c3_super_mini.menu.DebugLevel.debug.build.code_debug=4 +nologo_esp32c3_super_mini.menu.DebugLevel.verbose=Verbose +nologo_esp32c3_super_mini.menu.DebugLevel.verbose.build.code_debug=5 + +nologo_esp32c3_super_mini.menu.EraseFlash.none=Disabled +nologo_esp32c3_super_mini.menu.EraseFlash.none.upload.erase_cmd= +nologo_esp32c3_super_mini.menu.EraseFlash.all=Enabled +nologo_esp32c3_super_mini.menu.EraseFlash.all.upload.erase_cmd=-e + +############################################################## + +nologo_esp32s3_pico.name=Nologo ESP32S3 Pico +nologo_esp32s3_pico.vid.0=0x303a +nologo_esp32s3_pico.pid.0=0x1001 + +nologo_esp32s3_pico.bootloader.tool=esptool_py +nologo_esp32s3_pico.bootloader.tool.default=esptool_py + +nologo_esp32s3_pico.upload.tool=esptool_py +nologo_esp32s3_pico.upload.tool.default=esptool_py +nologo_esp32s3_pico.upload.tool.network=esp_ota + +nologo_esp32s3_pico.upload.maximum_size=1310720 +nologo_esp32s3_pico.upload.maximum_data_size=327680 +nologo_esp32s3_pico.upload.flags= +nologo_esp32s3_pico.upload.extra_flags= +nologo_esp32s3_pico.upload.use_1200bps_touch=false +nologo_esp32s3_pico.upload.wait_for_upload_port=false + +nologo_esp32s3_pico.serial.disableDTR=false +nologo_esp32s3_pico.serial.disableRTS=false + +nologo_esp32s3_pico.build.tarch=xtensa +nologo_esp32s3_pico.build.bootloader_addr=0x0 +nologo_esp32s3_pico.build.target=esp32s3 +nologo_esp32s3_pico.build.mcu=esp32s3 +nologo_esp32s3_pico.build.core=esp32 +nologo_esp32s3_pico.build.variant=nologo_esp32s3_pico +nologo_esp32s3_pico.build.board=NOLOGO_ESP32S3_PICO + +nologo_esp32s3_pico.build.usb_mode=1 +nologo_esp32s3_pico.build.cdc_on_boot=1 +nologo_esp32s3_pico.build.msc_on_boot=0 +nologo_esp32s3_pico.build.dfu_on_boot=0 +nologo_esp32s3_pico.build.f_cpu=240000000L +nologo_esp32s3_pico.build.flash_size=8MB +nologo_esp32s3_pico.build.flash_freq=80m +nologo_esp32s3_pico.build.flash_mode=dio +nologo_esp32s3_pico.build.boot=qio +nologo_esp32s3_pico.build.boot_freq=80m +nologo_esp32s3_pico.build.partitions=default +nologo_esp32s3_pico.build.defines= +nologo_esp32s3_pico.build.loop_core= +nologo_esp32s3_pico.build.event_core= +nologo_esp32s3_pico.build.psram_type=qspi +nologo_esp32s3_pico.build.memory_type={build.boot}_{build.psram_type} + +## IDE 2.0 Seems to not update the value +nologo_esp32s3_pico.menu.JTAGAdapter.default=Disabled +nologo_esp32s3_pico.menu.JTAGAdapter.default.build.copy_jtag_files=0 +nologo_esp32s3_pico.menu.JTAGAdapter.builtin=Integrated USB JTAG +nologo_esp32s3_pico.menu.JTAGAdapter.builtin.build.openocdscript=esp32s3-builtin.cfg +nologo_esp32s3_pico.menu.JTAGAdapter.builtin.build.copy_jtag_files=1 +nologo_esp32s3_pico.menu.JTAGAdapter.external=FTDI Adapter +nologo_esp32s3_pico.menu.JTAGAdapter.external.build.openocdscript=esp32s3-ftdi.cfg +nologo_esp32s3_pico.menu.JTAGAdapter.external.build.copy_jtag_files=1 +nologo_esp32s3_pico.menu.JTAGAdapter.bridge=ESP USB Bridge +nologo_esp32s3_pico.menu.JTAGAdapter.bridge.build.openocdscript=esp32s3-bridge.cfg +nologo_esp32s3_pico.menu.JTAGAdapter.bridge.build.copy_jtag_files=1 + +nologo_esp32s3_pico.menu.PSRAM.disabled=Disabled +nologo_esp32s3_pico.menu.PSRAM.disabled.build.defines= +nologo_esp32s3_pico.menu.PSRAM.disabled.build.psram_type=qspi +nologo_esp32s3_pico.menu.PSRAM.enabled=QSPI PSRAM +nologo_esp32s3_pico.menu.PSRAM.enabled.build.defines=-DBOARD_HAS_PSRAM +nologo_esp32s3_pico.menu.PSRAM.enabled.build.psram_type=qspi +nologo_esp32s3_pico.menu.PSRAM.opi=OPI PSRAM +nologo_esp32s3_pico.menu.PSRAM.opi.build.defines=-DBOARD_HAS_PSRAM +nologo_esp32s3_pico.menu.PSRAM.opi.build.psram_type=opi + +nologo_esp32s3_pico.menu.FlashMode.qio=QIO 80MHz +nologo_esp32s3_pico.menu.FlashMode.qio.build.flash_mode=dio +nologo_esp32s3_pico.menu.FlashMode.qio.build.boot=qio +nologo_esp32s3_pico.menu.FlashMode.qio.build.boot_freq=80m +nologo_esp32s3_pico.menu.FlashMode.qio.build.flash_freq=80m +nologo_esp32s3_pico.menu.FlashMode.qio120=QIO 120MHz +nologo_esp32s3_pico.menu.FlashMode.qio120.build.flash_mode=dio +nologo_esp32s3_pico.menu.FlashMode.qio120.build.boot=qio +nologo_esp32s3_pico.menu.FlashMode.qio120.build.boot_freq=120m +nologo_esp32s3_pico.menu.FlashMode.qio120.build.flash_freq=80m +nologo_esp32s3_pico.menu.FlashMode.dio=DIO 80MHz +nologo_esp32s3_pico.menu.FlashMode.dio.build.flash_mode=dio +nologo_esp32s3_pico.menu.FlashMode.dio.build.boot=dio +nologo_esp32s3_pico.menu.FlashMode.dio.build.boot_freq=80m +nologo_esp32s3_pico.menu.FlashMode.dio.build.flash_freq=80m +nologo_esp32s3_pico.menu.FlashMode.opi=OPI 80MHz +nologo_esp32s3_pico.menu.FlashMode.opi.build.flash_mode=dout +nologo_esp32s3_pico.menu.FlashMode.opi.build.boot=opi +nologo_esp32s3_pico.menu.FlashMode.opi.build.boot_freq=80m +nologo_esp32s3_pico.menu.FlashMode.opi.build.flash_freq=80m + +nologo_esp32s3_pico.menu.FlashSize.8M=8MB (64Mb) +nologo_esp32s3_pico.menu.FlashSize.8M.build.flash_size=8MB +nologo_esp32s3_pico.menu.FlashSize.8M.build.partitions=default_8MB +nologo_esp32s3_pico.menu.FlashSize.16M=16MB (128Mb) +nologo_esp32s3_pico.menu.FlashSize.16M.build.flash_size=16MB + +nologo_esp32s3_pico.menu.LoopCore.1=Core 1 +nologo_esp32s3_pico.menu.LoopCore.1.build.loop_core=-DARDUINO_RUNNING_CORE=1 +nologo_esp32s3_pico.menu.LoopCore.0=Core 0 +nologo_esp32s3_pico.menu.LoopCore.0.build.loop_core=-DARDUINO_RUNNING_CORE=0 + +nologo_esp32s3_pico.menu.EventsCore.1=Core 1 +nologo_esp32s3_pico.menu.EventsCore.1.build.event_core=-DARDUINO_EVENT_RUNNING_CORE=1 +nologo_esp32s3_pico.menu.EventsCore.0=Core 0 +nologo_esp32s3_pico.menu.EventsCore.0.build.event_core=-DARDUINO_EVENT_RUNNING_CORE=0 + +nologo_esp32s3_pico.menu.USBMode.hwcdc=Hardware CDC and JTAG +nologo_esp32s3_pico.menu.USBMode.hwcdc.build.usb_mode=1 +nologo_esp32s3_pico.menu.USBMode.default=USB-OTG (TinyUSB) +nologo_esp32s3_pico.menu.USBMode.default.build.usb_mode=0 + +nologo_esp32s3_pico.menu.CDCOnBoot.default=Enabled +nologo_esp32s3_pico.menu.CDCOnBoot.default.build.cdc_on_boot=1 +nologo_esp32s3_pico.menu.CDCOnBoot.cdc=Enabled +nologo_esp32s3_pico.menu.CDCOnBoot.cdc.build.cdc_on_boot=1 + +nologo_esp32s3_pico.menu.MSCOnBoot.default=Disabled +nologo_esp32s3_pico.menu.MSCOnBoot.default.build.msc_on_boot=0 +nologo_esp32s3_pico.menu.MSCOnBoot.msc=Enabled (Requires USB-OTG Mode) +nologo_esp32s3_pico.menu.MSCOnBoot.msc.build.msc_on_boot=1 + +nologo_esp32s3_pico.menu.DFUOnBoot.default=Disabled +nologo_esp32s3_pico.menu.DFUOnBoot.default.build.dfu_on_boot=0 +nologo_esp32s3_pico.menu.DFUOnBoot.dfu=Enabled (Requires USB-OTG Mode) +nologo_esp32s3_pico.menu.DFUOnBoot.dfu.build.dfu_on_boot=1 + +nologo_esp32s3_pico.menu.UploadMode.default=UART0 / Hardware CDC +nologo_esp32s3_pico.menu.UploadMode.default.upload.use_1200bps_touch=false +nologo_esp32s3_pico.menu.UploadMode.default.upload.wait_for_upload_port=false +nologo_esp32s3_pico.menu.UploadMode.cdc=USB-OTG CDC (TinyUSB) +nologo_esp32s3_pico.menu.UploadMode.cdc.upload.use_1200bps_touch=true +nologo_esp32s3_pico.menu.UploadMode.cdc.upload.wait_for_upload_port=true + +nologo_esp32s3_pico.menu.PartitionScheme.default=Default 4MB with spiffs (1.2MB APP/1.5MB SPIFFS) +nologo_esp32s3_pico.menu.PartitionScheme.default.build.partitions=default +nologo_esp32s3_pico.menu.PartitionScheme.defaultffat=Default 4MB with ffat (1.2MB APP/1.5MB FATFS) +nologo_esp32s3_pico.menu.PartitionScheme.defaultffat.build.partitions=default_ffat +nologo_esp32s3_pico.menu.PartitionScheme.default_8MB=8M with spiffs (3MB APP/1.5MB SPIFFS) +nologo_esp32s3_pico.menu.PartitionScheme.default_8MB.build.partitions=default_8MB +nologo_esp32s3_pico.menu.PartitionScheme.default_8MB.upload.maximum_size=3342336 +nologo_esp32s3_pico.menu.PartitionScheme.minimal=Minimal (1.3MB APP/700KB SPIFFS) +nologo_esp32s3_pico.menu.PartitionScheme.minimal.build.partitions=minimal +nologo_esp32s3_pico.menu.PartitionScheme.no_ota=No OTA (2MB APP/2MB SPIFFS) +nologo_esp32s3_pico.menu.PartitionScheme.no_ota.build.partitions=no_ota +nologo_esp32s3_pico.menu.PartitionScheme.no_ota.upload.maximum_size=2097152 +nologo_esp32s3_pico.menu.PartitionScheme.noota_3g=No OTA (1MB APP/3MB SPIFFS) +nologo_esp32s3_pico.menu.PartitionScheme.noota_3g.build.partitions=noota_3g +nologo_esp32s3_pico.menu.PartitionScheme.noota_3g.upload.maximum_size=1048576 +nologo_esp32s3_pico.menu.PartitionScheme.noota_ffat=No OTA (2MB APP/2MB FATFS) +nologo_esp32s3_pico.menu.PartitionScheme.noota_ffat.build.partitions=noota_ffat +nologo_esp32s3_pico.menu.PartitionScheme.noota_ffat.upload.maximum_size=2097152 +nologo_esp32s3_pico.menu.PartitionScheme.noota_3gffat=No OTA (1MB APP/3MB FATFS) +nologo_esp32s3_pico.menu.PartitionScheme.noota_3gffat.build.partitions=noota_3gffat +nologo_esp32s3_pico.menu.PartitionScheme.noota_3gffat.upload.maximum_size=1048576 +nologo_esp32s3_pico.menu.PartitionScheme.huge_app=Huge APP (3MB No OTA/1MB SPIFFS) +nologo_esp32s3_pico.menu.PartitionScheme.huge_app.build.partitions=huge_app +nologo_esp32s3_pico.menu.PartitionScheme.huge_app.upload.maximum_size=3145728 +nologo_esp32s3_pico.menu.PartitionScheme.min_spiffs=Minimal SPIFFS (1.9MB APP with OTA/190KB SPIFFS) +nologo_esp32s3_pico.menu.PartitionScheme.min_spiffs.build.partitions=min_spiffs +nologo_esp32s3_pico.menu.PartitionScheme.min_spiffs.upload.maximum_size=1966080 +nologo_esp32s3_pico.menu.PartitionScheme.fatflash=16M Flash (2MB APP/12.5MB FATFS) +nologo_esp32s3_pico.menu.PartitionScheme.fatflash.build.partitions=ffat +nologo_esp32s3_pico.menu.PartitionScheme.fatflash.upload.maximum_size=2097152 +nologo_esp32s3_pico.menu.PartitionScheme.app3M_fat9M_16MB=16M Flash (3MB APP/9.9MB FATFS) +nologo_esp32s3_pico.menu.PartitionScheme.app3M_fat9M_16MB.build.partitions=app3M_fat9M_16MB +nologo_esp32s3_pico.menu.PartitionScheme.app3M_fat9M_16MB.upload.maximum_size=3145728 +nologo_esp32s3_pico.menu.PartitionScheme.rainmaker=RainMaker +nologo_esp32s3_pico.menu.PartitionScheme.rainmaker.build.partitions=rainmaker +nologo_esp32s3_pico.menu.PartitionScheme.rainmaker.upload.maximum_size=3145728 +nologo_esp32s3_pico.menu.PartitionScheme.app5M_fat24M_32MB=32M Flash (4.8MB APP/22MB FATFS) +nologo_esp32s3_pico.menu.PartitionScheme.app5M_fat24M_32MB.build.partitions=large_fat_32MB +nologo_esp32s3_pico.menu.PartitionScheme.app5M_fat24M_32MB.upload.maximum_size=4718592 +nologo_esp32s3_pico.menu.PartitionScheme.app5M_little24M_32MB=32M Flash (4.8MB APP/22MB LittleFS) +nologo_esp32s3_pico.menu.PartitionScheme.app5M_little24M_32MB.build.partitions=large_littlefs_32MB +nologo_esp32s3_pico.menu.PartitionScheme.app5M_little24M_32MB.upload.maximum_size=4718592 +nologo_esp32s3_pico.menu.PartitionScheme.esp_sr_16=ESP SR 16M (3MB APP/7MB SPIFFS/2.9MB MODEL) +nologo_esp32s3_pico.menu.PartitionScheme.esp_sr_16.upload.maximum_size=3145728 +nologo_esp32s3_pico.menu.PartitionScheme.esp_sr_16.upload.extra_flags=0xD10000 {build.path}/srmodels.bin +nologo_esp32s3_pico.menu.PartitionScheme.esp_sr_16.build.partitions=esp_sr_16 +nologo_esp32s3_pico.menu.PartitionScheme.zigbee_zczr=Zigbee ZCZR 4MB with spiffs +nologo_esp32s3_pico.menu.PartitionScheme.zigbee_zczr.build.partitions=zigbee_zczr +nologo_esp32s3_pico.menu.PartitionScheme.zigbee_zczr.upload.maximum_size=1310720 +nologo_esp32s3_pico.menu.PartitionScheme.custom=Custom +nologo_esp32s3_pico.menu.PartitionScheme.custom.build.partitions= +nologo_esp32s3_pico.menu.PartitionScheme.custom.upload.maximum_size=16777216 + +nologo_esp32s3_pico.menu.CPUFreq.240=240MHz (WiFi) +nologo_esp32s3_pico.menu.CPUFreq.240.build.f_cpu=240000000L +nologo_esp32s3_pico.menu.CPUFreq.160=160MHz (WiFi) +nologo_esp32s3_pico.menu.CPUFreq.160.build.f_cpu=160000000L +nologo_esp32s3_pico.menu.CPUFreq.80=80MHz (WiFi) +nologo_esp32s3_pico.menu.CPUFreq.80.build.f_cpu=80000000L +nologo_esp32s3_pico.menu.CPUFreq.40=40MHz +nologo_esp32s3_pico.menu.CPUFreq.40.build.f_cpu=40000000L +nologo_esp32s3_pico.menu.CPUFreq.20=20MHz +nologo_esp32s3_pico.menu.CPUFreq.20.build.f_cpu=20000000L +nologo_esp32s3_pico.menu.CPUFreq.10=10MHz +nologo_esp32s3_pico.menu.CPUFreq.10.build.f_cpu=10000000L + +nologo_esp32s3_pico.menu.UploadSpeed.921600=921600 +nologo_esp32s3_pico.menu.UploadSpeed.921600.upload.speed=921600 +nologo_esp32s3_pico.menu.UploadSpeed.115200=115200 +nologo_esp32s3_pico.menu.UploadSpeed.115200.upload.speed=115200 +nologo_esp32s3_pico.menu.UploadSpeed.256000.windows=256000 +nologo_esp32s3_pico.menu.UploadSpeed.256000.upload.speed=256000 +nologo_esp32s3_pico.menu.UploadSpeed.230400.windows.upload.speed=256000 +nologo_esp32s3_pico.menu.UploadSpeed.230400=230400 +nologo_esp32s3_pico.menu.UploadSpeed.230400.upload.speed=230400 +nologo_esp32s3_pico.menu.UploadSpeed.460800.linux=460800 +nologo_esp32s3_pico.menu.UploadSpeed.460800.macosx=460800 +nologo_esp32s3_pico.menu.UploadSpeed.460800.upload.speed=460800 +nologo_esp32s3_pico.menu.UploadSpeed.512000.windows=512000 +nologo_esp32s3_pico.menu.UploadSpeed.512000.upload.speed=512000 + +nologo_esp32s3_pico.menu.DebugLevel.none=None +nologo_esp32s3_pico.menu.DebugLevel.none.build.code_debug=0 +nologo_esp32s3_pico.menu.DebugLevel.error=Error +nologo_esp32s3_pico.menu.DebugLevel.error.build.code_debug=1 +nologo_esp32s3_pico.menu.DebugLevel.warn=Warn +nologo_esp32s3_pico.menu.DebugLevel.warn.build.code_debug=2 +nologo_esp32s3_pico.menu.DebugLevel.info=Info +nologo_esp32s3_pico.menu.DebugLevel.info.build.code_debug=3 +nologo_esp32s3_pico.menu.DebugLevel.debug=Debug +nologo_esp32s3_pico.menu.DebugLevel.debug.build.code_debug=4 +nologo_esp32s3_pico.menu.DebugLevel.verbose=Verbose +nologo_esp32s3_pico.menu.DebugLevel.verbose.build.code_debug=5 + +nologo_esp32s3_pico.menu.EraseFlash.none=Disabled +nologo_esp32s3_pico.menu.EraseFlash.none.upload.erase_cmd= +nologo_esp32s3_pico.menu.EraseFlash.all=Enabled +nologo_esp32s3_pico.menu.EraseFlash.all.upload.erase_cmd=-e + +nologo_esp32s3_pico.menu.ZigbeeMode.default=Disabled +nologo_esp32s3_pico.menu.ZigbeeMode.default.build.zigbee_mode= +nologo_esp32s3_pico.menu.ZigbeeMode.default.build.zigbee_libs= +nologo_esp32s3_pico.menu.ZigbeeMode.zczr=Zigbee ZCZR (coordinator) +nologo_esp32s3_pico.menu.ZigbeeMode.zczr.build.zigbee_mode=-DZIGBEE_MODE_ZCZR +nologo_esp32s3_pico.menu.ZigbeeMode.zczr.build.zigbee_libs=-lesp_zb_api_zczr -lesp_zb_cli_command -lzboss_stack.zczr.trace -lzboss_stack.zczr -lzboss_port + +############################################################## + mhetesp32devkit.name=MH ET LIVE ESP32DevKIT mhetesp32devkit.bootloader.tool=esptool_py @@ -15638,1365 +16333,4156 @@ espino32.menu.EraseFlash.all.upload.erase_cmd=-e ############################################################## -m5stack-core-esp32.name=M5Stack-Core-ESP32 - -m5stack-core-esp32.bootloader.tool=esptool_py -m5stack-core-esp32.bootloader.tool.default=esptool_py - -m5stack-core-esp32.upload.tool=esptool_py -m5stack-core-esp32.upload.tool.default=esptool_py -m5stack-core-esp32.upload.tool.network=esp_ota - -m5stack-core-esp32.upload.maximum_size=1310720 -m5stack-core-esp32.upload.maximum_data_size=327680 -m5stack-core-esp32.upload.flags= -m5stack-core-esp32.upload.extra_flags= - -m5stack-core-esp32.serial.disableDTR=true -m5stack-core-esp32.serial.disableRTS=true - -m5stack-core-esp32.build.tarch=xtensa -m5stack-core-esp32.build.bootloader_addr=0x1000 -m5stack-core-esp32.build.target=esp32 -m5stack-core-esp32.build.mcu=esp32 -m5stack-core-esp32.build.core=esp32 -m5stack-core-esp32.build.variant=m5stack_core_esp32 -m5stack-core-esp32.build.board=M5Stack_Core_ESP32 - -m5stack-core-esp32.build.f_cpu=240000000L -m5stack-core-esp32.build.flash_size=4MB -m5stack-core-esp32.build.flash_mode=dio -m5stack-core-esp32.build.boot=dio -m5stack-core-esp32.build.partitions=default -m5stack-core-esp32.build.defines= - -m5stack-core-esp32.menu.FlashMode.qio=QIO -m5stack-core-esp32.menu.FlashMode.qio.build.flash_mode=dio -m5stack-core-esp32.menu.FlashMode.qio.build.boot=qio -m5stack-core-esp32.menu.FlashMode.dio=DIO -m5stack-core-esp32.menu.FlashMode.dio.build.flash_mode=dio -m5stack-core-esp32.menu.FlashMode.dio.build.boot=dio - -m5stack-core-esp32.menu.FlashFreq.80=80MHz -m5stack-core-esp32.menu.FlashFreq.80.build.flash_freq=80m -m5stack-core-esp32.menu.FlashFreq.40=40MHz -m5stack-core-esp32.menu.FlashFreq.40.build.flash_freq=40m - -m5stack-core-esp32.menu.PartitionScheme.default=Default -m5stack-core-esp32.menu.PartitionScheme.default.build.partitions=default -m5stack-core-esp32.menu.PartitionScheme.no_ota=No OTA (Large APP) -m5stack-core-esp32.menu.PartitionScheme.no_ota.build.partitions=no_ota -m5stack-core-esp32.menu.PartitionScheme.no_ota.upload.maximum_size=2097152 -m5stack-core-esp32.menu.PartitionScheme.min_spiffs=Minimal SPIFFS (Large APPS with OTA) -m5stack-core-esp32.menu.PartitionScheme.min_spiffs.build.partitions=min_spiffs -m5stack-core-esp32.menu.PartitionScheme.min_spiffs.upload.maximum_size=1966080 - -m5stack-core-esp32.menu.UploadSpeed.921600=921600 -m5stack-core-esp32.menu.UploadSpeed.921600.upload.speed=921600 -m5stack-core-esp32.menu.UploadSpeed.115200=115200 -m5stack-core-esp32.menu.UploadSpeed.115200.upload.speed=115200 -m5stack-core-esp32.menu.UploadSpeed.256000.windows=256000 -m5stack-core-esp32.menu.UploadSpeed.256000.upload.speed=256000 -m5stack-core-esp32.menu.UploadSpeed.230400.windows.upload.speed=256000 -m5stack-core-esp32.menu.UploadSpeed.230400=230400 -m5stack-core-esp32.menu.UploadSpeed.230400.upload.speed=230400 -m5stack-core-esp32.menu.UploadSpeed.460800.linux=460800 -m5stack-core-esp32.menu.UploadSpeed.460800.macosx=460800 -m5stack-core-esp32.menu.UploadSpeed.460800.upload.speed=460800 -m5stack-core-esp32.menu.UploadSpeed.512000.windows=512000 -m5stack-core-esp32.menu.UploadSpeed.512000.upload.speed=512000 - -m5stack-core-esp32.menu.DebugLevel.none=None -m5stack-core-esp32.menu.DebugLevel.none.build.code_debug=0 -m5stack-core-esp32.menu.DebugLevel.error=Error -m5stack-core-esp32.menu.DebugLevel.error.build.code_debug=1 -m5stack-core-esp32.menu.DebugLevel.warn=Warn -m5stack-core-esp32.menu.DebugLevel.warn.build.code_debug=2 -m5stack-core-esp32.menu.DebugLevel.info=Info -m5stack-core-esp32.menu.DebugLevel.info.build.code_debug=3 -m5stack-core-esp32.menu.DebugLevel.debug=Debug -m5stack-core-esp32.menu.DebugLevel.debug.build.code_debug=4 -m5stack-core-esp32.menu.DebugLevel.verbose=Verbose -m5stack-core-esp32.menu.DebugLevel.verbose.build.code_debug=5 - -m5stack-core-esp32.menu.EraseFlash.none=Disabled -m5stack-core-esp32.menu.EraseFlash.none.upload.erase_cmd= -m5stack-core-esp32.menu.EraseFlash.all=Enabled -m5stack-core-esp32.menu.EraseFlash.all.upload.erase_cmd=-e +m5stack_core.name=M5Core + +m5stack_core.bootloader.tool=esptool_py +m5stack_core.bootloader.tool.default=esptool_py + +m5stack_core.upload.tool=esptool_py +m5stack_core.upload.tool.default=esptool_py +m5stack_core.upload.tool.network=esp_ota + +m5stack_core.upload.maximum_size=1310720 +m5stack_core.upload.maximum_data_size=327680 +m5stack_core.upload.flags= +m5stack_core.upload.extra_flags= + +m5stack_core.serial.disableDTR=true +m5stack_core.serial.disableRTS=true + +m5stack_core.build.tarch=xtensa +m5stack_core.build.bootloader_addr=0x1000 +m5stack_core.build.target=esp32 +m5stack_core.build.mcu=esp32 +m5stack_core.build.core=esp32 +m5stack_core.build.variant=m5stack_core +m5stack_core.build.board=M5STACK_CORE + +m5stack_core.build.f_cpu=240000000L +m5stack_core.build.flash_size=4MB +m5stack_core.build.flash_freq=80m +m5stack_core.build.flash_mode=dio +m5stack_core.build.boot=dio +m5stack_core.build.partitions=default +m5stack_core.build.defines= +m5stack_core.build.loop_core= +m5stack_core.build.event_core= + +m5stack_core.menu.PartitionScheme.default=Default 4MB with spiffs (1.2MB APP/1.5MB SPIFFS) +m5stack_core.menu.PartitionScheme.default.build.partitions=default +m5stack_core.menu.PartitionScheme.defaultffat=Default 4MB with ffat (1.2MB APP/1.5MB FATFS) +m5stack_core.menu.PartitionScheme.defaultffat.build.partitions=default_ffat +m5stack_core.menu.PartitionScheme.default_8MB=8M with spiffs (3MB APP/1.5MB SPIFFS) +m5stack_core.menu.PartitionScheme.default_8MB.build.partitions=default_8MB +m5stack_core.menu.PartitionScheme.default_8MB.upload.maximum_size=3342336 +m5stack_core.menu.PartitionScheme.minimal=Minimal (1.3MB APP/700KB SPIFFS) +m5stack_core.menu.PartitionScheme.minimal.build.partitions=minimal +m5stack_core.menu.PartitionScheme.no_ota=No OTA (2MB APP/2MB SPIFFS) +m5stack_core.menu.PartitionScheme.no_ota.build.partitions=no_ota +m5stack_core.menu.PartitionScheme.no_ota.upload.maximum_size=2097152 +m5stack_core.menu.PartitionScheme.noota_3g=No OTA (1MB APP/3MB SPIFFS) +m5stack_core.menu.PartitionScheme.noota_3g.build.partitions=noota_3g +m5stack_core.menu.PartitionScheme.noota_3g.upload.maximum_size=1048576 +m5stack_core.menu.PartitionScheme.noota_ffat=No OTA (2MB APP/2MB FATFS) +m5stack_core.menu.PartitionScheme.noota_ffat.build.partitions=noota_ffat +m5stack_core.menu.PartitionScheme.noota_ffat.upload.maximum_size=2097152 +m5stack_core.menu.PartitionScheme.noota_3gffat=No OTA (1MB APP/3MB FATFS) +m5stack_core.menu.PartitionScheme.noota_3gffat.build.partitions=noota_3gffat +m5stack_core.menu.PartitionScheme.noota_3gffat.upload.maximum_size=1048576 +m5stack_core.menu.PartitionScheme.huge_app=Huge APP (3MB No OTA/1MB SPIFFS) +m5stack_core.menu.PartitionScheme.huge_app.build.partitions=huge_app +m5stack_core.menu.PartitionScheme.huge_app.upload.maximum_size=3145728 +m5stack_core.menu.PartitionScheme.min_spiffs=Minimal SPIFFS (1.9MB APP with OTA/190KB SPIFFS) +m5stack_core.menu.PartitionScheme.min_spiffs.build.partitions=min_spiffs +m5stack_core.menu.PartitionScheme.min_spiffs.upload.maximum_size=1966080 +m5stack_core.menu.PartitionScheme.fatflash=16M Flash (2MB APP/12.5MB FATFS) +m5stack_core.menu.PartitionScheme.fatflash.build.partitions=ffat +m5stack_core.menu.PartitionScheme.fatflash.upload.maximum_size=2097152 +m5stack_core.menu.PartitionScheme.rainmaker=RainMaker +m5stack_core.menu.PartitionScheme.rainmaker.build.partitions=rainmaker +m5stack_core.menu.PartitionScheme.rainmaker.upload.maximum_size=3145728 +m5stack_core.menu.PartitionScheme.custom=Custom +m5stack_core.menu.PartitionScheme.custom.build.partitions= +m5stack_core.menu.PartitionScheme.custom.upload.maximum_size=16777216 + +m5stack_core.menu.CPUFreq.240=240MHz (WiFi/BT) +m5stack_core.menu.CPUFreq.240.build.f_cpu=240000000L +m5stack_core.menu.CPUFreq.160=160MHz (WiFi/BT) +m5stack_core.menu.CPUFreq.160.build.f_cpu=160000000L +m5stack_core.menu.CPUFreq.80=80MHz (WiFi/BT) +m5stack_core.menu.CPUFreq.80.build.f_cpu=80000000L +m5stack_core.menu.CPUFreq.40=40MHz (40MHz XTAL) +m5stack_core.menu.CPUFreq.40.build.f_cpu=40000000L +m5stack_core.menu.CPUFreq.26=26MHz (26MHz XTAL) +m5stack_core.menu.CPUFreq.26.build.f_cpu=26000000L +m5stack_core.menu.CPUFreq.20=20MHz (40MHz XTAL) +m5stack_core.menu.CPUFreq.20.build.f_cpu=20000000L +m5stack_core.menu.CPUFreq.13=13MHz (26MHz XTAL) +m5stack_core.menu.CPUFreq.13.build.f_cpu=13000000L +m5stack_core.menu.CPUFreq.10=10MHz (40MHz XTAL) +m5stack_core.menu.CPUFreq.10.build.f_cpu=10000000L + +m5stack_core.menu.FlashMode.qio=QIO +m5stack_core.menu.FlashMode.qio.build.flash_mode=dio +m5stack_core.menu.FlashMode.qio.build.boot=qio +m5stack_core.menu.FlashMode.dio=DIO +m5stack_core.menu.FlashMode.dio.build.flash_mode=dio +m5stack_core.menu.FlashMode.dio.build.boot=dio +m5stack_core.menu.FlashMode.qout=QOUT +m5stack_core.menu.FlashMode.qout.build.flash_mode=dout +m5stack_core.menu.FlashMode.qout.build.boot=qout +m5stack_core.menu.FlashMode.dout=DOUT +m5stack_core.menu.FlashMode.dout.build.flash_mode=dout +m5stack_core.menu.FlashMode.dout.build.boot=dout + +m5stack_core.menu.FlashFreq.80=80MHz +m5stack_core.menu.FlashFreq.80.build.flash_freq=80m +m5stack_core.menu.FlashFreq.40=40MHz +m5stack_core.menu.FlashFreq.40.build.flash_freq=40m + +m5stack_core.menu.FlashSize.4M=4MB (32Mb) +m5stack_core.menu.FlashSize.4M.build.flash_size=4MB +m5stack_core.menu.FlashSize.16M=16MB (128Mb) +m5stack_core.menu.FlashSize.16M.build.flash_size=16MB + +m5stack_core.menu.UploadSpeed.1500000=1500000 +m5stack_core.menu.UploadSpeed.1500000.upload.speed=1500000 +m5stack_core.menu.UploadSpeed.921600=921600 +m5stack_core.menu.UploadSpeed.921600.upload.speed=921600 +m5stack_core.menu.UploadSpeed.115200=115200 +m5stack_core.menu.UploadSpeed.115200.upload.speed=115200 +m5stack_core.menu.UploadSpeed.256000.windows=256000 +m5stack_core.menu.UploadSpeed.256000.upload.speed=256000 +m5stack_core.menu.UploadSpeed.230400.windows.upload.speed=256000 +m5stack_core.menu.UploadSpeed.230400=230400 +m5stack_core.menu.UploadSpeed.230400.upload.speed=230400 +m5stack_core.menu.UploadSpeed.460800.linux=460800 +m5stack_core.menu.UploadSpeed.460800.macosx=460800 +m5stack_core.menu.UploadSpeed.460800.upload.speed=460800 +m5stack_core.menu.UploadSpeed.512000.windows=512000 +m5stack_core.menu.UploadSpeed.512000.upload.speed=512000 + +m5stack_core.menu.LoopCore.1=Core 1 +m5stack_core.menu.LoopCore.1.build.loop_core=-DARDUINO_RUNNING_CORE=1 +m5stack_core.menu.LoopCore.0=Core 0 +m5stack_core.menu.LoopCore.0.build.loop_core=-DARDUINO_RUNNING_CORE=0 + +m5stack_core.menu.EventsCore.1=Core 1 +m5stack_core.menu.EventsCore.1.build.event_core=-DARDUINO_EVENT_RUNNING_CORE=1 +m5stack_core.menu.EventsCore.0=Core 0 +m5stack_core.menu.EventsCore.0.build.event_core=-DARDUINO_EVENT_RUNNING_CORE=0 + +m5stack_core.menu.DebugLevel.none=None +m5stack_core.menu.DebugLevel.none.build.code_debug=0 +m5stack_core.menu.DebugLevel.error=Error +m5stack_core.menu.DebugLevel.error.build.code_debug=1 +m5stack_core.menu.DebugLevel.warn=Warn +m5stack_core.menu.DebugLevel.warn.build.code_debug=2 +m5stack_core.menu.DebugLevel.info=Info +m5stack_core.menu.DebugLevel.info.build.code_debug=3 +m5stack_core.menu.DebugLevel.debug=Debug +m5stack_core.menu.DebugLevel.debug.build.code_debug=4 +m5stack_core.menu.DebugLevel.verbose=Verbose +m5stack_core.menu.DebugLevel.verbose.build.code_debug=5 + +m5stack_core.menu.EraseFlash.none=Disabled +m5stack_core.menu.EraseFlash.none.upload.erase_cmd= +m5stack_core.menu.EraseFlash.all=Enabled +m5stack_core.menu.EraseFlash.all.upload.erase_cmd=-e ############################################################## -m5stack-fire.name=M5Stack-FIRE - -m5stack-fire.bootloader.tool=esptool_py -m5stack-fire.bootloader.tool.default=esptool_py - -m5stack-fire.upload.tool=esptool_py -m5stack-fire.upload.tool.default=esptool_py -m5stack-fire.upload.tool.network=esp_ota - -m5stack-fire.upload.maximum_size=6553600 -m5stack-fire.upload.maximum_data_size=4521984 -m5stack-fire.upload.flags= -m5stack-fire.upload.extra_flags= - -m5stack-fire.serial.disableDTR=true -m5stack-fire.serial.disableRTS=true - -m5stack-fire.build.tarch=xtensa -m5stack-fire.build.bootloader_addr=0x1000 -m5stack-fire.build.target=esp32 -m5stack-fire.build.mcu=esp32 -m5stack-fire.build.core=esp32 -m5stack-fire.build.variant=m5stack_fire -m5stack-fire.build.board=M5STACK_FIRE - -m5stack-fire.build.f_cpu=240000000L -m5stack-fire.build.flash_size=16MB -m5stack-fire.build.flash_freq=80m -m5stack-fire.build.flash_mode=dio -m5stack-fire.build.boot=dio -m5stack-fire.build.partitions=default_16MB -m5stack-fire.build.defines= - -m5stack-fire.menu.PSRAM.enabled=Enabled -m5stack-fire.menu.PSRAM.enabled.build.defines=-DBOARD_HAS_PSRAM -mfix-esp32-psram-cache-issue -mfix-esp32-psram-cache-strategy=memw -m5stack-fire.menu.PSRAM.enabled.build.extra_libs= -m5stack-fire.menu.PSRAM.disabled=Disabled -m5stack-fire.menu.PSRAM.disabled.build.defines= -m5stack-fire.menu.PSRAM.disabled.build.extra_libs= - -m5stack-fire.menu.PartitionScheme.default=Default (2 x 6.5 MB app, 3.6 MB SPIFFS) -m5stack-fire.menu.PartitionScheme.default.build.partitions=default_16MB -m5stack-fire.menu.PartitionScheme.default.upload.maximum_size=6553600 -m5stack-fire.menu.PartitionScheme.large_spiffs=Large SPIFFS (7 MB) -m5stack-fire.menu.PartitionScheme.large_spiffs.build.partitions=large_spiffs_16MB -m5stack-fire.menu.PartitionScheme.large_spiffs.upload.maximum_size=4685824 - -m5stack-fire.menu.UploadSpeed.921600=921600 -m5stack-fire.menu.UploadSpeed.921600.upload.speed=921600 -m5stack-fire.menu.UploadSpeed.115200=115200 -m5stack-fire.menu.UploadSpeed.115200.upload.speed=115200 -m5stack-fire.menu.UploadSpeed.256000.windows=256000 -m5stack-fire.menu.UploadSpeed.256000.upload.speed=256000 -m5stack-fire.menu.UploadSpeed.230400.windows.upload.speed=256000 -m5stack-fire.menu.UploadSpeed.230400=230400 -m5stack-fire.menu.UploadSpeed.230400.upload.speed=230400 -m5stack-fire.menu.UploadSpeed.460800.linux=460800 -m5stack-fire.menu.UploadSpeed.460800.macosx=460800 -m5stack-fire.menu.UploadSpeed.460800.upload.speed=460800 -m5stack-fire.menu.UploadSpeed.512000.windows=512000 -m5stack-fire.menu.UploadSpeed.512000.upload.speed=512000 - -m5stack-fire.menu.DebugLevel.none=None -m5stack-fire.menu.DebugLevel.none.build.code_debug=0 -m5stack-fire.menu.DebugLevel.error=Error -m5stack-fire.menu.DebugLevel.error.build.code_debug=1 -m5stack-fire.menu.DebugLevel.warn=Warn -m5stack-fire.menu.DebugLevel.warn.build.code_debug=2 -m5stack-fire.menu.DebugLevel.info=Info -m5stack-fire.menu.DebugLevel.info.build.code_debug=3 -m5stack-fire.menu.DebugLevel.debug=Debug -m5stack-fire.menu.DebugLevel.debug.build.code_debug=4 -m5stack-fire.menu.DebugLevel.verbose=Verbose -m5stack-fire.menu.DebugLevel.verbose.build.code_debug=5 - -m5stack-fire.menu.EraseFlash.none=Disabled -m5stack-fire.menu.EraseFlash.none.upload.erase_cmd= -m5stack-fire.menu.EraseFlash.all=Enabled -m5stack-fire.menu.EraseFlash.all.upload.erase_cmd=-e +m5stack_fire.name=M5Fire + +m5stack_fire.bootloader.tool=esptool_py +m5stack_fire.bootloader.tool.default=esptool_py + +m5stack_fire.upload.tool=esptool_py +m5stack_fire.upload.tool.default=esptool_py +m5stack_fire.upload.tool.network=esp_ota + +m5stack_fire.upload.maximum_size=6553600 +m5stack_fire.upload.maximum_data_size=4521984 +m5stack_fire.upload.flags= +m5stack_fire.upload.extra_flags= + +m5stack_fire.serial.disableDTR=true +m5stack_fire.serial.disableRTS=true + +m5stack_fire.build.tarch=xtensa +m5stack_fire.build.bootloader_addr=0x1000 +m5stack_fire.build.target=esp32 +m5stack_fire.build.mcu=esp32 +m5stack_fire.build.core=esp32 +m5stack_fire.build.variant=m5stack_fire +m5stack_fire.build.board=M5STACK_FIRE + +m5stack_fire.build.f_cpu=240000000L +m5stack_fire.build.flash_size=16MB +m5stack_fire.build.flash_freq=80m +m5stack_fire.build.flash_mode=dio +m5stack_fire.build.boot=dio +m5stack_fire.build.partitions=default +m5stack_fire.build.defines= +m5stack_fire.build.loop_core= +m5stack_fire.build.event_core= + +m5stack_fire.menu.PSRAM.enabled=Enabled +m5stack_fire.menu.PSRAM.enabled.build.defines=-DBOARD_HAS_PSRAM -mfix-esp32-psram-cache-issue -mfix-esp32-psram-cache-strategy=memw +m5stack_fire.menu.PSRAM.enabled.build.extra_libs= +m5stack_fire.menu.PSRAM.disabled=Disabled +m5stack_fire.menu.PSRAM.disabled.build.defines= +m5stack_fire.menu.PSRAM.disabled.build.extra_libs= + +m5stack_fire.menu.PartitionScheme.default=Default (2 x 6.5 MB app, 3.6 MB SPIFFS) +m5stack_fire.menu.PartitionScheme.default.build.partitions=default_16MB +m5stack_fire.menu.PartitionScheme.default.upload.maximum_size=6553600 +m5stack_fire.menu.PartitionScheme.defaultffat=Default 4MB with ffat (1.2MB APP/1.5MB FATFS) +m5stack_fire.menu.PartitionScheme.defaultffat.build.partitions=default_ffat +m5stack_fire.menu.PartitionScheme.default_8MB=8M with spiffs (3MB APP/1.5MB SPIFFS) +m5stack_fire.menu.PartitionScheme.default_8MB.build.partitions=default_8MB +m5stack_fire.menu.PartitionScheme.default_8MB.upload.maximum_size=3342336 +m5stack_fire.menu.PartitionScheme.minimal=Minimal (1.3MB APP/700KB SPIFFS) +m5stack_fire.menu.PartitionScheme.minimal.build.partitions=minimal +m5stack_fire.menu.PartitionScheme.no_ota=No OTA (2MB APP/2MB SPIFFS) +m5stack_fire.menu.PartitionScheme.no_ota.build.partitions=no_ota +m5stack_fire.menu.PartitionScheme.no_ota.upload.maximum_size=2097152 +m5stack_fire.menu.PartitionScheme.noota_3g=No OTA (1MB APP/3MB SPIFFS) +m5stack_fire.menu.PartitionScheme.noota_3g.build.partitions=noota_3g +m5stack_fire.menu.PartitionScheme.noota_3g.upload.maximum_size=1048576 +m5stack_fire.menu.PartitionScheme.noota_ffat=No OTA (2MB APP/2MB FATFS) +m5stack_fire.menu.PartitionScheme.noota_ffat.build.partitions=noota_ffat +m5stack_fire.menu.PartitionScheme.noota_ffat.upload.maximum_size=2097152 +m5stack_fire.menu.PartitionScheme.noota_3gffat=No OTA (1MB APP/3MB FATFS) +m5stack_fire.menu.PartitionScheme.noota_3gffat.build.partitions=noota_3gffat +m5stack_fire.menu.PartitionScheme.noota_3gffat.upload.maximum_size=1048576 +m5stack_fire.menu.PartitionScheme.huge_app=Huge APP (3MB No OTA/1MB SPIFFS) +m5stack_fire.menu.PartitionScheme.huge_app.build.partitions=huge_app +m5stack_fire.menu.PartitionScheme.huge_app.upload.maximum_size=3145728 +m5stack_fire.menu.PartitionScheme.min_spiffs=Minimal SPIFFS (1.9MB APP with OTA/190KB SPIFFS) +m5stack_fire.menu.PartitionScheme.min_spiffs.build.partitions=min_spiffs +m5stack_fire.menu.PartitionScheme.min_spiffs.upload.maximum_size=1966080 +m5stack_fire.menu.PartitionScheme.fatflash=16M Flash (2MB APP/12.5MB FATFS) +m5stack_fire.menu.PartitionScheme.fatflash.build.partitions=ffat +m5stack_fire.menu.PartitionScheme.fatflash.upload.maximum_size=2097152 +m5stack_fire.menu.PartitionScheme.app3M_fat9M_16MB=16M Flash (3MB APP/9.9MB FATFS) +m5stack_fire.menu.PartitionScheme.app3M_fat9M_16MB.build.partitions=app3M_fat9M_16MB +m5stack_fire.menu.PartitionScheme.app3M_fat9M_16MB.upload.maximum_size=3145728 +m5stack_fire.menu.PartitionScheme.rainmaker=RainMaker +m5stack_fire.menu.PartitionScheme.rainmaker.build.partitions=rainmaker +m5stack_fire.menu.PartitionScheme.rainmaker.upload.maximum_size=3145728 +m5stack_fire.menu.PartitionScheme.custom=Custom +m5stack_fire.menu.PartitionScheme.custom.build.partitions= +m5stack_fire.menu.PartitionScheme.custom.upload.maximum_size=16777216 + +m5stack_fire.menu.CPUFreq.240=240MHz (WiFi/BT) +m5stack_fire.menu.CPUFreq.240.build.f_cpu=240000000L +m5stack_fire.menu.CPUFreq.160=160MHz (WiFi/BT) +m5stack_fire.menu.CPUFreq.160.build.f_cpu=160000000L +m5stack_fire.menu.CPUFreq.80=80MHz (WiFi/BT) +m5stack_fire.menu.CPUFreq.80.build.f_cpu=80000000L +m5stack_fire.menu.CPUFreq.40=40MHz (40MHz XTAL) +m5stack_fire.menu.CPUFreq.40.build.f_cpu=40000000L +m5stack_fire.menu.CPUFreq.26=26MHz (26MHz XTAL) +m5stack_fire.menu.CPUFreq.26.build.f_cpu=26000000L +m5stack_fire.menu.CPUFreq.20=20MHz (40MHz XTAL) +m5stack_fire.menu.CPUFreq.20.build.f_cpu=20000000L +m5stack_fire.menu.CPUFreq.13=13MHz (26MHz XTAL) +m5stack_fire.menu.CPUFreq.13.build.f_cpu=13000000L +m5stack_fire.menu.CPUFreq.10=10MHz (40MHz XTAL) +m5stack_fire.menu.CPUFreq.10.build.f_cpu=10000000L + +m5stack_fire.menu.FlashMode.qio=QIO +m5stack_fire.menu.FlashMode.qio.build.flash_mode=dio +m5stack_fire.menu.FlashMode.qio.build.boot=qio +m5stack_fire.menu.FlashMode.dio=DIO +m5stack_fire.menu.FlashMode.dio.build.flash_mode=dio +m5stack_fire.menu.FlashMode.dio.build.boot=dio +m5stack_fire.menu.FlashMode.qout=QOUT +m5stack_fire.menu.FlashMode.qout.build.flash_mode=dout +m5stack_fire.menu.FlashMode.qout.build.boot=qout +m5stack_fire.menu.FlashMode.dout=DOUT +m5stack_fire.menu.FlashMode.dout.build.flash_mode=dout +m5stack_fire.menu.FlashMode.dout.build.boot=dout + +m5stack_fire.menu.FlashFreq.80=80MHz +m5stack_fire.menu.FlashFreq.80.build.flash_freq=80m +m5stack_fire.menu.FlashFreq.40=40MHz +m5stack_fire.menu.FlashFreq.40.build.flash_freq=40m + +m5stack_fire.menu.FlashSize.16M=16MB (128Mb) +m5stack_fire.menu.FlashSize.16M.build.flash_size=16MB + +m5stack_fire.menu.UploadSpeed.1500000=1500000 +m5stack_fire.menu.UploadSpeed.1500000.upload.speed=1500000 +m5stack_fire.menu.UploadSpeed.921600=921600 +m5stack_fire.menu.UploadSpeed.921600.upload.speed=921600 +m5stack_fire.menu.UploadSpeed.115200=115200 +m5stack_fire.menu.UploadSpeed.115200.upload.speed=115200 +m5stack_fire.menu.UploadSpeed.256000.windows=256000 +m5stack_fire.menu.UploadSpeed.256000.upload.speed=256000 +m5stack_fire.menu.UploadSpeed.230400.windows.upload.speed=256000 +m5stack_fire.menu.UploadSpeed.230400=230400 +m5stack_fire.menu.UploadSpeed.230400.upload.speed=230400 +m5stack_fire.menu.UploadSpeed.460800.linux=460800 +m5stack_fire.menu.UploadSpeed.460800.macosx=460800 +m5stack_fire.menu.UploadSpeed.460800.upload.speed=460800 +m5stack_fire.menu.UploadSpeed.512000.windows=512000 +m5stack_fire.menu.UploadSpeed.512000.upload.speed=512000 + +m5stack_fire.menu.LoopCore.1=Core 1 +m5stack_fire.menu.LoopCore.1.build.loop_core=-DARDUINO_RUNNING_CORE=1 +m5stack_fire.menu.LoopCore.0=Core 0 +m5stack_fire.menu.LoopCore.0.build.loop_core=-DARDUINO_RUNNING_CORE=0 + +m5stack_fire.menu.EventsCore.1=Core 1 +m5stack_fire.menu.EventsCore.1.build.event_core=-DARDUINO_EVENT_RUNNING_CORE=1 +m5stack_fire.menu.EventsCore.0=Core 0 +m5stack_fire.menu.EventsCore.0.build.event_core=-DARDUINO_EVENT_RUNNING_CORE=0 + +m5stack_fire.menu.DebugLevel.none=None +m5stack_fire.menu.DebugLevel.none.build.code_debug=0 +m5stack_fire.menu.DebugLevel.error=Error +m5stack_fire.menu.DebugLevel.error.build.code_debug=1 +m5stack_fire.menu.DebugLevel.warn=Warn +m5stack_fire.menu.DebugLevel.warn.build.code_debug=2 +m5stack_fire.menu.DebugLevel.info=Info +m5stack_fire.menu.DebugLevel.info.build.code_debug=3 +m5stack_fire.menu.DebugLevel.debug=Debug +m5stack_fire.menu.DebugLevel.debug.build.code_debug=4 +m5stack_fire.menu.DebugLevel.verbose=Verbose +m5stack_fire.menu.DebugLevel.verbose.build.code_debug=5 + +m5stack_fire.menu.EraseFlash.none=Disabled +m5stack_fire.menu.EraseFlash.none.upload.erase_cmd= +m5stack_fire.menu.EraseFlash.all=Enabled +m5stack_fire.menu.EraseFlash.all.upload.erase_cmd=-e ############################################################## -m5stack-station.name=M5Stack-Station - -m5stack-station.bootloader.tool=esptool_py -m5stack-station.bootloader.tool.default=esptool_py - -m5stack-station.upload.tool=esptool_py -m5stack-station.upload.tool.default=esptool_py -m5stack-station.upload.tool.network=esp_ota - -m5stack-station.upload.maximum_size=6553600 -m5stack-station.upload.maximum_data_size=4521984 -m5stack-station.upload.flags= -m5stack-station.upload.extra_flags= - -m5stack-station.serial.disableDTR=true -m5stack-station.serial.disableRTS=true - -m5stack-station.build.tarch=xtensa -m5stack-station.build.bootloader_addr=0x1000 -m5stack-station.build.target=esp32 -m5stack-station.build.mcu=esp32 -m5stack-station.build.core=esp32 -m5stack-station.build.variant=m5stack_station -m5stack-station.build.board=M5Stack_Station - -m5stack-station.build.f_cpu=240000000L -m5stack-station.build.flash_size=16MB -m5stack-station.build.flash_freq=80m -m5stack-station.build.flash_mode=dio -m5stack-station.build.boot=dio -m5stack-station.build.partitions=default_16MB -m5stack-station.build.defines= - -m5stack-station.menu.PartitionScheme.default=Default -m5stack-station.menu.PartitionScheme.default.build.partitions=default_16MB -m5stack-station.menu.PartitionScheme.no_ota=No OTA (Large APP) -m5stack-station.menu.PartitionScheme.no_ota.build.partitions=no_ota -m5stack-station.menu.PartitionScheme.no_ota.upload.maximum_size=6553600 -m5stack-station.menu.PartitionScheme.min_spiffs=Minimal SPIFFS (Large APPS with OTA) -m5stack-station.menu.PartitionScheme.min_spiffs.build.partitions=min_spiffs -m5stack-station.menu.PartitionScheme.min_spiffs.upload.maximum_size=1966080 - -m5stack-station.menu.CPUFreq.240=240MHz (WiFi/BT) -m5stack-station.menu.CPUFreq.240.build.f_cpu=240000000L -m5stack-station.menu.CPUFreq.160=160MHz (WiFi/BT) -m5stack-station.menu.CPUFreq.160.build.f_cpu=160000000L -m5stack-station.menu.CPUFreq.80=80MHz (WiFi/BT) -m5stack-station.menu.CPUFreq.80.build.f_cpu=80000000L -m5stack-station.menu.CPUFreq.40=40MHz (40MHz XTAL) -m5stack-station.menu.CPUFreq.40.build.f_cpu=40000000L -m5stack-station.menu.CPUFreq.26=26MHz (26MHz XTAL) -m5stack-station.menu.CPUFreq.26.build.f_cpu=26000000L -m5stack-station.menu.CPUFreq.20=20MHz (40MHz XTAL) -m5stack-station.menu.CPUFreq.20.build.f_cpu=20000000L -m5stack-station.menu.CPUFreq.13=13MHz (26MHz XTAL) -m5stack-station.menu.CPUFreq.13.build.f_cpu=13000000L -m5stack-station.menu.CPUFreq.10=10MHz (40MHz XTAL) -m5stack-station.menu.CPUFreq.10.build.f_cpu=10000000L - -m5stack-station.menu.UploadSpeed.1500000=1500000 -m5stack-station.menu.UploadSpeed.1500000.upload.speed=1500000 -m5stack-station.menu.UploadSpeed.750000=750000 -m5stack-station.menu.UploadSpeed.750000.upload.speed=750000 -m5stack-station.menu.UploadSpeed.500000=500000 -m5stack-station.menu.UploadSpeed.500000.upload.speed=500000 -m5stack-station.menu.UploadSpeed.250000=250000 -m5stack-station.menu.UploadSpeed.250000.upload.speed=250000 -m5stack-station.menu.UploadSpeed.115200=115200 -m5stack-station.menu.UploadSpeed.115200.upload.speed=115200 - -m5stack-station.menu.DebugLevel.none=None -m5stack-station.menu.DebugLevel.none.build.code_debug=0 -m5stack-station.menu.DebugLevel.error=Error -m5stack-station.menu.DebugLevel.error.build.code_debug=1 -m5stack-station.menu.DebugLevel.warn=Warn -m5stack-station.menu.DebugLevel.warn.build.code_debug=2 -m5stack-station.menu.DebugLevel.info=Info -m5stack-station.menu.DebugLevel.info.build.code_debug=3 -m5stack-station.menu.DebugLevel.debug=Debug -m5stack-station.menu.DebugLevel.debug.build.code_debug=4 -m5stack-station.menu.DebugLevel.verbose=Verbose -m5stack-station.menu.DebugLevel.verbose.build.code_debug=5 - -m5stack-station.menu.EraseFlash.none=Disabled -m5stack-station.menu.EraseFlash.none.upload.erase_cmd= -m5stack-station.menu.EraseFlash.all=Enabled -m5stack-station.menu.EraseFlash.all.upload.erase_cmd=-e +m5stack_core2.name=M5Core2 + +m5stack_core2.bootloader.tool=esptool_py +m5stack_core2.bootloader.tool.default=esptool_py + +m5stack_core2.upload.tool=esptool_py +m5stack_core2.upload.tool.default=esptool_py +m5stack_core2.upload.tool.network=esp_ota + +m5stack_core2.upload.maximum_size=6553600 +m5stack_core2.upload.maximum_data_size=4521984 +m5stack_core2.upload.flags= +m5stack_core2.upload.extra_flags= + +m5stack_core2.serial.disableDTR=true +m5stack_core2.serial.disableRTS=true + +m5stack_core2.build.tarch=xtensa +m5stack_core2.build.bootloader_addr=0x1000 +m5stack_core2.build.target=esp32 +m5stack_core2.build.mcu=esp32 +m5stack_core2.build.core=esp32 +m5stack_core2.build.variant=m5stack_core2 +m5stack_core2.build.board=M5STACK_CORE2 + +m5stack_core2.build.f_cpu=240000000L +m5stack_core2.build.flash_size=16MB +m5stack_core2.build.flash_freq=80m +m5stack_core2.build.flash_mode=dio +m5stack_core2.build.boot=dio +m5stack_core2.build.partitions=default +m5stack_core2.build.defines= +m5stack_core2.build.loop_core= +m5stack_core2.build.event_core= + +m5stack_core2.menu.PSRAM.enabled=Enabled +m5stack_core2.menu.PSRAM.enabled.build.defines=-DBOARD_HAS_PSRAM -mfix-esp32-psram-cache-issue -mfix-esp32-psram-cache-strategy=memw +m5stack_core2.menu.PSRAM.enabled.build.extra_libs= +m5stack_core2.menu.PSRAM.disabled=Disabled +m5stack_core2.menu.PSRAM.disabled.build.defines= +m5stack_core2.menu.PSRAM.disabled.build.extra_libs= + +m5stack_core2.menu.PartitionScheme.default=Default (2 x 6.5 MB app, 3.6 MB SPIFFS) +m5stack_core2.menu.PartitionScheme.default.build.partitions=default_16MB +m5stack_core2.menu.PartitionScheme.default.upload.maximum_size=6553600 +m5stack_core2.menu.PartitionScheme.defaultffat=Default 4MB with ffat (1.2MB APP/1.5MB FATFS) +m5stack_core2.menu.PartitionScheme.defaultffat.build.partitions=default_ffat +m5stack_core2.menu.PartitionScheme.default_8MB=8M with spiffs (3MB APP/1.5MB SPIFFS) +m5stack_core2.menu.PartitionScheme.default_8MB.build.partitions=default_8MB +m5stack_core2.menu.PartitionScheme.default_8MB.upload.maximum_size=3342336 +m5stack_core2.menu.PartitionScheme.minimal=Minimal (1.3MB APP/700KB SPIFFS) +m5stack_core2.menu.PartitionScheme.minimal.build.partitions=minimal +m5stack_core2.menu.PartitionScheme.no_ota=No OTA (2MB APP/2MB SPIFFS) +m5stack_core2.menu.PartitionScheme.no_ota.build.partitions=no_ota +m5stack_core2.menu.PartitionScheme.no_ota.upload.maximum_size=2097152 +m5stack_core2.menu.PartitionScheme.noota_3g=No OTA (1MB APP/3MB SPIFFS) +m5stack_core2.menu.PartitionScheme.noota_3g.build.partitions=noota_3g +m5stack_core2.menu.PartitionScheme.noota_3g.upload.maximum_size=1048576 +m5stack_core2.menu.PartitionScheme.noota_ffat=No OTA (2MB APP/2MB FATFS) +m5stack_core2.menu.PartitionScheme.noota_ffat.build.partitions=noota_ffat +m5stack_core2.menu.PartitionScheme.noota_ffat.upload.maximum_size=2097152 +m5stack_core2.menu.PartitionScheme.noota_3gffat=No OTA (1MB APP/3MB FATFS) +m5stack_core2.menu.PartitionScheme.noota_3gffat.build.partitions=noota_3gffat +m5stack_core2.menu.PartitionScheme.noota_3gffat.upload.maximum_size=1048576 +m5stack_core2.menu.PartitionScheme.huge_app=Huge APP (3MB No OTA/1MB SPIFFS) +m5stack_core2.menu.PartitionScheme.huge_app.build.partitions=huge_app +m5stack_core2.menu.PartitionScheme.huge_app.upload.maximum_size=3145728 +m5stack_core2.menu.PartitionScheme.min_spiffs=Minimal SPIFFS (1.9MB APP with OTA/190KB SPIFFS) +m5stack_core2.menu.PartitionScheme.min_spiffs.build.partitions=min_spiffs +m5stack_core2.menu.PartitionScheme.min_spiffs.upload.maximum_size=1966080 +m5stack_core2.menu.PartitionScheme.fatflash=16M Flash (2MB APP/12.5MB FATFS) +m5stack_core2.menu.PartitionScheme.fatflash.build.partitions=ffat +m5stack_core2.menu.PartitionScheme.fatflash.upload.maximum_size=2097152 +m5stack_core2.menu.PartitionScheme.app3M_fat9M_16MB=16M Flash (3MB APP/9.9MB FATFS) +m5stack_core2.menu.PartitionScheme.app3M_fat9M_16MB.build.partitions=app3M_fat9M_16MB +m5stack_core2.menu.PartitionScheme.app3M_fat9M_16MB.upload.maximum_size=3145728 +m5stack_core2.menu.PartitionScheme.rainmaker=RainMaker +m5stack_core2.menu.PartitionScheme.rainmaker.build.partitions=rainmaker +m5stack_core2.menu.PartitionScheme.rainmaker.upload.maximum_size=3145728 +m5stack_core2.menu.PartitionScheme.custom=Custom +m5stack_core2.menu.PartitionScheme.custom.build.partitions= +m5stack_core2.menu.PartitionScheme.custom.upload.maximum_size=16777216 + +m5stack_core2.menu.CPUFreq.240=240MHz (WiFi/BT) +m5stack_core2.menu.CPUFreq.240.build.f_cpu=240000000L +m5stack_core2.menu.CPUFreq.160=160MHz (WiFi/BT) +m5stack_core2.menu.CPUFreq.160.build.f_cpu=160000000L +m5stack_core2.menu.CPUFreq.80=80MHz (WiFi/BT) +m5stack_core2.menu.CPUFreq.80.build.f_cpu=80000000L +m5stack_core2.menu.CPUFreq.40=40MHz (40MHz XTAL) +m5stack_core2.menu.CPUFreq.40.build.f_cpu=40000000L +m5stack_core2.menu.CPUFreq.26=26MHz (26MHz XTAL) +m5stack_core2.menu.CPUFreq.26.build.f_cpu=26000000L +m5stack_core2.menu.CPUFreq.20=20MHz (40MHz XTAL) +m5stack_core2.menu.CPUFreq.20.build.f_cpu=20000000L +m5stack_core2.menu.CPUFreq.13=13MHz (26MHz XTAL) +m5stack_core2.menu.CPUFreq.13.build.f_cpu=13000000L +m5stack_core2.menu.CPUFreq.10=10MHz (40MHz XTAL) +m5stack_core2.menu.CPUFreq.10.build.f_cpu=10000000L + +m5stack_core2.menu.FlashMode.qio=QIO +m5stack_core2.menu.FlashMode.qio.build.flash_mode=dio +m5stack_core2.menu.FlashMode.qio.build.boot=qio +m5stack_core2.menu.FlashMode.dio=DIO +m5stack_core2.menu.FlashMode.dio.build.flash_mode=dio +m5stack_core2.menu.FlashMode.dio.build.boot=dio +m5stack_core2.menu.FlashMode.qout=QOUT +m5stack_core2.menu.FlashMode.qout.build.flash_mode=dout +m5stack_core2.menu.FlashMode.qout.build.boot=qout +m5stack_core2.menu.FlashMode.dout=DOUT +m5stack_core2.menu.FlashMode.dout.build.flash_mode=dout +m5stack_core2.menu.FlashMode.dout.build.boot=dout + +m5stack_core2.menu.FlashFreq.80=80MHz +m5stack_core2.menu.FlashFreq.80.build.flash_freq=80m +m5stack_core2.menu.FlashFreq.40=40MHz +m5stack_core2.menu.FlashFreq.40.build.flash_freq=40m + +m5stack_core2.menu.FlashSize.16M=16MB (128Mb) +m5stack_core2.menu.FlashSize.16M.build.flash_size=16MB + +m5stack_core2.menu.UploadSpeed.1500000=1500000 +m5stack_core2.menu.UploadSpeed.1500000.upload.speed=1500000 +m5stack_core2.menu.UploadSpeed.921600=921600 +m5stack_core2.menu.UploadSpeed.921600.upload.speed=921600 +m5stack_core2.menu.UploadSpeed.115200=115200 +m5stack_core2.menu.UploadSpeed.115200.upload.speed=115200 +m5stack_core2.menu.UploadSpeed.256000.windows=256000 +m5stack_core2.menu.UploadSpeed.256000.upload.speed=256000 +m5stack_core2.menu.UploadSpeed.230400.windows.upload.speed=256000 +m5stack_core2.menu.UploadSpeed.230400=230400 +m5stack_core2.menu.UploadSpeed.230400.upload.speed=230400 +m5stack_core2.menu.UploadSpeed.460800.linux=460800 +m5stack_core2.menu.UploadSpeed.460800.macosx=460800 +m5stack_core2.menu.UploadSpeed.460800.upload.speed=460800 +m5stack_core2.menu.UploadSpeed.512000.windows=512000 +m5stack_core2.menu.UploadSpeed.512000.upload.speed=512000 + +m5stack_core2.menu.LoopCore.1=Core 1 +m5stack_core2.menu.LoopCore.1.build.loop_core=-DARDUINO_RUNNING_CORE=1 +m5stack_core2.menu.LoopCore.0=Core 0 +m5stack_core2.menu.LoopCore.0.build.loop_core=-DARDUINO_RUNNING_CORE=0 + +m5stack_core2.menu.EventsCore.1=Core 1 +m5stack_core2.menu.EventsCore.1.build.event_core=-DARDUINO_EVENT_RUNNING_CORE=1 +m5stack_core2.menu.EventsCore.0=Core 0 +m5stack_core2.menu.EventsCore.0.build.event_core=-DARDUINO_EVENT_RUNNING_CORE=0 + +m5stack_core2.menu.DebugLevel.none=None +m5stack_core2.menu.DebugLevel.none.build.code_debug=0 +m5stack_core2.menu.DebugLevel.error=Error +m5stack_core2.menu.DebugLevel.error.build.code_debug=1 +m5stack_core2.menu.DebugLevel.warn=Warn +m5stack_core2.menu.DebugLevel.warn.build.code_debug=2 +m5stack_core2.menu.DebugLevel.info=Info +m5stack_core2.menu.DebugLevel.info.build.code_debug=3 +m5stack_core2.menu.DebugLevel.debug=Debug +m5stack_core2.menu.DebugLevel.debug.build.code_debug=4 +m5stack_core2.menu.DebugLevel.verbose=Verbose +m5stack_core2.menu.DebugLevel.verbose.build.code_debug=5 + +m5stack_core2.menu.EraseFlash.none=Disabled +m5stack_core2.menu.EraseFlash.none.upload.erase_cmd= +m5stack_core2.menu.EraseFlash.all=Enabled +m5stack_core2.menu.EraseFlash.all.upload.erase_cmd=-e ############################################################## -m5stick-c.name=M5Stick-C - -m5stick-c.bootloader.tool=esptool_py -m5stick-c.bootloader.tool.default=esptool_py - -m5stick-c.upload.tool=esptool_py -m5stick-c.upload.tool.default=esptool_py -m5stick-c.upload.tool.network=esp_ota - -m5stick-c.upload.maximum_size=1310720 -m5stick-c.upload.maximum_data_size=327680 -m5stick-c.upload.flags= -m5stick-c.upload.extra_flags= - -m5stick-c.serial.disableDTR=true -m5stick-c.serial.disableRTS=true - -m5stick-c.build.tarch=xtensa -m5stick-c.build.bootloader_addr=0x1000 -m5stick-c.build.target=esp32 -m5stick-c.build.mcu=esp32 -m5stick-c.build.core=esp32 -m5stick-c.build.variant=m5stick_c -m5stick-c.build.board=M5Stick_C - -m5stick-c.build.f_cpu=240000000L -m5stick-c.build.flash_size=4MB -m5stick-c.build.flash_freq=80m -m5stick-c.build.flash_mode=dio -m5stick-c.build.boot=dio -m5stick-c.build.partitions=default -m5stick-c.build.defines= - -m5stick-c.menu.PartitionScheme.default=Default -m5stick-c.menu.PartitionScheme.default.build.partitions=default -m5stick-c.menu.PartitionScheme.no_ota=No OTA (Large APP) -m5stick-c.menu.PartitionScheme.no_ota.build.partitions=no_ota -m5stick-c.menu.PartitionScheme.no_ota.upload.maximum_size=2097152 -m5stick-c.menu.PartitionScheme.min_spiffs=Minimal SPIFFS (Large APPS with OTA) -m5stick-c.menu.PartitionScheme.min_spiffs.build.partitions=min_spiffs -m5stick-c.menu.PartitionScheme.min_spiffs.upload.maximum_size=1966080 - -m5stick-c.menu.UploadSpeed.1500000=1500000 -m5stick-c.menu.UploadSpeed.1500000.upload.speed=1500000 -m5stick-c.menu.UploadSpeed.750000=750000 -m5stick-c.menu.UploadSpeed.750000.upload.speed=750000 -m5stick-c.menu.UploadSpeed.500000=500000 -m5stick-c.menu.UploadSpeed.500000.upload.speed=500000 -m5stick-c.menu.UploadSpeed.250000=250000 -m5stick-c.menu.UploadSpeed.250000.upload.speed=250000 -m5stick-c.menu.UploadSpeed.115200=115200 -m5stick-c.menu.UploadSpeed.115200.upload.speed=115200 - -m5stick-c.menu.DebugLevel.none=None -m5stick-c.menu.DebugLevel.none.build.code_debug=0 -m5stick-c.menu.DebugLevel.error=Error -m5stick-c.menu.DebugLevel.error.build.code_debug=1 -m5stick-c.menu.DebugLevel.warn=Warn -m5stick-c.menu.DebugLevel.warn.build.code_debug=2 -m5stick-c.menu.DebugLevel.info=Info -m5stick-c.menu.DebugLevel.info.build.code_debug=3 -m5stick-c.menu.DebugLevel.debug=Debug -m5stick-c.menu.DebugLevel.debug.build.code_debug=4 -m5stick-c.menu.DebugLevel.verbose=Verbose -m5stick-c.menu.DebugLevel.verbose.build.code_debug=5 - -m5stick-c.menu.EraseFlash.none=Disabled -m5stick-c.menu.EraseFlash.none.upload.erase_cmd= -m5stick-c.menu.EraseFlash.all=Enabled -m5stick-c.menu.EraseFlash.all.upload.erase_cmd=-e +m5stack_tough.name=M5Tough + +m5stack_tough.bootloader.tool=esptool_py +m5stack_tough.bootloader.tool.default=esptool_py + +m5stack_tough.upload.tool=esptool_py +m5stack_tough.upload.tool.default=esptool_py +m5stack_tough.upload.tool.network=esp_ota + +m5stack_tough.upload.maximum_size=6553600 +m5stack_tough.upload.maximum_data_size=4521984 +m5stack_tough.upload.flags= +m5stack_tough.upload.extra_flags= + +m5stack_tough.serial.disableDTR=true +m5stack_tough.serial.disableRTS=true + +m5stack_tough.build.tarch=xtensa +m5stack_tough.build.bootloader_addr=0x1000 +m5stack_tough.build.target=esp32 +m5stack_tough.build.mcu=esp32 +m5stack_tough.build.core=esp32 +m5stack_tough.build.variant=m5stack_tough +m5stack_tough.build.board=M5STACK_TOUGH + +m5stack_tough.build.f_cpu=240000000L +m5stack_tough.build.flash_size=16MB +m5stack_tough.build.flash_freq=80m +m5stack_tough.build.flash_mode=dio +m5stack_tough.build.boot=dio +m5stack_tough.build.partitions=default +m5stack_tough.build.defines= +m5stack_tough.build.loop_core= +m5stack_tough.build.event_core= + +m5stack_tough.menu.PSRAM.enabled=Enabled +m5stack_tough.menu.PSRAM.enabled.build.defines=-DBOARD_HAS_PSRAM -mfix-esp32-psram-cache-issue -mfix-esp32-psram-cache-strategy=memw +m5stack_tough.menu.PSRAM.enabled.build.extra_libs= +m5stack_tough.menu.PSRAM.disabled=Disabled +m5stack_tough.menu.PSRAM.disabled.build.defines= +m5stack_tough.menu.PSRAM.disabled.build.extra_libs= + +m5stack_tough.menu.PartitionScheme.default=Default (2 x 6.5 MB app, 3.6 MB SPIFFS) +m5stack_tough.menu.PartitionScheme.default.build.partitions=default_16MB +m5stack_tough.menu.PartitionScheme.default.upload.maximum_size=6553600 +m5stack_tough.menu.PartitionScheme.defaultffat=Default 4MB with ffat (1.2MB APP/1.5MB FATFS) +m5stack_tough.menu.PartitionScheme.defaultffat.build.partitions=default_ffat +m5stack_tough.menu.PartitionScheme.default_8MB=8M with spiffs (3MB APP/1.5MB SPIFFS) +m5stack_tough.menu.PartitionScheme.default_8MB.build.partitions=default_8MB +m5stack_tough.menu.PartitionScheme.default_8MB.upload.maximum_size=3342336 +m5stack_tough.menu.PartitionScheme.minimal=Minimal (1.3MB APP/700KB SPIFFS) +m5stack_tough.menu.PartitionScheme.minimal.build.partitions=minimal +m5stack_tough.menu.PartitionScheme.no_ota=No OTA (2MB APP/2MB SPIFFS) +m5stack_tough.menu.PartitionScheme.no_ota.build.partitions=no_ota +m5stack_tough.menu.PartitionScheme.no_ota.upload.maximum_size=2097152 +m5stack_tough.menu.PartitionScheme.noota_3g=No OTA (1MB APP/3MB SPIFFS) +m5stack_tough.menu.PartitionScheme.noota_3g.build.partitions=noota_3g +m5stack_tough.menu.PartitionScheme.noota_3g.upload.maximum_size=1048576 +m5stack_tough.menu.PartitionScheme.noota_ffat=No OTA (2MB APP/2MB FATFS) +m5stack_tough.menu.PartitionScheme.noota_ffat.build.partitions=noota_ffat +m5stack_tough.menu.PartitionScheme.noota_ffat.upload.maximum_size=2097152 +m5stack_tough.menu.PartitionScheme.noota_3gffat=No OTA (1MB APP/3MB FATFS) +m5stack_tough.menu.PartitionScheme.noota_3gffat.build.partitions=noota_3gffat +m5stack_tough.menu.PartitionScheme.noota_3gffat.upload.maximum_size=1048576 +m5stack_tough.menu.PartitionScheme.huge_app=Huge APP (3MB No OTA/1MB SPIFFS) +m5stack_tough.menu.PartitionScheme.huge_app.build.partitions=huge_app +m5stack_tough.menu.PartitionScheme.huge_app.upload.maximum_size=3145728 +m5stack_tough.menu.PartitionScheme.min_spiffs=Minimal SPIFFS (1.9MB APP with OTA/190KB SPIFFS) +m5stack_tough.menu.PartitionScheme.min_spiffs.build.partitions=min_spiffs +m5stack_tough.menu.PartitionScheme.min_spiffs.upload.maximum_size=1966080 +m5stack_tough.menu.PartitionScheme.fatflash=16M Flash (2MB APP/12.5MB FATFS) +m5stack_tough.menu.PartitionScheme.fatflash.build.partitions=ffat +m5stack_tough.menu.PartitionScheme.fatflash.upload.maximum_size=2097152 +m5stack_tough.menu.PartitionScheme.app3M_fat9M_16MB=16M Flash (3MB APP/9.9MB FATFS) +m5stack_tough.menu.PartitionScheme.app3M_fat9M_16MB.build.partitions=app3M_fat9M_16MB +m5stack_tough.menu.PartitionScheme.app3M_fat9M_16MB.upload.maximum_size=3145728 +m5stack_tough.menu.PartitionScheme.rainmaker=RainMaker +m5stack_tough.menu.PartitionScheme.rainmaker.build.partitions=rainmaker +m5stack_tough.menu.PartitionScheme.rainmaker.upload.maximum_size=3145728 +m5stack_tough.menu.PartitionScheme.custom=Custom +m5stack_tough.menu.PartitionScheme.custom.build.partitions= +m5stack_tough.menu.PartitionScheme.custom.upload.maximum_size=16777216 + +m5stack_tough.menu.CPUFreq.240=240MHz (WiFi/BT) +m5stack_tough.menu.CPUFreq.240.build.f_cpu=240000000L +m5stack_tough.menu.CPUFreq.160=160MHz (WiFi/BT) +m5stack_tough.menu.CPUFreq.160.build.f_cpu=160000000L +m5stack_tough.menu.CPUFreq.80=80MHz (WiFi/BT) +m5stack_tough.menu.CPUFreq.80.build.f_cpu=80000000L +m5stack_tough.menu.CPUFreq.40=40MHz (40MHz XTAL) +m5stack_tough.menu.CPUFreq.40.build.f_cpu=40000000L +m5stack_tough.menu.CPUFreq.26=26MHz (26MHz XTAL) +m5stack_tough.menu.CPUFreq.26.build.f_cpu=26000000L +m5stack_tough.menu.CPUFreq.20=20MHz (40MHz XTAL) +m5stack_tough.menu.CPUFreq.20.build.f_cpu=20000000L +m5stack_tough.menu.CPUFreq.13=13MHz (26MHz XTAL) +m5stack_tough.menu.CPUFreq.13.build.f_cpu=13000000L +m5stack_tough.menu.CPUFreq.10=10MHz (40MHz XTAL) +m5stack_tough.menu.CPUFreq.10.build.f_cpu=10000000L + +m5stack_tough.menu.FlashMode.qio=QIO +m5stack_tough.menu.FlashMode.qio.build.flash_mode=dio +m5stack_tough.menu.FlashMode.qio.build.boot=qio +m5stack_tough.menu.FlashMode.dio=DIO +m5stack_tough.menu.FlashMode.dio.build.flash_mode=dio +m5stack_tough.menu.FlashMode.dio.build.boot=dio +m5stack_tough.menu.FlashMode.qout=QOUT +m5stack_tough.menu.FlashMode.qout.build.flash_mode=dout +m5stack_tough.menu.FlashMode.qout.build.boot=qout +m5stack_tough.menu.FlashMode.dout=DOUT +m5stack_tough.menu.FlashMode.dout.build.flash_mode=dout +m5stack_tough.menu.FlashMode.dout.build.boot=dout + +m5stack_tough.menu.FlashFreq.80=80MHz +m5stack_tough.menu.FlashFreq.80.build.flash_freq=80m +m5stack_tough.menu.FlashFreq.40=40MHz +m5stack_tough.menu.FlashFreq.40.build.flash_freq=40m + +m5stack_tough.menu.FlashSize.16M=16MB (128Mb) +m5stack_tough.menu.FlashSize.16M.build.flash_size=16MB + +m5stack_tough.menu.UploadSpeed.1500000=1500000 +m5stack_tough.menu.UploadSpeed.1500000.upload.speed=1500000 +m5stack_tough.menu.UploadSpeed.921600=921600 +m5stack_tough.menu.UploadSpeed.921600.upload.speed=921600 +m5stack_tough.menu.UploadSpeed.115200=115200 +m5stack_tough.menu.UploadSpeed.115200.upload.speed=115200 +m5stack_tough.menu.UploadSpeed.256000.windows=256000 +m5stack_tough.menu.UploadSpeed.256000.upload.speed=256000 +m5stack_tough.menu.UploadSpeed.230400.windows.upload.speed=256000 +m5stack_tough.menu.UploadSpeed.230400=230400 +m5stack_tough.menu.UploadSpeed.230400.upload.speed=230400 +m5stack_tough.menu.UploadSpeed.460800.linux=460800 +m5stack_tough.menu.UploadSpeed.460800.macosx=460800 +m5stack_tough.menu.UploadSpeed.460800.upload.speed=460800 +m5stack_tough.menu.UploadSpeed.512000.windows=512000 +m5stack_tough.menu.UploadSpeed.512000.upload.speed=512000 + +m5stack_tough.menu.LoopCore.1=Core 1 +m5stack_tough.menu.LoopCore.1.build.loop_core=-DARDUINO_RUNNING_CORE=1 +m5stack_tough.menu.LoopCore.0=Core 0 +m5stack_tough.menu.LoopCore.0.build.loop_core=-DARDUINO_RUNNING_CORE=0 + +m5stack_tough.menu.EventsCore.1=Core 1 +m5stack_tough.menu.EventsCore.1.build.event_core=-DARDUINO_EVENT_RUNNING_CORE=1 +m5stack_tough.menu.EventsCore.0=Core 0 +m5stack_tough.menu.EventsCore.0.build.event_core=-DARDUINO_EVENT_RUNNING_CORE=0 + +m5stack_tough.menu.DebugLevel.none=None +m5stack_tough.menu.DebugLevel.none.build.code_debug=0 +m5stack_tough.menu.DebugLevel.error=Error +m5stack_tough.menu.DebugLevel.error.build.code_debug=1 +m5stack_tough.menu.DebugLevel.warn=Warn +m5stack_tough.menu.DebugLevel.warn.build.code_debug=2 +m5stack_tough.menu.DebugLevel.info=Info +m5stack_tough.menu.DebugLevel.info.build.code_debug=3 +m5stack_tough.menu.DebugLevel.debug=Debug +m5stack_tough.menu.DebugLevel.debug.build.code_debug=4 +m5stack_tough.menu.DebugLevel.verbose=Verbose +m5stack_tough.menu.DebugLevel.verbose.build.code_debug=5 + +m5stack_tough.menu.EraseFlash.none=Disabled +m5stack_tough.menu.EraseFlash.none.upload.erase_cmd= +m5stack_tough.menu.EraseFlash.all=Enabled +m5stack_tough.menu.EraseFlash.all.upload.erase_cmd=-e ############################################################## -m5stack-atom.name=M5Stack-ATOM - -m5stack-atom.bootloader.tool=esptool_py -m5stack-atom.bootloader.tool.default=esptool_py - -m5stack-atom.upload.tool=esptool_py -m5stack-atom.upload.tool.default=esptool_py -m5stack-atom.upload.tool.network=esp_ota - -m5stack-atom.upload.maximum_size=1310720 -m5stack-atom.upload.maximum_data_size=327680 -m5stack-atom.upload.flags= -m5stack-atom.upload.extra_flags= - -m5stack-atom.serial.disableDTR=true -m5stack-atom.serial.disableRTS=true - -m5stack-atom.build.tarch=xtensa -m5stack-atom.build.bootloader_addr=0x1000 -m5stack-atom.build.target=esp32 -m5stack-atom.build.mcu=esp32 -m5stack-atom.build.core=esp32 -m5stack-atom.build.variant=m5stack_atom -m5stack-atom.build.board=M5Stack_ATOM - -m5stack-atom.build.f_cpu=240000000L -m5stack-atom.build.flash_size=4MB -m5stack-atom.build.flash_freq=80m -m5stack-atom.build.flash_mode=dio -m5stack-atom.build.boot=dio -m5stack-atom.build.partitions=default -m5stack-atom.build.defines= - -m5stack-atom.menu.LoopCore.1=Core 1 -m5stack-atom.menu.LoopCore.1.build.loop_core=-DARDUINO_RUNNING_CORE=1 -m5stack-atom.menu.LoopCore.0=Core 0 -m5stack-atom.menu.LoopCore.0.build.loop_core=-DARDUINO_RUNNING_CORE=0 - -m5stack-atom.menu.EventsCore.1=Core 1 -m5stack-atom.menu.EventsCore.1.build.event_core=-DARDUINO_EVENT_RUNNING_CORE=1 -m5stack-atom.menu.EventsCore.0=Core 0 -m5stack-atom.menu.EventsCore.0.build.event_core=-DARDUINO_EVENT_RUNNING_CORE=0 - -m5stack-atom.menu.PartitionScheme.default=Default -m5stack-atom.menu.PartitionScheme.default.build.partitions=default -m5stack-atom.menu.PartitionScheme.no_ota=No OTA (Large APP) -m5stack-atom.menu.PartitionScheme.no_ota.build.partitions=no_ota -m5stack-atom.menu.PartitionScheme.no_ota.upload.maximum_size=2097152 -m5stack-atom.menu.PartitionScheme.min_spiffs=Minimal SPIFFS (Large APPS with OTA) -m5stack-atom.menu.PartitionScheme.min_spiffs.build.partitions=min_spiffs -m5stack-atom.menu.PartitionScheme.min_spiffs.upload.maximum_size=1966080 - -m5stack-atom.menu.UploadSpeed.1500000=1500000 -m5stack-atom.menu.UploadSpeed.1500000.upload.speed=1500000 -m5stack-atom.menu.UploadSpeed.750000=750000 -m5stack-atom.menu.UploadSpeed.750000.upload.speed=750000 -m5stack-atom.menu.UploadSpeed.500000=500000 -m5stack-atom.menu.UploadSpeed.500000.upload.speed=500000 -m5stack-atom.menu.UploadSpeed.250000=250000 -m5stack-atom.menu.UploadSpeed.250000.upload.speed=250000 -m5stack-atom.menu.UploadSpeed.115200=115200 -m5stack-atom.menu.UploadSpeed.115200.upload.speed=115200 - -m5stack-atom.menu.DebugLevel.none=None -m5stack-atom.menu.DebugLevel.none.build.code_debug=0 -m5stack-atom.menu.DebugLevel.error=Error -m5stack-atom.menu.DebugLevel.error.build.code_debug=1 -m5stack-atom.menu.DebugLevel.warn=Warn -m5stack-atom.menu.DebugLevel.warn.build.code_debug=2 -m5stack-atom.menu.DebugLevel.info=Info -m5stack-atom.menu.DebugLevel.info.build.code_debug=3 -m5stack-atom.menu.DebugLevel.debug=Debug -m5stack-atom.menu.DebugLevel.debug.build.code_debug=4 -m5stack-atom.menu.DebugLevel.verbose=Verbose -m5stack-atom.menu.DebugLevel.verbose.build.code_debug=5 - -m5stack-atom.menu.EraseFlash.none=Disabled -m5stack-atom.menu.EraseFlash.none.upload.erase_cmd= -m5stack-atom.menu.EraseFlash.all=Enabled -m5stack-atom.menu.EraseFlash.all.upload.erase_cmd=-e +m5stack_station.name=M5Station + +m5stack_station.bootloader.tool=esptool_py +m5stack_station.bootloader.tool.default=esptool_py + +m5stack_station.upload.tool=esptool_py +m5stack_station.upload.tool.default=esptool_py +m5stack_station.upload.tool.network=esp_ota + +m5stack_station.upload.maximum_size=6553600 +m5stack_station.upload.maximum_data_size=4521984 +m5stack_station.upload.flags= +m5stack_station.upload.extra_flags= + +m5stack_station.serial.disableDTR=true +m5stack_station.serial.disableRTS=true + +m5stack_station.build.tarch=xtensa +m5stack_station.build.bootloader_addr=0x1000 +m5stack_station.build.target=esp32 +m5stack_station.build.mcu=esp32 +m5stack_station.build.core=esp32 +m5stack_station.build.variant=m5stack_station +m5stack_station.build.board=M5STACK_STATION + +m5stack_station.build.f_cpu=240000000L +m5stack_station.build.flash_size=16MB +m5stack_station.build.flash_freq=80m +m5stack_station.build.flash_mode=dio +m5stack_station.build.boot=dio +m5stack_station.build.partitions=default +m5stack_station.build.defines= +m5stack_station.build.loop_core= +m5stack_station.build.event_core= + +m5stack_station.menu.PartitionScheme.default=Default (2 x 6.5 MB app, 3.6 MB SPIFFS) +m5stack_station.menu.PartitionScheme.default.build.partitions=default_16MB +m5stack_station.menu.PartitionScheme.default.upload.maximum_size=6553600 +m5stack_station.menu.PartitionScheme.defaultffat=Default 4MB with ffat (1.2MB APP/1.5MB FATFS) +m5stack_station.menu.PartitionScheme.defaultffat.build.partitions=default_ffat +m5stack_station.menu.PartitionScheme.default_8MB=8M with spiffs (3MB APP/1.5MB SPIFFS) +m5stack_station.menu.PartitionScheme.default_8MB.build.partitions=default_8MB +m5stack_station.menu.PartitionScheme.default_8MB.upload.maximum_size=3342336 +m5stack_station.menu.PartitionScheme.minimal=Minimal (1.3MB APP/700KB SPIFFS) +m5stack_station.menu.PartitionScheme.minimal.build.partitions=minimal +m5stack_station.menu.PartitionScheme.no_ota=No OTA (2MB APP/2MB SPIFFS) +m5stack_station.menu.PartitionScheme.no_ota.build.partitions=no_ota +m5stack_station.menu.PartitionScheme.no_ota.upload.maximum_size=2097152 +m5stack_station.menu.PartitionScheme.noota_3g=No OTA (1MB APP/3MB SPIFFS) +m5stack_station.menu.PartitionScheme.noota_3g.build.partitions=noota_3g +m5stack_station.menu.PartitionScheme.noota_3g.upload.maximum_size=1048576 +m5stack_station.menu.PartitionScheme.noota_ffat=No OTA (2MB APP/2MB FATFS) +m5stack_station.menu.PartitionScheme.noota_ffat.build.partitions=noota_ffat +m5stack_station.menu.PartitionScheme.noota_ffat.upload.maximum_size=2097152 +m5stack_station.menu.PartitionScheme.noota_3gffat=No OTA (1MB APP/3MB FATFS) +m5stack_station.menu.PartitionScheme.noota_3gffat.build.partitions=noota_3gffat +m5stack_station.menu.PartitionScheme.noota_3gffat.upload.maximum_size=1048576 +m5stack_station.menu.PartitionScheme.huge_app=Huge APP (3MB No OTA/1MB SPIFFS) +m5stack_station.menu.PartitionScheme.huge_app.build.partitions=huge_app +m5stack_station.menu.PartitionScheme.huge_app.upload.maximum_size=3145728 +m5stack_station.menu.PartitionScheme.min_spiffs=Minimal SPIFFS (1.9MB APP with OTA/190KB SPIFFS) +m5stack_station.menu.PartitionScheme.min_spiffs.build.partitions=min_spiffs +m5stack_station.menu.PartitionScheme.min_spiffs.upload.maximum_size=1966080 +m5stack_station.menu.PartitionScheme.fatflash=16M Flash (2MB APP/12.5MB FATFS) +m5stack_station.menu.PartitionScheme.fatflash.build.partitions=ffat +m5stack_station.menu.PartitionScheme.fatflash.upload.maximum_size=2097152 +m5stack_station.menu.PartitionScheme.app3M_fat9M_16MB=16M Flash (3MB APP/9.9MB FATFS) +m5stack_station.menu.PartitionScheme.app3M_fat9M_16MB.build.partitions=app3M_fat9M_16MB +m5stack_station.menu.PartitionScheme.app3M_fat9M_16MB.upload.maximum_size=3145728 +m5stack_station.menu.PartitionScheme.rainmaker=RainMaker +m5stack_station.menu.PartitionScheme.rainmaker.build.partitions=rainmaker +m5stack_station.menu.PartitionScheme.rainmaker.upload.maximum_size=3145728 +m5stack_station.menu.PartitionScheme.custom=Custom +m5stack_station.menu.PartitionScheme.custom.build.partitions= +m5stack_station.menu.PartitionScheme.custom.upload.maximum_size=16777216 + +m5stack_station.menu.CPUFreq.240=240MHz (WiFi/BT) +m5stack_station.menu.CPUFreq.240.build.f_cpu=240000000L +m5stack_station.menu.CPUFreq.160=160MHz (WiFi/BT) +m5stack_station.menu.CPUFreq.160.build.f_cpu=160000000L +m5stack_station.menu.CPUFreq.80=80MHz (WiFi/BT) +m5stack_station.menu.CPUFreq.80.build.f_cpu=80000000L +m5stack_station.menu.CPUFreq.40=40MHz (40MHz XTAL) +m5stack_station.menu.CPUFreq.40.build.f_cpu=40000000L +m5stack_station.menu.CPUFreq.26=26MHz (26MHz XTAL) +m5stack_station.menu.CPUFreq.26.build.f_cpu=26000000L +m5stack_station.menu.CPUFreq.20=20MHz (40MHz XTAL) +m5stack_station.menu.CPUFreq.20.build.f_cpu=20000000L +m5stack_station.menu.CPUFreq.13=13MHz (26MHz XTAL) +m5stack_station.menu.CPUFreq.13.build.f_cpu=13000000L +m5stack_station.menu.CPUFreq.10=10MHz (40MHz XTAL) +m5stack_station.menu.CPUFreq.10.build.f_cpu=10000000L + +m5stack_station.menu.FlashMode.qio=QIO +m5stack_station.menu.FlashMode.qio.build.flash_mode=dio +m5stack_station.menu.FlashMode.qio.build.boot=qio +m5stack_station.menu.FlashMode.dio=DIO +m5stack_station.menu.FlashMode.dio.build.flash_mode=dio +m5stack_station.menu.FlashMode.dio.build.boot=dio +m5stack_station.menu.FlashMode.qout=QOUT +m5stack_station.menu.FlashMode.qout.build.flash_mode=dout +m5stack_station.menu.FlashMode.qout.build.boot=qout +m5stack_station.menu.FlashMode.dout=DOUT +m5stack_station.menu.FlashMode.dout.build.flash_mode=dout +m5stack_station.menu.FlashMode.dout.build.boot=dout + +m5stack_station.menu.FlashFreq.80=80MHz +m5stack_station.menu.FlashFreq.80.build.flash_freq=80m +m5stack_station.menu.FlashFreq.40=40MHz +m5stack_station.menu.FlashFreq.40.build.flash_freq=40m + +m5stack_station.menu.FlashSize.16M=16MB (128Mb) +m5stack_station.menu.FlashSize.16M.build.flash_size=16MB + +m5stack_station.menu.UploadSpeed.1500000=1500000 +m5stack_station.menu.UploadSpeed.1500000.upload.speed=1500000 +m5stack_station.menu.UploadSpeed.921600=921600 +m5stack_station.menu.UploadSpeed.921600.upload.speed=921600 +m5stack_station.menu.UploadSpeed.115200=115200 +m5stack_station.menu.UploadSpeed.115200.upload.speed=115200 +m5stack_station.menu.UploadSpeed.256000.windows=256000 +m5stack_station.menu.UploadSpeed.256000.upload.speed=256000 +m5stack_station.menu.UploadSpeed.230400.windows.upload.speed=256000 +m5stack_station.menu.UploadSpeed.230400=230400 +m5stack_station.menu.UploadSpeed.230400.upload.speed=230400 +m5stack_station.menu.UploadSpeed.460800.linux=460800 +m5stack_station.menu.UploadSpeed.460800.macosx=460800 +m5stack_station.menu.UploadSpeed.460800.upload.speed=460800 +m5stack_station.menu.UploadSpeed.512000.windows=512000 +m5stack_station.menu.UploadSpeed.512000.upload.speed=512000 + +m5stack_station.menu.LoopCore.1=Core 1 +m5stack_station.menu.LoopCore.1.build.loop_core=-DARDUINO_RUNNING_CORE=1 +m5stack_station.menu.LoopCore.0=Core 0 +m5stack_station.menu.LoopCore.0.build.loop_core=-DARDUINO_RUNNING_CORE=0 + +m5stack_station.menu.EventsCore.1=Core 1 +m5stack_station.menu.EventsCore.1.build.event_core=-DARDUINO_EVENT_RUNNING_CORE=1 +m5stack_station.menu.EventsCore.0=Core 0 +m5stack_station.menu.EventsCore.0.build.event_core=-DARDUINO_EVENT_RUNNING_CORE=0 + +m5stack_station.menu.DebugLevel.none=None +m5stack_station.menu.DebugLevel.none.build.code_debug=0 +m5stack_station.menu.DebugLevel.error=Error +m5stack_station.menu.DebugLevel.error.build.code_debug=1 +m5stack_station.menu.DebugLevel.warn=Warn +m5stack_station.menu.DebugLevel.warn.build.code_debug=2 +m5stack_station.menu.DebugLevel.info=Info +m5stack_station.menu.DebugLevel.info.build.code_debug=3 +m5stack_station.menu.DebugLevel.debug=Debug +m5stack_station.menu.DebugLevel.debug.build.code_debug=4 +m5stack_station.menu.DebugLevel.verbose=Verbose +m5stack_station.menu.DebugLevel.verbose.build.code_debug=5 + +m5stack_station.menu.EraseFlash.none=Disabled +m5stack_station.menu.EraseFlash.none.upload.erase_cmd= +m5stack_station.menu.EraseFlash.all=Enabled +m5stack_station.menu.EraseFlash.all.upload.erase_cmd=-e ############################################################## -m5stack-atoms3.name=M5Stack-ATOMS3 -m5stack-atoms3.vid.0=0x303a -m5stack-atoms3.pid.0=0x1001 - -m5stack-atoms3.bootloader.tool=esptool_py -m5stack-atoms3.bootloader.tool.default=esptool_py - -m5stack-atoms3.upload.tool=esptool_py -m5stack-atoms3.upload.tool.default=esptool_py -m5stack-atoms3.upload.tool.network=esp_ota - -m5stack-atoms3.upload.maximum_size=1310720 -m5stack-atoms3.upload.maximum_data_size=327680 -m5stack-atoms3.upload.flags= -m5stack-atoms3.upload.extra_flags= -m5stack-atoms3.upload.use_1200bps_touch=false -m5stack-atoms3.upload.wait_for_upload_port=false - -m5stack-atoms3.serial.disableDTR=false -m5stack-atoms3.serial.disableRTS=false - -m5stack-atoms3.build.tarch=xtensa -m5stack-atoms3.build.bootloader_addr=0x0 -m5stack-atoms3.build.target=esp32s3 -m5stack-atoms3.build.mcu=esp32s3 -m5stack-atoms3.build.core=esp32 -m5stack-atoms3.build.variant=m5stack_atoms3 -m5stack-atoms3.build.board=M5Stack_ATOMS3 - -m5stack-atoms3.build.usb_mode=1 -m5stack-atoms3.build.cdc_on_boot=0 -m5stack-atoms3.build.msc_on_boot=0 -m5stack-atoms3.build.dfu_on_boot=0 -m5stack-atoms3.build.f_cpu=240000000L -m5stack-atoms3.build.flash_size=4MB -m5stack-atoms3.build.flash_freq=80m -m5stack-atoms3.build.flash_mode=dio -m5stack-atoms3.build.boot=qio -m5stack-atoms3.build.boot_freq=80m -m5stack-atoms3.build.partitions=default -m5stack-atoms3.build.defines= -m5stack-atoms3.build.loop_core= -m5stack-atoms3.build.event_core= -m5stack-atoms3.build.psram_type=qspi -m5stack-atoms3.build.memory_type={build.boot}_{build.psram_type} +m5stack_stickc.name=M5StickC + +m5stack_stickc.bootloader.tool=esptool_py +m5stack_stickc.bootloader.tool.default=esptool_py + +m5stack_stickc.upload.tool=esptool_py +m5stack_stickc.upload.tool.default=esptool_py +m5stack_stickc.upload.tool.network=esp_ota + +m5stack_stickc.upload.maximum_size=1310720 +m5stack_stickc.upload.maximum_data_size=327680 +m5stack_stickc.upload.flags= +m5stack_stickc.upload.extra_flags= + +m5stack_stickc.serial.disableDTR=true +m5stack_stickc.serial.disableRTS=true + +m5stack_stickc.build.tarch=xtensa +m5stack_stickc.build.bootloader_addr=0x1000 +m5stack_stickc.build.target=esp32 +m5stack_stickc.build.mcu=esp32 +m5stack_stickc.build.core=esp32 +m5stack_stickc.build.variant=m5stack_stickc +m5stack_stickc.build.board=M5STACK_STICKC + +m5stack_stickc.build.f_cpu=240000000L +m5stack_stickc.build.flash_size=4MB +m5stack_stickc.build.flash_freq=80m +m5stack_stickc.build.flash_mode=dio +m5stack_stickc.build.boot=dio +m5stack_stickc.build.partitions=huge_app +m5stack_stickc.build.defines= +m5stack_stickc.build.loop_core= +m5stack_stickc.build.event_core= + +m5stack_stickc.menu.PartitionScheme.huge_app=Huge APP (3MB No OTA/1MB SPIFFS) +m5stack_stickc.menu.PartitionScheme.huge_app.build.partitions=huge_app +m5stack_stickc.menu.PartitionScheme.huge_app.upload.maximum_size=3145728 +m5stack_stickc.menu.PartitionScheme.default=Default 4MB with spiffs (1.2MB APP/1.5MB SPIFFS) +m5stack_stickc.menu.PartitionScheme.default.build.partitions=default +m5stack_stickc.menu.PartitionScheme.defaultffat=Default 4MB with ffat (1.2MB APP/1.5MB FATFS) +m5stack_stickc.menu.PartitionScheme.defaultffat.build.partitions=default_ffat +m5stack_stickc.menu.PartitionScheme.default_8MB=8M with spiffs (3MB APP/1.5MB SPIFFS) +m5stack_stickc.menu.PartitionScheme.default_8MB.build.partitions=default_8MB +m5stack_stickc.menu.PartitionScheme.default_8MB.upload.maximum_size=3342336 +m5stack_stickc.menu.PartitionScheme.minimal=Minimal (1.3MB APP/700KB SPIFFS) +m5stack_stickc.menu.PartitionScheme.minimal.build.partitions=minimal +m5stack_stickc.menu.PartitionScheme.no_ota=No OTA (2MB APP/2MB SPIFFS) +m5stack_stickc.menu.PartitionScheme.no_ota.build.partitions=no_ota +m5stack_stickc.menu.PartitionScheme.no_ota.upload.maximum_size=2097152 +m5stack_stickc.menu.PartitionScheme.noota_3g=No OTA (1MB APP/3MB SPIFFS) +m5stack_stickc.menu.PartitionScheme.noota_3g.build.partitions=noota_3g +m5stack_stickc.menu.PartitionScheme.noota_3g.upload.maximum_size=1048576 +m5stack_stickc.menu.PartitionScheme.noota_ffat=No OTA (2MB APP/2MB FATFS) +m5stack_stickc.menu.PartitionScheme.noota_ffat.build.partitions=noota_ffat +m5stack_stickc.menu.PartitionScheme.noota_ffat.upload.maximum_size=2097152 +m5stack_stickc.menu.PartitionScheme.noota_3gffat=No OTA (1MB APP/3MB FATFS) +m5stack_stickc.menu.PartitionScheme.noota_3gffat.build.partitions=noota_3gffat +m5stack_stickc.menu.PartitionScheme.noota_3gffat.upload.maximum_size=1048576 +m5stack_stickc.menu.PartitionScheme.min_spiffs=Minimal SPIFFS (1.9MB APP with OTA/190KB SPIFFS) +m5stack_stickc.menu.PartitionScheme.min_spiffs.build.partitions=min_spiffs +m5stack_stickc.menu.PartitionScheme.min_spiffs.upload.maximum_size=1966080 +m5stack_stickc.menu.PartitionScheme.fatflash=16M Flash (2MB APP/12.5MB FATFS) +m5stack_stickc.menu.PartitionScheme.fatflash.build.partitions=ffat +m5stack_stickc.menu.PartitionScheme.fatflash.upload.maximum_size=2097152 +m5stack_stickc.menu.PartitionScheme.rainmaker=RainMaker +m5stack_stickc.menu.PartitionScheme.rainmaker.build.partitions=rainmaker +m5stack_stickc.menu.PartitionScheme.rainmaker.upload.maximum_size=3145728 +m5stack_stickc.menu.PartitionScheme.custom=Custom +m5stack_stickc.menu.PartitionScheme.custom.build.partitions= +m5stack_stickc.menu.PartitionScheme.custom.upload.maximum_size=16777216 + +m5stack_stickc.menu.CPUFreq.240=240MHz (WiFi/BT) +m5stack_stickc.menu.CPUFreq.240.build.f_cpu=240000000L +m5stack_stickc.menu.CPUFreq.160=160MHz (WiFi/BT) +m5stack_stickc.menu.CPUFreq.160.build.f_cpu=160000000L +m5stack_stickc.menu.CPUFreq.80=80MHz (WiFi/BT) +m5stack_stickc.menu.CPUFreq.80.build.f_cpu=80000000L +m5stack_stickc.menu.CPUFreq.40=40MHz (40MHz XTAL) +m5stack_stickc.menu.CPUFreq.40.build.f_cpu=40000000L +m5stack_stickc.menu.CPUFreq.26=26MHz (26MHz XTAL) +m5stack_stickc.menu.CPUFreq.26.build.f_cpu=26000000L +m5stack_stickc.menu.CPUFreq.20=20MHz (40MHz XTAL) +m5stack_stickc.menu.CPUFreq.20.build.f_cpu=20000000L +m5stack_stickc.menu.CPUFreq.13=13MHz (26MHz XTAL) +m5stack_stickc.menu.CPUFreq.13.build.f_cpu=13000000L +m5stack_stickc.menu.CPUFreq.10=10MHz (40MHz XTAL) +m5stack_stickc.menu.CPUFreq.10.build.f_cpu=10000000L + +m5stack_stickc.menu.FlashMode.qio=QIO +m5stack_stickc.menu.FlashMode.qio.build.flash_mode=dio +m5stack_stickc.menu.FlashMode.qio.build.boot=qio +m5stack_stickc.menu.FlashMode.dio=DIO +m5stack_stickc.menu.FlashMode.dio.build.flash_mode=dio +m5stack_stickc.menu.FlashMode.dio.build.boot=dio +m5stack_stickc.menu.FlashMode.qout=QOUT +m5stack_stickc.menu.FlashMode.qout.build.flash_mode=dout +m5stack_stickc.menu.FlashMode.qout.build.boot=qout +m5stack_stickc.menu.FlashMode.dout=DOUT +m5stack_stickc.menu.FlashMode.dout.build.flash_mode=dout +m5stack_stickc.menu.FlashMode.dout.build.boot=dout + +m5stack_stickc.menu.FlashFreq.80=80MHz +m5stack_stickc.menu.FlashFreq.80.build.flash_freq=80m +m5stack_stickc.menu.FlashFreq.40=40MHz +m5stack_stickc.menu.FlashFreq.40.build.flash_freq=40m + +m5stack_stickc.menu.FlashSize.4M=4MB (32Mb) +m5stack_stickc.menu.FlashSize.4M.build.flash_size=4MB + +m5stack_stickc.menu.UploadSpeed.1500000=1500000 +m5stack_stickc.menu.UploadSpeed.1500000.upload.speed=1500000 +m5stack_stickc.menu.UploadSpeed.750000=750000 +m5stack_stickc.menu.UploadSpeed.750000.upload.speed=750000 +m5stack_stickc.menu.UploadSpeed.500000=500000 +m5stack_stickc.menu.UploadSpeed.500000.upload.speed=500000 +m5stack_stickc.menu.UploadSpeed.250000=250000 +m5stack_stickc.menu.UploadSpeed.250000.upload.speed=250000 +m5stack_stickc.menu.UploadSpeed.115200=115200 +m5stack_stickc.menu.UploadSpeed.115200.upload.speed=115200 + +m5stack_stickc.menu.LoopCore.1=Core 1 +m5stack_stickc.menu.LoopCore.1.build.loop_core=-DARDUINO_RUNNING_CORE=1 +m5stack_stickc.menu.LoopCore.0=Core 0 +m5stack_stickc.menu.LoopCore.0.build.loop_core=-DARDUINO_RUNNING_CORE=0 + +m5stack_stickc.menu.EventsCore.1=Core 1 +m5stack_stickc.menu.EventsCore.1.build.event_core=-DARDUINO_EVENT_RUNNING_CORE=1 +m5stack_stickc.menu.EventsCore.0=Core 0 +m5stack_stickc.menu.EventsCore.0.build.event_core=-DARDUINO_EVENT_RUNNING_CORE=0 + +m5stack_stickc.menu.DebugLevel.none=None +m5stack_stickc.menu.DebugLevel.none.build.code_debug=0 +m5stack_stickc.menu.DebugLevel.error=Error +m5stack_stickc.menu.DebugLevel.error.build.code_debug=1 +m5stack_stickc.menu.DebugLevel.warn=Warn +m5stack_stickc.menu.DebugLevel.warn.build.code_debug=2 +m5stack_stickc.menu.DebugLevel.info=Info +m5stack_stickc.menu.DebugLevel.info.build.code_debug=3 +m5stack_stickc.menu.DebugLevel.debug=Debug +m5stack_stickc.menu.DebugLevel.debug.build.code_debug=4 +m5stack_stickc.menu.DebugLevel.verbose=Verbose +m5stack_stickc.menu.DebugLevel.verbose.build.code_debug=5 + +m5stack_stickc.menu.EraseFlash.none=Disabled +m5stack_stickc.menu.EraseFlash.none.upload.erase_cmd= +m5stack_stickc.menu.EraseFlash.all=Enabled +m5stack_stickc.menu.EraseFlash.all.upload.erase_cmd=-e + +############################################################## + +m5stack_stickc_plus.name=M5StickCPlus + +m5stack_stickc_plus.bootloader.tool=esptool_py +m5stack_stickc_plus.bootloader.tool.default=esptool_py + +m5stack_stickc_plus.upload.tool=esptool_py +m5stack_stickc_plus.upload.tool.default=esptool_py +m5stack_stickc_plus.upload.tool.network=esp_ota + +m5stack_stickc_plus.upload.maximum_size=1310720 +m5stack_stickc_plus.upload.maximum_data_size=327680 +m5stack_stickc_plus.upload.flags= +m5stack_stickc_plus.upload.extra_flags= + +m5stack_stickc_plus.serial.disableDTR=true +m5stack_stickc_plus.serial.disableRTS=true + +m5stack_stickc_plus.build.tarch=xtensa +m5stack_stickc_plus.build.bootloader_addr=0x1000 +m5stack_stickc_plus.build.target=esp32 +m5stack_stickc_plus.build.mcu=esp32 +m5stack_stickc_plus.build.core=esp32 +m5stack_stickc_plus.build.variant=m5stack_stickc_plus +m5stack_stickc_plus.build.board=M5STACK_STICKC_PLUS + +m5stack_stickc_plus.build.f_cpu=240000000L +m5stack_stickc_plus.build.flash_size=4MB +m5stack_stickc_plus.build.flash_freq=80m +m5stack_stickc_plus.build.flash_mode=dio +m5stack_stickc_plus.build.boot=dio +m5stack_stickc_plus.build.partitions=huge_app +m5stack_stickc_plus.build.defines= +m5stack_stickc_plus.build.loop_core= +m5stack_stickc_plus.build.event_core= + +m5stack_stickc_plus.menu.PartitionScheme.huge_app=Huge APP (3MB No OTA/1MB SPIFFS) +m5stack_stickc_plus.menu.PartitionScheme.huge_app.build.partitions=huge_app +m5stack_stickc_plus.menu.PartitionScheme.huge_app.upload.maximum_size=3145728 +m5stack_stickc_plus.menu.PartitionScheme.default=Default 4MB with spiffs (1.2MB APP/1.5MB SPIFFS) +m5stack_stickc_plus.menu.PartitionScheme.default.build.partitions=default +m5stack_stickc_plus.menu.PartitionScheme.defaultffat=Default 4MB with ffat (1.2MB APP/1.5MB FATFS) +m5stack_stickc_plus.menu.PartitionScheme.defaultffat.build.partitions=default_ffat +m5stack_stickc_plus.menu.PartitionScheme.default_8MB=8M with spiffs (3MB APP/1.5MB SPIFFS) +m5stack_stickc_plus.menu.PartitionScheme.default_8MB.build.partitions=default_8MB +m5stack_stickc_plus.menu.PartitionScheme.default_8MB.upload.maximum_size=3342336 +m5stack_stickc_plus.menu.PartitionScheme.minimal=Minimal (1.3MB APP/700KB SPIFFS) +m5stack_stickc_plus.menu.PartitionScheme.minimal.build.partitions=minimal +m5stack_stickc_plus.menu.PartitionScheme.no_ota=No OTA (2MB APP/2MB SPIFFS) +m5stack_stickc_plus.menu.PartitionScheme.no_ota.build.partitions=no_ota +m5stack_stickc_plus.menu.PartitionScheme.no_ota.upload.maximum_size=2097152 +m5stack_stickc_plus.menu.PartitionScheme.noota_3g=No OTA (1MB APP/3MB SPIFFS) +m5stack_stickc_plus.menu.PartitionScheme.noota_3g.build.partitions=noota_3g +m5stack_stickc_plus.menu.PartitionScheme.noota_3g.upload.maximum_size=1048576 +m5stack_stickc_plus.menu.PartitionScheme.noota_ffat=No OTA (2MB APP/2MB FATFS) +m5stack_stickc_plus.menu.PartitionScheme.noota_ffat.build.partitions=noota_ffat +m5stack_stickc_plus.menu.PartitionScheme.noota_ffat.upload.maximum_size=2097152 +m5stack_stickc_plus.menu.PartitionScheme.noota_3gffat=No OTA (1MB APP/3MB FATFS) +m5stack_stickc_plus.menu.PartitionScheme.noota_3gffat.build.partitions=noota_3gffat +m5stack_stickc_plus.menu.PartitionScheme.noota_3gffat.upload.maximum_size=1048576 +m5stack_stickc_plus.menu.PartitionScheme.min_spiffs=Minimal SPIFFS (1.9MB APP with OTA/190KB SPIFFS) +m5stack_stickc_plus.menu.PartitionScheme.min_spiffs.build.partitions=min_spiffs +m5stack_stickc_plus.menu.PartitionScheme.min_spiffs.upload.maximum_size=1966080 +m5stack_stickc_plus.menu.PartitionScheme.fatflash=16M Flash (2MB APP/12.5MB FATFS) +m5stack_stickc_plus.menu.PartitionScheme.fatflash.build.partitions=ffat +m5stack_stickc_plus.menu.PartitionScheme.fatflash.upload.maximum_size=2097152 +m5stack_stickc_plus.menu.PartitionScheme.rainmaker=RainMaker +m5stack_stickc_plus.menu.PartitionScheme.rainmaker.build.partitions=rainmaker +m5stack_stickc_plus.menu.PartitionScheme.rainmaker.upload.maximum_size=3145728 +m5stack_stickc_plus.menu.PartitionScheme.custom=Custom +m5stack_stickc_plus.menu.PartitionScheme.custom.build.partitions= +m5stack_stickc_plus.menu.PartitionScheme.custom.upload.maximum_size=16777216 + +m5stack_stickc_plus.menu.CPUFreq.240=240MHz (WiFi/BT) +m5stack_stickc_plus.menu.CPUFreq.240.build.f_cpu=240000000L +m5stack_stickc_plus.menu.CPUFreq.160=160MHz (WiFi/BT) +m5stack_stickc_plus.menu.CPUFreq.160.build.f_cpu=160000000L +m5stack_stickc_plus.menu.CPUFreq.80=80MHz (WiFi/BT) +m5stack_stickc_plus.menu.CPUFreq.80.build.f_cpu=80000000L +m5stack_stickc_plus.menu.CPUFreq.40=40MHz (40MHz XTAL) +m5stack_stickc_plus.menu.CPUFreq.40.build.f_cpu=40000000L +m5stack_stickc_plus.menu.CPUFreq.26=26MHz (26MHz XTAL) +m5stack_stickc_plus.menu.CPUFreq.26.build.f_cpu=26000000L +m5stack_stickc_plus.menu.CPUFreq.20=20MHz (40MHz XTAL) +m5stack_stickc_plus.menu.CPUFreq.20.build.f_cpu=20000000L +m5stack_stickc_plus.menu.CPUFreq.13=13MHz (26MHz XTAL) +m5stack_stickc_plus.menu.CPUFreq.13.build.f_cpu=13000000L +m5stack_stickc_plus.menu.CPUFreq.10=10MHz (40MHz XTAL) +m5stack_stickc_plus.menu.CPUFreq.10.build.f_cpu=10000000L + +m5stack_stickc_plus.menu.FlashMode.qio=QIO +m5stack_stickc_plus.menu.FlashMode.qio.build.flash_mode=dio +m5stack_stickc_plus.menu.FlashMode.qio.build.boot=qio +m5stack_stickc_plus.menu.FlashMode.dio=DIO +m5stack_stickc_plus.menu.FlashMode.dio.build.flash_mode=dio +m5stack_stickc_plus.menu.FlashMode.dio.build.boot=dio +m5stack_stickc_plus.menu.FlashMode.qout=QOUT +m5stack_stickc_plus.menu.FlashMode.qout.build.flash_mode=dout +m5stack_stickc_plus.menu.FlashMode.qout.build.boot=qout +m5stack_stickc_plus.menu.FlashMode.dout=DOUT +m5stack_stickc_plus.menu.FlashMode.dout.build.flash_mode=dout +m5stack_stickc_plus.menu.FlashMode.dout.build.boot=dout + +m5stack_stickc_plus.menu.FlashFreq.80=80MHz +m5stack_stickc_plus.menu.FlashFreq.80.build.flash_freq=80m +m5stack_stickc_plus.menu.FlashFreq.40=40MHz +m5stack_stickc_plus.menu.FlashFreq.40.build.flash_freq=40m + +m5stack_stickc_plus.menu.FlashSize.4M=4MB (32Mb) +m5stack_stickc_plus.menu.FlashSize.4M.build.flash_size=4MB + +m5stack_stickc_plus.menu.UploadSpeed.1500000=1500000 +m5stack_stickc_plus.menu.UploadSpeed.1500000.upload.speed=1500000 +m5stack_stickc_plus.menu.UploadSpeed.750000=750000 +m5stack_stickc_plus.menu.UploadSpeed.750000.upload.speed=750000 +m5stack_stickc_plus.menu.UploadSpeed.500000=500000 +m5stack_stickc_plus.menu.UploadSpeed.500000.upload.speed=500000 +m5stack_stickc_plus.menu.UploadSpeed.250000=250000 +m5stack_stickc_plus.menu.UploadSpeed.250000.upload.speed=250000 +m5stack_stickc_plus.menu.UploadSpeed.115200=115200 +m5stack_stickc_plus.menu.UploadSpeed.115200.upload.speed=115200 + +m5stack_stickc_plus.menu.LoopCore.1=Core 1 +m5stack_stickc_plus.menu.LoopCore.1.build.loop_core=-DARDUINO_RUNNING_CORE=1 +m5stack_stickc_plus.menu.LoopCore.0=Core 0 +m5stack_stickc_plus.menu.LoopCore.0.build.loop_core=-DARDUINO_RUNNING_CORE=0 + +m5stack_stickc_plus.menu.EventsCore.1=Core 1 +m5stack_stickc_plus.menu.EventsCore.1.build.event_core=-DARDUINO_EVENT_RUNNING_CORE=1 +m5stack_stickc_plus.menu.EventsCore.0=Core 0 +m5stack_stickc_plus.menu.EventsCore.0.build.event_core=-DARDUINO_EVENT_RUNNING_CORE=0 + +m5stack_stickc_plus.menu.DebugLevel.none=None +m5stack_stickc_plus.menu.DebugLevel.none.build.code_debug=0 +m5stack_stickc_plus.menu.DebugLevel.error=Error +m5stack_stickc_plus.menu.DebugLevel.error.build.code_debug=1 +m5stack_stickc_plus.menu.DebugLevel.warn=Warn +m5stack_stickc_plus.menu.DebugLevel.warn.build.code_debug=2 +m5stack_stickc_plus.menu.DebugLevel.info=Info +m5stack_stickc_plus.menu.DebugLevel.info.build.code_debug=3 +m5stack_stickc_plus.menu.DebugLevel.debug=Debug +m5stack_stickc_plus.menu.DebugLevel.debug.build.code_debug=4 +m5stack_stickc_plus.menu.DebugLevel.verbose=Verbose +m5stack_stickc_plus.menu.DebugLevel.verbose.build.code_debug=5 + +m5stack_stickc_plus.menu.EraseFlash.none=Disabled +m5stack_stickc_plus.menu.EraseFlash.none.upload.erase_cmd= +m5stack_stickc_plus.menu.EraseFlash.all=Enabled +m5stack_stickc_plus.menu.EraseFlash.all.upload.erase_cmd=-e + + + +############################################################## + +m5stack_stickc_plus2.name=M5StickCPlus2 + +m5stack_stickc_plus2.bootloader.tool=esptool_py +m5stack_stickc_plus2.bootloader.tool.default=esptool_py + +m5stack_stickc_plus2.upload.tool=esptool_py +m5stack_stickc_plus2.upload.tool.default=esptool_py +m5stack_stickc_plus2.upload.tool.network=esp_ota + +m5stack_stickc_plus2.upload.maximum_size=3342336 +m5stack_stickc_plus2.upload.maximum_data_size=327680 +m5stack_stickc_plus2.upload.flags= +m5stack_stickc_plus2.upload.extra_flags= + +m5stack_stickc_plus2.serial.disableDTR=true +m5stack_stickc_plus2.serial.disableRTS=true + +m5stack_stickc_plus2.build.tarch=xtensa +m5stack_stickc_plus2.build.bootloader_addr=0x1000 +m5stack_stickc_plus2.build.target=esp32 +m5stack_stickc_plus2.build.mcu=esp32 +m5stack_stickc_plus2.build.core=esp32 +m5stack_stickc_plus2.build.variant=m5stack_stickc_plus2 +m5stack_stickc_plus2.build.board=M5STACK_STICKC_PLUS2 + +m5stack_stickc_plus2.build.f_cpu=240000000L +m5stack_stickc_plus2.build.flash_size=8MB +m5stack_stickc_plus2.build.flash_freq=80m +m5stack_stickc_plus2.build.flash_mode=dio +m5stack_stickc_plus2.build.boot=dio +m5stack_stickc_plus2.build.partitions=default_8MB +m5stack_stickc_plus2.build.defines= +m5stack_stickc_plus2.build.loop_core= +m5stack_stickc_plus2.build.event_core= + +m5stack_stickc_plus2.menu.PSRAM.enabled=Enabled +m5stack_stickc_plus2.menu.PSRAM.enabled.build.defines=-DBOARD_HAS_PSRAM -mfix-esp32-psram-cache-issue -mfix-esp32-psram-cache-strategy=memw +m5stack_stickc_plus2.menu.PSRAM.enabled.build.extra_libs= +m5stack_stickc_plus2.menu.PSRAM.disabled=Disabled +m5stack_stickc_plus2.menu.PSRAM.disabled.build.defines= +m5stack_stickc_plus2.menu.PSRAM.disabled.build.extra_libs= + +m5stack_stickc_plus2.menu.PartitionScheme.default_8MB=8M with spiffs (3MB APP/1.5MB SPIFFS) +m5stack_stickc_plus2.menu.PartitionScheme.default_8MB.build.partitions=default_8MB +m5stack_stickc_plus2.menu.PartitionScheme.default_8MB.upload.maximum_size=3342336 +m5stack_stickc_plus2.menu.PartitionScheme.huge_app=Huge APP (3MB No OTA/1MB SPIFFS) +m5stack_stickc_plus2.menu.PartitionScheme.huge_app.build.partitions=huge_app +m5stack_stickc_plus2.menu.PartitionScheme.huge_app.upload.maximum_size=3145728 +m5stack_stickc_plus2.menu.PartitionScheme.default=Default 4MB with spiffs (1.2MB APP/1.5MB SPIFFS) +m5stack_stickc_plus2.menu.PartitionScheme.default.build.partitions=default +m5stack_stickc_plus2.menu.PartitionScheme.defaultffat=Default 4MB with ffat (1.2MB APP/1.5MB FATFS) +m5stack_stickc_plus2.menu.PartitionScheme.defaultffat.build.partitions=default_ffat +m5stack_stickc_plus2.menu.PartitionScheme.minimal=Minimal (1.3MB APP/700KB SPIFFS) +m5stack_stickc_plus2.menu.PartitionScheme.minimal.build.partitions=minimal +m5stack_stickc_plus2.menu.PartitionScheme.no_ota=No OTA (2MB APP/2MB SPIFFS) +m5stack_stickc_plus2.menu.PartitionScheme.no_ota.build.partitions=no_ota +m5stack_stickc_plus2.menu.PartitionScheme.no_ota.upload.maximum_size=2097152 +m5stack_stickc_plus2.menu.PartitionScheme.noota_3g=No OTA (1MB APP/3MB SPIFFS) +m5stack_stickc_plus2.menu.PartitionScheme.noota_3g.build.partitions=noota_3g +m5stack_stickc_plus2.menu.PartitionScheme.noota_3g.upload.maximum_size=1048576 +m5stack_stickc_plus2.menu.PartitionScheme.noota_ffat=No OTA (2MB APP/2MB FATFS) +m5stack_stickc_plus2.menu.PartitionScheme.noota_ffat.build.partitions=noota_ffat +m5stack_stickc_plus2.menu.PartitionScheme.noota_ffat.upload.maximum_size=2097152 +m5stack_stickc_plus2.menu.PartitionScheme.noota_3gffat=No OTA (1MB APP/3MB FATFS) +m5stack_stickc_plus2.menu.PartitionScheme.noota_3gffat.build.partitions=noota_3gffat +m5stack_stickc_plus2.menu.PartitionScheme.noota_3gffat.upload.maximum_size=1048576 +m5stack_stickc_plus2.menu.PartitionScheme.min_spiffs=Minimal SPIFFS (1.9MB APP with OTA/190KB SPIFFS) +m5stack_stickc_plus2.menu.PartitionScheme.min_spiffs.build.partitions=min_spiffs +m5stack_stickc_plus2.menu.PartitionScheme.min_spiffs.upload.maximum_size=1966080 +m5stack_stickc_plus2.menu.PartitionScheme.fatflash=16M Flash (2MB APP/12.5MB FATFS) +m5stack_stickc_plus2.menu.PartitionScheme.fatflash.build.partitions=ffat +m5stack_stickc_plus2.menu.PartitionScheme.fatflash.upload.maximum_size=2097152 +m5stack_stickc_plus2.menu.PartitionScheme.rainmaker=RainMaker +m5stack_stickc_plus2.menu.PartitionScheme.rainmaker.build.partitions=rainmaker +m5stack_stickc_plus2.menu.PartitionScheme.rainmaker.upload.maximum_size=3145728 +m5stack_stickc_plus2.menu.PartitionScheme.custom=Custom +m5stack_stickc_plus2.menu.PartitionScheme.custom.build.partitions= +m5stack_stickc_plus2.menu.PartitionScheme.custom.upload.maximum_size=16777216 + +m5stack_stickc_plus2.menu.CPUFreq.240=240MHz (WiFi/BT) +m5stack_stickc_plus2.menu.CPUFreq.240.build.f_cpu=240000000L +m5stack_stickc_plus2.menu.CPUFreq.160=160MHz (WiFi/BT) +m5stack_stickc_plus2.menu.CPUFreq.160.build.f_cpu=160000000L +m5stack_stickc_plus2.menu.CPUFreq.80=80MHz (WiFi/BT) +m5stack_stickc_plus2.menu.CPUFreq.80.build.f_cpu=80000000L +m5stack_stickc_plus2.menu.CPUFreq.40=40MHz (40MHz XTAL) +m5stack_stickc_plus2.menu.CPUFreq.40.build.f_cpu=40000000L +m5stack_stickc_plus2.menu.CPUFreq.26=26MHz (26MHz XTAL) +m5stack_stickc_plus2.menu.CPUFreq.26.build.f_cpu=26000000L +m5stack_stickc_plus2.menu.CPUFreq.20=20MHz (40MHz XTAL) +m5stack_stickc_plus2.menu.CPUFreq.20.build.f_cpu=20000000L +m5stack_stickc_plus2.menu.CPUFreq.13=13MHz (26MHz XTAL) +m5stack_stickc_plus2.menu.CPUFreq.13.build.f_cpu=13000000L +m5stack_stickc_plus2.menu.CPUFreq.10=10MHz (40MHz XTAL) +m5stack_stickc_plus2.menu.CPUFreq.10.build.f_cpu=10000000L + +m5stack_stickc_plus2.menu.FlashMode.qio=QIO +m5stack_stickc_plus2.menu.FlashMode.qio.build.flash_mode=dio +m5stack_stickc_plus2.menu.FlashMode.qio.build.boot=qio +m5stack_stickc_plus2.menu.FlashMode.dio=DIO +m5stack_stickc_plus2.menu.FlashMode.dio.build.flash_mode=dio +m5stack_stickc_plus2.menu.FlashMode.dio.build.boot=dio +m5stack_stickc_plus2.menu.FlashMode.qout=QOUT +m5stack_stickc_plus2.menu.FlashMode.qout.build.flash_mode=dout +m5stack_stickc_plus2.menu.FlashMode.qout.build.boot=qout +m5stack_stickc_plus2.menu.FlashMode.dout=DOUT +m5stack_stickc_plus2.menu.FlashMode.dout.build.flash_mode=dout +m5stack_stickc_plus2.menu.FlashMode.dout.build.boot=dout + +m5stack_stickc_plus2.menu.FlashFreq.80=80MHz +m5stack_stickc_plus2.menu.FlashFreq.80.build.flash_freq=80m +m5stack_stickc_plus2.menu.FlashFreq.40=40MHz +m5stack_stickc_plus2.menu.FlashFreq.40.build.flash_freq=40m + +m5stack_stickc_plus2.menu.FlashSize.8M=8MB (64Mb) +m5stack_stickc_plus2.menu.FlashSize.8M.build.flash_size=8MB + +m5stack_stickc_plus2.menu.UploadSpeed.1500000=1500000 +m5stack_stickc_plus2.menu.UploadSpeed.1500000.upload.speed=1500000 +m5stack_stickc_plus2.menu.UploadSpeed.750000=750000 +m5stack_stickc_plus2.menu.UploadSpeed.750000.upload.speed=750000 +m5stack_stickc_plus2.menu.UploadSpeed.500000=500000 +m5stack_stickc_plus2.menu.UploadSpeed.500000.upload.speed=500000 +m5stack_stickc_plus2.menu.UploadSpeed.250000=250000 +m5stack_stickc_plus2.menu.UploadSpeed.250000.upload.speed=250000 +m5stack_stickc_plus2.menu.UploadSpeed.115200=115200 +m5stack_stickc_plus2.menu.UploadSpeed.115200.upload.speed=115200 + +m5stack_stickc_plus2.menu.LoopCore.1=Core 1 +m5stack_stickc_plus2.menu.LoopCore.1.build.loop_core=-DARDUINO_RUNNING_CORE=1 +m5stack_stickc_plus2.menu.LoopCore.0=Core 0 +m5stack_stickc_plus2.menu.LoopCore.0.build.loop_core=-DARDUINO_RUNNING_CORE=0 + +m5stack_stickc_plus2.menu.EventsCore.1=Core 1 +m5stack_stickc_plus2.menu.EventsCore.1.build.event_core=-DARDUINO_EVENT_RUNNING_CORE=1 +m5stack_stickc_plus2.menu.EventsCore.0=Core 0 +m5stack_stickc_plus2.menu.EventsCore.0.build.event_core=-DARDUINO_EVENT_RUNNING_CORE=0 + +m5stack_stickc_plus2.menu.DebugLevel.none=None +m5stack_stickc_plus2.menu.DebugLevel.none.build.code_debug=0 +m5stack_stickc_plus2.menu.DebugLevel.error=Error +m5stack_stickc_plus2.menu.DebugLevel.error.build.code_debug=1 +m5stack_stickc_plus2.menu.DebugLevel.warn=Warn +m5stack_stickc_plus2.menu.DebugLevel.warn.build.code_debug=2 +m5stack_stickc_plus2.menu.DebugLevel.info=Info +m5stack_stickc_plus2.menu.DebugLevel.info.build.code_debug=3 +m5stack_stickc_plus2.menu.DebugLevel.debug=Debug +m5stack_stickc_plus2.menu.DebugLevel.debug.build.code_debug=4 +m5stack_stickc_plus2.menu.DebugLevel.verbose=Verbose +m5stack_stickc_plus2.menu.DebugLevel.verbose.build.code_debug=5 + +m5stack_stickc_plus2.menu.EraseFlash.none=Disabled +m5stack_stickc_plus2.menu.EraseFlash.none.upload.erase_cmd= +m5stack_stickc_plus2.menu.EraseFlash.all=Enabled +m5stack_stickc_plus2.menu.EraseFlash.all.upload.erase_cmd=-e + + +############################################################## + +m5stack_atom.name=M5Atom + +m5stack_atom.bootloader.tool=esptool_py +m5stack_atom.bootloader.tool.default=esptool_py + +m5stack_atom.upload.tool=esptool_py +m5stack_atom.upload.tool.default=esptool_py +m5stack_atom.upload.tool.network=esp_ota + +m5stack_atom.upload.maximum_size=1310720 +m5stack_atom.upload.maximum_data_size=327680 +m5stack_atom.upload.flags= +m5stack_atom.upload.extra_flags= + +m5stack_atom.serial.disableDTR=true +m5stack_atom.serial.disableRTS=true + +m5stack_atom.build.tarch=xtensa +m5stack_atom.build.bootloader_addr=0x1000 +m5stack_atom.build.target=esp32 +m5stack_atom.build.mcu=esp32 +m5stack_atom.build.core=esp32 +m5stack_atom.build.variant=m5stack_atom +m5stack_atom.build.board=M5STACK_ATOM + +m5stack_atom.build.f_cpu=240000000L +m5stack_atom.build.flash_size=4MB +m5stack_atom.build.flash_freq=80m +m5stack_atom.build.flash_mode=dio +m5stack_atom.build.boot=dio +m5stack_atom.build.partitions=huge_app +m5stack_atom.build.defines= +m5stack_atom.build.loop_core= +m5stack_atom.build.event_core= + +m5stack_atom.menu.PartitionScheme.huge_app=Huge APP (3MB No OTA/1MB SPIFFS) +m5stack_atom.menu.PartitionScheme.huge_app.build.partitions=huge_app +m5stack_atom.menu.PartitionScheme.huge_app.upload.maximum_size=3145728 +m5stack_atom.menu.PartitionScheme.default=Default 4MB with spiffs (1.2MB APP/1.5MB SPIFFS) +m5stack_atom.menu.PartitionScheme.default.build.partitions=default +m5stack_atom.menu.PartitionScheme.defaultffat=Default 4MB with ffat (1.2MB APP/1.5MB FATFS) +m5stack_atom.menu.PartitionScheme.defaultffat.build.partitions=default_ffat +m5stack_atom.menu.PartitionScheme.default_8MB=8M with spiffs (3MB APP/1.5MB SPIFFS) +m5stack_atom.menu.PartitionScheme.default_8MB.build.partitions=default_8MB +m5stack_atom.menu.PartitionScheme.default_8MB.upload.maximum_size=3342336 +m5stack_atom.menu.PartitionScheme.minimal=Minimal (1.3MB APP/700KB SPIFFS) +m5stack_atom.menu.PartitionScheme.minimal.build.partitions=minimal +m5stack_atom.menu.PartitionScheme.no_ota=No OTA (2MB APP/2MB SPIFFS) +m5stack_atom.menu.PartitionScheme.no_ota.build.partitions=no_ota +m5stack_atom.menu.PartitionScheme.no_ota.upload.maximum_size=2097152 +m5stack_atom.menu.PartitionScheme.noota_3g=No OTA (1MB APP/3MB SPIFFS) +m5stack_atom.menu.PartitionScheme.noota_3g.build.partitions=noota_3g +m5stack_atom.menu.PartitionScheme.noota_3g.upload.maximum_size=1048576 +m5stack_atom.menu.PartitionScheme.noota_ffat=No OTA (2MB APP/2MB FATFS) +m5stack_atom.menu.PartitionScheme.noota_ffat.build.partitions=noota_ffat +m5stack_atom.menu.PartitionScheme.noota_ffat.upload.maximum_size=2097152 +m5stack_atom.menu.PartitionScheme.noota_3gffat=No OTA (1MB APP/3MB FATFS) +m5stack_atom.menu.PartitionScheme.noota_3gffat.build.partitions=noota_3gffat +m5stack_atom.menu.PartitionScheme.noota_3gffat.upload.maximum_size=1048576 +m5stack_atom.menu.PartitionScheme.min_spiffs=Minimal SPIFFS (1.9MB APP with OTA/190KB SPIFFS) +m5stack_atom.menu.PartitionScheme.min_spiffs.build.partitions=min_spiffs +m5stack_atom.menu.PartitionScheme.min_spiffs.upload.maximum_size=1966080 +m5stack_atom.menu.PartitionScheme.fatflash=16M Flash (2MB APP/12.5MB FATFS) +m5stack_atom.menu.PartitionScheme.fatflash.build.partitions=ffat +m5stack_atom.menu.PartitionScheme.fatflash.upload.maximum_size=2097152 +m5stack_atom.menu.PartitionScheme.rainmaker=RainMaker +m5stack_atom.menu.PartitionScheme.rainmaker.build.partitions=rainmaker +m5stack_atom.menu.PartitionScheme.rainmaker.upload.maximum_size=3145728 +m5stack_atom.menu.PartitionScheme.custom=Custom +m5stack_atom.menu.PartitionScheme.custom.build.partitions= +m5stack_atom.menu.PartitionScheme.custom.upload.maximum_size=16777216 + +m5stack_atom.menu.CPUFreq.240=240MHz (WiFi/BT) +m5stack_atom.menu.CPUFreq.240.build.f_cpu=240000000L +m5stack_atom.menu.CPUFreq.160=160MHz (WiFi/BT) +m5stack_atom.menu.CPUFreq.160.build.f_cpu=160000000L +m5stack_atom.menu.CPUFreq.80=80MHz (WiFi/BT) +m5stack_atom.menu.CPUFreq.80.build.f_cpu=80000000L +m5stack_atom.menu.CPUFreq.40=40MHz (40MHz XTAL) +m5stack_atom.menu.CPUFreq.40.build.f_cpu=40000000L +m5stack_atom.menu.CPUFreq.26=26MHz (26MHz XTAL) +m5stack_atom.menu.CPUFreq.26.build.f_cpu=26000000L +m5stack_atom.menu.CPUFreq.20=20MHz (40MHz XTAL) +m5stack_atom.menu.CPUFreq.20.build.f_cpu=20000000L +m5stack_atom.menu.CPUFreq.13=13MHz (26MHz XTAL) +m5stack_atom.menu.CPUFreq.13.build.f_cpu=13000000L +m5stack_atom.menu.CPUFreq.10=10MHz (40MHz XTAL) +m5stack_atom.menu.CPUFreq.10.build.f_cpu=10000000L + +m5stack_atom.menu.FlashMode.qio=QIO +m5stack_atom.menu.FlashMode.qio.build.flash_mode=dio +m5stack_atom.menu.FlashMode.qio.build.boot=qio +m5stack_atom.menu.FlashMode.dio=DIO +m5stack_atom.menu.FlashMode.dio.build.flash_mode=dio +m5stack_atom.menu.FlashMode.dio.build.boot=dio +m5stack_atom.menu.FlashMode.qout=QOUT +m5stack_atom.menu.FlashMode.qout.build.flash_mode=dout +m5stack_atom.menu.FlashMode.qout.build.boot=qout +m5stack_atom.menu.FlashMode.dout=DOUT +m5stack_atom.menu.FlashMode.dout.build.flash_mode=dout +m5stack_atom.menu.FlashMode.dout.build.boot=dout + +m5stack_atom.menu.FlashFreq.80=80MHz +m5stack_atom.menu.FlashFreq.80.build.flash_freq=80m +m5stack_atom.menu.FlashFreq.40=40MHz +m5stack_atom.menu.FlashFreq.40.build.flash_freq=40m + +m5stack_atom.menu.FlashSize.4M=4MB (32Mb) +m5stack_atom.menu.FlashSize.4M.build.flash_size=4MB + +m5stack_atom.menu.UploadSpeed.1500000=1500000 +m5stack_atom.menu.UploadSpeed.1500000.upload.speed=1500000 +m5stack_atom.menu.UploadSpeed.750000=750000 +m5stack_atom.menu.UploadSpeed.750000.upload.speed=750000 +m5stack_atom.menu.UploadSpeed.500000=500000 +m5stack_atom.menu.UploadSpeed.500000.upload.speed=500000 +m5stack_atom.menu.UploadSpeed.250000=250000 +m5stack_atom.menu.UploadSpeed.250000.upload.speed=250000 +m5stack_atom.menu.UploadSpeed.115200=115200 +m5stack_atom.menu.UploadSpeed.115200.upload.speed=115200 + +m5stack_atom.menu.LoopCore.1=Core 1 +m5stack_atom.menu.LoopCore.1.build.loop_core=-DARDUINO_RUNNING_CORE=1 +m5stack_atom.menu.LoopCore.0=Core 0 +m5stack_atom.menu.LoopCore.0.build.loop_core=-DARDUINO_RUNNING_CORE=0 + +m5stack_atom.menu.EventsCore.1=Core 1 +m5stack_atom.menu.EventsCore.1.build.event_core=-DARDUINO_EVENT_RUNNING_CORE=1 +m5stack_atom.menu.EventsCore.0=Core 0 +m5stack_atom.menu.EventsCore.0.build.event_core=-DARDUINO_EVENT_RUNNING_CORE=0 + +m5stack_atom.menu.DebugLevel.none=None +m5stack_atom.menu.DebugLevel.none.build.code_debug=0 +m5stack_atom.menu.DebugLevel.error=Error +m5stack_atom.menu.DebugLevel.error.build.code_debug=1 +m5stack_atom.menu.DebugLevel.warn=Warn +m5stack_atom.menu.DebugLevel.warn.build.code_debug=2 +m5stack_atom.menu.DebugLevel.info=Info +m5stack_atom.menu.DebugLevel.info.build.code_debug=3 +m5stack_atom.menu.DebugLevel.debug=Debug +m5stack_atom.menu.DebugLevel.debug.build.code_debug=4 +m5stack_atom.menu.DebugLevel.verbose=Verbose +m5stack_atom.menu.DebugLevel.verbose.build.code_debug=5 + +m5stack_atom.menu.EraseFlash.none=Disabled +m5stack_atom.menu.EraseFlash.none.upload.erase_cmd= +m5stack_atom.menu.EraseFlash.all=Enabled +m5stack_atom.menu.EraseFlash.all.upload.erase_cmd=-e + +############################################################## + +m5stack_atoms3.name=M5AtomS3 +m5stack_atoms3.vid.0=0x303a +m5stack_atoms3.pid.0=0x1001 +m5stack_atoms3.bootloader.tool=esptool_py +m5stack_atoms3.bootloader.tool.default=esptool_py + +m5stack_atoms3.upload.tool=esptool_py +m5stack_atoms3.upload.tool.default=esptool_py +m5stack_atoms3.upload.tool.network=esp_ota + +m5stack_atoms3.upload.maximum_size=1310720 +m5stack_atoms3.upload.maximum_data_size=327680 +m5stack_atoms3.upload.flags= +m5stack_atoms3.upload.extra_flags= +m5stack_atoms3.upload.use_1200bps_touch=false +m5stack_atoms3.upload.wait_for_upload_port=false + +m5stack_atoms3.serial.disableDTR=false +m5stack_atoms3.serial.disableRTS=false + +m5stack_atoms3.build.tarch=xtensa +m5stack_atoms3.build.bootloader_addr=0x0 +m5stack_atoms3.build.target=esp32s3 +m5stack_atoms3.build.mcu=esp32s3 +m5stack_atoms3.build.core=esp32 +m5stack_atoms3.build.variant=m5stack_atoms3 +m5stack_atoms3.build.board=M5STACK_ATOMS3 + +m5stack_atoms3.build.usb_mode=1 +m5stack_atoms3.build.cdc_on_boot=1 +m5stack_atoms3.build.msc_on_boot=0 +m5stack_atoms3.build.dfu_on_boot=0 +m5stack_atoms3.build.f_cpu=240000000L +m5stack_atoms3.build.flash_size=8MB +m5stack_atoms3.build.flash_freq=80m +m5stack_atoms3.build.flash_mode=dio +m5stack_atoms3.build.boot=qio +m5stack_atoms3.build.boot_freq=80m +m5stack_atoms3.build.partitions=default +m5stack_atoms3.build.defines= +m5stack_atoms3.build.loop_core= +m5stack_atoms3.build.event_core= +m5stack_atoms3.build.psram_type=qspi +m5stack_atoms3.build.memory_type={build.boot}_{build.psram_type} + +## IDE 2.0 Seems to not update the value +m5stack_atoms3.menu.JTAGAdapter.default=Disabled +m5stack_atoms3.menu.JTAGAdapter.default.build.copy_jtag_files=0 +m5stack_atoms3.menu.JTAGAdapter.builtin=Integrated USB JTAG +m5stack_atoms3.menu.JTAGAdapter.builtin.build.openocdscript=esp32s3-builtin.cfg +m5stack_atoms3.menu.JTAGAdapter.builtin.build.copy_jtag_files=1 +m5stack_atoms3.menu.JTAGAdapter.external=FTDI Adapter +m5stack_atoms3.menu.JTAGAdapter.external.build.openocdscript=esp32s3-ftdi.cfg +m5stack_atoms3.menu.JTAGAdapter.external.build.copy_jtag_files=1 +m5stack_atoms3.menu.JTAGAdapter.bridge=ESP USB Bridge +m5stack_atoms3.menu.JTAGAdapter.bridge.build.openocdscript=esp32s3-bridge.cfg +m5stack_atoms3.menu.JTAGAdapter.bridge.build.copy_jtag_files=1 + +m5stack_atoms3.menu.PSRAM.disabled=Disabled +m5stack_atoms3.menu.PSRAM.disabled.build.defines= +m5stack_atoms3.menu.PSRAM.disabled.build.psram_type=qspi +m5stack_atoms3.menu.PSRAM.enabled=QSPI PSRAM +m5stack_atoms3.menu.PSRAM.enabled.build.defines=-DBOARD_HAS_PSRAM +m5stack_atoms3.menu.PSRAM.enabled.build.psram_type=qspi +m5stack_atoms3.menu.PSRAM.opi=OPI PSRAM +m5stack_atoms3.menu.PSRAM.opi.build.defines=-DBOARD_HAS_PSRAM +m5stack_atoms3.menu.PSRAM.opi.build.psram_type=opi + +m5stack_atoms3.menu.FlashMode.qio=QIO 80MHz +m5stack_atoms3.menu.FlashMode.qio.build.flash_mode=dio +m5stack_atoms3.menu.FlashMode.qio.build.boot=qio +m5stack_atoms3.menu.FlashMode.qio.build.boot_freq=80m +m5stack_atoms3.menu.FlashMode.qio.build.flash_freq=80m +m5stack_atoms3.menu.FlashMode.qio120=QIO 120MHz +m5stack_atoms3.menu.FlashMode.qio120.build.flash_mode=dio +m5stack_atoms3.menu.FlashMode.qio120.build.boot=qio +m5stack_atoms3.menu.FlashMode.qio120.build.boot_freq=120m +m5stack_atoms3.menu.FlashMode.qio120.build.flash_freq=80m +m5stack_atoms3.menu.FlashMode.dio=DIO 80MHz +m5stack_atoms3.menu.FlashMode.dio.build.flash_mode=dio +m5stack_atoms3.menu.FlashMode.dio.build.boot=dio +m5stack_atoms3.menu.FlashMode.dio.build.boot_freq=80m +m5stack_atoms3.menu.FlashMode.dio.build.flash_freq=80m +m5stack_atoms3.menu.FlashMode.opi=OPI 80MHz +m5stack_atoms3.menu.FlashMode.opi.build.flash_mode=dout +m5stack_atoms3.menu.FlashMode.opi.build.boot=opi +m5stack_atoms3.menu.FlashMode.opi.build.boot_freq=80m +m5stack_atoms3.menu.FlashMode.opi.build.flash_freq=80m + + +m5stack_atoms3.menu.FlashSize.8M=8MB (64Mb) +m5stack_atoms3.menu.FlashSize.8M.build.flash_size=8MB +m5stack_atoms3.menu.FlashSize.8M.build.partitions=default_8MB + +m5stack_atoms3.menu.LoopCore.1=Core 1 +m5stack_atoms3.menu.LoopCore.1.build.loop_core=-DARDUINO_RUNNING_CORE=1 +m5stack_atoms3.menu.LoopCore.0=Core 0 +m5stack_atoms3.menu.LoopCore.0.build.loop_core=-DARDUINO_RUNNING_CORE=0 + +m5stack_atoms3.menu.EventsCore.1=Core 1 +m5stack_atoms3.menu.EventsCore.1.build.event_core=-DARDUINO_EVENT_RUNNING_CORE=1 +m5stack_atoms3.menu.EventsCore.0=Core 0 +m5stack_atoms3.menu.EventsCore.0.build.event_core=-DARDUINO_EVENT_RUNNING_CORE=0 + +m5stack_atoms3.menu.USBMode.hwcdc=Hardware CDC and JTAG +m5stack_atoms3.menu.USBMode.hwcdc.build.usb_mode=1 +m5stack_atoms3.menu.USBMode.default=USB-OTG (TinyUSB) +m5stack_atoms3.menu.USBMode.default.build.usb_mode=0 + +m5stack_atoms3.menu.CDCOnBoot.cdc=Enabled +m5stack_atoms3.menu.CDCOnBoot.cdc.build.cdc_on_boot=1 +m5stack_atoms3.menu.CDCOnBoot.default=Disabled +m5stack_atoms3.menu.CDCOnBoot.default.build.cdc_on_boot=0 + +m5stack_atoms3.menu.MSCOnBoot.default=Disabled +m5stack_atoms3.menu.MSCOnBoot.default.build.msc_on_boot=0 +m5stack_atoms3.menu.MSCOnBoot.msc=Enabled (Requires USB-OTG Mode) +m5stack_atoms3.menu.MSCOnBoot.msc.build.msc_on_boot=1 + +m5stack_atoms3.menu.DFUOnBoot.default=Disabled +m5stack_atoms3.menu.DFUOnBoot.default.build.dfu_on_boot=0 +m5stack_atoms3.menu.DFUOnBoot.dfu=Enabled (Requires USB-OTG Mode) +m5stack_atoms3.menu.DFUOnBoot.dfu.build.dfu_on_boot=1 + +m5stack_atoms3.menu.UploadMode.default=UART0 / Hardware CDC +m5stack_atoms3.menu.UploadMode.default.upload.use_1200bps_touch=false +m5stack_atoms3.menu.UploadMode.default.upload.wait_for_upload_port=false +m5stack_atoms3.menu.UploadMode.cdc=USB-OTG CDC (TinyUSB) +m5stack_atoms3.menu.UploadMode.cdc.upload.use_1200bps_touch=true +m5stack_atoms3.menu.UploadMode.cdc.upload.wait_for_upload_port=true + +m5stack_atoms3.menu.PartitionScheme.default=Default 4MB with spiffs (1.2MB APP/1.5MB SPIFFS) +m5stack_atoms3.menu.PartitionScheme.default.build.partitions=default +m5stack_atoms3.menu.PartitionScheme.defaultffat=Default 4MB with ffat (1.2MB APP/1.5MB FATFS) +m5stack_atoms3.menu.PartitionScheme.defaultffat.build.partitions=default_ffat +m5stack_atoms3.menu.PartitionScheme.default_8MB=8M with spiffs (3MB APP/1.5MB SPIFFS) +m5stack_atoms3.menu.PartitionScheme.default_8MB.build.partitions=default_8MB +m5stack_atoms3.menu.PartitionScheme.default_8MB.upload.maximum_size=3342336 +m5stack_atoms3.menu.PartitionScheme.minimal=Minimal (1.3MB APP/700KB SPIFFS) +m5stack_atoms3.menu.PartitionScheme.minimal.build.partitions=minimal +m5stack_atoms3.menu.PartitionScheme.no_ota=No OTA (2MB APP/2MB SPIFFS) +m5stack_atoms3.menu.PartitionScheme.no_ota.build.partitions=no_ota +m5stack_atoms3.menu.PartitionScheme.no_ota.upload.maximum_size=2097152 +m5stack_atoms3.menu.PartitionScheme.noota_3g=No OTA (1MB APP/3MB SPIFFS) +m5stack_atoms3.menu.PartitionScheme.noota_3g.build.partitions=noota_3g +m5stack_atoms3.menu.PartitionScheme.noota_3g.upload.maximum_size=1048576 +m5stack_atoms3.menu.PartitionScheme.noota_ffat=No OTA (2MB APP/2MB FATFS) +m5stack_atoms3.menu.PartitionScheme.noota_ffat.build.partitions=noota_ffat +m5stack_atoms3.menu.PartitionScheme.noota_ffat.upload.maximum_size=2097152 +m5stack_atoms3.menu.PartitionScheme.noota_3gffat=No OTA (1MB APP/3MB FATFS) +m5stack_atoms3.menu.PartitionScheme.noota_3gffat.build.partitions=noota_3gffat +m5stack_atoms3.menu.PartitionScheme.noota_3gffat.upload.maximum_size=1048576 +m5stack_atoms3.menu.PartitionScheme.huge_app=Huge APP (3MB No OTA/1MB SPIFFS) +m5stack_atoms3.menu.PartitionScheme.huge_app.build.partitions=huge_app +m5stack_atoms3.menu.PartitionScheme.huge_app.upload.maximum_size=3145728 +m5stack_atoms3.menu.PartitionScheme.min_spiffs=Minimal SPIFFS (1.9MB APP with OTA/190KB SPIFFS) +m5stack_atoms3.menu.PartitionScheme.min_spiffs.build.partitions=min_spiffs +m5stack_atoms3.menu.PartitionScheme.min_spiffs.upload.maximum_size=1966080 +m5stack_atoms3.menu.PartitionScheme.fatflash=16M Flash (2MB APP/12.5MB FATFS) +m5stack_atoms3.menu.PartitionScheme.fatflash.build.partitions=ffat +m5stack_atoms3.menu.PartitionScheme.fatflash.upload.maximum_size=2097152 +m5stack_atoms3.menu.PartitionScheme.app3M_fat9M_16MB=16M Flash (3MB APP/9.9MB FATFS) +m5stack_atoms3.menu.PartitionScheme.app3M_fat9M_16MB.build.partitions=app3M_fat9M_16MB +m5stack_atoms3.menu.PartitionScheme.app3M_fat9M_16MB.upload.maximum_size=3145728 +m5stack_atoms3.menu.PartitionScheme.rainmaker=RainMaker +m5stack_atoms3.menu.PartitionScheme.rainmaker.build.partitions=rainmaker +m5stack_atoms3.menu.PartitionScheme.rainmaker.upload.maximum_size=3145728 +m5stack_atoms3.menu.PartitionScheme.app5M_fat24M_32MB=32M Flash (4.8MB APP/22MB FATFS) +m5stack_atoms3.menu.PartitionScheme.app5M_fat24M_32MB.build.partitions=large_fat_32MB +m5stack_atoms3.menu.PartitionScheme.app5M_fat24M_32MB.upload.maximum_size=4718592 +m5stack_atoms3.menu.PartitionScheme.app5M_little24M_32MB=32M Flash (4.8MB APP/22MB LittleFS) +m5stack_atoms3.menu.PartitionScheme.app5M_little24M_32MB.build.partitions=large_littlefs_32MB +m5stack_atoms3.menu.PartitionScheme.app5M_little24M_32MB.upload.maximum_size=4718592 +m5stack_atoms3.menu.PartitionScheme.esp_sr_16=ESP SR 16M (3MB APP/7MB SPIFFS/2.9MB MODEL) +m5stack_atoms3.menu.PartitionScheme.esp_sr_16.upload.maximum_size=3145728 +m5stack_atoms3.menu.PartitionScheme.esp_sr_16.upload.extra_flags=0xD10000 {build.path}/srmodels.bin +m5stack_atoms3.menu.PartitionScheme.esp_sr_16.build.partitions=esp_sr_16 +m5stack_atoms3.menu.PartitionScheme.custom=Custom +m5stack_atoms3.menu.PartitionScheme.custom.build.partitions= +m5stack_atoms3.menu.PartitionScheme.custom.upload.maximum_size=16777216 + +m5stack_atoms3.menu.CPUFreq.240=240MHz (WiFi) +m5stack_atoms3.menu.CPUFreq.240.build.f_cpu=240000000L +m5stack_atoms3.menu.CPUFreq.160=160MHz (WiFi) +m5stack_atoms3.menu.CPUFreq.160.build.f_cpu=160000000L +m5stack_atoms3.menu.CPUFreq.80=80MHz (WiFi) +m5stack_atoms3.menu.CPUFreq.80.build.f_cpu=80000000L +m5stack_atoms3.menu.CPUFreq.40=40MHz +m5stack_atoms3.menu.CPUFreq.40.build.f_cpu=40000000L +m5stack_atoms3.menu.CPUFreq.20=20MHz +m5stack_atoms3.menu.CPUFreq.20.build.f_cpu=20000000L +m5stack_atoms3.menu.CPUFreq.10=10MHz +m5stack_atoms3.menu.CPUFreq.10.build.f_cpu=10000000L + +m5stack_atoms3.menu.UploadSpeed.921600=921600 +m5stack_atoms3.menu.UploadSpeed.921600.upload.speed=921600 +m5stack_atoms3.menu.UploadSpeed.115200=115200 +m5stack_atoms3.menu.UploadSpeed.115200.upload.speed=115200 +m5stack_atoms3.menu.UploadSpeed.256000.windows=256000 +m5stack_atoms3.menu.UploadSpeed.256000.upload.speed=256000 +m5stack_atoms3.menu.UploadSpeed.230400.windows.upload.speed=256000 +m5stack_atoms3.menu.UploadSpeed.230400=230400 +m5stack_atoms3.menu.UploadSpeed.230400.upload.speed=230400 +m5stack_atoms3.menu.UploadSpeed.460800.linux=460800 +m5stack_atoms3.menu.UploadSpeed.460800.macosx=460800 +m5stack_atoms3.menu.UploadSpeed.460800.upload.speed=460800 +m5stack_atoms3.menu.UploadSpeed.512000.windows=512000 +m5stack_atoms3.menu.UploadSpeed.512000.upload.speed=512000 + +m5stack_atoms3.menu.DebugLevel.none=None +m5stack_atoms3.menu.DebugLevel.none.build.code_debug=0 +m5stack_atoms3.menu.DebugLevel.error=Error +m5stack_atoms3.menu.DebugLevel.error.build.code_debug=1 +m5stack_atoms3.menu.DebugLevel.warn=Warn +m5stack_atoms3.menu.DebugLevel.warn.build.code_debug=2 +m5stack_atoms3.menu.DebugLevel.info=Info +m5stack_atoms3.menu.DebugLevel.info.build.code_debug=3 +m5stack_atoms3.menu.DebugLevel.debug=Debug +m5stack_atoms3.menu.DebugLevel.debug.build.code_debug=4 +m5stack_atoms3.menu.DebugLevel.verbose=Verbose +m5stack_atoms3.menu.DebugLevel.verbose.build.code_debug=5 + +m5stack_atoms3.menu.EraseFlash.none=Disabled +m5stack_atoms3.menu.EraseFlash.none.upload.erase_cmd= +m5stack_atoms3.menu.EraseFlash.all=Enabled +m5stack_atoms3.menu.EraseFlash.all.upload.erase_cmd=-e + +############################################################## + +m5stack_cores3.name=M5CoreS3 +m5stack_cores3.vid.0=0x303a +m5stack_cores3.pid.0=0x1001 +m5stack_cores3.bootloader.tool=esptool_py +m5stack_cores3.bootloader.tool.default=esptool_py + +m5stack_cores3.upload.tool=esptool_py +m5stack_cores3.upload.tool.default=esptool_py +m5stack_cores3.upload.tool.network=esp_ota + +m5stack_cores3.upload.maximum_size=1310720 +m5stack_cores3.upload.maximum_data_size=327680 +m5stack_cores3.upload.flags= +m5stack_cores3.upload.extra_flags= +m5stack_cores3.upload.use_1200bps_touch=false +m5stack_cores3.upload.wait_for_upload_port=false + +m5stack_cores3.serial.disableDTR=false +m5stack_cores3.serial.disableRTS=false + +m5stack_cores3.build.tarch=xtensa +m5stack_cores3.build.bootloader_addr=0x0 +m5stack_cores3.build.target=esp32s3 +m5stack_cores3.build.mcu=esp32s3 +m5stack_cores3.build.core=esp32 +m5stack_cores3.build.variant=m5stack_cores3 +m5stack_cores3.build.board=M5STACK_CORES3 + +m5stack_cores3.build.usb_mode=1 +m5stack_cores3.build.cdc_on_boot=1 +m5stack_cores3.build.msc_on_boot=0 +m5stack_cores3.build.dfu_on_boot=0 +m5stack_cores3.build.f_cpu=240000000L +m5stack_cores3.build.flash_size=16MB +m5stack_cores3.build.flash_freq=80m +m5stack_cores3.build.flash_mode=dio +m5stack_cores3.build.boot=qio +m5stack_cores3.build.boot_freq=80m +m5stack_cores3.build.partitions=default +m5stack_cores3.build.defines= +m5stack_cores3.build.loop_core= +m5stack_cores3.build.event_core= +m5stack_cores3.build.psram_type=qspi +m5stack_cores3.build.memory_type={build.boot}_{build.psram_type} ## IDE 2.0 Seems to not update the value -m5stack-atoms3.menu.JTAGAdapter.default=Disabled -m5stack-atoms3.menu.JTAGAdapter.default.build.copy_jtag_files=0 -m5stack-atoms3.menu.JTAGAdapter.builtin=Integrated USB JTAG -m5stack-atoms3.menu.JTAGAdapter.builtin.build.openocdscript=esp32s3-builtin.cfg -m5stack-atoms3.menu.JTAGAdapter.builtin.build.copy_jtag_files=1 -m5stack-atoms3.menu.JTAGAdapter.external=FTDI Adapter -m5stack-atoms3.menu.JTAGAdapter.external.build.openocdscript=esp32s3-ftdi.cfg -m5stack-atoms3.menu.JTAGAdapter.external.build.copy_jtag_files=1 -m5stack-atoms3.menu.JTAGAdapter.bridge=ESP USB Bridge -m5stack-atoms3.menu.JTAGAdapter.bridge.build.openocdscript=esp32s3-bridge.cfg -m5stack-atoms3.menu.JTAGAdapter.bridge.build.copy_jtag_files=1 - -m5stack-atoms3.menu.PSRAM.disabled=Disabled -m5stack-atoms3.menu.PSRAM.disabled.build.defines= -m5stack-atoms3.menu.PSRAM.disabled.build.psram_type=qspi -m5stack-atoms3.menu.PSRAM.enabled=QSPI PSRAM -m5stack-atoms3.menu.PSRAM.enabled.build.defines=-DBOARD_HAS_PSRAM -m5stack-atoms3.menu.PSRAM.enabled.build.psram_type=qspi -m5stack-atoms3.menu.PSRAM.opi=OPI PSRAM -m5stack-atoms3.menu.PSRAM.opi.build.defines=-DBOARD_HAS_PSRAM -m5stack-atoms3.menu.PSRAM.opi.build.psram_type=opi - -m5stack-atoms3.menu.FlashMode.qio=QIO 80MHz -m5stack-atoms3.menu.FlashMode.qio.build.flash_mode=dio -m5stack-atoms3.menu.FlashMode.qio.build.boot=qio -m5stack-atoms3.menu.FlashMode.qio.build.boot_freq=80m -m5stack-atoms3.menu.FlashMode.qio.build.flash_freq=80m -m5stack-atoms3.menu.FlashMode.qio120=QIO 120MHz -m5stack-atoms3.menu.FlashMode.qio120.build.flash_mode=dio -m5stack-atoms3.menu.FlashMode.qio120.build.boot=qio -m5stack-atoms3.menu.FlashMode.qio120.build.boot_freq=120m -m5stack-atoms3.menu.FlashMode.qio120.build.flash_freq=80m -m5stack-atoms3.menu.FlashMode.dio=DIO 80MHz -m5stack-atoms3.menu.FlashMode.dio.build.flash_mode=dio -m5stack-atoms3.menu.FlashMode.dio.build.boot=dio -m5stack-atoms3.menu.FlashMode.dio.build.boot_freq=80m -m5stack-atoms3.menu.FlashMode.dio.build.flash_freq=80m -m5stack-atoms3.menu.FlashMode.opi=OPI 80MHz -m5stack-atoms3.menu.FlashMode.opi.build.flash_mode=dout -m5stack-atoms3.menu.FlashMode.opi.build.boot=opi -m5stack-atoms3.menu.FlashMode.opi.build.boot_freq=80m -m5stack-atoms3.menu.FlashMode.opi.build.flash_freq=80m - -m5stack-atoms3.menu.FlashSize.4M=4MB (32Mb) -m5stack-atoms3.menu.FlashSize.4M.build.flash_size=4MB -m5stack-atoms3.menu.FlashSize.8M=8MB (64Mb) -m5stack-atoms3.menu.FlashSize.8M.build.flash_size=8MB -m5stack-atoms3.menu.FlashSize.8M.build.partitions=default_8MB -m5stack-atoms3.menu.FlashSize.16M=16MB (128Mb) -m5stack-atoms3.menu.FlashSize.16M.build.flash_size=16MB -#m5stack-atoms3.menu.FlashSize.32M=32MB (256Mb) -#m5stack-atoms3.menu.FlashSize.32M.build.flash_size=32MB - -m5stack-atoms3.menu.LoopCore.1=Core 1 -m5stack-atoms3.menu.LoopCore.1.build.loop_core=-DARDUINO_RUNNING_CORE=1 -m5stack-atoms3.menu.LoopCore.0=Core 0 -m5stack-atoms3.menu.LoopCore.0.build.loop_core=-DARDUINO_RUNNING_CORE=0 - -m5stack-atoms3.menu.EventsCore.1=Core 1 -m5stack-atoms3.menu.EventsCore.1.build.event_core=-DARDUINO_EVENT_RUNNING_CORE=1 -m5stack-atoms3.menu.EventsCore.0=Core 0 -m5stack-atoms3.menu.EventsCore.0.build.event_core=-DARDUINO_EVENT_RUNNING_CORE=0 - -m5stack-atoms3.menu.USBMode.hwcdc=Hardware CDC and JTAG -m5stack-atoms3.menu.USBMode.hwcdc.build.usb_mode=1 -m5stack-atoms3.menu.USBMode.default=USB-OTG (TinyUSB) -m5stack-atoms3.menu.USBMode.default.build.usb_mode=0 - -m5stack-atoms3.menu.CDCOnBoot.default=Disabled -m5stack-atoms3.menu.CDCOnBoot.default.build.cdc_on_boot=0 -m5stack-atoms3.menu.CDCOnBoot.cdc=Enabled -m5stack-atoms3.menu.CDCOnBoot.cdc.build.cdc_on_boot=1 - -m5stack-atoms3.menu.MSCOnBoot.default=Disabled -m5stack-atoms3.menu.MSCOnBoot.default.build.msc_on_boot=0 -m5stack-atoms3.menu.MSCOnBoot.msc=Enabled (Requires USB-OTG Mode) -m5stack-atoms3.menu.MSCOnBoot.msc.build.msc_on_boot=1 - -m5stack-atoms3.menu.DFUOnBoot.default=Disabled -m5stack-atoms3.menu.DFUOnBoot.default.build.dfu_on_boot=0 -m5stack-atoms3.menu.DFUOnBoot.dfu=Enabled (Requires USB-OTG Mode) -m5stack-atoms3.menu.DFUOnBoot.dfu.build.dfu_on_boot=1 - -m5stack-atoms3.menu.UploadMode.default=UART0 / Hardware CDC -m5stack-atoms3.menu.UploadMode.default.upload.use_1200bps_touch=false -m5stack-atoms3.menu.UploadMode.default.upload.wait_for_upload_port=false -m5stack-atoms3.menu.UploadMode.cdc=USB-OTG CDC (TinyUSB) -m5stack-atoms3.menu.UploadMode.cdc.upload.use_1200bps_touch=true -m5stack-atoms3.menu.UploadMode.cdc.upload.wait_for_upload_port=true - -m5stack-atoms3.menu.PartitionScheme.default=Default 4MB with spiffs (1.2MB APP/1.5MB SPIFFS) -m5stack-atoms3.menu.PartitionScheme.default.build.partitions=default -m5stack-atoms3.menu.PartitionScheme.defaultffat=Default 4MB with ffat (1.2MB APP/1.5MB FATFS) -m5stack-atoms3.menu.PartitionScheme.defaultffat.build.partitions=default_ffat -m5stack-atoms3.menu.PartitionScheme.default_8MB=8M with spiffs (3MB APP/1.5MB SPIFFS) -m5stack-atoms3.menu.PartitionScheme.default_8MB.build.partitions=default_8MB -m5stack-atoms3.menu.PartitionScheme.default_8MB.upload.maximum_size=3342336 - -m5stack-atoms3.menu.CPUFreq.240=240MHz (WiFi) -m5stack-atoms3.menu.CPUFreq.240.build.f_cpu=240000000L -m5stack-atoms3.menu.CPUFreq.160=160MHz (WiFi) -m5stack-atoms3.menu.CPUFreq.160.build.f_cpu=160000000L -m5stack-atoms3.menu.CPUFreq.80=80MHz (WiFi) -m5stack-atoms3.menu.CPUFreq.80.build.f_cpu=80000000L -m5stack-atoms3.menu.CPUFreq.40=40MHz -m5stack-atoms3.menu.CPUFreq.40.build.f_cpu=40000000L -m5stack-atoms3.menu.CPUFreq.20=20MHz -m5stack-atoms3.menu.CPUFreq.20.build.f_cpu=20000000L -m5stack-atoms3.menu.CPUFreq.10=10MHz -m5stack-atoms3.menu.CPUFreq.10.build.f_cpu=10000000L - -m5stack-atoms3.menu.UploadSpeed.921600=921600 -m5stack-atoms3.menu.UploadSpeed.921600.upload.speed=921600 -m5stack-atoms3.menu.UploadSpeed.115200=115200 -m5stack-atoms3.menu.UploadSpeed.115200.upload.speed=115200 -m5stack-atoms3.menu.UploadSpeed.256000.windows=256000 -m5stack-atoms3.menu.UploadSpeed.256000.upload.speed=256000 -m5stack-atoms3.menu.UploadSpeed.230400.windows.upload.speed=256000 -m5stack-atoms3.menu.UploadSpeed.230400=230400 -m5stack-atoms3.menu.UploadSpeed.230400.upload.speed=230400 -m5stack-atoms3.menu.UploadSpeed.460800.linux=460800 -m5stack-atoms3.menu.UploadSpeed.460800.macosx=460800 -m5stack-atoms3.menu.UploadSpeed.460800.upload.speed=460800 -m5stack-atoms3.menu.UploadSpeed.512000.windows=512000 -m5stack-atoms3.menu.UploadSpeed.512000.upload.speed=512000 - -m5stack-atoms3.menu.DebugLevel.none=None -m5stack-atoms3.menu.DebugLevel.none.build.code_debug=0 -m5stack-atoms3.menu.DebugLevel.error=Error -m5stack-atoms3.menu.DebugLevel.error.build.code_debug=1 -m5stack-atoms3.menu.DebugLevel.warn=Warn -m5stack-atoms3.menu.DebugLevel.warn.build.code_debug=2 -m5stack-atoms3.menu.DebugLevel.info=Info -m5stack-atoms3.menu.DebugLevel.info.build.code_debug=3 -m5stack-atoms3.menu.DebugLevel.debug=Debug -m5stack-atoms3.menu.DebugLevel.debug.build.code_debug=4 -m5stack-atoms3.menu.DebugLevel.verbose=Verbose -m5stack-atoms3.menu.DebugLevel.verbose.build.code_debug=5 - -m5stack-atoms3.menu.EraseFlash.none=Disabled -m5stack-atoms3.menu.EraseFlash.none.upload.erase_cmd= -m5stack-atoms3.menu.EraseFlash.all=Enabled -m5stack-atoms3.menu.EraseFlash.all.upload.erase_cmd=-e +m5stack_cores3.menu.JTAGAdapter.default=Disabled +m5stack_cores3.menu.JTAGAdapter.default.build.copy_jtag_files=0 +m5stack_cores3.menu.JTAGAdapter.builtin=Integrated USB JTAG +m5stack_cores3.menu.JTAGAdapter.builtin.build.openocdscript=esp32s3-builtin.cfg +m5stack_cores3.menu.JTAGAdapter.builtin.build.copy_jtag_files=1 +m5stack_cores3.menu.JTAGAdapter.external=FTDI Adapter +m5stack_cores3.menu.JTAGAdapter.external.build.openocdscript=esp32s3-ftdi.cfg +m5stack_cores3.menu.JTAGAdapter.external.build.copy_jtag_files=1 +m5stack_cores3.menu.JTAGAdapter.bridge=ESP USB Bridge +m5stack_cores3.menu.JTAGAdapter.bridge.build.openocdscript=esp32s3-bridge.cfg +m5stack_cores3.menu.JTAGAdapter.bridge.build.copy_jtag_files=1 + +m5stack_cores3.menu.PSRAM.enabled=QSPI PSRAM +m5stack_cores3.menu.PSRAM.enabled.build.defines=-DBOARD_HAS_PSRAM +m5stack_cores3.menu.PSRAM.enabled.build.psram_type=qspi +m5stack_cores3.menu.PSRAM.disabled=Disabled +m5stack_cores3.menu.PSRAM.disabled.build.defines= +m5stack_cores3.menu.PSRAM.disabled.build.psram_type=qspi +m5stack_cores3.menu.PSRAM.opi=OPI PSRAM +m5stack_cores3.menu.PSRAM.opi.build.defines=-DBOARD_HAS_PSRAM +m5stack_cores3.menu.PSRAM.opi.build.psram_type=opi + +m5stack_cores3.menu.FlashMode.qio=QIO 80MHz +m5stack_cores3.menu.FlashMode.qio.build.flash_mode=dio +m5stack_cores3.menu.FlashMode.qio.build.boot=qio +m5stack_cores3.menu.FlashMode.qio.build.boot_freq=80m +m5stack_cores3.menu.FlashMode.qio.build.flash_freq=80m +m5stack_cores3.menu.FlashMode.qio120=QIO 120MHz +m5stack_cores3.menu.FlashMode.qio120.build.flash_mode=dio +m5stack_cores3.menu.FlashMode.qio120.build.boot=qio +m5stack_cores3.menu.FlashMode.qio120.build.boot_freq=120m +m5stack_cores3.menu.FlashMode.qio120.build.flash_freq=80m +m5stack_cores3.menu.FlashMode.dio=DIO 80MHz +m5stack_cores3.menu.FlashMode.dio.build.flash_mode=dio +m5stack_cores3.menu.FlashMode.dio.build.boot=dio +m5stack_cores3.menu.FlashMode.dio.build.boot_freq=80m +m5stack_cores3.menu.FlashMode.dio.build.flash_freq=80m +m5stack_cores3.menu.FlashMode.opi=OPI 80MHz +m5stack_cores3.menu.FlashMode.opi.build.flash_mode=dout +m5stack_cores3.menu.FlashMode.opi.build.boot=opi +m5stack_cores3.menu.FlashMode.opi.build.boot_freq=80m +m5stack_cores3.menu.FlashMode.opi.build.flash_freq=80m + +m5stack_cores3.menu.FlashSize.16M=16MB (128Mb) +m5stack_cores3.menu.FlashSize.16M.build.flash_size=16MB +m5stack_cores3.menu.FlashSize.32M=32MB (256Mb) +m5stack_cores3.menu.FlashSize.32M.build.flash_size=32MB +m5stack_cores3.menu.FlashSize.32M.build.partitions=app5M_fat24M_32MB + +m5stack_cores3.menu.LoopCore.1=Core 1 +m5stack_cores3.menu.LoopCore.1.build.loop_core=-DARDUINO_RUNNING_CORE=1 +m5stack_cores3.menu.LoopCore.0=Core 0 +m5stack_cores3.menu.LoopCore.0.build.loop_core=-DARDUINO_RUNNING_CORE=0 + +m5stack_cores3.menu.EventsCore.1=Core 1 +m5stack_cores3.menu.EventsCore.1.build.event_core=-DARDUINO_EVENT_RUNNING_CORE=1 +m5stack_cores3.menu.EventsCore.0=Core 0 +m5stack_cores3.menu.EventsCore.0.build.event_core=-DARDUINO_EVENT_RUNNING_CORE=0 + +m5stack_cores3.menu.USBMode.hwcdc=Hardware CDC and JTAG +m5stack_cores3.menu.USBMode.hwcdc.build.usb_mode=1 +m5stack_cores3.menu.USBMode.default=USB-OTG (TinyUSB) +m5stack_cores3.menu.USBMode.default.build.usb_mode=0 + +m5stack_cores3.menu.CDCOnBoot.cdc=Enabled +m5stack_cores3.menu.CDCOnBoot.cdc.build.cdc_on_boot=1 +m5stack_cores3.menu.CDCOnBoot.default=Disabled +m5stack_cores3.menu.CDCOnBoot.default.build.cdc_on_boot=0 + +m5stack_cores3.menu.MSCOnBoot.default=Disabled +m5stack_cores3.menu.MSCOnBoot.default.build.msc_on_boot=0 +m5stack_cores3.menu.MSCOnBoot.msc=Enabled (Requires USB-OTG Mode) +m5stack_cores3.menu.MSCOnBoot.msc.build.msc_on_boot=1 + +m5stack_cores3.menu.DFUOnBoot.default=Disabled +m5stack_cores3.menu.DFUOnBoot.default.build.dfu_on_boot=0 +m5stack_cores3.menu.DFUOnBoot.dfu=Enabled (Requires USB-OTG Mode) +m5stack_cores3.menu.DFUOnBoot.dfu.build.dfu_on_boot=1 + +m5stack_cores3.menu.UploadMode.default=UART0 / Hardware CDC +m5stack_cores3.menu.UploadMode.default.upload.use_1200bps_touch=false +m5stack_cores3.menu.UploadMode.default.upload.wait_for_upload_port=false +m5stack_cores3.menu.UploadMode.cdc=USB-OTG CDC (TinyUSB) +m5stack_cores3.menu.UploadMode.cdc.upload.use_1200bps_touch=true +m5stack_cores3.menu.UploadMode.cdc.upload.wait_for_upload_port=true + +m5stack_cores3.menu.PartitionScheme.app3M_fat9M_16MB=16M Flash (3MB APP/9.9MB FATFS) +m5stack_cores3.menu.PartitionScheme.app3M_fat9M_16MB.build.partitions=app3M_fat9M_16MB +m5stack_cores3.menu.PartitionScheme.app3M_fat9M_16MB.upload.maximum_size=3145728 +m5stack_cores3.menu.PartitionScheme.default=Default 4MB with spiffs (1.2MB APP/1.5MB SPIFFS) +m5stack_cores3.menu.PartitionScheme.default.build.partitions=default +m5stack_cores3.menu.PartitionScheme.defaultffat=Default 4MB with ffat (1.2MB APP/1.5MB FATFS) +m5stack_cores3.menu.PartitionScheme.defaultffat.build.partitions=default_ffat +m5stack_cores3.menu.PartitionScheme.default_8MB=8M with spiffs (3MB APP/1.5MB SPIFFS) +m5stack_cores3.menu.PartitionScheme.default_8MB.build.partitions=default_8MB +m5stack_cores3.menu.PartitionScheme.default_8MB.upload.maximum_size=3342336 +m5stack_cores3.menu.PartitionScheme.minimal=Minimal (1.3MB APP/700KB SPIFFS) +m5stack_cores3.menu.PartitionScheme.minimal.build.partitions=minimal +m5stack_cores3.menu.PartitionScheme.no_ota=No OTA (2MB APP/2MB SPIFFS) +m5stack_cores3.menu.PartitionScheme.no_ota.build.partitions=no_ota +m5stack_cores3.menu.PartitionScheme.no_ota.upload.maximum_size=2097152 +m5stack_cores3.menu.PartitionScheme.noota_3g=No OTA (1MB APP/3MB SPIFFS) +m5stack_cores3.menu.PartitionScheme.noota_3g.build.partitions=noota_3g +m5stack_cores3.menu.PartitionScheme.noota_3g.upload.maximum_size=1048576 +m5stack_cores3.menu.PartitionScheme.noota_ffat=No OTA (2MB APP/2MB FATFS) +m5stack_cores3.menu.PartitionScheme.noota_ffat.build.partitions=noota_ffat +m5stack_cores3.menu.PartitionScheme.noota_ffat.upload.maximum_size=2097152 +m5stack_cores3.menu.PartitionScheme.noota_3gffat=No OTA (1MB APP/3MB FATFS) +m5stack_cores3.menu.PartitionScheme.noota_3gffat.build.partitions=noota_3gffat +m5stack_cores3.menu.PartitionScheme.noota_3gffat.upload.maximum_size=1048576 +m5stack_cores3.menu.PartitionScheme.huge_app=Huge APP (3MB No OTA/1MB SPIFFS) +m5stack_cores3.menu.PartitionScheme.huge_app.build.partitions=huge_app +m5stack_cores3.menu.PartitionScheme.huge_app.upload.maximum_size=3145728 +m5stack_cores3.menu.PartitionScheme.min_spiffs=Minimal SPIFFS (1.9MB APP with OTA/190KB SPIFFS) +m5stack_cores3.menu.PartitionScheme.min_spiffs.build.partitions=min_spiffs +m5stack_cores3.menu.PartitionScheme.min_spiffs.upload.maximum_size=1966080 +m5stack_cores3.menu.PartitionScheme.fatflash=16M Flash (2MB APP/12.5MB FATFS) +m5stack_cores3.menu.PartitionScheme.fatflash.build.partitions=ffat +m5stack_cores3.menu.PartitionScheme.fatflash.upload.maximum_size=2097152 +m5stack_cores3.menu.PartitionScheme.rainmaker=RainMaker +m5stack_cores3.menu.PartitionScheme.rainmaker.build.partitions=rainmaker +m5stack_cores3.menu.PartitionScheme.rainmaker.upload.maximum_size=3145728 +m5stack_cores3.menu.PartitionScheme.app5M_fat24M_32MB=32M Flash (4.8MB APP/22MB FATFS) +m5stack_cores3.menu.PartitionScheme.app5M_fat24M_32MB.build.partitions=large_fat_32MB +m5stack_cores3.menu.PartitionScheme.app5M_fat24M_32MB.upload.maximum_size=4718592 +m5stack_cores3.menu.PartitionScheme.app5M_little24M_32MB=32M Flash (4.8MB APP/22MB LittleFS) +m5stack_cores3.menu.PartitionScheme.app5M_little24M_32MB.build.partitions=large_littlefs_32MB +m5stack_cores3.menu.PartitionScheme.app5M_little24M_32MB.upload.maximum_size=4718592 +m5stack_cores3.menu.PartitionScheme.esp_sr_16=ESP SR 16M (3MB APP/7MB SPIFFS/2.9MB MODEL) +m5stack_cores3.menu.PartitionScheme.esp_sr_16.upload.maximum_size=3145728 +m5stack_cores3.menu.PartitionScheme.esp_sr_16.upload.extra_flags=0xD10000 {build.path}/srmodels.bin +m5stack_cores3.menu.PartitionScheme.esp_sr_16.build.partitions=esp_sr_16 +m5stack_cores3.menu.PartitionScheme.custom=Custom +m5stack_cores3.menu.PartitionScheme.custom.build.partitions= +m5stack_cores3.menu.PartitionScheme.custom.upload.maximum_size=16777216 + +m5stack_cores3.menu.PartitionScheme.factory_4apps=16MB+Factory (4x 3MB APP/2MB SPIFFS) +m5stack_cores3.menu.PartitionScheme.factory_4apps.build.custom_partitions=m5stack_partitions_16MB_factory_4_apps +m5stack_cores3.menu.PartitionScheme.factory_4apps.upload.maximum_size=3145728 +m5stack_cores3.menu.PartitionScheme.factory_6apps=16MB+Factory (6x 2MB APP/2MB SPIFFS) +m5stack_cores3.menu.PartitionScheme.factory_6apps.build.custom_partitions=m5stack_partitions_16MB_factory_6_apps +m5stack_cores3.menu.PartitionScheme.factory_6apps.upload.maximum_size=2097152 + +m5stack_cores3.menu.CPUFreq.240=240MHz (WiFi) +m5stack_cores3.menu.CPUFreq.240.build.f_cpu=240000000L +m5stack_cores3.menu.CPUFreq.160=160MHz (WiFi) +m5stack_cores3.menu.CPUFreq.160.build.f_cpu=160000000L +m5stack_cores3.menu.CPUFreq.80=80MHz (WiFi) +m5stack_cores3.menu.CPUFreq.80.build.f_cpu=80000000L +m5stack_cores3.menu.CPUFreq.40=40MHz +m5stack_cores3.menu.CPUFreq.40.build.f_cpu=40000000L +m5stack_cores3.menu.CPUFreq.20=20MHz +m5stack_cores3.menu.CPUFreq.20.build.f_cpu=20000000L +m5stack_cores3.menu.CPUFreq.10=10MHz +m5stack_cores3.menu.CPUFreq.10.build.f_cpu=10000000L + +m5stack_cores3.menu.UploadSpeed.921600=921600 +m5stack_cores3.menu.UploadSpeed.921600.upload.speed=921600 +m5stack_cores3.menu.UploadSpeed.115200=115200 +m5stack_cores3.menu.UploadSpeed.115200.upload.speed=115200 +m5stack_cores3.menu.UploadSpeed.256000.windows=256000 +m5stack_cores3.menu.UploadSpeed.256000.upload.speed=256000 +m5stack_cores3.menu.UploadSpeed.230400.windows.upload.speed=256000 +m5stack_cores3.menu.UploadSpeed.230400=230400 +m5stack_cores3.menu.UploadSpeed.230400.upload.speed=230400 +m5stack_cores3.menu.UploadSpeed.460800.linux=460800 +m5stack_cores3.menu.UploadSpeed.460800.macosx=460800 +m5stack_cores3.menu.UploadSpeed.460800.upload.speed=460800 +m5stack_cores3.menu.UploadSpeed.512000.windows=512000 +m5stack_cores3.menu.UploadSpeed.512000.upload.speed=512000 + +m5stack_cores3.menu.DebugLevel.none=None +m5stack_cores3.menu.DebugLevel.none.build.code_debug=0 +m5stack_cores3.menu.DebugLevel.error=Error +m5stack_cores3.menu.DebugLevel.error.build.code_debug=1 +m5stack_cores3.menu.DebugLevel.warn=Warn +m5stack_cores3.menu.DebugLevel.warn.build.code_debug=2 +m5stack_cores3.menu.DebugLevel.info=Info +m5stack_cores3.menu.DebugLevel.info.build.code_debug=3 +m5stack_cores3.menu.DebugLevel.debug=Debug +m5stack_cores3.menu.DebugLevel.debug.build.code_debug=4 +m5stack_cores3.menu.DebugLevel.verbose=Verbose +m5stack_cores3.menu.DebugLevel.verbose.build.code_debug=5 + +m5stack_cores3.menu.EraseFlash.none=Disabled +m5stack_cores3.menu.EraseFlash.none.upload.erase_cmd= +m5stack_cores3.menu.EraseFlash.all=Enabled +m5stack_cores3.menu.EraseFlash.all.upload.erase_cmd=-e ############################################################## -m5stack-core2.name=M5Stack-Core2 - -m5stack-core2.bootloader.tool=esptool_py -m5stack-core2.bootloader.tool.default=esptool_py - -m5stack-core2.upload.tool=esptool_py -m5stack-core2.upload.tool.default=esptool_py -m5stack-core2.upload.tool.network=esp_ota - -m5stack-core2.upload.maximum_size=6553600 -m5stack-core2.upload.maximum_data_size=4521984 -m5stack-core2.upload.wait_for_upload_port=true -m5stack-core2.upload.flags= -m5stack-core2.upload.extra_flags= - -m5stack-core2.serial.disableDTR=true -m5stack-core2.serial.disableRTS=true - -m5stack-core2.build.tarch=xtensa -m5stack-core2.build.bootloader_addr=0x1000 -m5stack-core2.build.target=esp32 -m5stack-core2.build.mcu=esp32 -m5stack-core2.build.core=esp32 -m5stack-core2.build.variant=m5stack_core2 -m5stack-core2.build.board=M5STACK_Core2 - -m5stack-core2.build.f_cpu=240000000L -m5stack-core2.build.flash_size=16MB -m5stack-core2.build.flash_freq=80m -m5stack-core2.build.flash_mode=dio -m5stack-core2.build.boot=qio -m5stack-core2.build.partitions=default_16MB -m5stack-core2.build.defines= - -m5stack-core2.menu.PSRAM.enabled=Enabled -m5stack-core2.menu.PSRAM.enabled.build.defines=-DBOARD_HAS_PSRAM -mfix-esp32-psram-cache-issue -mfix-esp32-psram-cache-strategy=memw -m5stack-core2.menu.PSRAM.enabled.build.extra_libs= -m5stack-core2.menu.PSRAM.disabled=Disabled -m5stack-core2.menu.PSRAM.disabled.build.defines= -m5stack-core2.menu.PSRAM.disabled.build.extra_libs= - -m5stack-core2.menu.PartitionScheme.default=Default (2 x 6.5 MB app, 3.6 MB SPIFFS) -m5stack-core2.menu.PartitionScheme.default.build.partitions=default_16MB -m5stack-core2.menu.PartitionScheme.default.upload.maximum_size=6553600 -m5stack-core2.menu.PartitionScheme.large_spiffs=Large SPIFFS (7 MB) -m5stack-core2.menu.PartitionScheme.large_spiffs.build.partitions=large_spiffs_16MB -m5stack-core2.menu.PartitionScheme.large_spiffs.upload.maximum_size=4685824 - -m5stack-core2.menu.PartitionScheme.minimal=Minimal (1.3MB APP/700KB SPIFFS) -m5stack-core2.menu.PartitionScheme.minimal.build.partitions=minimal -m5stack-core2.menu.PartitionScheme.no_ota=No OTA (2MB APP/2MB SPIFFS) -m5stack-core2.menu.PartitionScheme.no_ota.build.partitions=no_ota -m5stack-core2.menu.PartitionScheme.no_ota.upload.maximum_size=2097152 -m5stack-core2.menu.PartitionScheme.noota_3g=No OTA (1MB APP/3MB SPIFFS) -m5stack-core2.menu.PartitionScheme.noota_3g.build.partitions=noota_3g -m5stack-core2.menu.PartitionScheme.noota_3g.upload.maximum_size=1048576 -m5stack-core2.menu.PartitionScheme.huge_app=Huge APP (3MB No OTA/1MB SPIFFS) -m5stack-core2.menu.PartitionScheme.huge_app.build.partitions=huge_app -m5stack-core2.menu.PartitionScheme.huge_app.upload.maximum_size=3145728 -m5stack-core2.menu.PartitionScheme.min_spiffs=Minimal SPIFFS (1.9MB APP with OTA/190KB SPIFFS) -m5stack-core2.menu.PartitionScheme.min_spiffs.build.partitions=min_spiffs -m5stack-core2.menu.PartitionScheme.min_spiffs.upload.maximum_size=1966080 - -m5stack-core2.menu.CPUFreq.240=240MHz (WiFi/BT) -m5stack-core2.menu.CPUFreq.240.build.f_cpu=240000000L -m5stack-core2.menu.CPUFreq.160=160MHz (WiFi/BT) -m5stack-core2.menu.CPUFreq.160.build.f_cpu=160000000L -m5stack-core2.menu.CPUFreq.80=80MHz (WiFi/BT) -m5stack-core2.menu.CPUFreq.80.build.f_cpu=80000000L -m5stack-core2.menu.CPUFreq.40=40MHz (40MHz XTAL) -m5stack-core2.menu.CPUFreq.40.build.f_cpu=40000000L -m5stack-core2.menu.CPUFreq.26=26MHz (26MHz XTAL) -m5stack-core2.menu.CPUFreq.26.build.f_cpu=26000000L -m5stack-core2.menu.CPUFreq.20=20MHz (40MHz XTAL) -m5stack-core2.menu.CPUFreq.20.build.f_cpu=20000000L -m5stack-core2.menu.CPUFreq.13=13MHz (26MHz XTAL) -m5stack-core2.menu.CPUFreq.13.build.f_cpu=13000000L -m5stack-core2.menu.CPUFreq.10=10MHz (40MHz XTAL) -m5stack-core2.menu.CPUFreq.10.build.f_cpu=10000000L - -m5stack-core2.menu.UploadSpeed.921600=921600 -m5stack-core2.menu.UploadSpeed.921600.upload.speed=921600 -m5stack-core2.menu.UploadSpeed.115200=115200 -m5stack-core2.menu.UploadSpeed.115200.upload.speed=115200 -m5stack-core2.menu.UploadSpeed.256000.windows=256000 -m5stack-core2.menu.UploadSpeed.256000.upload.speed=256000 -m5stack-core2.menu.UploadSpeed.230400.windows.upload.speed=256000 -m5stack-core2.menu.UploadSpeed.230400=230400 -m5stack-core2.menu.UploadSpeed.230400.upload.speed=230400 -m5stack-core2.menu.UploadSpeed.460800.linux=460800 -m5stack-core2.menu.UploadSpeed.460800.macosx=460800 -m5stack-core2.menu.UploadSpeed.460800.upload.speed=460800 -m5stack-core2.menu.UploadSpeed.512000.windows=512000 -m5stack-core2.menu.UploadSpeed.512000.upload.speed=512000 -m5stack-core2.menu.UploadSpeed.1500000=1500000 -m5stack-core2.menu.UploadSpeed.1500000.upload.speed=1500000 - -m5stack-core2.menu.DebugLevel.none=None -m5stack-core2.menu.DebugLevel.none.build.code_debug=0 -m5stack-core2.menu.DebugLevel.error=Error -m5stack-core2.menu.DebugLevel.error.build.code_debug=1 -m5stack-core2.menu.DebugLevel.warn=Warn -m5stack-core2.menu.DebugLevel.warn.build.code_debug=2 -m5stack-core2.menu.DebugLevel.info=Info -m5stack-core2.menu.DebugLevel.info.build.code_debug=3 -m5stack-core2.menu.DebugLevel.debug=Debug -m5stack-core2.menu.DebugLevel.debug.build.code_debug=4 -m5stack-core2.menu.DebugLevel.verbose=Verbose -m5stack-core2.menu.DebugLevel.verbose.build.code_debug=5 - -m5stack-core2.menu.EraseFlash.none=Disabled -m5stack-core2.menu.EraseFlash.none.upload.erase_cmd= -m5stack-core2.menu.EraseFlash.all=Enabled -m5stack-core2.menu.EraseFlash.all.upload.erase_cmd=-e +m5stack_timer_cam.name=M5TimerCAM + +m5stack_timer_cam.bootloader.tool=esptool_py +m5stack_timer_cam.bootloader.tool.default=esptool_py + +m5stack_timer_cam.upload.tool=esptool_py +m5stack_timer_cam.upload.tool.default=esptool_py +m5stack_timer_cam.upload.tool.network=esp_ota + +m5stack_timer_cam.upload.maximum_size=1310720 +m5stack_timer_cam.upload.maximum_data_size=327680 + +m5stack_timer_cam.upload.flags= +m5stack_timer_cam.upload.extra_flags= + +m5stack_timer_cam.serial.disableDTR=true +m5stack_timer_cam.serial.disableRTS=true + +m5stack_timer_cam.build.tarch=xtensa +m5stack_timer_cam.build.bootloader_addr=0x1000 +m5stack_timer_cam.build.target=esp32 +m5stack_timer_cam.build.mcu=esp32 +m5stack_timer_cam.build.core=esp32 +m5stack_timer_cam.build.variant=m5stack_timer_cam +m5stack_timer_cam.build.board=M5STACK_TIMER_CAM + +m5stack_timer_cam.build.f_cpu=240000000L +m5stack_timer_cam.build.flash_size=4MB +m5stack_timer_cam.build.flash_freq=80m +m5stack_timer_cam.build.flash_mode=dio +m5stack_timer_cam.build.boot=dio +m5stack_timer_cam.build.partitions=default +m5stack_timer_cam.build.defines= +m5stack_timer_cam.build.loop_core= +m5stack_timer_cam.build.event_core= + +m5stack_timer_cam.menu.PSRAM.enabled=Enabled +m5stack_timer_cam.menu.PSRAM.enabled.build.defines=-DBOARD_HAS_PSRAM -mfix-esp32-psram-cache-issue -mfix-esp32-psram-cache-strategy=memw +m5stack_timer_cam.menu.PSRAM.enabled.build.extra_libs= +m5stack_timer_cam.menu.PSRAM.disabled=Disabled +m5stack_timer_cam.menu.PSRAM.disabled.build.defines= +m5stack_timer_cam.menu.PSRAM.disabled.build.extra_libs= + +m5stack_timer_cam.menu.PartitionScheme.default=Default 4MB with spiffs (1.2MB APP/1.5MB SPIFFS) +m5stack_timer_cam.menu.PartitionScheme.default.build.partitions=default +m5stack_timer_cam.menu.PartitionScheme.defaultffat=Default 4MB with ffat (1.2MB APP/1.5MB FATFS) +m5stack_timer_cam.menu.PartitionScheme.defaultffat.build.partitions=default_ffat +m5stack_timer_cam.menu.PartitionScheme.default_8MB=8M with spiffs (3MB APP/1.5MB SPIFFS) +m5stack_timer_cam.menu.PartitionScheme.default_8MB.build.partitions=default_8MB +m5stack_timer_cam.menu.PartitionScheme.default_8MB.upload.maximum_size=3342336 +m5stack_timer_cam.menu.PartitionScheme.minimal=Minimal (1.3MB APP/700KB SPIFFS) +m5stack_timer_cam.menu.PartitionScheme.minimal.build.partitions=minimal +m5stack_timer_cam.menu.PartitionScheme.no_ota=No OTA (2MB APP/2MB SPIFFS) +m5stack_timer_cam.menu.PartitionScheme.no_ota.build.partitions=no_ota +m5stack_timer_cam.menu.PartitionScheme.no_ota.upload.maximum_size=2097152 +m5stack_timer_cam.menu.PartitionScheme.noota_3g=No OTA (1MB APP/3MB SPIFFS) +m5stack_timer_cam.menu.PartitionScheme.noota_3g.build.partitions=noota_3g +m5stack_timer_cam.menu.PartitionScheme.noota_3g.upload.maximum_size=1048576 +m5stack_timer_cam.menu.PartitionScheme.noota_ffat=No OTA (2MB APP/2MB FATFS) +m5stack_timer_cam.menu.PartitionScheme.noota_ffat.build.partitions=noota_ffat +m5stack_timer_cam.menu.PartitionScheme.noota_ffat.upload.maximum_size=2097152 +m5stack_timer_cam.menu.PartitionScheme.noota_3gffat=No OTA (1MB APP/3MB FATFS) +m5stack_timer_cam.menu.PartitionScheme.noota_3gffat.build.partitions=noota_3gffat +m5stack_timer_cam.menu.PartitionScheme.noota_3gffat.upload.maximum_size=1048576 +m5stack_timer_cam.menu.PartitionScheme.huge_app=Huge APP (3MB No OTA/1MB SPIFFS) +m5stack_timer_cam.menu.PartitionScheme.huge_app.build.partitions=huge_app +m5stack_timer_cam.menu.PartitionScheme.huge_app.upload.maximum_size=3145728 +m5stack_timer_cam.menu.PartitionScheme.min_spiffs=Minimal SPIFFS (1.9MB APP with OTA/190KB SPIFFS) +m5stack_timer_cam.menu.PartitionScheme.min_spiffs.build.partitions=min_spiffs +m5stack_timer_cam.menu.PartitionScheme.min_spiffs.upload.maximum_size=1966080 + +m5stack_timer_cam.menu.CPUFreq.240=240MHz (WiFi/BT) +m5stack_timer_cam.menu.CPUFreq.240.build.f_cpu=240000000L +m5stack_timer_cam.menu.CPUFreq.160=160MHz (WiFi/BT) +m5stack_timer_cam.menu.CPUFreq.160.build.f_cpu=160000000L +m5stack_timer_cam.menu.CPUFreq.80=80MHz (WiFi/BT) +m5stack_timer_cam.menu.CPUFreq.80.build.f_cpu=80000000L +m5stack_timer_cam.menu.CPUFreq.40=40MHz (40MHz XTAL) +m5stack_timer_cam.menu.CPUFreq.40.build.f_cpu=40000000L +m5stack_timer_cam.menu.CPUFreq.26=26MHz (26MHz XTAL) +m5stack_timer_cam.menu.CPUFreq.26.build.f_cpu=26000000L +m5stack_timer_cam.menu.CPUFreq.20=20MHz (40MHz XTAL) +m5stack_timer_cam.menu.CPUFreq.20.build.f_cpu=20000000L +m5stack_timer_cam.menu.CPUFreq.13=13MHz (26MHz XTAL) +m5stack_timer_cam.menu.CPUFreq.13.build.f_cpu=13000000L +m5stack_timer_cam.menu.CPUFreq.10=10MHz (40MHz XTAL) +m5stack_timer_cam.menu.CPUFreq.10.build.f_cpu=10000000L + +m5stack_timer_cam.menu.FlashMode.qio=QIO +m5stack_timer_cam.menu.FlashMode.qio.build.flash_mode=dio +m5stack_timer_cam.menu.FlashMode.qio.build.boot=qio +m5stack_timer_cam.menu.FlashMode.dio=DIO +m5stack_timer_cam.menu.FlashMode.dio.build.flash_mode=dio +m5stack_timer_cam.menu.FlashMode.dio.build.boot=dio +m5stack_timer_cam.menu.FlashMode.qout=QOUT +m5stack_timer_cam.menu.FlashMode.qout.build.flash_mode=dout +m5stack_timer_cam.menu.FlashMode.qout.build.boot=qout +m5stack_timer_cam.menu.FlashMode.dout=DOUT +m5stack_timer_cam.menu.FlashMode.dout.build.flash_mode=dout +m5stack_timer_cam.menu.FlashMode.dout.build.boot=dout + +m5stack_timer_cam.menu.FlashFreq.80=80MHz +m5stack_timer_cam.menu.FlashFreq.80.build.flash_freq=80m +m5stack_timer_cam.menu.FlashFreq.40=40MHz +m5stack_timer_cam.menu.FlashFreq.40.build.flash_freq=40m + +m5stack_timer_cam.menu.FlashSize.4M=4MB (32Mb) +m5stack_timer_cam.menu.FlashSize.4M.build.flash_size=4MB + +m5stack_timer_cam.menu.UploadSpeed.1500000=1500000 +m5stack_timer_cam.menu.UploadSpeed.1500000.upload.speed=1500000 +m5stack_timer_cam.menu.UploadSpeed.750000=750000 +m5stack_timer_cam.menu.UploadSpeed.750000.upload.speed=750000 +m5stack_timer_cam.menu.UploadSpeed.500000=500000 +m5stack_timer_cam.menu.UploadSpeed.500000.upload.speed=500000 +m5stack_timer_cam.menu.UploadSpeed.250000=250000 +m5stack_timer_cam.menu.UploadSpeed.250000.upload.speed=250000 +m5stack_timer_cam.menu.UploadSpeed.115200=115200 +m5stack_timer_cam.menu.UploadSpeed.115200.upload.speed=115200 + +m5stack_timer_cam.menu.LoopCore.1=Core 1 +m5stack_timer_cam.menu.LoopCore.1.build.loop_core=-DARDUINO_RUNNING_CORE=1 +m5stack_timer_cam.menu.LoopCore.0=Core 0 +m5stack_timer_cam.menu.LoopCore.0.build.loop_core=-DARDUINO_RUNNING_CORE=0 + +m5stack_timer_cam.menu.EventsCore.1=Core 1 +m5stack_timer_cam.menu.EventsCore.1.build.event_core=-DARDUINO_EVENT_RUNNING_CORE=1 +m5stack_timer_cam.menu.EventsCore.0=Core 0 +m5stack_timer_cam.menu.EventsCore.0.build.event_core=-DARDUINO_EVENT_RUNNING_CORE=0 + +m5stack_timer_cam.menu.DebugLevel.none=None +m5stack_timer_cam.menu.DebugLevel.none.build.code_debug=0 +m5stack_timer_cam.menu.DebugLevel.error=Error +m5stack_timer_cam.menu.DebugLevel.error.build.code_debug=1 +m5stack_timer_cam.menu.DebugLevel.warn=Warn +m5stack_timer_cam.menu.DebugLevel.warn.build.code_debug=2 +m5stack_timer_cam.menu.DebugLevel.info=Info +m5stack_timer_cam.menu.DebugLevel.info.build.code_debug=3 +m5stack_timer_cam.menu.DebugLevel.debug=Debug +m5stack_timer_cam.menu.DebugLevel.debug.build.code_debug=4 +m5stack_timer_cam.menu.DebugLevel.verbose=Verbose +m5stack_timer_cam.menu.DebugLevel.verbose.build.code_debug=5 + +m5stack_timer_cam.menu.EraseFlash.none=Disabled +m5stack_timer_cam.menu.EraseFlash.none.upload.erase_cmd= +m5stack_timer_cam.menu.EraseFlash.all=Enabled +m5stack_timer_cam.menu.EraseFlash.all.upload.erase_cmd=-e + ############################################################## -m5stack-cores3.name=M5Stack-CoreS3 -m5stack-cores3.vid.0=0x303a -m5stack-cores3.pid.0=0x1001 - -m5stack-cores3.bootloader.tool=esptool_py -m5stack-cores3.bootloader.tool.default=esptool_py - -m5stack-cores3.upload.tool=esptool_py -m5stack-cores3.upload.tool.default=esptool_py -m5stack-cores3.upload.tool.network=esp_ota - -m5stack-cores3.upload.maximum_size=1310720 -m5stack-cores3.upload.maximum_data_size=327680 -m5stack-cores3.upload.speed=921600 -m5stack-cores3.upload.flags= -m5stack-cores3.upload.extra_flags= -m5stack-cores3.upload.use_1200bps_touch=false -m5stack-cores3.upload.wait_for_upload_port=false - -m5stack-cores3.serial.disableDTR=false -m5stack-cores3.serial.disableRTS=false - -m5stack-cores3.build.tarch=xtensa -m5stack-cores3.build.bootloader_addr=0x0 -m5stack-cores3.build.target=esp32s3 -m5stack-cores3.build.mcu=esp32s3 -m5stack-cores3.build.core=esp32 -m5stack-cores3.build.variant=m5stack_cores3 -m5stack-cores3.build.board=M5STACK_CORES3 - -m5stack-cores3.build.usb_mode=1 -m5stack-cores3.build.cdc_on_boot=1 -m5stack-cores3.build.msc_on_boot=0 -m5stack-cores3.build.dfu_on_boot=0 -m5stack-cores3.build.f_cpu=240000000L -m5stack-cores3.build.flash_size=16MB -m5stack-cores3.build.flash_freq=80m -m5stack-cores3.build.flash_mode=dio -m5stack-cores3.build.boot=qio -m5stack-cores3.build.partitions=default_16MB -m5stack-cores3.build.defines=-DBOARD_HAS_PSRAM -m5stack-cores3.build.psram_type=qspi -m5stack-cores3.build.memory_type=qio_qspi -m5stack-cores3.build.loop_core=-DARDUINO_RUNNING_CORE=1 -m5stack-cores3.build.event_core=-DARDUINO_EVENT_RUNNING_CORE=1 - -m5stack-cores3.menu.JTAGAdapter.default=Disabled -m5stack-cores3.menu.JTAGAdapter.default.build.copy_jtag_files=0 -m5stack-cores3.menu.JTAGAdapter.builtin=Integrated USB JTAG -m5stack-cores3.menu.JTAGAdapter.builtin.build.openocdscript=esp32s3-builtin.cfg -m5stack-cores3.menu.JTAGAdapter.builtin.build.copy_jtag_files=1 -m5stack-cores3.menu.JTAGAdapter.external=FTDI Adapter -m5stack-cores3.menu.JTAGAdapter.external.build.openocdscript=esp32s3-ftdi.cfg -m5stack-cores3.menu.JTAGAdapter.external.build.copy_jtag_files=1 -m5stack-cores3.menu.JTAGAdapter.bridge=ESP USB Bridge -m5stack-cores3.menu.JTAGAdapter.bridge.build.openocdscript=esp32s3-bridge.cfg -m5stack-cores3.menu.JTAGAdapter.bridge.build.copy_jtag_files=1 - -m5stack-cores3.menu.FlashSize.16M=16MB (128Mb) -m5stack-cores3.menu.FlashSize.16M.build.flash_size=16MB -m5stack-cores3.menu.FlashSize.16M.build.partitions=default_16MB -m5stack-cores3.menu.FlashSize.4M=4MB (32Mb) -m5stack-cores3.menu.FlashSize.4M.build.flash_size=4MB -m5stack-cores3.menu.FlashSize.8M=8MB (64Mb) -m5stack-cores3.menu.FlashSize.8M.build.flash_size=8MB -m5stack-cores3.menu.FlashSize.8M.build.partitions=default_8MB - -m5stack-cores3.menu.LoopCore.1=Core 1 -m5stack-cores3.menu.LoopCore.1.build.loop_core=-DARDUINO_RUNNING_CORE=1 -m5stack-cores3.menu.LoopCore.0=Core 0 -m5stack-cores3.menu.LoopCore.0.build.loop_core=-DARDUINO_RUNNING_CORE=0 - -m5stack-cores3.menu.EventsCore.1=Core 1 -m5stack-cores3.menu.EventsCore.1.build.event_core=-DARDUINO_EVENT_RUNNING_CORE=1 -m5stack-cores3.menu.EventsCore.0=Core 0 -m5stack-cores3.menu.EventsCore.0.build.event_core=-DARDUINO_EVENT_RUNNING_CORE=0 - -m5stack-cores3.menu.USBMode.hwcdc=Hardware CDC and JTAG -m5stack-cores3.menu.USBMode.hwcdc.build.usb_mode=1 -m5stack-cores3.menu.USBMode.hwcdc.upload.use_1200bps_touch=false -m5stack-cores3.menu.USBMode.hwcdc.upload.wait_for_upload_port=false -m5stack-cores3.menu.USBMode.default=USB-OTG -m5stack-cores3.menu.USBMode.default.build.usb_mode=0 -m5stack-cores3.menu.USBMode.default.upload.use_1200bps_touch=true -m5stack-cores3.menu.USBMode.default.upload.wait_for_upload_port=true - -m5stack-cores3.menu.CDCOnBoot.cdc=Enabled -m5stack-cores3.menu.CDCOnBoot.cdc.build.cdc_on_boot=1 -m5stack-cores3.menu.CDCOnBoot.default=Disabled -m5stack-cores3.menu.CDCOnBoot.default.build.cdc_on_boot=0 - -m5stack-cores3.menu.MSCOnBoot.default=Disabled -m5stack-cores3.menu.MSCOnBoot.default.build.msc_on_boot=0 -m5stack-cores3.menu.MSCOnBoot.msc=Enabled (Requires USB-OTG Mode) -m5stack-cores3.menu.MSCOnBoot.msc.build.msc_on_boot=1 - -m5stack-cores3.menu.DFUOnBoot.default=Disabled -m5stack-cores3.menu.DFUOnBoot.default.build.dfu_on_boot=0 -m5stack-cores3.menu.DFUOnBoot.dfu=Enabled (Requires USB-OTG Mode) -m5stack-cores3.menu.DFUOnBoot.dfu.build.dfu_on_boot=1 - -m5stack-cores3.menu.UploadMode.default=UART0 / Hardware CDC -m5stack-cores3.menu.UploadMode.default.upload.use_1200bps_touch=false -m5stack-cores3.menu.UploadMode.default.upload.wait_for_upload_port=false -m5stack-cores3.menu.UploadMode.cdc=USB-OTG CDC (TinyUSB) -m5stack-cores3.menu.UploadMode.cdc.upload.use_1200bps_touch=true -m5stack-cores3.menu.UploadMode.cdc.upload.wait_for_upload_port=true - -m5stack-cores3.menu.PartitionScheme.default_16MB=Default 16MB with spiffs (2x 6.5 MB APP/3.6MB SPIFFS) -m5stack-cores3.menu.PartitionScheme.default_16MB.build.partitions=default_16MB -m5stack-cores3.menu.PartitionScheme.default_16MB.upload.maximum_size=6553600 -m5stack-cores3.menu.PartitionScheme.default=4MB with spiffs (2x 1.2MB APP/1.5MB SPIFFS) -m5stack-cores3.menu.PartitionScheme.default.build.partitions=default -m5stack-cores3.menu.PartitionScheme.defaultffat=4MB with ffat (2x 1.2MB APP/1.5MB FATFS) -m5stack-cores3.menu.PartitionScheme.defaultffat.build.partitions=default_ffat -m5stack-cores3.menu.PartitionScheme.default_8MB=8M with spiffs (2x 3MB APP/1.5MB SPIFFS) -m5stack-cores3.menu.PartitionScheme.default_8MB.build.partitions=default_8MB -m5stack-cores3.menu.PartitionScheme.default_8MB.upload.maximum_size=3342336 -m5stack-cores3.menu.PartitionScheme.large_spiffs=16MB with Large SPIFFS (2x 4MB APP/7MB SPIFFS) -m5stack-cores3.menu.PartitionScheme.large_spiffs.build.partitions=large_spiffs_16MB -m5stack-cores3.menu.PartitionScheme.large_spiffs.upload.maximum_size=4685824 -m5stack-cores3.menu.PartitionScheme.factory_4apps=16MB+Factory (4x 3MB APP/2MB SPIFFS) -m5stack-cores3.menu.PartitionScheme.factory_4apps.build.custom_partitions=partitions_16MB_factory_4_apps -# m5stack-cores3.menu.PartitionScheme.factory_4apps.upload.extra_flags=0xc10000 "{runtime.platform.path}/variants/{build.variant}/firmware.bin" -m5stack-cores3.menu.PartitionScheme.factory_4apps.upload.maximum_size=3145728 -m5stack-cores3.menu.PartitionScheme.factory_6apps=16MB+Factory (6x 2MB APP/2MB SPIFFS) -m5stack-cores3.menu.PartitionScheme.factory_6apps.build.custom_partitions=partitions_16MB_factory_6_apps -# m5stack-cores3.menu.PartitionScheme.factory_6apps.upload.extra_flags=0xc10000 "{runtime.platform.path}/variants/{build.variant}/firmware.bin" -m5stack-cores3.menu.PartitionScheme.factory_6apps.upload.maximum_size=2097152 - -m5stack-cores3.menu.CPUFreq.240=240MHz (WiFi) -m5stack-cores3.menu.CPUFreq.240.build.f_cpu=240000000L -m5stack-cores3.menu.CPUFreq.160=160MHz (WiFi) -m5stack-cores3.menu.CPUFreq.160.build.f_cpu=160000000L -m5stack-cores3.menu.CPUFreq.80=80MHz (WiFi) -m5stack-cores3.menu.CPUFreq.80.build.f_cpu=80000000L -m5stack-cores3.menu.CPUFreq.40=40MHz -m5stack-cores3.menu.CPUFreq.40.build.f_cpu=40000000L -m5stack-cores3.menu.CPUFreq.20=20MHz -m5stack-cores3.menu.CPUFreq.20.build.f_cpu=20000000L -m5stack-cores3.menu.CPUFreq.10=10MHz -m5stack-cores3.menu.CPUFreq.10.build.f_cpu=10000000L - -m5stack-cores3.menu.UploadSpeed.921600=921600 -m5stack-cores3.menu.UploadSpeed.921600.upload.speed=921600 -m5stack-cores3.menu.UploadSpeed.115200=115200 -m5stack-cores3.menu.UploadSpeed.115200.upload.speed=115200 -m5stack-cores3.menu.UploadSpeed.256000.windows=256000 -m5stack-cores3.menu.UploadSpeed.256000.upload.speed=256000 -m5stack-cores3.menu.UploadSpeed.230400.windows.upload.speed=256000 -m5stack-cores3.menu.UploadSpeed.230400=230400 -m5stack-cores3.menu.UploadSpeed.230400.upload.speed=230400 -m5stack-cores3.menu.UploadSpeed.460800.linux=460800 -m5stack-cores3.menu.UploadSpeed.460800.macosx=460800 -m5stack-cores3.menu.UploadSpeed.460800.upload.speed=460800 -m5stack-cores3.menu.UploadSpeed.512000.windows=512000 -m5stack-cores3.menu.UploadSpeed.512000.upload.speed=512000 -m5stack-cores3.menu.UploadSpeed.1500000=1500000 -m5stack-cores3.menu.UploadSpeed.1500000.upload.speed=1500000 - -m5stack-cores3.menu.DebugLevel.none=None -m5stack-cores3.menu.DebugLevel.none.build.code_debug=0 -m5stack-cores3.menu.DebugLevel.error=Error -m5stack-cores3.menu.DebugLevel.error.build.code_debug=1 -m5stack-cores3.menu.DebugLevel.warn=Warn -m5stack-cores3.menu.DebugLevel.warn.build.code_debug=2 -m5stack-cores3.menu.DebugLevel.info=Info -m5stack-cores3.menu.DebugLevel.info.build.code_debug=3 -m5stack-cores3.menu.DebugLevel.debug=Debug -m5stack-cores3.menu.DebugLevel.debug.build.code_debug=4 -m5stack-cores3.menu.DebugLevel.verbose=Verbose -m5stack-cores3.menu.DebugLevel.verbose.build.code_debug=5 - -m5stack-cores3.menu.EraseFlash.none=Disabled -m5stack-cores3.menu.EraseFlash.none.upload.erase_cmd= -m5stack-cores3.menu.EraseFlash.all=Enabled -m5stack-cores3.menu.EraseFlash.all.upload.erase_cmd=-e + +m5stack_unit_cam.name=M5UnitCAM + +m5stack_unit_cam.bootloader.tool=esptool_py +m5stack_unit_cam.bootloader.tool.default=esptool_py + +m5stack_unit_cam.upload.tool=esptool_py +m5stack_unit_cam.upload.tool.default=esptool_py +m5stack_unit_cam.upload.tool.network=esp_ota + +m5stack_unit_cam.upload.maximum_size=1310720 +m5stack_unit_cam.upload.maximum_data_size=327680 + +m5stack_unit_cam.upload.flags= +m5stack_unit_cam.upload.extra_flags= + +m5stack_unit_cam.serial.disableDTR=true +m5stack_unit_cam.serial.disableRTS=true + +m5stack_unit_cam.build.tarch=xtensa +m5stack_unit_cam.build.bootloader_addr=0x1000 +m5stack_unit_cam.build.target=esp32 +m5stack_unit_cam.build.mcu=esp32 +m5stack_unit_cam.build.core=esp32 +m5stack_unit_cam.build.variant=m5stack_unit_cam +m5stack_unit_cam.build.board=M5STACK_UNIT_CAM + +m5stack_unit_cam.build.f_cpu=240000000L +m5stack_unit_cam.build.flash_size=4MB +m5stack_unit_cam.build.flash_freq=80m +m5stack_unit_cam.build.flash_mode=dio +m5stack_unit_cam.build.boot=dio +m5stack_unit_cam.build.partitions=default +m5stack_unit_cam.build.defines= +m5stack_unit_cam.build.loop_core= +m5stack_unit_cam.build.event_core= + +m5stack_unit_cam.menu.PSRAM.enabled=Enabled +m5stack_unit_cam.menu.PSRAM.enabled.build.defines=-DBOARD_HAS_PSRAM -mfix-esp32-psram-cache-issue -mfix-esp32-psram-cache-strategy=memw +m5stack_unit_cam.menu.PSRAM.enabled.build.extra_libs= +m5stack_unit_cam.menu.PSRAM.disabled=Disabled +m5stack_unit_cam.menu.PSRAM.disabled.build.defines= +m5stack_unit_cam.menu.PSRAM.disabled.build.extra_libs= + +m5stack_unit_cam.menu.PartitionScheme.default=Default 4MB with spiffs (1.2MB APP/1.5MB SPIFFS) +m5stack_unit_cam.menu.PartitionScheme.default.build.partitions=default +m5stack_unit_cam.menu.PartitionScheme.defaultffat=Default 4MB with ffat (1.2MB APP/1.5MB FATFS) +m5stack_unit_cam.menu.PartitionScheme.defaultffat.build.partitions=default_ffat +m5stack_unit_cam.menu.PartitionScheme.default_8MB=8M with spiffs (3MB APP/1.5MB SPIFFS) +m5stack_unit_cam.menu.PartitionScheme.default_8MB.build.partitions=default_8MB +m5stack_unit_cam.menu.PartitionScheme.default_8MB.upload.maximum_size=3342336 +m5stack_unit_cam.menu.PartitionScheme.minimal=Minimal (1.3MB APP/700KB SPIFFS) +m5stack_unit_cam.menu.PartitionScheme.minimal.build.partitions=minimal +m5stack_unit_cam.menu.PartitionScheme.no_ota=No OTA (2MB APP/2MB SPIFFS) +m5stack_unit_cam.menu.PartitionScheme.no_ota.build.partitions=no_ota +m5stack_unit_cam.menu.PartitionScheme.no_ota.upload.maximum_size=2097152 +m5stack_unit_cam.menu.PartitionScheme.noota_3g=No OTA (1MB APP/3MB SPIFFS) +m5stack_unit_cam.menu.PartitionScheme.noota_3g.build.partitions=noota_3g +m5stack_unit_cam.menu.PartitionScheme.noota_3g.upload.maximum_size=1048576 +m5stack_unit_cam.menu.PartitionScheme.noota_ffat=No OTA (2MB APP/2MB FATFS) +m5stack_unit_cam.menu.PartitionScheme.noota_ffat.build.partitions=noota_ffat +m5stack_unit_cam.menu.PartitionScheme.noota_ffat.upload.maximum_size=2097152 +m5stack_unit_cam.menu.PartitionScheme.noota_3gffat=No OTA (1MB APP/3MB FATFS) +m5stack_unit_cam.menu.PartitionScheme.noota_3gffat.build.partitions=noota_3gffat +m5stack_unit_cam.menu.PartitionScheme.noota_3gffat.upload.maximum_size=1048576 +m5stack_unit_cam.menu.PartitionScheme.huge_app=Huge APP (3MB No OTA/1MB SPIFFS) +m5stack_unit_cam.menu.PartitionScheme.huge_app.build.partitions=huge_app +m5stack_unit_cam.menu.PartitionScheme.huge_app.upload.maximum_size=3145728 +m5stack_unit_cam.menu.PartitionScheme.min_spiffs=Minimal SPIFFS (1.9MB APP with OTA/190KB SPIFFS) +m5stack_unit_cam.menu.PartitionScheme.min_spiffs.build.partitions=min_spiffs +m5stack_unit_cam.menu.PartitionScheme.min_spiffs.upload.maximum_size=1966080 + +m5stack_unit_cam.menu.CPUFreq.240=240MHz (WiFi/BT) +m5stack_unit_cam.menu.CPUFreq.240.build.f_cpu=240000000L +m5stack_unit_cam.menu.CPUFreq.160=160MHz (WiFi/BT) +m5stack_unit_cam.menu.CPUFreq.160.build.f_cpu=160000000L +m5stack_unit_cam.menu.CPUFreq.80=80MHz (WiFi/BT) +m5stack_unit_cam.menu.CPUFreq.80.build.f_cpu=80000000L +m5stack_unit_cam.menu.CPUFreq.40=40MHz (40MHz XTAL) +m5stack_unit_cam.menu.CPUFreq.40.build.f_cpu=40000000L +m5stack_unit_cam.menu.CPUFreq.26=26MHz (26MHz XTAL) +m5stack_unit_cam.menu.CPUFreq.26.build.f_cpu=26000000L +m5stack_unit_cam.menu.CPUFreq.20=20MHz (40MHz XTAL) +m5stack_unit_cam.menu.CPUFreq.20.build.f_cpu=20000000L +m5stack_unit_cam.menu.CPUFreq.13=13MHz (26MHz XTAL) +m5stack_unit_cam.menu.CPUFreq.13.build.f_cpu=13000000L +m5stack_unit_cam.menu.CPUFreq.10=10MHz (40MHz XTAL) +m5stack_unit_cam.menu.CPUFreq.10.build.f_cpu=10000000L + +m5stack_unit_cam.menu.FlashMode.qio=QIO +m5stack_unit_cam.menu.FlashMode.qio.build.flash_mode=dio +m5stack_unit_cam.menu.FlashMode.qio.build.boot=qio +m5stack_unit_cam.menu.FlashMode.dio=DIO +m5stack_unit_cam.menu.FlashMode.dio.build.flash_mode=dio +m5stack_unit_cam.menu.FlashMode.dio.build.boot=dio +m5stack_unit_cam.menu.FlashMode.qout=QOUT +m5stack_unit_cam.menu.FlashMode.qout.build.flash_mode=dout +m5stack_unit_cam.menu.FlashMode.qout.build.boot=qout +m5stack_unit_cam.menu.FlashMode.dout=DOUT +m5stack_unit_cam.menu.FlashMode.dout.build.flash_mode=dout +m5stack_unit_cam.menu.FlashMode.dout.build.boot=dout + +m5stack_unit_cam.menu.FlashFreq.80=80MHz +m5stack_unit_cam.menu.FlashFreq.80.build.flash_freq=80m +m5stack_unit_cam.menu.FlashFreq.40=40MHz +m5stack_unit_cam.menu.FlashFreq.40.build.flash_freq=40m + +m5stack_unit_cam.menu.FlashSize.4M=4MB (32Mb) +m5stack_unit_cam.menu.FlashSize.4M.build.flash_size=4MB + +m5stack_unit_cam.menu.UploadSpeed.1500000=1500000 +m5stack_unit_cam.menu.UploadSpeed.1500000.upload.speed=1500000 +m5stack_unit_cam.menu.UploadSpeed.750000=750000 +m5stack_unit_cam.menu.UploadSpeed.750000.upload.speed=750000 +m5stack_unit_cam.menu.UploadSpeed.500000=500000 +m5stack_unit_cam.menu.UploadSpeed.500000.upload.speed=500000 +m5stack_unit_cam.menu.UploadSpeed.250000=250000 +m5stack_unit_cam.menu.UploadSpeed.250000.upload.speed=250000 +m5stack_unit_cam.menu.UploadSpeed.115200=115200 +m5stack_unit_cam.menu.UploadSpeed.115200.upload.speed=115200 + +m5stack_unit_cam.menu.LoopCore.1=Core 1 +m5stack_unit_cam.menu.LoopCore.1.build.loop_core=-DARDUINO_RUNNING_CORE=1 +m5stack_unit_cam.menu.LoopCore.0=Core 0 +m5stack_unit_cam.menu.LoopCore.0.build.loop_core=-DARDUINO_RUNNING_CORE=0 + +m5stack_unit_cam.menu.EventsCore.1=Core 1 +m5stack_unit_cam.menu.EventsCore.1.build.event_core=-DARDUINO_EVENT_RUNNING_CORE=1 +m5stack_unit_cam.menu.EventsCore.0=Core 0 +m5stack_unit_cam.menu.EventsCore.0.build.event_core=-DARDUINO_EVENT_RUNNING_CORE=0 + +m5stack_unit_cam.menu.DebugLevel.none=None +m5stack_unit_cam.menu.DebugLevel.none.build.code_debug=0 +m5stack_unit_cam.menu.DebugLevel.error=Error +m5stack_unit_cam.menu.DebugLevel.error.build.code_debug=1 +m5stack_unit_cam.menu.DebugLevel.warn=Warn +m5stack_unit_cam.menu.DebugLevel.warn.build.code_debug=2 +m5stack_unit_cam.menu.DebugLevel.info=Info +m5stack_unit_cam.menu.DebugLevel.info.build.code_debug=3 +m5stack_unit_cam.menu.DebugLevel.debug=Debug +m5stack_unit_cam.menu.DebugLevel.debug.build.code_debug=4 +m5stack_unit_cam.menu.DebugLevel.verbose=Verbose +m5stack_unit_cam.menu.DebugLevel.verbose.build.code_debug=5 + +m5stack_unit_cam.menu.EraseFlash.none=Disabled +m5stack_unit_cam.menu.EraseFlash.none.upload.erase_cmd= +m5stack_unit_cam.menu.EraseFlash.all=Enabled +m5stack_unit_cam.menu.EraseFlash.all.upload.erase_cmd=-e ############################################################## -m5stack-timer-cam.name=M5Stack-Timer-CAM - -m5stack-timer-cam.bootloader.tool=esptool_py -m5stack-timer-cam.bootloader.tool.default=esptool_py - -m5stack-timer-cam.upload.tool=esptool_py -m5stack-timer-cam.upload.tool.default=esptool_py -m5stack-timer-cam.upload.tool.network=esp_ota - -m5stack-timer-cam.upload.maximum_size=1310720 -m5stack-timer-cam.upload.maximum_data_size=327680 -m5stack-timer-cam.upload.wait_for_upload_port=true -m5stack-timer-cam.upload.flags= -m5stack-timer-cam.upload.extra_flags= - -m5stack-timer-cam.serial.disableDTR=true -m5stack-timer-cam.serial.disableRTS=true - -m5stack-timer-cam.build.tarch=xtensa -m5stack-timer-cam.build.bootloader_addr=0x1000 -m5stack-timer-cam.build.target=esp32 -m5stack-timer-cam.build.mcu=esp32 -m5stack-timer-cam.build.core=esp32 -m5stack-timer-cam.build.variant=m5stack_timer_cam -m5stack-timer-cam.build.board=M5Stack-Timer-CAM - -m5stack-timer-cam.build.f_cpu=240000000L -m5stack-timer-cam.build.flash_size=4MB -m5stack-timer-cam.build.flash_freq=80m -m5stack-timer-cam.build.flash_mode=dio -m5stack-timer-cam.build.boot=dio -m5stack-timer-cam.build.partitions=default -m5stack-timer-cam.build.defines= - -m5stack-timer-cam.menu.PSRAM.enabled=Enabled -m5stack-timer-cam.menu.PSRAM.enabled.build.defines=-DBOARD_HAS_PSRAM -mfix-esp32-psram-cache-issue -mfix-esp32-psram-cache-strategy=memw -m5stack-timer-cam.menu.PSRAM.enabled.build.extra_libs= -m5stack-timer-cam.menu.PSRAM.disabled=Disabled -m5stack-timer-cam.menu.PSRAM.disabled.build.defines= -m5stack-timer-cam.menu.PSRAM.disabled.build.extra_libs= - -m5stack-timer-cam.menu.PartitionScheme.default=Default(3MB No OTA/1MB SPIFFS) -m5stack-timer-cam.menu.PartitionScheme.default.build.partitions=huge_app -m5stack-timer-cam.menu.PartitionScheme.default.upload.maximum_size=3145728 - -m5stack-timer-cam.menu.PartitionScheme.no_ota=No OTA (Large APP) -m5stack-timer-cam.menu.PartitionScheme.no_ota.build.partitions=no_ota -m5stack-timer-cam.menu.PartitionScheme.no_ota.upload.maximum_size=2097152 - -m5stack-timer-cam.menu.PartitionScheme.min_spiffs=Minimal SPIFFS (Large APPS with OTA) -m5stack-timer-cam.menu.PartitionScheme.min_spiffs.build.partitions=min_spiffs -m5stack-timer-cam.menu.PartitionScheme.min_spiffs.upload.maximum_size=1966080 - -m5stack-timer-cam.menu.PartitionScheme.no_ota=No OTA (2MB APP/2MB SPIFFS) -m5stack-timer-cam.menu.PartitionScheme.no_ota.build.partitions=no_ota -m5stack-timer-cam.menu.PartitionScheme.no_ota.upload.maximum_size=2097152 - -m5stack-timer-cam.menu.PartitionScheme.min_spiffs=Minimal SPIFFS (1.9MB APP with OTA/190KB SPIFFS) -m5stack-timer-cam.menu.PartitionScheme.min_spiffs.build.partitions=min_spiffs -m5stack-timer-cam.menu.PartitionScheme.min_spiffs.upload.maximum_size=1966080 - -m5stack-timer-cam.menu.CPUFreq.240=240MHz (WiFi/BT) -m5stack-timer-cam.menu.CPUFreq.240.build.f_cpu=240000000L -m5stack-timer-cam.menu.CPUFreq.160=160MHz (WiFi/BT) -m5stack-timer-cam.menu.CPUFreq.160.build.f_cpu=160000000L -m5stack-timer-cam.menu.CPUFreq.80=80MHz (WiFi/BT) -m5stack-timer-cam.menu.CPUFreq.80.build.f_cpu=80000000L -m5stack-timer-cam.menu.CPUFreq.40=40MHz (40MHz XTAL) -m5stack-timer-cam.menu.CPUFreq.40.build.f_cpu=40000000L -m5stack-timer-cam.menu.CPUFreq.26=26MHz (26MHz XTAL) -m5stack-timer-cam.menu.CPUFreq.26.build.f_cpu=26000000L -m5stack-timer-cam.menu.CPUFreq.20=20MHz (40MHz XTAL) -m5stack-timer-cam.menu.CPUFreq.20.build.f_cpu=20000000L -m5stack-timer-cam.menu.CPUFreq.13=13MHz (26MHz XTAL) -m5stack-timer-cam.menu.CPUFreq.13.build.f_cpu=13000000L -m5stack-timer-cam.menu.CPUFreq.10=10MHz (40MHz XTAL) -m5stack-timer-cam.menu.CPUFreq.10.build.f_cpu=10000000L - -m5stack-timer-cam.menu.UploadSpeed.1500000=1500000 -m5stack-timer-cam.menu.UploadSpeed.1500000.upload.speed=1500000 -m5stack-timer-cam.menu.UploadSpeed.750000=750000 -m5stack-timer-cam.menu.UploadSpeed.750000.upload.speed=750000 -m5stack-timer-cam.menu.UploadSpeed.500000=500000 -m5stack-timer-cam.menu.UploadSpeed.500000.upload.speed=500000 -m5stack-timer-cam.menu.UploadSpeed.250000=250000 -m5stack-timer-cam.menu.UploadSpeed.250000.upload.speed=250000 -m5stack-timer-cam.menu.UploadSpeed.115200=115200 -m5stack-timer-cam.menu.UploadSpeed.115200.upload.speed=115200 - -m5stack-timer-cam.menu.DebugLevel.none=None -m5stack-timer-cam.menu.DebugLevel.none.build.code_debug=0 -m5stack-timer-cam.menu.DebugLevel.error=Error -m5stack-timer-cam.menu.DebugLevel.error.build.code_debug=1 -m5stack-timer-cam.menu.DebugLevel.warn=Warn -m5stack-timer-cam.menu.DebugLevel.warn.build.code_debug=2 -m5stack-timer-cam.menu.DebugLevel.info=Info -m5stack-timer-cam.menu.DebugLevel.info.build.code_debug=3 -m5stack-timer-cam.menu.DebugLevel.debug=Debug -m5stack-timer-cam.menu.DebugLevel.debug.build.code_debug=4 -m5stack-timer-cam.menu.DebugLevel.verbose=Verbose -m5stack-timer-cam.menu.DebugLevel.verbose.build.code_debug=5 - -m5stack-timer-cam.menu.EraseFlash.none=Disabled -m5stack-timer-cam.menu.EraseFlash.none.upload.erase_cmd= -m5stack-timer-cam.menu.EraseFlash.all=Enabled -m5stack-timer-cam.menu.EraseFlash.all.upload.erase_cmd=-e +m5stack_unit_cams3.name=M5UnitCAMS3 +m5stack_unit_cams3.vid.0=0x303a +m5stack_unit_cams3.pid.0=0x1001 +m5stack_unit_cams3.bootloader.tool=esptool_py +m5stack_unit_cams3.bootloader.tool.default=esptool_py + +m5stack_unit_cams3.upload.tool=esptool_py +m5stack_unit_cams3.upload.tool.default=esptool_py +m5stack_unit_cams3.upload.tool.network=esp_ota + +m5stack_unit_cams3.upload.maximum_size=1310720 +m5stack_unit_cams3.upload.maximum_data_size=327680 +m5stack_unit_cams3.upload.flags= +m5stack_unit_cams3.upload.extra_flags= +m5stack_unit_cams3.upload.use_1200bps_touch=false +m5stack_unit_cams3.upload.wait_for_upload_port=false + +m5stack_unit_cams3.serial.disableDTR=false +m5stack_unit_cams3.serial.disableRTS=false + +m5stack_unit_cams3.build.tarch=xtensa +m5stack_unit_cams3.build.bootloader_addr=0x0 +m5stack_unit_cams3.build.target=esp32s3 +m5stack_unit_cams3.build.mcu=esp32s3 +m5stack_unit_cams3.build.core=esp32 +m5stack_unit_cams3.build.variant=m5stack_unit_cams3 +m5stack_unit_cams3.build.board=M5STACK_UNIT_CAMS3 + +m5stack_unit_cams3.build.usb_mode=1 +m5stack_unit_cams3.build.cdc_on_boot=1 +m5stack_unit_cams3.build.msc_on_boot=0 +m5stack_unit_cams3.build.dfu_on_boot=0 +m5stack_unit_cams3.build.f_cpu=240000000L +m5stack_unit_cams3.build.flash_size=16MB +m5stack_unit_cams3.build.flash_freq=80m +m5stack_unit_cams3.build.flash_mode=dio +m5stack_unit_cams3.build.boot=qio +m5stack_unit_cams3.build.boot_freq=80m +m5stack_unit_cams3.build.partitions=default +m5stack_unit_cams3.build.defines= +m5stack_unit_cams3.build.loop_core= +m5stack_unit_cams3.build.event_core= +m5stack_unit_cams3.build.psram_type=qspi +m5stack_unit_cams3.build.memory_type={build.boot}_{build.psram_type} + +## IDE 2.0 Seems to not update the value +m5stack_unit_cams3.menu.JTAGAdapter.default=Disabled +m5stack_unit_cams3.menu.JTAGAdapter.default.build.copy_jtag_files=0 +m5stack_unit_cams3.menu.JTAGAdapter.builtin=Integrated USB JTAG +m5stack_unit_cams3.menu.JTAGAdapter.builtin.build.openocdscript=esp32s3-builtin.cfg +m5stack_unit_cams3.menu.JTAGAdapter.builtin.build.copy_jtag_files=1 +m5stack_unit_cams3.menu.JTAGAdapter.external=FTDI Adapter +m5stack_unit_cams3.menu.JTAGAdapter.external.build.openocdscript=esp32s3-ftdi.cfg +m5stack_unit_cams3.menu.JTAGAdapter.external.build.copy_jtag_files=1 +m5stack_unit_cams3.menu.JTAGAdapter.bridge=ESP USB Bridge +m5stack_unit_cams3.menu.JTAGAdapter.bridge.build.openocdscript=esp32s3-bridge.cfg +m5stack_unit_cams3.menu.JTAGAdapter.bridge.build.copy_jtag_files=1 + +m5stack_unit_cams3.menu.PSRAM.enabled=QSPI PSRAM +m5stack_unit_cams3.menu.PSRAM.enabled.build.defines=-DBOARD_HAS_PSRAM +m5stack_unit_cams3.menu.PSRAM.enabled.build.psram_type=qspi +m5stack_unit_cams3.menu.PSRAM.disabled=Disabled +m5stack_unit_cams3.menu.PSRAM.disabled.build.defines= +m5stack_unit_cams3.menu.PSRAM.disabled.build.psram_type=qspi +m5stack_unit_cams3.menu.PSRAM.opi=OPI PSRAM +m5stack_unit_cams3.menu.PSRAM.opi.build.defines=-DBOARD_HAS_PSRAM +m5stack_unit_cams3.menu.PSRAM.opi.build.psram_type=opi + +m5stack_unit_cams3.menu.FlashMode.qio=QIO 80MHz +m5stack_unit_cams3.menu.FlashMode.qio.build.flash_mode=dio +m5stack_unit_cams3.menu.FlashMode.qio.build.boot=qio +m5stack_unit_cams3.menu.FlashMode.qio.build.boot_freq=80m +m5stack_unit_cams3.menu.FlashMode.qio.build.flash_freq=80m +m5stack_unit_cams3.menu.FlashMode.qio120=QIO 120MHz +m5stack_unit_cams3.menu.FlashMode.qio120.build.flash_mode=dio +m5stack_unit_cams3.menu.FlashMode.qio120.build.boot=qio +m5stack_unit_cams3.menu.FlashMode.qio120.build.boot_freq=120m +m5stack_unit_cams3.menu.FlashMode.qio120.build.flash_freq=80m +m5stack_unit_cams3.menu.FlashMode.dio=DIO 80MHz +m5stack_unit_cams3.menu.FlashMode.dio.build.flash_mode=dio +m5stack_unit_cams3.menu.FlashMode.dio.build.boot=dio +m5stack_unit_cams3.menu.FlashMode.dio.build.boot_freq=80m +m5stack_unit_cams3.menu.FlashMode.dio.build.flash_freq=80m +m5stack_unit_cams3.menu.FlashMode.opi=OPI 80MHz +m5stack_unit_cams3.menu.FlashMode.opi.build.flash_mode=dout +m5stack_unit_cams3.menu.FlashMode.opi.build.boot=opi +m5stack_unit_cams3.menu.FlashMode.opi.build.boot_freq=80m +m5stack_unit_cams3.menu.FlashMode.opi.build.flash_freq=80m + +m5stack_unit_cams3.menu.FlashSize.16M=16MB (128Mb) +m5stack_unit_cams3.menu.FlashSize.16M.build.flash_size=16MB +m5stack_unit_cams3.menu.FlashSize.32M=32MB (256Mb) +m5stack_unit_cams3.menu.FlashSize.32M.build.flash_size=32MB +m5stack_unit_cams3.menu.FlashSize.32M.build.partitions=app5M_fat24M_32MB + +m5stack_unit_cams3.menu.LoopCore.1=Core 1 +m5stack_unit_cams3.menu.LoopCore.1.build.loop_core=-DARDUINO_RUNNING_CORE=1 +m5stack_unit_cams3.menu.LoopCore.0=Core 0 +m5stack_unit_cams3.menu.LoopCore.0.build.loop_core=-DARDUINO_RUNNING_CORE=0 + +m5stack_unit_cams3.menu.EventsCore.1=Core 1 +m5stack_unit_cams3.menu.EventsCore.1.build.event_core=-DARDUINO_EVENT_RUNNING_CORE=1 +m5stack_unit_cams3.menu.EventsCore.0=Core 0 +m5stack_unit_cams3.menu.EventsCore.0.build.event_core=-DARDUINO_EVENT_RUNNING_CORE=0 + +m5stack_unit_cams3.menu.USBMode.hwcdc=Hardware CDC and JTAG +m5stack_unit_cams3.menu.USBMode.hwcdc.build.usb_mode=1 +m5stack_unit_cams3.menu.USBMode.default=USB-OTG (TinyUSB) +m5stack_unit_cams3.menu.USBMode.default.build.usb_mode=0 + +m5stack_unit_cams3.menu.CDCOnBoot.cdc=Enabled +m5stack_unit_cams3.menu.CDCOnBoot.cdc.build.cdc_on_boot=1 +m5stack_unit_cams3.menu.CDCOnBoot.default=Disabled +m5stack_unit_cams3.menu.CDCOnBoot.default.build.cdc_on_boot=0 + +m5stack_unit_cams3.menu.MSCOnBoot.default=Disabled +m5stack_unit_cams3.menu.MSCOnBoot.default.build.msc_on_boot=0 +m5stack_unit_cams3.menu.MSCOnBoot.msc=Enabled (Requires USB-OTG Mode) +m5stack_unit_cams3.menu.MSCOnBoot.msc.build.msc_on_boot=1 + +m5stack_unit_cams3.menu.DFUOnBoot.default=Disabled +m5stack_unit_cams3.menu.DFUOnBoot.default.build.dfu_on_boot=0 +m5stack_unit_cams3.menu.DFUOnBoot.dfu=Enabled (Requires USB-OTG Mode) +m5stack_unit_cams3.menu.DFUOnBoot.dfu.build.dfu_on_boot=1 + +m5stack_unit_cams3.menu.UploadMode.default=UART0 / Hardware CDC +m5stack_unit_cams3.menu.UploadMode.default.upload.use_1200bps_touch=false +m5stack_unit_cams3.menu.UploadMode.default.upload.wait_for_upload_port=false +m5stack_unit_cams3.menu.UploadMode.cdc=USB-OTG CDC (TinyUSB) +m5stack_unit_cams3.menu.UploadMode.cdc.upload.use_1200bps_touch=true +m5stack_unit_cams3.menu.UploadMode.cdc.upload.wait_for_upload_port=true + +m5stack_unit_cams3.menu.PartitionScheme.app3M_fat9M_16MB=16M Flash (3MB APP/9.9MB FATFS) +m5stack_unit_cams3.menu.PartitionScheme.app3M_fat9M_16MB.build.partitions=app3M_fat9M_16MB +m5stack_unit_cams3.menu.PartitionScheme.app3M_fat9M_16MB.upload.maximum_size=3145728 +m5stack_unit_cams3.menu.PartitionScheme.default=Default 4MB with spiffs (1.2MB APP/1.5MB SPIFFS) +m5stack_unit_cams3.menu.PartitionScheme.default.build.partitions=default +m5stack_unit_cams3.menu.PartitionScheme.defaultffat=Default 4MB with ffat (1.2MB APP/1.5MB FATFS) +m5stack_unit_cams3.menu.PartitionScheme.defaultffat.build.partitions=default_ffat +m5stack_unit_cams3.menu.PartitionScheme.default_8MB=8M with spiffs (3MB APP/1.5MB SPIFFS) +m5stack_unit_cams3.menu.PartitionScheme.default_8MB.build.partitions=default_8MB +m5stack_unit_cams3.menu.PartitionScheme.default_8MB.upload.maximum_size=3342336 +m5stack_unit_cams3.menu.PartitionScheme.minimal=Minimal (1.3MB APP/700KB SPIFFS) +m5stack_unit_cams3.menu.PartitionScheme.minimal.build.partitions=minimal +m5stack_unit_cams3.menu.PartitionScheme.no_ota=No OTA (2MB APP/2MB SPIFFS) +m5stack_unit_cams3.menu.PartitionScheme.no_ota.build.partitions=no_ota +m5stack_unit_cams3.menu.PartitionScheme.no_ota.upload.maximum_size=2097152 +m5stack_unit_cams3.menu.PartitionScheme.noota_3g=No OTA (1MB APP/3MB SPIFFS) +m5stack_unit_cams3.menu.PartitionScheme.noota_3g.build.partitions=noota_3g +m5stack_unit_cams3.menu.PartitionScheme.noota_3g.upload.maximum_size=1048576 +m5stack_unit_cams3.menu.PartitionScheme.noota_ffat=No OTA (2MB APP/2MB FATFS) +m5stack_unit_cams3.menu.PartitionScheme.noota_ffat.build.partitions=noota_ffat +m5stack_unit_cams3.menu.PartitionScheme.noota_ffat.upload.maximum_size=2097152 +m5stack_unit_cams3.menu.PartitionScheme.noota_3gffat=No OTA (1MB APP/3MB FATFS) +m5stack_unit_cams3.menu.PartitionScheme.noota_3gffat.build.partitions=noota_3gffat +m5stack_unit_cams3.menu.PartitionScheme.noota_3gffat.upload.maximum_size=1048576 +m5stack_unit_cams3.menu.PartitionScheme.huge_app=Huge APP (3MB No OTA/1MB SPIFFS) +m5stack_unit_cams3.menu.PartitionScheme.huge_app.build.partitions=huge_app +m5stack_unit_cams3.menu.PartitionScheme.huge_app.upload.maximum_size=3145728 +m5stack_unit_cams3.menu.PartitionScheme.min_spiffs=Minimal SPIFFS (1.9MB APP with OTA/190KB SPIFFS) +m5stack_unit_cams3.menu.PartitionScheme.min_spiffs.build.partitions=min_spiffs +m5stack_unit_cams3.menu.PartitionScheme.min_spiffs.upload.maximum_size=1966080 +m5stack_unit_cams3.menu.PartitionScheme.fatflash=16M Flash (2MB APP/12.5MB FATFS) +m5stack_unit_cams3.menu.PartitionScheme.fatflash.build.partitions=ffat +m5stack_unit_cams3.menu.PartitionScheme.fatflash.upload.maximum_size=2097152 +m5stack_unit_cams3.menu.PartitionScheme.rainmaker=RainMaker +m5stack_unit_cams3.menu.PartitionScheme.rainmaker.build.partitions=rainmaker +m5stack_unit_cams3.menu.PartitionScheme.rainmaker.upload.maximum_size=3145728 +m5stack_unit_cams3.menu.PartitionScheme.app5M_fat24M_32MB=32M Flash (4.8MB APP/22MB FATFS) +m5stack_unit_cams3.menu.PartitionScheme.app5M_fat24M_32MB.build.partitions=large_fat_32MB +m5stack_unit_cams3.menu.PartitionScheme.app5M_fat24M_32MB.upload.maximum_size=4718592 +m5stack_unit_cams3.menu.PartitionScheme.app5M_little24M_32MB=32M Flash (4.8MB APP/22MB LittleFS) +m5stack_unit_cams3.menu.PartitionScheme.app5M_little24M_32MB.build.partitions=large_littlefs_32MB +m5stack_unit_cams3.menu.PartitionScheme.app5M_little24M_32MB.upload.maximum_size=4718592 +m5stack_unit_cams3.menu.PartitionScheme.esp_sr_16=ESP SR 16M (3MB APP/7MB SPIFFS/2.9MB MODEL) +m5stack_unit_cams3.menu.PartitionScheme.esp_sr_16.upload.maximum_size=3145728 +m5stack_unit_cams3.menu.PartitionScheme.esp_sr_16.upload.extra_flags=0xD10000 {build.path}/srmodels.bin +m5stack_unit_cams3.menu.PartitionScheme.esp_sr_16.build.partitions=esp_sr_16 +m5stack_unit_cams3.menu.PartitionScheme.custom=Custom +m5stack_unit_cams3.menu.PartitionScheme.custom.build.partitions= +m5stack_unit_cams3.menu.PartitionScheme.custom.upload.maximum_size=16777216 + +m5stack_unit_cams3.menu.CPUFreq.240=240MHz (WiFi) +m5stack_unit_cams3.menu.CPUFreq.240.build.f_cpu=240000000L +m5stack_unit_cams3.menu.CPUFreq.160=160MHz (WiFi) +m5stack_unit_cams3.menu.CPUFreq.160.build.f_cpu=160000000L +m5stack_unit_cams3.menu.CPUFreq.80=80MHz (WiFi) +m5stack_unit_cams3.menu.CPUFreq.80.build.f_cpu=80000000L +m5stack_unit_cams3.menu.CPUFreq.40=40MHz +m5stack_unit_cams3.menu.CPUFreq.40.build.f_cpu=40000000L +m5stack_unit_cams3.menu.CPUFreq.20=20MHz +m5stack_unit_cams3.menu.CPUFreq.20.build.f_cpu=20000000L +m5stack_unit_cams3.menu.CPUFreq.10=10MHz +m5stack_unit_cams3.menu.CPUFreq.10.build.f_cpu=10000000L + +m5stack_unit_cams3.menu.UploadSpeed.921600=921600 +m5stack_unit_cams3.menu.UploadSpeed.921600.upload.speed=921600 +m5stack_unit_cams3.menu.UploadSpeed.115200=115200 +m5stack_unit_cams3.menu.UploadSpeed.115200.upload.speed=115200 +m5stack_unit_cams3.menu.UploadSpeed.256000.windows=256000 +m5stack_unit_cams3.menu.UploadSpeed.256000.upload.speed=256000 +m5stack_unit_cams3.menu.UploadSpeed.230400.windows.upload.speed=256000 +m5stack_unit_cams3.menu.UploadSpeed.230400=230400 +m5stack_unit_cams3.menu.UploadSpeed.230400.upload.speed=230400 +m5stack_unit_cams3.menu.UploadSpeed.460800.linux=460800 +m5stack_unit_cams3.menu.UploadSpeed.460800.macosx=460800 +m5stack_unit_cams3.menu.UploadSpeed.460800.upload.speed=460800 +m5stack_unit_cams3.menu.UploadSpeed.512000.windows=512000 +m5stack_unit_cams3.menu.UploadSpeed.512000.upload.speed=512000 + +m5stack_unit_cams3.menu.DebugLevel.none=None +m5stack_unit_cams3.menu.DebugLevel.none.build.code_debug=0 +m5stack_unit_cams3.menu.DebugLevel.error=Error +m5stack_unit_cams3.menu.DebugLevel.error.build.code_debug=1 +m5stack_unit_cams3.menu.DebugLevel.warn=Warn +m5stack_unit_cams3.menu.DebugLevel.warn.build.code_debug=2 +m5stack_unit_cams3.menu.DebugLevel.info=Info +m5stack_unit_cams3.menu.DebugLevel.info.build.code_debug=3 +m5stack_unit_cams3.menu.DebugLevel.debug=Debug +m5stack_unit_cams3.menu.DebugLevel.debug.build.code_debug=4 +m5stack_unit_cams3.menu.DebugLevel.verbose=Verbose +m5stack_unit_cams3.menu.DebugLevel.verbose.build.code_debug=5 + +m5stack_unit_cams3.menu.EraseFlash.none=Disabled +m5stack_unit_cams3.menu.EraseFlash.none.upload.erase_cmd= +m5stack_unit_cams3.menu.EraseFlash.all=Enabled +m5stack_unit_cams3.menu.EraseFlash.all.upload.erase_cmd=-e + ############################################################## -m5stack-coreink.name=M5Stack-CoreInk - -m5stack-coreink.bootloader.tool=esptool_py -m5stack-coreink.bootloader.tool.default=esptool_py - -m5stack-coreink.upload.tool=esptool_py -m5stack-coreink.upload.tool.default=esptool_py -m5stack-coreink.upload.tool.network=esp_ota - -m5stack-coreink.upload.maximum_size=1310720 -m5stack-coreink.upload.maximum_data_size=327680 -m5stack-coreink.upload.wait_for_upload_port=true -m5stack-coreink.upload.flags= -m5stack-coreink.upload.extra_flags= - -m5stack-coreink.serial.disableDTR=true -m5stack-coreink.serial.disableRTS=true - -m5stack-coreink.build.tarch=xtensa -m5stack-coreink.build.bootloader_addr=0x1000 -m5stack-coreink.build.target=esp32 -m5stack-coreink.build.mcu=esp32 -m5stack-coreink.build.core=esp32 -m5stack-coreink.build.variant=m5stack_coreink -m5stack-coreink.build.board=M5Stack_CoreInk - -m5stack-coreink.build.f_cpu=240000000L -m5stack-coreink.build.flash_size=4MB -m5stack-coreink.build.flash_freq=80m -m5stack-coreink.build.flash_mode=dio -m5stack-coreink.build.boot=dio -m5stack-coreink.build.partitions=default -m5stack-coreink.build.defines= - -m5stack-coreink.menu.PartitionScheme.default=Default -m5stack-coreink.menu.PartitionScheme.default.build.partitions=default -m5stack-coreink.menu.PartitionScheme.no_ota=No OTA (Large APP) -m5stack-coreink.menu.PartitionScheme.no_ota.build.partitions=no_ota -m5stack-coreink.menu.PartitionScheme.no_ota.upload.maximum_size=2097152 -m5stack-coreink.menu.PartitionScheme.min_spiffs=Minimal SPIFFS (Large APPS with OTA) -m5stack-coreink.menu.PartitionScheme.min_spiffs.build.partitions=min_spiffs -m5stack-coreink.menu.PartitionScheme.min_spiffs.upload.maximum_size=1966080 - -m5stack-coreink.menu.UploadSpeed.921600=921600 -m5stack-coreink.menu.UploadSpeed.921600.upload.speed=921600 -m5stack-coreink.menu.UploadSpeed.115200=115200 -m5stack-coreink.menu.UploadSpeed.115200.upload.speed=115200 -m5stack-coreink.menu.UploadSpeed.256000.windows=256000 -m5stack-coreink.menu.UploadSpeed.256000.upload.speed=256000 -m5stack-coreink.menu.UploadSpeed.230400.windows.upload.speed=256000 -m5stack-coreink.menu.UploadSpeed.230400=230400 -m5stack-coreink.menu.UploadSpeed.230400.upload.speed=230400 -m5stack-coreink.menu.UploadSpeed.460800.linux=460800 -m5stack-coreink.menu.UploadSpeed.460800.macosx=460800 -m5stack-coreink.menu.UploadSpeed.460800.upload.speed=460800 -m5stack-coreink.menu.UploadSpeed.512000.windows=512000 -m5stack-coreink.menu.UploadSpeed.512000.upload.speed=512000 -m5stack-coreink.menu.UploadSpeed.1500000=1500000 -m5stack-coreink.menu.UploadSpeed.1500000.upload.speed=1500000 - -m5stack-coreink.menu.DebugLevel.none=None -m5stack-coreink.menu.DebugLevel.none.build.code_debug=0 -m5stack-coreink.menu.DebugLevel.error=Error -m5stack-coreink.menu.DebugLevel.error.build.code_debug=1 -m5stack-coreink.menu.DebugLevel.warn=Warn -m5stack-coreink.menu.DebugLevel.warn.build.code_debug=2 -m5stack-coreink.menu.DebugLevel.info=Info -m5stack-coreink.menu.DebugLevel.info.build.code_debug=3 -m5stack-coreink.menu.DebugLevel.debug=Debug -m5stack-coreink.menu.DebugLevel.debug.build.code_debug=4 -m5stack-coreink.menu.DebugLevel.verbose=Verbose -m5stack-coreink.menu.DebugLevel.verbose.build.code_debug=5 - -m5stack-coreink.menu.EraseFlash.none=Disabled -m5stack-coreink.menu.EraseFlash.none.upload.erase_cmd= -m5stack-coreink.menu.EraseFlash.all=Enabled -m5stack-coreink.menu.EraseFlash.all.upload.erase_cmd=-e +m5stack_poe_cam.name=M5PoECAM + +m5stack_poe_cam.bootloader.tool=esptool_py +m5stack_poe_cam.bootloader.tool.default=esptool_py + +m5stack_poe_cam.upload.tool=esptool_py +m5stack_poe_cam.upload.tool.default=esptool_py +m5stack_poe_cam.upload.tool.network=esp_ota + +m5stack_poe_cam.upload.maximum_size=1310720 +m5stack_poe_cam.upload.maximum_data_size=327680 + +m5stack_poe_cam.upload.flags= +m5stack_poe_cam.upload.extra_flags= + +m5stack_poe_cam.serial.disableDTR=true +m5stack_poe_cam.serial.disableRTS=true + +m5stack_poe_cam.build.tarch=xtensa +m5stack_poe_cam.build.bootloader_addr=0x1000 +m5stack_poe_cam.build.target=esp32 +m5stack_poe_cam.build.mcu=esp32 +m5stack_poe_cam.build.core=esp32 +m5stack_poe_cam.build.variant=m5stack_poe_cam +m5stack_poe_cam.build.board=M5STACK_POE_CAM + +m5stack_poe_cam.build.f_cpu=240000000L +m5stack_poe_cam.build.flash_size=4MB +m5stack_poe_cam.build.flash_freq=80m +m5stack_poe_cam.build.flash_mode=dio +m5stack_poe_cam.build.boot=dio +m5stack_poe_cam.build.partitions=default +m5stack_poe_cam.build.defines= +m5stack_poe_cam.build.loop_core= +m5stack_poe_cam.build.event_core= + +m5stack_poe_cam.menu.PSRAM.enabled=Enabled +m5stack_poe_cam.menu.PSRAM.enabled.build.defines=-DBOARD_HAS_PSRAM -mfix-esp32-psram-cache-issue -mfix-esp32-psram-cache-strategy=memw +m5stack_poe_cam.menu.PSRAM.enabled.build.extra_libs= +m5stack_poe_cam.menu.PSRAM.disabled=Disabled +m5stack_poe_cam.menu.PSRAM.disabled.build.defines= +m5stack_poe_cam.menu.PSRAM.disabled.build.extra_libs= + +m5stack_poe_cam.menu.PartitionScheme.default=Default 4MB with spiffs (1.2MB APP/1.5MB SPIFFS) +m5stack_poe_cam.menu.PartitionScheme.default.build.partitions=default +m5stack_poe_cam.menu.PartitionScheme.defaultffat=Default 4MB with ffat (1.2MB APP/1.5MB FATFS) +m5stack_poe_cam.menu.PartitionScheme.defaultffat.build.partitions=default_ffat +m5stack_poe_cam.menu.PartitionScheme.default_8MB=8M with spiffs (3MB APP/1.5MB SPIFFS) +m5stack_poe_cam.menu.PartitionScheme.default_8MB.build.partitions=default_8MB +m5stack_poe_cam.menu.PartitionScheme.default_8MB.upload.maximum_size=3342336 +m5stack_poe_cam.menu.PartitionScheme.minimal=Minimal (1.3MB APP/700KB SPIFFS) +m5stack_poe_cam.menu.PartitionScheme.minimal.build.partitions=minimal +m5stack_poe_cam.menu.PartitionScheme.no_ota=No OTA (2MB APP/2MB SPIFFS) +m5stack_poe_cam.menu.PartitionScheme.no_ota.build.partitions=no_ota +m5stack_poe_cam.menu.PartitionScheme.no_ota.upload.maximum_size=2097152 +m5stack_poe_cam.menu.PartitionScheme.noota_3g=No OTA (1MB APP/3MB SPIFFS) +m5stack_poe_cam.menu.PartitionScheme.noota_3g.build.partitions=noota_3g +m5stack_poe_cam.menu.PartitionScheme.noota_3g.upload.maximum_size=1048576 +m5stack_poe_cam.menu.PartitionScheme.noota_ffat=No OTA (2MB APP/2MB FATFS) +m5stack_poe_cam.menu.PartitionScheme.noota_ffat.build.partitions=noota_ffat +m5stack_poe_cam.menu.PartitionScheme.noota_ffat.upload.maximum_size=2097152 +m5stack_poe_cam.menu.PartitionScheme.noota_3gffat=No OTA (1MB APP/3MB FATFS) +m5stack_poe_cam.menu.PartitionScheme.noota_3gffat.build.partitions=noota_3gffat +m5stack_poe_cam.menu.PartitionScheme.noota_3gffat.upload.maximum_size=1048576 +m5stack_poe_cam.menu.PartitionScheme.huge_app=Huge APP (3MB No OTA/1MB SPIFFS) +m5stack_poe_cam.menu.PartitionScheme.huge_app.build.partitions=huge_app +m5stack_poe_cam.menu.PartitionScheme.huge_app.upload.maximum_size=3145728 +m5stack_poe_cam.menu.PartitionScheme.min_spiffs=Minimal SPIFFS (1.9MB APP with OTA/190KB SPIFFS) +m5stack_poe_cam.menu.PartitionScheme.min_spiffs.build.partitions=min_spiffs +m5stack_poe_cam.menu.PartitionScheme.min_spiffs.upload.maximum_size=1966080 + +m5stack_poe_cam.menu.CPUFreq.240=240MHz (WiFi/BT) +m5stack_poe_cam.menu.CPUFreq.240.build.f_cpu=240000000L +m5stack_poe_cam.menu.CPUFreq.160=160MHz (WiFi/BT) +m5stack_poe_cam.menu.CPUFreq.160.build.f_cpu=160000000L +m5stack_poe_cam.menu.CPUFreq.80=80MHz (WiFi/BT) +m5stack_poe_cam.menu.CPUFreq.80.build.f_cpu=80000000L +m5stack_poe_cam.menu.CPUFreq.40=40MHz (40MHz XTAL) +m5stack_poe_cam.menu.CPUFreq.40.build.f_cpu=40000000L +m5stack_poe_cam.menu.CPUFreq.26=26MHz (26MHz XTAL) +m5stack_poe_cam.menu.CPUFreq.26.build.f_cpu=26000000L +m5stack_poe_cam.menu.CPUFreq.20=20MHz (40MHz XTAL) +m5stack_poe_cam.menu.CPUFreq.20.build.f_cpu=20000000L +m5stack_poe_cam.menu.CPUFreq.13=13MHz (26MHz XTAL) +m5stack_poe_cam.menu.CPUFreq.13.build.f_cpu=13000000L +m5stack_poe_cam.menu.CPUFreq.10=10MHz (40MHz XTAL) +m5stack_poe_cam.menu.CPUFreq.10.build.f_cpu=10000000L + +m5stack_poe_cam.menu.FlashMode.qio=QIO +m5stack_poe_cam.menu.FlashMode.qio.build.flash_mode=dio +m5stack_poe_cam.menu.FlashMode.qio.build.boot=qio +m5stack_poe_cam.menu.FlashMode.dio=DIO +m5stack_poe_cam.menu.FlashMode.dio.build.flash_mode=dio +m5stack_poe_cam.menu.FlashMode.dio.build.boot=dio +m5stack_poe_cam.menu.FlashMode.qout=QOUT +m5stack_poe_cam.menu.FlashMode.qout.build.flash_mode=dout +m5stack_poe_cam.menu.FlashMode.qout.build.boot=qout +m5stack_poe_cam.menu.FlashMode.dout=DOUT +m5stack_poe_cam.menu.FlashMode.dout.build.flash_mode=dout +m5stack_poe_cam.menu.FlashMode.dout.build.boot=dout + +m5stack_poe_cam.menu.FlashFreq.80=80MHz +m5stack_poe_cam.menu.FlashFreq.80.build.flash_freq=80m +m5stack_poe_cam.menu.FlashFreq.40=40MHz +m5stack_poe_cam.menu.FlashFreq.40.build.flash_freq=40m + +m5stack_poe_cam.menu.FlashSize.4M=4MB (32Mb) +m5stack_poe_cam.menu.FlashSize.4M.build.flash_size=4MB + +m5stack_poe_cam.menu.UploadSpeed.1500000=1500000 +m5stack_poe_cam.menu.UploadSpeed.1500000.upload.speed=1500000 +m5stack_poe_cam.menu.UploadSpeed.750000=750000 +m5stack_poe_cam.menu.UploadSpeed.750000.upload.speed=750000 +m5stack_poe_cam.menu.UploadSpeed.500000=500000 +m5stack_poe_cam.menu.UploadSpeed.500000.upload.speed=500000 +m5stack_poe_cam.menu.UploadSpeed.250000=250000 +m5stack_poe_cam.menu.UploadSpeed.250000.upload.speed=250000 +m5stack_poe_cam.menu.UploadSpeed.115200=115200 +m5stack_poe_cam.menu.UploadSpeed.115200.upload.speed=115200 + +m5stack_poe_cam.menu.LoopCore.1=Core 1 +m5stack_poe_cam.menu.LoopCore.1.build.loop_core=-DARDUINO_RUNNING_CORE=1 +m5stack_poe_cam.menu.LoopCore.0=Core 0 +m5stack_poe_cam.menu.LoopCore.0.build.loop_core=-DARDUINO_RUNNING_CORE=0 + +m5stack_poe_cam.menu.EventsCore.1=Core 1 +m5stack_poe_cam.menu.EventsCore.1.build.event_core=-DARDUINO_EVENT_RUNNING_CORE=1 +m5stack_poe_cam.menu.EventsCore.0=Core 0 +m5stack_poe_cam.menu.EventsCore.0.build.event_core=-DARDUINO_EVENT_RUNNING_CORE=0 + +m5stack_poe_cam.menu.DebugLevel.none=None +m5stack_poe_cam.menu.DebugLevel.none.build.code_debug=0 +m5stack_poe_cam.menu.DebugLevel.error=Error +m5stack_poe_cam.menu.DebugLevel.error.build.code_debug=1 +m5stack_poe_cam.menu.DebugLevel.warn=Warn +m5stack_poe_cam.menu.DebugLevel.warn.build.code_debug=2 +m5stack_poe_cam.menu.DebugLevel.info=Info +m5stack_poe_cam.menu.DebugLevel.info.build.code_debug=3 +m5stack_poe_cam.menu.DebugLevel.debug=Debug +m5stack_poe_cam.menu.DebugLevel.debug.build.code_debug=4 +m5stack_poe_cam.menu.DebugLevel.verbose=Verbose +m5stack_poe_cam.menu.DebugLevel.verbose.build.code_debug=5 + +m5stack_poe_cam.menu.EraseFlash.none=Disabled +m5stack_poe_cam.menu.EraseFlash.none.upload.erase_cmd= +m5stack_poe_cam.menu.EraseFlash.all=Enabled +m5stack_poe_cam.menu.EraseFlash.all.upload.erase_cmd=-e + ############################################################## -stamp-s3.name=STAMP-S3 -stamp-s3.vid.0=0x303a -stamp-s3.pid.0=0x1001 - -stamp-s3.bootloader.tool=esptool_py -stamp-s3.bootloader.tool.default=esptool_py - -stamp-s3.upload.tool=esptool_py -stamp-s3.upload.tool.default=esptool_py -stamp-s3.upload.tool.network=esp_ota - -stamp-s3.upload.maximum_size=1310720 -stamp-s3.upload.maximum_data_size=327680 -stamp-s3.upload.flags= -stamp-s3.upload.extra_flags= -stamp-s3.upload.use_1200bps_touch=false -stamp-s3.upload.wait_for_upload_port=false - -stamp-s3.serial.disableDTR=false -stamp-s3.serial.disableRTS=false - -stamp-s3.build.tarch=xtensa -stamp-s3.build.bootloader_addr=0x0 -stamp-s3.build.target=esp32s3 -stamp-s3.build.mcu=esp32s3 -stamp-s3.build.core=esp32 -stamp-s3.build.variant=m5stack_stamp_s3 -stamp-s3.build.board=STAMP_S3 - -stamp-s3.build.usb_mode=1 -stamp-s3.build.cdc_on_boot=0 -stamp-s3.build.msc_on_boot=0 -stamp-s3.build.dfu_on_boot=0 -stamp-s3.build.f_cpu=240000000L -stamp-s3.build.flash_size=4MB -stamp-s3.build.flash_freq=80m -stamp-s3.build.flash_mode=dio -stamp-s3.build.boot=qio -stamp-s3.build.boot_freq=80m -stamp-s3.build.partitions=default -stamp-s3.build.defines= -stamp-s3.build.loop_core= -stamp-s3.build.event_core= -stamp-s3.build.psram_type=qspi -stamp-s3.build.memory_type={build.boot}_{build.psram_type} - -stamp-s3.menu.JTAGAdapter.default=Disabled -stamp-s3.menu.JTAGAdapter.default.build.copy_jtag_files=0 -stamp-s3.menu.JTAGAdapter.builtin=Integrated USB JTAG -stamp-s3.menu.JTAGAdapter.builtin.build.openocdscript=esp32s3-builtin.cfg -stamp-s3.menu.JTAGAdapter.builtin.build.copy_jtag_files=1 -stamp-s3.menu.JTAGAdapter.external=FTDI Adapter -stamp-s3.menu.JTAGAdapter.external.build.openocdscript=esp32s3-ftdi.cfg -stamp-s3.menu.JTAGAdapter.external.build.copy_jtag_files=1 -stamp-s3.menu.JTAGAdapter.bridge=ESP USB Bridge -stamp-s3.menu.JTAGAdapter.bridge.build.openocdscript=esp32s3-bridge.cfg -stamp-s3.menu.JTAGAdapter.bridge.build.copy_jtag_files=1 - -stamp-s3.menu.PSRAM.disabled=Disabled -stamp-s3.menu.PSRAM.disabled.build.defines= -stamp-s3.menu.PSRAM.disabled.build.psram_type=qspi -stamp-s3.menu.PSRAM.enabled=QSPI PSRAM -stamp-s3.menu.PSRAM.enabled.build.defines=-DBOARD_HAS_PSRAM -stamp-s3.menu.PSRAM.enabled.build.psram_type=qspi -stamp-s3.menu.PSRAM.opi=OPI PSRAM -stamp-s3.menu.PSRAM.opi.build.defines=-DBOARD_HAS_PSRAM -stamp-s3.menu.PSRAM.opi.build.psram_type=opi - -stamp-s3.menu.FlashMode.qio=QIO 80MHz -stamp-s3.menu.FlashMode.qio.build.flash_mode=dio -stamp-s3.menu.FlashMode.qio.build.boot=qio -stamp-s3.menu.FlashMode.qio.build.boot_freq=80m -stamp-s3.menu.FlashMode.qio.build.flash_freq=80m -stamp-s3.menu.FlashMode.qio120=QIO 120MHz -stamp-s3.menu.FlashMode.qio120.build.flash_mode=dio -stamp-s3.menu.FlashMode.qio120.build.boot=qio -stamp-s3.menu.FlashMode.qio120.build.boot_freq=120m -stamp-s3.menu.FlashMode.qio120.build.flash_freq=80m -stamp-s3.menu.FlashMode.dio=DIO 80MHz -stamp-s3.menu.FlashMode.dio.build.flash_mode=dio -stamp-s3.menu.FlashMode.dio.build.boot=dio -stamp-s3.menu.FlashMode.dio.build.boot_freq=80m -stamp-s3.menu.FlashMode.dio.build.flash_freq=80m -stamp-s3.menu.FlashMode.opi=OPI 80MHz -stamp-s3.menu.FlashMode.opi.build.flash_mode=dout -stamp-s3.menu.FlashMode.opi.build.boot=opi -stamp-s3.menu.FlashMode.opi.build.boot_freq=80m -stamp-s3.menu.FlashMode.opi.build.flash_freq=80m - -stamp-s3.menu.FlashSize.4M=4MB (32Mb) -stamp-s3.menu.FlashSize.4M.build.flash_size=4MB -stamp-s3.menu.FlashSize.8M=8MB (64Mb) -stamp-s3.menu.FlashSize.8M.build.flash_size=8MB -stamp-s3.menu.FlashSize.8M.build.partitions=default_8MB -stamp-s3.menu.FlashSize.16M=16MB (128Mb) -stamp-s3.menu.FlashSize.16M.build.flash_size=16MB -#stamp-s3.menu.FlashSize.32M=32MB (256Mb) -#stamp-s3.menu.FlashSize.32M.build.flash_size=32MB - -stamp-s3.menu.LoopCore.1=Core 1 -stamp-s3.menu.LoopCore.1.build.loop_core=-DARDUINO_RUNNING_CORE=1 -stamp-s3.menu.LoopCore.0=Core 0 -stamp-s3.menu.LoopCore.0.build.loop_core=-DARDUINO_RUNNING_CORE=0 - -stamp-s3.menu.EventsCore.1=Core 1 -stamp-s3.menu.EventsCore.1.build.event_core=-DARDUINO_EVENT_RUNNING_CORE=1 -stamp-s3.menu.EventsCore.0=Core 0 -stamp-s3.menu.EventsCore.0.build.event_core=-DARDUINO_EVENT_RUNNING_CORE=0 - -stamp-s3.menu.USBMode.hwcdc=Hardware CDC and JTAG -stamp-s3.menu.USBMode.hwcdc.build.usb_mode=1 -stamp-s3.menu.USBMode.default=USB-OTG (TinyUSB) -stamp-s3.menu.USBMode.default.build.usb_mode=0 - -stamp-s3.menu.CDCOnBoot.default=Disabled -stamp-s3.menu.CDCOnBoot.default.build.cdc_on_boot=0 -stamp-s3.menu.CDCOnBoot.cdc=Enabled -stamp-s3.menu.CDCOnBoot.cdc.build.cdc_on_boot=1 - -stamp-s3.menu.MSCOnBoot.default=Disabled -stamp-s3.menu.MSCOnBoot.default.build.msc_on_boot=0 -stamp-s3.menu.MSCOnBoot.msc=Enabled (Requires USB-OTG Mode) -stamp-s3.menu.MSCOnBoot.msc.build.msc_on_boot=1 - -stamp-s3.menu.DFUOnBoot.default=Disabled -stamp-s3.menu.DFUOnBoot.default.build.dfu_on_boot=0 -stamp-s3.menu.DFUOnBoot.dfu=Enabled (Requires USB-OTG Mode) -stamp-s3.menu.DFUOnBoot.dfu.build.dfu_on_boot=1 - -stamp-s3.menu.UploadMode.default=UART0 / Hardware CDC -stamp-s3.menu.UploadMode.default.upload.use_1200bps_touch=false -stamp-s3.menu.UploadMode.default.upload.wait_for_upload_port=false -stamp-s3.menu.UploadMode.cdc=USB-OTG CDC (TinyUSB) -stamp-s3.menu.UploadMode.cdc.upload.use_1200bps_touch=true -stamp-s3.menu.UploadMode.cdc.upload.wait_for_upload_port=true - -stamp-s3.menu.PartitionScheme.default=Default 4MB with spiffs (1.2MB APP/1.5MB SPIFFS) -stamp-s3.menu.PartitionScheme.default.build.partitions=default -stamp-s3.menu.PartitionScheme.defaultffat=Default 4MB with ffat (1.2MB APP/1.5MB FATFS) -stamp-s3.menu.PartitionScheme.defaultffat.build.partitions=default_ffat -stamp-s3.menu.PartitionScheme.default_8MB=8M with spiffs (3MB APP/1.5MB SPIFFS) -stamp-s3.menu.PartitionScheme.default_8MB.build.partitions=default_8MB -stamp-s3.menu.PartitionScheme.default_8MB.upload.maximum_size=3342336 - -stamp-s3.menu.CPUFreq.240=240MHz (WiFi) -stamp-s3.menu.CPUFreq.240.build.f_cpu=240000000L -stamp-s3.menu.CPUFreq.160=160MHz (WiFi) -stamp-s3.menu.CPUFreq.160.build.f_cpu=160000000L -stamp-s3.menu.CPUFreq.80=80MHz (WiFi) -stamp-s3.menu.CPUFreq.80.build.f_cpu=80000000L -stamp-s3.menu.CPUFreq.40=40MHz -stamp-s3.menu.CPUFreq.40.build.f_cpu=40000000L -stamp-s3.menu.CPUFreq.20=20MHz -stamp-s3.menu.CPUFreq.20.build.f_cpu=20000000L -stamp-s3.menu.CPUFreq.10=10MHz -stamp-s3.menu.CPUFreq.10.build.f_cpu=10000000L - -stamp-s3.menu.UploadSpeed.921600=921600 -stamp-s3.menu.UploadSpeed.921600.upload.speed=921600 -stamp-s3.menu.UploadSpeed.115200=115200 -stamp-s3.menu.UploadSpeed.115200.upload.speed=115200 -stamp-s3.menu.UploadSpeed.256000.windows=256000 -stamp-s3.menu.UploadSpeed.256000.upload.speed=256000 -stamp-s3.menu.UploadSpeed.230400.windows.upload.speed=256000 -stamp-s3.menu.UploadSpeed.230400=230400 -stamp-s3.menu.UploadSpeed.230400.upload.speed=230400 -stamp-s3.menu.UploadSpeed.460800.linux=460800 -stamp-s3.menu.UploadSpeed.460800.macosx=460800 -stamp-s3.menu.UploadSpeed.460800.upload.speed=460800 -stamp-s3.menu.UploadSpeed.512000.windows=512000 -stamp-s3.menu.UploadSpeed.512000.upload.speed=512000 - -stamp-s3.menu.DebugLevel.none=None -stamp-s3.menu.DebugLevel.none.build.code_debug=0 -stamp-s3.menu.DebugLevel.error=Error -stamp-s3.menu.DebugLevel.error.build.code_debug=1 -stamp-s3.menu.DebugLevel.warn=Warn -stamp-s3.menu.DebugLevel.warn.build.code_debug=2 -stamp-s3.menu.DebugLevel.info=Info -stamp-s3.menu.DebugLevel.info.build.code_debug=3 -stamp-s3.menu.DebugLevel.debug=Debug -stamp-s3.menu.DebugLevel.debug.build.code_debug=4 -stamp-s3.menu.DebugLevel.verbose=Verbose -stamp-s3.menu.DebugLevel.verbose.build.code_debug=5 - -stamp-s3.menu.EraseFlash.none=Disabled -stamp-s3.menu.EraseFlash.none.upload.erase_cmd= -stamp-s3.menu.EraseFlash.all=Enabled -stamp-s3.menu.EraseFlash.all.upload.erase_cmd=-e +m5stack_paper.name=M5Paper + +m5stack_paper.bootloader.tool=esptool_py +m5stack_paper.bootloader.tool.default=esptool_py + +m5stack_paper.upload.tool=esptool_py +m5stack_paper.upload.tool.default=esptool_py +m5stack_paper.upload.tool.network=esp_ota + +m5stack_paper.upload.maximum_size=6553600 +m5stack_paper.upload.maximum_data_size=4521984 +m5stack_paper.upload.flags= +m5stack_paper.upload.extra_flags= + +m5stack_paper.serial.disableDTR=true +m5stack_paper.serial.disableRTS=true + +m5stack_paper.build.tarch=xtensa +m5stack_paper.build.bootloader_addr=0x1000 +m5stack_paper.build.target=esp32 +m5stack_paper.build.mcu=esp32 +m5stack_paper.build.core=esp32 +m5stack_paper.build.variant=m5stack_paper +m5stack_paper.build.board=M5STACK_PAPER + +m5stack_paper.build.f_cpu=240000000L +m5stack_paper.build.flash_size=16MB +m5stack_paper.build.flash_freq=80m +m5stack_paper.build.flash_mode=dio +m5stack_paper.build.boot=dio +m5stack_paper.build.partitions=default +m5stack_paper.build.defines= +m5stack_paper.build.loop_core= +m5stack_paper.build.event_core= + +m5stack_paper.menu.PSRAM.enabled=Enabled +m5stack_paper.menu.PSRAM.enabled.build.defines=-DBOARD_HAS_PSRAM -mfix-esp32-psram-cache-issue -mfix-esp32-psram-cache-strategy=memw +m5stack_paper.menu.PSRAM.enabled.build.extra_libs= +m5stack_paper.menu.PSRAM.disabled=Disabled +m5stack_paper.menu.PSRAM.disabled.build.defines= +m5stack_paper.menu.PSRAM.disabled.build.extra_libs= + +m5stack_paper.menu.PartitionScheme.default=Default (2 x 6.5 MB app, 3.6 MB SPIFFS) +m5stack_paper.menu.PartitionScheme.default.build.partitions=default_16MB +m5stack_paper.menu.PartitionScheme.default.upload.maximum_size=6553600 +m5stack_paper.menu.PartitionScheme.defaultffat=Default 4MB with ffat (1.2MB APP/1.5MB FATFS) +m5stack_paper.menu.PartitionScheme.defaultffat.build.partitions=default_ffat +m5stack_paper.menu.PartitionScheme.default_8MB=8M with spiffs (3MB APP/1.5MB SPIFFS) +m5stack_paper.menu.PartitionScheme.default_8MB.build.partitions=default_8MB +m5stack_paper.menu.PartitionScheme.default_8MB.upload.maximum_size=3342336 +m5stack_paper.menu.PartitionScheme.minimal=Minimal (1.3MB APP/700KB SPIFFS) +m5stack_paper.menu.PartitionScheme.minimal.build.partitions=minimal +m5stack_paper.menu.PartitionScheme.no_ota=No OTA (2MB APP/2MB SPIFFS) +m5stack_paper.menu.PartitionScheme.no_ota.build.partitions=no_ota +m5stack_paper.menu.PartitionScheme.no_ota.upload.maximum_size=2097152 +m5stack_paper.menu.PartitionScheme.noota_3g=No OTA (1MB APP/3MB SPIFFS) +m5stack_paper.menu.PartitionScheme.noota_3g.build.partitions=noota_3g +m5stack_paper.menu.PartitionScheme.noota_3g.upload.maximum_size=1048576 +m5stack_paper.menu.PartitionScheme.noota_ffat=No OTA (2MB APP/2MB FATFS) +m5stack_paper.menu.PartitionScheme.noota_ffat.build.partitions=noota_ffat +m5stack_paper.menu.PartitionScheme.noota_ffat.upload.maximum_size=2097152 +m5stack_paper.menu.PartitionScheme.noota_3gffat=No OTA (1MB APP/3MB FATFS) +m5stack_paper.menu.PartitionScheme.noota_3gffat.build.partitions=noota_3gffat +m5stack_paper.menu.PartitionScheme.noota_3gffat.upload.maximum_size=1048576 +m5stack_paper.menu.PartitionScheme.huge_app=Huge APP (3MB No OTA/1MB SPIFFS) +m5stack_paper.menu.PartitionScheme.huge_app.build.partitions=huge_app +m5stack_paper.menu.PartitionScheme.huge_app.upload.maximum_size=3145728 +m5stack_paper.menu.PartitionScheme.min_spiffs=Minimal SPIFFS (1.9MB APP with OTA/190KB SPIFFS) +m5stack_paper.menu.PartitionScheme.min_spiffs.build.partitions=min_spiffs +m5stack_paper.menu.PartitionScheme.min_spiffs.upload.maximum_size=1966080 +m5stack_paper.menu.PartitionScheme.fatflash=16M Flash (2MB APP/12.5MB FATFS) +m5stack_paper.menu.PartitionScheme.fatflash.build.partitions=ffat +m5stack_paper.menu.PartitionScheme.fatflash.upload.maximum_size=2097152 +m5stack_paper.menu.PartitionScheme.app3M_fat9M_16MB=16M Flash (3MB APP/9.9MB FATFS) +m5stack_paper.menu.PartitionScheme.app3M_fat9M_16MB.build.partitions=app3M_fat9M_16MB +m5stack_paper.menu.PartitionScheme.app3M_fat9M_16MB.upload.maximum_size=3145728 +m5stack_paper.menu.PartitionScheme.rainmaker=RainMaker +m5stack_paper.menu.PartitionScheme.rainmaker.build.partitions=rainmaker +m5stack_paper.menu.PartitionScheme.rainmaker.upload.maximum_size=3145728 +m5stack_paper.menu.PartitionScheme.custom=Custom +m5stack_paper.menu.PartitionScheme.custom.build.partitions= +m5stack_paper.menu.PartitionScheme.custom.upload.maximum_size=16777216 + +m5stack_paper.menu.CPUFreq.240=240MHz (WiFi/BT) +m5stack_paper.menu.CPUFreq.240.build.f_cpu=240000000L +m5stack_paper.menu.CPUFreq.160=160MHz (WiFi/BT) +m5stack_paper.menu.CPUFreq.160.build.f_cpu=160000000L +m5stack_paper.menu.CPUFreq.80=80MHz (WiFi/BT) +m5stack_paper.menu.CPUFreq.80.build.f_cpu=80000000L +m5stack_paper.menu.CPUFreq.40=40MHz (40MHz XTAL) +m5stack_paper.menu.CPUFreq.40.build.f_cpu=40000000L +m5stack_paper.menu.CPUFreq.26=26MHz (26MHz XTAL) +m5stack_paper.menu.CPUFreq.26.build.f_cpu=26000000L +m5stack_paper.menu.CPUFreq.20=20MHz (40MHz XTAL) +m5stack_paper.menu.CPUFreq.20.build.f_cpu=20000000L +m5stack_paper.menu.CPUFreq.13=13MHz (26MHz XTAL) +m5stack_paper.menu.CPUFreq.13.build.f_cpu=13000000L +m5stack_paper.menu.CPUFreq.10=10MHz (40MHz XTAL) +m5stack_paper.menu.CPUFreq.10.build.f_cpu=10000000L + +m5stack_paper.menu.FlashMode.qio=QIO +m5stack_paper.menu.FlashMode.qio.build.flash_mode=dio +m5stack_paper.menu.FlashMode.qio.build.boot=qio +m5stack_paper.menu.FlashMode.dio=DIO +m5stack_paper.menu.FlashMode.dio.build.flash_mode=dio +m5stack_paper.menu.FlashMode.dio.build.boot=dio +m5stack_paper.menu.FlashMode.qout=QOUT +m5stack_paper.menu.FlashMode.qout.build.flash_mode=dout +m5stack_paper.menu.FlashMode.qout.build.boot=qout +m5stack_paper.menu.FlashMode.dout=DOUT +m5stack_paper.menu.FlashMode.dout.build.flash_mode=dout +m5stack_paper.menu.FlashMode.dout.build.boot=dout + +m5stack_paper.menu.FlashFreq.80=80MHz +m5stack_paper.menu.FlashFreq.80.build.flash_freq=80m +m5stack_paper.menu.FlashFreq.40=40MHz +m5stack_paper.menu.FlashFreq.40.build.flash_freq=40m + +m5stack_paper.menu.FlashSize.16M=16MB (128Mb) +m5stack_paper.menu.FlashSize.16M.build.flash_size=16MB + +m5stack_paper.menu.UploadSpeed.1500000=1500000 +m5stack_paper.menu.UploadSpeed.1500000.upload.speed=1500000 +m5stack_paper.menu.UploadSpeed.921600=921600 +m5stack_paper.menu.UploadSpeed.921600.upload.speed=921600 +m5stack_paper.menu.UploadSpeed.115200=115200 +m5stack_paper.menu.UploadSpeed.115200.upload.speed=115200 +m5stack_paper.menu.UploadSpeed.256000.windows=256000 +m5stack_paper.menu.UploadSpeed.256000.upload.speed=256000 +m5stack_paper.menu.UploadSpeed.230400.windows.upload.speed=256000 +m5stack_paper.menu.UploadSpeed.230400=230400 +m5stack_paper.menu.UploadSpeed.230400.upload.speed=230400 +m5stack_paper.menu.UploadSpeed.460800.linux=460800 +m5stack_paper.menu.UploadSpeed.460800.macosx=460800 +m5stack_paper.menu.UploadSpeed.460800.upload.speed=460800 +m5stack_paper.menu.UploadSpeed.512000.windows=512000 +m5stack_paper.menu.UploadSpeed.512000.upload.speed=512000 + +m5stack_paper.menu.LoopCore.1=Core 1 +m5stack_paper.menu.LoopCore.1.build.loop_core=-DARDUINO_RUNNING_CORE=1 +m5stack_paper.menu.LoopCore.0=Core 0 +m5stack_paper.menu.LoopCore.0.build.loop_core=-DARDUINO_RUNNING_CORE=0 + +m5stack_paper.menu.EventsCore.1=Core 1 +m5stack_paper.menu.EventsCore.1.build.event_core=-DARDUINO_EVENT_RUNNING_CORE=1 +m5stack_paper.menu.EventsCore.0=Core 0 +m5stack_paper.menu.EventsCore.0.build.event_core=-DARDUINO_EVENT_RUNNING_CORE=0 + +m5stack_paper.menu.DebugLevel.none=None +m5stack_paper.menu.DebugLevel.none.build.code_debug=0 +m5stack_paper.menu.DebugLevel.error=Error +m5stack_paper.menu.DebugLevel.error.build.code_debug=1 +m5stack_paper.menu.DebugLevel.warn=Warn +m5stack_paper.menu.DebugLevel.warn.build.code_debug=2 +m5stack_paper.menu.DebugLevel.info=Info +m5stack_paper.menu.DebugLevel.info.build.code_debug=3 +m5stack_paper.menu.DebugLevel.debug=Debug +m5stack_paper.menu.DebugLevel.debug.build.code_debug=4 +m5stack_paper.menu.DebugLevel.verbose=Verbose +m5stack_paper.menu.DebugLevel.verbose.build.code_debug=5 + +m5stack_paper.menu.EraseFlash.none=Disabled +m5stack_paper.menu.EraseFlash.none.upload.erase_cmd= +m5stack_paper.menu.EraseFlash.all=Enabled +m5stack_paper.menu.EraseFlash.all.upload.erase_cmd=-e + + +############################################################## + +m5stack_coreink.name=M5CoreInk + +m5stack_coreink.bootloader.tool=esptool_py +m5stack_coreink.bootloader.tool.default=esptool_py + +m5stack_coreink.upload.tool=esptool_py +m5stack_coreink.upload.tool.default=esptool_py +m5stack_coreink.upload.tool.network=esp_ota + +m5stack_coreink.upload.maximum_size=1310720 +m5stack_coreink.upload.maximum_data_size=327680 +m5stack_coreink.upload.flags= +m5stack_coreink.upload.extra_flags= + +m5stack_coreink.serial.disableDTR=true +m5stack_coreink.serial.disableRTS=true + +m5stack_coreink.build.tarch=xtensa +m5stack_coreink.build.bootloader_addr=0x1000 +m5stack_coreink.build.target=esp32 +m5stack_coreink.build.mcu=esp32 +m5stack_coreink.build.core=esp32 +m5stack_coreink.build.variant=m5stack_coreink +m5stack_coreink.build.board=M5STACK_COREINK + +m5stack_coreink.build.f_cpu=240000000L +m5stack_coreink.build.flash_size=4MB +m5stack_coreink.build.flash_freq=80m +m5stack_coreink.build.flash_mode=dio +m5stack_coreink.build.boot=dio +m5stack_coreink.build.partitions=default +m5stack_coreink.build.defines= +m5stack_coreink.build.loop_core= +m5stack_coreink.build.event_core= + +m5stack_coreink.menu.PartitionScheme.default=Default 4MB with spiffs (1.2MB APP/1.5MB SPIFFS) +m5stack_coreink.menu.PartitionScheme.default.build.partitions=default +m5stack_coreink.menu.PartitionScheme.defaultffat=Default 4MB with ffat (1.2MB APP/1.5MB FATFS) +m5stack_coreink.menu.PartitionScheme.defaultffat.build.partitions=default_ffat +m5stack_coreink.menu.PartitionScheme.default_8MB=8M with spiffs (3MB APP/1.5MB SPIFFS) +m5stack_coreink.menu.PartitionScheme.default_8MB.build.partitions=default_8MB +m5stack_coreink.menu.PartitionScheme.default_8MB.upload.maximum_size=3342336 +m5stack_coreink.menu.PartitionScheme.minimal=Minimal (1.3MB APP/700KB SPIFFS) +m5stack_coreink.menu.PartitionScheme.minimal.build.partitions=minimal +m5stack_coreink.menu.PartitionScheme.no_ota=No OTA (2MB APP/2MB SPIFFS) +m5stack_coreink.menu.PartitionScheme.no_ota.build.partitions=no_ota +m5stack_coreink.menu.PartitionScheme.no_ota.upload.maximum_size=2097152 +m5stack_coreink.menu.PartitionScheme.noota_3g=No OTA (1MB APP/3MB SPIFFS) +m5stack_coreink.menu.PartitionScheme.noota_3g.build.partitions=noota_3g +m5stack_coreink.menu.PartitionScheme.noota_3g.upload.maximum_size=1048576 +m5stack_coreink.menu.PartitionScheme.noota_ffat=No OTA (2MB APP/2MB FATFS) +m5stack_coreink.menu.PartitionScheme.noota_ffat.build.partitions=noota_ffat +m5stack_coreink.menu.PartitionScheme.noota_ffat.upload.maximum_size=2097152 +m5stack_coreink.menu.PartitionScheme.noota_3gffat=No OTA (1MB APP/3MB FATFS) +m5stack_coreink.menu.PartitionScheme.noota_3gffat.build.partitions=noota_3gffat +m5stack_coreink.menu.PartitionScheme.noota_3gffat.upload.maximum_size=1048576 +m5stack_coreink.menu.PartitionScheme.huge_app=Huge APP (3MB No OTA/1MB SPIFFS) +m5stack_coreink.menu.PartitionScheme.huge_app.build.partitions=huge_app +m5stack_coreink.menu.PartitionScheme.huge_app.upload.maximum_size=3145728 +m5stack_coreink.menu.PartitionScheme.min_spiffs=Minimal SPIFFS (1.9MB APP with OTA/190KB SPIFFS) +m5stack_coreink.menu.PartitionScheme.min_spiffs.build.partitions=min_spiffs +m5stack_coreink.menu.PartitionScheme.min_spiffs.upload.maximum_size=1966080 +m5stack_coreink.menu.PartitionScheme.fatflash=16M Flash (2MB APP/12.5MB FATFS) +m5stack_coreink.menu.PartitionScheme.fatflash.build.partitions=ffat +m5stack_coreink.menu.PartitionScheme.fatflash.upload.maximum_size=2097152 +m5stack_coreink.menu.PartitionScheme.rainmaker=RainMaker +m5stack_coreink.menu.PartitionScheme.rainmaker.build.partitions=rainmaker +m5stack_coreink.menu.PartitionScheme.rainmaker.upload.maximum_size=3145728 +m5stack_coreink.menu.PartitionScheme.custom=Custom +m5stack_coreink.menu.PartitionScheme.custom.build.partitions= +m5stack_coreink.menu.PartitionScheme.custom.upload.maximum_size=16777216 + +m5stack_coreink.menu.CPUFreq.240=240MHz (WiFi/BT) +m5stack_coreink.menu.CPUFreq.240.build.f_cpu=240000000L +m5stack_coreink.menu.CPUFreq.160=160MHz (WiFi/BT) +m5stack_coreink.menu.CPUFreq.160.build.f_cpu=160000000L +m5stack_coreink.menu.CPUFreq.80=80MHz (WiFi/BT) +m5stack_coreink.menu.CPUFreq.80.build.f_cpu=80000000L +m5stack_coreink.menu.CPUFreq.40=40MHz (40MHz XTAL) +m5stack_coreink.menu.CPUFreq.40.build.f_cpu=40000000L +m5stack_coreink.menu.CPUFreq.26=26MHz (26MHz XTAL) +m5stack_coreink.menu.CPUFreq.26.build.f_cpu=26000000L +m5stack_coreink.menu.CPUFreq.20=20MHz (40MHz XTAL) +m5stack_coreink.menu.CPUFreq.20.build.f_cpu=20000000L +m5stack_coreink.menu.CPUFreq.13=13MHz (26MHz XTAL) +m5stack_coreink.menu.CPUFreq.13.build.f_cpu=13000000L +m5stack_coreink.menu.CPUFreq.10=10MHz (40MHz XTAL) +m5stack_coreink.menu.CPUFreq.10.build.f_cpu=10000000L + +m5stack_coreink.menu.FlashMode.qio=QIO +m5stack_coreink.menu.FlashMode.qio.build.flash_mode=dio +m5stack_coreink.menu.FlashMode.qio.build.boot=qio +m5stack_coreink.menu.FlashMode.dio=DIO +m5stack_coreink.menu.FlashMode.dio.build.flash_mode=dio +m5stack_coreink.menu.FlashMode.dio.build.boot=dio +m5stack_coreink.menu.FlashMode.qout=QOUT +m5stack_coreink.menu.FlashMode.qout.build.flash_mode=dout +m5stack_coreink.menu.FlashMode.qout.build.boot=qout +m5stack_coreink.menu.FlashMode.dout=DOUT +m5stack_coreink.menu.FlashMode.dout.build.flash_mode=dout +m5stack_coreink.menu.FlashMode.dout.build.boot=dout + +m5stack_coreink.menu.FlashFreq.80=80MHz +m5stack_coreink.menu.FlashFreq.80.build.flash_freq=80m +m5stack_coreink.menu.FlashFreq.40=40MHz +m5stack_coreink.menu.FlashFreq.40.build.flash_freq=40m + +m5stack_coreink.menu.FlashSize.4M=4MB (32Mb) +m5stack_coreink.menu.FlashSize.4M.build.flash_size=4MB + +m5stack_coreink.menu.UploadSpeed.1500000=1500000 +m5stack_coreink.menu.UploadSpeed.1500000.upload.speed=1500000 +m5stack_coreink.menu.UploadSpeed.750000=750000 +m5stack_coreink.menu.UploadSpeed.750000.upload.speed=750000 +m5stack_coreink.menu.UploadSpeed.500000=500000 +m5stack_coreink.menu.UploadSpeed.500000.upload.speed=500000 +m5stack_coreink.menu.UploadSpeed.250000=250000 +m5stack_coreink.menu.UploadSpeed.250000.upload.speed=250000 +m5stack_coreink.menu.UploadSpeed.115200=115200 +m5stack_coreink.menu.UploadSpeed.115200.upload.speed=115200 + +m5stack_coreink.menu.LoopCore.1=Core 1 +m5stack_coreink.menu.LoopCore.1.build.loop_core=-DARDUINO_RUNNING_CORE=1 +m5stack_coreink.menu.LoopCore.0=Core 0 +m5stack_coreink.menu.LoopCore.0.build.loop_core=-DARDUINO_RUNNING_CORE=0 + +m5stack_coreink.menu.EventsCore.1=Core 1 +m5stack_coreink.menu.EventsCore.1.build.event_core=-DARDUINO_EVENT_RUNNING_CORE=1 +m5stack_coreink.menu.EventsCore.0=Core 0 +m5stack_coreink.menu.EventsCore.0.build.event_core=-DARDUINO_EVENT_RUNNING_CORE=0 + +m5stack_coreink.menu.DebugLevel.none=None +m5stack_coreink.menu.DebugLevel.none.build.code_debug=0 +m5stack_coreink.menu.DebugLevel.error=Error +m5stack_coreink.menu.DebugLevel.error.build.code_debug=1 +m5stack_coreink.menu.DebugLevel.warn=Warn +m5stack_coreink.menu.DebugLevel.warn.build.code_debug=2 +m5stack_coreink.menu.DebugLevel.info=Info +m5stack_coreink.menu.DebugLevel.info.build.code_debug=3 +m5stack_coreink.menu.DebugLevel.debug=Debug +m5stack_coreink.menu.DebugLevel.debug.build.code_debug=4 +m5stack_coreink.menu.DebugLevel.verbose=Verbose +m5stack_coreink.menu.DebugLevel.verbose.build.code_debug=5 + +m5stack_coreink.menu.EraseFlash.none=Disabled +m5stack_coreink.menu.EraseFlash.none.upload.erase_cmd= +m5stack_coreink.menu.EraseFlash.all=Enabled +m5stack_coreink.menu.EraseFlash.all.upload.erase_cmd=-e + + +############################################################### + +m5stack_stamp_pico.name=M5StampPico + +m5stack_stamp_pico.bootloader.tool=esptool_py +m5stack_stamp_pico.bootloader.tool.default=esptool_py + +m5stack_stamp_pico.upload.tool=esptool_py +m5stack_stamp_pico.upload.tool.default=esptool_py +m5stack_stamp_pico.upload.tool.network=esp_ota + +m5stack_stamp_pico.upload.maximum_size=1310720 +m5stack_stamp_pico.upload.maximum_data_size=327680 +m5stack_stamp_pico.upload.flags= +m5stack_stamp_pico.upload.extra_flags= + +m5stack_stamp_pico.serial.disableDTR=true +m5stack_stamp_pico.serial.disableRTS=true + +m5stack_stamp_pico.build.tarch=xtensa +m5stack_stamp_pico.build.bootloader_addr=0x1000 +m5stack_stamp_pico.build.target=esp32 +m5stack_stamp_pico.build.mcu=esp32 +m5stack_stamp_pico.build.core=esp32 +m5stack_stamp_pico.build.variant=m5stack_stamp_pico +m5stack_stamp_pico.build.board=M5STACK_STAMP_PICO + +m5stack_stamp_pico.build.f_cpu=240000000L +m5stack_stamp_pico.build.flash_size=4MB +m5stack_stamp_pico.build.flash_freq=80m +m5stack_stamp_pico.build.flash_mode=dio +m5stack_stamp_pico.build.boot=dio +m5stack_stamp_pico.build.partitions=default +m5stack_stamp_pico.build.defines= +m5stack_stamp_pico.build.loop_core= +m5stack_stamp_pico.build.event_core= + +m5stack_stamp_pico.menu.PartitionScheme.default=Default 4MB with spiffs (1.2MB APP/1.5MB SPIFFS) +m5stack_stamp_pico.menu.PartitionScheme.default.build.partitions=default +m5stack_stamp_pico.menu.PartitionScheme.defaultffat=Default 4MB with ffat (1.2MB APP/1.5MB FATFS) +m5stack_stamp_pico.menu.PartitionScheme.defaultffat.build.partitions=default_ffat +m5stack_stamp_pico.menu.PartitionScheme.default_8MB=8M with spiffs (3MB APP/1.5MB SPIFFS) +m5stack_stamp_pico.menu.PartitionScheme.default_8MB.build.partitions=default_8MB +m5stack_stamp_pico.menu.PartitionScheme.default_8MB.upload.maximum_size=3342336 +m5stack_stamp_pico.menu.PartitionScheme.minimal=Minimal (1.3MB APP/700KB SPIFFS) +m5stack_stamp_pico.menu.PartitionScheme.minimal.build.partitions=minimal +m5stack_stamp_pico.menu.PartitionScheme.no_ota=No OTA (2MB APP/2MB SPIFFS) +m5stack_stamp_pico.menu.PartitionScheme.no_ota.build.partitions=no_ota +m5stack_stamp_pico.menu.PartitionScheme.no_ota.upload.maximum_size=2097152 +m5stack_stamp_pico.menu.PartitionScheme.noota_3g=No OTA (1MB APP/3MB SPIFFS) +m5stack_stamp_pico.menu.PartitionScheme.noota_3g.build.partitions=noota_3g +m5stack_stamp_pico.menu.PartitionScheme.noota_3g.upload.maximum_size=1048576 +m5stack_stamp_pico.menu.PartitionScheme.noota_ffat=No OTA (2MB APP/2MB FATFS) +m5stack_stamp_pico.menu.PartitionScheme.noota_ffat.build.partitions=noota_ffat +m5stack_stamp_pico.menu.PartitionScheme.noota_ffat.upload.maximum_size=2097152 +m5stack_stamp_pico.menu.PartitionScheme.noota_3gffat=No OTA (1MB APP/3MB FATFS) +m5stack_stamp_pico.menu.PartitionScheme.noota_3gffat.build.partitions=noota_3gffat +m5stack_stamp_pico.menu.PartitionScheme.noota_3gffat.upload.maximum_size=1048576 +m5stack_stamp_pico.menu.PartitionScheme.huge_app=Huge APP (3MB No OTA/1MB SPIFFS) +m5stack_stamp_pico.menu.PartitionScheme.huge_app.build.partitions=huge_app +m5stack_stamp_pico.menu.PartitionScheme.huge_app.upload.maximum_size=3145728 +m5stack_stamp_pico.menu.PartitionScheme.min_spiffs=Minimal SPIFFS (1.9MB APP with OTA/190KB SPIFFS) +m5stack_stamp_pico.menu.PartitionScheme.min_spiffs.build.partitions=min_spiffs +m5stack_stamp_pico.menu.PartitionScheme.min_spiffs.upload.maximum_size=1966080 +m5stack_stamp_pico.menu.PartitionScheme.fatflash=16M Flash (2MB APP/12.5MB FATFS) +m5stack_stamp_pico.menu.PartitionScheme.fatflash.build.partitions=ffat +m5stack_stamp_pico.menu.PartitionScheme.fatflash.upload.maximum_size=2097152 +m5stack_stamp_pico.menu.PartitionScheme.rainmaker=RainMaker +m5stack_stamp_pico.menu.PartitionScheme.rainmaker.build.partitions=rainmaker +m5stack_stamp_pico.menu.PartitionScheme.rainmaker.upload.maximum_size=3145728 +m5stack_stamp_pico.menu.PartitionScheme.custom=Custom +m5stack_stamp_pico.menu.PartitionScheme.custom.build.partitions= +m5stack_stamp_pico.menu.PartitionScheme.custom.upload.maximum_size=16777216 + +m5stack_stamp_pico.menu.CPUFreq.240=240MHz (WiFi/BT) +m5stack_stamp_pico.menu.CPUFreq.240.build.f_cpu=240000000L +m5stack_stamp_pico.menu.CPUFreq.160=160MHz (WiFi/BT) +m5stack_stamp_pico.menu.CPUFreq.160.build.f_cpu=160000000L +m5stack_stamp_pico.menu.CPUFreq.80=80MHz (WiFi/BT) +m5stack_stamp_pico.menu.CPUFreq.80.build.f_cpu=80000000L +m5stack_stamp_pico.menu.CPUFreq.40=40MHz (40MHz XTAL) +m5stack_stamp_pico.menu.CPUFreq.40.build.f_cpu=40000000L +m5stack_stamp_pico.menu.CPUFreq.26=26MHz (26MHz XTAL) +m5stack_stamp_pico.menu.CPUFreq.26.build.f_cpu=26000000L +m5stack_stamp_pico.menu.CPUFreq.20=20MHz (40MHz XTAL) +m5stack_stamp_pico.menu.CPUFreq.20.build.f_cpu=20000000L +m5stack_stamp_pico.menu.CPUFreq.13=13MHz (26MHz XTAL) +m5stack_stamp_pico.menu.CPUFreq.13.build.f_cpu=13000000L +m5stack_stamp_pico.menu.CPUFreq.10=10MHz (40MHz XTAL) +m5stack_stamp_pico.menu.CPUFreq.10.build.f_cpu=10000000L + +m5stack_stamp_pico.menu.FlashMode.qio=QIO +m5stack_stamp_pico.menu.FlashMode.qio.build.flash_mode=dio +m5stack_stamp_pico.menu.FlashMode.qio.build.boot=qio +m5stack_stamp_pico.menu.FlashMode.dio=DIO +m5stack_stamp_pico.menu.FlashMode.dio.build.flash_mode=dio +m5stack_stamp_pico.menu.FlashMode.dio.build.boot=dio +m5stack_stamp_pico.menu.FlashMode.qout=QOUT +m5stack_stamp_pico.menu.FlashMode.qout.build.flash_mode=dout +m5stack_stamp_pico.menu.FlashMode.qout.build.boot=qout +m5stack_stamp_pico.menu.FlashMode.dout=DOUT +m5stack_stamp_pico.menu.FlashMode.dout.build.flash_mode=dout +m5stack_stamp_pico.menu.FlashMode.dout.build.boot=dout + +m5stack_stamp_pico.menu.FlashFreq.80=80MHz +m5stack_stamp_pico.menu.FlashFreq.80.build.flash_freq=80m +m5stack_stamp_pico.menu.FlashFreq.40=40MHz +m5stack_stamp_pico.menu.FlashFreq.40.build.flash_freq=40m + +m5stack_stamp_pico.menu.FlashSize.4M=4MB (32Mb) +m5stack_stamp_pico.menu.FlashSize.4M.build.flash_size=4MB + +m5stack_stamp_pico.menu.UploadSpeed.1500000=1500000 +m5stack_stamp_pico.menu.UploadSpeed.1500000.upload.speed=1500000 +m5stack_stamp_pico.menu.UploadSpeed.750000=750000 +m5stack_stamp_pico.menu.UploadSpeed.750000.upload.speed=750000 +m5stack_stamp_pico.menu.UploadSpeed.500000=500000 +m5stack_stamp_pico.menu.UploadSpeed.500000.upload.speed=500000 +m5stack_stamp_pico.menu.UploadSpeed.250000=250000 +m5stack_stamp_pico.menu.UploadSpeed.250000.upload.speed=250000 +m5stack_stamp_pico.menu.UploadSpeed.115200=115200 +m5stack_stamp_pico.menu.UploadSpeed.115200.upload.speed=115200 + +m5stack_stamp_pico.menu.LoopCore.1=Core 1 +m5stack_stamp_pico.menu.LoopCore.1.build.loop_core=-DARDUINO_RUNNING_CORE=1 +m5stack_stamp_pico.menu.LoopCore.0=Core 0 +m5stack_stamp_pico.menu.LoopCore.0.build.loop_core=-DARDUINO_RUNNING_CORE=0 + +m5stack_stamp_pico.menu.EventsCore.1=Core 1 +m5stack_stamp_pico.menu.EventsCore.1.build.event_core=-DARDUINO_EVENT_RUNNING_CORE=1 +m5stack_stamp_pico.menu.EventsCore.0=Core 0 +m5stack_stamp_pico.menu.EventsCore.0.build.event_core=-DARDUINO_EVENT_RUNNING_CORE=0 + +m5stack_stamp_pico.menu.DebugLevel.none=None +m5stack_stamp_pico.menu.DebugLevel.none.build.code_debug=0 +m5stack_stamp_pico.menu.DebugLevel.error=Error +m5stack_stamp_pico.menu.DebugLevel.error.build.code_debug=1 +m5stack_stamp_pico.menu.DebugLevel.warn=Warn +m5stack_stamp_pico.menu.DebugLevel.warn.build.code_debug=2 +m5stack_stamp_pico.menu.DebugLevel.info=Info +m5stack_stamp_pico.menu.DebugLevel.info.build.code_debug=3 +m5stack_stamp_pico.menu.DebugLevel.debug=Debug +m5stack_stamp_pico.menu.DebugLevel.debug.build.code_debug=4 +m5stack_stamp_pico.menu.DebugLevel.verbose=Verbose +m5stack_stamp_pico.menu.DebugLevel.verbose.build.code_debug=5 + +m5stack_stamp_pico.menu.EraseFlash.none=Disabled +m5stack_stamp_pico.menu.EraseFlash.none.upload.erase_cmd= +m5stack_stamp_pico.menu.EraseFlash.all=Enabled +m5stack_stamp_pico.menu.EraseFlash.all.upload.erase_cmd=-e + + +############################################################## + +m5stack_stamp_c3.name=M5StampC3 +m5stack_stamp_c3.vid.0=0x303a +m5stack_stamp_c3.pid.0=0x1001 + +m5stack_stamp_c3.bootloader.tool=esptool_py +m5stack_stamp_c3.bootloader.tool.default=esptool_py + +m5stack_stamp_c3.upload.tool=esptool_py +m5stack_stamp_c3.upload.tool.default=esptool_py +m5stack_stamp_c3.upload.tool.network=esp_ota + +m5stack_stamp_c3.upload.maximum_size=1310720 +m5stack_stamp_c3.upload.maximum_data_size=327680 +m5stack_stamp_c3.upload.wait_for_upload_port=false +m5stack_stamp_c3.upload.flags= +m5stack_stamp_c3.upload.extra_flags= + +m5stack_stamp_c3.serial.disableDTR=false +m5stack_stamp_c3.serial.disableRTS=false + +m5stack_stamp_c3.build.tarch=riscv32 +m5stack_stamp_c3.build.target=esp +m5stack_stamp_c3.build.mcu=esp32c3 +m5stack_stamp_c3.build.core=esp32 +m5stack_stamp_c3.build.variant=m5stack_stamp_c3 +m5stack_stamp_c3.build.board=M5STACK_STAMP_C3 +m5stack_stamp_c3.build.bootloader_addr=0x0 + +m5stack_stamp_c3.build.cdc_on_boot=1 +m5stack_stamp_c3.build.f_cpu=160000000L +m5stack_stamp_c3.build.flash_size=4MB +m5stack_stamp_c3.build.flash_freq=80m +m5stack_stamp_c3.build.flash_mode=qio +m5stack_stamp_c3.build.boot=qio +m5stack_stamp_c3.build.partitions=default +m5stack_stamp_c3.build.defines= + +## IDE 2.0 Seems to not update the value +m5stack_stamp_c3.menu.JTAGAdapter.default=Disabled +m5stack_stamp_c3.menu.JTAGAdapter.default.build.copy_jtag_files=0 +m5stack_stamp_c3.menu.JTAGAdapter.builtin=Integrated USB JTAG +m5stack_stamp_c3.menu.JTAGAdapter.builtin.build.openocdscript=esp32c3-builtin.cfg +m5stack_stamp_c3.menu.JTAGAdapter.builtin.build.copy_jtag_files=1 +m5stack_stamp_c3.menu.JTAGAdapter.external=FTDI Adapter +m5stack_stamp_c3.menu.JTAGAdapter.external.build.openocdscript=esp32c3-ftdi.cfg +m5stack_stamp_c3.menu.JTAGAdapter.external.build.copy_jtag_files=1 +m5stack_stamp_c3.menu.JTAGAdapter.bridge=ESP USB Bridge +m5stack_stamp_c3.menu.JTAGAdapter.bridge.build.openocdscript=esp32c3-bridge.cfg +m5stack_stamp_c3.menu.JTAGAdapter.bridge.build.copy_jtag_files=1 + +m5stack_stamp_c3.menu.CDCOnBoot.cdc=Enabled +m5stack_stamp_c3.menu.CDCOnBoot.cdc.build.cdc_on_boot=1 +m5stack_stamp_c3.menu.CDCOnBoot.default=Disabled +m5stack_stamp_c3.menu.CDCOnBoot.default.build.cdc_on_boot=0 + +m5stack_stamp_c3.menu.PartitionScheme.default=Default 4MB with spiffs (1.2MB APP/1.5MB SPIFFS) +m5stack_stamp_c3.menu.PartitionScheme.default.build.partitions=default +m5stack_stamp_c3.menu.PartitionScheme.defaultffat=Default 4MB with ffat (1.2MB APP/1.5MB FATFS) +m5stack_stamp_c3.menu.PartitionScheme.defaultffat.build.partitions=default_ffat +m5stack_stamp_c3.menu.PartitionScheme.minimal=Minimal (1.3MB APP/700KB SPIFFS) +m5stack_stamp_c3.menu.PartitionScheme.minimal.build.partitions=minimal +m5stack_stamp_c3.menu.PartitionScheme.no_ota=No OTA (2MB APP/2MB SPIFFS) +m5stack_stamp_c3.menu.PartitionScheme.no_ota.build.partitions=no_ota +m5stack_stamp_c3.menu.PartitionScheme.no_ota.upload.maximum_size=2097152 +m5stack_stamp_c3.menu.PartitionScheme.noota_3g=No OTA (1MB APP/3MB SPIFFS) +m5stack_stamp_c3.menu.PartitionScheme.noota_3g.build.partitions=noota_3g +m5stack_stamp_c3.menu.PartitionScheme.noota_3g.upload.maximum_size=1048576 +m5stack_stamp_c3.menu.PartitionScheme.noota_ffat=No OTA (2MB APP/2MB FATFS) +m5stack_stamp_c3.menu.PartitionScheme.noota_ffat.build.partitions=noota_ffat +m5stack_stamp_c3.menu.PartitionScheme.noota_ffat.upload.maximum_size=2097152 +m5stack_stamp_c3.menu.PartitionScheme.noota_3gffat=No OTA (1MB APP/3MB FATFS) +m5stack_stamp_c3.menu.PartitionScheme.noota_3gffat.build.partitions=noota_3gffat +m5stack_stamp_c3.menu.PartitionScheme.noota_3gffat.upload.maximum_size=1048576 +m5stack_stamp_c3.menu.PartitionScheme.huge_app=Huge APP (3MB No OTA/1MB SPIFFS) +m5stack_stamp_c3.menu.PartitionScheme.huge_app.build.partitions=huge_app +m5stack_stamp_c3.menu.PartitionScheme.huge_app.upload.maximum_size=3145728 +m5stack_stamp_c3.menu.PartitionScheme.min_spiffs=Minimal SPIFFS (1.9MB APP with OTA/190KB SPIFFS) +m5stack_stamp_c3.menu.PartitionScheme.min_spiffs.build.partitions=min_spiffs +m5stack_stamp_c3.menu.PartitionScheme.min_spiffs.upload.maximum_size=1966080 + + +m5stack_stamp_c3.menu.CPUFreq.160=160MHz (WiFi) +m5stack_stamp_c3.menu.CPUFreq.160.build.f_cpu=160000000L +m5stack_stamp_c3.menu.CPUFreq.80=80MHz (WiFi) +m5stack_stamp_c3.menu.CPUFreq.80.build.f_cpu=80000000L +m5stack_stamp_c3.menu.CPUFreq.40=40MHz +m5stack_stamp_c3.menu.CPUFreq.40.build.f_cpu=40000000L +m5stack_stamp_c3.menu.CPUFreq.20=20MHz +m5stack_stamp_c3.menu.CPUFreq.20.build.f_cpu=20000000L +m5stack_stamp_c3.menu.CPUFreq.10=10MHz +m5stack_stamp_c3.menu.CPUFreq.10.build.f_cpu=10000000L + +m5stack_stamp_c3.menu.FlashMode.qio=QIO +m5stack_stamp_c3.menu.FlashMode.qio.build.flash_mode=dio +m5stack_stamp_c3.menu.FlashMode.qio.build.boot=qio +m5stack_stamp_c3.menu.FlashMode.dio=DIO +m5stack_stamp_c3.menu.FlashMode.dio.build.flash_mode=dio +m5stack_stamp_c3.menu.FlashMode.dio.build.boot=dio +m5stack_stamp_c3.menu.FlashMode.qout=QOUT +m5stack_stamp_c3.menu.FlashMode.qout.build.flash_mode=dout +m5stack_stamp_c3.menu.FlashMode.qout.build.boot=qout +m5stack_stamp_c3.menu.FlashMode.dout=DOUT +m5stack_stamp_c3.menu.FlashMode.dout.build.flash_mode=dout +m5stack_stamp_c3.menu.FlashMode.dout.build.boot=dout + +m5stack_stamp_c3.menu.FlashFreq.80=80MHz +m5stack_stamp_c3.menu.FlashFreq.80.build.flash_freq=80m +m5stack_stamp_c3.menu.FlashFreq.40=40MHz +m5stack_stamp_c3.menu.FlashFreq.40.build.flash_freq=40m + +m5stack_stamp_c3.menu.FlashSize.4M=4MB (32Mb) +m5stack_stamp_c3.menu.FlashSize.4M.build.flash_size=4MB + +m5stack_stamp_c3.menu.UploadSpeed.921600=921600 +m5stack_stamp_c3.menu.UploadSpeed.921600.upload.speed=921600 +m5stack_stamp_c3.menu.UploadSpeed.115200=115200 +m5stack_stamp_c3.menu.UploadSpeed.115200.upload.speed=115200 +m5stack_stamp_c3.menu.UploadSpeed.256000.windows=256000 +m5stack_stamp_c3.menu.UploadSpeed.256000.upload.speed=256000 +m5stack_stamp_c3.menu.UploadSpeed.230400.windows.upload.speed=256000 +m5stack_stamp_c3.menu.UploadSpeed.230400=230400 +m5stack_stamp_c3.menu.UploadSpeed.230400.upload.speed=230400 +m5stack_stamp_c3.menu.UploadSpeed.460800.linux=460800 +m5stack_stamp_c3.menu.UploadSpeed.460800.macosx=460800 +m5stack_stamp_c3.menu.UploadSpeed.460800.upload.speed=460800 +m5stack_stamp_c3.menu.UploadSpeed.512000.windows=512000 +m5stack_stamp_c3.menu.UploadSpeed.512000.upload.speed=512000 + +m5stack_stamp_c3.menu.DebugLevel.none=None +m5stack_stamp_c3.menu.DebugLevel.none.build.code_debug=0 +m5stack_stamp_c3.menu.DebugLevel.error=Error +m5stack_stamp_c3.menu.DebugLevel.error.build.code_debug=1 +m5stack_stamp_c3.menu.DebugLevel.warn=Warn +m5stack_stamp_c3.menu.DebugLevel.warn.build.code_debug=2 +m5stack_stamp_c3.menu.DebugLevel.info=Info +m5stack_stamp_c3.menu.DebugLevel.info.build.code_debug=3 +m5stack_stamp_c3.menu.DebugLevel.debug=Debug +m5stack_stamp_c3.menu.DebugLevel.debug.build.code_debug=4 +m5stack_stamp_c3.menu.DebugLevel.verbose=Verbose +m5stack_stamp_c3.menu.DebugLevel.verbose.build.code_debug=5 + +m5stack_stamp_c3.menu.EraseFlash.none=Disabled +m5stack_stamp_c3.menu.EraseFlash.none.upload.erase_cmd= +m5stack_stamp_c3.menu.EraseFlash.all=Enabled +m5stack_stamp_c3.menu.EraseFlash.all.upload.erase_cmd=-e ############################################################### -m5stamp-pico.name=M5Stamp-Pico - -m5stamp-pico.bootloader.tool=esptool_py -m5stamp-pico.bootloader.tool.default=esptool_py - -m5stamp-pico.upload.tool=esptool_py -m5stamp-pico.upload.tool.default=esptool_py -m5stamp-pico.upload.tool.network=esp_ota - -m5stamp-pico.upload.maximum_size=1310720 -m5stamp-pico.upload.maximum_data_size=327680 -m5stamp-pico.upload.wait_for_upload_port=true -m5stamp-pico.upload.flags= -m5stamp-pico.upload.extra_flags= - -m5stamp-pico.serial.disableDTR=true -m5stamp-pico.serial.disableRTS=true - -m5stamp-pico.build.tarch=xtensa -m5stamp-pico.build.bootloader_addr=0x1000 -m5stamp-pico.build.target=esp32 -m5stamp-pico.build.mcu=esp32 -m5stamp-pico.build.core=esp32 -m5stamp-pico.build.variant=m5stack_stamp_pico -m5stamp-pico.build.board=M5Stamp_Pico - -m5stamp-pico.build.f_cpu=240000000L -m5stamp-pico.build.flash_size=4MB -m5stamp-pico.build.flash_freq=80m -m5stamp-pico.build.flash_mode=dio -m5stamp-pico.build.boot=dio -m5stamp-pico.build.partitions=default -m5stamp-pico.build.defines= - -m5stamp-pico.menu.PartitionScheme.default=Default -m5stamp-pico.menu.PartitionScheme.default.build.partitions=default -m5stamp-pico.menu.PartitionScheme.no_ota=No OTA (Large APP) -m5stamp-pico.menu.PartitionScheme.no_ota.build.partitions=no_ota -m5stamp-pico.menu.PartitionScheme.no_ota.upload.maximum_size=2097152 -m5stamp-pico.menu.PartitionScheme.min_spiffs=Minimal SPIFFS (Large APPS with OTA) -m5stamp-pico.menu.PartitionScheme.min_spiffs.build.partitions=min_spiffs -m5stamp-pico.menu.PartitionScheme.min_spiffs.upload.maximum_size=1966080 - - -m5stamp-pico.menu.UploadSpeed.1500000=1500000 -m5stamp-pico.menu.UploadSpeed.1500000.upload.speed=1500000 -m5stamp-pico.menu.UploadSpeed.750000=750000 -m5stamp-pico.menu.UploadSpeed.750000.upload.speed=750000 -m5stamp-pico.menu.UploadSpeed.500000=500000 -m5stamp-pico.menu.UploadSpeed.500000.upload.speed=500000 -m5stamp-pico.menu.UploadSpeed.250000=250000 -m5stamp-pico.menu.UploadSpeed.250000.upload.speed=250000 -m5stamp-pico.menu.UploadSpeed.115200=115200 -m5stamp-pico.menu.UploadSpeed.115200.upload.speed=115200 - -m5stamp-pico.menu.DebugLevel.none=None -m5stamp-pico.menu.DebugLevel.none.build.code_debug=0 -m5stamp-pico.menu.DebugLevel.error=Error -m5stamp-pico.menu.DebugLevel.error.build.code_debug=1 -m5stamp-pico.menu.DebugLevel.warn=Warn -m5stamp-pico.menu.DebugLevel.warn.build.code_debug=2 -m5stamp-pico.menu.DebugLevel.info=Info -m5stamp-pico.menu.DebugLevel.info.build.code_debug=3 -m5stamp-pico.menu.DebugLevel.debug=Debug -m5stamp-pico.menu.DebugLevel.debug.build.code_debug=4 -m5stamp-pico.menu.DebugLevel.verbose=Verbose -m5stamp-pico.menu.DebugLevel.verbose.build.code_debug=5 - -m5stamp-pico.menu.EraseFlash.none=Disabled -m5stamp-pico.menu.EraseFlash.none.upload.erase_cmd= -m5stamp-pico.menu.EraseFlash.all=Enabled -m5stamp-pico.menu.EraseFlash.all.upload.erase_cmd=-e +m5stack_stamp_s3.name=M5StampS3 +m5stack_stamp_s3.vid.0=0x303a +m5stack_stamp_s3.pid.0=0x1001 +m5stack_stamp_s3.bootloader.tool=esptool_py +m5stack_stamp_s3.bootloader.tool.default=esptool_py + +m5stack_stamp_s3.upload.tool=esptool_py +m5stack_stamp_s3.upload.tool.default=esptool_py +m5stack_stamp_s3.upload.tool.network=esp_ota + +m5stack_stamp_s3.upload.maximum_size=1310720 +m5stack_stamp_s3.upload.maximum_data_size=327680 +m5stack_stamp_s3.upload.flags= +m5stack_stamp_s3.upload.extra_flags= +m5stack_stamp_s3.upload.use_1200bps_touch=false +m5stack_stamp_s3.upload.wait_for_upload_port=false + +m5stack_stamp_s3.serial.disableDTR=false +m5stack_stamp_s3.serial.disableRTS=false + +m5stack_stamp_s3.build.tarch=xtensa +m5stack_stamp_s3.build.bootloader_addr=0x0 +m5stack_stamp_s3.build.target=esp32s3 +m5stack_stamp_s3.build.mcu=esp32s3 +m5stack_stamp_s3.build.core=esp32 +m5stack_stamp_s3.build.variant=m5stack_stamp_s3 +m5stack_stamp_s3.build.board=M5STACK_STAMP_S3 + +m5stack_stamp_s3.build.usb_mode=1 +m5stack_stamp_s3.build.cdc_on_boot=1 +m5stack_stamp_s3.build.msc_on_boot=0 +m5stack_stamp_s3.build.dfu_on_boot=0 +m5stack_stamp_s3.build.f_cpu=240000000L +m5stack_stamp_s3.build.flash_size=8MB +m5stack_stamp_s3.build.flash_freq=80m +m5stack_stamp_s3.build.flash_mode=dio +m5stack_stamp_s3.build.boot=qio +m5stack_stamp_s3.build.boot_freq=80m +m5stack_stamp_s3.build.partitions=default +m5stack_stamp_s3.build.defines= +m5stack_stamp_s3.build.loop_core= +m5stack_stamp_s3.build.event_core= +m5stack_stamp_s3.build.psram_type=qspi +m5stack_stamp_s3.build.memory_type={build.boot}_{build.psram_type} + +## IDE 2.0 Seems to not update the value +m5stack_stamp_s3.menu.JTAGAdapter.default=Disabled +m5stack_stamp_s3.menu.JTAGAdapter.default.build.copy_jtag_files=0 +m5stack_stamp_s3.menu.JTAGAdapter.builtin=Integrated USB JTAG +m5stack_stamp_s3.menu.JTAGAdapter.builtin.build.openocdscript=esp32s3-builtin.cfg +m5stack_stamp_s3.menu.JTAGAdapter.builtin.build.copy_jtag_files=1 +m5stack_stamp_s3.menu.JTAGAdapter.external=FTDI Adapter +m5stack_stamp_s3.menu.JTAGAdapter.external.build.openocdscript=esp32s3-ftdi.cfg +m5stack_stamp_s3.menu.JTAGAdapter.external.build.copy_jtag_files=1 +m5stack_stamp_s3.menu.JTAGAdapter.bridge=ESP USB Bridge +m5stack_stamp_s3.menu.JTAGAdapter.bridge.build.openocdscript=esp32s3-bridge.cfg +m5stack_stamp_s3.menu.JTAGAdapter.bridge.build.copy_jtag_files=1 + +m5stack_stamp_s3.menu.PSRAM.disabled=Disabled +m5stack_stamp_s3.menu.PSRAM.disabled.build.defines= +m5stack_stamp_s3.menu.PSRAM.disabled.build.psram_type=qspi +m5stack_stamp_s3.menu.PSRAM.enabled=QSPI PSRAM +m5stack_stamp_s3.menu.PSRAM.enabled.build.defines=-DBOARD_HAS_PSRAM +m5stack_stamp_s3.menu.PSRAM.enabled.build.psram_type=qspi +m5stack_stamp_s3.menu.PSRAM.opi=OPI PSRAM +m5stack_stamp_s3.menu.PSRAM.opi.build.defines=-DBOARD_HAS_PSRAM +m5stack_stamp_s3.menu.PSRAM.opi.build.psram_type=opi + +m5stack_stamp_s3.menu.FlashMode.qio=QIO 80MHz +m5stack_stamp_s3.menu.FlashMode.qio.build.flash_mode=dio +m5stack_stamp_s3.menu.FlashMode.qio.build.boot=qio +m5stack_stamp_s3.menu.FlashMode.qio.build.boot_freq=80m +m5stack_stamp_s3.menu.FlashMode.qio.build.flash_freq=80m +m5stack_stamp_s3.menu.FlashMode.qio120=QIO 120MHz +m5stack_stamp_s3.menu.FlashMode.qio120.build.flash_mode=dio +m5stack_stamp_s3.menu.FlashMode.qio120.build.boot=qio +m5stack_stamp_s3.menu.FlashMode.qio120.build.boot_freq=120m +m5stack_stamp_s3.menu.FlashMode.qio120.build.flash_freq=80m +m5stack_stamp_s3.menu.FlashMode.dio=DIO 80MHz +m5stack_stamp_s3.menu.FlashMode.dio.build.flash_mode=dio +m5stack_stamp_s3.menu.FlashMode.dio.build.boot=dio +m5stack_stamp_s3.menu.FlashMode.dio.build.boot_freq=80m +m5stack_stamp_s3.menu.FlashMode.dio.build.flash_freq=80m +m5stack_stamp_s3.menu.FlashMode.opi=OPI 80MHz +m5stack_stamp_s3.menu.FlashMode.opi.build.flash_mode=dout +m5stack_stamp_s3.menu.FlashMode.opi.build.boot=opi +m5stack_stamp_s3.menu.FlashMode.opi.build.boot_freq=80m +m5stack_stamp_s3.menu.FlashMode.opi.build.flash_freq=80m + +m5stack_stamp_s3.menu.FlashSize.4M=4MB (32Mb) +m5stack_stamp_s3.menu.FlashSize.4M.build.flash_size=4MB +m5stack_stamp_s3.menu.FlashSize.8M=8MB (64Mb) +m5stack_stamp_s3.menu.FlashSize.8M.build.flash_size=8MB +m5stack_stamp_s3.menu.FlashSize.8M.build.partitions=default_8MB +m5stack_stamp_s3.menu.FlashSize.16M=16MB (128Mb) +m5stack_stamp_s3.menu.FlashSize.16M.build.flash_size=16MB +m5stack_stamp_s3.menu.FlashSize.32M=32MB (256Mb) +m5stack_stamp_s3.menu.FlashSize.32M.build.flash_size=32MB +m5stack_stamp_s3.menu.FlashSize.32M.build.partitions=app5M_fat24M_32MB + +m5stack_stamp_s3.menu.LoopCore.1=Core 1 +m5stack_stamp_s3.menu.LoopCore.1.build.loop_core=-DARDUINO_RUNNING_CORE=1 +m5stack_stamp_s3.menu.LoopCore.0=Core 0 +m5stack_stamp_s3.menu.LoopCore.0.build.loop_core=-DARDUINO_RUNNING_CORE=0 + +m5stack_stamp_s3.menu.EventsCore.1=Core 1 +m5stack_stamp_s3.menu.EventsCore.1.build.event_core=-DARDUINO_EVENT_RUNNING_CORE=1 +m5stack_stamp_s3.menu.EventsCore.0=Core 0 +m5stack_stamp_s3.menu.EventsCore.0.build.event_core=-DARDUINO_EVENT_RUNNING_CORE=0 + +m5stack_stamp_s3.menu.USBMode.hwcdc=Hardware CDC and JTAG +m5stack_stamp_s3.menu.USBMode.hwcdc.build.usb_mode=1 +m5stack_stamp_s3.menu.USBMode.default=USB-OTG (TinyUSB) +m5stack_stamp_s3.menu.USBMode.default.build.usb_mode=0 + +m5stack_stamp_s3.menu.CDCOnBoot.cdc=Enabled +m5stack_stamp_s3.menu.CDCOnBoot.cdc.build.cdc_on_boot=1 +m5stack_stamp_s3.menu.CDCOnBoot.default=Disabled +m5stack_stamp_s3.menu.CDCOnBoot.default.build.cdc_on_boot=0 + +m5stack_stamp_s3.menu.MSCOnBoot.default=Disabled +m5stack_stamp_s3.menu.MSCOnBoot.default.build.msc_on_boot=0 +m5stack_stamp_s3.menu.MSCOnBoot.msc=Enabled (Requires USB-OTG Mode) +m5stack_stamp_s3.menu.MSCOnBoot.msc.build.msc_on_boot=1 + +m5stack_stamp_s3.menu.DFUOnBoot.default=Disabled +m5stack_stamp_s3.menu.DFUOnBoot.default.build.dfu_on_boot=0 +m5stack_stamp_s3.menu.DFUOnBoot.dfu=Enabled (Requires USB-OTG Mode) +m5stack_stamp_s3.menu.DFUOnBoot.dfu.build.dfu_on_boot=1 + +m5stack_stamp_s3.menu.UploadMode.default=UART0 / Hardware CDC +m5stack_stamp_s3.menu.UploadMode.default.upload.use_1200bps_touch=false +m5stack_stamp_s3.menu.UploadMode.default.upload.wait_for_upload_port=false +m5stack_stamp_s3.menu.UploadMode.cdc=USB-OTG CDC (TinyUSB) +m5stack_stamp_s3.menu.UploadMode.cdc.upload.use_1200bps_touch=true +m5stack_stamp_s3.menu.UploadMode.cdc.upload.wait_for_upload_port=true + +m5stack_stamp_s3.menu.PartitionScheme.default=Default 4MB with spiffs (1.2MB APP/1.5MB SPIFFS) +m5stack_stamp_s3.menu.PartitionScheme.default.build.partitions=default +m5stack_stamp_s3.menu.PartitionScheme.defaultffat=Default 4MB with ffat (1.2MB APP/1.5MB FATFS) +m5stack_stamp_s3.menu.PartitionScheme.defaultffat.build.partitions=default_ffat +m5stack_stamp_s3.menu.PartitionScheme.default_8MB=8M with spiffs (3MB APP/1.5MB SPIFFS) +m5stack_stamp_s3.menu.PartitionScheme.default_8MB.build.partitions=default_8MB +m5stack_stamp_s3.menu.PartitionScheme.default_8MB.upload.maximum_size=3342336 +m5stack_stamp_s3.menu.PartitionScheme.minimal=Minimal (1.3MB APP/700KB SPIFFS) +m5stack_stamp_s3.menu.PartitionScheme.minimal.build.partitions=minimal +m5stack_stamp_s3.menu.PartitionScheme.no_ota=No OTA (2MB APP/2MB SPIFFS) +m5stack_stamp_s3.menu.PartitionScheme.no_ota.build.partitions=no_ota +m5stack_stamp_s3.menu.PartitionScheme.no_ota.upload.maximum_size=2097152 +m5stack_stamp_s3.menu.PartitionScheme.noota_3g=No OTA (1MB APP/3MB SPIFFS) +m5stack_stamp_s3.menu.PartitionScheme.noota_3g.build.partitions=noota_3g +m5stack_stamp_s3.menu.PartitionScheme.noota_3g.upload.maximum_size=1048576 +m5stack_stamp_s3.menu.PartitionScheme.noota_ffat=No OTA (2MB APP/2MB FATFS) +m5stack_stamp_s3.menu.PartitionScheme.noota_ffat.build.partitions=noota_ffat +m5stack_stamp_s3.menu.PartitionScheme.noota_ffat.upload.maximum_size=2097152 +m5stack_stamp_s3.menu.PartitionScheme.noota_3gffat=No OTA (1MB APP/3MB FATFS) +m5stack_stamp_s3.menu.PartitionScheme.noota_3gffat.build.partitions=noota_3gffat +m5stack_stamp_s3.menu.PartitionScheme.noota_3gffat.upload.maximum_size=1048576 +m5stack_stamp_s3.menu.PartitionScheme.huge_app=Huge APP (3MB No OTA/1MB SPIFFS) +m5stack_stamp_s3.menu.PartitionScheme.huge_app.build.partitions=huge_app +m5stack_stamp_s3.menu.PartitionScheme.huge_app.upload.maximum_size=3145728 +m5stack_stamp_s3.menu.PartitionScheme.min_spiffs=Minimal SPIFFS (1.9MB APP with OTA/190KB SPIFFS) +m5stack_stamp_s3.menu.PartitionScheme.min_spiffs.build.partitions=min_spiffs +m5stack_stamp_s3.menu.PartitionScheme.min_spiffs.upload.maximum_size=1966080 +m5stack_stamp_s3.menu.PartitionScheme.fatflash=16M Flash (2MB APP/12.5MB FATFS) +m5stack_stamp_s3.menu.PartitionScheme.fatflash.build.partitions=ffat +m5stack_stamp_s3.menu.PartitionScheme.fatflash.upload.maximum_size=2097152 +m5stack_stamp_s3.menu.PartitionScheme.app3M_fat9M_16MB=16M Flash (3MB APP/9.9MB FATFS) +m5stack_stamp_s3.menu.PartitionScheme.app3M_fat9M_16MB.build.partitions=app3M_fat9M_16MB +m5stack_stamp_s3.menu.PartitionScheme.app3M_fat9M_16MB.upload.maximum_size=3145728 +m5stack_stamp_s3.menu.PartitionScheme.rainmaker=RainMaker +m5stack_stamp_s3.menu.PartitionScheme.rainmaker.build.partitions=rainmaker +m5stack_stamp_s3.menu.PartitionScheme.rainmaker.upload.maximum_size=3145728 +m5stack_stamp_s3.menu.PartitionScheme.app5M_fat24M_32MB=32M Flash (4.8MB APP/22MB FATFS) +m5stack_stamp_s3.menu.PartitionScheme.app5M_fat24M_32MB.build.partitions=large_fat_32MB +m5stack_stamp_s3.menu.PartitionScheme.app5M_fat24M_32MB.upload.maximum_size=4718592 +m5stack_stamp_s3.menu.PartitionScheme.app5M_little24M_32MB=32M Flash (4.8MB APP/22MB LittleFS) +m5stack_stamp_s3.menu.PartitionScheme.app5M_little24M_32MB.build.partitions=large_littlefs_32MB +m5stack_stamp_s3.menu.PartitionScheme.app5M_little24M_32MB.upload.maximum_size=4718592 +m5stack_stamp_s3.menu.PartitionScheme.esp_sr_16=ESP SR 16M (3MB APP/7MB SPIFFS/2.9MB MODEL) +m5stack_stamp_s3.menu.PartitionScheme.esp_sr_16.upload.maximum_size=3145728 +m5stack_stamp_s3.menu.PartitionScheme.esp_sr_16.upload.extra_flags=0xD10000 {build.path}/srmodels.bin +m5stack_stamp_s3.menu.PartitionScheme.esp_sr_16.build.partitions=esp_sr_16 +m5stack_stamp_s3.menu.PartitionScheme.custom=Custom +m5stack_stamp_s3.menu.PartitionScheme.custom.build.partitions= +m5stack_stamp_s3.menu.PartitionScheme.custom.upload.maximum_size=16777216 + +m5stack_stamp_s3.menu.CPUFreq.240=240MHz (WiFi) +m5stack_stamp_s3.menu.CPUFreq.240.build.f_cpu=240000000L +m5stack_stamp_s3.menu.CPUFreq.160=160MHz (WiFi) +m5stack_stamp_s3.menu.CPUFreq.160.build.f_cpu=160000000L +m5stack_stamp_s3.menu.CPUFreq.80=80MHz (WiFi) +m5stack_stamp_s3.menu.CPUFreq.80.build.f_cpu=80000000L +m5stack_stamp_s3.menu.CPUFreq.40=40MHz +m5stack_stamp_s3.menu.CPUFreq.40.build.f_cpu=40000000L +m5stack_stamp_s3.menu.CPUFreq.20=20MHz +m5stack_stamp_s3.menu.CPUFreq.20.build.f_cpu=20000000L +m5stack_stamp_s3.menu.CPUFreq.10=10MHz +m5stack_stamp_s3.menu.CPUFreq.10.build.f_cpu=10000000L + +m5stack_stamp_s3.menu.UploadSpeed.921600=921600 +m5stack_stamp_s3.menu.UploadSpeed.921600.upload.speed=921600 +m5stack_stamp_s3.menu.UploadSpeed.115200=115200 +m5stack_stamp_s3.menu.UploadSpeed.115200.upload.speed=115200 +m5stack_stamp_s3.menu.UploadSpeed.256000.windows=256000 +m5stack_stamp_s3.menu.UploadSpeed.256000.upload.speed=256000 +m5stack_stamp_s3.menu.UploadSpeed.230400.windows.upload.speed=256000 +m5stack_stamp_s3.menu.UploadSpeed.230400=230400 +m5stack_stamp_s3.menu.UploadSpeed.230400.upload.speed=230400 +m5stack_stamp_s3.menu.UploadSpeed.460800.linux=460800 +m5stack_stamp_s3.menu.UploadSpeed.460800.macosx=460800 +m5stack_stamp_s3.menu.UploadSpeed.460800.upload.speed=460800 +m5stack_stamp_s3.menu.UploadSpeed.512000.windows=512000 +m5stack_stamp_s3.menu.UploadSpeed.512000.upload.speed=512000 + +m5stack_stamp_s3.menu.DebugLevel.none=None +m5stack_stamp_s3.menu.DebugLevel.none.build.code_debug=0 +m5stack_stamp_s3.menu.DebugLevel.error=Error +m5stack_stamp_s3.menu.DebugLevel.error.build.code_debug=1 +m5stack_stamp_s3.menu.DebugLevel.warn=Warn +m5stack_stamp_s3.menu.DebugLevel.warn.build.code_debug=2 +m5stack_stamp_s3.menu.DebugLevel.info=Info +m5stack_stamp_s3.menu.DebugLevel.info.build.code_debug=3 +m5stack_stamp_s3.menu.DebugLevel.debug=Debug +m5stack_stamp_s3.menu.DebugLevel.debug.build.code_debug=4 +m5stack_stamp_s3.menu.DebugLevel.verbose=Verbose +m5stack_stamp_s3.menu.DebugLevel.verbose.build.code_debug=5 + +m5stack_stamp_s3.menu.EraseFlash.none=Disabled +m5stack_stamp_s3.menu.EraseFlash.none.upload.erase_cmd= +m5stack_stamp_s3.menu.EraseFlash.all=Enabled +m5stack_stamp_s3.menu.EraseFlash.all.upload.erase_cmd=-e + + +############################################################## + +m5stack_capsule.name=M5Capsule +m5stack_capsule.vid.0=0x303a +m5stack_capsule.pid.0=0x1001 +m5stack_capsule.bootloader.tool=esptool_py +m5stack_capsule.bootloader.tool.default=esptool_py + +m5stack_capsule.upload.tool=esptool_py +m5stack_capsule.upload.tool.default=esptool_py +m5stack_capsule.upload.tool.network=esp_ota + +m5stack_capsule.upload.maximum_size=1310720 +m5stack_capsule.upload.maximum_data_size=327680 +m5stack_capsule.upload.flags= +m5stack_capsule.upload.extra_flags= +m5stack_capsule.upload.use_1200bps_touch=false +m5stack_capsule.upload.wait_for_upload_port=false + +m5stack_capsule.serial.disableDTR=false +m5stack_capsule.serial.disableRTS=false + +m5stack_capsule.build.tarch=xtensa +m5stack_capsule.build.bootloader_addr=0x0 +m5stack_capsule.build.target=esp32s3 +m5stack_capsule.build.mcu=esp32s3 +m5stack_capsule.build.core=esp32 +m5stack_capsule.build.variant=m5stack_capsule +m5stack_capsule.build.board=M5STACK_CAPSULE + +m5stack_capsule.build.usb_mode=1 +m5stack_capsule.build.cdc_on_boot=1 +m5stack_capsule.build.msc_on_boot=0 +m5stack_capsule.build.dfu_on_boot=0 +m5stack_capsule.build.f_cpu=240000000L +m5stack_capsule.build.flash_size=8MB +m5stack_capsule.build.flash_freq=80m +m5stack_capsule.build.flash_mode=dio +m5stack_capsule.build.boot=qio +m5stack_capsule.build.boot_freq=80m +m5stack_capsule.build.partitions=default +m5stack_capsule.build.defines= +m5stack_capsule.build.loop_core= +m5stack_capsule.build.event_core= +m5stack_capsule.build.psram_type=qspi +m5stack_capsule.build.memory_type={build.boot}_{build.psram_type} + +## IDE 2.0 Seems to not update the value +m5stack_capsule.menu.JTAGAdapter.default=Disabled +m5stack_capsule.menu.JTAGAdapter.default.build.copy_jtag_files=0 +m5stack_capsule.menu.JTAGAdapter.builtin=Integrated USB JTAG +m5stack_capsule.menu.JTAGAdapter.builtin.build.openocdscript=esp32s3-builtin.cfg +m5stack_capsule.menu.JTAGAdapter.builtin.build.copy_jtag_files=1 +m5stack_capsule.menu.JTAGAdapter.external=FTDI Adapter +m5stack_capsule.menu.JTAGAdapter.external.build.openocdscript=esp32s3-ftdi.cfg +m5stack_capsule.menu.JTAGAdapter.external.build.copy_jtag_files=1 +m5stack_capsule.menu.JTAGAdapter.bridge=ESP USB Bridge +m5stack_capsule.menu.JTAGAdapter.bridge.build.openocdscript=esp32s3-bridge.cfg +m5stack_capsule.menu.JTAGAdapter.bridge.build.copy_jtag_files=1 + +m5stack_capsule.menu.PSRAM.disabled=Disabled +m5stack_capsule.menu.PSRAM.disabled.build.defines= +m5stack_capsule.menu.PSRAM.disabled.build.psram_type=qspi +m5stack_capsule.menu.PSRAM.enabled=QSPI PSRAM +m5stack_capsule.menu.PSRAM.enabled.build.defines=-DBOARD_HAS_PSRAM +m5stack_capsule.menu.PSRAM.enabled.build.psram_type=qspi +m5stack_capsule.menu.PSRAM.opi=OPI PSRAM +m5stack_capsule.menu.PSRAM.opi.build.defines=-DBOARD_HAS_PSRAM +m5stack_capsule.menu.PSRAM.opi.build.psram_type=opi + +m5stack_capsule.menu.FlashMode.qio=QIO 80MHz +m5stack_capsule.menu.FlashMode.qio.build.flash_mode=dio +m5stack_capsule.menu.FlashMode.qio.build.boot=qio +m5stack_capsule.menu.FlashMode.qio.build.boot_freq=80m +m5stack_capsule.menu.FlashMode.qio.build.flash_freq=80m +m5stack_capsule.menu.FlashMode.qio120=QIO 120MHz +m5stack_capsule.menu.FlashMode.qio120.build.flash_mode=dio +m5stack_capsule.menu.FlashMode.qio120.build.boot=qio +m5stack_capsule.menu.FlashMode.qio120.build.boot_freq=120m +m5stack_capsule.menu.FlashMode.qio120.build.flash_freq=80m +m5stack_capsule.menu.FlashMode.dio=DIO 80MHz +m5stack_capsule.menu.FlashMode.dio.build.flash_mode=dio +m5stack_capsule.menu.FlashMode.dio.build.boot=dio +m5stack_capsule.menu.FlashMode.dio.build.boot_freq=80m +m5stack_capsule.menu.FlashMode.dio.build.flash_freq=80m +m5stack_capsule.menu.FlashMode.opi=OPI 80MHz +m5stack_capsule.menu.FlashMode.opi.build.flash_mode=dout +m5stack_capsule.menu.FlashMode.opi.build.boot=opi +m5stack_capsule.menu.FlashMode.opi.build.boot_freq=80m +m5stack_capsule.menu.FlashMode.opi.build.flash_freq=80m + +m5stack_capsule.menu.FlashSize.4M=4MB (32Mb) +m5stack_capsule.menu.FlashSize.4M.build.flash_size=4MB +m5stack_capsule.menu.FlashSize.8M=8MB (64Mb) +m5stack_capsule.menu.FlashSize.8M.build.flash_size=8MB +m5stack_capsule.menu.FlashSize.8M.build.partitions=default_8MB +m5stack_capsule.menu.FlashSize.16M=16MB (128Mb) +m5stack_capsule.menu.FlashSize.16M.build.flash_size=16MB +m5stack_capsule.menu.FlashSize.32M=32MB (256Mb) +m5stack_capsule.menu.FlashSize.32M.build.flash_size=32MB +m5stack_capsule.menu.FlashSize.32M.build.partitions=app5M_fat24M_32MB + +m5stack_capsule.menu.LoopCore.1=Core 1 +m5stack_capsule.menu.LoopCore.1.build.loop_core=-DARDUINO_RUNNING_CORE=1 +m5stack_capsule.menu.LoopCore.0=Core 0 +m5stack_capsule.menu.LoopCore.0.build.loop_core=-DARDUINO_RUNNING_CORE=0 + +m5stack_capsule.menu.EventsCore.1=Core 1 +m5stack_capsule.menu.EventsCore.1.build.event_core=-DARDUINO_EVENT_RUNNING_CORE=1 +m5stack_capsule.menu.EventsCore.0=Core 0 +m5stack_capsule.menu.EventsCore.0.build.event_core=-DARDUINO_EVENT_RUNNING_CORE=0 + +m5stack_capsule.menu.USBMode.hwcdc=Hardware CDC and JTAG +m5stack_capsule.menu.USBMode.hwcdc.build.usb_mode=1 +m5stack_capsule.menu.USBMode.default=USB-OTG (TinyUSB) +m5stack_capsule.menu.USBMode.default.build.usb_mode=0 + +m5stack_capsule.menu.CDCOnBoot.cdc=Enabled +m5stack_capsule.menu.CDCOnBoot.cdc.build.cdc_on_boot=1 +m5stack_capsule.menu.CDCOnBoot.default=Disabled +m5stack_capsule.menu.CDCOnBoot.default.build.cdc_on_boot=0 + +m5stack_capsule.menu.MSCOnBoot.default=Disabled +m5stack_capsule.menu.MSCOnBoot.default.build.msc_on_boot=0 +m5stack_capsule.menu.MSCOnBoot.msc=Enabled (Requires USB-OTG Mode) +m5stack_capsule.menu.MSCOnBoot.msc.build.msc_on_boot=1 + +m5stack_capsule.menu.DFUOnBoot.default=Disabled +m5stack_capsule.menu.DFUOnBoot.default.build.dfu_on_boot=0 +m5stack_capsule.menu.DFUOnBoot.dfu=Enabled (Requires USB-OTG Mode) +m5stack_capsule.menu.DFUOnBoot.dfu.build.dfu_on_boot=1 + +m5stack_capsule.menu.UploadMode.default=UART0 / Hardware CDC +m5stack_capsule.menu.UploadMode.default.upload.use_1200bps_touch=false +m5stack_capsule.menu.UploadMode.default.upload.wait_for_upload_port=false +m5stack_capsule.menu.UploadMode.cdc=USB-OTG CDC (TinyUSB) +m5stack_capsule.menu.UploadMode.cdc.upload.use_1200bps_touch=true +m5stack_capsule.menu.UploadMode.cdc.upload.wait_for_upload_port=true + +m5stack_capsule.menu.PartitionScheme.default=Default 4MB with spiffs (1.2MB APP/1.5MB SPIFFS) +m5stack_capsule.menu.PartitionScheme.default.build.partitions=default +m5stack_capsule.menu.PartitionScheme.defaultffat=Default 4MB with ffat (1.2MB APP/1.5MB FATFS) +m5stack_capsule.menu.PartitionScheme.defaultffat.build.partitions=default_ffat +m5stack_capsule.menu.PartitionScheme.default_8MB=8M with spiffs (3MB APP/1.5MB SPIFFS) +m5stack_capsule.menu.PartitionScheme.default_8MB.build.partitions=default_8MB +m5stack_capsule.menu.PartitionScheme.default_8MB.upload.maximum_size=3342336 +m5stack_capsule.menu.PartitionScheme.minimal=Minimal (1.3MB APP/700KB SPIFFS) +m5stack_capsule.menu.PartitionScheme.minimal.build.partitions=minimal +m5stack_capsule.menu.PartitionScheme.no_ota=No OTA (2MB APP/2MB SPIFFS) +m5stack_capsule.menu.PartitionScheme.no_ota.build.partitions=no_ota +m5stack_capsule.menu.PartitionScheme.no_ota.upload.maximum_size=2097152 +m5stack_capsule.menu.PartitionScheme.noota_3g=No OTA (1MB APP/3MB SPIFFS) +m5stack_capsule.menu.PartitionScheme.noota_3g.build.partitions=noota_3g +m5stack_capsule.menu.PartitionScheme.noota_3g.upload.maximum_size=1048576 +m5stack_capsule.menu.PartitionScheme.noota_ffat=No OTA (2MB APP/2MB FATFS) +m5stack_capsule.menu.PartitionScheme.noota_ffat.build.partitions=noota_ffat +m5stack_capsule.menu.PartitionScheme.noota_ffat.upload.maximum_size=2097152 +m5stack_capsule.menu.PartitionScheme.noota_3gffat=No OTA (1MB APP/3MB FATFS) +m5stack_capsule.menu.PartitionScheme.noota_3gffat.build.partitions=noota_3gffat +m5stack_capsule.menu.PartitionScheme.noota_3gffat.upload.maximum_size=1048576 +m5stack_capsule.menu.PartitionScheme.huge_app=Huge APP (3MB No OTA/1MB SPIFFS) +m5stack_capsule.menu.PartitionScheme.huge_app.build.partitions=huge_app +m5stack_capsule.menu.PartitionScheme.huge_app.upload.maximum_size=3145728 +m5stack_capsule.menu.PartitionScheme.min_spiffs=Minimal SPIFFS (1.9MB APP with OTA/190KB SPIFFS) +m5stack_capsule.menu.PartitionScheme.min_spiffs.build.partitions=min_spiffs +m5stack_capsule.menu.PartitionScheme.min_spiffs.upload.maximum_size=1966080 +m5stack_capsule.menu.PartitionScheme.fatflash=16M Flash (2MB APP/12.5MB FATFS) +m5stack_capsule.menu.PartitionScheme.fatflash.build.partitions=ffat +m5stack_capsule.menu.PartitionScheme.fatflash.upload.maximum_size=2097152 +m5stack_capsule.menu.PartitionScheme.app3M_fat9M_16MB=16M Flash (3MB APP/9.9MB FATFS) +m5stack_capsule.menu.PartitionScheme.app3M_fat9M_16MB.build.partitions=app3M_fat9M_16MB +m5stack_capsule.menu.PartitionScheme.app3M_fat9M_16MB.upload.maximum_size=3145728 +m5stack_capsule.menu.PartitionScheme.rainmaker=RainMaker +m5stack_capsule.menu.PartitionScheme.rainmaker.build.partitions=rainmaker +m5stack_capsule.menu.PartitionScheme.rainmaker.upload.maximum_size=3145728 +m5stack_capsule.menu.PartitionScheme.app5M_fat24M_32MB=32M Flash (4.8MB APP/22MB FATFS) +m5stack_capsule.menu.PartitionScheme.app5M_fat24M_32MB.build.partitions=large_fat_32MB +m5stack_capsule.menu.PartitionScheme.app5M_fat24M_32MB.upload.maximum_size=4718592 +m5stack_capsule.menu.PartitionScheme.app5M_little24M_32MB=32M Flash (4.8MB APP/22MB LittleFS) +m5stack_capsule.menu.PartitionScheme.app5M_little24M_32MB.build.partitions=large_littlefs_32MB +m5stack_capsule.menu.PartitionScheme.app5M_little24M_32MB.upload.maximum_size=4718592 +m5stack_capsule.menu.PartitionScheme.esp_sr_16=ESP SR 16M (3MB APP/7MB SPIFFS/2.9MB MODEL) +m5stack_capsule.menu.PartitionScheme.esp_sr_16.upload.maximum_size=3145728 +m5stack_capsule.menu.PartitionScheme.esp_sr_16.upload.extra_flags=0xD10000 {build.path}/srmodels.bin +m5stack_capsule.menu.PartitionScheme.esp_sr_16.build.partitions=esp_sr_16 +m5stack_capsule.menu.PartitionScheme.custom=Custom +m5stack_capsule.menu.PartitionScheme.custom.build.partitions= +m5stack_capsule.menu.PartitionScheme.custom.upload.maximum_size=16777216 + +m5stack_capsule.menu.CPUFreq.240=240MHz (WiFi) +m5stack_capsule.menu.CPUFreq.240.build.f_cpu=240000000L +m5stack_capsule.menu.CPUFreq.160=160MHz (WiFi) +m5stack_capsule.menu.CPUFreq.160.build.f_cpu=160000000L +m5stack_capsule.menu.CPUFreq.80=80MHz (WiFi) +m5stack_capsule.menu.CPUFreq.80.build.f_cpu=80000000L +m5stack_capsule.menu.CPUFreq.40=40MHz +m5stack_capsule.menu.CPUFreq.40.build.f_cpu=40000000L +m5stack_capsule.menu.CPUFreq.20=20MHz +m5stack_capsule.menu.CPUFreq.20.build.f_cpu=20000000L +m5stack_capsule.menu.CPUFreq.10=10MHz +m5stack_capsule.menu.CPUFreq.10.build.f_cpu=10000000L + + +m5stack_capsule.menu.UploadSpeed.1500000=1500000 +m5stack_capsule.menu.UploadSpeed.1500000.upload.speed=1500000 +m5stack_capsule.menu.UploadSpeed.921600=921600 +m5stack_capsule.menu.UploadSpeed.921600.upload.speed=921600 +m5stack_capsule.menu.UploadSpeed.115200=115200 +m5stack_capsule.menu.UploadSpeed.115200.upload.speed=115200 +m5stack_capsule.menu.UploadSpeed.256000.windows=256000 +m5stack_capsule.menu.UploadSpeed.256000.upload.speed=256000 +m5stack_capsule.menu.UploadSpeed.230400.windows.upload.speed=256000 +m5stack_capsule.menu.UploadSpeed.230400=230400 +m5stack_capsule.menu.UploadSpeed.230400.upload.speed=230400 +m5stack_capsule.menu.UploadSpeed.460800.linux=460800 +m5stack_capsule.menu.UploadSpeed.460800.macosx=460800 +m5stack_capsule.menu.UploadSpeed.460800.upload.speed=460800 +m5stack_capsule.menu.UploadSpeed.512000.windows=512000 +m5stack_capsule.menu.UploadSpeed.512000.upload.speed=512000 + +m5stack_capsule.menu.DebugLevel.none=None +m5stack_capsule.menu.DebugLevel.none.build.code_debug=0 +m5stack_capsule.menu.DebugLevel.error=Error +m5stack_capsule.menu.DebugLevel.error.build.code_debug=1 +m5stack_capsule.menu.DebugLevel.warn=Warn +m5stack_capsule.menu.DebugLevel.warn.build.code_debug=2 +m5stack_capsule.menu.DebugLevel.info=Info +m5stack_capsule.menu.DebugLevel.info.build.code_debug=3 +m5stack_capsule.menu.DebugLevel.debug=Debug +m5stack_capsule.menu.DebugLevel.debug.build.code_debug=4 +m5stack_capsule.menu.DebugLevel.verbose=Verbose +m5stack_capsule.menu.DebugLevel.verbose.build.code_debug=5 + +m5stack_capsule.menu.EraseFlash.none=Disabled +m5stack_capsule.menu.EraseFlash.none.upload.erase_cmd= +m5stack_capsule.menu.EraseFlash.all=Enabled +m5stack_capsule.menu.EraseFlash.all.upload.erase_cmd=-e + +############################################################## + +m5stack_cardputer.name=M5Cardputer +m5stack_cardputer.vid.0=0x303a +m5stack_cardputer.pid.0=0x1001 +m5stack_cardputer.bootloader.tool=esptool_py +m5stack_cardputer.bootloader.tool.default=esptool_py + +m5stack_cardputer.upload.tool=esptool_py +m5stack_cardputer.upload.tool.default=esptool_py +m5stack_cardputer.upload.tool.network=esp_ota + +m5stack_cardputer.upload.maximum_size=1310720 +m5stack_cardputer.upload.maximum_data_size=327680 +m5stack_cardputer.upload.flags= +m5stack_cardputer.upload.extra_flags= +m5stack_cardputer.upload.use_1200bps_touch=false +m5stack_cardputer.upload.wait_for_upload_port=false + +m5stack_cardputer.serial.disableDTR=false +m5stack_cardputer.serial.disableRTS=false + +m5stack_cardputer.build.tarch=xtensa +m5stack_cardputer.build.bootloader_addr=0x0 +m5stack_cardputer.build.target=esp32s3 +m5stack_cardputer.build.mcu=esp32s3 +m5stack_cardputer.build.core=esp32 +m5stack_cardputer.build.variant=m5stack_cardputer +m5stack_cardputer.build.board=M5STACK_CARDPUTER + +m5stack_cardputer.build.usb_mode=1 +m5stack_cardputer.build.cdc_on_boot=1 +m5stack_cardputer.build.msc_on_boot=0 +m5stack_cardputer.build.dfu_on_boot=0 +m5stack_cardputer.build.f_cpu=240000000L +m5stack_cardputer.build.flash_size=8MB +m5stack_cardputer.build.flash_freq=80m +m5stack_cardputer.build.flash_mode=dio +m5stack_cardputer.build.boot=qio +m5stack_cardputer.build.boot_freq=80m +m5stack_cardputer.build.partitions=default +m5stack_cardputer.build.defines= +m5stack_cardputer.build.loop_core= +m5stack_cardputer.build.event_core= +m5stack_cardputer.build.psram_type=qspi +m5stack_cardputer.build.memory_type={build.boot}_{build.psram_type} + +## IDE 2.0 Seems to not update the value +m5stack_cardputer.menu.JTAGAdapter.default=Disabled +m5stack_cardputer.menu.JTAGAdapter.default.build.copy_jtag_files=0 +m5stack_cardputer.menu.JTAGAdapter.builtin=Integrated USB JTAG +m5stack_cardputer.menu.JTAGAdapter.builtin.build.openocdscript=esp32s3-builtin.cfg +m5stack_cardputer.menu.JTAGAdapter.builtin.build.copy_jtag_files=1 +m5stack_cardputer.menu.JTAGAdapter.external=FTDI Adapter +m5stack_cardputer.menu.JTAGAdapter.external.build.openocdscript=esp32s3-ftdi.cfg +m5stack_cardputer.menu.JTAGAdapter.external.build.copy_jtag_files=1 +m5stack_cardputer.menu.JTAGAdapter.bridge=ESP USB Bridge +m5stack_cardputer.menu.JTAGAdapter.bridge.build.openocdscript=esp32s3-bridge.cfg +m5stack_cardputer.menu.JTAGAdapter.bridge.build.copy_jtag_files=1 + +m5stack_cardputer.menu.PSRAM.disabled=Disabled +m5stack_cardputer.menu.PSRAM.disabled.build.defines= +m5stack_cardputer.menu.PSRAM.disabled.build.psram_type=qspi +m5stack_cardputer.menu.PSRAM.enabled=QSPI PSRAM +m5stack_cardputer.menu.PSRAM.enabled.build.defines=-DBOARD_HAS_PSRAM +m5stack_cardputer.menu.PSRAM.enabled.build.psram_type=qspi +m5stack_cardputer.menu.PSRAM.opi=OPI PSRAM +m5stack_cardputer.menu.PSRAM.opi.build.defines=-DBOARD_HAS_PSRAM +m5stack_cardputer.menu.PSRAM.opi.build.psram_type=opi + +m5stack_cardputer.menu.FlashMode.qio=QIO 80MHz +m5stack_cardputer.menu.FlashMode.qio.build.flash_mode=dio +m5stack_cardputer.menu.FlashMode.qio.build.boot=qio +m5stack_cardputer.menu.FlashMode.qio.build.boot_freq=80m +m5stack_cardputer.menu.FlashMode.qio.build.flash_freq=80m +m5stack_cardputer.menu.FlashMode.qio120=QIO 120MHz +m5stack_cardputer.menu.FlashMode.qio120.build.flash_mode=dio +m5stack_cardputer.menu.FlashMode.qio120.build.boot=qio +m5stack_cardputer.menu.FlashMode.qio120.build.boot_freq=120m +m5stack_cardputer.menu.FlashMode.qio120.build.flash_freq=80m +m5stack_cardputer.menu.FlashMode.dio=DIO 80MHz +m5stack_cardputer.menu.FlashMode.dio.build.flash_mode=dio +m5stack_cardputer.menu.FlashMode.dio.build.boot=dio +m5stack_cardputer.menu.FlashMode.dio.build.boot_freq=80m +m5stack_cardputer.menu.FlashMode.dio.build.flash_freq=80m +m5stack_cardputer.menu.FlashMode.opi=OPI 80MHz +m5stack_cardputer.menu.FlashMode.opi.build.flash_mode=dout +m5stack_cardputer.menu.FlashMode.opi.build.boot=opi +m5stack_cardputer.menu.FlashMode.opi.build.boot_freq=80m +m5stack_cardputer.menu.FlashMode.opi.build.flash_freq=80m + +m5stack_cardputer.menu.FlashSize.4M=4MB (32Mb) +m5stack_cardputer.menu.FlashSize.4M.build.flash_size=4MB +m5stack_cardputer.menu.FlashSize.8M=8MB (64Mb) +m5stack_cardputer.menu.FlashSize.8M.build.flash_size=8MB +m5stack_cardputer.menu.FlashSize.8M.build.partitions=default_8MB +m5stack_cardputer.menu.FlashSize.16M=16MB (128Mb) +m5stack_cardputer.menu.FlashSize.16M.build.flash_size=16MB +m5stack_cardputer.menu.FlashSize.32M=32MB (256Mb) +m5stack_cardputer.menu.FlashSize.32M.build.flash_size=32MB +m5stack_cardputer.menu.FlashSize.32M.build.partitions=app5M_fat24M_32MB + +m5stack_cardputer.menu.LoopCore.1=Core 1 +m5stack_cardputer.menu.LoopCore.1.build.loop_core=-DARDUINO_RUNNING_CORE=1 +m5stack_cardputer.menu.LoopCore.0=Core 0 +m5stack_cardputer.menu.LoopCore.0.build.loop_core=-DARDUINO_RUNNING_CORE=0 + +m5stack_cardputer.menu.EventsCore.1=Core 1 +m5stack_cardputer.menu.EventsCore.1.build.event_core=-DARDUINO_EVENT_RUNNING_CORE=1 +m5stack_cardputer.menu.EventsCore.0=Core 0 +m5stack_cardputer.menu.EventsCore.0.build.event_core=-DARDUINO_EVENT_RUNNING_CORE=0 + +m5stack_cardputer.menu.USBMode.hwcdc=Hardware CDC and JTAG +m5stack_cardputer.menu.USBMode.hwcdc.build.usb_mode=1 +m5stack_cardputer.menu.USBMode.default=USB-OTG (TinyUSB) +m5stack_cardputer.menu.USBMode.default.build.usb_mode=0 + +m5stack_cardputer.menu.CDCOnBoot.cdc=Enabled +m5stack_cardputer.menu.CDCOnBoot.cdc.build.cdc_on_boot=1 +m5stack_cardputer.menu.CDCOnBoot.default=Disabled +m5stack_cardputer.menu.CDCOnBoot.default.build.cdc_on_boot=0 + +m5stack_cardputer.menu.MSCOnBoot.default=Disabled +m5stack_cardputer.menu.MSCOnBoot.default.build.msc_on_boot=0 +m5stack_cardputer.menu.MSCOnBoot.msc=Enabled (Requires USB-OTG Mode) +m5stack_cardputer.menu.MSCOnBoot.msc.build.msc_on_boot=1 + +m5stack_cardputer.menu.DFUOnBoot.default=Disabled +m5stack_cardputer.menu.DFUOnBoot.default.build.dfu_on_boot=0 +m5stack_cardputer.menu.DFUOnBoot.dfu=Enabled (Requires USB-OTG Mode) +m5stack_cardputer.menu.DFUOnBoot.dfu.build.dfu_on_boot=1 + +m5stack_cardputer.menu.UploadMode.default=UART0 / Hardware CDC +m5stack_cardputer.menu.UploadMode.default.upload.use_1200bps_touch=false +m5stack_cardputer.menu.UploadMode.default.upload.wait_for_upload_port=false +m5stack_cardputer.menu.UploadMode.cdc=USB-OTG CDC (TinyUSB) +m5stack_cardputer.menu.UploadMode.cdc.upload.use_1200bps_touch=true +m5stack_cardputer.menu.UploadMode.cdc.upload.wait_for_upload_port=true + +m5stack_cardputer.menu.PartitionScheme.default=Default 4MB with spiffs (1.2MB APP/1.5MB SPIFFS) +m5stack_cardputer.menu.PartitionScheme.default.build.partitions=default +m5stack_cardputer.menu.PartitionScheme.defaultffat=Default 4MB with ffat (1.2MB APP/1.5MB FATFS) +m5stack_cardputer.menu.PartitionScheme.defaultffat.build.partitions=default_ffat +m5stack_cardputer.menu.PartitionScheme.default_8MB=8M with spiffs (3MB APP/1.5MB SPIFFS) +m5stack_cardputer.menu.PartitionScheme.default_8MB.build.partitions=default_8MB +m5stack_cardputer.menu.PartitionScheme.default_8MB.upload.maximum_size=3342336 +m5stack_cardputer.menu.PartitionScheme.minimal=Minimal (1.3MB APP/700KB SPIFFS) +m5stack_cardputer.menu.PartitionScheme.minimal.build.partitions=minimal +m5stack_cardputer.menu.PartitionScheme.no_ota=No OTA (2MB APP/2MB SPIFFS) +m5stack_cardputer.menu.PartitionScheme.no_ota.build.partitions=no_ota +m5stack_cardputer.menu.PartitionScheme.no_ota.upload.maximum_size=2097152 +m5stack_cardputer.menu.PartitionScheme.noota_3g=No OTA (1MB APP/3MB SPIFFS) +m5stack_cardputer.menu.PartitionScheme.noota_3g.build.partitions=noota_3g +m5stack_cardputer.menu.PartitionScheme.noota_3g.upload.maximum_size=1048576 +m5stack_cardputer.menu.PartitionScheme.noota_ffat=No OTA (2MB APP/2MB FATFS) +m5stack_cardputer.menu.PartitionScheme.noota_ffat.build.partitions=noota_ffat +m5stack_cardputer.menu.PartitionScheme.noota_ffat.upload.maximum_size=2097152 +m5stack_cardputer.menu.PartitionScheme.noota_3gffat=No OTA (1MB APP/3MB FATFS) +m5stack_cardputer.menu.PartitionScheme.noota_3gffat.build.partitions=noota_3gffat +m5stack_cardputer.menu.PartitionScheme.noota_3gffat.upload.maximum_size=1048576 +m5stack_cardputer.menu.PartitionScheme.huge_app=Huge APP (3MB No OTA/1MB SPIFFS) +m5stack_cardputer.menu.PartitionScheme.huge_app.build.partitions=huge_app +m5stack_cardputer.menu.PartitionScheme.huge_app.upload.maximum_size=3145728 +m5stack_cardputer.menu.PartitionScheme.min_spiffs=Minimal SPIFFS (1.9MB APP with OTA/190KB SPIFFS) +m5stack_cardputer.menu.PartitionScheme.min_spiffs.build.partitions=min_spiffs +m5stack_cardputer.menu.PartitionScheme.min_spiffs.upload.maximum_size=1966080 +m5stack_cardputer.menu.PartitionScheme.fatflash=16M Flash (2MB APP/12.5MB FATFS) +m5stack_cardputer.menu.PartitionScheme.fatflash.build.partitions=ffat +m5stack_cardputer.menu.PartitionScheme.fatflash.upload.maximum_size=2097152 +m5stack_cardputer.menu.PartitionScheme.app3M_fat9M_16MB=16M Flash (3MB APP/9.9MB FATFS) +m5stack_cardputer.menu.PartitionScheme.app3M_fat9M_16MB.build.partitions=app3M_fat9M_16MB +m5stack_cardputer.menu.PartitionScheme.app3M_fat9M_16MB.upload.maximum_size=3145728 +m5stack_cardputer.menu.PartitionScheme.rainmaker=RainMaker +m5stack_cardputer.menu.PartitionScheme.rainmaker.build.partitions=rainmaker +m5stack_cardputer.menu.PartitionScheme.rainmaker.upload.maximum_size=3145728 +m5stack_cardputer.menu.PartitionScheme.app5M_fat24M_32MB=32M Flash (4.8MB APP/22MB FATFS) +m5stack_cardputer.menu.PartitionScheme.app5M_fat24M_32MB.build.partitions=large_fat_32MB +m5stack_cardputer.menu.PartitionScheme.app5M_fat24M_32MB.upload.maximum_size=4718592 +m5stack_cardputer.menu.PartitionScheme.app5M_little24M_32MB=32M Flash (4.8MB APP/22MB LittleFS) +m5stack_cardputer.menu.PartitionScheme.app5M_little24M_32MB.build.partitions=large_littlefs_32MB +m5stack_cardputer.menu.PartitionScheme.app5M_little24M_32MB.upload.maximum_size=4718592 +m5stack_cardputer.menu.PartitionScheme.esp_sr_16=ESP SR 16M (3MB APP/7MB SPIFFS/2.9MB MODEL) +m5stack_cardputer.menu.PartitionScheme.esp_sr_16.upload.maximum_size=3145728 +m5stack_cardputer.menu.PartitionScheme.esp_sr_16.upload.extra_flags=0xD10000 {build.path}/srmodels.bin +m5stack_cardputer.menu.PartitionScheme.esp_sr_16.build.partitions=esp_sr_16 +m5stack_cardputer.menu.PartitionScheme.custom=Custom +m5stack_cardputer.menu.PartitionScheme.custom.build.partitions= +m5stack_cardputer.menu.PartitionScheme.custom.upload.maximum_size=16777216 + +m5stack_cardputer.menu.CPUFreq.240=240MHz (WiFi) +m5stack_cardputer.menu.CPUFreq.240.build.f_cpu=240000000L +m5stack_cardputer.menu.CPUFreq.160=160MHz (WiFi) +m5stack_cardputer.menu.CPUFreq.160.build.f_cpu=160000000L +m5stack_cardputer.menu.CPUFreq.80=80MHz (WiFi) +m5stack_cardputer.menu.CPUFreq.80.build.f_cpu=80000000L +m5stack_cardputer.menu.CPUFreq.40=40MHz +m5stack_cardputer.menu.CPUFreq.40.build.f_cpu=40000000L +m5stack_cardputer.menu.CPUFreq.20=20MHz +m5stack_cardputer.menu.CPUFreq.20.build.f_cpu=20000000L +m5stack_cardputer.menu.CPUFreq.10=10MHz +m5stack_cardputer.menu.CPUFreq.10.build.f_cpu=10000000L + +m5stack_cardputer.menu.UploadSpeed.921600=921600 +m5stack_cardputer.menu.UploadSpeed.921600.upload.speed=921600 +m5stack_cardputer.menu.UploadSpeed.115200=115200 +m5stack_cardputer.menu.UploadSpeed.115200.upload.speed=115200 +m5stack_cardputer.menu.UploadSpeed.256000.windows=256000 +m5stack_cardputer.menu.UploadSpeed.256000.upload.speed=256000 +m5stack_cardputer.menu.UploadSpeed.230400.windows.upload.speed=256000 +m5stack_cardputer.menu.UploadSpeed.230400=230400 +m5stack_cardputer.menu.UploadSpeed.230400.upload.speed=230400 +m5stack_cardputer.menu.UploadSpeed.460800.linux=460800 +m5stack_cardputer.menu.UploadSpeed.460800.macosx=460800 +m5stack_cardputer.menu.UploadSpeed.460800.upload.speed=460800 +m5stack_cardputer.menu.UploadSpeed.512000.windows=512000 +m5stack_cardputer.menu.UploadSpeed.512000.upload.speed=512000 + +m5stack_cardputer.menu.DebugLevel.none=None +m5stack_cardputer.menu.DebugLevel.none.build.code_debug=0 +m5stack_cardputer.menu.DebugLevel.error=Error +m5stack_cardputer.menu.DebugLevel.error.build.code_debug=1 +m5stack_cardputer.menu.DebugLevel.warn=Warn +m5stack_cardputer.menu.DebugLevel.warn.build.code_debug=2 +m5stack_cardputer.menu.DebugLevel.info=Info +m5stack_cardputer.menu.DebugLevel.info.build.code_debug=3 +m5stack_cardputer.menu.DebugLevel.debug=Debug +m5stack_cardputer.menu.DebugLevel.debug.build.code_debug=4 +m5stack_cardputer.menu.DebugLevel.verbose=Verbose +m5stack_cardputer.menu.DebugLevel.verbose.build.code_debug=5 + +m5stack_cardputer.menu.EraseFlash.none=Disabled +m5stack_cardputer.menu.EraseFlash.none.upload.erase_cmd= +m5stack_cardputer.menu.EraseFlash.all=Enabled +m5stack_cardputer.menu.EraseFlash.all.upload.erase_cmd=-e + +############################################################## + +m5stack_dial.name=M5Dial +m5stack_dial.vid.0=0x303a +m5stack_dial.pid.0=0x1001 +m5stack_dial.bootloader.tool=esptool_py +m5stack_dial.bootloader.tool.default=esptool_py + +m5stack_dial.upload.tool=esptool_py +m5stack_dial.upload.tool.default=esptool_py +m5stack_dial.upload.tool.network=esp_ota + +m5stack_dial.upload.maximum_size=1310720 +m5stack_dial.upload.maximum_data_size=327680 +m5stack_dial.upload.flags= +m5stack_dial.upload.extra_flags= +m5stack_dial.upload.use_1200bps_touch=false +m5stack_dial.upload.wait_for_upload_port=false + +m5stack_dial.serial.disableDTR=false +m5stack_dial.serial.disableRTS=false + +m5stack_dial.build.tarch=xtensa +m5stack_dial.build.bootloader_addr=0x0 +m5stack_dial.build.target=esp32s3 +m5stack_dial.build.mcu=esp32s3 +m5stack_dial.build.core=esp32 +m5stack_dial.build.variant=m5stack_dial +m5stack_dial.build.board=M5STACK_DIAL + +m5stack_dial.build.usb_mode=1 +m5stack_dial.build.cdc_on_boot=1 +m5stack_dial.build.msc_on_boot=0 +m5stack_dial.build.dfu_on_boot=0 +m5stack_dial.build.f_cpu=240000000L +m5stack_dial.build.flash_size=8MB +m5stack_dial.build.flash_freq=80m +m5stack_dial.build.flash_mode=dio +m5stack_dial.build.boot=qio +m5stack_dial.build.boot_freq=80m +m5stack_dial.build.partitions=default +m5stack_dial.build.defines= +m5stack_dial.build.loop_core= +m5stack_dial.build.event_core= +m5stack_dial.build.psram_type=qspi +m5stack_dial.build.memory_type={build.boot}_{build.psram_type} + +## IDE 2.0 Seems to not update the value +m5stack_dial.menu.JTAGAdapter.default=Disabled +m5stack_dial.menu.JTAGAdapter.default.build.copy_jtag_files=0 +m5stack_dial.menu.JTAGAdapter.builtin=Integrated USB JTAG +m5stack_dial.menu.JTAGAdapter.builtin.build.openocdscript=esp32s3-builtin.cfg +m5stack_dial.menu.JTAGAdapter.builtin.build.copy_jtag_files=1 +m5stack_dial.menu.JTAGAdapter.external=FTDI Adapter +m5stack_dial.menu.JTAGAdapter.external.build.openocdscript=esp32s3-ftdi.cfg +m5stack_dial.menu.JTAGAdapter.external.build.copy_jtag_files=1 +m5stack_dial.menu.JTAGAdapter.bridge=ESP USB Bridge +m5stack_dial.menu.JTAGAdapter.bridge.build.openocdscript=esp32s3-bridge.cfg +m5stack_dial.menu.JTAGAdapter.bridge.build.copy_jtag_files=1 + +m5stack_dial.menu.PSRAM.disabled=Disabled +m5stack_dial.menu.PSRAM.disabled.build.defines= +m5stack_dial.menu.PSRAM.disabled.build.psram_type=qspi +m5stack_dial.menu.PSRAM.enabled=QSPI PSRAM +m5stack_dial.menu.PSRAM.enabled.build.defines=-DBOARD_HAS_PSRAM +m5stack_dial.menu.PSRAM.enabled.build.psram_type=qspi +m5stack_dial.menu.PSRAM.opi=OPI PSRAM +m5stack_dial.menu.PSRAM.opi.build.defines=-DBOARD_HAS_PSRAM +m5stack_dial.menu.PSRAM.opi.build.psram_type=opi + +m5stack_dial.menu.FlashMode.qio=QIO 80MHz +m5stack_dial.menu.FlashMode.qio.build.flash_mode=dio +m5stack_dial.menu.FlashMode.qio.build.boot=qio +m5stack_dial.menu.FlashMode.qio.build.boot_freq=80m +m5stack_dial.menu.FlashMode.qio.build.flash_freq=80m +m5stack_dial.menu.FlashMode.qio120=QIO 120MHz +m5stack_dial.menu.FlashMode.qio120.build.flash_mode=dio +m5stack_dial.menu.FlashMode.qio120.build.boot=qio +m5stack_dial.menu.FlashMode.qio120.build.boot_freq=120m +m5stack_dial.menu.FlashMode.qio120.build.flash_freq=80m +m5stack_dial.menu.FlashMode.dio=DIO 80MHz +m5stack_dial.menu.FlashMode.dio.build.flash_mode=dio +m5stack_dial.menu.FlashMode.dio.build.boot=dio +m5stack_dial.menu.FlashMode.dio.build.boot_freq=80m +m5stack_dial.menu.FlashMode.dio.build.flash_freq=80m +m5stack_dial.menu.FlashMode.opi=OPI 80MHz +m5stack_dial.menu.FlashMode.opi.build.flash_mode=dout +m5stack_dial.menu.FlashMode.opi.build.boot=opi +m5stack_dial.menu.FlashMode.opi.build.boot_freq=80m +m5stack_dial.menu.FlashMode.opi.build.flash_freq=80m + +m5stack_dial.menu.FlashSize.4M=4MB (32Mb) +m5stack_dial.menu.FlashSize.4M.build.flash_size=4MB +m5stack_dial.menu.FlashSize.8M=8MB (64Mb) +m5stack_dial.menu.FlashSize.8M.build.flash_size=8MB +m5stack_dial.menu.FlashSize.8M.build.partitions=default_8MB +m5stack_dial.menu.FlashSize.16M=16MB (128Mb) +m5stack_dial.menu.FlashSize.16M.build.flash_size=16MB +m5stack_dial.menu.FlashSize.32M=32MB (256Mb) +m5stack_dial.menu.FlashSize.32M.build.flash_size=32MB +m5stack_dial.menu.FlashSize.32M.build.partitions=app5M_fat24M_32MB + +m5stack_dial.menu.LoopCore.1=Core 1 +m5stack_dial.menu.LoopCore.1.build.loop_core=-DARDUINO_RUNNING_CORE=1 +m5stack_dial.menu.LoopCore.0=Core 0 +m5stack_dial.menu.LoopCore.0.build.loop_core=-DARDUINO_RUNNING_CORE=0 + +m5stack_dial.menu.EventsCore.1=Core 1 +m5stack_dial.menu.EventsCore.1.build.event_core=-DARDUINO_EVENT_RUNNING_CORE=1 +m5stack_dial.menu.EventsCore.0=Core 0 +m5stack_dial.menu.EventsCore.0.build.event_core=-DARDUINO_EVENT_RUNNING_CORE=0 + +m5stack_dial.menu.USBMode.hwcdc=Hardware CDC and JTAG +m5stack_dial.menu.USBMode.hwcdc.build.usb_mode=1 +m5stack_dial.menu.USBMode.default=USB-OTG (TinyUSB) +m5stack_dial.menu.USBMode.default.build.usb_mode=0 + +m5stack_dial.menu.CDCOnBoot.cdc=Enabled +m5stack_dial.menu.CDCOnBoot.cdc.build.cdc_on_boot=1 +m5stack_dial.menu.CDCOnBoot.default=Disabled +m5stack_dial.menu.CDCOnBoot.default.build.cdc_on_boot=0 + +m5stack_dial.menu.MSCOnBoot.default=Disabled +m5stack_dial.menu.MSCOnBoot.default.build.msc_on_boot=0 +m5stack_dial.menu.MSCOnBoot.msc=Enabled (Requires USB-OTG Mode) +m5stack_dial.menu.MSCOnBoot.msc.build.msc_on_boot=1 + +m5stack_dial.menu.DFUOnBoot.default=Disabled +m5stack_dial.menu.DFUOnBoot.default.build.dfu_on_boot=0 +m5stack_dial.menu.DFUOnBoot.dfu=Enabled (Requires USB-OTG Mode) +m5stack_dial.menu.DFUOnBoot.dfu.build.dfu_on_boot=1 + +m5stack_dial.menu.UploadMode.default=UART0 / Hardware CDC +m5stack_dial.menu.UploadMode.default.upload.use_1200bps_touch=false +m5stack_dial.menu.UploadMode.default.upload.wait_for_upload_port=false +m5stack_dial.menu.UploadMode.cdc=USB-OTG CDC (TinyUSB) +m5stack_dial.menu.UploadMode.cdc.upload.use_1200bps_touch=true +m5stack_dial.menu.UploadMode.cdc.upload.wait_for_upload_port=true + +m5stack_dial.menu.PartitionScheme.default=Default 4MB with spiffs (1.2MB APP/1.5MB SPIFFS) +m5stack_dial.menu.PartitionScheme.default.build.partitions=default +m5stack_dial.menu.PartitionScheme.defaultffat=Default 4MB with ffat (1.2MB APP/1.5MB FATFS) +m5stack_dial.menu.PartitionScheme.defaultffat.build.partitions=default_ffat +m5stack_dial.menu.PartitionScheme.default_8MB=8M with spiffs (3MB APP/1.5MB SPIFFS) +m5stack_dial.menu.PartitionScheme.default_8MB.build.partitions=default_8MB +m5stack_dial.menu.PartitionScheme.default_8MB.upload.maximum_size=3342336 +m5stack_dial.menu.PartitionScheme.minimal=Minimal (1.3MB APP/700KB SPIFFS) +m5stack_dial.menu.PartitionScheme.minimal.build.partitions=minimal +m5stack_dial.menu.PartitionScheme.no_ota=No OTA (2MB APP/2MB SPIFFS) +m5stack_dial.menu.PartitionScheme.no_ota.build.partitions=no_ota +m5stack_dial.menu.PartitionScheme.no_ota.upload.maximum_size=2097152 +m5stack_dial.menu.PartitionScheme.noota_3g=No OTA (1MB APP/3MB SPIFFS) +m5stack_dial.menu.PartitionScheme.noota_3g.build.partitions=noota_3g +m5stack_dial.menu.PartitionScheme.noota_3g.upload.maximum_size=1048576 +m5stack_dial.menu.PartitionScheme.noota_ffat=No OTA (2MB APP/2MB FATFS) +m5stack_dial.menu.PartitionScheme.noota_ffat.build.partitions=noota_ffat +m5stack_dial.menu.PartitionScheme.noota_ffat.upload.maximum_size=2097152 +m5stack_dial.menu.PartitionScheme.noota_3gffat=No OTA (1MB APP/3MB FATFS) +m5stack_dial.menu.PartitionScheme.noota_3gffat.build.partitions=noota_3gffat +m5stack_dial.menu.PartitionScheme.noota_3gffat.upload.maximum_size=1048576 +m5stack_dial.menu.PartitionScheme.huge_app=Huge APP (3MB No OTA/1MB SPIFFS) +m5stack_dial.menu.PartitionScheme.huge_app.build.partitions=huge_app +m5stack_dial.menu.PartitionScheme.huge_app.upload.maximum_size=3145728 +m5stack_dial.menu.PartitionScheme.min_spiffs=Minimal SPIFFS (1.9MB APP with OTA/190KB SPIFFS) +m5stack_dial.menu.PartitionScheme.min_spiffs.build.partitions=min_spiffs +m5stack_dial.menu.PartitionScheme.min_spiffs.upload.maximum_size=1966080 +m5stack_dial.menu.PartitionScheme.fatflash=16M Flash (2MB APP/12.5MB FATFS) +m5stack_dial.menu.PartitionScheme.fatflash.build.partitions=ffat +m5stack_dial.menu.PartitionScheme.fatflash.upload.maximum_size=2097152 +m5stack_dial.menu.PartitionScheme.app3M_fat9M_16MB=16M Flash (3MB APP/9.9MB FATFS) +m5stack_dial.menu.PartitionScheme.app3M_fat9M_16MB.build.partitions=app3M_fat9M_16MB +m5stack_dial.menu.PartitionScheme.app3M_fat9M_16MB.upload.maximum_size=3145728 +m5stack_dial.menu.PartitionScheme.rainmaker=RainMaker +m5stack_dial.menu.PartitionScheme.rainmaker.build.partitions=rainmaker +m5stack_dial.menu.PartitionScheme.rainmaker.upload.maximum_size=3145728 +m5stack_dial.menu.PartitionScheme.app5M_fat24M_32MB=32M Flash (4.8MB APP/22MB FATFS) +m5stack_dial.menu.PartitionScheme.app5M_fat24M_32MB.build.partitions=large_fat_32MB +m5stack_dial.menu.PartitionScheme.app5M_fat24M_32MB.upload.maximum_size=4718592 +m5stack_dial.menu.PartitionScheme.app5M_little24M_32MB=32M Flash (4.8MB APP/22MB LittleFS) +m5stack_dial.menu.PartitionScheme.app5M_little24M_32MB.build.partitions=large_littlefs_32MB +m5stack_dial.menu.PartitionScheme.app5M_little24M_32MB.upload.maximum_size=4718592 +m5stack_dial.menu.PartitionScheme.esp_sr_16=ESP SR 16M (3MB APP/7MB SPIFFS/2.9MB MODEL) +m5stack_dial.menu.PartitionScheme.esp_sr_16.upload.maximum_size=3145728 +m5stack_dial.menu.PartitionScheme.esp_sr_16.upload.extra_flags=0xD10000 {build.path}/srmodels.bin +m5stack_dial.menu.PartitionScheme.esp_sr_16.build.partitions=esp_sr_16 +m5stack_dial.menu.PartitionScheme.custom=Custom +m5stack_dial.menu.PartitionScheme.custom.build.partitions= +m5stack_dial.menu.PartitionScheme.custom.upload.maximum_size=16777216 + +m5stack_dial.menu.CPUFreq.240=240MHz (WiFi) +m5stack_dial.menu.CPUFreq.240.build.f_cpu=240000000L +m5stack_dial.menu.CPUFreq.160=160MHz (WiFi) +m5stack_dial.menu.CPUFreq.160.build.f_cpu=160000000L +m5stack_dial.menu.CPUFreq.80=80MHz (WiFi) +m5stack_dial.menu.CPUFreq.80.build.f_cpu=80000000L +m5stack_dial.menu.CPUFreq.40=40MHz +m5stack_dial.menu.CPUFreq.40.build.f_cpu=40000000L +m5stack_dial.menu.CPUFreq.20=20MHz +m5stack_dial.menu.CPUFreq.20.build.f_cpu=20000000L +m5stack_dial.menu.CPUFreq.10=10MHz +m5stack_dial.menu.CPUFreq.10.build.f_cpu=10000000L + +m5stack_dial.menu.UploadSpeed.921600=921600 +m5stack_dial.menu.UploadSpeed.921600.upload.speed=921600 +m5stack_dial.menu.UploadSpeed.115200=115200 +m5stack_dial.menu.UploadSpeed.115200.upload.speed=115200 +m5stack_dial.menu.UploadSpeed.256000.windows=256000 +m5stack_dial.menu.UploadSpeed.256000.upload.speed=256000 +m5stack_dial.menu.UploadSpeed.230400.windows.upload.speed=256000 +m5stack_dial.menu.UploadSpeed.230400=230400 +m5stack_dial.menu.UploadSpeed.230400.upload.speed=230400 +m5stack_dial.menu.UploadSpeed.460800.linux=460800 +m5stack_dial.menu.UploadSpeed.460800.macosx=460800 +m5stack_dial.menu.UploadSpeed.460800.upload.speed=460800 +m5stack_dial.menu.UploadSpeed.512000.windows=512000 +m5stack_dial.menu.UploadSpeed.512000.upload.speed=512000 + +m5stack_dial.menu.DebugLevel.none=None +m5stack_dial.menu.DebugLevel.none.build.code_debug=0 +m5stack_dial.menu.DebugLevel.error=Error +m5stack_dial.menu.DebugLevel.error.build.code_debug=1 +m5stack_dial.menu.DebugLevel.warn=Warn +m5stack_dial.menu.DebugLevel.warn.build.code_debug=2 +m5stack_dial.menu.DebugLevel.info=Info +m5stack_dial.menu.DebugLevel.info.build.code_debug=3 +m5stack_dial.menu.DebugLevel.debug=Debug +m5stack_dial.menu.DebugLevel.debug.build.code_debug=4 +m5stack_dial.menu.DebugLevel.verbose=Verbose +m5stack_dial.menu.DebugLevel.verbose.build.code_debug=5 + +m5stack_dial.menu.EraseFlash.none=Disabled +m5stack_dial.menu.EraseFlash.none.upload.erase_cmd= +m5stack_dial.menu.EraseFlash.all=Enabled +m5stack_dial.menu.EraseFlash.all.upload.erase_cmd=-e ############################################################## @@ -17694,15 +21180,12 @@ heltec_wireless_stick.build.bootloader_addr=0x1000 heltec_wireless_stick.build.target=esp32 heltec_wireless_stick.build.mcu=esp32 heltec_wireless_stick.build.core=esp32 -heltec_wireless_stick.build.variant=heltec_wireless_stick heltec_wireless_stick.build.board=HELTEC_WIRELESS_STICK heltec_wireless_stick.build.f_cpu=240000000L -heltec_wireless_stick.build.flash_size=8MB heltec_wireless_stick.build.flash_freq=80m heltec_wireless_stick.build.flash_mode=dio heltec_wireless_stick.build.boot=dio -heltec_wireless_stick.build.partitions=default_8MB heltec_wireless_stick.build.defines=-D{build.band} -DLoRaWAN_DEBUG_LEVEL={build.LoRaWanDebugLevel} -DACTIVE_REGION=LORAMAC_{build.band} {build.psram} heltec_wireless_stick.menu.PSRAM.disabled=Disabled @@ -17782,6 +21265,24 @@ heltec_wireless_stick.menu.EraseFlash.none.upload.erase_cmd= heltec_wireless_stick.menu.EraseFlash.all=Enabled heltec_wireless_stick.menu.EraseFlash.all.upload.erase_cmd=-e +heltec_wireless_stick.menu.Revision.Heltec_Wireless_Stick_V1=Heltec Wireless Stick V1 (SX1276) +heltec_wireless_stick.menu.Revision.Heltec_Wireless_Stick_V1.build.board=HELTEC_WIRELESS_STICK_V1 +heltec_wireless_stick.menu.Revision.Heltec_Wireless_Stick_V1.build.variant=heltec_wireless_stick_V1 +heltec_wireless_stick.menu.Revision.Heltec_Wireless_Stick_V1.build.flash_size=4MB +heltec_wireless_stick.menu.Revision.Heltec_Wireless_Stick_V1.build.partitions=default + +heltec_wireless_stick.menu.Revision.Heltec_Wireless_Stick_V2=Heltec Wireless Stick V2 (SX1276) +heltec_wireless_stick.menu.Revision.Heltec_Wireless_Stick_V2.build.board=HELTEC_WIRELESS_STICK_V2 +heltec_wireless_stick.menu.Revision.Heltec_Wireless_Stick_V2.build.variant=heltec_wireless_stick +heltec_wireless_stick.menu.Revision.Heltec_Wireless_Stick_V2.build.flash_size=8MB +heltec_wireless_stick.menu.Revision.Heltec_Wireless_Stick_V2.build.partitions=default_8MB + +heltec_wireless_stick.menu.Revision.Heltec_Wireless_Stick_V3=Heltec Wireless Stick V3 (SX1262) +heltec_wireless_stick.menu.Revision.Heltec_Wireless_Stick_V3.build.board=HELTEC_WIRELESS_STICK_V3 +heltec_wireless_stick.menu.Revision.Heltec_Wireless_Stick_V3.build.variant=heltec_wireless_stick +heltec_wireless_stick.menu.Revision.Heltec_Wireless_Stick_V3.build.flash_size=8MB +heltec_wireless_stick.menu.Revision.Heltec_Wireless_Stick_V3.build.partitions=default_8MB + ############################################################## heltec_wireless_stick_lite.name=Heltec Wireless Stick Lite @@ -17897,6 +21398,255 @@ heltec_wireless_stick_lite.menu.EraseFlash.all.upload.erase_cmd=-e ############################################################## +heltec_wireless_tracker.name=Heltec Wireless Tracker +heltec_wireless_tracker.vid.0=0x303a +heltec_wireless_tracker.pid.0=0x1001 + +heltec_wireless_tracker.bootloader.tool=esptool_py +heltec_wireless_tracker.bootloader.tool.default=esptool_py + +heltec_wireless_tracker.upload.tool=esptool_py +heltec_wireless_tracker.upload.tool.default=esptool_py +heltec_wireless_tracker.upload.tool.network=esp_ota + +heltec_wireless_tracker.upload.maximum_size=1310720 +heltec_wireless_tracker.upload.maximum_data_size=327680 +heltec_wireless_tracker.upload.flags= +heltec_wireless_tracker.upload.extra_flags= +heltec_wireless_tracker.upload.use_1200bps_touch=false +heltec_wireless_tracker.upload.wait_for_upload_port=false + +heltec_wireless_tracker.serial.disableDTR=false +heltec_wireless_tracker.serial.disableRTS=false + +heltec_wireless_tracker.build.tarch=xtensa +heltec_wireless_tracker.build.bootloader_addr=0x0 +heltec_wireless_tracker.build.target=esp32s3 +heltec_wireless_tracker.build.mcu=esp32s3 +heltec_wireless_tracker.build.core=esp32 +heltec_wireless_tracker.build.variant=heltec_wireless_tracker +heltec_wireless_tracker.build.board=HELTEC_WIRELESS_TRACKER + +heltec_wireless_tracker.build.usb_mode=1 +heltec_wireless_tracker.build.cdc_on_boot=0 +heltec_wireless_tracker.build.msc_on_boot=0 +heltec_wireless_tracker.build.dfu_on_boot=0 +heltec_wireless_tracker.build.f_cpu=240000000L +heltec_wireless_tracker.build.flash_size=4MB +heltec_wireless_tracker.build.flash_freq=80m +heltec_wireless_tracker.build.flash_mode=dio +heltec_wireless_tracker.build.boot=qio +heltec_wireless_tracker.build.boot_freq=80m +heltec_wireless_tracker.build.partitions=default +heltec_wireless_tracker.build.loop_core= +heltec_wireless_tracker.build.event_core= +heltec_wireless_tracker.build.psram_type=qspi +heltec_wireless_tracker.build.memory_type={build.boot}_{build.psram_type} +heltec_wireless_tracker.build.defines=-D{build.band} {build.psram_val} -DLoRaWAN_DEBUG_LEVEL={build.LoRaWanDebugLevel} -DACTIVE_REGION=LORAMAC_{build.band} -DLORAWAN_PREAMBLE_LENGTH={build.LORAWAN_PREAMBLE_LENGTH} -DLORAWAN_DEVEUI_AUTO={build.LORAWAN_DEVEUI_AUTO} -D{build.board} + +heltec_wireless_tracker.menu.PSRAM.disabled=Disabled +heltec_wireless_tracker.menu.PSRAM.disabled.build.psram_val= +heltec_wireless_tracker.menu.PSRAM.disabled.build.psram_type=qspi +heltec_wireless_tracker.menu.PSRAM.enabled=QSPI PSRAM +heltec_wireless_tracker.menu.PSRAM.enabled.build.psram_val=-DBOARD_HAS_PSRAM +heltec_wireless_tracker.menu.PSRAM.enabled.build.psram_type=qspi +heltec_wireless_tracker.menu.PSRAM.opi=OPI PSRAM +heltec_wireless_tracker.menu.PSRAM.opi.build.psram_val=-DBOARD_HAS_PSRAM +heltec_wireless_tracker.menu.PSRAM.opi.build.psram_type=opi + +heltec_wireless_tracker.menu.FlashMode.qio=QIO 80MHz +heltec_wireless_tracker.menu.FlashMode.qio.build.flash_mode=dio +heltec_wireless_tracker.menu.FlashMode.qio.build.boot=qio +heltec_wireless_tracker.menu.FlashMode.qio.build.boot_freq=80m +heltec_wireless_tracker.menu.FlashMode.qio.build.flash_freq=80m +heltec_wireless_tracker.menu.FlashMode.qio120=QIO 120MHz +heltec_wireless_tracker.menu.FlashMode.qio120.build.flash_mode=dio +heltec_wireless_tracker.menu.FlashMode.qio120.build.boot=qio +heltec_wireless_tracker.menu.FlashMode.qio120.build.boot_freq=120m +heltec_wireless_tracker.menu.FlashMode.qio120.build.flash_freq=80m +heltec_wireless_tracker.menu.FlashMode.dio=DIO 80MHz +heltec_wireless_tracker.menu.FlashMode.dio.build.flash_mode=dio +heltec_wireless_tracker.menu.FlashMode.dio.build.boot=dio +heltec_wireless_tracker.menu.FlashMode.dio.build.boot_freq=80m +heltec_wireless_tracker.menu.FlashMode.dio.build.flash_freq=80m +heltec_wireless_tracker.menu.FlashMode.opi=OPI 80MHz +heltec_wireless_tracker.menu.FlashMode.opi.build.flash_mode=dout +heltec_wireless_tracker.menu.FlashMode.opi.build.boot=opi +heltec_wireless_tracker.menu.FlashMode.opi.build.boot_freq=80m +heltec_wireless_tracker.menu.FlashMode.opi.build.flash_freq=80m + +heltec_wireless_tracker.menu.FlashSize.4M=4MB (32Mb) +heltec_wireless_tracker.menu.FlashSize.4M.build.flash_size=4MB +heltec_wireless_tracker.menu.FlashSize.8M=8MB (64Mb) +heltec_wireless_tracker.menu.FlashSize.8M.build.flash_size=8MB +heltec_wireless_tracker.menu.FlashSize.8M.build.partitions=default_8MB +heltec_wireless_tracker.menu.FlashSize.16M=16MB (128Mb) +heltec_wireless_tracker.menu.FlashSize.16M.build.flash_size=16MB +#heltec_wireless_tracker.menu.FlashSize.32M=32MB (256Mb) +#heltec_wireless_tracker.menu.FlashSize.32M.build.flash_size=32MB + +heltec_wireless_tracker.menu.LoopCore.1=Core 1 +heltec_wireless_tracker.menu.LoopCore.1.build.loop_core=-DARDUINO_RUNNING_CORE=1 +heltec_wireless_tracker.menu.LoopCore.0=Core 0 +heltec_wireless_tracker.menu.LoopCore.0.build.loop_core=-DARDUINO_RUNNING_CORE=0 + +heltec_wireless_tracker.menu.EventsCore.1=Core 1 +heltec_wireless_tracker.menu.EventsCore.1.build.event_core=-DARDUINO_EVENT_RUNNING_CORE=1 +heltec_wireless_tracker.menu.EventsCore.0=Core 0 +heltec_wireless_tracker.menu.EventsCore.0.build.event_core=-DARDUINO_EVENT_RUNNING_CORE=0 + +heltec_wireless_tracker.menu.USBMode.hwcdc=Hardware CDC and JTAG +heltec_wireless_tracker.menu.USBMode.hwcdc.build.usb_mode=1 +heltec_wireless_tracker.menu.USBMode.default=USB-OTG (TinyUSB) +heltec_wireless_tracker.menu.USBMode.default.build.usb_mode=0 + +heltec_wireless_tracker.menu.CDCOnBoot.default=Disabled +heltec_wireless_tracker.menu.CDCOnBoot.default.build.cdc_on_boot=0 +heltec_wireless_tracker.menu.CDCOnBoot.cdc=Enabled +heltec_wireless_tracker.menu.CDCOnBoot.cdc.build.cdc_on_boot=1 + +heltec_wireless_tracker.menu.MSCOnBoot.default=Disabled +heltec_wireless_tracker.menu.MSCOnBoot.default.build.msc_on_boot=0 +heltec_wireless_tracker.menu.MSCOnBoot.msc=Enabled (Requires USB-OTG Mode) +heltec_wireless_tracker.menu.MSCOnBoot.msc.build.msc_on_boot=1 + +heltec_wireless_tracker.menu.DFUOnBoot.default=Disabled +heltec_wireless_tracker.menu.DFUOnBoot.default.build.dfu_on_boot=0 +heltec_wireless_tracker.menu.DFUOnBoot.dfu=Enabled (Requires USB-OTG Mode) +heltec_wireless_tracker.menu.DFUOnBoot.dfu.build.dfu_on_boot=1 + +heltec_wireless_tracker.menu.UploadMode.default=UART0 / Hardware CDC +heltec_wireless_tracker.menu.UploadMode.default.upload.use_1200bps_touch=false +heltec_wireless_tracker.menu.UploadMode.default.upload.wait_for_upload_port=false +heltec_wireless_tracker.menu.UploadMode.cdc=USB-OTG CDC (TinyUSB) +heltec_wireless_tracker.menu.UploadMode.cdc.upload.use_1200bps_touch=true +heltec_wireless_tracker.menu.UploadMode.cdc.upload.wait_for_upload_port=true + +heltec_wireless_tracker.menu.PartitionScheme.default=Default 4MB with spiffs (1.2MB APP/1.5MB SPIFFS) +heltec_wireless_tracker.menu.PartitionScheme.default.build.partitions=default +heltec_wireless_tracker.menu.PartitionScheme.defaultffat=Default 4MB with ffat (1.2MB APP/1.5MB FATFS) +heltec_wireless_tracker.menu.PartitionScheme.defaultffat.build.partitions=default_ffat +heltec_wireless_tracker.menu.PartitionScheme.default_8MB=8M Flash (3MB APP/1.5MB FAT) +heltec_wireless_tracker.menu.PartitionScheme.default_8MB.build.partitions=default_8MB +heltec_wireless_tracker.menu.PartitionScheme.default_8MB.upload.maximum_size=3342336 +heltec_wireless_tracker.menu.PartitionScheme.minimal=Minimal (1.3MB APP/700KB SPIFFS) +heltec_wireless_tracker.menu.PartitionScheme.minimal.build.partitions=minimal +heltec_wireless_tracker.menu.PartitionScheme.no_ota=No OTA (2MB APP/2MB SPIFFS) +heltec_wireless_tracker.menu.PartitionScheme.no_ota.build.partitions=no_ota +heltec_wireless_tracker.menu.PartitionScheme.no_ota.upload.maximum_size=2097152 +heltec_wireless_tracker.menu.PartitionScheme.noota_3g=No OTA (1MB APP/3MB SPIFFS) +heltec_wireless_tracker.menu.PartitionScheme.noota_3g.build.partitions=noota_3g +heltec_wireless_tracker.menu.PartitionScheme.noota_3g.upload.maximum_size=1048576 +heltec_wireless_tracker.menu.PartitionScheme.noota_ffat=No OTA (2MB APP/2MB FATFS) +heltec_wireless_tracker.menu.PartitionScheme.noota_ffat.build.partitions=noota_ffat +heltec_wireless_tracker.menu.PartitionScheme.noota_ffat.upload.maximum_size=2097152 +heltec_wireless_tracker.menu.PartitionScheme.noota_3gffat=No OTA (1MB APP/3MB FATFS) +heltec_wireless_tracker.menu.PartitionScheme.noota_3gffat.build.partitions=noota_3gffat +heltec_wireless_tracker.menu.PartitionScheme.noota_3gffat.upload.maximum_size=1048576 +heltec_wireless_tracker.menu.PartitionScheme.huge_app=Huge APP (3MB No OTA/1MB SPIFFS) +heltec_wireless_tracker.menu.PartitionScheme.huge_app.build.partitions=huge_app +heltec_wireless_tracker.menu.PartitionScheme.huge_app.upload.maximum_size=3145728 +heltec_wireless_tracker.menu.PartitionScheme.min_spiffs=Minimal SPIFFS (1.9MB APP with OTA/190KB SPIFFS) +heltec_wireless_tracker.menu.PartitionScheme.min_spiffs.build.partitions=min_spiffs +heltec_wireless_tracker.menu.PartitionScheme.min_spiffs.upload.maximum_size=1966080 +heltec_wireless_tracker.menu.PartitionScheme.fatflash=16M Flash (2MB APP/12.5MB FAT) +heltec_wireless_tracker.menu.PartitionScheme.fatflash.build.partitions=ffat +heltec_wireless_tracker.menu.PartitionScheme.fatflash.upload.maximum_size=2097152 +heltec_wireless_tracker.menu.PartitionScheme.app3M_fat9M_16MB=16M Flash (3MB APP/9MB FATFS) +heltec_wireless_tracker.menu.PartitionScheme.app3M_fat9M_16MB.build.partitions=app3M_fat9M_16MB +heltec_wireless_tracker.menu.PartitionScheme.app3M_fat9M_16MB.upload.maximum_size=3145728 +heltec_wireless_tracker.menu.PartitionScheme.rainmaker=RainMaker +heltec_wireless_tracker.menu.PartitionScheme.rainmaker.build.partitions=rainmaker +heltec_wireless_tracker.menu.PartitionScheme.rainmaker.upload.maximum_size=3145728 + +heltec_wireless_tracker.menu.CPUFreq.240=240MHz (WiFi) +heltec_wireless_tracker.menu.CPUFreq.240.build.f_cpu=240000000L +heltec_wireless_tracker.menu.CPUFreq.160=160MHz (WiFi) +heltec_wireless_tracker.menu.CPUFreq.160.build.f_cpu=160000000L +heltec_wireless_tracker.menu.CPUFreq.80=80MHz (WiFi) +heltec_wireless_tracker.menu.CPUFreq.80.build.f_cpu=80000000L +heltec_wireless_tracker.menu.CPUFreq.40=40MHz +heltec_wireless_tracker.menu.CPUFreq.40.build.f_cpu=40000000L +heltec_wireless_tracker.menu.CPUFreq.20=20MHz +heltec_wireless_tracker.menu.CPUFreq.20.build.f_cpu=20000000L +heltec_wireless_tracker.menu.CPUFreq.10=10MHz +heltec_wireless_tracker.menu.CPUFreq.10.build.f_cpu=10000000L + +heltec_wireless_tracker.menu.UploadSpeed.921600=921600 +heltec_wireless_tracker.menu.UploadSpeed.921600.upload.speed=921600 +heltec_wireless_tracker.menu.UploadSpeed.115200=115200 +heltec_wireless_tracker.menu.UploadSpeed.115200.upload.speed=115200 +heltec_wireless_tracker.menu.UploadSpeed.256000.windows=256000 +heltec_wireless_tracker.menu.UploadSpeed.256000.upload.speed=256000 +heltec_wireless_tracker.menu.UploadSpeed.230400.windows.upload.speed=256000 +heltec_wireless_tracker.menu.UploadSpeed.230400=230400 +heltec_wireless_tracker.menu.UploadSpeed.230400.upload.speed=230400 +heltec_wireless_tracker.menu.UploadSpeed.460800.linux=460800 +heltec_wireless_tracker.menu.UploadSpeed.460800.macosx=460800 +heltec_wireless_tracker.menu.UploadSpeed.460800.upload.speed=460800 +heltec_wireless_tracker.menu.UploadSpeed.512000.windows=512000 +heltec_wireless_tracker.menu.UploadSpeed.512000.upload.speed=512000 + +heltec_wireless_tracker.menu.DebugLevel.none=None +heltec_wireless_tracker.menu.DebugLevel.none.build.code_debug=0 +heltec_wireless_tracker.menu.DebugLevel.error=Error +heltec_wireless_tracker.menu.DebugLevel.error.build.code_debug=1 +heltec_wireless_tracker.menu.DebugLevel.warn=Warn +heltec_wireless_tracker.menu.DebugLevel.warn.build.code_debug=2 +heltec_wireless_tracker.menu.DebugLevel.info=Info +heltec_wireless_tracker.menu.DebugLevel.info.build.code_debug=3 +heltec_wireless_tracker.menu.DebugLevel.debug=Debug +heltec_wireless_tracker.menu.DebugLevel.debug.build.code_debug=4 +heltec_wireless_tracker.menu.DebugLevel.verbose=Verbose +heltec_wireless_tracker.menu.DebugLevel.verbose.build.code_debug=5 + +heltec_wireless_tracker.menu.LORAWAN_REGION.0=REGION_EU868 +heltec_wireless_tracker.menu.LORAWAN_REGION.0.build.band=REGION_EU868 +heltec_wireless_tracker.menu.LORAWAN_REGION.1=REGION_EU433 +heltec_wireless_tracker.menu.LORAWAN_REGION.1.build.band=REGION_EU433 +heltec_wireless_tracker.menu.LORAWAN_REGION.2=REGION_CN470 +heltec_wireless_tracker.menu.LORAWAN_REGION.2.build.band=REGION_CN470 +heltec_wireless_tracker.menu.LORAWAN_REGION.3=REGION_US915 +heltec_wireless_tracker.menu.LORAWAN_REGION.3.build.band=REGION_US915 +heltec_wireless_tracker.menu.LORAWAN_REGION.4=REGION_AU915 +heltec_wireless_tracker.menu.LORAWAN_REGION.4.build.band=REGION_AU915 +heltec_wireless_tracker.menu.LORAWAN_REGION.5=REGION_CN779 +heltec_wireless_tracker.menu.LORAWAN_REGION.5.build.band=REGION_CN779 +heltec_wireless_tracker.menu.LORAWAN_REGION.6=REGION_AS923 +heltec_wireless_tracker.menu.LORAWAN_REGION.6.build.band=REGION_AS923 +heltec_wireless_tracker.menu.LORAWAN_REGION.7=REGION_KR920 +heltec_wireless_tracker.menu.LORAWAN_REGION.7.build.band=REGION_KR920 +heltec_wireless_tracker.menu.LORAWAN_REGION.8=REGION_IN865 +heltec_wireless_tracker.menu.LORAWAN_REGION.8.build.band=REGION_IN865 +heltec_wireless_tracker.menu.LORAWAN_REGION.9=REGION_US915_HYBRID +heltec_wireless_tracker.menu.LORAWAN_REGION.9.build.band=REGION_US915_HYBRID + +heltec_wireless_tracker.menu.LoRaWanDebugLevel.0=None +heltec_wireless_tracker.menu.LoRaWanDebugLevel.0.build.LoRaWanDebugLevel=0 +heltec_wireless_tracker.menu.LoRaWanDebugLevel.1=Freq +heltec_wireless_tracker.menu.LoRaWanDebugLevel.1.build.LoRaWanDebugLevel=1 +heltec_wireless_tracker.menu.LoRaWanDebugLevel.2=Freq && DIO +heltec_wireless_tracker.menu.LoRaWanDebugLevel.2.build.LoRaWanDebugLevel=2 +heltec_wireless_tracker.menu.LoRaWanDebugLevel.3=Freq && DIO && PW +heltec_wireless_tracker.menu.LoRaWanDebugLevel.3.build.LoRaWanDebugLevel=3 + +heltec_wireless_tracker.menu.LORAWAN_DEVEUI.0=CUSTOM +heltec_wireless_tracker.menu.LORAWAN_DEVEUI.0.build.LORAWAN_DEVEUI_AUTO=0 +heltec_wireless_tracker.menu.LORAWAN_DEVEUI.1=Generate By ChipID +heltec_wireless_tracker.menu.LORAWAN_DEVEUI.1.build.LORAWAN_DEVEUI_AUTO=1 + +heltec_wireless_tracker.menu.LORAWAN_PREAMBLE_LENGTH.0=8(default) +heltec_wireless_tracker.menu.LORAWAN_PREAMBLE_LENGTH.0.build.LORAWAN_PREAMBLE_LENGTH=8 +heltec_wireless_tracker.menu.LORAWAN_PREAMBLE_LENGTH.1=16(For M00 and M00L) +heltec_wireless_tracker.menu.LORAWAN_PREAMBLE_LENGTH.1.build.LORAWAN_PREAMBLE_LENGTH=16 + +heltec_wireless_tracker.menu.EraseFlash.none=Disabled +heltec_wireless_tracker.menu.EraseFlash.none.upload.erase_cmd= +heltec_wireless_tracker.menu.EraseFlash.all=Enabled +heltec_wireless_tracker.menu.EraseFlash.all.upload.erase_cmd=-e + +############################################################## + espectro32.name=ESPectro32 espectro32.bootloader.tool=esptool_py @@ -29364,7 +33114,7 @@ esp32s3_powerfeather.build.variant=esp32s3_powerfeather esp32s3_powerfeather.build.board=ESP32S3_POWERFEATHER esp32s3_powerfeather.build.usb_mode=1 -esp32s3_powerfeather.build.cdc_on_boot=0 +esp32s3_powerfeather.build.cdc_on_boot=1 esp32s3_powerfeather.build.msc_on_boot=0 esp32s3_powerfeather.build.dfu_on_boot=0 esp32s3_powerfeather.build.f_cpu=240000000L @@ -29377,8 +33127,9 @@ esp32s3_powerfeather.build.partitions=default_8MB esp32s3_powerfeather.build.defines= esp32s3_powerfeather.build.loop_core= esp32s3_powerfeather.build.event_core= +esp32s3_powerfeather.build.flash_type=qio esp32s3_powerfeather.build.psram_type=qspi -esp32s3_powerfeather.build.memory_type={build.boot}_{build.psram_type} +esp32s3_powerfeather.build.memory_type={build.flash_type}_{build.psram_type} esp32s3_powerfeather.menu.PSRAM.disabled=Disabled esp32s3_powerfeather.menu.PSRAM.disabled.build.defines= @@ -29418,10 +33169,10 @@ esp32s3_powerfeather.menu.USBMode.hwcdc.build.usb_mode=1 esp32s3_powerfeather.menu.USBMode.default=USB-OTG (TinyUSB) esp32s3_powerfeather.menu.USBMode.default.build.usb_mode=0 -esp32s3_powerfeather.menu.CDCOnBoot.default=Disabled -esp32s3_powerfeather.menu.CDCOnBoot.default.build.cdc_on_boot=0 esp32s3_powerfeather.menu.CDCOnBoot.cdc=Enabled esp32s3_powerfeather.menu.CDCOnBoot.cdc.build.cdc_on_boot=1 +esp32s3_powerfeather.menu.CDCOnBoot.default=Disabled +esp32s3_powerfeather.menu.CDCOnBoot.default.build.cdc_on_boot=0 esp32s3_powerfeather.menu.MSCOnBoot.default=Disabled esp32s3_powerfeather.menu.MSCOnBoot.default.build.msc_on_boot=0 @@ -29440,39 +33191,21 @@ esp32s3_powerfeather.menu.UploadMode.cdc=USB-OTG CDC (TinyUSB) esp32s3_powerfeather.menu.UploadMode.cdc.upload.use_1200bps_touch=true esp32s3_powerfeather.menu.UploadMode.cdc.upload.wait_for_upload_port=true -esp32s3_powerfeather.menu.PartitionScheme.default=Default 4MB with spiffs (1.2MB APP/1.5MB SPIFFS) -esp32s3_powerfeather.menu.PartitionScheme.default.build.partitions=default -esp32s3_powerfeather.menu.PartitionScheme.defaultffat=Default 4MB with ffat (1.2MB APP/1.5MB FATFS) -esp32s3_powerfeather.menu.PartitionScheme.defaultffat.build.partitions=default_ffat esp32s3_powerfeather.menu.PartitionScheme.default_8MB=8M with spiffs (3MB APP/1.5MB SPIFFS) esp32s3_powerfeather.menu.PartitionScheme.default_8MB.build.partitions=default_8MB esp32s3_powerfeather.menu.PartitionScheme.default_8MB.upload.maximum_size=3342336 -esp32s3_powerfeather.menu.PartitionScheme.minimal=Minimal (1.3MB APP/700KB SPIFFS) -esp32s3_powerfeather.menu.PartitionScheme.minimal.build.partitions=minimal -esp32s3_powerfeather.menu.PartitionScheme.no_ota=No OTA (2MB APP/2MB SPIFFS) -esp32s3_powerfeather.menu.PartitionScheme.no_ota.build.partitions=no_ota -esp32s3_powerfeather.menu.PartitionScheme.no_ota.upload.maximum_size=2097152 -esp32s3_powerfeather.menu.PartitionScheme.noota_3g=No OTA (1MB APP/3MB SPIFFS) -esp32s3_powerfeather.menu.PartitionScheme.noota_3g.build.partitions=noota_3g -esp32s3_powerfeather.menu.PartitionScheme.noota_3g.upload.maximum_size=1048576 -esp32s3_powerfeather.menu.PartitionScheme.noota_ffat=No OTA (2MB APP/2MB FATFS) -esp32s3_powerfeather.menu.PartitionScheme.noota_ffat.build.partitions=noota_ffat -esp32s3_powerfeather.menu.PartitionScheme.noota_ffat.upload.maximum_size=2097152 -esp32s3_powerfeather.menu.PartitionScheme.noota_3gffat=No OTA (1MB APP/3MB FATFS) -esp32s3_powerfeather.menu.PartitionScheme.noota_3gffat.build.partitions=noota_3gffat -esp32s3_powerfeather.menu.PartitionScheme.noota_3gffat.upload.maximum_size=1048576 -esp32s3_powerfeather.menu.PartitionScheme.huge_app=Huge APP (3MB No OTA/1MB SPIFFS) -esp32s3_powerfeather.menu.PartitionScheme.huge_app.build.partitions=huge_app -esp32s3_powerfeather.menu.PartitionScheme.huge_app.upload.maximum_size=3145728 -esp32s3_powerfeather.menu.PartitionScheme.min_spiffs=Minimal SPIFFS (1.9MB APP with OTA/190KB SPIFFS) -esp32s3_powerfeather.menu.PartitionScheme.min_spiffs.build.partitions=min_spiffs -esp32s3_powerfeather.menu.PartitionScheme.min_spiffs.upload.maximum_size=1966080 +esp32s3_powerfeather.menu.PartitionScheme.default_ffat_8MB=8M with ffat (3MB APP/1.5MB FATFS) +esp32s3_powerfeather.menu.PartitionScheme.default_ffat_8MB.build.partitions=default_ffat_8MB +esp32s3_powerfeather.menu.PartitionScheme.default_ffat_8MB.upload.maximum_size=3342336 +esp32s3_powerfeather.menu.PartitionScheme.large_spiffs_8MB=Large SPIFFS (1.2MB APP/5.3MB SPIFFS) +esp32s3_powerfeather.menu.PartitionScheme.large_spiffs_8MB.build.partitions=large_spiffs_8MB +esp32s3_powerfeather.menu.PartitionScheme.large_spiffs_8MB.upload.maximum_size=1310720 +esp32s3_powerfeather.menu.PartitionScheme.large_ffat_8MB=Large FFAT (1.2MB APP/5.3MB FATFS) +esp32s3_powerfeather.menu.PartitionScheme.large_ffat_8MB.build.partitions=large_ffat_8MB +esp32s3_powerfeather.menu.PartitionScheme.large_ffat_8MB.upload.maximum_size=1310720 esp32s3_powerfeather.menu.PartitionScheme.max_app_8MB=Maximum APP (7.9MB APP No OTA/No FS) esp32s3_powerfeather.menu.PartitionScheme.max_app_8MB.build.partitions=max_app_8MB esp32s3_powerfeather.menu.PartitionScheme.max_app_8MB.upload.maximum_size=8257536 -esp32s3_powerfeather.menu.PartitionScheme.rainmaker=RainMaker -esp32s3_powerfeather.menu.PartitionScheme.rainmaker.build.partitions=rainmaker -esp32s3_powerfeather.menu.PartitionScheme.rainmaker.upload.maximum_size=3145728 esp32s3_powerfeather.menu.CPUFreq.240=240MHz (WiFi) esp32s3_powerfeather.menu.CPUFreq.240.build.f_cpu=240000000L @@ -29741,9 +33474,22 @@ nano_nora.build.psram_type=opi nano_nora.build.memory_type={build.boot}_{build.psram_type} nano_nora.build.disable_pin_remap= +nano_nora.debug_config.nano_nora.cortex-debug.custom.name=Arduino on Nano ESP32 +nano_nora.debug_config.nano_nora.cortex-debug.custom.overrideAttachCommands.0=set remote hardware-watchpoint-limit 2 +nano_nora.debug_config.nano_nora.cortex-debug.custom.overrideAttachCommands.1=monitor reset halt +nano_nora.debug_config.nano_nora.cortex-debug.custom.overrideAttachCommands.2=monitor gdb_sync +nano_nora.debug_config.nano_nora.cortex-debug.custom.overrideAttachCommands.3=interrupt +nano_nora.debug_config.nano_nora.cortex-debug.custom.overrideRestartCommands.0=monitor reset halt +nano_nora.debug_config.nano_nora.cortex-debug.custom.overrideRestartCommands.1=monitor gdb_sync +nano_nora.debug_config.nano_nora.cortex-debug.custom.overrideRestartCommands.2=interrupt +nano_nora.debug.additional_config=debug_config.nano_nora + nano_nora.tools.esptool_py.program.pattern_args=--chip {build.mcu} --port "{serial.port}" --before default_reset --after hard_reset write_flash -z --flash_mode {build.flash_mode} --flash_freq {build.flash_freq} --flash_size {build.flash_size} {build.bootloader_addr} "{build.path}/{build.project_name}.bootloader.bin" 0x8000 "{build.path}/{build.project_name}.partitions.bin" 0xe000 "{runtime.platform.path}/tools/partitions/boot_app0.bin" 0xf70000 "{build.variant.path}/extra/nora_recovery/nora_recovery.ino.bin" 0x10000 "{build.path}/{build.project_name}.bin" nano_nora.tools.esptool_py.erase.pattern_args=--chip {build.mcu} --port "{serial.port}" --before default_reset --after hard_reset erase_flash +nano_nora.programmer.default=esptool +nano_nora.debug.executable= + nano_nora.menu.PartitionScheme.default=With FAT partition (default) nano_nora.menu.PartitionScheme.spiffs=With SPIFFS partition (advanced) nano_nora.menu.PartitionScheme.spiffs.build.partitions=app3M_spiffs9M_fact512k_16MB @@ -29755,8 +33501,122 @@ nano_nora.menu.PinNumbers.byGPIONumber.build.disable_pin_remap=-DBOARD_USES_HW_G nano_nora.menu.USBMode.default=Normal mode (TinyUSB) nano_nora.menu.USBMode.hwcdc=Debug mode (Hardware CDC) nano_nora.menu.USBMode.hwcdc.build.usb_mode=1 -nano_nora.menu.USBMode.hwcdc.build.copy_jtag_files=1 -nano_nora.menu.USBMode.hwcdc.build.openocdscript=esp32s3-builtin.cfg -nano_nora.menu.USBMode.hwcdc.build.debugconfig=esp32s3-arduino.json +nano_nora.menu.USBMode.hwcdc.debug.executable={build.path}/{build.project_name}.elf + +############################################################## + +makergo_c3_supermini.name=MakerGO ESP32 C3 SuperMini +makergo_c3_supermini.vid.0=0x303a +makergo_c3_supermini.pid.0=0x1001 + +makergo_c3_supermini.bootloader.tool=esptool_py +makergo_c3_supermini.bootloader.tool.default=esptool_py + +makergo_c3_supermini.upload.tool=esptool_py +makergo_c3_supermini.upload.tool.default=esptool_py +makergo_c3_supermini.upload.tool.network=esp_ota + +makergo_c3_supermini.upload.maximum_size=1310720 +makergo_c3_supermini.upload.maximum_data_size=327680 +makergo_c3_supermini.upload.flags= +makergo_c3_supermini.upload.extra_flags= +makergo_c3_supermini.upload.use_1200bps_touch=false +makergo_c3_supermini.upload.wait_for_upload_port=false + +makergo_c3_supermini.serial.disableDTR=true +makergo_c3_supermini.serial.disableRTS=true + +makergo_c3_supermini.build.tarch=riscv32 +makergo_c3_supermini.build.target=esp +makergo_c3_supermini.build.mcu=esp32c3 +makergo_c3_supermini.build.core=esp32 +makergo_c3_supermini.build.variant=makergo_c3_supermini +makergo_c3_supermini.build.board=MAKERGO_C3_SUPERMINI +makergo_c3_supermini.build.bootloader_addr=0x0 + +makergo_c3_supermini.build.cdc_on_boot=1 +makergo_c3_supermini.build.f_cpu=160000000L +makergo_c3_supermini.build.flash_size=4MB +makergo_c3_supermini.build.flash_freq=80m +makergo_c3_supermini.build.flash_mode=dio +makergo_c3_supermini.build.boot=qio +makergo_c3_supermini.build.partitions=default +makergo_c3_supermini.build.defines= + +makergo_c3_supermini.menu.CDCOnBoot.default=Enabled +makergo_c3_supermini.menu.CDCOnBoot.default.build.cdc_on_boot=1 +makergo_c3_supermini.menu.CDCOnBoot.dis_cdc=Disabled +makergo_c3_supermini.menu.CDCOnBoot.dis_cdc.build.cdc_on_boot=0 + +makergo_c3_supermini.menu.PartitionScheme.default=Default 4MB with spiffs (1.2MB APP/1.5MB SPIFFS) +makergo_c3_supermini.menu.PartitionScheme.default.build.partitions=default +makergo_c3_supermini.menu.PartitionScheme.defaultffat=Default 4MB with ffat (1.2MB APP/1.5MB FATFS) +makergo_c3_supermini.menu.PartitionScheme.defaultffat.build.partitions=default_ffat +makergo_c3_supermini.menu.PartitionScheme.no_ota=No OTA (2MB APP/2MB SPIFFS) +makergo_c3_supermini.menu.PartitionScheme.no_ota.build.partitions=no_ota +makergo_c3_supermini.menu.PartitionScheme.no_ota.upload.maximum_size=2097152 +makergo_c3_supermini.menu.PartitionScheme.noota_3g=No OTA (1MB APP/3MB SPIFFS) +makergo_c3_supermini.menu.PartitionScheme.noota_3g.build.partitions=noota_3g +makergo_c3_supermini.menu.PartitionScheme.noota_3g.upload.maximum_size=1048576 +makergo_c3_supermini.menu.PartitionScheme.noota_ffat=No OTA (2MB APP/2MB FATFS) +makergo_c3_supermini.menu.PartitionScheme.noota_ffat.build.partitions=noota_ffat +makergo_c3_supermini.menu.PartitionScheme.noota_ffat.upload.maximum_size=2097152 +makergo_c3_supermini.menu.PartitionScheme.noota_3gffat=No OTA (1MB APP/3MB FATFS) +makergo_c3_supermini.menu.PartitionScheme.noota_3gffat.build.partitions=noota_3gffat +makergo_c3_supermini.menu.PartitionScheme.noota_3gffat.upload.maximum_size=1048576 +makergo_c3_supermini.menu.PartitionScheme.huge_app=Huge APP (3MB No OTA/1MB SPIFFS) +makergo_c3_supermini.menu.PartitionScheme.huge_app.build.partitions=huge_app +makergo_c3_supermini.menu.PartitionScheme.huge_app.upload.maximum_size=3145728 + + +makergo_c3_supermini.menu.CPUFreq.160=160MHz (WiFi) +makergo_c3_supermini.menu.CPUFreq.160.build.f_cpu=160000000L +makergo_c3_supermini.menu.CPUFreq.80=80MHz (WiFi) +makergo_c3_supermini.menu.CPUFreq.80.build.f_cpu=80000000L +makergo_c3_supermini.menu.CPUFreq.40=40MHz +makergo_c3_supermini.menu.CPUFreq.40.build.f_cpu=40000000L +makergo_c3_supermini.menu.CPUFreq.20=20MHz +makergo_c3_supermini.menu.CPUFreq.20.build.f_cpu=20000000L +makergo_c3_supermini.menu.CPUFreq.10=10MHz +makergo_c3_supermini.menu.CPUFreq.10.build.f_cpu=10000000L + + +makergo_c3_supermini.menu.FlashFreq.80=80MHz +makergo_c3_supermini.menu.FlashFreq.80.build.flash_freq=80m +makergo_c3_supermini.menu.FlashFreq.40=40MHz +makergo_c3_supermini.menu.FlashFreq.40.build.flash_freq=40m + +makergo_c3_supermini.menu.UploadSpeed.921600=921600 +makergo_c3_supermini.menu.UploadSpeed.921600.upload.speed=921600 +makergo_c3_supermini.menu.UploadSpeed.115200=115200 +makergo_c3_supermini.menu.UploadSpeed.115200.upload.speed=115200 +makergo_c3_supermini.menu.UploadSpeed.256000.windows=256000 +makergo_c3_supermini.menu.UploadSpeed.256000.upload.speed=256000 +makergo_c3_supermini.menu.UploadSpeed.230400.windows.upload.speed=256000 +makergo_c3_supermini.menu.UploadSpeed.230400=230400 +makergo_c3_supermini.menu.UploadSpeed.230400.upload.speed=230400 +makergo_c3_supermini.menu.UploadSpeed.460800.linux=460800 +makergo_c3_supermini.menu.UploadSpeed.460800.macosx=460800 +makergo_c3_supermini.menu.UploadSpeed.460800.upload.speed=460800 +makergo_c3_supermini.menu.UploadSpeed.512000.windows=512000 +makergo_c3_supermini.menu.UploadSpeed.512000.upload.speed=512000 + +makergo_c3_supermini.menu.DebugLevel.none=None +makergo_c3_supermini.menu.DebugLevel.none.build.code_debug=0 +makergo_c3_supermini.menu.DebugLevel.error=Error +makergo_c3_supermini.menu.DebugLevel.error.build.code_debug=1 +makergo_c3_supermini.menu.DebugLevel.warn=Warn +makergo_c3_supermini.menu.DebugLevel.warn.build.code_debug=2 +makergo_c3_supermini.menu.DebugLevel.info=Info +makergo_c3_supermini.menu.DebugLevel.info.build.code_debug=3 +makergo_c3_supermini.menu.DebugLevel.debug=Debug +makergo_c3_supermini.menu.DebugLevel.debug.build.code_debug=4 +makergo_c3_supermini.menu.DebugLevel.verbose=Verbose +makergo_c3_supermini.menu.DebugLevel.verbose.build.code_debug=5 + +makergo_c3_supermini.menu.EraseFlash.none=Disabled +makergo_c3_supermini.menu.EraseFlash.none.upload.erase_cmd= +makergo_c3_supermini.menu.EraseFlash.all=Enabled +makergo_c3_supermini.menu.EraseFlash.all.upload.erase_cmd=-e ############################################################## diff --git a/cores/esp32/Esp.cpp b/cores/esp32/Esp.cpp index aa73e698bbe..925a67dfbad 100644 --- a/cores/esp32/Esp.cpp +++ b/cores/esp32/Esp.cpp @@ -131,7 +131,7 @@ unsigned long long operator"" _GB(unsigned long long x) EspClass ESP; -void EspClass::deepSleep(uint32_t time_us) +void EspClass::deepSleep(uint64_t time_us) { esp_deep_sleep(time_us); } @@ -248,6 +248,10 @@ String EspClass::getSketchMD5() md5.add(pb, readBytes); lengthLeft -= readBytes; offset += readBytes; + + #if CONFIG_FREERTOS_UNICORE + delay(1); // Fix solo WDT + #endif } free(pb); md5.calculate(); diff --git a/cores/esp32/Esp.h b/cores/esp32/Esp.h index 478158ddf1f..82dd25e3c25 100644 --- a/cores/esp32/Esp.h +++ b/cores/esp32/Esp.h @@ -86,7 +86,7 @@ class EspClass const char * getSdkVersion(); //version of ESP-IDF const char * getCoreVersion();//version of this core - void deepSleep(uint32_t time_us); + void deepSleep(uint64_t time_us); uint32_t getFlashChipSize(); uint32_t getFlashChipSpeed(); diff --git a/cores/esp32/HEXBuilder.cpp b/cores/esp32/HEXBuilder.cpp new file mode 100644 index 00000000000..f3b0f7a9b3e --- /dev/null +++ b/cores/esp32/HEXBuilder.cpp @@ -0,0 +1,71 @@ +/* + Copyright (c) 2015 Hristo Gochkov. All rights reserved. + This file is part of the esp32 core for Arduino environment. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#include +#include + +static uint8_t hex_char_to_byte(uint8_t c) +{ + return (c >= 'a' && c <= 'f') ? (c - ((uint8_t)'a' - 0xa)) : + (c >= 'A' && c <= 'F') ? (c - ((uint8_t)'A' - 0xA)) : + (c >= '0' && c<= '9') ? (c - (uint8_t)'0') : 0x10; // unknown char is 16 +} + +size_t HEXBuilder::hex2bytes(unsigned char * out, size_t maxlen, String &in) { + return hex2bytes(out, maxlen, in.c_str()); +} + +size_t HEXBuilder::hex2bytes(unsigned char * out, size_t maxlen, const char * in) { + size_t len = 0; + for(;*in;in++) { + uint8_t c = hex_char_to_byte(*in); + // Silently skip anything unknown. + if (c > 15) + continue; + + if (len & 1) { + if (len/2 < maxlen) + out[len/2] |= c; + } else { + if (len/2 < maxlen) + out[len/2] = c<<4; + } + len++; + } + return (len + 1)/2; +} + +size_t HEXBuilder::bytes2hex(char * out, size_t maxlen, const unsigned char * in, size_t len) { + for(size_t i = 0; i < len; i++) { + if (i*2 + 1 < maxlen) { + sprintf(out + (i * 2), "%02x", in[i]); + } + } + return len * 2 + 1; +} + +String HEXBuilder::bytes2hex(const unsigned char * in, size_t len) { + size_t maxlen = len * 2 + 1; + char * out = (char *) malloc(maxlen); + if (!out) return String(); + bytes2hex(out, maxlen, in, len); + String ret = String(out); + free(out); + return ret; +} diff --git a/cores/esp32/HEXBuilder.h b/cores/esp32/HEXBuilder.h new file mode 100644 index 00000000000..b3ec02ae267 --- /dev/null +++ b/cores/esp32/HEXBuilder.h @@ -0,0 +1,34 @@ +/* + Copyright (c) 2015 Hristo Gochkov. All rights reserved. + This file is part of the esp32 core for Arduino environment. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#ifndef HEXBuilder_h +#define HEXBuilder_h + +#include +#include + +class HEXBuilder { +public: + static size_t hex2bytes(unsigned char * out, size_t maxlen, String & in); + static size_t hex2bytes(unsigned char * out, size_t maxlen, const char * in); + + static String bytes2hex(const unsigned char * in, size_t len); + static size_t bytes2hex(char * out, size_t maxlen, const unsigned char * in, size_t len); +}; +#endif diff --git a/cores/esp32/HardwareI2C.h b/cores/esp32/HardwareI2C.h new file mode 100644 index 00000000000..830c24a80d6 --- /dev/null +++ b/cores/esp32/HardwareI2C.h @@ -0,0 +1,42 @@ +/* + Copyright (c) 2016 Arduino LLC. All right reserved. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#pragma once + +#include +#include "Stream.h" + +class HardwareI2C : public Stream +{ + public: + virtual bool begin() = 0; + virtual bool begin(uint8_t address) = 0; + virtual bool end() = 0; + + virtual bool setClock(uint32_t freq) = 0; + + virtual void beginTransmission(uint8_t address) = 0; + virtual uint8_t endTransmission(bool stopBit) = 0; + virtual uint8_t endTransmission(void) = 0; + + virtual size_t requestFrom(uint8_t address, size_t len, bool stopBit) = 0; + virtual size_t requestFrom(uint8_t address, size_t len) = 0; + + virtual void onReceive(void(*)(int)) = 0; + virtual void onRequest(void(*)(void)) = 0; +}; diff --git a/cores/esp32/HardwareSerial.cpp b/cores/esp32/HardwareSerial.cpp index 7792b8e039b..10a6bc1ca1d 100644 --- a/cores/esp32/HardwareSerial.cpp +++ b/cores/esp32/HardwareSerial.cpp @@ -114,7 +114,7 @@ _eventTask(NULL) HardwareSerial::~HardwareSerial() { - end(true); // explicit Full UART termination + end(); // explicit Full UART termination #if !CONFIG_DISABLE_HAL_LOCKS if(_lock != NULL){ vSemaphoreDelete(_lock); @@ -329,16 +329,22 @@ void HardwareSerial::begin(unsigned long baud, uint32_t config, int8_t rxPin, in // map logical pins to GPIO numbers rxPin = digitalPinToGPIONumber(rxPin); txPin = digitalPinToGPIONumber(txPin); + // IDF UART driver keeps Pin setting on restarting. Negative Pin number will keep it unmodified. + // it will detach previous UART attached pins - if(_uart) { - // in this case it is a begin() over a previous begin() - maybe to change baud rate - // thus do not disable debug output - end(false); // disables IDF UART driver and UART event Task + sets _uart to NULL + // indicates that uartbegin() has to initilize a new IDF driver + if (_testUartBegin(_uart_nr, baud ? baud : 9600, config, rxPin, txPin, _rxBufferSize, _txBufferSize, invert, rxfifo_full_thrhd)) { + _destroyEventTask(); // when IDF uart driver must be restarted, _eventTask must finish too } // IDF UART driver keeps Pin setting on restarting. Negative Pin number will keep it unmodified. // it will detach previous UART attached pins _uart = uartBegin(_uart_nr, baud ? baud : 9600, config, rxPin, txPin, _rxBufferSize, _txBufferSize, invert, rxfifo_full_thrhd); + if (_uart == NULL) { + log_e("UART driver failed to start. Please check the logs."); + HSERIAL_MUTEX_UNLOCK(); + return; + } if (!baud) { // using baud rate as zero, forces it to try to detect the current baud rate in place uartStartDetectBaudrate(_uart); @@ -348,11 +354,14 @@ void HardwareSerial::begin(unsigned long baud, uint32_t config, int8_t rxPin, in yield(); } - end(false); // disables IDF UART driver and UART event Task + sets _uart to NULL - if(detectedBaudRate) { delay(100); // Give some time... _uart = uartBegin(_uart_nr, detectedBaudRate, config, rxPin, txPin, _rxBufferSize, _txBufferSize, invert, rxfifo_full_thrhd); + if (_uart == NULL) { + log_e("UART driver failed to start. Please check the logs."); + HSERIAL_MUTEX_UNLOCK(); + return; + } } else { log_e("Could not detect baudrate. Serial data at the port must be present within the timeout for detection to be possible"); _uart = NULL; @@ -389,22 +398,17 @@ void HardwareSerial::updateBaudRate(unsigned long baud) uartSetBaudRate(_uart, baud); } -void HardwareSerial::end(bool fullyTerminate) +void HardwareSerial::end() { // default Serial.end() will completely disable HardwareSerial, // including any tasks or debug message channel (log_x()) - but not for IDF log messages! - if(fullyTerminate) { - _onReceiveCB = NULL; - _onReceiveErrorCB = NULL; - if (uartGetDebug() == _uart_nr) { - uartSetDebug(0); - } - _rxFIFOFull = 0; - uartEnd(_uart_nr); // fully detach all pins and delete the UART driver - } else { - // do not invalidate callbacks, detach pins, invalidate DBG output - uart_driver_delete(_uart_nr); + _onReceiveCB = NULL; + _onReceiveErrorCB = NULL; + if (uartGetDebug() == _uart_nr) { + uartSetDebug(0); } + _rxFIFOFull = 0; + uartEnd(_uart_nr); // fully detach all pins and delete the UART driver _destroyEventTask(); // when IDF uart driver is deleted, _eventTask must finish too _uart = NULL; } @@ -564,3 +568,4 @@ size_t HardwareSerial::setTxBufferSize(size_t new_size) { _txBufferSize = new_size; return _txBufferSize; } + diff --git a/cores/esp32/HardwareSerial.h b/cores/esp32/HardwareSerial.h index 688655f4f21..0bf72d2aff2 100644 --- a/cores/esp32/HardwareSerial.h +++ b/cores/esp32/HardwareSerial.h @@ -252,7 +252,7 @@ class HardwareSerial: public Stream // invert will invert RX/TX polarity // rxfifo_full_thrhd if the UART Flow Control Threshold in the UART FIFO (max 127) void begin(unsigned long baud, uint32_t config=SERIAL_8N1, int8_t rxPin=-1, int8_t txPin=-1, bool invert=false, unsigned long timeout_ms = 20000UL, uint8_t rxfifo_full_thrhd = 112); - void end(bool fullyTerminate = true); + void end(void); void updateBaudRate(unsigned long baud); int available(void); int availableForWrite(void); diff --git a/cores/esp32/HashBuilder.h b/cores/esp32/HashBuilder.h new file mode 100644 index 00000000000..86013bd65a2 --- /dev/null +++ b/cores/esp32/HashBuilder.h @@ -0,0 +1,52 @@ +// Copyright 2024 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#ifndef HashBuilder_h +#define HashBuilder_h + +#include +#include + +#include "HEXBuilder.h" + +class HashBuilder : public HEXBuilder +{ +public: + virtual ~HashBuilder() {} + virtual void begin() = 0; + + virtual void add(const uint8_t* data, size_t len) = 0; + virtual void add(const char* data) + { + add((const uint8_t*)data, strlen(data)); + } + virtual void add(String data) + { + add(data.c_str()); + } + + virtual void addHexString(const char* data) = 0; + virtual void addHexString(String data) + { + addHexString(data.c_str()); + } + + virtual bool addStream(Stream& stream, const size_t maxLen) = 0; + virtual void calculate() = 0; + virtual void getBytes(uint8_t* output) = 0; + virtual void getChars(char* output) = 0; + virtual String toString() = 0; +}; + +#endif diff --git a/cores/esp32/IPAddress.cpp b/cores/esp32/IPAddress.cpp index 0575363f254..0fa5affdea7 100644 --- a/cores/esp32/IPAddress.cpp +++ b/cores/esp32/IPAddress.cpp @@ -1,97 +1,138 @@ /* - IPAddress.cpp - Base class that provides IPAddress - Copyright (c) 2011 Adrian McEwen. All right reserved. + IPAddress.cpp - Base class that provides IPAddress + Copyright (c) 2011 Adrian McEwen. All right reserved. - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ -#include -#include -#include +#include "IPAddress.h" +#include "Print.h" +#include "lwip/netif.h" +#include "StreamString.h" -IPAddress::IPAddress() +IPAddress::IPAddress() : IPAddress(IPv4) {} + +IPAddress::IPAddress(IPType ip_type) { - _address.dword = 0; + _type = ip_type; + _zone = IP6_NO_ZONE; + memset(_address.bytes, 0, sizeof(_address.bytes)); } IPAddress::IPAddress(uint8_t first_octet, uint8_t second_octet, uint8_t third_octet, uint8_t fourth_octet) { - _address.bytes[0] = first_octet; - _address.bytes[1] = second_octet; - _address.bytes[2] = third_octet; - _address.bytes[3] = fourth_octet; + _type = IPv4; + _zone = IP6_NO_ZONE; + memset(_address.bytes, 0, sizeof(_address.bytes)); + _address.bytes[IPADDRESS_V4_BYTES_INDEX] = first_octet; + _address.bytes[IPADDRESS_V4_BYTES_INDEX + 1] = second_octet; + _address.bytes[IPADDRESS_V4_BYTES_INDEX + 2] = third_octet; + _address.bytes[IPADDRESS_V4_BYTES_INDEX + 3] = fourth_octet; } -IPAddress::IPAddress(uint32_t address) -{ - _address.dword = address; +IPAddress::IPAddress(uint8_t o1, uint8_t o2, uint8_t o3, uint8_t o4, uint8_t o5, uint8_t o6, uint8_t o7, uint8_t o8, uint8_t o9, uint8_t o10, uint8_t o11, uint8_t o12, uint8_t o13, uint8_t o14, uint8_t o15, uint8_t o16, uint8_t z) { + _type = IPv6; + _address.bytes[0] = o1; + _address.bytes[1] = o2; + _address.bytes[2] = o3; + _address.bytes[3] = o4; + _address.bytes[4] = o5; + _address.bytes[5] = o6; + _address.bytes[6] = o7; + _address.bytes[7] = o8; + _address.bytes[8] = o9; + _address.bytes[9] = o10; + _address.bytes[10] = o11; + _address.bytes[11] = o12; + _address.bytes[12] = o13; + _address.bytes[13] = o14; + _address.bytes[14] = o15; + _address.bytes[15] = o16; + _zone = z; } -IPAddress::IPAddress(const uint8_t *address) +IPAddress::IPAddress(uint32_t address) { - memcpy(_address.bytes, address, sizeof(_address.bytes)); + // IPv4 only + _type = IPv4; + _zone = IP6_NO_ZONE; + memset(_address.bytes, 0, sizeof(_address.bytes)); + _address.dword[IPADDRESS_V4_DWORD_INDEX] = address; + + // NOTE on conversion/comparison and uint32_t: + // These conversions are host platform dependent. + // There is a defined integer representation of IPv4 addresses, + // based on network byte order (will be the value on big endian systems), + // e.g. http://2398766798 is the same as http://142.250.70.206, + // However on little endian systems the octets 0x83, 0xFA, 0x46, 0xCE, + // in that order, will form the integer (uint32_t) 3460758158 . } -IPAddress& IPAddress::operator=(const uint8_t *address) +IPAddress::IPAddress(const uint8_t *address) : IPAddress(IPv4, address) {} + +IPAddress::IPAddress(IPType ip_type, const uint8_t *address, uint8_t z) { - memcpy(_address.bytes, address, sizeof(_address.bytes)); - return *this; + _type = ip_type; + if (ip_type == IPv4) { + memset(_address.bytes, 0, sizeof(_address.bytes)); + memcpy(&_address.bytes[IPADDRESS_V4_BYTES_INDEX], address, sizeof(uint32_t)); + _zone = 0; + } else { + memcpy(_address.bytes, address, sizeof(_address.bytes)); + _zone = z; + } } -IPAddress& IPAddress::operator=(uint32_t address) +IPAddress::IPAddress(const char *address) { - _address.dword = address; - return *this; + fromString(address); } -bool IPAddress::operator==(const uint8_t* addr) const +IPAddress::IPAddress(const IPAddress& address) { - return memcmp(addr, _address.bytes, sizeof(_address.bytes)) == 0; + *this = address; } -size_t IPAddress::printTo(Print& p) const +String IPAddress::toString(bool includeZone) const { - size_t n = 0; - for(int i = 0; i < 3; i++) { - n += p.print(_address.bytes[i], DEC); - n += p.print('.'); - } - n += p.print(_address.bytes[3], DEC); - return n; + StreamString s; + printTo(s, includeZone); + return String(s); } -String IPAddress::toString() const -{ - char szRet[16]; - sprintf(szRet,"%u.%u.%u.%u", _address.bytes[0], _address.bytes[1], _address.bytes[2], _address.bytes[3]); - return String(szRet); +bool IPAddress::fromString(const char *address) { + if (!fromString4(address)) { + return fromString6(address); + } + return true; } -bool IPAddress::fromString(const char *address) +bool IPAddress::fromString4(const char *address) { // TODO: add support for "a", "a.b", "a.b.c" formats - uint16_t acc = 0; // Accumulator + int16_t acc = -1; // Accumulator uint8_t dots = 0; + memset(_address.bytes, 0, sizeof(_address.bytes)); while (*address) { char c = *address++; if (c >= '0' && c <= '9') { - acc = acc * 10 + (c - '0'); + acc = (acc < 0) ? (c - '0') : acc * 10 + (c - '0'); if (acc > 255) { // Value out of [0..255] range return false; @@ -100,11 +141,15 @@ bool IPAddress::fromString(const char *address) else if (c == '.') { if (dots == 3) { - // Too much dots (there must be 3 dots) + // Too many dots (there must be 3 dots) return false; } - _address.bytes[dots++] = acc; - acc = 0; + if (acc < 0) { + /* No value between dots, e.g. '1..' */ + return false; + } + _address.bytes[IPADDRESS_V4_BYTES_INDEX + dots++] = acc; + acc = -1; } else { @@ -117,9 +162,269 @@ bool IPAddress::fromString(const char *address) // Too few dots (there must be 3 dots) return false; } - _address.bytes[3] = acc; + if (acc < 0) { + /* No value between dots, e.g. '1..' */ + return false; + } + _address.bytes[IPADDRESS_V4_BYTES_INDEX + 3] = acc; + _type = IPv4; return true; } -// declared one time - as external in IPAddress.h -IPAddress INADDR_NONE(0, 0, 0, 0); +bool IPAddress::fromString6(const char *address) { + uint32_t acc = 0; // Accumulator + int colons = 0, double_colons = -1; + + while (*address) + { + char c = tolower(*address++); + if (isalnum(c) && c <= 'f') { + if (c >= 'a') + c -= 'a' - '0' - 10; + acc = acc * 16 + (c - '0'); + if (acc > 0xffff) + // Value out of range + return false; + } + else if (c == ':') { + if (*address == ':') { + if (double_colons >= 0) { + // :: allowed once + return false; + } + if (*address != '\0' && *(address + 1) == ':') { + // ::: not allowed + return false; + } + // remember location + double_colons = colons + !!acc; + address++; + } else if (*address == '\0') { + // can't end with a single colon + return false; + } + if (colons == 7) + // too many separators + return false; + _address.bytes[colons * 2] = acc >> 8; + _address.bytes[colons * 2 + 1] = acc & 0xff; + colons++; + acc = 0; + } + else if (c == '%') { + _zone = netif_name_to_index(address); + while(*address != '\0'){ + address++; + } + } + else + // Invalid char + return false; + } + + if (double_colons == -1 && colons != 7) { + // Too few separators + return false; + } + if (double_colons > -1 && colons > 6) { + // Too many segments (double colon must be at least one zero field) + return false; + } + _address.bytes[colons * 2] = acc >> 8; + _address.bytes[colons * 2 + 1] = acc & 0xff; + colons++; + + if (double_colons != -1) { + for (int i = colons * 2 - double_colons * 2 - 1; i >= 0; i--) + _address.bytes[16 - colons * 2 + double_colons * 2 + i] = _address.bytes[double_colons * 2 + i]; + for (int i = double_colons * 2; i < 16 - colons * 2 + double_colons * 2; i++) + _address.bytes[i] = 0; + } + + _type = IPv6; + return true; +} + +IPAddress& IPAddress::operator=(const uint8_t *address) +{ + // IPv4 only conversion from byte pointer + _type = IPv4; + memset(_address.bytes, 0, sizeof(_address.bytes)); + memcpy(&_address.bytes[IPADDRESS_V4_BYTES_INDEX], address, sizeof(uint32_t)); + return *this; +} + +IPAddress& IPAddress::operator=(const char *address) +{ + fromString(address); + return *this; +} + +IPAddress& IPAddress::operator=(uint32_t address) +{ + // IPv4 conversion + // See note on conversion/comparison and uint32_t + _type = IPv4; + memset(_address.bytes, 0, sizeof(_address.bytes)); + _address.dword[IPADDRESS_V4_DWORD_INDEX] = address; + return *this; +} + +IPAddress& IPAddress::operator=(const IPAddress& address){ + _type = address.type(); + _zone = address.zone(); + memcpy(_address.bytes, address._address.bytes, sizeof(_address.bytes)); + return *this; +} + +bool IPAddress::operator==(const IPAddress& addr) const { + return (addr._type == _type) + && (memcmp(addr._address.bytes, _address.bytes, sizeof(_address.bytes)) == 0); +} + +bool IPAddress::operator==(const uint8_t* addr) const +{ + // IPv4 only comparison to byte pointer + // Can't support IPv6 as we know our type, but not the length of the pointer + return _type == IPv4 && memcmp(addr, &_address.bytes[IPADDRESS_V4_BYTES_INDEX], sizeof(uint32_t)) == 0; +} + +uint8_t IPAddress::operator[](int index) const { + if (_type == IPv4) { + return _address.bytes[IPADDRESS_V4_BYTES_INDEX + index]; + } + return _address.bytes[index]; +} + +uint8_t& IPAddress::operator[](int index) { + if (_type == IPv4) { + return _address.bytes[IPADDRESS_V4_BYTES_INDEX + index]; + } + return _address.bytes[index]; +} + +size_t IPAddress::printTo(Print& p) const +{ + return printTo(p, false); +} + +size_t IPAddress::printTo(Print& p, bool includeZone) const +{ + size_t n = 0; + + if (_type == IPv6) { + // IPv6 IETF canonical format: compress left-most longest run of two or more zero fields, lower case + int8_t longest_start = -1; + int8_t longest_length = 1; + int8_t current_start = -1; + int8_t current_length = 0; + for (int8_t f = 0; f < 8; f++) { + if (_address.bytes[f * 2] == 0 && _address.bytes[f * 2 + 1] == 0) { + if (current_start == -1) { + current_start = f; + current_length = 1; + } else { + current_length++; + } + if (current_length > longest_length) { + longest_start = current_start; + longest_length = current_length; + } + } else { + current_start = -1; + } + } + for (int f = 0; f < 8; f++) { + if (f < longest_start || f >= longest_start + longest_length) { + uint8_t c1 = _address.bytes[f * 2] >> 4; + uint8_t c2 = _address.bytes[f * 2] & 0xf; + uint8_t c3 = _address.bytes[f * 2 + 1] >> 4; + uint8_t c4 = _address.bytes[f * 2 + 1] & 0xf; + if (c1 > 0) { + n += p.print((char)(c1 < 10 ? '0' + c1 : 'a' + c1 - 10)); + } + if (c1 > 0 || c2 > 0) { + n += p.print((char)(c2 < 10 ? '0' + c2 : 'a' + c2 - 10)); + } + if (c1 > 0 || c2 > 0 || c3 > 0) { + n += p.print((char)(c3 < 10 ? '0' + c3 : 'a' + c3 - 10)); + } + n += p.print((char)(c4 < 10 ? '0' + c4 : 'a' + c4 - 10)); + if (f < 7) { + n += p.print(':'); + } + } else if (f == longest_start) { + if (longest_start == 0) { + n += p.print(':'); + } + n += p.print(':'); + } + } + // add a zone if zone-id is non-zero + if(_zone > 0 && includeZone){ + n += p.print('%'); + char if_name[NETIF_NAMESIZE]; + netif_index_to_name(_zone, if_name); + n += p.print(if_name); + } + return n; + } + + // IPv4 + for (int i =0; i < 3; i++) + { + n += p.print(_address.bytes[IPADDRESS_V4_BYTES_INDEX + i], DEC); + n += p.print('.'); + } + n += p.print(_address.bytes[IPADDRESS_V4_BYTES_INDEX + 3], DEC); + return n; +} + +IPAddress::IPAddress(const ip_addr_t *addr){ + from_ip_addr_t(addr); +} + +void IPAddress::to_ip_addr_t(ip_addr_t* addr) const { + if(_type == IPv6){ + addr->type = IPADDR_TYPE_V6; + addr->u_addr.ip6.addr[0] = _address.dword[0]; + addr->u_addr.ip6.addr[1] = _address.dword[1]; + addr->u_addr.ip6.addr[2] = _address.dword[2]; + addr->u_addr.ip6.addr[3] = _address.dword[3]; +#if LWIP_IPV6_SCOPES + addr->u_addr.ip6.zone = _zone; +#endif /* LWIP_IPV6_SCOPES */ + } else { + addr->type = IPADDR_TYPE_V4; + addr->u_addr.ip4.addr = _address.dword[IPADDRESS_V4_DWORD_INDEX]; + } +} + +IPAddress& IPAddress::from_ip_addr_t(const ip_addr_t* addr){ + if(addr->type == IPADDR_TYPE_V6){ + _type = IPv6; + _address.dword[0] = addr->u_addr.ip6.addr[0]; + _address.dword[1] = addr->u_addr.ip6.addr[1]; + _address.dword[2] = addr->u_addr.ip6.addr[2]; + _address.dword[3] = addr->u_addr.ip6.addr[3]; +#if LWIP_IPV6_SCOPES + _zone = addr->u_addr.ip6.zone; +#endif /* LWIP_IPV6_SCOPES */ + } else { + _type = IPv4; + _address.dword[IPADDRESS_V4_DWORD_INDEX] = addr->u_addr.ip4.addr; + } + return *this; +} + +esp_ip6_addr_type_t IPAddress::addr_type() const { + if(_type != IPv6){ + return ESP_IP6_ADDR_IS_UNKNOWN; + } + ip_addr_t addr; + to_ip_addr_t(&addr); + return esp_netif_ip6_get_addr_type((esp_ip6_addr_t*)(&(addr.u_addr.ip6))); +} + +const IPAddress IN6ADDR_ANY(IPv6); +const IPAddress INADDR_NONE(0,0,0,0); diff --git a/cores/esp32/IPAddress.h b/cores/esp32/IPAddress.h index 3bedd4f8749..0a3efd01c8d 100644 --- a/cores/esp32/IPAddress.h +++ b/cores/esp32/IPAddress.h @@ -1,96 +1,119 @@ /* - IPAddress.h - Base class that provides IPAddress - Copyright (c) 2011 Adrian McEwen. All right reserved. + IPAddress.h - Base class that provides IPAddress + Copyright (c) 2011 Adrian McEwen. All right reserved. - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ -#ifndef IPAddress_h -#define IPAddress_h +#pragma once #include -#include -#include +#include "Printable.h" +#include "WString.h" +#include "lwip/ip_addr.h" +#include "esp_netif_ip_addr.h" + +#define IPADDRESS_V4_BYTES_INDEX 12 +#define IPADDRESS_V4_DWORD_INDEX 3 // A class to make it easier to handle and pass around IP addresses -class IPAddress: public Printable -{ +enum IPType { + IPv4, + IPv6 +}; + +class IPAddress : public Printable { private: union { - uint8_t bytes[4]; // IPv4 address - uint32_t dword; + uint8_t bytes[16]; + uint32_t dword[4]; } _address; + IPType _type; + uint8_t _zone; // Access the raw byte array containing the address. Because this returns a pointer // to the internal structure rather than a copy of the address this function should only // be used when you know that the usage of the returned uint8_t* will be transient and not // stored. - uint8_t* raw_address() - { - return _address.bytes; - } + uint8_t* raw_address() { return _type == IPv4 ? &_address.bytes[IPADDRESS_V4_BYTES_INDEX] : _address.bytes; } public: // Constructors + + // Default IPv4 IPAddress(); + IPAddress(IPType ip_type); IPAddress(uint8_t first_octet, uint8_t second_octet, uint8_t third_octet, uint8_t fourth_octet); + IPAddress(uint8_t o1, uint8_t o2, uint8_t o3, uint8_t o4, uint8_t o5, uint8_t o6, uint8_t o7, uint8_t o8, uint8_t o9, uint8_t o10, uint8_t o11, uint8_t o12, uint8_t o13, uint8_t o14, uint8_t o15, uint8_t o16, uint8_t z=0); + // IPv4; see implementation note IPAddress(uint32_t address); + // Default IPv4 IPAddress(const uint8_t *address); - virtual ~IPAddress() {} + IPAddress(IPType ip_type, const uint8_t *address, uint8_t z=0); + // If IPv4 fails tries IPv6 see fromString function + IPAddress(const char *address); + IPAddress(const IPAddress& address); bool fromString(const char *address); bool fromString(const String &address) { return fromString(address.c_str()); } - // Overloaded cast operator to allow IPAddress objects to be used where a pointer - // to a four-byte uint8_t array is expected - operator uint32_t() const - { - return _address.dword; - } - bool operator==(const IPAddress& addr) const - { - return _address.dword == addr._address.dword; - } + // Overloaded cast operator to allow IPAddress objects to be used where a uint32_t is expected + // NOTE: IPv4 only; see implementation note + operator uint32_t() const { return _type == IPv4 ? _address.dword[IPADDRESS_V4_DWORD_INDEX] : 0; }; + + bool operator==(const IPAddress& addr) const; + bool operator!=(const IPAddress& addr) const { return !(*this == addr); }; + + // NOTE: IPv4 only; we don't know the length of the pointer bool operator==(const uint8_t* addr) const; // Overloaded index operator to allow getting and setting individual octets of the address - uint8_t operator[](int index) const - { - return _address.bytes[index]; - } - uint8_t& operator[](int index) - { - return _address.bytes[index]; - } + uint8_t operator[](int index) const; + uint8_t& operator[](int index); // Overloaded copy operators to allow initialisation of IPAddress objects from other types + // NOTE: IPv4 only IPAddress& operator=(const uint8_t *address); + // NOTE: IPv4 only; see implementation note IPAddress& operator=(uint32_t address); + // If IPv4 fails tries IPv6 see fromString function + IPAddress& operator=(const char *address); + IPAddress& operator=(const IPAddress& address); virtual size_t printTo(Print& p) const; - String toString() const; + String toString(bool includeZone = false) const; + + IPType type() const { return _type; } + + // Espresif LwIP conversions + IPAddress(const ip_addr_t *addr); + void to_ip_addr_t(ip_addr_t* addr) const; + IPAddress& from_ip_addr_t(const ip_addr_t* addr); + esp_ip6_addr_type_t addr_type() const; + uint8_t zone() const { return (type() == IPv6)?_zone:0; } + size_t printTo(Print& p, bool includeZone) const; - friend class EthernetClass; friend class UDP; friend class Client; friend class Server; - friend class DhcpClass; - friend class DNSClient; + +protected: + bool fromString4(const char *address); + bool fromString6(const char *address); }; -// changed to extern because const declaration creates copies in BSS of INADDR_NONE for each CPP unit that includes it -extern IPAddress INADDR_NONE; -#endif +extern const IPAddress IN6ADDR_ANY; +extern const IPAddress INADDR_NONE; diff --git a/cores/esp32/IPv6Address.cpp b/cores/esp32/IPv6Address.cpp deleted file mode 100644 index 7d3c0de5f53..00000000000 --- a/cores/esp32/IPv6Address.cpp +++ /dev/null @@ -1,90 +0,0 @@ -/* - IPv6Address.cpp - Base class that provides IPv6Address - Copyright (c) 2011 Adrian McEwen. All right reserved. - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include -#include -#include - -IPv6Address::IPv6Address() -{ - memset(_address.bytes, 0, sizeof(_address.bytes)); -} - -IPv6Address::IPv6Address(const uint8_t *address) -{ - memcpy(_address.bytes, address, sizeof(_address.bytes)); -} - -IPv6Address::IPv6Address(const uint32_t *address) -{ - memcpy(_address.bytes, (const uint8_t *)address, sizeof(_address.bytes)); -} - -IPv6Address& IPv6Address::operator=(const uint8_t *address) -{ - memcpy(_address.bytes, address, sizeof(_address.bytes)); - return *this; -} - -bool IPv6Address::operator==(const uint8_t* addr) const -{ - return memcmp(addr, _address.bytes, sizeof(_address.bytes)) == 0; -} - -size_t IPv6Address::printTo(Print& p) const -{ - size_t n = 0; - for(int i = 0; i < 16; i+=2) { - if(i){ - n += p.print(':'); - } - n += p.printf("%02x", _address.bytes[i]); - n += p.printf("%02x", _address.bytes[i+1]); - - } - return n; -} - -String IPv6Address::toString() const -{ - char szRet[40]; - sprintf(szRet,"%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x", - _address.bytes[0], _address.bytes[1], _address.bytes[2], _address.bytes[3], - _address.bytes[4], _address.bytes[5], _address.bytes[6], _address.bytes[7], - _address.bytes[8], _address.bytes[9], _address.bytes[10], _address.bytes[11], - _address.bytes[12], _address.bytes[13], _address.bytes[14], _address.bytes[15]); - return String(szRet); -} - -bool IPv6Address::fromString(const char *address) -{ - //format 0011:2233:4455:6677:8899:aabb:ccdd:eeff - if(strlen(address) != 39){ - return false; - } - char * pos = (char *)address; - size_t i = 0; - for(i = 0; i < 16; i+=2) { - if(!sscanf(pos, "%2hhx", &_address.bytes[i]) || !sscanf(pos+2, "%2hhx", &_address.bytes[i+1])){ - return false; - } - pos += 5; - } - return true; -} diff --git a/cores/esp32/IPv6Address.h b/cores/esp32/IPv6Address.h deleted file mode 100644 index e61d0e7b371..00000000000 --- a/cores/esp32/IPv6Address.h +++ /dev/null @@ -1,94 +0,0 @@ -/* - IPv6Address.h - Base class that provides IPv6Address - Copyright (c) 2011 Adrian McEwen. All right reserved. - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef IPv6Address_h -#define IPv6Address_h - -#include -#include -#include - -// A class to make it easier to handle and pass around IP addresses - -class IPv6Address: public Printable -{ -private: - union { - uint8_t bytes[16]; // IPv4 address - uint32_t dword[4]; - } _address; - - // Access the raw byte array containing the address. Because this returns a pointer - // to the internal structure rather than a copy of the address this function should only - // be used when you know that the usage of the returned uint8_t* will be transient and not - // stored. - uint8_t* raw_address() - { - return _address.bytes; - } - -public: - // Constructors - IPv6Address(); - IPv6Address(const uint8_t *address); - IPv6Address(const uint32_t *address); - virtual ~IPv6Address() {} - - bool fromString(const char *address); - bool fromString(const String &address) { return fromString(address.c_str()); } - - operator const uint8_t*() const - { - return _address.bytes; - } - operator const uint32_t*() const - { - return _address.dword; - } - bool operator==(const IPv6Address& addr) const - { - return (_address.dword[0] == addr._address.dword[0]) - && (_address.dword[1] == addr._address.dword[1]) - && (_address.dword[2] == addr._address.dword[2]) - && (_address.dword[3] == addr._address.dword[3]); - } - bool operator==(const uint8_t* addr) const; - - // Overloaded index operator to allow getting and setting individual octets of the address - uint8_t operator[](int index) const - { - return _address.bytes[index]; - } - uint8_t& operator[](int index) - { - return _address.bytes[index]; - } - - // Overloaded copy operators to allow initialisation of IPv6Address objects from other types - IPv6Address& operator=(const uint8_t *address); - - virtual size_t printTo(Print& p) const; - String toString() const; - - friend class UDP; - friend class Client; - friend class Server; -}; - -#endif diff --git a/cores/esp32/MD5Builder.cpp b/cores/esp32/MD5Builder.cpp index e242c3763b9..f27b2dc7846 100644 --- a/cores/esp32/MD5Builder.cpp +++ b/cores/esp32/MD5Builder.cpp @@ -16,39 +16,30 @@ License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ + #include +#include #include -static uint8_t hex_char_to_byte(uint8_t c) -{ - return (c >= 'a' && c <= 'f') ? (c - ((uint8_t)'a' - 0xa)) : - (c >= 'A' && c <= 'F') ? (c - ((uint8_t)'A' - 0xA)) : - (c >= '0' && c<= '9') ? (c - (uint8_t)'0') : 0; -} - void MD5Builder::begin(void) { memset(_buf, 0x00, ESP_ROM_MD5_DIGEST_LEN); esp_rom_md5_init(&_ctx); } -void MD5Builder::add(uint8_t * data, uint16_t len) +void MD5Builder::add(const uint8_t * data, size_t len) { esp_rom_md5_update(&_ctx, data, len); } void MD5Builder::addHexString(const char * data) { - uint16_t i, len = strlen(data); + size_t len = strlen(data); uint8_t * tmp = (uint8_t*)malloc(len/2); if(tmp == NULL) { return; } - for(i=0; i #include @@ -25,41 +27,27 @@ #include "esp_system.h" #include "esp_rom_md5.h" -class MD5Builder +#include "HashBuilder.h" + +class MD5Builder : public HashBuilder { private: md5_context_t _ctx; uint8_t _buf[ESP_ROM_MD5_DIGEST_LEN]; public: - void begin(void); - void add(uint8_t * data, uint16_t len); - void add(const char * data) - { - add((uint8_t*)data, strlen(data)); - } - void add(char * data) - { - add((const char*)data); - } - void add(String data) - { - add(data.c_str()); - } - void addHexString(const char * data); - void addHexString(char * data) - { - addHexString((const char*)data); - } - void addHexString(String data) - { - addHexString(data.c_str()); - } - bool addStream(Stream & stream, const size_t maxLen); - void calculate(void); - void getBytes(uint8_t * output); - void getChars(char * output); - String toString(void); -}; + void begin(void) override; + using HashBuilder::add; + void add(const uint8_t * data, size_t len) override; + + using HashBuilder::addHexString; + void addHexString(const char * data) override; + + bool addStream(Stream & stream, const size_t maxLen) override; + void calculate(void) override; + void getBytes(uint8_t * output) override; + void getChars(char * output) override; + String toString(void) override; +}; #endif diff --git a/cores/esp32/SHA1Builder.cpp b/cores/esp32/SHA1Builder.cpp new file mode 100644 index 00000000000..0f67d1086fd --- /dev/null +++ b/cores/esp32/SHA1Builder.cpp @@ -0,0 +1,367 @@ +/* + * FIPS-180-1 compliant SHA-1 implementation + * + * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved + * SPDX-License-Identifier: Apache-2.0 + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * This file is part of mbed TLS (https://tls.mbed.org) + * Modified for esp32 by Lucas Saavedra Vaz on 11 Jan 2024 + */ + +#include +#include + +// 32-bit integer manipulation macros (big endian) + +#ifndef GET_UINT32_BE +#define GET_UINT32_BE(n,b,i) \ +{ \ + (n) = ((uint32_t) (b)[(i) ] << 24) \ + | ((uint32_t) (b)[(i) + 1] << 16) \ + | ((uint32_t) (b)[(i) + 2] << 8) \ + | ((uint32_t) (b)[(i) + 3] ); \ +} +#endif + +#ifndef PUT_UINT32_BE +#define PUT_UINT32_BE(n,b,i) \ +{ \ + (b)[(i) ] = (uint8_t) ((n) >> 24); \ + (b)[(i) + 1] = (uint8_t) ((n) >> 16); \ + (b)[(i) + 2] = (uint8_t) ((n) >> 8); \ + (b)[(i) + 3] = (uint8_t) ((n) ); \ +} +#endif + +// Constants + +static const uint8_t sha1_padding[64] = +{ + 0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 +}; + +// Private methods + +void SHA1Builder::process(const uint8_t* data) +{ + uint32_t temp, W[16], A, B, C, D, E; + + GET_UINT32_BE(W[ 0], data, 0); + GET_UINT32_BE(W[ 1], data, 4); + GET_UINT32_BE(W[ 2], data, 8); + GET_UINT32_BE(W[ 3], data, 12); + GET_UINT32_BE(W[ 4], data, 16); + GET_UINT32_BE(W[ 5], data, 20); + GET_UINT32_BE(W[ 6], data, 24); + GET_UINT32_BE(W[ 7], data, 28); + GET_UINT32_BE(W[ 8], data, 32); + GET_UINT32_BE(W[ 9], data, 36); + GET_UINT32_BE(W[10], data, 40); + GET_UINT32_BE(W[11], data, 44); + GET_UINT32_BE(W[12], data, 48); + GET_UINT32_BE(W[13], data, 52); + GET_UINT32_BE(W[14], data, 56); + GET_UINT32_BE(W[15], data, 60); + +#define sha1_S(x,n) ((x << n) | ((x & 0xFFFFFFFF) >> (32 - n))) + +#define sha1_R(t) \ +( \ + temp = W[(t - 3) & 0x0F] ^ W[(t - 8) & 0x0F] ^ \ + W[(t - 14) & 0x0F] ^ W[ t & 0x0F], \ + (W[t & 0x0F] = sha1_S(temp,1)) \ +) + +#define sha1_P(a,b,c,d,e,x) \ +{ \ + e += sha1_S(a,5) + sha1_F(b,c,d) + sha1_K + x; b = sha1_S(b,30); \ +} + + A = state[0]; + B = state[1]; + C = state[2]; + D = state[3]; + E = state[4]; + +#define sha1_F(x,y,z) (z ^ (x & (y ^ z))) +#define sha1_K 0x5A827999 + + sha1_P(A, B, C, D, E, W[0]); + sha1_P(E, A, B, C, D, W[1]); + sha1_P(D, E, A, B, C, W[2]); + sha1_P(C, D, E, A, B, W[3]); + sha1_P(B, C, D, E, A, W[4]); + sha1_P(A, B, C, D, E, W[5]); + sha1_P(E, A, B, C, D, W[6]); + sha1_P(D, E, A, B, C, W[7]); + sha1_P(C, D, E, A, B, W[8]); + sha1_P(B, C, D, E, A, W[9]); + sha1_P(A, B, C, D, E, W[10]); + sha1_P(E, A, B, C, D, W[11]); + sha1_P(D, E, A, B, C, W[12]); + sha1_P(C, D, E, A, B, W[13]); + sha1_P(B, C, D, E, A, W[14]); + sha1_P(A, B, C, D, E, W[15]); + sha1_P(E, A, B, C, D, sha1_R(16)); + sha1_P(D, E, A, B, C, sha1_R(17)); + sha1_P(C, D, E, A, B, sha1_R(18)); + sha1_P(B, C, D, E, A, sha1_R(19)); + +#undef sha1_K +#undef sha1_F + +#define sha1_F(x,y,z) (x ^ y ^ z) +#define sha1_K 0x6ED9EBA1 + + sha1_P(A, B, C, D, E, sha1_R(20)); + sha1_P(E, A, B, C, D, sha1_R(21)); + sha1_P(D, E, A, B, C, sha1_R(22)); + sha1_P(C, D, E, A, B, sha1_R(23)); + sha1_P(B, C, D, E, A, sha1_R(24)); + sha1_P(A, B, C, D, E, sha1_R(25)); + sha1_P(E, A, B, C, D, sha1_R(26)); + sha1_P(D, E, A, B, C, sha1_R(27)); + sha1_P(C, D, E, A, B, sha1_R(28)); + sha1_P(B, C, D, E, A, sha1_R(29)); + sha1_P(A, B, C, D, E, sha1_R(30)); + sha1_P(E, A, B, C, D, sha1_R(31)); + sha1_P(D, E, A, B, C, sha1_R(32)); + sha1_P(C, D, E, A, B, sha1_R(33)); + sha1_P(B, C, D, E, A, sha1_R(34)); + sha1_P(A, B, C, D, E, sha1_R(35)); + sha1_P(E, A, B, C, D, sha1_R(36)); + sha1_P(D, E, A, B, C, sha1_R(37)); + sha1_P(C, D, E, A, B, sha1_R(38)); + sha1_P(B, C, D, E, A, sha1_R(39)); + +#undef sha1_K +#undef sha1_F + +#define sha1_F(x,y,z) ((x & y) | (z & (x | y))) +#define sha1_K 0x8F1BBCDC + + sha1_P(A, B, C, D, E, sha1_R(40)); + sha1_P(E, A, B, C, D, sha1_R(41)); + sha1_P(D, E, A, B, C, sha1_R(42)); + sha1_P(C, D, E, A, B, sha1_R(43)); + sha1_P(B, C, D, E, A, sha1_R(44)); + sha1_P(A, B, C, D, E, sha1_R(45)); + sha1_P(E, A, B, C, D, sha1_R(46)); + sha1_P(D, E, A, B, C, sha1_R(47)); + sha1_P(C, D, E, A, B, sha1_R(48)); + sha1_P(B, C, D, E, A, sha1_R(49)); + sha1_P(A, B, C, D, E, sha1_R(50)); + sha1_P(E, A, B, C, D, sha1_R(51)); + sha1_P(D, E, A, B, C, sha1_R(52)); + sha1_P(C, D, E, A, B, sha1_R(53)); + sha1_P(B, C, D, E, A, sha1_R(54)); + sha1_P(A, B, C, D, E, sha1_R(55)); + sha1_P(E, A, B, C, D, sha1_R(56)); + sha1_P(D, E, A, B, C, sha1_R(57)); + sha1_P(C, D, E, A, B, sha1_R(58)); + sha1_P(B, C, D, E, A, sha1_R(59)); + +#undef sha1_K +#undef sha1_F + +#define sha1_F(x,y,z) (x ^ y ^ z) +#define sha1_K 0xCA62C1D6 + + sha1_P(A, B, C, D, E, sha1_R(60)); + sha1_P(E, A, B, C, D, sha1_R(61)); + sha1_P(D, E, A, B, C, sha1_R(62)); + sha1_P(C, D, E, A, B, sha1_R(63)); + sha1_P(B, C, D, E, A, sha1_R(64)); + sha1_P(A, B, C, D, E, sha1_R(65)); + sha1_P(E, A, B, C, D, sha1_R(66)); + sha1_P(D, E, A, B, C, sha1_R(67)); + sha1_P(C, D, E, A, B, sha1_R(68)); + sha1_P(B, C, D, E, A, sha1_R(69)); + sha1_P(A, B, C, D, E, sha1_R(70)); + sha1_P(E, A, B, C, D, sha1_R(71)); + sha1_P(D, E, A, B, C, sha1_R(72)); + sha1_P(C, D, E, A, B, sha1_R(73)); + sha1_P(B, C, D, E, A, sha1_R(74)); + sha1_P(A, B, C, D, E, sha1_R(75)); + sha1_P(E, A, B, C, D, sha1_R(76)); + sha1_P(D, E, A, B, C, sha1_R(77)); + sha1_P(C, D, E, A, B, sha1_R(78)); + sha1_P(B, C, D, E, A, sha1_R(79)); + +#undef sha1_K +#undef sha1_F + + state[0] += A; + state[1] += B; + state[2] += C; + state[3] += D; + state[4] += E; +} + +// Public methods + +void SHA1Builder::begin(void) +{ + total[0] = 0; + total[1] = 0; + + state[0] = 0x67452301; + state[1] = 0xEFCDAB89; + state[2] = 0x98BADCFE; + state[3] = 0x10325476; + state[4] = 0xC3D2E1F0; + + memset(buffer, 0x00, sizeof(buffer)); + memset(hash, 0x00, sizeof(hash)); +} + +void SHA1Builder::add(const uint8_t* data, size_t len) +{ + size_t fill; + uint32_t left; + + if(len == 0) + { + return; + } + + left = total[0] & 0x3F; + fill = 64 - left; + + total[0] += (uint32_t) len; + total[0] &= 0xFFFFFFFF; + + if(total[0] < (uint32_t) len) + { + total[1]++; + } + + if(left && len >= fill) + { + memcpy((void *) (buffer + left), data, fill); + process(buffer); + data += fill; + len -= fill; + left = 0; + } + + while(len >= 64) + { + process(data); + data += 64; + len -= 64; + } + + if(len > 0) { + memcpy((void *) (buffer + left), data, len); + } +} + +void SHA1Builder::addHexString(const char * data) +{ + uint16_t len = strlen(data); + uint8_t * tmp = (uint8_t*)malloc(len/2); + if(tmp == NULL) { + return; + } + hex2bytes(tmp, len/2, data); + add(tmp, len/2); + free(tmp); +} + +bool SHA1Builder::addStream(Stream & stream, const size_t maxLen) +{ + const int buf_size = 512; + int maxLengthLeft = maxLen; + uint8_t * buf = (uint8_t*) malloc(buf_size); + + if(!buf) { + return false; + } + + int bytesAvailable = stream.available(); + while((bytesAvailable > 0) && (maxLengthLeft > 0)) { + + // determine number of bytes to read + int readBytes = bytesAvailable; + if(readBytes > maxLengthLeft) { + readBytes = maxLengthLeft ; // read only until max_len + } + if(readBytes > buf_size) { + readBytes = buf_size; // not read more the buffer can handle + } + + // read data and check if we got something + int numBytesRead = stream.readBytes(buf, readBytes); + if(numBytesRead< 1) { + free(buf); + return false; + } + + // Update SHA1 with buffer payload + add(buf, numBytesRead); + + // update available number of bytes + maxLengthLeft -= numBytesRead; + bytesAvailable = stream.available(); + } + free(buf); + return true; +} + +void SHA1Builder::calculate(void) +{ + uint32_t last, padn; + uint32_t high, low; + uint8_t msglen[8]; + + high = (total[0] >> 29) | (total[1] << 3); + low = (total[0] << 3); + + PUT_UINT32_BE(high, msglen, 0); + PUT_UINT32_BE(low, msglen, 4); + + last = total[0] & 0x3F; + padn = (last < 56) ? (56 - last) : (120 - last); + + add((uint8_t*)sha1_padding, padn); + add(msglen, 8); + + PUT_UINT32_BE(state[0], hash, 0); + PUT_UINT32_BE(state[1], hash, 4); + PUT_UINT32_BE(state[2], hash, 8); + PUT_UINT32_BE(state[3], hash, 12); + PUT_UINT32_BE(state[4], hash, 16); +} + +void SHA1Builder::getBytes(uint8_t * output) +{ + memcpy(output, hash, SHA1_HASH_SIZE); +} + +void SHA1Builder::getChars(char * output) +{ + bytes2hex(output, SHA1_HASH_SIZE*2+1, hash, SHA1_HASH_SIZE); +} + +String SHA1Builder::toString(void) +{ + char out[(SHA1_HASH_SIZE * 2) + 1]; + getChars(out); + return String(out); +} diff --git a/cores/esp32/SHA1Builder.h b/cores/esp32/SHA1Builder.h new file mode 100644 index 00000000000..2ab876f6411 --- /dev/null +++ b/cores/esp32/SHA1Builder.h @@ -0,0 +1,51 @@ +// Copyright 2024 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#ifndef SHA1Builder_h +#define SHA1Builder_h + +#include +#include + +#include "HashBuilder.h" + +#define SHA1_HASH_SIZE 20 + +class SHA1Builder : public HashBuilder +{ +private: + uint32_t total[2]; /* number of bytes processed */ + uint32_t state[5]; /* intermediate digest state */ + unsigned char buffer[64]; /* data block being processed */ + uint8_t hash[SHA1_HASH_SIZE]; /* SHA-1 result */ + + void process(const uint8_t* data); + +public: + void begin() override; + + using HashBuilder::add; + void add(const uint8_t* data, size_t len) override; + + using HashBuilder::addHexString; + void addHexString(const char* data) override; + + bool addStream(Stream& stream, const size_t maxLen) override; + void calculate() override; + void getBytes(uint8_t* output) override; + void getChars(char* output) override; + String toString() override; +}; + +#endif diff --git a/cores/esp32/StreamString.h b/cores/esp32/StreamString.h index dbdf3fb0097..fa983786c70 100644 --- a/cores/esp32/StreamString.h +++ b/cores/esp32/StreamString.h @@ -21,7 +21,8 @@ #ifndef STREAMSTRING_H_ #define STREAMSTRING_H_ - +#include "Stream.h" +#include "WString.h" class StreamString: public Stream, public String { diff --git a/cores/esp32/Tone.cpp b/cores/esp32/Tone.cpp index 77a254cd1d1..772b2b6bba1 100644 --- a/cores/esp32/Tone.cpp +++ b/cores/esp32/Tone.cpp @@ -95,6 +95,7 @@ void noTone(uint8_t pin){ .frequency = 0, // Ignored .duration = 0, // Ignored }; + xQueueReset(_tone_queue); // clear queue xQueueSend(_tone_queue, &tone_msg, portMAX_DELAY); } } diff --git a/cores/esp32/USBCDC.cpp b/cores/esp32/USBCDC.cpp index da0d5587af6..c99659dadac 100644 --- a/cores/esp32/USBCDC.cpp +++ b/cores/esp32/USBCDC.cpp @@ -79,7 +79,7 @@ void tud_cdc_tx_complete_cb(uint8_t itf){ static void ARDUINO_ISR_ATTR cdc0_write_char(char c){ if(devices[0] != NULL){ - devices[0]->write(c); + tud_cdc_n_write_char(0, c); } } diff --git a/cores/esp32/WString.cpp b/cores/esp32/WString.cpp index 6f0a4fc68a8..990a2824a51 100644 --- a/cores/esp32/WString.cpp +++ b/cores/esp32/WString.cpp @@ -677,7 +677,10 @@ int String::lastIndexOf(char ch, unsigned int fromIndex) const { wbuffer()[fromIndex + 1] = tempchar; if(temp == NULL) return -1; - return temp - buffer(); + const int rv = temp - buffer(); + if(rv >= len()) + return -1; + return rv; } int String::lastIndexOf(const String &s2) const { diff --git a/cores/esp32/cbuf.cpp b/cores/esp32/cbuf.cpp index ef7370a8a07..4a110fd732a 100644 --- a/cores/esp32/cbuf.cpp +++ b/cores/esp32/cbuf.cpp @@ -19,178 +19,272 @@ */ #include "cbuf.h" +#include "esp32-hal-log.h" + +#if CONFIG_DISABLE_HAL_LOCKS +#define CBUF_MUTEX_CREATE() +#define CBUF_MUTEX_LOCK() +#define CBUF_MUTEX_UNLOCK() +#define CBUF_MUTEX_DELETE() +#else +#define CBUF_MUTEX_CREATE() if(_lock == NULL){_lock = xSemaphoreCreateMutex(); if(_lock == NULL){log_e("failed to create mutex");}} +#define CBUF_MUTEX_LOCK() if(_lock != NULL){xSemaphoreTakeRecursive(_lock, portMAX_DELAY);} +#define CBUF_MUTEX_UNLOCK() if(_lock != NULL){xSemaphoreGiveRecursive(_lock);} +#define CBUF_MUTEX_DELETE() if(_lock != NULL){SemaphoreHandle_t l = _lock; _lock = NULL; vSemaphoreDelete(l);} +#endif cbuf::cbuf(size_t size) : - next(NULL), _size(size+1), _buf(new char[size+1]), _bufend(_buf + size + 1), _begin(_buf), _end(_begin) + next(NULL), + has_peek(false), + peek_byte(0), + _buf(xRingbufferCreate(size, RINGBUF_TYPE_BYTEBUF)) { + if(_buf == NULL) { + log_e("failed to allocate ring buffer"); + } + CBUF_MUTEX_CREATE(); } cbuf::~cbuf() { - delete[] _buf; + CBUF_MUTEX_LOCK(); + if(_buf != NULL){ + RingbufHandle_t b = _buf; + _buf = NULL; + vRingbufferDelete(b); + } + CBUF_MUTEX_UNLOCK(); + CBUF_MUTEX_DELETE(); } size_t cbuf::resizeAdd(size_t addSize) { - return resize(_size + addSize); + return resize(size() + addSize); } size_t cbuf::resize(size_t newSize) { + CBUF_MUTEX_LOCK(); + size_t _size = size(); + if(newSize == _size) { + return _size; + } - size_t bytes_available = available(); - newSize += 1; // not lose any data // if data can be lost use remove or flush before resize - if((newSize < bytes_available) || (newSize == _size)) { + size_t bytes_available = available(); + if(newSize < bytes_available) { + CBUF_MUTEX_UNLOCK(); + log_e("new size is less than the currently available data size"); return _size; } - char *newbuf = new char[newSize]; - char *oldbuf = _buf; - - if(!newbuf) { + RingbufHandle_t newbuf = xRingbufferCreate(newSize, RINGBUF_TYPE_BYTEBUF); + if(newbuf == NULL) { + CBUF_MUTEX_UNLOCK(); + log_e("failed to allocate new ring buffer"); return _size; } - if(_buf) { - read(newbuf, bytes_available); - memset((newbuf + bytes_available), 0x00, (newSize - bytes_available)); + if(_buf != NULL) { + if(bytes_available){ + char * old_data = (char *)malloc(bytes_available); + if(old_data == NULL){ + vRingbufferDelete(newbuf); + CBUF_MUTEX_UNLOCK(); + log_e("failed to allocate temporary buffer"); + return _size; + } + bytes_available = read(old_data, bytes_available); + if(!bytes_available){ + free(old_data); + vRingbufferDelete(newbuf); + CBUF_MUTEX_UNLOCK(); + log_e("failed to read previous data"); + return _size; + } + if(xRingbufferSend(newbuf, (void*)old_data, bytes_available, 0) != pdTRUE){ + write(old_data, bytes_available); + free(old_data); + vRingbufferDelete(newbuf); + CBUF_MUTEX_UNLOCK(); + log_e("failed to restore previous data"); + return _size; + } + free(old_data); + } + + RingbufHandle_t b = _buf; + _buf = newbuf; + vRingbufferDelete(b); + } else { + _buf = newbuf; } - - _begin = newbuf; - _end = newbuf + bytes_available; - _bufend = newbuf + newSize; - _size = newSize; - - _buf = newbuf; - delete[] oldbuf; - - return _size; + CBUF_MUTEX_UNLOCK(); + return newSize; } size_t cbuf::available() const { - if(_end >= _begin) { - return _end - _begin; + size_t available = 0; + if(_buf != NULL){ + vRingbufferGetInfo(_buf, NULL, NULL, NULL, NULL, (UBaseType_t *)&available); } - return _size - (_begin - _end); + if (has_peek) available++; + return available; } size_t cbuf::size() { + size_t _size = 0; + if(_buf != NULL){ + _size = xRingbufferGetMaxItemSize(_buf); + } return _size; } size_t cbuf::room() const { - if(_end >= _begin) { - return _size - (_end - _begin) - 1; + size_t _room = 0; + if(_buf != NULL){ + _room = xRingbufferGetCurFreeSize(_buf); } - return _begin - _end - 1; + return _room; +} + +bool cbuf::empty() const +{ + return available() == 0; +} + +bool cbuf::full() const +{ + return room() == 0; } int cbuf::peek() { - if(empty()) { + if (!available()) { return -1; } - return static_cast(*_begin); -} + int c; -size_t cbuf::peek(char *dst, size_t size) -{ - size_t bytes_available = available(); - size_t size_to_read = (size < bytes_available) ? size : bytes_available; - size_t size_read = size_to_read; - char * begin = _begin; - if(_end < _begin && size_to_read > (size_t) (_bufend - _begin)) { - size_t top_size = _bufend - _begin; - memcpy(dst, _begin, top_size); - begin = _buf; - size_to_read -= top_size; - dst += top_size; - } - memcpy(dst, begin, size_to_read); - return size_read; + CBUF_MUTEX_LOCK(); + if (has_peek) { + c = peek_byte; + } else { + c = read(); + if (c >= 0) { + has_peek = true; + peek_byte = c; + } + } + CBUF_MUTEX_UNLOCK(); + return c; } int cbuf::read() { - if(empty()) { + char result = 0; + if(!read(&result, 1)){ return -1; } - - char result = *_begin; - _begin = wrap_if_bufend(_begin + 1); return static_cast(result); } size_t cbuf::read(char* dst, size_t size) { + CBUF_MUTEX_LOCK(); size_t bytes_available = available(); - size_t size_to_read = (size < bytes_available) ? size : bytes_available; - size_t size_read = size_to_read; - if(_end < _begin && size_to_read > (size_t) (_bufend - _begin)) { - size_t top_size = _bufend - _begin; - memcpy(dst, _begin, top_size); - _begin = _buf; - size_to_read -= top_size; - dst += top_size; - } - memcpy(dst, _begin, size_to_read); - _begin = wrap_if_bufend(_begin + size_to_read); + if(!bytes_available || !size){ + CBUF_MUTEX_UNLOCK(); + return 0; + } + + if (has_peek) { + if (dst != NULL) { + *dst++ = peek_byte; + } + size--; + } + + size_t size_read = 0; + if (size) { + size_t received_size = 0; + size_t size_to_read = (size < bytes_available) ? size : bytes_available; + uint8_t *received_buff = (uint8_t *)xRingbufferReceiveUpTo(_buf, &received_size, 0, size_to_read); + if (received_buff != NULL) { + if(dst != NULL){ + memcpy(dst, received_buff, received_size); + } + vRingbufferReturnItem(_buf, received_buff); + size_read = received_size; + size_to_read -= received_size; + // wrap around data + if(size_to_read){ + received_size = 0; + received_buff = (uint8_t *)xRingbufferReceiveUpTo(_buf, &received_size, 0, size_to_read); + if (received_buff != NULL) { + if(dst != NULL){ + memcpy(dst+size_read, received_buff, received_size); + } + vRingbufferReturnItem(_buf, received_buff); + size_read += received_size; + } else { + log_e("failed to read wrap around data from ring buffer"); + } + } + } else { + log_e("failed to read from ring buffer"); + } + } + + if (has_peek) { + has_peek = false; + size_read++; + } + + CBUF_MUTEX_UNLOCK(); return size_read; } size_t cbuf::write(char c) { - if(full()) { - return 0; - } - - *_end = c; - _end = wrap_if_bufend(_end + 1); - return 1; + return write(&c, 1); } size_t cbuf::write(const char* src, size_t size) { + CBUF_MUTEX_LOCK(); size_t bytes_available = room(); + if(!bytes_available || !size){ + CBUF_MUTEX_UNLOCK(); + return 0; + } size_t size_to_write = (size < bytes_available) ? size : bytes_available; - size_t size_written = size_to_write; - if(_end >= _begin && size_to_write > (size_t) (_bufend - _end)) { - size_t top_size = _bufend - _end; - memcpy(_end, src, top_size); - _end = _buf; - size_to_write -= top_size; - src += top_size; + if(xRingbufferSend(_buf, (void*)src, size_to_write, 0) != pdTRUE){ + CBUF_MUTEX_UNLOCK(); + log_e("failed to write to ring buffer"); + return 0; } - memcpy(_end, src, size_to_write); - _end = wrap_if_bufend(_end + size_to_write); - return size_written; + CBUF_MUTEX_UNLOCK(); + return size_to_write; } void cbuf::flush() { - _begin = _buf; - _end = _buf; + read(NULL, available()); } size_t cbuf::remove(size_t size) { + CBUF_MUTEX_LOCK(); size_t bytes_available = available(); - if(size >= bytes_available) { - flush(); - return 0; - } - size_t size_to_remove = (size < bytes_available) ? size : bytes_available; - if(_end < _begin && size_to_remove > (size_t) (_bufend - _begin)) { - size_t top_size = _bufend - _begin; - _begin = _buf; - size_to_remove -= top_size; + if(bytes_available && size){ + size_t size_to_remove = (size < bytes_available) ? size : bytes_available; + bytes_available -= read(NULL, size_to_remove); } - _begin = wrap_if_bufend(_begin + size_to_remove); - return available(); + CBUF_MUTEX_UNLOCK(); + return bytes_available; } diff --git a/cores/esp32/cbuf.h b/cores/esp32/cbuf.h index 490352e3202..29e11efb83e 100644 --- a/cores/esp32/cbuf.h +++ b/cores/esp32/cbuf.h @@ -18,12 +18,15 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#ifndef __cbuf_h -#define __cbuf_h +#pragma once #include #include #include +#include "sdkconfig.h" +#include "freertos/FreeRTOS.h" +#include "freertos/ringbuf.h" +#include "freertos/semphr.h" class cbuf { @@ -33,23 +36,14 @@ class cbuf size_t resizeAdd(size_t addSize); size_t resize(size_t newSize); + size_t available() const; size_t size(); - size_t room() const; - - inline bool empty() const - { - return _begin == _end; - } - - inline bool full() const - { - return wrap_if_bufend(_end + 1) == _begin; - } + bool empty() const; + bool full() const; int peek(); - size_t peek(char *dst, size_t size); int read(); size_t read(char* dst, size_t size); @@ -61,19 +55,13 @@ class cbuf size_t remove(size_t size); cbuf *next; + bool has_peek; + uint8_t peek_byte; protected: - inline char* wrap_if_bufend(char* ptr) const - { - return (ptr == _bufend) ? _buf : ptr; - } - - size_t _size; - char* _buf; - const char* _bufend; - char* _begin; - char* _end; + RingbufHandle_t _buf = NULL; +#if !CONFIG_DISABLE_HAL_LOCKS + SemaphoreHandle_t _lock = NULL; +#endif }; - -#endif//__cbuf_h diff --git a/cores/esp32/esp32-hal-gpio.c b/cores/esp32/esp32-hal-gpio.c index 456f12c833e..df0e6a29984 100644 --- a/cores/esp32/esp32-hal-gpio.c +++ b/cores/esp32/esp32-hal-gpio.c @@ -104,14 +104,14 @@ extern void ARDUINO_ISR_ATTR __pinMode(uint8_t pin, uint8_t mode) #endif if (pin >= SOC_GPIO_PIN_COUNT) { - log_e("Invalid pin selected"); + log_e("Invalid IO %i selected", pin); return; } if(perimanGetPinBus(pin, ESP32_BUS_TYPE_GPIO) == NULL){ perimanSetBusDeinit(ESP32_BUS_TYPE_GPIO, gpioDetachBus); if(!perimanClearPinBus(pin)){ - log_e("Deinit of previous bus failed"); + log_e("Deinit of previous bus from IO %i failed", pin); return; } } @@ -140,7 +140,7 @@ extern void ARDUINO_ISR_ATTR __pinMode(uint8_t pin, uint8_t mode) } if(gpio_config(&conf) != ESP_OK) { - log_e("GPIO config failed"); + log_e("IO %i config failed", pin); return; } if(perimanGetPinBus(pin, ESP32_BUS_TYPE_GPIO) == NULL){ @@ -164,7 +164,7 @@ extern void ARDUINO_ISR_ATTR __digitalWrite(uint8_t pin, uint8_t val) if(perimanGetPinBus(pin, ESP32_BUS_TYPE_GPIO) != NULL){ gpio_set_level((gpio_num_t)pin, val); } else { - log_e("Pin is not set as GPIO."); + log_e("IO %i is not set as GPIO.", pin); } } @@ -174,7 +174,7 @@ extern int ARDUINO_ISR_ATTR __digitalRead(uint8_t pin) return gpio_get_level((gpio_num_t)pin); } else { - log_e("Pin is not set as GPIO."); + log_e("IO %i is not set as GPIO.", pin); return 0; } } @@ -204,7 +204,7 @@ extern void __attachInterruptFunctionalArg(uint8_t pin, voidFuncPtrArg userFunc, interrupt_initialized = (err == ESP_OK) || (err == ESP_ERR_INVALID_STATE); } if(!interrupt_initialized) { - log_e("GPIO ISR Service Failed To Start"); + log_e("IO %i ISR Service Failed To Start", pin); return; } @@ -256,6 +256,14 @@ extern void __detachInterrupt(uint8_t pin) gpio_set_intr_type((gpio_num_t)pin, GPIO_INTR_DISABLE); } +extern void enableInterrupt(uint8_t pin) { + gpio_intr_enable((gpio_num_t)pin); +} + +extern void disableInterrupt(uint8_t pin) { + gpio_intr_disable((gpio_num_t)pin); +} + extern void pinMode(uint8_t pin, uint8_t mode) __attribute__ ((weak, alias("__pinMode"))); extern void digitalWrite(uint8_t pin, uint8_t val) __attribute__ ((weak, alias("__digitalWrite"))); diff --git a/cores/esp32/esp32-hal-gpio.h b/cores/esp32/esp32-hal-gpio.h index 69b55178d3f..a45302d9e99 100644 --- a/cores/esp32/esp32-hal-gpio.h +++ b/cores/esp32/esp32-hal-gpio.h @@ -78,6 +78,8 @@ int digitalRead(uint8_t pin); void attachInterrupt(uint8_t pin, void (*)(void), int mode); void attachInterruptArg(uint8_t pin, void (*)(void*), void * arg, int mode); void detachInterrupt(uint8_t pin); +void enableInterrupt(uint8_t pin); +void disableInterrupt(uint8_t pin); int8_t digitalPinToTouchChannel(uint8_t pin); int8_t digitalPinToAnalogChannel(uint8_t pin); diff --git a/cores/esp32/esp32-hal-i2c.c b/cores/esp32/esp32-hal-i2c.c index e70428ac5bc..b76fa963e81 100644 --- a/cores/esp32/esp32-hal-i2c.c +++ b/cores/esp32/esp32-hal-i2c.c @@ -42,9 +42,10 @@ typedef volatile struct { uint32_t frequency; #if !CONFIG_DISABLE_HAL_LOCKS SemaphoreHandle_t lock; +#endif int8_t scl; int8_t sda; -#endif + } i2c_bus_t; static i2c_bus_t bus[SOC_I2C_NUM]; diff --git a/cores/esp32/esp32-hal-ledc.c b/cores/esp32/esp32-hal-ledc.c index c96d1b0a650..76d522c2313 100644 --- a/cores/esp32/esp32-hal-ledc.c +++ b/cores/esp32/esp32-hal-ledc.c @@ -56,12 +56,11 @@ static bool ledcDetachBus(void * bus){ return true; } -bool ledcAttach(uint8_t pin, uint32_t freq, uint8_t resolution) +bool ledcAttachChannel(uint8_t pin, uint32_t freq, uint8_t resolution, uint8_t channel) { - int free_channel = ~ledc_handle.used_channels & (ledc_handle.used_channels+1); - if (free_channel == 0 || resolution > LEDC_MAX_BIT_WIDTH) + if (channel >= LEDC_CHANNELS || resolution > LEDC_MAX_BIT_WIDTH) { - log_e("No more LEDC channels available! (maximum %u) or bit width too big (maximum %u)", LEDC_CHANNELS, LEDC_MAX_BIT_WIDTH); + log_e("Channel %u is not available! (maximum %u) or bit width too big (maximum %u)", channel, LEDC_CHANNELS, LEDC_MAX_BIT_WIDTH); return false; } @@ -71,7 +70,6 @@ bool ledcAttach(uint8_t pin, uint32_t freq, uint8_t resolution) return false; } - int channel = log2(free_channel & -free_channel); uint8_t group=(channel/8), timer=((channel/2)%4); ledc_timer_config_t ledc_timer = { @@ -115,8 +113,22 @@ bool ledcAttach(uint8_t pin, uint32_t freq, uint8_t resolution) return false; } + log_i("LEDC attached to pin %u (channel %u, resolution %u)", pin, channel, resolution); return true; } + +bool ledcAttach(uint8_t pin, uint32_t freq, uint8_t resolution) +{ + uint8_t free_channel = ~ledc_handle.used_channels & (ledc_handle.used_channels+1); + if (free_channel == 0 || resolution > LEDC_MAX_BIT_WIDTH){ + log_e("No more LEDC channels available! (maximum %u) or bit width too big (maximum %u)", LEDC_CHANNELS, LEDC_MAX_BIT_WIDTH); + return false; + } + int channel = log2(free_channel & -free_channel); + + return ledcAttachChannel(pin, freq, resolution, channel); +} + bool ledcWrite(uint8_t pin, uint32_t duty) { ledc_channel_handle_t *bus = (ledc_channel_handle_t*)perimanGetPinBus(pin, ESP32_BUS_TYPE_LEDC); diff --git a/cores/esp32/esp32-hal-ledc.h b/cores/esp32/esp32-hal-ledc.h index ca172844247..2d2c42e9369 100644 --- a/cores/esp32/esp32-hal-ledc.h +++ b/cores/esp32/esp32-hal-ledc.h @@ -24,6 +24,8 @@ extern "C" { #include #include +#include "freertos/FreeRTOS.h" +#include "freertos/semphr.h" typedef enum { NOTE_C, NOTE_Cs, NOTE_D, NOTE_Eb, NOTE_E, NOTE_F, NOTE_Fs, NOTE_G, NOTE_Gs, NOTE_A, NOTE_Bb, NOTE_B, NOTE_MAX @@ -45,6 +47,7 @@ typedef struct { //channel 0-15 resolution 1-16bits freq limits depend on resolution bool ledcAttach(uint8_t pin, uint32_t freq, uint8_t resolution); +bool ledcAttachChannel(uint8_t pin, uint32_t freq, uint8_t resolution, uint8_t channel); bool ledcWrite(uint8_t pin, uint32_t duty); uint32_t ledcWriteTone(uint8_t pin, uint32_t freq); uint32_t ledcWriteNote(uint8_t pin, note_t note, uint8_t octave); diff --git a/cores/esp32/esp32-hal-periman.c b/cores/esp32/esp32-hal-periman.c index 5c9c3ceccbd..dd3a2f32a21 100644 --- a/cores/esp32/esp32-hal-periman.c +++ b/cores/esp32/esp32-hal-periman.c @@ -78,7 +78,7 @@ const char* perimanGetTypeName(peripheral_bus_type_t type) { case ESP32_BUS_TYPE_SPI_MASTER_SCK: return "SPI_MASTER_SCK"; case ESP32_BUS_TYPE_SPI_MASTER_MISO: return "SPI_MASTER_MISO"; case ESP32_BUS_TYPE_SPI_MASTER_MOSI: return "SPI_MASTER_MOSI"; - case ESP32_BUS_TYPE_SPI_MASTER_CS: return "SPI_MASTER_CS"; + case ESP32_BUS_TYPE_SPI_MASTER_SS: return "SPI_MASTER_SS"; #endif #if SOC_SDMMC_HOST_SUPPORTED case ESP32_BUS_TYPE_SDMMC_CLK: return "SDMMC_CLK"; diff --git a/cores/esp32/esp32-hal-periman.h b/cores/esp32/esp32-hal-periman.h index 42833b4bab1..aa3de699502 100644 --- a/cores/esp32/esp32-hal-periman.h +++ b/cores/esp32/esp32-hal-periman.h @@ -77,7 +77,7 @@ typedef enum { ESP32_BUS_TYPE_SPI_MASTER_SCK, // IO is used as SPI master SCK pin ESP32_BUS_TYPE_SPI_MASTER_MISO, // IO is used as SPI master MISO pin ESP32_BUS_TYPE_SPI_MASTER_MOSI, // IO is used as SPI master MOSI pin - ESP32_BUS_TYPE_SPI_MASTER_CS, // IO is used as SPI master CS pin + ESP32_BUS_TYPE_SPI_MASTER_SS, // IO is used as SPI master SS pin #endif #if SOC_SDMMC_HOST_SUPPORTED ESP32_BUS_TYPE_SDMMC_CLK, // IO is used as SDMMC CLK pin diff --git a/cores/esp32/esp32-hal-rmt.c b/cores/esp32/esp32-hal-rmt.c index 4d19d52638d..0755dc43ecd 100644 --- a/cores/esp32/esp32-hal-rmt.c +++ b/cores/esp32/esp32-hal-rmt.c @@ -61,6 +61,7 @@ struct rmt_obj_s { bool rmt_ch_is_looping; // Is this RMT TX Channel in LOOPING MODE? size_t *num_symbols_read; // Pointer to the number of RMT symbol read by IDF RMT RX Done uint32_t frequency_Hz; // RMT Frequency + uint8_t rmt_EOT_Level; // RMT End of Transmission Level - default is LOW #if !CONFIG_DISABLE_HAL_LOCKS SemaphoreHandle_t g_rmt_objlocks; // Channel Semaphore Lock @@ -185,6 +186,20 @@ static bool _rmtDetachBus(void *busptr) Public method definitions */ +bool rmtSetEOT(int pin, uint8_t EOT_Level) +{ + rmt_bus_handle_t bus = _rmtGetBus(pin, __FUNCTION__); + if (bus == NULL) { + return false; + } + if (!_rmtCheckDirection(pin, RMT_TX_MODE, __FUNCTION__)) { + return false; + } + + bus->rmt_EOT_Level = EOT_Level > 0 ? 1 : 0; + return true; +} + bool rmtSetCarrier(int pin, bool carrier_en, bool carrier_level, uint32_t frequency_Hz, float duty_percent) { rmt_bus_handle_t bus = _rmtGetBus(pin, __FUNCTION__); @@ -316,6 +331,10 @@ static bool _rmtWrite(int pin, rmt_data_t* data, size_t num_rmt_symbols, bool bl rmt_enable(bus->rmt_channel_h); bus->rmt_ch_is_looping = false; // not looping anymore } + // sets the End of Transmission level to HIGH if the user has requested so + if (bus->rmt_EOT_Level) { + transmit_cfg.flags.eot_level = 1; // EOT is HIGH + } if (loopCancel) { // just resets and releases the channel, maybe, already done above, then exits bus->rmt_ch_is_looping = false; @@ -487,7 +506,7 @@ bool rmtInit(int pin, rmt_ch_dir_t channel_direction, rmt_reserve_memsize_t mem_ // store the RMT Freq to check Filter and Idle valid values in the RMT API bus->frequency_Hz = frequency_Hz; // pulses with width smaller than min_ns will be ignored (as a glitch) - bus->signal_range_min_ns = 0; // disabled + //bus->signal_range_min_ns = 0; // disabled --> not necessary CALLOC set all to ZERO. // RMT stops reading if the input stays idle for longer than max_ns bus->signal_range_max_ns = (1000000000 / frequency_Hz) * RMT_LL_MAX_IDLE_VALUE; // maximum possible // creates the event group to control read_done and write_done diff --git a/cores/esp32/esp32-hal-rmt.h b/cores/esp32/esp32-hal-rmt.h index fedc75dba40..1b08fdae00d 100644 --- a/cores/esp32/esp32-hal-rmt.h +++ b/cores/esp32/esp32-hal-rmt.h @@ -76,6 +76,20 @@ typedef union { */ bool rmtInit(int pin, rmt_ch_dir_t channel_direction, rmt_reserve_memsize_t memsize, uint32_t frequency_Hz); +/** + Sets the End of Transmission level to be set for the when the RMT transmission ends. + This function affects how rmtWrite(), rmtWriteAsync() or rmtWriteLooping() will set the pin after writing the data. + The default EOT level is LOW, in case this function isn't used before RMT Writing. + This level can be set for each RMT pin and can be changed between writings to the same pin. + + shall be Zero (LOW) or non-zero (HIGH) value. + It only affects the transmission process, therefore, it doesn't affect any IDLE LEVEL before starting the RMT transmission. + The pre-transmission idle level can be set manually calling, for instance, digitalWrite(pin, Level). + + Returns when EOT has been correctly set for , otherwise. +*/ +bool rmtSetEOT(int pin, uint8_t EOT_Level); + /** Sending data in Blocking Mode. is a 32 bits structure as defined by rmt_data_t type. diff --git a/cores/esp32/esp32-hal-spi.c b/cores/esp32/esp32-hal-spi.c index 4388d0d60c9..26cb5c873ee 100644 --- a/cores/esp32/esp32-hal-spi.c +++ b/cores/esp32/esp32-hal-spi.c @@ -177,36 +177,65 @@ static spi_t _spi_bus_array[] = { static bool spiDetachBus(void * bus){ uint8_t spi_num = (int)bus - 1; spi_t * spi = &_spi_bus_array[spi_num]; - if(spi->dev->clock.val != 0){ - log_d("Stopping SPI BUS"); + + if(spi->dev->clock.val == 0){ + log_d("SPI bus already stopped"); + return true; + } + else if(spi->sck == -1 || (spi->miso == -1 && spi->mosi == -1)){ + log_d("Stopping SPI bus"); spiStopBus(spi); + + spiDetachSCK(spi); + spiDetachMISO(spi); + spiDetachMOSI(spi); + spiDetachSS(spi); + spi = NULL; + return true; } + return true; +} + +static bool spiDetachBus_SCK(void * bus){ + uint8_t spi_num = (int)bus - 1; + spi_t * spi = &_spi_bus_array[spi_num]; if(spi->sck != -1){ - log_d("SPI detach SCK pin %d",spi->sck); - spiDetachSCK(spi,spi->sck); + spiDetachSCK(spi); + spiDetachBus(bus); } + return true; +} + +static bool spiDetachBus_MISO(void * bus){ + uint8_t spi_num = (int)bus - 1; + spi_t * spi = &_spi_bus_array[spi_num]; if(spi->miso != -1){ - log_d("SPI detach MISO pin %d",spi->miso); - spiDetachMISO(spi,spi->miso); + spiDetachMISO(spi); + spiDetachBus(bus); } + return true; +} + +static bool spiDetachBus_MOSI(void * bus){ + uint8_t spi_num = (int)bus - 1; + spi_t * spi = &_spi_bus_array[spi_num]; if(spi->mosi != -1){ - log_d("SPI detach MOSI pin %d",spi->mosi); - spiDetachMOSI(spi,spi->mosi); + spiDetachMOSI(spi); + spiDetachBus(bus); } + return true; +} + +static bool spiDetachBus_SS(void * bus){ + uint8_t spi_num = (int)bus - 1; + spi_t * spi = &_spi_bus_array[spi_num]; if(spi->ss != -1){ - log_d("SPI detach SS pin %d",spi->ss); - spiDetachSS(spi,spi->ss); + spiDetachSS(spi); + spiDetachBus(bus); } - //set SPI to NULL, as all pins are already detached - if(spi->sck == -1 && spi->miso == -1 && spi->mosi == -1 && spi->ss == -1){ - log_d("Set spi handle to NULL"); - spi = NULL; - return true; - } - return false; + return true; } - bool spiAttachSCK(spi_t * spi, int8_t sck) { if(!spi || sck < 0) { @@ -220,7 +249,7 @@ bool spiAttachSCK(spi_t * spi, int8_t sck) pinMatrixOutAttach(sck, SPI_CLK_IDX(spi->num), false, false); spi->sck = sck; if(!perimanSetPinBus(sck, ESP32_BUS_TYPE_SPI_MASTER_SCK, (void *)(spi->num+1), spi->num, -1)){ - spiDetachBus((void *)(spi->num+1)); + spiDetachBus_SCK((void *)(spi->num+1)); log_e("Failed to set pin bus to SPI for pin %d", sck); return false; } @@ -236,13 +265,11 @@ bool spiAttachMISO(spi_t * spi, int8_t miso) if(bus != NULL && !perimanClearPinBus(miso)){ return false; } - SPI_MUTEX_LOCK(); pinMode(miso, INPUT); pinMatrixInAttach(miso, SPI_MISO_IDX(spi->num), false); spi->miso = miso; - SPI_MUTEX_UNLOCK(); if(!perimanSetPinBus(miso, ESP32_BUS_TYPE_SPI_MASTER_MISO, (void *)(spi->num+1), spi->num, -1)){ - spiDetachBus((void *)(spi->num+1)); + spiDetachBus_MISO((void *)(spi->num+1)); log_e("Failed to set pin bus to SPI for pin %d", miso); return false; } @@ -262,102 +289,114 @@ bool spiAttachMOSI(spi_t * spi, int8_t mosi) pinMatrixOutAttach(mosi, SPI_MOSI_IDX(spi->num), false, false); spi->mosi = mosi; if(!perimanSetPinBus(mosi, ESP32_BUS_TYPE_SPI_MASTER_MOSI, (void *)(spi->num+1), spi->num, -1)){ - spiDetachBus((void *)(spi->num+1)); + spiDetachBus_MOSI((void *)(spi->num+1)); log_e("Failed to set pin bus to SPI for pin %d", mosi); return false; } return true; } -bool spiDetachSCK(spi_t * spi, int8_t sck) +bool spiDetachSCK(spi_t * spi) { - if(!spi || sck < 0) { + if(!spi) { return false; } - pinMatrixOutDetach(sck, false, false); - spi->sck = -1; - perimanClearPinBus(sck); + int8_t sck = spi->sck; + if(sck != -1) { + pinMatrixOutDetach(sck, false, false); + spi->sck = -1; + perimanClearPinBus(sck); + } return true; } -bool spiDetachMISO(spi_t * spi, int8_t miso) +bool spiDetachMISO(spi_t * spi) { - if(!spi || miso < 0) { + if(!spi) { return false; } - pinMatrixInDetach(SPI_MISO_IDX(spi->num), false, false); - spi->miso = -1; - perimanClearPinBus(miso); + int8_t miso = spi->miso; + if(miso != -1) { + pinMatrixInDetach(SPI_MISO_IDX(spi->num), false, false); + spi->miso = -1; + perimanClearPinBus(miso); + } return true; } -bool spiDetachMOSI(spi_t * spi, int8_t mosi) +bool spiDetachMOSI(spi_t * spi) { - if(!spi || mosi < 0) { + if(!spi) { return false; } - pinMatrixOutDetach(mosi, false, false); - spi->mosi = -1; - perimanClearPinBus(mosi); + int8_t mosi = spi->mosi; + if(mosi != -1) { + pinMatrixOutDetach(mosi, false, false); + spi->mosi = -1; + perimanClearPinBus(mosi); + } return true; } -bool spiAttachSS(spi_t * spi, uint8_t cs_num, int8_t ss) +bool spiAttachSS(spi_t * spi, uint8_t ss_num, int8_t ss) { - if(!spi || ss < 0 || cs_num > 2) { + if(!spi || ss < 0 || ss_num > 2) { return false; } - void * bus = perimanGetPinBus(ss, ESP32_BUS_TYPE_SPI_MASTER_CS); + void * bus = perimanGetPinBus(ss, ESP32_BUS_TYPE_SPI_MASTER_SS); if(bus != NULL && !perimanClearPinBus(ss)){ return false; } pinMode(ss, OUTPUT); - pinMatrixOutAttach(ss, SPI_SS_IDX(spi->num, cs_num), false, false); - spiEnableSSPins(spi, (1 << cs_num)); + pinMatrixOutAttach(ss, SPI_SS_IDX(spi->num, ss_num), false, false); + spiEnableSSPins(spi, (1 << ss_num)); spi->ss = ss; - if(!perimanSetPinBus(ss, ESP32_BUS_TYPE_SPI_MASTER_CS, (void *)(spi->num+1), spi->num, -1)){ - spiDetachBus((void *)(spi->num+1)); + if(!perimanSetPinBus(ss, ESP32_BUS_TYPE_SPI_MASTER_SS, (void *)(spi->num+1), spi->num, -1)){ + spiDetachBus_SS((void *)(spi->num+1)); log_e("Failed to set pin bus to SPI for pin %d", ss); return false; } return true; } -bool spiDetachSS(spi_t * spi, int8_t ss) +bool spiDetachSS(spi_t * spi) { - if(!spi || ss < 0) { + if(!spi) { return false; } - pinMatrixOutDetach(ss, false, false); - spi->ss = -1; - perimanClearPinBus(ss); + int8_t ss = spi->ss; + if(ss != -1) { + pinMatrixOutDetach(ss, false, false); + spi->ss = -1; + perimanClearPinBus(ss); + } return true; } -void spiEnableSSPins(spi_t * spi, uint8_t cs_mask) +void spiEnableSSPins(spi_t * spi, uint8_t ss_mask) { if(!spi) { return; } SPI_MUTEX_LOCK(); #if CONFIG_IDF_TARGET_ESP32S2 || CONFIG_IDF_TARGET_ESP32S3 || CONFIG_IDF_TARGET_ESP32C2 || CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32H2 - spi->dev->misc.val &= ~(cs_mask & SPI_CS_MASK_ALL); + spi->dev->misc.val &= ~(ss_mask & SPI_SS_MASK_ALL); #else - spi->dev->pin.val &= ~(cs_mask & SPI_CS_MASK_ALL); + spi->dev->pin.val &= ~(ss_mask & SPI_SS_MASK_ALL); #endif SPI_MUTEX_UNLOCK(); } -void spiDisableSSPins(spi_t * spi, uint8_t cs_mask) +void spiDisableSSPins(spi_t * spi, uint8_t ss_mask) { if(!spi) { return; } SPI_MUTEX_LOCK(); #if CONFIG_IDF_TARGET_ESP32S2 || CONFIG_IDF_TARGET_ESP32S3 || CONFIG_IDF_TARGET_ESP32C2 || CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32H2 - spi->dev->misc.val |= (cs_mask & SPI_CS_MASK_ALL); + spi->dev->misc.val |= (ss_mask & SPI_SS_MASK_ALL); #else - spi->dev->pin.val |= (cs_mask & SPI_CS_MASK_ALL); + spi->dev->pin.val |= (ss_mask & SPI_SS_MASK_ALL); #endif SPI_MUTEX_UNLOCK(); } @@ -578,10 +617,10 @@ spi_t * spiStartBus(uint8_t spi_num, uint32_t clockDiv, uint8_t dataMode, uint8_ return NULL; } - perimanSetBusDeinit(ESP32_BUS_TYPE_SPI_MASTER_SCK, spiDetachBus); - perimanSetBusDeinit(ESP32_BUS_TYPE_SPI_MASTER_MISO, spiDetachBus); - perimanSetBusDeinit(ESP32_BUS_TYPE_SPI_MASTER_MOSI, spiDetachBus); - perimanSetBusDeinit(ESP32_BUS_TYPE_SPI_MASTER_CS, spiDetachBus); + perimanSetBusDeinit(ESP32_BUS_TYPE_SPI_MASTER_SCK, spiDetachBus_SCK); + perimanSetBusDeinit(ESP32_BUS_TYPE_SPI_MASTER_MISO, spiDetachBus_MISO); + perimanSetBusDeinit(ESP32_BUS_TYPE_SPI_MASTER_MOSI, spiDetachBus_MOSI); + perimanSetBusDeinit(ESP32_BUS_TYPE_SPI_MASTER_SS, spiDetachBus_SS); spi_t * spi = &_spi_bus_array[spi_num]; diff --git a/cores/esp32/esp32-hal-spi.h b/cores/esp32/esp32-hal-spi.h index 63ab88bcd33..5c8eb58d059 100644 --- a/cores/esp32/esp32-hal-spi.h +++ b/cores/esp32/esp32-hal-spi.h @@ -31,12 +31,15 @@ extern "C" { #if CONFIG_IDF_TARGET_ESP32C2 || CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32H2 || CONFIG_IDF_TARGET_ESP32S3 #define FSPI 0 #define HSPI 1 -#else -#define FSPI 1 //SPI bus attached to the flash (can use the same data lines but different SS) -#define HSPI 2 //SPI bus normally mapped to pins 12 - 15, but can be matrixed to any pins -#if CONFIG_IDF_TARGET_ESP32 -#define VSPI 3 //SPI bus normally attached to pins 5, 18, 19 and 23, but can be matrixed to any pins -#endif +#elif CONFIG_IDF_TARGET_ESP32S2 +#define FSPI 1 //SPI 1 bus. ESP32S2: for external memory only (can use the same data lines but different SS) +#define HSPI 2 //SPI 2 bus. ESP32S2: external memory or device - it can be matrixed to any pins +#define SPI2 2 // Another name for ESP32S2 SPI 2 +#define SPI3 3 //SPI 3 bus. ESP32S2: device only - it can be matrixed to any pins +#elif CONFIG_IDF_TARGET_ESP32 +#define FSPI 1 //SPI 1 bus attached to the flash (can use the same data lines but different SS) +#define HSPI 2 //SPI 2 bus normally mapped to pins 12 - 15, but can be matrixed to any pins +#define VSPI 3 //SPI 3 bus normally attached to pins 5, 18, 19 and 23, but can be matrixed to any pins #endif // This defines are not representing the real Divider of the ESP32 @@ -54,10 +57,10 @@ extern "C" { #define SPI_MODE2 2 #define SPI_MODE3 3 -#define SPI_CS0 0 -#define SPI_CS1 1 -#define SPI_CS2 2 -#define SPI_CS_MASK_ALL 0x7 +#define SPI_SS0 0 +#define SPI_SS1 1 +#define SPI_SS2 2 +#define SPI_SS_MASK_ALL 0x7 #define SPI_LSBFIRST 0 #define SPI_MSBFIRST 1 @@ -72,25 +75,25 @@ void spiStopBus(spi_t * spi); bool spiAttachSCK(spi_t * spi, int8_t sck); bool spiAttachMISO(spi_t * spi, int8_t miso); bool spiAttachMOSI(spi_t * spi, int8_t mosi); -bool spiDetachSCK(spi_t * spi, int8_t sck); -bool spiDetachMISO(spi_t * spi, int8_t miso); -bool spiDetachMOSI(spi_t * spi, int8_t mosi); +bool spiDetachSCK(spi_t * spi); +bool spiDetachMISO(spi_t * spi); +bool spiDetachMOSI(spi_t * spi); -//Attach/Detach SS pin to SPI_CSx signal -bool spiAttachSS(spi_t * spi, uint8_t cs_num, int8_t ss); -bool spiDetachSS(spi_t * spi, int8_t ss); +//Attach/Detach SS pin to SPI_SSx signal +bool spiAttachSS(spi_t * spi, uint8_t ss_num, int8_t ss); +bool spiDetachSS(spi_t * spi); -//Enable/Disable SPI_CSx pins -void spiEnableSSPins(spi_t * spi, uint8_t cs_mask); -void spiDisableSSPins(spi_t * spi, uint8_t cs_mask); +//Enable/Disable SPI_SSx pins +void spiEnableSSPins(spi_t * spi, uint8_t ss_mask); +void spiDisableSSPins(spi_t * spi, uint8_t ss_mask); -//Enable/Disable hardware control of SPI_CSx pins +//Enable/Disable hardware control of SPI_SSx pins void spiSSEnable(spi_t * spi); void spiSSDisable(spi_t * spi); -//Activate enabled SPI_CSx pins +//Activate enabled SPI_SSx pins void spiSSSet(spi_t * spi); -//Deactivate enabled SPI_CSx pins +//Deactivate enabled SPI_SSx pins void spiSSClear(spi_t * spi); void spiWaitReady(spi_t * spi); diff --git a/cores/esp32/esp32-hal-uart.c b/cores/esp32/esp32-hal-uart.c index 3d3559f7dec..b22267fbc68 100644 --- a/cores/esp32/esp32-hal-uart.c +++ b/cores/esp32/esp32-hal-uart.c @@ -1,4 +1,4 @@ -// Copyright 2015-2023 Espressif Systems (Shanghai) PTE LTD +// Copyright 2015-2024 Espressif Systems (Shanghai) PTE LTD // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -33,19 +33,25 @@ #include "hal/gpio_hal.h" #include "esp_rom_gpio.h" -static int s_uart_debug_nr = 0; +static int s_uart_debug_nr = 0; // UART number for debug output struct uart_struct_t { #if !CONFIG_DISABLE_HAL_LOCKS - SemaphoreHandle_t lock; + SemaphoreHandle_t lock; // UART lock #endif - uint8_t num; - bool has_peek; - uint8_t peek_byte; - QueueHandle_t uart_event_queue; // export it by some uartGetEventQueue() function - int8_t _rxPin, _txPin, _ctsPin, _rtsPin; // UART GPIOs + uint8_t num; // UART number for IDF driver API + bool has_peek; // flag to indicate that there is a peek byte pending to be read + uint8_t peek_byte; // peek byte that has been read but not consumed + QueueHandle_t uart_event_queue; // export it by some uartGetEventQueue() function + // configuration data:: Arduino API tipical data + int8_t _rxPin, _txPin, _ctsPin, _rtsPin; // UART GPIOs + uint32_t _baudrate, _config; // UART baudrate and config + // UART ESP32 specific data + uint16_t _rx_buffer_size, _tx_buffer_size; // UART RX and TX buffer sizes + bool _inverted; // UART inverted signal + uint8_t _rxfifo_full_thrhd; // UART RX FIFO full threshold }; #if CONFIG_DISABLE_HAL_LOCKS @@ -54,12 +60,12 @@ struct uart_struct_t { #define UART_MUTEX_UNLOCK() static uart_t _uart_bus_array[] = { - {0, false, 0, NULL, -1, -1, -1, -1}, + {0, false, 0, NULL, -1, -1, -1, -1, 0, 0, 0, 0, false, 0}, #if SOC_UART_NUM > 1 - {1, false, 0, NULL, -1, -1, -1, -1}, + {1, false, 0, NULL, -1, -1, -1, -1, 0, 0, 0, 0, false, 0}, #endif #if SOC_UART_NUM > 2 - {2, false, 0, NULL, -1, -1, -1, -1}, + {2, false, 0, NULL, -1, -1, -1, -1, 0, 0, 0, 0, false, 0}, #endif }; @@ -69,12 +75,12 @@ static uart_t _uart_bus_array[] = { #define UART_MUTEX_UNLOCK() if(uart->lock != NULL) xSemaphoreGive(uart->lock) static uart_t _uart_bus_array[] = { - {NULL, 0, false, 0, NULL, -1, -1, -1, -1}, + {NULL, 0, false, 0, NULL, -1, -1, -1, -1, 0, 0, 0, 0, false, 0}, #if SOC_UART_NUM > 1 - {NULL, 1, false, 0, NULL, -1, -1, -1, -1}, + {NULL, 1, false, 0, NULL, -1, -1, -1, -1, 0, 0, 0, 0, false, 0}, #endif #if SOC_UART_NUM > 2 - {NULL, 2, false, 0, NULL, -1, -1, -1, -1}, + {NULL, 2, false, 0, NULL, -1, -1, -1, -1, 0, 0, 0, 0, false, 0}, #endif }; @@ -97,7 +103,12 @@ static bool _uartDetachPins(uint8_t uart_num, int8_t rxPin, int8_t txPin, int8_t // detaches pins and sets Peripheral Manager and UART information if (rxPin >= 0 && uart->_rxPin == rxPin && perimanGetPinBusType(rxPin) == ESP32_BUS_TYPE_UART_RX) { gpio_hal_iomux_func_sel(GPIO_PIN_MUX_REG[rxPin], PIN_FUNC_GPIO); - esp_rom_gpio_connect_in_signal(GPIO_FUNC_IN_LOW, UART_PERIPH_SIGNAL(uart_num, SOC_UART_RX_PIN_IDX), false); + // avoids causing BREAK in the UART line + if (uart->_inverted) { + esp_rom_gpio_connect_in_signal(GPIO_FUNC_IN_LOW, UART_PERIPH_SIGNAL(uart_num, SOC_UART_RX_PIN_IDX), false); + } else { + esp_rom_gpio_connect_in_signal(GPIO_FUNC_IN_HIGH, UART_PERIPH_SIGNAL(uart_num, SOC_UART_RX_PIN_IDX), false); + } uart->_rxPin = -1; // -1 means unassigned/detached if (!perimanClearPinBus(rxPin)) { retCode = false; @@ -355,28 +366,121 @@ bool uartSetHwFlowCtrlMode(uart_t *uart, uart_hw_flowcontrol_t mode, uint8_t thr return retCode; } -uart_t* uartBegin(uint8_t uart_nr, uint32_t baudrate, uint32_t config, int8_t rxPin, int8_t txPin, uint16_t rx_buffer_size, uint16_t tx_buffer_size, bool inverted, uint8_t rxfifo_full_thrhd) +// This helper function will return true if a new IDF UART driver needs to be restarted and false if the current one can continue its execution +bool _testUartBegin(uint8_t uart_nr, uint32_t baudrate, uint32_t config, int8_t rxPin, int8_t txPin, uint16_t rx_buffer_size, uint16_t tx_buffer_size, bool inverted, uint8_t rxfifo_full_thrhd) { if(uart_nr >= SOC_UART_NUM) { - return NULL; + return false; // no new driver has to be installed } uart_t* uart = &_uart_bus_array[uart_nr]; - + // verify if is necessary to restart the UART driver if (uart_is_driver_installed(uart_nr)) { - uartEnd(uart_nr); + // some parameters can't be changed unless we end the UART driver + if ( uart->_rx_buffer_size != rx_buffer_size || uart->_tx_buffer_size != tx_buffer_size || uart->_inverted != inverted || uart->_rxfifo_full_thrhd != rxfifo_full_thrhd) { + return true; // the current IDF UART driver must be terminated and a new driver shall be installed + } else { + return false; // The current IDF UART driver can continue its execution + } + } else { + return true; // no IDF UART driver is running and a new driver shall be installed } +} + +uart_t* uartBegin(uint8_t uart_nr, uint32_t baudrate, uint32_t config, int8_t rxPin, int8_t txPin, uint16_t rx_buffer_size, uint16_t tx_buffer_size, bool inverted, uint8_t rxfifo_full_thrhd) +{ + if(uart_nr >= SOC_UART_NUM) { + log_e("UART number is invalid, please use number from 0 to %u", SOC_UART_NUM - 1); + return NULL; // no new driver was installed + } + uart_t* uart = &_uart_bus_array[uart_nr]; + log_v("UART%d baud(%ld) Mode(%x) rxPin(%d) txPin(%d)", uart_nr, baudrate, config, rxPin, txPin); #if !CONFIG_DISABLE_HAL_LOCKS if(uart->lock == NULL) { uart->lock = xSemaphoreCreateMutex(); if(uart->lock == NULL) { log_e("HAL LOCK error."); - return NULL; + return NULL; // no new driver was installed } } #endif - UART_MUTEX_LOCK(); + if (uart_is_driver_installed(uart_nr)) { + log_v("UART%d Driver already installed.", uart_nr); + // some parameters can't be changed unless we end the UART driver + if ( uart->_rx_buffer_size != rx_buffer_size || uart->_tx_buffer_size != tx_buffer_size || uart->_inverted != inverted || uart->_rxfifo_full_thrhd != rxfifo_full_thrhd) { + log_v("UART%d changing buffer sizes or inverted signal or rxfifo_full_thrhd. IDF driver will be restarted", uart_nr); + uartEnd(uart_nr); + } else { + bool retCode = true; + UART_MUTEX_LOCK(); + //User may just want to change some parameters, such as baudrate, data length, parity, stop bits or pins + if (uart->_baudrate != baudrate) { + if (ESP_OK != uart_set_baudrate(uart_nr, baudrate)) { + log_e("UART%d changing baudrate failed.", uart_nr); + retCode = false; + } else { + log_v("UART%d changed baudrate to %d", uart_nr, baudrate); + uart->_baudrate = baudrate; + } + } + uart_word_length_t data_bits = (config & 0xc) >> 2; + uart_parity_t parity = config & 0x3; + uart_stop_bits_t stop_bits = (config & 0x30) >> 4; + if (retCode && (uart->_config & 0xc) >> 2 != data_bits) { + if (ESP_OK != uart_set_word_length(uart_nr, data_bits)) { + log_e("UART%d changing data length failed.", uart_nr); + retCode = false; + } else { + log_v("UART%d changed data length to %d", uart_nr, data_bits + 5); + } + } + if (retCode && (uart->_config & 0x3) != parity) { + if (ESP_OK != uart_set_parity(uart_nr, parity)) { + log_e("UART%d changing parity failed.", uart_nr); + retCode = false; + } else { + log_v("UART%d changed parity to %s", uart_nr, parity == 0 ? "NONE" : parity == 2 ? "EVEN" : "ODD"); + } + } + if (retCode && (uart->_config & 0xc30) >> 4 != stop_bits) { + if (ESP_OK != uart_set_stop_bits(uart_nr, stop_bits)) { + log_e("UART%d changing stop bits failed.", uart_nr); + retCode = false; + } else { + log_v("UART%d changed stop bits to %d", uart_nr, stop_bits == 3 ? 2 : 1); + } + } + if (retCode) uart->_config = config; + if (retCode && rxPin > 0 && uart->_rxPin != rxPin) { + retCode &= _uartDetachPins(uart_nr, uart->_rxPin, UART_PIN_NO_CHANGE, UART_PIN_NO_CHANGE, UART_PIN_NO_CHANGE); + retCode &= _uartAttachPins(uart_nr, rxPin, UART_PIN_NO_CHANGE, UART_PIN_NO_CHANGE, UART_PIN_NO_CHANGE); + if (!retCode) { + log_e("UART%d changing RX pin failed.", uart_nr); + } else { + log_v("UART%d changed RX pin to %d", uart_nr, rxPin); + } + } + if (retCode && txPin > 0 && uart->_txPin != txPin) { + retCode &= _uartDetachPins(uart_nr, UART_PIN_NO_CHANGE, uart->_txPin, UART_PIN_NO_CHANGE, UART_PIN_NO_CHANGE); + retCode &= _uartAttachPins(uart_nr, UART_PIN_NO_CHANGE, txPin, UART_PIN_NO_CHANGE, UART_PIN_NO_CHANGE); + if (!retCode) { + log_e("UART%d changing TX pin failed.", uart_nr); + } else { + log_v("UART%d changed TX pin to %d", uart_nr, txPin); + } + } + UART_MUTEX_UNLOCK(); + if (retCode) { + // UART driver was already working, just return the uart_t structure, syaing that no new driver was installed + return uart; + } + // if we reach this point, it means that we need to restart the UART driver + uartEnd(uart_nr); + } + } else { + log_v("UART%d not installed. Starting installation", uart_nr); + } uart_config_t uart_config; uart_config.data_bits = (config & 0xc) >> 2; uart_config.parity = (config & 0x3); @@ -386,7 +490,10 @@ uart_t* uartBegin(uint8_t uart_nr, uint32_t baudrate, uint32_t config, int8_t rx uart_config.baud_rate = baudrate; // CLK_APB for ESP32|S2|S3|C3 -- CLK_PLL_F40M for C2 -- CLK_PLL_F48M for H2 -- CLK_PLL_F80M for C6 uart_config.source_clk = UART_SCLK_DEFAULT; + + UART_MUTEX_LOCK(); bool retCode = ESP_OK == uart_driver_install(uart_nr, rx_buffer_size, tx_buffer_size, 20, &(uart->uart_event_queue), 0); + if (retCode) retCode &= ESP_OK == uart_param_config(uart_nr, &uart_config); // Is it right or the idea is to swap rx and tx pins? @@ -395,19 +502,31 @@ uart_t* uartBegin(uint8_t uart_nr, uint32_t baudrate, uint32_t config, int8_t rx retCode &= ESP_OK == uart_set_line_inverse(uart_nr, UART_SIGNAL_TXD_INV | UART_SIGNAL_RXD_INV); } + if (retCode) { + uart->_baudrate = baudrate; + uart->_config = config; + uart->_inverted = inverted; + uart->_rxfifo_full_thrhd = rxfifo_full_thrhd; + uart->_rx_buffer_size = rx_buffer_size; + uart->_tx_buffer_size = tx_buffer_size; + uart->_ctsPin = -1; + uart->_rtsPin = -1; + uart->has_peek = false; + uart->peek_byte = 0; + } UART_MUTEX_UNLOCK(); + // uartSetPins detaches previous pins if new ones are used over a previous begin() if (retCode) retCode &= uartSetPins(uart_nr, rxPin, txPin, UART_PIN_NO_CHANGE, UART_PIN_NO_CHANGE); - - if (retCode) uartFlush(uart); - else { + if (!retCode) { uartEnd(uart_nr); uart = NULL; log_e("UART%d initialization error.", uart->num); + } else { + uartFlush(uart); + log_v("UART%d initialization done.", uart->num); } - - log_v("UART%d baud(%ld) Mode(%x) rxPin(%d) txPin(%d)", uart_nr, baudrate, config, rxPin, txPin); - return uart; + return uart; // a new driver was installed } // This function code is under testing - for now just keep it here @@ -658,6 +777,7 @@ void uartSetBaudRate(uart_t* uart, uint32_t baud_rate) if(uart_get_sclk_freq(UART_SCLK_DEFAULT, &sclk_freq) == ESP_OK){ uart_ll_set_baudrate(UART_LL_GET_HW(uart->num), baud_rate, sclk_freq); } + uart->_baudrate = baud_rate; UART_MUTEX_UNLOCK(); } @@ -1025,3 +1145,4 @@ int uart_send_msg_with_break(uint8_t uartNum, uint8_t *msg, size_t msgSize) } #endif /* SOC_UART_SUPPORTED */ + diff --git a/cores/esp32/esp32-hal-uart.h b/cores/esp32/esp32-hal-uart.h index fbb9694c58a..b33c7bc75fe 100644 --- a/cores/esp32/esp32-hal-uart.h +++ b/cores/esp32/esp32-hal-uart.h @@ -32,6 +32,7 @@ extern "C" { struct uart_struct_t; typedef struct uart_struct_t uart_t; +bool _testUartBegin(uint8_t uart_nr, uint32_t baudrate, uint32_t config, int8_t rxPin, int8_t txPin, uint16_t rx_buffer_size, uint16_t tx_buffer_size, bool inverted, uint8_t rxfifo_full_thrhd); uart_t* uartBegin(uint8_t uart_nr, uint32_t baudrate, uint32_t config, int8_t rxPin, int8_t txPin, uint16_t rx_buffer_size, uint16_t tx_buffer_size, bool inverted, uint8_t rxfifo_full_thrhd); void uartEnd(uint8_t uart_num); diff --git a/docs/Makefile b/docs/Makefile deleted file mode 100644 index ba5447de969..00000000000 --- a/docs/Makefile +++ /dev/null @@ -1,28 +0,0 @@ -# Minimal makefile for Sphinx documentation -# - -# You can set these variables from the command line, and also -# from the environment for the first two. -SPHINXOPTS ?= -SPHINXBUILD ?= sphinx-build -SOURCEDIR = source -BUILDDIR = build - -LINKCHECKDIR = build/linkcheck - -.PHONY: checklinks - checklinks: - $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(LINKCHECKDIR) - @echo - @echo "Check finished. Report is in $(LINKCHECKDIR)." - -# Put it first so that "make" without argument is like "make help". -help: - @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) - -.PHONY: help Makefile - -# Catch-all target: route all unknown targets to Sphinx using the new -# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). -%: Makefile - @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) diff --git a/docs/source/_static/arduino-ide.png b/docs/_static/arduino-ide.png similarity index 100% rename from docs/source/_static/arduino-ide.png rename to docs/_static/arduino-ide.png diff --git a/docs/source/_static/arduino_i2c_master.png b/docs/_static/arduino_i2c_master.png similarity index 100% rename from docs/source/_static/arduino_i2c_master.png rename to docs/_static/arduino_i2c_master.png diff --git a/docs/source/_static/arduino_i2c_slave.png b/docs/_static/arduino_i2c_slave.png similarity index 100% rename from docs/source/_static/arduino_i2c_slave.png rename to docs/_static/arduino_i2c_slave.png diff --git a/docs/_static/arduino_versions.js b/docs/_static/arduino_versions.js new file mode 100644 index 00000000000..825bc0cbc27 --- /dev/null +++ b/docs/_static/arduino_versions.js @@ -0,0 +1,16 @@ +var DOCUMENTATION_VERSIONS = { + DEFAULTS: { has_targets: false, + supported_targets: [ "esp32" ] + }, + VERSIONS: [ + { name: "latest", has_targets: true, supported_targets: [ "esp32", "esp32s2", "esp32s3", "esp32c3", "esp32h2", "esp32c6" ] }, + ], + IDF_TARGETS: [ + { text: "ESP32", value: "esp32"}, + { text: "ESP32-S2", value: "esp32s2"}, + { text: "ESP32-S3", value: "esp32s3"}, + { text: "ESP32-C3", value: "esp32c3"}, + { text: "ESP32-H2", value: "esp32h2"}, + { text: "ESP32-C6", value: "esp32c6"}, + ] +}; diff --git a/docs/source/_static/cross.png b/docs/_static/cross.png similarity index 100% rename from docs/source/_static/cross.png rename to docs/_static/cross.png diff --git a/docs/source/_static/esp32-c3_devkitM-1_pinlayout.png b/docs/_static/esp32-c3_devkitM-1_pinlayout.png similarity index 100% rename from docs/source/_static/esp32-c3_devkitM-1_pinlayout.png rename to docs/_static/esp32-c3_devkitM-1_pinlayout.png diff --git a/docs/source/_static/esp32-s2_saola1_pinlayout.png b/docs/_static/esp32-s2_saola1_pinlayout.png similarity index 100% rename from docs/source/_static/esp32-s2_saola1_pinlayout.png rename to docs/_static/esp32-s2_saola1_pinlayout.png diff --git a/docs/source/_static/esp32_devkitC_pinlayout.png b/docs/_static/esp32_devkitC_pinlayout.png similarity index 100% rename from docs/source/_static/esp32_devkitC_pinlayout.png rename to docs/_static/esp32_devkitC_pinlayout.png diff --git a/docs/source/_static/external_library_test_pr.png b/docs/_static/external_library_test_pr.png similarity index 100% rename from docs/source/_static/external_library_test_pr.png rename to docs/_static/external_library_test_pr.png diff --git a/docs/source/_static/external_library_test_schedule.png b/docs/_static/external_library_test_schedule.png similarity index 100% rename from docs/source/_static/external_library_test_schedule.png rename to docs/_static/external_library_test_schedule.png diff --git a/docs/source/_static/gpio_output.png b/docs/_static/gpio_output.png similarity index 100% rename from docs/source/_static/gpio_output.png rename to docs/_static/gpio_output.png diff --git a/docs/source/_static/gpio_pullup.png b/docs/_static/gpio_pullup.png similarity index 100% rename from docs/source/_static/gpio_pullup.png rename to docs/_static/gpio_pullup.png diff --git a/docs/source/_static/green_checkmark.png b/docs/_static/green_checkmark.png similarity index 100% rename from docs/source/_static/green_checkmark.png rename to docs/_static/green_checkmark.png diff --git a/docs/source/_static/install_guide_boards_manager_esp32.png b/docs/_static/install_guide_boards_manager_esp32.png similarity index 100% rename from docs/source/_static/install_guide_boards_manager_esp32.png rename to docs/_static/install_guide_boards_manager_esp32.png diff --git a/docs/source/_static/install_guide_boards_manager_url.png b/docs/_static/install_guide_boards_manager_url.png similarity index 100% rename from docs/source/_static/install_guide_boards_manager_url.png rename to docs/_static/install_guide_boards_manager_url.png diff --git a/docs/source/_static/install_guide_preferences.png b/docs/_static/install_guide_preferences.png similarity index 100% rename from docs/source/_static/install_guide_preferences.png rename to docs/_static/install_guide_preferences.png diff --git a/docs/source/_static/logo_arduino.png b/docs/_static/logo_arduino.png similarity index 100% rename from docs/source/_static/logo_arduino.png rename to docs/_static/logo_arduino.png diff --git a/docs/source/_static/logo_espressif.png b/docs/_static/logo_espressif.png similarity index 100% rename from docs/source/_static/logo_espressif.png rename to docs/_static/logo_espressif.png diff --git a/docs/source/_static/logo_linux.png b/docs/_static/logo_linux.png similarity index 100% rename from docs/source/_static/logo_linux.png rename to docs/_static/logo_linux.png diff --git a/docs/source/_static/logo_macos.png b/docs/_static/logo_macos.png similarity index 100% rename from docs/source/_static/logo_macos.png rename to docs/_static/logo_macos.png diff --git a/docs/source/_static/logo_pio.png b/docs/_static/logo_pio.png similarity index 100% rename from docs/source/_static/logo_pio.png rename to docs/_static/logo_pio.png diff --git a/docs/source/_static/logo_windows.png b/docs/_static/logo_windows.png similarity index 100% rename from docs/source/_static/logo_windows.png rename to docs/_static/logo_windows.png diff --git a/docs/source/_static/ota_esp32_login.png b/docs/_static/ota_esp32_login.png similarity index 100% rename from docs/source/_static/ota_esp32_login.png rename to docs/_static/ota_esp32_login.png diff --git a/docs/source/_static/ota_esp32_upload.png b/docs/_static/ota_esp32_upload.png similarity index 100% rename from docs/source/_static/ota_esp32_upload.png rename to docs/_static/ota_esp32_upload.png diff --git a/docs/source/_static/ota_esp32_verbose.png b/docs/_static/ota_esp32_verbose.png similarity index 100% rename from docs/source/_static/ota_esp32_verbose.png rename to docs/_static/ota_esp32_verbose.png diff --git a/docs/source/_static/ota_export_to_binary.png b/docs/_static/ota_export_to_binary.png similarity index 100% rename from docs/source/_static/ota_export_to_binary.png rename to docs/_static/ota_export_to_binary.png diff --git a/docs/source/_static/soc-module.png b/docs/_static/soc-module.png similarity index 100% rename from docs/source/_static/soc-module.png rename to docs/_static/soc-module.png diff --git a/docs/source/_static/tutorials/basic/tutorial_basic_ide.png b/docs/_static/tutorials/basic/tutorial_basic_ide.png similarity index 100% rename from docs/source/_static/tutorials/basic/tutorial_basic_ide.png rename to docs/_static/tutorials/basic/tutorial_basic_ide.png diff --git a/docs/source/_static/tutorials/peripherals/tutorial_peripheral_diagram.png b/docs/_static/tutorials/peripherals/tutorial_peripheral_diagram.png similarity index 100% rename from docs/source/_static/tutorials/peripherals/tutorial_peripheral_diagram.png rename to docs/_static/tutorials/peripherals/tutorial_peripheral_diagram.png diff --git a/docs/source/_static/usb_msc_drive.png b/docs/_static/usb_msc_drive.png similarity index 100% rename from docs/source/_static/usb_msc_drive.png rename to docs/_static/usb_msc_drive.png diff --git a/docs/source/_static/warning.png b/docs/_static/warning.png similarity index 100% rename from docs/source/_static/warning.png rename to docs/_static/warning.png diff --git a/docs/source/_static/wifi_esp32_ap.png b/docs/_static/wifi_esp32_ap.png similarity index 100% rename from docs/source/_static/wifi_esp32_ap.png rename to docs/_static/wifi_esp32_ap.png diff --git a/docs/source/_static/wifi_esp32_sta.png b/docs/_static/wifi_esp32_sta.png similarity index 100% rename from docs/source/_static/wifi_esp32_sta.png rename to docs/_static/wifi_esp32_sta.png diff --git a/docs/source/_static/win-gui-1.png b/docs/_static/win-gui-1.png similarity index 100% rename from docs/source/_static/win-gui-1.png rename to docs/_static/win-gui-1.png diff --git a/docs/source/_static/win-gui-2.png b/docs/_static/win-gui-2.png similarity index 100% rename from docs/source/_static/win-gui-2.png rename to docs/_static/win-gui-2.png diff --git a/docs/source/_static/win-gui-3.png b/docs/_static/win-gui-3.png similarity index 100% rename from docs/source/_static/win-gui-3.png rename to docs/_static/win-gui-3.png diff --git a/docs/source/_static/win-gui-4.png b/docs/_static/win-gui-4.png similarity index 100% rename from docs/source/_static/win-gui-4.png rename to docs/_static/win-gui-4.png diff --git a/docs/source/_static/win-gui-5.png b/docs/_static/win-gui-5.png similarity index 100% rename from docs/source/_static/win-gui-5.png rename to docs/_static/win-gui-5.png diff --git a/docs/source/_static/win-gui-update-1.png b/docs/_static/win-gui-update-1.png similarity index 100% rename from docs/source/_static/win-gui-update-1.png rename to docs/_static/win-gui-update-1.png diff --git a/docs/source/_static/win-gui-update-2.png b/docs/_static/win-gui-update-2.png similarity index 100% rename from docs/source/_static/win-gui-update-2.png rename to docs/_static/win-gui-update-2.png diff --git a/docs/conf_common.py b/docs/conf_common.py new file mode 100644 index 00000000000..dd37c809849 --- /dev/null +++ b/docs/conf_common.py @@ -0,0 +1,54 @@ +# --------------------------------------------------------------- + +from esp_docs.conf_docs import * # noqa: F403,F401 + +languages = ["en"] + +# idf_targets = [ +# "esp32", +# "esp32s2", +# "esp32s3", +# "esp32c3", +# "esp32c6", +# "esp32h2", +# ] + +# link roles config +github_repo = "espressif/arduino-esp32" + +# context used by sphinx_idf_theme +html_context["github_user"] = "espressif" +html_context["github_repo"] = "arduino-esp32" + +html_static_path = ["../_static"] + +# Conditional content + +extensions += ['sphinx_copybutton', + 'sphinx_tabs.tabs', + 'esp_docs.esp_extensions.dummy_build_system', + ] + +# ESP32_DOCS = [ +# "index.rst", +# ] + +# ESP32S2_DOCS = ESP32_DOCS +# ESP32C3_DOCS = ESP32S2_DOCS +# ESP32S3_DOCS = ESP32S2_DOCS +# ESP32C6_DOCS = ESP32S2_DOCS +# ESP32H2_DOCS = ESP32S2_DOCS + +# conditional_include_dict = { +# "esp32": ESP32_DOCS, +# "esp32s2": ESP32S2_DOCS, +# "esp32c3": ESP32C3_DOCS, +# "esp32s3": ESP32S3_DOCS, +# "esp32c6": ESP32C6_DOCS, +# "esp32h2": ESP32H2_DOCS, +# } + +# Extra options required by sphinx_idf_theme +project_slug = "arduino-esp32" + +# versions_url = "./../_static/arduino_versions.js" diff --git a/docs/source/advanced_utils.rst b/docs/en/advanced_utils.rst similarity index 100% rename from docs/source/advanced_utils.rst rename to docs/en/advanced_utils.rst diff --git a/docs/source/api/adc.rst b/docs/en/api/adc.rst similarity index 100% rename from docs/source/api/adc.rst rename to docs/en/api/adc.rst diff --git a/docs/source/api/ble.rst b/docs/en/api/ble.rst similarity index 100% rename from docs/source/api/ble.rst rename to docs/en/api/ble.rst diff --git a/docs/source/api/bluetooth.rst b/docs/en/api/bluetooth.rst similarity index 100% rename from docs/source/api/bluetooth.rst rename to docs/en/api/bluetooth.rst diff --git a/docs/source/api/dac.rst b/docs/en/api/dac.rst similarity index 100% rename from docs/source/api/dac.rst rename to docs/en/api/dac.rst diff --git a/docs/source/api/deepsleep.rst b/docs/en/api/deepsleep.rst similarity index 100% rename from docs/source/api/deepsleep.rst rename to docs/en/api/deepsleep.rst diff --git a/docs/source/api/espnow.rst b/docs/en/api/espnow.rst similarity index 100% rename from docs/source/api/espnow.rst rename to docs/en/api/espnow.rst diff --git a/docs/source/api/ethernet.rst b/docs/en/api/ethernet.rst similarity index 100% rename from docs/source/api/ethernet.rst rename to docs/en/api/ethernet.rst diff --git a/docs/source/api/gpio.rst b/docs/en/api/gpio.rst similarity index 100% rename from docs/source/api/gpio.rst rename to docs/en/api/gpio.rst diff --git a/docs/source/api/i2c.rst b/docs/en/api/i2c.rst similarity index 99% rename from docs/source/api/i2c.rst rename to docs/en/api/i2c.rst index f53d8f27a3c..31a07f88046 100644 --- a/docs/source/api/i2c.rst +++ b/docs/en/api/i2c.rst @@ -19,7 +19,7 @@ The I2C can be used in two different modes: * **I2C Master Mode** * In this mode, the ESP32 generates the clock signal and initiates the communication with the slave device. -.. figure:: ../_static/arduino_i2c_master.png +.. figure:: ../../_static/arduino_i2c_master.png :align: center :width: 720 :figclass: align-center @@ -27,7 +27,7 @@ The I2C can be used in two different modes: * **I2C Slave Mode** * The slave mode, the clock is generated by the master device and responds to the master if the destination address is the same as the destination. -.. figure:: ../_static/arduino_i2c_slave.png +.. figure:: ../../_static/arduino_i2c_slave.png :align: center :width: 520 :figclass: align-center diff --git a/docs/en/api/i2s.rst b/docs/en/api/i2s.rst new file mode 100644 index 00000000000..8040dccbb5c --- /dev/null +++ b/docs/en/api/i2s.rst @@ -0,0 +1,557 @@ +### +I2S +### + +About +----- + +I2S - Inter-IC Sound, correctly written I²S pronounced "eye-squared-ess", alternative notation is IIS. I²S is an electrical serial bus interface standard used for connecting digital audio devices together. + +It is used to communicate PCM (Pulse-Code Modulation) audio data between integrated circuits in an electronic device. The I²S bus separates clock and serial data signals, resulting in simpler receivers than those required for asynchronous communications systems that need to recover the clock from the data stream. + +Despite the similar name, I²S is unrelated and incompatible with the bidirectional I²C (IIC) bus. + +The I²S bus consists of at least three lines: + +.. note:: All lines can be attached to almost any pin and this change can occur even during operation. + +* **Bit clock line** + + * Officially "continuous serial clock (SCK)". Typically written "bit clock (BCLK)". + * In this library function parameter ``sck``. + +* **Word clock line** + + * Officially "word select (WS)". Typically called "left-right clock (LRCLK)" or "frame sync (FS)". + * 0 = Left channel, 1 = Right channel + * In this library function parameter ``ws``. + +* **Data line** + + * Officially "serial data (SD)", but can be called SDATA, SDIN, SDOUT, DACDAT, ADCDAT, etc. + * Unlike Arduino I2S with single data pin switching between input and output, in ESP core driver use separate data line for input and output. + * Output data line is called ``dout`` for function parameter. + * Input data line is called ``din`` for function parameter. + +It may also include a **Master clock** line: + +* **Master clock** + + * Officially "master clock (MCLK)". + * This is not a part of I2S bus, but is used to synchronize multiple I2S devices. + * In this library function parameter ``mclk``. + +.. note:: Please check the `ESP-IDF documentation `_ for more details on the I2S peripheral for each ESP32 chip. + +I2S Configuration +----------------- + +Master / Slave Mode +******************* + +In **Master mode** (default) the device is generating clock signal ``sck`` and word select signal on ``ws``. + +In **Slave mode** the device listens on attached pins for the clock signal and word select - i.e. unless externally driven the pins will remain LOW. +This mode is not supported yet. + +Operation Modes +*************** + +Setting the operation mode is done with function ``begin`` and is set by function parameter ``mode``. + +* ``I2S_MODE_STD`` + In standard mode, there are always two sound channels, i.e., the left and right channels, which are called "slots". + These slots support 8/16/24/32-bit width sample data. + The communication format for the slots follows the Philips standard. + +* ``I2S_MODE_TDM`` + In Time Division Multiplexing mode (TDM), the number of sound channels is variable, and the width of each channel + is fixed. + +* ``I2S_MODE_PDM_TX`` + PDM (Pulse-density Modulation) mode for the TX channel can convert PCM data into PDM format which always + has left and right slots. + PDM TX is only supported on I2S0 and it only supports 16-bit width sample data. + It needs at least a CLK pin for clock signal and a DOUT pin for data signal. + +* ``I2S_MODE_PDM_RX`` + PDM (Pulse-density Modulation) mode for RX channel can receive PDM-format data and convert the data + into PCM format. PDM RX is only supported on I2S0, and it only supports 16-bit width sample data. + PDM RX needs at least a CLK pin for clock signal and a DIN pin for data signal. + +Simplex / Duplex Mode +********************* + +Due to the different clock sources the PDM modes are always in **Simplex** mode, using only one data pin. + +The STD and TDM modes operate in the **Duplex** mode, using two separate data pins: + +* Output pin ``dout`` for function parameter +* Input pin ``din`` for function parameter + +In this mode, the driver is able to read and write simultaneously on each line and is suitable for applications like walkie-talkie or phone. + +Data Bit Width +************** + +This is the number of bits in a channel sample. The data bit width is set by function parameter ``bits_cfg``. +The current supported values are: + +* ``I2S_DATA_BIT_WIDTH_8BIT`` +* ``I2S_DATA_BIT_WIDTH_16BIT`` +* ``I2S_DATA_BIT_WIDTH_24BIT``, requires the MCLK multiplier to be manually set to 384 +* ``I2S_DATA_BIT_WIDTH_32BIT`` + +Sample Rate +*********** + +The sample rate is set by function parameter ``rate``. It is the number of samples per second in Hz. + +Slot Mode +********* + +The slot mode is set by function parameter ``ch``. The current supported values are: + +* ``I2S_SLOT_MODE_MONO`` + I2S channel slot format mono. Transmit the same data in all slots for TX mode. + Only receive the data in the first slots for RX mode. + +* ``I2S_SLOT_MODE_STEREO`` + I2S channel slot format stereo. Transmit different data in different slots for TX mode. + Receive the data in all slots for RX mode. + +Arduino-ESP32 I2S API +--------------------- + +Initialization and deinitialization +*********************************** + +Before initialization, set which pins you want to use. + +begin (Master Mode) +^^^^^^^^^^^^^^^^^^^ + +Before usage choose which pins you want to use. + +.. code-block:: arduino + + bool begin(i2s_mode_t mode, uint32_t rate, i2s_data_bit_width_t bits_cfg, i2s_slot_mode_t ch, int8_t slot_mask=-1) + +Parameters: + +* [in] ``mode`` one of above mentioned operation mode, for example ``I2S_MODE_STD``. + +* [in] ``rate`` is the sampling rate in Hz, for example ``16000``. + +* [in] ``bits_cfg`` is the number of bits in a channel sample, for example ``I2S_DATA_BIT_WIDTH_16BIT``. + +* [in] ``ch`` is the slot mode, for example ``I2S_SLOT_MODE_STEREO``. + +* [in] ``slot_mask`` is the slot mask, for example ``0b11``. This parameter is optional and defaults to ``-1`` (not used). + +This function will return ``true`` on success or ``fail`` in case of failure. + +When failed, an error message will be printed if the correct log level is set. + +end +^^^ + +Performs safe deinitialization - free buffers, destroy task, end driver operation, etc. + +.. code-block:: arduino + + void end() + +Pin setup +********* + +The function to set the pins will depend on the operation mode. + +setPins +^^^^^^^ + +Set the pins for the I2S interface when using the standard or TDM mode. + +.. code-block:: arduino + + void setPins(int8_t bclk, int8_t ws, int8_t dout, int8_t din=-1, int8_t mclk=-1) + +Parameters: + +* [in] ``bclk`` is the bit clock pin. + +* [in] ``ws`` is the word select pin. + +* [in] ``dout`` is the data output pin. Can be set to ``-1`` if not used. + +* [in] ``din`` is the data input pin. This parameter is optional and defaults to ``-1`` (not used). + +* [in] ``mclk`` is the master clock pin. This parameter is optional and defaults to ``-1`` (not used). + +setPinsPdmTx +^^^^^^^^^^^^ + +Set the pins for the I2S interface when using the PDM TX mode. + +.. code-block:: arduino + + void setPinsPdmTx(int8_t clk, int8_t dout0, int8_t dout1=-1) + +Parameters: + +* [in] ``clk`` is the clock pin. + +* [in] ``dout0`` is the data output pin 0. + +* [in] ``dout1`` is the data output pin 1. This parameter is optional and defaults to ``-1`` (not used). + +setPinsPdmRx +^^^^^^^^^^^^ + +Set the pins for the I2S interface when using the PDM RX mode. + +.. code-block:: arduino + + void setPinsPdmRx(int8_t clk, int8_t din0, int8_t din1=-1, int8_t din2=-1, int8_t din3=-1) + +Parameters: + +* [in] ``clk`` is the clock pin. + +* [in] ``din0`` is the data input pin 0. + +* [in] ``din1`` is the data input pin 1. This parameter is optional and defaults to ``-1`` (not used). + +* [in] ``din2`` is the data input pin 2. This parameter is optional and defaults to ``-1`` (not used). + +* [in] ``din3`` is the data input pin 3. This parameter is optional and defaults to ``-1`` (not used). + +setInverted +^^^^^^^^^^^ + +Set which pins have inverted logic when using the standard or TDM mode. Data pins cannot be inverted. + +.. code-block:: arduino + + void setInverted(bool bclk, bool ws, bool mclk=false) + +Parameters: + +* [in] ``bclk`` true if the bit clock pin is inverted. False otherwise. + +* [in] ``ws`` true if the word select pin is inverted. False otherwise. + +* [in] ``mclk`` true if the master clock pin is inverted. False otherwise. This parameter is optional and defaults to ``false``. + +setInvertedPdm +^^^^^^^^^^^^^^ + +Set which pins have inverted logic when using the PDM mode. Data pins cannot be inverted. + +.. code-block:: arduino + + void setInvertedPdm(bool clk) + +Parameters: + +* [in] ``clk`` true if the clock pin is inverted. False otherwise. + +I2S Configuration +***************** + +The I2S configuration can be changed during operation. + +configureTX +^^^^^^^^^^^ + +Configure the I2S TX channel. + +.. code-block:: arduino + + bool configureTX(uint32_t rate, i2s_data_bit_width_t bits_cfg, i2s_slot_mode_t ch, int8_t slot_mask=-1) + +Parameters: + +* [in] ``rate`` is the sampling rate in Hz, for example ``16000``. + +* [in] ``bits_cfg`` is the number of bits in a channel sample, for example ``I2S_DATA_BIT_WIDTH_16BIT``. + +* [in] ``ch`` is the slot mode, for example ``I2S_SLOT_MODE_STEREO``. + +* [in] ``slot_mask`` is the slot mask, for example ``0b11``. This parameter is optional and defaults to ``-1`` (not used). + +This function will return ``true`` on success or ``fail`` in case of failure. + +When failed, an error message will be printed if the correct log level is set. + +configureRX +^^^^^^^^^^^ + +Configure the I2S RX channel. + +.. code-block:: arduino + + bool configureRX(uint32_t rate, i2s_data_bit_width_t bits_cfg, i2s_slot_mode_t ch, i2s_rx_transform_t transform=I2S_RX_TRANSFORM_NONE) + +Parameters: + +* [in] ``rate`` is the sampling rate in Hz, for example ``16000``. + +* [in] ``bits_cfg`` is the number of bits in a channel sample, for example ``I2S_DATA_BIT_WIDTH_16BIT``. + +* [in] ``ch`` is the slot mode, for example ``I2S_SLOT_MODE_STEREO``. + +* [in] ``transform`` is the transform mode, for example ``I2S_RX_TRANSFORM_NONE``. + This can be used to apply a transformation/conversion to the received data. + The supported values are: ``I2S_RX_TRANSFORM_NONE`` (no transformation), + ``I2S_RX_TRANSFORM_32_TO_16`` (convert from 32 bits of data width to 16 bits) and + ``I2S_RX_TRANSFORM_16_STEREO_TO_MONO`` (convert from stereo to mono when using 16 bits of data width). + +This function will return ``true`` on success or ``fail`` in case of failure. + +When failed, an error message will be printed if the correct log level is set. + +txChan +^^^^^^ + +Get the TX channel handler pointer. + +.. code-block:: arduino + + i2s_chan_handle_t txChan() + +txSampleRate +^^^^^^^^^^^^ + +Get the TX sample rate. + +.. code-block:: arduino + + uint32_t txSampleRate() + +txDataWidth +^^^^^^^^^^^ + +Get the TX data width (8, 16 or 32 bits). + +.. code-block:: arduino + + i2s_data_bit_width_t txDataWidth() + +txSlotMode +^^^^^^^^^^ + +Get the TX slot mode (stereo or mono). + +.. code-block:: arduino + + i2s_slot_mode_t txSlotMode() + +rxChan +^^^^^^ + +Get the RX channel handler pointer. + +.. code-block:: arduino + + i2s_chan_handle_t rxChan() + +rxSampleRate +^^^^^^^^^^^^ + +Get the RX sample rate. + +.. code-block:: arduino + + uint32_t rxSampleRate() + +rxDataWidth +^^^^^^^^^^^ + +Get the RX data width (8, 16 or 32 bits). + +.. code-block:: arduino + + i2s_data_bit_width_t rxDataWidth() + +rxSlotMode +^^^^^^^^^^ + +Get the RX slot mode (stereo or mono). + +.. code-block:: arduino + + i2s_slot_mode_t rxSlotMode() + +I/O Operations +************** + +readBytes +^^^^^^^^^ + +Read a certain amount of data bytes from the I2S interface. + +.. code-block:: arduino + + size_t readBytes(char *buffer, size_t size) + +Parameters: + +* [in] ``buffer`` is the buffer to store the read data. The buffer must be at least ``size`` bytes long. + +* [in] ``size`` is the number of bytes to read. + +This function will return the number of bytes read. + +read +^^^^ + +Read the next available byte from the I2S interface. + +.. code-block:: arduino + + int read() + +This function will return the next available byte or ``-1`` if no data is available +or an error occurred. + +write + +There are two versions of the write function: + +The first version writes a certain amount of data bytes to the I2S interface. + +.. code-block:: arduino + + size_t write(uint8_t *buffer, size_t size) + +Parameters: + +* [in] ``buffer`` is the buffer containing the data to be written. + +* [in] ``size`` is the number of bytes to write from the buffer. + +This function will return the number of bytes written. + +The second version writes a single byte to the I2S interface. + +.. code-block:: arduino + + size_t write(uint8_t d) + +Parameters: + +* [in] ``d`` is the byte to be written. + +This function will return ``1`` if the byte was written or ``0`` if an error occurred. + +available +^^^^^^^^^ + +Get if there is data available to be read. + +.. code-block:: arduino + + int available() + +This function will return ``I2S_READ_CHUNK_SIZE`` if there is data available to be read or ``-1`` if not. + +peek +^^^^ + +Get the next available byte from the I2S interface without removing it from the buffer. Currently not implemented. + +.. code-block:: arduino + + int peek() + +This function will currently always return ``-1``. + +lastError +^^^^^^^^^ + +Get the last error code for an I/O operation on the I2S interface. + +.. code-block:: arduino + + int lastError() + +recordWAV +^^^^^^^^^ + +Record a short PCM WAV to memory with the current RX settings. +Returns a buffer that must be freed by the user. + +.. code-block:: arduino + + uint8_t * recordWAV(size_t rec_seconds, size_t * out_size) + +Parameters: + +* [in] ``rec_seconds`` is the number of seconds to record. + +* [out] ``out_size`` is the size of the returned buffer in bytes. + +This function will return a pointer to the buffer containing the recorded WAV data or ``NULL`` if an error occurred. + +playWAV +^^^^^^^ + +Play a PCM WAV from memory with the current TX settings. + +.. code-block:: arduino + + void playWAV(uint8_t * data, size_t len) + +Parameters: + +* [in] ``data`` is the buffer containing the WAV data. + +* [in] ``len`` is the size of the buffer in bytes. + +playMP3 +^^^^^^^ + +Play a MP3 from memory with the current TX settings. + +.. code-block:: arduino + + bool playMP3(uint8_t *src, size_t src_len) + +Parameters: + +* [in] ``src`` is the buffer containing the MP3 data. + +* [in] ``src_len`` is the size of the buffer in bytes. + +This function will return ``true`` on success or ``false`` in case of failure. + +When failed, an error message will be printed if the correct log level is set. + +Sample code +----------- + +.. code-block:: arduino + + #include + + const int buff_size = 128; + int available, read; + uint8_t buffer[buff_size]; + I2SClass I2S; + + void setup() { + I2S.setPins(5, 25, 26, 35, 0); //SCK, WS, SDOUT, SDIN, MCLK + I2S.begin(I2S_MODE_STD, 16000, I2S_DATA_BIT_WIDTH_16BIT, I2S_SLOT_MODE_STEREO); + I2S.read(); + available = I2S.available(); + if(available < buff_size) { + read = I2S.read(buffer, available); + } else { + read = I2S.read(buffer, buff_size); + } + I2S.write(buffer, read); + I2S.end(); + } + + void loop() {} diff --git a/docs/source/api/insights.rst b/docs/en/api/insights.rst similarity index 100% rename from docs/source/api/insights.rst rename to docs/en/api/insights.rst diff --git a/docs/source/api/ledc.rst b/docs/en/api/ledc.rst similarity index 92% rename from docs/source/api/ledc.rst rename to docs/en/api/ledc.rst index b69f581f5bf..1abeea2f6ee 100644 --- a/docs/source/api/ledc.rst +++ b/docs/en/api/ledc.rst @@ -27,6 +27,7 @@ ledcAttach ********** This function is used to setup LEDC pin with given frequency and resolution. +LEDC channel will be selected automatically. .. code-block:: arduino @@ -41,6 +42,25 @@ This function is used to setup LEDC pin with given frequency and resolution. This function will return ``true`` if configuration is successful. If ``false`` is returned, error occurs and LEDC channel was not configured. +ledcAttachChannel +***************** + +This function is used to setup LEDC pin with given frequency, resolution and channel. + +.. code-block:: arduino + + bool ledcAttachChannel(uint8_t pin, uint32_t freq, uint8_t resolution, uint8_t channel); + +* ``pin`` select LEDC pin. +* ``freq`` select frequency of pwm. +* ``resolution`` select resolution for LEDC channel. +* ``channel`` select LEDC channel. + + * range is 1-14 bits (1-20 bits for ESP32). + +This function will return ``true`` if configuration is successful. +If ``false`` is returned, error occurs and LEDC channel was not configured. + ledcWrite ********* diff --git a/docs/source/api/preferences.rst b/docs/en/api/preferences.rst similarity index 98% rename from docs/source/api/preferences.rst rename to docs/en/api/preferences.rst index 33fb2b6042e..83ca6d820e9 100644 --- a/docs/source/api/preferences.rst +++ b/docs/en/api/preferences.rst @@ -177,6 +177,27 @@ Arduino-esp32 Preferences API **Note** * A message providing the reason for a failed call is sent to the arduino-esp32 ``log_e`` facility. + + +``isKey`` +************* + + Check if a key-value pair from the currently open namespace exists. + + .. code-block:: arduino + + bool isKey(const char * key) + .. + + **Parameters** + * ``key`` (Required) + - the name of the key to be checked. + + **Returns** + * ``true`` if key-value pair exists; ``false`` otherwise. + + **Note** + * Attempting to check a key without a namespace being open will return false. ``putChar, putUChar`` diff --git a/docs/source/api/pulse_counter.rst b/docs/en/api/pulse_counter.rst similarity index 100% rename from docs/source/api/pulse_counter.rst rename to docs/en/api/pulse_counter.rst diff --git a/docs/source/api/rainmaker.rst b/docs/en/api/rainmaker.rst similarity index 100% rename from docs/source/api/rainmaker.rst rename to docs/en/api/rainmaker.rst diff --git a/docs/source/api/reset_reason.rst b/docs/en/api/reset_reason.rst similarity index 100% rename from docs/source/api/reset_reason.rst rename to docs/en/api/reset_reason.rst diff --git a/docs/source/api/rmt.rst b/docs/en/api/rmt.rst similarity index 100% rename from docs/source/api/rmt.rst rename to docs/en/api/rmt.rst diff --git a/docs/source/api/sdio.rst b/docs/en/api/sdio.rst similarity index 100% rename from docs/source/api/sdio.rst rename to docs/en/api/sdio.rst diff --git a/docs/source/api/sdmmc.rst b/docs/en/api/sdmmc.rst similarity index 100% rename from docs/source/api/sdmmc.rst rename to docs/en/api/sdmmc.rst diff --git a/docs/source/api/sigmadelta.rst b/docs/en/api/sigmadelta.rst similarity index 100% rename from docs/source/api/sigmadelta.rst rename to docs/en/api/sigmadelta.rst diff --git a/docs/source/api/spi.rst b/docs/en/api/spi.rst similarity index 100% rename from docs/source/api/spi.rst rename to docs/en/api/spi.rst diff --git a/docs/source/api/timer.rst b/docs/en/api/timer.rst similarity index 100% rename from docs/source/api/timer.rst rename to docs/en/api/timer.rst diff --git a/docs/source/api/touch.rst b/docs/en/api/touch.rst similarity index 100% rename from docs/source/api/touch.rst rename to docs/en/api/touch.rst diff --git a/docs/source/api/usb.rst b/docs/en/api/usb.rst similarity index 100% rename from docs/source/api/usb.rst rename to docs/en/api/usb.rst diff --git a/docs/source/api/usb_cdc.rst b/docs/en/api/usb_cdc.rst similarity index 100% rename from docs/source/api/usb_cdc.rst rename to docs/en/api/usb_cdc.rst diff --git a/docs/source/api/usb_msc.rst b/docs/en/api/usb_msc.rst similarity index 100% rename from docs/source/api/usb_msc.rst rename to docs/en/api/usb_msc.rst diff --git a/docs/source/api/wifi.rst b/docs/en/api/wifi.rst similarity index 98% rename from docs/source/api/wifi.rst rename to docs/en/api/wifi.rst index c906cdaa588..010a11cfc1c 100644 --- a/docs/source/api/wifi.rst +++ b/docs/en/api/wifi.rst @@ -21,7 +21,7 @@ Working as AP In this mode, the ESP32 is configured as an Access Point (AP) and it's capable of receiving incoming connections from other devices (stations) by providing a Wi-Fi network. -.. figure:: ../_static/wifi_esp32_ap.png +.. figure:: ../../_static/wifi_esp32_ap.png :align: center :width: 520 :figclass: align-center @@ -33,7 +33,7 @@ Working as STA The STA mode is used to connect the ESP32 to a Wi-Fi network, provided by an Access Point. -.. figure:: ../_static/wifi_esp32_sta.png +.. figure:: ../../_static/wifi_esp32_sta.png :align: center :width: 520 :figclass: align-center @@ -327,14 +327,14 @@ Get the softAP subnet mask. IPAddress softAPSubnetMask(); -softAPenableIpV6 +softAPenableIPv6 **************** Function used to enable the IPv6 support. .. code-block:: arduino - bool softAPenableIpV6(); + bool softAPenableIPv6(bool enable=true); The function will return ``true`` if the configuration is successful. @@ -345,9 +345,9 @@ Function to get the IPv6 address. .. code-block:: arduino - IPv6Address softAPIPv6(); + IPAddress softAPIPv6(); -The function will return the AP IPv6 address in ``IPv6Address`` format. +The function will return the AP IPv6 address in ``IPAddress`` format. softAPgetHostname ***************** diff --git a/docs/source/boards/ESP32-C3-DevKitM-1.rst b/docs/en/boards/ESP32-C3-DevKitM-1.rst similarity index 98% rename from docs/source/boards/ESP32-C3-DevKitM-1.rst rename to docs/en/boards/ESP32-C3-DevKitM-1.rst index 7ce9475d69b..11e6e45d55f 100644 --- a/docs/source/boards/ESP32-C3-DevKitM-1.rst +++ b/docs/en/boards/ESP32-C3-DevKitM-1.rst @@ -88,7 +88,7 @@ No. Name Type [1]_ Function Pin Layout ---------- -.. figure:: ../_static/esp32-c3_devkitM-1_pinlayout.png +.. figure:: ../../_static/esp32-c3_devkitM-1_pinlayout.png :align: center :width: 600 :alt: ESP32-C3-DevKitM-1 (click to enlarge) diff --git a/docs/source/boards/ESP32-DevKitC-1.rst b/docs/en/boards/ESP32-DevKitC-1.rst similarity index 98% rename from docs/source/boards/ESP32-DevKitC-1.rst rename to docs/en/boards/ESP32-DevKitC-1.rst index dcd5632eab7..4bb86696227 100644 --- a/docs/source/boards/ESP32-DevKitC-1.rst +++ b/docs/en/boards/ESP32-DevKitC-1.rst @@ -96,7 +96,7 @@ No. Name Type Function Pin Layout ---------- -.. figure:: ../_static/esp32_devkitC_pinlayout.png +.. figure:: ../../_static/esp32_devkitC_pinlayout.png :align: center :width: 600 :alt: ESP32-DevKitC-1 (click to enlarge) diff --git a/docs/source/boards/ESP32-S2-Saola-1.rst b/docs/en/boards/ESP32-S2-Saola-1.rst similarity index 98% rename from docs/source/boards/ESP32-S2-Saola-1.rst rename to docs/en/boards/ESP32-S2-Saola-1.rst index fd41772c234..1a06a6d87bb 100644 --- a/docs/source/boards/ESP32-S2-Saola-1.rst +++ b/docs/en/boards/ESP32-S2-Saola-1.rst @@ -100,7 +100,7 @@ No. Name Type Function Pin Layout ---------- -.. figure:: ../_static/esp32-s2_saola1_pinlayout.png +.. figure:: ../../_static/esp32-s2_saola1_pinlayout.png :align: center :width: 600 :alt: ESP32-S2-Saola-1 (click to enlarge) diff --git a/docs/source/boards/boards.rst b/docs/en/boards/boards.rst similarity index 97% rename from docs/source/boards/boards.rst rename to docs/en/boards/boards.rst index 6214fe4ebd1..7115d5bcb4e 100644 --- a/docs/source/boards/boards.rst +++ b/docs/en/boards/boards.rst @@ -30,7 +30,7 @@ For each family, we have SoC variants with some differentiation. The differences The modules use the SoC internally, including the external flash, PSRAM (in some models) and other essential electronic components. Essentially, all modules from the same family use the same SoC. -.. figure:: ../_static/soc-module.png +.. figure:: ../../_static/soc-module.png :align: center :width: 250 :alt: ESP32 SoC and Module (click to enlarge) @@ -60,7 +60,7 @@ Before buying: Keep in mind that for some "must have" features when choosing the Espressif --------- -.. figure:: ../_static/logo_espressif.png +.. figure:: ../../_static/logo_espressif.png :align: center :width: 250 :alt: Espressif Logo diff --git a/docs/source/boards/generic.rst b/docs/en/boards/generic.rst similarity index 100% rename from docs/source/boards/generic.rst rename to docs/en/boards/generic.rst diff --git a/docs/source/common/datasheet.inc b/docs/en/common/datasheet.inc similarity index 100% rename from docs/source/common/datasheet.inc rename to docs/en/common/datasheet.inc diff --git a/docs/en/conf.py b/docs/en/conf.py new file mode 100644 index 00000000000..9979662dae0 --- /dev/null +++ b/docs/en/conf.py @@ -0,0 +1,31 @@ +# -*- coding: utf-8 -*- +# +# English Language RTD & Sphinx config file +# +# Uses ../conf_common.py for most non-language-specific settings. + +# Importing conf_common adds all the non-language-specific +# parts to this conf module + +try: + from conf_common import * # noqa: F403,F401 +except ImportError: + import os + import sys + sys.path.insert(0, os.path.abspath('../')) + from conf_common import * # noqa: F403,F401 + +import datetime +current_year = datetime.datetime.now().year + +# General information about the project. +project = u'Arduino ESP32' +copyright = u'2016 - {}, Espressif Systems (Shanghai) Co., Ltd'.format(current_year) +pdf_title = u'Arduino ESP32 Documentation Guide' + +# The language for content autogenerated by Sphinx. Refer to documentation +# for a list of supported languages. +language = 'en' + +# Tracking ID for Google Analytics +google_analytics_id = 'G-F58JM78930' \ No newline at end of file diff --git a/docs/source/contributing.rst b/docs/en/contributing.rst similarity index 100% rename from docs/source/contributing.rst rename to docs/en/contributing.rst diff --git a/docs/source/esp-idf_component.rst b/docs/en/esp-idf_component.rst similarity index 93% rename from docs/source/esp-idf_component.rst rename to docs/en/esp-idf_component.rst index efecff594f3..c6dbe68e662 100644 --- a/docs/source/esp-idf_component.rst +++ b/docs/en/esp-idf_component.rst @@ -73,16 +73,17 @@ After the setup you can save and exit: - Close confirmation window [Enter] or [Space] or [Esc] - Quit [Q] -Option 1. Using Arduino setup() and loop() -****************************************** +As the Arduino libraries use C++ features, you will need to swap some file extensions from ``.c`` to ``.cpp``: - In main folder rename file `main.c` to `main.cpp`. +- In main folder open file `CMakeLists.txt` and change `main.c` to `main.cpp` as described below. -- In main folder open file `CMakeList.txt` and change `main.c` to `main.cpp` as described below. +Option 1. Using Arduino setup() and loop() +****************************************** -- Your main.cpp should be formatted like any other sketch. +Your main.cpp should be formatted like any other sketch. Don't forget to include ``Arduino.h``. -.. code-block:: c +.. code-block:: cpp //file: main.cpp #include "Arduino.h" @@ -102,14 +103,14 @@ Option 1. Using Arduino setup() and loop() Option 2. Using ESP-IDF appmain() ********************************* -In main.c or main.cpp you need to implement ``app_main()`` and call ``initArduino();`` in it. +In main.cpp you need to implement ``app_main()`` and call ``initArduino();`` in it. Keep in mind that setup() and loop() will not be called in this case. Furthermore the ``app_main()`` is single execution as a normal function so if you need an infinite loop as in Arduino place it there. .. code-block:: cpp - //file: main.c or main.cpp + //file: main.cpp #include "Arduino.h" extern "C" void app_main() @@ -141,7 +142,7 @@ Build, flash and monitor - After a successful flash, you may need to press the RST button again - - To terminate the serial monitor press [Ctrl] + [ ] ] + - To terminate the serial monitor press ``Ctrl`` + ``]`` Logging To Serial ----------------- @@ -179,7 +180,7 @@ Download the library: .. code-block:: bash - cd ~/esp/esp-idf/components/arduino-esp32/ + cd ~/esp/esp-idf/components/arduino/ git clone --recursive git@github.com:Author/new_library.git libraries/new_library diff --git a/docs/source/external_libraries_test.rst b/docs/en/external_libraries_test.rst similarity index 94% rename from docs/source/external_libraries_test.rst rename to docs/en/external_libraries_test.rst index 2064987df07..0d7da671cd2 100644 --- a/docs/source/external_libraries_test.rst +++ b/docs/en/external_libraries_test.rst @@ -104,7 +104,7 @@ You can check the results in `LIBRARIES_TEST.md`_. The results file example: -.. image:: _static/external_library_test_schedule.png +.. image:: ../_static/external_library_test_schedule.png :width: 600 Pull Request test result @@ -113,18 +113,18 @@ Pull Request test result If the test run on Pull Request, it will compile all libraries and sketches 2 times (before/after changes in PR) to see, if the PR is breaking/fixing libraries. In the table the results are in order ``BEFORE -> AFTER``. -.. image:: _static/external_library_test_pr.png +.. image:: ../_static/external_library_test_pr.png :width: 600 -.. |success| image:: _static/green_checkmark.png +.. |success| image:: ../_static/green_checkmark.png :height: 2ex :class: no-scaled-link -.. |warning| image:: _static/warning.png +.. |warning| image:: ../_static/warning.png :height: 2ex :class: no-scaled-link -.. |fail| image:: _static/cross.png +.. |fail| image:: ../_static/cross.png :height: 2ex :class: no-scaled-link diff --git a/docs/source/faq.rst b/docs/en/faq.rst similarity index 100% rename from docs/source/faq.rst rename to docs/en/faq.rst diff --git a/docs/source/getting_started.rst b/docs/en/getting_started.rst similarity index 95% rename from docs/source/getting_started.rst rename to docs/en/getting_started.rst index 3540dda685b..9267f1b427f 100644 --- a/docs/source/getting_started.rst +++ b/docs/en/getting_started.rst @@ -64,9 +64,9 @@ Supported Operating Systems | Windows | Linux | macOS | +-------------------+-------------------+-------------------+ -.. |windows-logo| image:: _static/logo_windows.png -.. |linux-logo| image:: _static/logo_linux.png -.. |macos-logo| image:: _static/logo_macos.png +.. |windows-logo| image:: ../_static/logo_windows.png +.. |linux-logo| image:: ../_static/logo_linux.png +.. |macos-logo| image:: ../_static/logo_macos.png Supported IDEs --------------------------- @@ -79,8 +79,8 @@ Here is the list of supported IDE for Arduino ESP32 support integration. | Arduino IDE | PlatformIO | +-------------------+-------------------+ -.. |arduino-logo| image:: _static/logo_arduino.png -.. |pio-logo| image:: _static/logo_pio.png +.. |arduino-logo| image:: ../_static/logo_arduino.png +.. |pio-logo| image:: ../_static/logo_pio.png See `Installing Guides `_ for more details on how to install the Arduino ESP32 support. diff --git a/docs/source/guides/core_debug.rst b/docs/en/guides/core_debug.rst similarity index 100% rename from docs/source/guides/core_debug.rst rename to docs/en/guides/core_debug.rst diff --git a/docs/source/guides/docs_contributing.rst b/docs/en/guides/docs_contributing.rst similarity index 98% rename from docs/source/guides/docs_contributing.rst rename to docs/en/guides/docs_contributing.rst index be5a54e4b37..d0089a5fd9f 100644 --- a/docs/source/guides/docs_contributing.rst +++ b/docs/en/guides/docs_contributing.rst @@ -97,7 +97,7 @@ If everything is ok, you will see some output logs similar to this one: writing output... [100%] tutorials/tutorials generating indices... genindexdone writing additional pages... searchdone - copying images... [100%] tutorials/../_static/tutorials/peripherals/tutorial_peripheral_diagram.png + copying images... [100%] tutorials/../../_static/tutorials/peripherals/tutorial_peripheral_diagram.png copying static files... ... done copying extra files... done dumping search index in English (code: en)... done @@ -309,7 +309,7 @@ After that, you can use the following structure to include the image in the docs .. code-block:: - .. figure:: ../_static/arduino_i2c_master.png + .. figure:: ../../_static/arduino_i2c_master.png :align: center :width: 720 :figclass: align-center diff --git a/docs/source/guides/guides.rst b/docs/en/guides/guides.rst similarity index 100% rename from docs/source/guides/guides.rst rename to docs/en/guides/guides.rst diff --git a/docs/source/guides/tools_menu.rst b/docs/en/guides/tools_menu.rst similarity index 99% rename from docs/source/guides/tools_menu.rst rename to docs/en/guides/tools_menu.rst index 96b3bcc3674..41c8878bf6e 100644 --- a/docs/source/guides/tools_menu.rst +++ b/docs/en/guides/tools_menu.rst @@ -240,7 +240,7 @@ The USB Mass Storage Class, or USB MSC, is a class used for storage devices, lik This option can be used to ``Enable`` or ``Disable`` this function at the boot. If this option is ``Enabled``, once the device is connected via USB, one new storage device will appear in the system as a storage drive. Use this new storage drive to write and read files or to drop a new firmware binary to flash the device. -.. figure:: ../_static/usb_msc_drive.png +.. figure:: ../../_static/usb_msc_drive.png :align: center :width: 720 :figclass: align-center diff --git a/docs/source/index.rst b/docs/en/index.rst similarity index 100% rename from docs/source/index.rst rename to docs/en/index.rst diff --git a/docs/source/installing.rst b/docs/en/installing.rst similarity index 95% rename from docs/source/installing.rst rename to docs/en/installing.rst index 3b5554baf32..3acabd5505c 100644 --- a/docs/source/installing.rst +++ b/docs/en/installing.rst @@ -13,7 +13,7 @@ To install Arduino-ESP32 support, you can use one of the following options. Installing using Arduino IDE ---------------------------- -.. figure:: _static/logo_arduino.png +.. figure:: ../_static/logo_arduino.png :align: center :width: 200 :figclass: align-center @@ -42,21 +42,21 @@ To start the installation process using the Boards Managaer, follow these steps: - Start Arduino and open the Preferences window. -.. figure:: _static/install_guide_preferences.png +.. figure:: ../_static/install_guide_preferences.png :align: center :width: 600 :figclass: align-center - Enter one of the release links above into *Additional Board Manager URLs* field. You can add multiple URLs, separating them with commas. -.. figure:: _static/install_guide_boards_manager_url.png +.. figure:: ../_static/install_guide_boards_manager_url.png :align: center :width: 600 :figclass: align-center - Open Boards Manager from Tools > Board menu and install *esp32* platform (and do not forget to select your ESP32 board from Tools > Board menu after installation). -.. figure:: _static/install_guide_boards_manager_esp32.png +.. figure:: ../_static/install_guide_boards_manager_esp32.png :align: center :width: 600 :figclass: align-center @@ -66,7 +66,7 @@ To start the installation process using the Boards Managaer, follow these steps: Installing using PlatformIO --------------------------- -.. figure:: _static/logo_pio.png +.. figure:: ../_static/logo_pio.png :align: center :width: 200 :figclass: align-center @@ -166,7 +166,7 @@ Steps to install Arduino ESP32 support on Windows: - Select ``Clone Existing Repository`` -.. figure:: _static/win-gui-1.png +.. figure:: ../_static/win-gui-1.png :align: center :width: 600 :figclass: align-center @@ -179,13 +179,13 @@ Steps to install Arduino ESP32 support on Windows: **Step 2** -.. figure:: _static/win-gui-2.png +.. figure:: ../_static/win-gui-2.png :align: center :figclass: align-center **Step 3** -.. figure:: _static/win-gui-3.png +.. figure:: ../_static/win-gui-3.png :align: center :figclass: align-center @@ -194,7 +194,7 @@ Steps to install Arduino ESP32 support on Windows: **Step 4** -.. figure:: _static/win-gui-4.png +.. figure:: ../_static/win-gui-4.png :align: center :figclass: align-center @@ -202,7 +202,7 @@ Steps to install Arduino ESP32 support on Windows: **Step 5** -.. figure:: _static/win-gui-5.png +.. figure:: ../_static/win-gui-5.png :align: center :figclass: align-center @@ -212,7 +212,7 @@ Steps to install Arduino ESP32 support on Windows: 4. Select the COM port that the board is attached to 5. Compile and upload (You might need to hold the boot button while uploading) -.. figure:: _static/arduino-ide.png +.. figure:: ../_static/arduino-ide.png :align: center :figclass: align-center @@ -221,27 +221,27 @@ How to update to the latest code 1. Start ``Git GUI`` and you should see the repository under ``Open Recent Repository``. Click on it! -.. figure:: _static/win-gui-update-1.png +.. figure:: ../_static/win-gui-update-1.png :align: center :figclass: align-center 1. From menu ``Remote`` select ``Fetch from`` > ``origin`` -.. figure:: _static/win-gui-update-2.png +.. figure:: ../_static/win-gui-update-2.png :align: center :figclass: align-center 1. Wait for git to pull any changes and close ``Git GUI`` 2. Open ``[ARDUINO_SKETCHBOOK_DIR]/hardware/espressif/esp32/tools`` and double-click ``get.exe`` -.. figure:: _static/win-gui-4.png +.. figure:: ../_static/win-gui-4.png :align: center :figclass: align-center Linux ----- -.. figure:: _static/logo_linux.png +.. figure:: ../_static/logo_linux.png :align: center :width: 200 :figclass: align-center diff --git a/docs/source/lib_builder.rst b/docs/en/lib_builder.rst similarity index 100% rename from docs/source/lib_builder.rst rename to docs/en/lib_builder.rst diff --git a/docs/source/libraries.rst b/docs/en/libraries.rst similarity index 91% rename from docs/source/libraries.rst rename to docs/en/libraries.rst index 8c5357150a3..a3c32b4d6dd 100644 --- a/docs/source/libraries.rst +++ b/docs/en/libraries.rst @@ -24,7 +24,7 @@ Currently, the Arduino ESP32 supports the following peripherals with Arduino API +---------------+---------------+---------------+---------------+---------------+-----+------------------------+ | GPIO | Yes | Yes | Yes | Yes | | | +---------------+---------------+---------------+---------------+---------------+-----+------------------------+ -| Hall Sensor | Yes | Not Supported | Not Supported | Not Supported | | | +| Hall Sensor | Not Supported | Not Supported | Not Supported | Not Supported | | | +---------------+---------------+---------------+---------------+---------------+-----+------------------------+ | I2C | Yes | Yes | Yes | Yes | | | +---------------+---------------+---------------+---------------+---------------+-----+------------------------+ @@ -71,6 +71,11 @@ APIs The Arduino ESP32 offers some unique APIs, described in this section: +.. note:: + Please be advised that we cannot ensure continuous compatibility between the Arduino Core ESP32 APIs and ESP8266 APIs, as well as Arduino-Core APIs (Arduino.cc). + While our aim is to maintain harmony, the addition of new features may result in occasional divergence. We strive to achieve the best possible integration but acknowledge + that perfect compatibility might not always be feasible. Please refer to the documentation for any specific considerations. + .. toctree:: :maxdepth: 1 :glob: diff --git a/docs/source/make.rst b/docs/en/make.rst similarity index 100% rename from docs/source/make.rst rename to docs/en/make.rst diff --git a/docs/source/migration_guides/2.x_to_3.0.rst b/docs/en/migration_guides/2.x_to_3.0.rst similarity index 100% rename from docs/source/migration_guides/2.x_to_3.0.rst rename to docs/en/migration_guides/2.x_to_3.0.rst diff --git a/docs/source/migration_guides/migration_guides.rst b/docs/en/migration_guides/migration_guides.rst similarity index 100% rename from docs/source/migration_guides/migration_guides.rst rename to docs/en/migration_guides/migration_guides.rst diff --git a/docs/source/ota_web_update.rst b/docs/en/ota_web_update.rst similarity index 94% rename from docs/source/ota_web_update.rst rename to docs/en/ota_web_update.rst index be0a6d5e263..179101770a0 100644 --- a/docs/source/ota_web_update.rst +++ b/docs/en/ota_web_update.rst @@ -39,14 +39,14 @@ Prepare the sketch and configuration for initial upload with a serial port - Update ssid and pass in the sketch so the module can join your Wi-Fi network - Open File > Preferences, look for “Show verbose output during:” and check out “compilation” option -.. figure:: _static/ota_esp32_verbose.png +.. figure:: ../_static/ota_esp32_verbose.png :align: center :figclass: align-center - Upload sketch (Ctrl+U) - Now open web browser and enter the url, i.e. http://esp32.local. Once entered, browser should display a form -.. figure:: _static/ota_esp32_login.png +.. figure:: ../_static/ota_esp32_login.png :align: center :figclass: align-center @@ -59,7 +59,7 @@ Prepare the sketch and configuration for initial upload with a serial port Now click on the Login button and browser will display an upload form -.. figure:: _static/ota_esp32_upload.png +.. figure:: ../_static/ota_esp32_upload.png :align: center :figclass: align-center @@ -70,7 +70,7 @@ Exporting Binary file of the Firmware (Code) - Open up the Code, for Exporting up Binary file - Now go to Sketch > export compiled Binary -.. figure:: _static/ota_export_to_binary.png +.. figure:: ../_static/ota_export_to_binary.png :align: center :figclass: align-center diff --git a/docs/source/troubleshooting.rst b/docs/en/troubleshooting.rst similarity index 100% rename from docs/source/troubleshooting.rst rename to docs/en/troubleshooting.rst diff --git a/docs/source/tutorials/basic.rst b/docs/en/tutorials/basic.rst similarity index 97% rename from docs/source/tutorials/basic.rst rename to docs/en/tutorials/basic.rst index 34d9a05c094..8b932987bea 100644 --- a/docs/source/tutorials/basic.rst +++ b/docs/en/tutorials/basic.rst @@ -21,7 +21,7 @@ Here are the steps for this tutorial. 1. Open the Arduino IDE -.. figure:: ../_static/tutorials/basic/tutorial_basic_ide.png +.. figure:: ../../_static/tutorials/basic/tutorial_basic_ide.png :align: center :width: 600 :alt: Arduino IDE (click to enlarge) diff --git a/docs/source/tutorials/blink.rst b/docs/en/tutorials/blink.rst similarity index 100% rename from docs/source/tutorials/blink.rst rename to docs/en/tutorials/blink.rst diff --git a/docs/source/tutorials/cdc_dfu_flash.rst b/docs/en/tutorials/cdc_dfu_flash.rst similarity index 100% rename from docs/source/tutorials/cdc_dfu_flash.rst rename to docs/en/tutorials/cdc_dfu_flash.rst diff --git a/docs/source/tutorials/io_mux.rst b/docs/en/tutorials/io_mux.rst similarity index 98% rename from docs/source/tutorials/io_mux.rst rename to docs/en/tutorials/io_mux.rst index 12e0a9c9c0c..03b10449013 100644 --- a/docs/source/tutorials/io_mux.rst +++ b/docs/en/tutorials/io_mux.rst @@ -23,7 +23,7 @@ GPIO Matrix and Pin Mux The ESP32 architecture includes the capability of configuring some peripherals to any of the GPIOs pins, managed by the `IO MUX GPIO`_. Essentially, this capability means that we can route the internal peripheral into a different physical pin using the IO MUX and the GPIO Matrix. -.. figure:: ../_static/tutorials/peripherals/tutorial_peripheral_diagram.png +.. figure:: ../../_static/tutorials/peripherals/tutorial_peripheral_diagram.png :align: center :width: 600 :figclass: align-center diff --git a/docs/source/tutorials/partition_table.rst b/docs/en/tutorials/partition_table.rst similarity index 100% rename from docs/source/tutorials/partition_table.rst rename to docs/en/tutorials/partition_table.rst diff --git a/docs/source/tutorials/preferences.rst b/docs/en/tutorials/preferences.rst similarity index 100% rename from docs/source/tutorials/preferences.rst rename to docs/en/tutorials/preferences.rst diff --git a/docs/source/tutorials/tutorials.rst b/docs/en/tutorials/tutorials.rst similarity index 100% rename from docs/source/tutorials/tutorials.rst rename to docs/en/tutorials/tutorials.rst diff --git a/docs/make.bat b/docs/make.bat deleted file mode 100644 index 6247f7e2317..00000000000 --- a/docs/make.bat +++ /dev/null @@ -1,35 +0,0 @@ -@ECHO OFF - -pushd %~dp0 - -REM Command file for Sphinx documentation - -if "%SPHINXBUILD%" == "" ( - set SPHINXBUILD=sphinx-build -) -set SOURCEDIR=source -set BUILDDIR=build - -if "%1" == "" goto help - -%SPHINXBUILD% >NUL 2>NUL -if errorlevel 9009 ( - echo. - echo.The 'sphinx-build' command was not found. Make sure you have Sphinx - echo.installed, then set the SPHINXBUILD environment variable to point - echo.to the full path of the 'sphinx-build' executable. Alternatively you - echo.may add the Sphinx directory to PATH. - echo. - echo.If you don't have Sphinx installed, grab it from - echo.http://sphinx-doc.org/ - exit /b 1 -) - -%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% -goto end - -:help -%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% - -:end -popd diff --git a/docs/requirements.txt b/docs/requirements.txt index da0d937707a..71b14c5c135 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -1,7 +1,3 @@ -# This is a list of python packages used to generate documentation. This file is used with pip: -# pip install --user -r requirements.txt -# -# matplotlib is currently required only by the script generate_chart.py -sphinx-rtd-theme +esp-docs>=1.4.0 sphinx-copybutton==0.5.0 -sphinx-tabs==3.2.0 \ No newline at end of file +sphinx-tabs==3.2.0 diff --git a/docs/source/api/i2s.rst b/docs/source/api/i2s.rst deleted file mode 100644 index 02539fb3f2b..00000000000 --- a/docs/source/api/i2s.rst +++ /dev/null @@ -1,566 +0,0 @@ -### -I2S -### - -About ------ - -I2S - Inter-IC Sound, correctly written I²S pronounced "eye-squared-ess", alternative notation is IIS. I²S is an electrical serial bus interface standard used for connecting digital audio devices together. - -It is used to communicate PCM (Pulse-Code Modulation) audio data between integrated circuits in an electronic device. The I²S bus separates clock and serial data signals, resulting in simpler receivers than those required for asynchronous communications systems that need to recover the clock from the data stream. - -Despite the similar name, I²S is unrelated and incompatible with the bidirectional I²C (IIC) bus. - -The I²S bus consists of at least three lines: - -.. note:: All lines can be attached to almost any pin and this change can occur even during operation. - -* **Bit clock line** - - * Officially "continuous serial clock (SCK)". Typically written "bit clock (BCLK)". - * In this library function parameter ``sckPin`` or constant ``PIN_I2S_SCK``. - -* **Word clock line** - - * Officially "word select (WS)". Typically called "left-right clock (LRCLK)" or "frame sync (FS)". - * 0 = Left channel, 1 = Right channel - * In this library function parameter ``fsPin`` or constant ``PIN_I2S_FS``. - -* **Data line** - - * Officially "serial data (SD)", but can be called SDATA, SDIN, SDOUT, DACDAT, ADCDAT, etc. - * Unlike Arduino I2S with single data pin switching between input and output, in ESP core driver use separate data line for input and output. - * For backward compatibility, the shared data pin is ``sdPin`` or constant ``PIN_I2S_SD`` when using simplex mode. - - * When using in duplex mode, there are two data lines: - - * Output data line is called ``outSdPin`` for function parameter, or constant ``PIN_I2S_SD_OUT`` - * Input data line is called ``inSdPin`` for function parameter, or constant ``PIN_I2S_SD_IN`` - -I2S Modes ---------- - -The I2S can be set up in three groups of modes: - -* Master (default) or Slave. -* Simplex (default) or Duplex. -* Operation modes (Philips standard, ADC/DAC, PDM) - - * Most of them are dual-channel, some can be single channel - -.. note:: Officially supported operation mode is only ``I2S_PHILIPS_MODE``. Other modes are implemented, but we cannot guarantee flawless execution and behavior. - -Master / Slave Mode -******************* - -In **Master mode** (default) the device is generating clock signal ``sckPin`` and word select signal on ``fsPin``. - -In **Slave mode** the device listens on attached pins for the clock signal and word select - i.e. unless externally driven the pins will remain LOW. - -How to enter either mode is described in the function section. - -Operation Modes -*************** - -Setting the operation mode is done with function ``begin`` (see API section) - -* ``I2S_PHILIPS_MODE`` - * Currently the only official* ``PIN_I2S_SCK`` -* ``PIN_I2S_FS`` -* ``PIN_I2S_SD`` -* ``PIN_I2S_SD_OUT`` only need to send one channel data but the data will be copied for another channel automatically, then both channels will transmit same data. - -* ``ADC_DAC_MODE`` - The output will be an analog signal on pins ``25`` (L or R?) and ``26`` (L or R?). - Input will be received on pin ``_inSdPin``. - The data are sampled in 12 bits and stored in a 16 bits, with the 4 most significant bits set to zero. - -* ``PDM_STEREO_MODE`` - Pulse-density-modulation is similar to PWM, but instead, the pulses have constant width. The signal is modulated with the number of ones or zeroes in sequence. - -* ``PDM_MONO_MODE`` - Single-channel version of PDM mode described above. - -Simplex / Duplex Mode -********************* - -The **Simplex** mode is the default after driver initialization. Simplex mode uses the shared data pin ``sdPin`` or constant ``PIN_I2S_SD`` for both output and input, but can only read or write. This is the same behavior as in original Arduino library. - -The **Duplex** mode uses two separate data pins: - -* Output pin ``outSdPin`` for function parameter, or constant ``PIN_I2S_SD_OUT`` -* Input pin ``inSdPin`` for function parameter, or constant ``PIN_I2S_SD_IN`` - -In this mode, the driver is able to read and write simultaneously on each line and is suitable for applications like walkie-talkie or phone. - -Switching between these modes is performed simply by calling setDuplex() or setSimplex() (see APi section for details and more functions). - -Arduino-ESP32 I2S API ---------------------- - -The ESP32 I2S library is based on the Arduino I2S Library and implements a few more APIs, described in this `documentation `_. - -Initialization and deinitialization -*********************************** - -Before initialization, choose which pins you want to use. In DAC mode you can use only pins `25` and `26` for the output. - -begin (Master Mode) -^^^^^^^^^^^^^^^^^^^ - -Before usage choose which pins you want to use. In DAC mode you can use only pins 25 and 26 as output. - -.. code-block:: arduino - - int begin(int mode, int sampleRate, int bitsPerSample) - -Parameters: - -* [in] ``mode`` one of above mentioned operation mode, for example ``I2S_PHILIPS_MODE``. - -* [in] ``sampleRate`` is the sampling rate in Hz. Currently officially supported value is only 16000 - other than this value will print warning, but continue to operate, however the resulting audio quality may suffer and the app may crash. - -* [in] ``bitsPerSample`` is the number of bits in a channel sample. - -Currently, the supported value is only 16 - other than this value will print a warning, but continues to operate, however, the resulting audio quality may suffer and the application may crash. - -For ``ADC_DAC_MODE`` the only possible value will remain 16. - -This function will return ``true`` on success or ``fail`` in case of failure. - -When failed, an error message will be printed if subscribed. - -begin (Slave Mode) -^^^^^^^^^^^^^^^^^^ - -Performs initialization before use - creates buffers, task handling underlying driver messages, configuring and starting the driver operation. - -This version initializes I2S in SLAVE mode (see previous entry for MASTER mode). - -.. code-block:: arduino - - int begin(int mode, int bitsPerSample) - -Parameters: - -* [in] ``mode`` one of above mentioned modes for example ``I2S_PHILIPS_MODE``. - -* [in] ``bitsPerSample`` is the umber of bits in a channel sample. Currently, the only supported value is only 16 - other than this value will print warning, but continue to operate, however the resulting audio quality may suffer and the app may crash. - -For ``ADC_DAC_MODE`` the only possible value will remain 16. - -This function will return ``true`` on success or ``fail`` in case of failure. - -When failed, an error message will be printed if subscribed. - -end -^^^ - -Performs safe deinitialization - free buffers, destroy task, end driver operation, etc. - -.. code-block:: arduino - - void end() - -Pin setup -********* - -Pins can be changed in two ways- 1st constants, 2nd functions. - -.. note:: Shared data pin can be equal to any other data pin, but must not be equal to clock pin nor frame sync pin! Input and Output pins must not be equal, but one of them can be equal to shared data pin! - -.. code-block:: arduino - - sckPin != fsPin != outSdPin != inSdPin - -.. code-block:: arduino - - sckPin != fsPin != sdPin - -By default, the pin numbers are defined in constants in the header file. You can redefine any of those constants before including ``I2S.h``. This way the driver will use these new default values and you will not need to specify pins in your code. The constants and their default values are: - -* ``PIN_I2S_SCK`` 14 -* ``PIN_I2S_FS`` 25 -* ``PIN_I2S_SD`` 26 -* ``PIN_I2S_SD_OUT`` 26 -* ``PIN_I2S_SD_IN`` 35 - -The second option to change pins is using the following functions. These functions can be called on either on initialized or uninitialized object. - -If called on the initialized object (after calling ``begin``) the pins will change during operation. -If called on the uninitialized object (before calling ``begin``, or after calling ``end``) the new pin setup will be used on next initialization. - -setSckPin -^^^^^^^^^ - -Set and apply clock pin. - -.. code-block:: arduino - - int setSckPin(int sckPin) - -This function will return ``true`` on success or ``fail`` in case of failure. - -setFsPin -^^^^^^^^ - -Set and apply frame sync pin. - -.. code-block:: arduino - - int setFsPin(int fsPin) - -This function will return ``true`` on success or ``fail`` in case of failure. - -setDataPin -^^^^^^^^^^ - -Set and apply shared data pin used in simplex mode. - -.. code-block:: arduino - - int setDataPin(int sdPin) - -This function will return ``true`` on success or ``fail`` in case of failure. - -setDataInPin -^^^^^^^^^^^^ - -Set and apply data input pin. - -.. code-block:: arduino - - int setDataInPin(int inSdPin) - -This function will return ``true`` on success or ``fail`` in case of failure. - -setDataOutPin -^^^^^^^^^^^^^ - -Set and apply data output pin. - -.. code-block:: arduino - - int setDataOutPin(int outSdPin) - -This function will return ``true`` on success or ``fail`` in case of failure. - -setAllPins -^^^^^^^^^^ - -Set all pins using given values in parameters. This is simply a wrapper of four functions mentioned above. - -.. code-block:: arduino - - int setAllPins(int sckPin, int fsPin, int sdPin, int outSdPin, int inSdPin) - -Set all pins to default i.e. take values from constants mentioned above. This simply calls the the function with the following constants. - -* ``PIN_I2S_SCK`` 14 -* ``PIN_I2S_FS`` 25 -* ``PIN_I2S_SD`` 26 -* ``PIN_I2S_SD_OUT`` 26 -* ``PIN_I2S_SD_IN`` 35 - -.. code-block:: arduino - - int setAllPins() - -getSckPin -^^^^^^^^^ - -Get the current value of the clock pin. - -.. code-block:: arduino - - int getSckPin() - -getFsPin -^^^^^^^^ - -Get the current value of frame sync pin. - -.. code-block:: arduino - - int getFsPin() - -getDataPin -^^^^^^^^^^ - -Get the current value of shared data pin. - -.. code-block:: arduino - - int getDataPin() - -getDataInPin -^^^^^^^^^^^^ - -Get the current value of data input pin. - -.. code-block:: arduino - - int getDataInPin() - -getDataOutPin -^^^^^^^^^^^^^ - -Get the current value of data output pin. - -.. code-block:: arduino - - int getDataOutPin() - -onTransmit -^^^^^^^^^^ - -Register the function to be called on each successful transmit event. - -.. code-block:: arduino - - void onTransmit(void(*)(void)) - -onReceive -^^^^^^^^^ - -Register the function to be called on each successful receives event. - -.. code-block:: arduino - - void onReceive(void(*)(void)) - -setBufferSize -^^^^^^^^^^^^^ - -Set the size of buffer. - -.. code-block:: arduino - - int setBufferSize(int bufferSize) - -This function can be called on both the initialized or uninitialized driver. - -If called on initialized, it will change internal values for buffer size and re-initialize driver with new value. -If called on uninitialized, it will only change the internal values which will be used for next initialization. - -Parameter ``bufferSize`` must be in range from 8 to 1024 and the unit is sample words. The default value is 128. - -Example: 16 bit sample, dual channel, buffer size for input: - - ``128 = 2B sample * 2 channels * 128 buffer size * buffer count (default 2) = 1024B`` - -And more ```1024B`` for output buffer in total of ``2kB`` used. - -This function always assumes dual-channel, keeping the same size even for MONO modes. - -This function will return ``true`` on success or ``fail`` in case of failure. - -When failed, an error message will be printed. - -getBufferSize -^^^^^^^^^^^^^ - -Get current buffer sizes in sample words (see description for ``setBufferSize``). - -.. code-block:: arduino - - int getBufferSize() - -Duplex vs Simplex -***************** - -Original Arduino I2S library supports only *simplex* mode (only transmit or only receive at a time). For compatibility, we kept this behavior, but ESP natively supports *duplex* mode (receive and transmit simultaneously on separate pins). -By default this library is initialized in simplex mode as it would in Arduino, switching input and output on ``sdPin`` (constant ``PIN_I2S_SD`` default pin 26). - -setDuplex -^^^^^^^^^ - -Switch to duplex mode and use separate pins: - -.. code-block:: arduino - - int setDuplex() - -input: inSdPin (constant PIN_I2S_SD_IN, default 35) -output: outSdPin (constant PIN_I2S_SD, default 26) - -setSimplex -^^^^^^^^^^ - -(Default mode) - -Switch to simplex mode using shared data pin sdPin (constant PIN_I2S_SD, default 26). - -.. code-block:: arduino - - int setSimplex() - -isDuplex -^^^^^^^^ - -Returns 1 if current mode is duplex, 0 if current mode is simplex (default). - -.. code-block:: arduino - - int isDuplex() - -Data stream -*********** - -available -^^^^^^^^^ - -Returns number of **bytes** ready to read. - -.. code-block:: arduino - - int available() - -read -^^^^ - -Read ``size`` bytes from internal buffer if possible. - -.. code-block:: arduino - - int read(void* buffer, size_t size) - -This function is non-blocking, i.e. if the requested number of bytes is not available, it will return as much as possible without waiting. - -Hint: use ``available()`` before calling this function. - -Parameters: - -[out] ``void* buffer`` buffer into which will be copied data read from internal buffer. WARNING: this buffer must be allocated before use! - -[in] ``size_t size`` number of bytes required to be read. - -Returns number of successfully bytes read. Returns ``false``` in case of reading error. - -Read one sample. - -.. code-block:: arduino - - int read() - -peek -^^^^ - -Read one sample from the internal buffer and returns it. - -.. code-block:: arduino - - int peek() - -Repeated peeks will be returned in the same sample until ``read`` is called. - -flush -^^^^^ - -Force write internal buffer to driver. - -.. code-block:: arduino - - void flush() - -write -^^^^^ - -Write a single byte. - -.. code-block:: arduino - - size_t write(uint8_t) - -Single-sample writes are blocking - waiting until there is free space in the internal buffer to be written into. - -Returns number of successfully written bytes, in this case, 1. Returns 0 on error. - -Write single sample. - -.. code-block:: arduino - - size_t write(int32_t) - -Single-sample writes are blocking - waiting until there is free space in the internal buffer to be written into. - -Returns number of successfully written bytes. Returns 0 on error. - -Expected return number is ``bitsPerSample/8``. - -Write buffer of supplied size; - -.. code-block:: arduino - - size_t write(const void *buffer, size_t size) - -Parameters: - -[in] ``const void *buffer`` buffer to be written -[in] ``size_t size`` size of buffer in bytes - -Returns number of successfully written bytes. Returns 0 in case of error. -The expected return number is equal to ``size``. - -write -^^^^^ - -This is a wrapper of the previous function performing typecast from `uint8_t*`` to ``void*``. - -.. code-block:: arduino - - size_t write(const uint8_t *buffer, size_t size) - -availableForWrite -^^^^^^^^^^^^^^^^^ - -Returns number of bytes available for write. - -.. code-block:: arduino - - int availableForWrite() - -write_blocking -^^^^^^^^^^^^^^ - -Core function implementing blocking write, i.e. waits until all requested data are written. - -.. code-block:: arduino - - size_t write_blocking(const void *buffer, size_t size) - -WARNING: If too many bytes are requested, this can cause WatchDog Trigger Reset! - -Returns number of successfully written bytes. Returns 0 on error. - -write_nonblocking -^^^^^^^^^^^^^^^^^ - -Core function implementing non-blocking write, i.e. writes as much as possible and exits. - -.. code-block:: arduino - - size_t write_nonblocking(const void *buffer, size_t size) - -Returns number of successfully written bytes. Returns 0 on error. - -Sample code ------------ - -.. code-block:: c - - #include - const int buff_size = 128; - int available, read; - uint8_t buffer[buff_size]; - - I2S.begin(I2S_PHILIPS_MODE, 16000, 16); - I2S.read(); // Switch the driver in simplex mode to receive - available = I2S.available(); - if(available < buff_size){ - read = I2S.read(buffer, available); - }else{ - read = I2S.read(buffer, buff_size); - } - I2S.write(buffer, read); - I2S.end(); diff --git a/docs/source/conf.py b/docs/source/conf.py deleted file mode 100644 index 47b30b912ed..00000000000 --- a/docs/source/conf.py +++ /dev/null @@ -1,72 +0,0 @@ -# Configuration file for the Sphinx documentation builder. -# -# This file only contains a selection of the most common options. For a full -# list see the documentation: -# https://www.sphinx-doc.org/en/master/usage/configuration.html - -# -- Path setup -------------------------------------------------------------- - -# If extensions (or modules to document with autodoc) are in another directory, -# add these directories to sys.path here. If the directory is relative to the -# documentation root, use os.path.abspath to make it absolute, like shown here. -# -import os -import sys -# sys.path.insert(0, os.path.abspath('.')) - - -# -- Project information ----------------------------------------------------- - -project = 'Arduino-ESP32' -copyright = '2023, Espressif' -author = 'Espressif' - -# The full version, including alpha/beta/rc tags -release = '2.0.14' - -# -- General configuration --------------------------------------------------- - -# Add any Sphinx extension module names here, as strings. They can be -# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom -# ones. -extensions = [ - 'sphinx_rtd_theme', - 'sphinx_copybutton', - 'sphinx_tabs.tabs' -] - -# Add any paths that contain templates here, relative to this directory. -templates_path = ['_templates'] - -# The suffix(es) of source filenames. -# You can specify multiple suffix as a list of string: -# -# source_suffix = ['.rst', '.md'] -source_suffix = '.rst' - -# The master toctree document. -master_doc = 'index' - -# List of patterns, relative to source directory, that match files and -# directories to ignore when looking for source files. -# This pattern also affects html_static_path and html_extra_path. -exclude_patterns = [] - -# -- Options for HTML output ------------------------------------------------- - -# The theme to use for HTML and HTML Help pages. See the documentation for -# a list of builtin themes. -# -html_theme = "sphinx_rtd_theme" -html_logo = '_static/logo_espressif.png' - -# Add any paths that contain custom static files (such as style sheets) here, -# relative to this directory. They are copied after the builtin static files, -# so a file named "default.css" will overwrite the builtin "default.css". -html_static_path = ['_static'] - -# Style -# pygments_style = "sphinx" - -# Tracking ID for Google Analytics -google_analytics_id = 'G-F58JM78930' diff --git a/docs/utils.sh b/docs/utils.sh new file mode 100644 index 00000000000..0f9574e57a5 --- /dev/null +++ b/docs/utils.sh @@ -0,0 +1,18 @@ +# Bash helper functions for adding SSH keys + +function add_ssh_keys() { + local key_string="${1}" + mkdir -p ~/.ssh + chmod 700 ~/.ssh + echo -n "${key_string}" >~/.ssh/id_rsa_base64 + base64 --decode --ignore-garbage ~/.ssh/id_rsa_base64 >~/.ssh/id_rsa + chmod 600 ~/.ssh/id_rsa +} + +function add_doc_server_ssh_keys() { + local key_string="${1}" + local server_url="${2}" + local server_user="${3}" + add_ssh_keys "${key_string}" + echo -e "Host ${server_url}\n\tStrictHostKeyChecking no\n\tUser ${server_user}\n" >>~/.ssh/config +} \ No newline at end of file diff --git a/idf_component.yml b/idf_component.yml index cb56652e9ed..2188f0437dc 100644 --- a/idf_component.yml +++ b/idf_component.yml @@ -1,5 +1,6 @@ description: "Arduino core for ESP32, ESP32-S and ESP32-C series of SoCs" url: "https://github.com/espressif/arduino-esp32" +license: "LGPL-2.1" targets: - esp32 - esp32s2 @@ -12,7 +13,6 @@ tags: - arduino files: include: - - "cores/**/*" - "variants/esp32/**/*" - "variants/esp32s2/**/*" - "variants/esp32s3/**/*" @@ -20,11 +20,27 @@ files: - "variants/esp32c3/**/*" - "variants/esp32c6/**/*" - "variants/esp32h2/**/*" - - "libraries/**/*" - - "CMakeLists.txt" - - "Kconfig.projbuild" exclude: - - "**/*" + - "docs/" + - "docs/**/*" + - "idf_component_examples/" + - "idf_component_examples/**/*" + - "package/" + - "package/**/*" + - "tests/" + - "tests/**/*" + - "tools/" + - "tools/**/*" + - "variants/**/*" + - ".gitignore" + - ".gitmodules" + - ".readthedocs.yaml" + - "boards.txt" + - "CODE_OF_CONDUCT.md" + - "LICENSE.md" + - "package.json" + - "platform.txt" + - "programmers.txt" dependencies: idf: ">=5.1" # mdns 1.2.1 is necessary to build H2 with no WiFi @@ -66,5 +82,5 @@ dependencies: rules: - if: "target in [esp32s3]" examples: - - path: idf_component_examples/ + - path: ./idf_component_examples/Hello_world diff --git a/libraries/ArduinoOTA/src/ArduinoOTA.cpp b/libraries/ArduinoOTA/src/ArduinoOTA.cpp index f7ad9105813..ee9c3e95301 100644 --- a/libraries/ArduinoOTA/src/ArduinoOTA.cpp +++ b/libraries/ArduinoOTA/src/ArduinoOTA.cpp @@ -315,6 +315,10 @@ void ArduinoOTAClass::_runUpdate() { size_t r = client.read(buf, available); if(r != available){ log_w("didn't read enough! %u != %u", r, available); + if((int32_t) r<0) { + delay(1); + continue; //let's not try to write 4 gigabytes when client.read returns -1 + } } written = Update.write(buf, r); diff --git a/libraries/AsyncUDP/src/AsyncUDP.cpp b/libraries/AsyncUDP/src/AsyncUDP.cpp index e533755da7a..1c650f1a721 100644 --- a/libraries/AsyncUDP/src/AsyncUDP.cpp +++ b/libraries/AsyncUDP/src/AsyncUDP.cpp @@ -424,12 +424,12 @@ IPAddress AsyncUDPPacket::localIP() return IPAddress(_localIp.u_addr.ip4.addr); } -IPv6Address AsyncUDPPacket::localIPv6() +IPAddress AsyncUDPPacket::localIPv6() { if(_localIp.type != IPADDR_TYPE_V6){ - return IPv6Address(); + return IPAddress(IPv6); } - return IPv6Address(_localIp.u_addr.ip6.addr); + return IPAddress(IPv6, (const uint8_t *)_localIp.u_addr.ip6.addr, _localIp.u_addr.ip6.zone); } uint16_t AsyncUDPPacket::localPort() @@ -445,12 +445,12 @@ IPAddress AsyncUDPPacket::remoteIP() return IPAddress(_remoteIp.u_addr.ip4.addr); } -IPv6Address AsyncUDPPacket::remoteIPv6() +IPAddress AsyncUDPPacket::remoteIPv6() { if(_remoteIp.type != IPADDR_TYPE_V6){ - return IPv6Address(); + return IPAddress(IPv6); } - return IPv6Address(_remoteIp.u_addr.ip6.addr); + return IPAddress(IPv6, (const uint8_t *)_remoteIp.u_addr.ip6.addr, _remoteIp.u_addr.ip6.zone); } uint16_t AsyncUDPPacket::remotePort() @@ -739,32 +739,28 @@ bool AsyncUDP::listen(uint16_t port) bool AsyncUDP::listen(const IPAddress addr, uint16_t port) { ip_addr_t laddr; - laddr.type = IPADDR_TYPE_V4; - laddr.u_addr.ip4.addr = addr; + addr.to_ip_addr_t(&laddr); return listen(&laddr, port); } bool AsyncUDP::listenMulticast(const IPAddress addr, uint16_t port, uint8_t ttl, tcpip_adapter_if_t tcpip_if) { ip_addr_t laddr; - laddr.type = IPADDR_TYPE_V4; - laddr.u_addr.ip4.addr = addr; + addr.to_ip_addr_t(&laddr); return listenMulticast(&laddr, port, ttl, tcpip_if); } bool AsyncUDP::connect(const IPAddress addr, uint16_t port) { ip_addr_t daddr; - daddr.type = IPADDR_TYPE_V4; - daddr.u_addr.ip4.addr = addr; + addr.to_ip_addr_t(&daddr); return connect(&daddr, port); } size_t AsyncUDP::writeTo(const uint8_t *data, size_t len, const IPAddress addr, uint16_t port, tcpip_adapter_if_t tcpip_if) { ip_addr_t daddr; - daddr.type = IPADDR_TYPE_V4; - daddr.u_addr.ip4.addr = addr; + addr.to_ip_addr_t(&daddr); return writeTo(data, len, &daddr, port, tcpip_if); } @@ -776,44 +772,12 @@ IPAddress AsyncUDP::listenIP() return IPAddress(_pcb->remote_ip.u_addr.ip4.addr); } -bool AsyncUDP::listen(const IPv6Address addr, uint16_t port) -{ - ip_addr_t laddr; - laddr.type = IPADDR_TYPE_V6; - memcpy((uint8_t*)(laddr.u_addr.ip6.addr), (const uint8_t*)addr, 16); - return listen(&laddr, port); -} - -bool AsyncUDP::listenMulticast(const IPv6Address addr, uint16_t port, uint8_t ttl, tcpip_adapter_if_t tcpip_if) -{ - ip_addr_t laddr; - laddr.type = IPADDR_TYPE_V6; - memcpy((uint8_t*)(laddr.u_addr.ip6.addr), (const uint8_t*)addr, 16); - return listenMulticast(&laddr, port, ttl, tcpip_if); -} - -bool AsyncUDP::connect(const IPv6Address addr, uint16_t port) -{ - ip_addr_t daddr; - daddr.type = IPADDR_TYPE_V6; - memcpy((uint8_t*)(daddr.u_addr.ip6.addr), (const uint8_t*)addr, 16); - return connect(&daddr, port); -} - -size_t AsyncUDP::writeTo(const uint8_t *data, size_t len, const IPv6Address addr, uint16_t port, tcpip_adapter_if_t tcpip_if) -{ - ip_addr_t daddr; - daddr.type = IPADDR_TYPE_V6; - memcpy((uint8_t*)(daddr.u_addr.ip6.addr), (const uint8_t*)addr, 16); - return writeTo(data, len, &daddr, port, tcpip_if); -} - -IPv6Address AsyncUDP::listenIPv6() +IPAddress AsyncUDP::listenIPv6() { if(!_pcb || _pcb->remote_ip.type != IPADDR_TYPE_V6){ - return IPv6Address(); + return IPAddress(IPv6); } - return IPv6Address(_pcb->remote_ip.u_addr.ip6.addr); + return IPAddress(IPv6, (const uint8_t *)_pcb->remote_ip.u_addr.ip6.addr, _pcb->remote_ip.u_addr.ip6.zone); } size_t AsyncUDP::write(const uint8_t *data, size_t len) @@ -866,14 +830,6 @@ size_t AsyncUDP::sendTo(AsyncUDPMessage &message, const IPAddress addr, uint16_t return writeTo(message.data(), message.length(), addr, port, tcpip_if); } -size_t AsyncUDP::sendTo(AsyncUDPMessage &message, const IPv6Address addr, uint16_t port, tcpip_adapter_if_t tcpip_if) -{ - if(!message) { - return 0; - } - return writeTo(message.data(), message.length(), addr, port, tcpip_if); -} - size_t AsyncUDP::send(AsyncUDPMessage &message) { if(!message) { diff --git a/libraries/AsyncUDP/src/AsyncUDP.h b/libraries/AsyncUDP/src/AsyncUDP.h index c9f365d1197..31d075191df 100644 --- a/libraries/AsyncUDP/src/AsyncUDP.h +++ b/libraries/AsyncUDP/src/AsyncUDP.h @@ -2,7 +2,6 @@ #define ESPASYNCUDP_H #include "IPAddress.h" -#include "IPv6Address.h" #include "Print.h" #include "Stream.h" #include @@ -81,10 +80,10 @@ class AsyncUDPPacket : public Stream tcpip_adapter_if_t interface(); IPAddress localIP(); - IPv6Address localIPv6(); + IPAddress localIPv6(); uint16_t localPort(); IPAddress remoteIP(); - IPv6Address remoteIPv6(); + IPAddress remoteIPv6(); uint16_t remotePort(); void remoteMac(uint8_t * mac); @@ -121,22 +120,18 @@ class AsyncUDP : public Print bool listen(const ip_addr_t *addr, uint16_t port); bool listen(const IPAddress addr, uint16_t port); - bool listen(const IPv6Address addr, uint16_t port); bool listen(uint16_t port); bool listenMulticast(const ip_addr_t *addr, uint16_t port, uint8_t ttl=1, tcpip_adapter_if_t tcpip_if=TCPIP_ADAPTER_IF_MAX); bool listenMulticast(const IPAddress addr, uint16_t port, uint8_t ttl=1, tcpip_adapter_if_t tcpip_if=TCPIP_ADAPTER_IF_MAX); - bool listenMulticast(const IPv6Address addr, uint16_t port, uint8_t ttl=1, tcpip_adapter_if_t tcpip_if=TCPIP_ADAPTER_IF_MAX); bool connect(const ip_addr_t *addr, uint16_t port); bool connect(const IPAddress addr, uint16_t port); - bool connect(const IPv6Address addr, uint16_t port); void close(); size_t writeTo(const uint8_t *data, size_t len, const ip_addr_t *addr, uint16_t port, tcpip_adapter_if_t tcpip_if=TCPIP_ADAPTER_IF_MAX); size_t writeTo(const uint8_t *data, size_t len, const IPAddress addr, uint16_t port, tcpip_adapter_if_t tcpip_if=TCPIP_ADAPTER_IF_MAX); - size_t writeTo(const uint8_t *data, size_t len, const IPv6Address addr, uint16_t port, tcpip_adapter_if_t tcpip_if=TCPIP_ADAPTER_IF_MAX); size_t write(const uint8_t *data, size_t len); size_t write(uint8_t data); @@ -147,14 +142,13 @@ class AsyncUDP : public Print size_t sendTo(AsyncUDPMessage &message, const ip_addr_t *addr, uint16_t port, tcpip_adapter_if_t tcpip_if=TCPIP_ADAPTER_IF_MAX); size_t sendTo(AsyncUDPMessage &message, const IPAddress addr, uint16_t port, tcpip_adapter_if_t tcpip_if=TCPIP_ADAPTER_IF_MAX); - size_t sendTo(AsyncUDPMessage &message, const IPv6Address addr, uint16_t port, tcpip_adapter_if_t tcpip_if=TCPIP_ADAPTER_IF_MAX); size_t send(AsyncUDPMessage &message); size_t broadcastTo(AsyncUDPMessage &message, uint16_t port, tcpip_adapter_if_t tcpip_if=TCPIP_ADAPTER_IF_MAX); size_t broadcast(AsyncUDPMessage &message); IPAddress listenIP(); - IPv6Address listenIPv6(); + IPAddress listenIPv6(); bool connected(); esp_err_t lastErr(); operator bool(); diff --git a/libraries/BLE/src/BLEClient.cpp b/libraries/BLE/src/BLEClient.cpp index ae82c2417a1..60ee53c0fa0 100644 --- a/libraries/BLE/src/BLEClient.cpp +++ b/libraries/BLE/src/BLEClient.cpp @@ -92,12 +92,23 @@ bool BLEClient::connect(BLEAdvertisedDevice* device) { return connect(address, type); } +/** + * Add overloaded function to ease connect to peer device with not public address + */ +bool BLEClient::connectTimeout(BLEAdvertisedDevice* device, uint32_t timeoutMs) { + BLEAddress address = device->getAddress(); + esp_ble_addr_type_t type = device->getAddressType(); + return connect(address, type, timeoutMs); +} + /** * @brief Connect to the partner (BLE Server). * @param [in] address The address of the partner. + * @param [in] type The type of the address. + * @param [in] timeoutMs The number of milliseconds to wait for the connection to complete. * @return True on success. */ -bool BLEClient::connect(BLEAddress address, esp_ble_addr_type_t type) { +bool BLEClient::connect(BLEAddress address, esp_ble_addr_type_t type, uint32_t timeoutMs) { log_v(">> connect(%s)", address.toString().c_str()); // We need the connection handle that we get from registering the application. We register the app @@ -142,9 +153,10 @@ bool BLEClient::connect(BLEAddress address, esp_ble_addr_type_t type) { return false; } - rc = m_semaphoreOpenEvt.wait("connect"); // Wait for the connection to complete. + bool got_sem = m_semaphoreOpenEvt.timedWait("connect", timeoutMs); // Wait for the connection to complete. + rc = m_semaphoreOpenEvt.value(); // check the status of the connection and cleanup in case of failure - if (rc != ESP_GATT_OK) { + if (!got_sem || rc != ESP_GATT_OK) { BLEDevice::removePeerDevice(m_appId, true); esp_ble_gattc_app_unregister(m_gattc_if); m_gattc_if = ESP_GATT_IF_NONE; diff --git a/libraries/BLE/src/BLEClient.h b/libraries/BLE/src/BLEClient.h index 0207a214b66..2c8bc2c4ab9 100644 --- a/libraries/BLE/src/BLEClient.h +++ b/libraries/BLE/src/BLEClient.h @@ -37,7 +37,8 @@ class BLEClient { ~BLEClient(); bool connect(BLEAdvertisedDevice* device); - bool connect(BLEAddress address, esp_ble_addr_type_t type = BLE_ADDR_TYPE_PUBLIC); // Connect to the remote BLE Server + bool connectTimeout(BLEAdvertisedDevice* device, uint32_t timeoutMS = portMAX_DELAY); + bool connect(BLEAddress address, esp_ble_addr_type_t type = BLE_ADDR_TYPE_PUBLIC, uint32_t timeoutMS = portMAX_DELAY); // Connect to the remote BLE Server void disconnect(); // Disconnect from the remote BLE Server BLEAddress getPeerAddress(); // Get the address of the remote BLE Server int getRssi(); // Get the RSSI of the remote BLE Server diff --git a/libraries/BluetoothSerial/src/BluetoothSerial.cpp b/libraries/BluetoothSerial/src/BluetoothSerial.cpp index 8bdf7657ae4..eb6b9043d58 100644 --- a/libraries/BluetoothSerial/src/BluetoothSerial.cpp +++ b/libraries/BluetoothSerial/src/BluetoothSerial.cpp @@ -55,7 +55,7 @@ static TaskHandle_t _spp_task_handle = NULL; static EventGroupHandle_t _spp_event_group = NULL; static EventGroupHandle_t _bt_event_group = NULL; static boolean secondConnectionAttempt; -static esp_spp_cb_t * custom_spp_callback = NULL; +static esp_spp_cb_t custom_spp_callback = NULL; static BluetoothSerialDataCb custom_data_callback = NULL; static esp_bd_addr_t current_bd_addr; static ConfirmRequestCb confirm_request_callback = NULL; @@ -945,7 +945,7 @@ void BluetoothSerial::confirmReply(boolean confirm) } -esp_err_t BluetoothSerial::register_callback(esp_spp_cb_t * callback) +esp_err_t BluetoothSerial::register_callback(esp_spp_cb_t callback) { custom_spp_callback = callback; return ESP_OK; diff --git a/libraries/BluetoothSerial/src/BluetoothSerial.h b/libraries/BluetoothSerial/src/BluetoothSerial.h index 574b96af089..0041c1eb47e 100644 --- a/libraries/BluetoothSerial/src/BluetoothSerial.h +++ b/libraries/BluetoothSerial/src/BluetoothSerial.h @@ -28,7 +28,6 @@ #include "BTScan.h" #include "BTAdvertisedDevice.h" - typedef std::function BluetoothSerialDataCb; typedef std::function ConfirmRequestCb; typedef std::function KeyRequestCb; @@ -57,7 +56,7 @@ class BluetoothSerial: public Stream void memrelease(); void setTimeout(int timeoutMS); void onData(BluetoothSerialDataCb cb); - esp_err_t register_callback(esp_spp_cb_t * callback); + esp_err_t register_callback(esp_spp_cb_t callback); #ifdef CONFIG_BT_SSP_ENABLED void onConfirmRequest(ConfirmRequestCb cb); diff --git a/libraries/DNSServer/examples/CaptivePortal/CaptivePortal.ino b/libraries/DNSServer/examples/CaptivePortal/CaptivePortal.ino index 9221af1eaa2..7e292e1adfb 100644 --- a/libraries/DNSServer/examples/CaptivePortal/CaptivePortal.ino +++ b/libraries/DNSServer/examples/CaptivePortal/CaptivePortal.ino @@ -1,52 +1,59 @@ +/* +This example enables catch-all Captive portal for ESP32 Access-Point +It will allow modern devices/OSes to detect that WiFi connection is +limited and offer a user to access a banner web-page. +There is no need to find and open device's IP address/URL, i.e. http://192.168.4.1/ +This works for Android, Ubuntu, FireFox, Windows, maybe others... +*/ + +#include #include #include +#include + -const byte DNS_PORT = 53; -IPAddress apIP(8,8,4,4); // The default android DNS DNSServer dnsServer; -WiFiServer server(80); +WebServer server(80); + +static const char responsePortal[] = R"===( +ESP32 CaptivePortal +

Hello World!

This is a captive portal example page. All unknown http requests will +be redirected here.

+)==="; + +// index page handler +void handleRoot() { + server.send(200, "text/plain", "Hello from esp32!"); +} -String responseHTML = "" - "CaptivePortal" - "

Hello World!

This is a captive portal example. All requests will " - "be redirected here.

"; +// this will redirect unknown http req's to our captive portal page +// based on this redirect various systems could detect that WiFi AP has a captive portal page +void handleNotFound() { + server.sendHeader("Location", "/portal"); + server.send(302, "text/plain", "redirect to captive portal"); +} -void setup() { +void setup() { + Serial.begin(115200); WiFi.mode(WIFI_AP); WiFi.softAP("ESP32-DNSServer"); - WiFi.softAPConfig(apIP, apIP, IPAddress(255, 255, 255, 0)); - // if DNSServer is started with "*" for domain name, it will reply with - // provided IP to all DNS request - dnsServer.start(DNS_PORT, "*", apIP); + // by default DNSServer is started serving any "*" domain name. It will reply + // AccessPoint's IP to all DNS request (this is requred for Captive Portal detection) + dnsServer.start(); + + // serve a simple root page + server.on("/", handleRoot); + + // serve portal page + server.on("/portal",[](){server.send(200, "text/html", responsePortal);}); + // all unknown pages are redirected to captive portal + server.onNotFound(handleNotFound); server.begin(); } void loop() { - dnsServer.processNextRequest(); - WiFiClient client = server.available(); // listen for incoming clients - - if (client) { - String currentLine = ""; - while (client.connected()) { - if (client.available()) { - char c = client.read(); - if (c == '\n') { - if (currentLine.length() == 0) { - client.println("HTTP/1.1 200 OK"); - client.println("Content-type:text/html"); - client.println(); - client.print(responseHTML); - break; - } else { - currentLine = ""; - } - } else if (c != '\r') { - currentLine += c; - } - } - } - client.stop(); - } + server.handleClient(); + delay(5); // give CPU some idle time } diff --git a/libraries/DNSServer/src/DNSServer.cpp b/libraries/DNSServer/src/DNSServer.cpp index aaa3d33344b..a8114733460 100644 --- a/libraries/DNSServer/src/DNSServer.cpp +++ b/libraries/DNSServer/src/DNSServer.cpp @@ -1,6 +1,8 @@ #include "DNSServer.h" #include #include +#include + // #define DEBUG_ESP_DNS #ifdef DEBUG_ESP_PORT @@ -9,45 +11,37 @@ #define DEBUG_OUTPUT Serial #endif -DNSServer::DNSServer() -{ - _ttl = htonl(DNS_DEFAULT_TTL); - _errorReplyCode = DNSReplyCode::NonExistentDomain; - _dnsHeader = (DNSHeader*) malloc( sizeof(DNSHeader) ) ; - _dnsQuestion = (DNSQuestion*) malloc( sizeof(DNSQuestion) ) ; - _buffer = NULL; - _currentPacketSize = 0; - _port = 0; -} +#define DNS_MIN_REQ_LEN 17 // minimal size for DNS request asking ROOT = DNS_HEADER_SIZE + 1 null byte for Name + 4 bytes type/class -DNSServer::~DNSServer() -{ - if (_dnsHeader) { - free(_dnsHeader); - _dnsHeader = NULL; - } - if (_dnsQuestion) { - free(_dnsQuestion); - _dnsQuestion = NULL; - } - if (_buffer) { - free(_buffer); - _buffer = NULL; - } +DNSServer::DNSServer() : _port(DNS_DEFAULT_PORT), _ttl(htonl(DNS_DEFAULT_TTL)), _errorReplyCode(DNSReplyCode::NonExistentDomain){} + +DNSServer::DNSServer(const String &domainName) : _port(DNS_DEFAULT_PORT), _ttl(htonl(DNS_DEFAULT_TTL)), _errorReplyCode(DNSReplyCode::NonExistentDomain), _domainName(domainName){}; + + +bool DNSServer::start(){ + if (_resolvedIP.operator uint32_t() == 0){ // no address is set, try to obtain AP interface's IP + if (WiFi.getMode() & WIFI_AP){ + _resolvedIP = WiFi.softAPIP(); + } else return false; // won't run if WiFi is not in AP mode + } + + _udp.close(); + _udp.onPacket([this](AsyncUDPPacket& pkt){ this->_handleUDP(pkt); }); + return _udp.listen(_port); } -bool DNSServer::start(const uint16_t &port, const String &domainName, - const IPAddress &resolvedIP) -{ +bool DNSServer::start(uint16_t port, const String &domainName, const IPAddress &resolvedIP){ _port = port; - _buffer = NULL; - _domainName = domainName; - _resolvedIP[0] = resolvedIP[0]; - _resolvedIP[1] = resolvedIP[1]; - _resolvedIP[2] = resolvedIP[2]; - _resolvedIP[3] = resolvedIP[3]; - downcaseAndRemoveWwwPrefix(_domainName); - return _udp.begin(_port) == 1; + if (domainName != "*"){ + _domainName = domainName; + downcaseAndRemoveWwwPrefix(_domainName); + } else + _domainName.clear(); + + _resolvedIP = resolvedIP; + _udp.close(); + _udp.onPacket([this](AsyncUDPPacket& pkt){ this->_handleUDP(pkt); }); + return _udp.listen(_port); } void DNSServer::setErrorReplyCode(const DNSReplyCode &replyCode) @@ -62,9 +56,7 @@ void DNSServer::setTTL(const uint32_t &ttl) void DNSServer::stop() { - _udp.stop(); - free(_buffer); - _buffer = NULL; + _udp.close(); } void DNSServer::downcaseAndRemoveWwwPrefix(String &domainName) @@ -73,151 +65,125 @@ void DNSServer::downcaseAndRemoveWwwPrefix(String &domainName) domainName.replace("www.", ""); } -void DNSServer::processNextRequest() +void DNSServer::_handleUDP(AsyncUDPPacket& pkt) { - _currentPacketSize = _udp.parsePacket(); - if (_currentPacketSize) - { - // Allocate buffer for the DNS query - if (_buffer != NULL) - free(_buffer); - _buffer = (unsigned char*)malloc(_currentPacketSize * sizeof(char)); - if (_buffer == NULL) - return; + if (pkt.length() < DNS_MIN_REQ_LEN) return; // truncated packet or not a DNS req + + // get DNS header (beginning of message) + DNSHeader dnsHeader; + DNSQuestion dnsQuestion; + memcpy( &dnsHeader, pkt.data(), DNS_HEADER_SIZE ); + if (dnsHeader.QR != DNS_QR_QUERY) return; // ignore non-query mesages - // Put the packet received in the buffer and get DNS header (beginning of message) - // and the question - _udp.read(_buffer, _currentPacketSize); - memcpy( _dnsHeader, _buffer, DNS_HEADER_SIZE ) ; - if ( requestIncludesOnlyOneQuestion() ) + if ( requestIncludesOnlyOneQuestion(dnsHeader) ) { +/* // The QName has a variable length, maximum 255 bytes and is comprised of multiple labels. // Each label contains a byte to describe its length and the label itself. The list of // labels terminates with a zero-valued byte. In "github.com", we have two labels "github" & "com" - // Iterate through the labels and copy them as they come into a single buffer (for simplicity's sake) - _dnsQuestion->QNameLength = 0 ; - while ( _buffer[ DNS_HEADER_SIZE + _dnsQuestion->QNameLength ] != 0 ) - { - memcpy( (void*) &_dnsQuestion->QName[_dnsQuestion->QNameLength], (void*) &_buffer[DNS_HEADER_SIZE + _dnsQuestion->QNameLength], _buffer[DNS_HEADER_SIZE + _dnsQuestion->QNameLength] + 1 ) ; - _dnsQuestion->QNameLength += _buffer[DNS_HEADER_SIZE + _dnsQuestion->QNameLength] + 1 ; - } - _dnsQuestion->QName[_dnsQuestion->QNameLength] = 0 ; - _dnsQuestion->QNameLength++ ; - - // Copy the QType and QClass - memcpy( &_dnsQuestion->QType, (void*) &_buffer[DNS_HEADER_SIZE + _dnsQuestion->QNameLength], sizeof(_dnsQuestion->QType) ) ; - memcpy( &_dnsQuestion->QClass, (void*) &_buffer[DNS_HEADER_SIZE + _dnsQuestion->QNameLength + sizeof(_dnsQuestion->QType)], sizeof(_dnsQuestion->QClass) ) ; +*/ + const char * enoflbls = strchr(reinterpret_cast(pkt.data()) + DNS_HEADER_SIZE, 0); // find end_of_label marker + ++enoflbls; // advance after null terminator + dnsQuestion.QName = pkt.data() + DNS_HEADER_SIZE; // we can reference labels from the request + dnsQuestion.QNameLength = enoflbls - (char*)pkt.data() - DNS_HEADER_SIZE; + /* + check if we aint going out of pkt bounds + proper dns req should have label terminator at least 4 bytes before end of packet + */ + if (dnsQuestion.QNameLength > pkt.length() - DNS_HEADER_SIZE - sizeof(dnsQuestion.QType) - sizeof(dnsQuestion.QClass)) return; // malformed packet + + // Copy the QType and QClass + memcpy( &dnsQuestion.QType, enoflbls, sizeof(dnsQuestion.QType) ); + memcpy( &dnsQuestion.QClass, enoflbls + sizeof(dnsQuestion.QType), sizeof(dnsQuestion.QClass) ); } - - if (_dnsHeader->QR == DNS_QR_QUERY && - _dnsHeader->OPCode == DNS_OPCODE_QUERY && - requestIncludesOnlyOneQuestion() && - (_domainName == "*" || getDomainNameWithoutWwwPrefix() == _domainName) + // will reply with IP only to "*" or if doman matches without www. subdomain + if (dnsHeader.OPCode == DNS_OPCODE_QUERY && + requestIncludesOnlyOneQuestion(dnsHeader) && + (_domainName.isEmpty() || + getDomainNameWithoutWwwPrefix(static_cast(dnsQuestion.QName), dnsQuestion.QNameLength) == _domainName) ) { - replyWithIP(); - } - else if (_dnsHeader->QR == DNS_QR_QUERY) - { - replyWithCustomCode(); + replyWithIP(pkt, dnsHeader, dnsQuestion); + return; } - free(_buffer); - _buffer = NULL; - } + // otherwise reply with custom code + replyWithCustomCode(pkt, dnsHeader); } -bool DNSServer::requestIncludesOnlyOneQuestion() +bool DNSServer::requestIncludesOnlyOneQuestion(DNSHeader& dnsHeader) { - return ntohs(_dnsHeader->QDCount) == 1 && - _dnsHeader->ANCount == 0 && - _dnsHeader->NSCount == 0 && - _dnsHeader->ARCount == 0; + return ntohs(dnsHeader.QDCount) == 1 && + dnsHeader.ANCount == 0 && + dnsHeader.NSCount == 0 && + dnsHeader.ARCount == 0; } -String DNSServer::getDomainNameWithoutWwwPrefix() +String DNSServer::getDomainNameWithoutWwwPrefix(const unsigned char* start, size_t len) { - // Error checking : if the buffer containing the DNS request is a null pointer, return an empty domain - String parsedDomainName = ""; - if (_buffer == NULL) - return parsedDomainName; - - // Set the start of the domain just after the header (12 bytes). If equal to null character, return an empty domain - unsigned char *start = _buffer + DNS_OFFSET_DOMAIN_NAME; - if (*start == 0) - { - return parsedDomainName; - } + String parsedDomainName(start, --len); // exclude trailing null byte from labels length, String constructor will add it anyway int pos = 0; - while(true) + while(posQR = DNS_QR_RESPONSE; - _dnsHeader->ANCount = _dnsHeader->QDCount; - _udp.write( (unsigned char*) _dnsHeader, DNS_HEADER_SIZE ) ; + dnsHeader.QR = DNS_QR_RESPONSE; + dnsHeader.ANCount = dnsHeader.QDCount; + rpl.write( (unsigned char*) &dnsHeader, DNS_HEADER_SIZE ) ; // Write the question - _udp.write(_dnsQuestion->QName, _dnsQuestion->QNameLength) ; - _udp.write( (unsigned char*) &_dnsQuestion->QType, 2 ) ; - _udp.write( (unsigned char*) &_dnsQuestion->QClass, 2 ) ; + rpl.write(dnsQuestion.QName, dnsQuestion.QNameLength) ; + rpl.write( (uint8_t*) &dnsQuestion.QType, 2 ) ; + rpl.write( (uint8_t*) &dnsQuestion.QClass, 2 ) ; // Write the answer // Use DNS name compression : instead of repeating the name in this RNAME occurence, // set the two MSB of the byte corresponding normally to the length to 1. The following // 14 bits must be used to specify the offset of the domain name in the message // (<255 here so the first byte has the 6 LSB at 0) - _udp.write((uint8_t) 0xC0); - _udp.write((uint8_t) DNS_OFFSET_DOMAIN_NAME); + rpl.write((uint8_t) 0xC0); + rpl.write((uint8_t) DNS_OFFSET_DOMAIN_NAME); // DNS type A : host address, DNS class IN for INternet, returning an IPv4 address uint16_t answerType = htons(DNS_TYPE_A), answerClass = htons(DNS_CLASS_IN), answerIPv4 = htons(DNS_RDLENGTH_IPV4) ; - _udp.write((unsigned char*) &answerType, 2 ); - _udp.write((unsigned char*) &answerClass, 2 ); - _udp.write((unsigned char*) &_ttl, 4); // DNS Time To Live - _udp.write((unsigned char*) &answerIPv4, 2 ); - _udp.write(_resolvedIP, sizeof(_resolvedIP)); // The IP address to return - _udp.endPacket(); + rpl.write((unsigned char*) &answerType, 2 ); + rpl.write((unsigned char*) &answerClass, 2 ); + rpl.write((unsigned char*) &_ttl, 4); // DNS Time To Live + rpl.write((unsigned char*) &answerIPv4, 2 ); + uint32_t ip = _resolvedIP; + rpl.write(reinterpret_cast(&ip), sizeof(uint32_t)); // The IPv4 address to return + + _udp.sendTo(rpl, req.remoteIP(), req.remotePort()); #ifdef DEBUG_ESP_DNS DEBUG_OUTPUT.printf("DNS responds: %s for %s\n", - IPAddress(_resolvedIP).toString().c_str(), getDomainNameWithoutWwwPrefix().c_str() ); + _resolvedIP.toString().c_str(), getDomainNameWithoutWwwPrefix(static_cast(dnsQuestion.QName), dnsQuestion.QNameLength).c_str() ); #endif } -void DNSServer::replyWithCustomCode() +void DNSServer::replyWithCustomCode(AsyncUDPPacket& req, DNSHeader& dnsHeader) { - _dnsHeader->QR = DNS_QR_RESPONSE; - _dnsHeader->RCode = (unsigned char)_errorReplyCode; - _dnsHeader->QDCount = 0; + dnsHeader.QR = DNS_QR_RESPONSE; + dnsHeader.RCode = static_cast(_errorReplyCode); + dnsHeader.QDCount = 0; - _udp.beginPacket(_udp.remoteIP(), _udp.remotePort()); - _udp.write((unsigned char*)_dnsHeader, sizeof(DNSHeader)); - _udp.endPacket(); + AsyncUDPMessage rpl(sizeof(DNSHeader)); + rpl.write(reinterpret_cast(&dnsHeader), sizeof(DNSHeader)); + _udp.sendTo(rpl, req.remoteIP(), req.remotePort()); } diff --git a/libraries/DNSServer/src/DNSServer.h b/libraries/DNSServer/src/DNSServer.h index 1250f5ce960..860507ac9ec 100644 --- a/libraries/DNSServer/src/DNSServer.h +++ b/libraries/DNSServer/src/DNSServer.h @@ -1,15 +1,15 @@ -#ifndef DNSServer_h -#define DNSServer_h -#include +#pragma once +#include #define DNS_QR_QUERY 0 #define DNS_QR_RESPONSE 1 #define DNS_OPCODE_QUERY 0 #define DNS_DEFAULT_TTL 60 // Default Time To Live : time interval in seconds that the resource record should be cached before being discarded -#define DNS_OFFSET_DOMAIN_NAME 12 // Offset in bytes to reach the domain name in the DNS message #define DNS_HEADER_SIZE 12 +#define DNS_OFFSET_DOMAIN_NAME DNS_HEADER_SIZE // Offset in bytes to reach the domain name labels in the DNS message +#define DNS_DEFAULT_PORT 53 -enum class DNSReplyCode +enum class DNSReplyCode:uint16_t { NoError = 0, FormError = 1, @@ -59,14 +59,14 @@ struct DNSHeader uint16_t Flags; }; uint16_t QDCount; // number of question entries - uint16_t ANCount; // number of answer entries + uint16_t ANCount; // number of ANswer entries uint16_t NSCount; // number of authority entries - uint16_t ARCount; // number of resource entries + uint16_t ARCount; // number of Additional Resource entries }; struct DNSQuestion { - uint8_t QName[256] ; //need 1 Byte for zero termination! + const uint8_t* QName; uint16_t QNameLength ; uint16_t QType ; uint16_t QClass ; @@ -75,36 +75,116 @@ struct DNSQuestion class DNSServer { public: + /** + * @brief Construct a new DNSServer object + * by default server is configured to run in "Captive-portal" mode + * it must be started with start() call to establish a listening socket + * + */ DNSServer(); - ~DNSServer(); - void processNextRequest(); + + /** + * @brief Construct a new DNSServer object + * builds DNS server with default parameters + * @param domainName - domain name to serve + */ + DNSServer(const String &domainName); + ~DNSServer(){}; // default d-tor + + // Copy semantics not implemented (won't run on same UDP port anyway) + DNSServer(const DNSServer&) = delete; + DNSServer& operator=(const DNSServer&) = delete; + + + /** + * @brief stub, left for compatibility with an old version + * does nothing actually + * + */ + void processNextRequest(){}; + + /** + * @brief Set the Error Reply Code for all req's not matching predifined domain + * + * @param replyCode + */ void setErrorReplyCode(const DNSReplyCode &replyCode); + + /** + * @brief set TTL for successfull replies + * + * @param ttl in seconds + */ void setTTL(const uint32_t &ttl); - // Returns true if successful, false if there are no sockets available - bool start(const uint16_t &port, + /** + * @brief (re)Starts a server with current configuration or with default parameters + * if it's the first call. + * Defaults are: + * port: 53 + * domainName: any + * ip: WiFi AP's IP address + * + * @return true on success + * @return false if IP or socket error + */ + bool start(); + + /** + * @brief (re)Starts a server with provided configuration + * + * @return true on success + * @return false if IP or socket error + */ + bool start(uint16_t port, const String &domainName, const IPAddress &resolvedIP); - // stops the DNS server + + /** + * @brief stops the server and close UDP socket + * + */ void stop(); + /** + * @brief returns true if DNS server runs in captive-portal mode + * i.e. all requests are served with AP's ip address + * + * @return true if catch-all mode active + * @return false otherwise + */ + inline bool isCaptive() const { return _domainName.isEmpty(); }; + + /** + * @brief returns 'true' if server is up and UDP socket is listening for UDP req's + * + * @return true if server is up + * @return false otherwise + */ + inline bool isUp() { return _udp.connected(); }; + private: - WiFiUDP _udp; + AsyncUDP _udp; uint16_t _port; - String _domainName; - unsigned char _resolvedIP[4]; - int _currentPacketSize; - unsigned char* _buffer; - DNSHeader* _dnsHeader; uint32_t _ttl; DNSReplyCode _errorReplyCode; - DNSQuestion* _dnsQuestion ; + String _domainName; + IPAddress _resolvedIP; void downcaseAndRemoveWwwPrefix(String &domainName); - String getDomainNameWithoutWwwPrefix(); - bool requestIncludesOnlyOneQuestion(); - void replyWithIP(); - void replyWithCustomCode(); + + /** + * @brief Get the Domain Name Without Www Prefix object + * scan labels in DNS packet and build a string of a domain name + * truncate any www. label if found + * @param start a pointer to the start of labels records in DNS packet + * @param len labels length + * @return String + */ + String getDomainNameWithoutWwwPrefix(const unsigned char* start, size_t len); + inline bool requestIncludesOnlyOneQuestion(DNSHeader& dnsHeader); + void replyWithIP(AsyncUDPPacket& req, DNSHeader& dnsHeader, DNSQuestion& dnsQuestion); + inline void replyWithCustomCode(AsyncUDPPacket& req, DNSHeader& dnsHeader); + void _handleUDP(AsyncUDPPacket& pkt); }; -#endif diff --git a/libraries/ESP32/examples/AnalogRead/AnalogRead.ino b/libraries/ESP32/examples/AnalogRead/AnalogRead.ino index c238517d380..647e16ba8bd 100644 --- a/libraries/ESP32/examples/AnalogRead/AnalogRead.ino +++ b/libraries/ESP32/examples/AnalogRead/AnalogRead.ino @@ -2,7 +2,7 @@ void setup() { // initialize serial communication at 115200 bits per second: Serial.begin(115200); - //set the resolution to 12 bits (0-4096) + //set the resolution to 12 bits (0-4095) analogReadResolution(12); } diff --git a/libraries/ESP32/examples/RMT/RMT_EndOfTransmissionState/RMT_EndOfTransmissionState.ino b/libraries/ESP32/examples/RMT/RMT_EndOfTransmissionState/RMT_EndOfTransmissionState.ino new file mode 100644 index 00000000000..90c4e4f7d08 --- /dev/null +++ b/libraries/ESP32/examples/RMT/RMT_EndOfTransmissionState/RMT_EndOfTransmissionState.ino @@ -0,0 +1,59 @@ +#define BLINK_GPIO 2 +#define EOT_INITIAL_STATE_TIME_MS 1000 + +// BLINK_GPIO shall start at RMT_EOT (HIGH or LOW) as initial state for EOT_INITIAL_STATE_TIME_MS, +// BLINK: 1 second ON, 1 second OFF and then return/stay to RMT_EOT level at the end. +#define RMT_EOT HIGH + +// RMT is at 400KHz with a 2.5us tick +// This RMT data sends a 0.5Hz pulse with 1s High and 1s Low signal +rmt_data_t blink_1s_rmt_data[] = { + // 400,000 x 2.5us = 1 second ON + {25000, 1, 25000, 1,}, + {25000, 1, 25000, 1,}, + {25000, 1, 25000, 1,}, + {25000, 1, 25000, 1,}, + {25000, 1, 25000, 1,}, + {25000, 1, 25000, 1,}, + {25000, 1, 25000, 1,}, + {25000, 1, 25000, 1,}, + // 400,000 x 2.5us = 1 second OFF + {25000, 0, 25000, 0,}, + {25000, 0, 25000, 0,}, + {25000, 0, 25000, 0,}, + {25000, 0, 25000, 0,}, + {25000, 0, 25000, 0,}, + {25000, 0, 25000, 0,}, + {25000, 0, 25000, 0,}, + {25000, 0, 25000, 0,}, + // Looping mode needs a Zero ending data to mark the EOF + {0, 0, 0, 0} +}; + +void setup() { + Serial.begin(115200); + Serial.println("Starting Blink testing..."); + Serial.flush(); + + // 1 RMT Block has 64 RMT_SYMBOLS (ESP32|ESP32S2) or 48 RMT_SYMBOLS (ESP32C3|ESP32S3) + if (!rmtInit(BLINK_GPIO, RMT_TX_MODE, RMT_MEM_NUM_BLOCKS_1, 400000)) { //2.5us tick + Serial.println("===> rmtInit Error!"); + } + + // sets the End of Transmission Level to HIGH, after writing to the pin. DEFAULT is LOW. + rmtSetEOT(BLINK_GPIO, RMT_EOT); + // set initial RMT state by writing a single RMT data + rmt_data_t initStateSetup_rmt_data[] = { {1, RMT_EOT, 0, 0} }; + rmtWrite(BLINK_GPIO, initStateSetup_rmt_data, RMT_SYMBOLS_OF(initStateSetup_rmt_data), RMT_WAIT_FOR_EVER); + Serial.printf("\nLED GPIO%d start in the inital level %s\n", BLINK_GPIO, RMT_EOT == LOW ? "LOW" : "HIGH"); + delay(EOT_INITIAL_STATE_TIME_MS); // set initial state of the LED is set by RMT_EOT. + + // Send the data and wait until it is done - set EOT level to HIGH + Serial.printf("\nLED GPIO%d Blinks 1 second HIGH - 1 second LOW.\n", BLINK_GPIO); + if (!rmtWrite(BLINK_GPIO, blink_1s_rmt_data, RMT_SYMBOLS_OF(blink_1s_rmt_data) - 2, RMT_WAIT_FOR_EVER)) { + Serial.println("===> rmtWrite Blink 1s Error!"); + } + Serial.printf("\nLED GPIO%d goes to the EOT level %s\n", BLINK_GPIO, RMT_EOT == LOW ? "LOW" : "HIGH"); +} + +void loop(){} diff --git a/libraries/ESP32/examples/Serial/RS485_Echo_Demo/RS485_Echo_Demo.ino b/libraries/ESP32/examples/Serial/RS485_Echo_Demo/RS485_Echo_Demo.ino new file mode 100644 index 00000000000..a19be7ffe25 --- /dev/null +++ b/libraries/ESP32/examples/Serial/RS485_Echo_Demo/RS485_Echo_Demo.ino @@ -0,0 +1,48 @@ +/* + This Sketch demonstrates how to use the Hardware Serial peripheral to communicate over an RS485 bus. + + Data received on the primary serial port is relayed to the bus acting as an RS485 interface and vice versa. + + UART to RS485 translation hardware (e.g., MAX485, MAX33046E, ADM483) is assumed to be configured in half-duplex + mode with collision detection as described in + https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/peripherals/uart.html#circuit-a-collision-detection-circuit + + To use the script open the Arduino serial monitor (or alternative serial monitor on the Arduino port). Then, + using an RS485 tranciver, connect another serial monitor to the RS485 port. Entering data on one terminal + should be displayed on the other terminal. +*/ +#include "hal/uart_types.h" + +#define RS485_RX_PIN 16 +#define RS485_TX_PIN 5 +#define RS485_RTS_PIN 4 + +#define RS485 Serial1 + +void setup() { + Serial.begin(115200); + while(!Serial) { delay(10); } + + RS485.begin(9600, SERIAL_8N1, RS485_RX_PIN, RS485_TX_PIN); + while(!RS485) { delay(10); } + if(!RS485.setPins(-1, -1, -1, RS485_RTS_PIN)){ + Serial.print("Failed to set RS485 pins"); + } + + // Certain versions of Arduino core don't define MODE_RS485_HALF_DUPLEX and so fail to compile. + // By using UART_MODE_RS485_HALF_DUPLEX defined in hal/uart_types.h we work around this problem. + // If using a newer IDF and Arduino core you can ommit including hal/uart_types.h and use MODE_RS485_HALF_DUPLEX + // defined in esp32-hal-uart.h (included during other build steps) instead. + if(!RS485.setMode(UART_MODE_RS485_HALF_DUPLEX)) { + Serial.print("Failed to set RS485 mode"); + } +} + +void loop() { + if (RS485.available()) { + Serial.write(RS485.read()); + } + if (Serial.available()) { + RS485.write(Serial.read()); + } +} diff --git a/libraries/ESP32/examples/Utilities/HEXBuilder/HEXBuilder.ino b/libraries/ESP32/examples/Utilities/HEXBuilder/HEXBuilder.ino new file mode 100644 index 00000000000..3e9ae5bfd53 --- /dev/null +++ b/libraries/ESP32/examples/Utilities/HEXBuilder/HEXBuilder.ino @@ -0,0 +1,71 @@ +#include + +void setup() { + Serial.begin(115200); + while (!Serial) { delay(10); } + Serial.println("\n\n\nStart."); + + // Convert a HEX string like 6c6c6f20576f726c64 to a binary buffer + { + const char * out = "Hello World"; + const char * hexin = "48656c6c6f20576f726c6400"; // As the string above is \0 terminated too + + unsigned char buff[256]; + size_t len = HEXBuilder::hex2bytes(buff, sizeof(buff), hexin); + + if (len != 1 + strlen(out)) + Serial.println("Odd - length 1 is wrong"); + + if (memcmp(buff, out, len) != 0) + Serial.println("Odd - decode 1 went wrong"); + + // Safe to print this binary buffer -- as we've included a \0 in the hex sequence. + Serial.printf("IN: <%s>\nOUT <%s\\0>\n", hexin, buff); + }; + + { + String helloHEX = "48656c6c6f20576f726c64"; + const char hello[] = "Hello World"; + + unsigned char buff[256]; + size_t len = HEXBuilder::hex2bytes(buff, sizeof(buff), helloHEX); + + if (len != strlen(hello)) + Serial.println("Odd - length 2 is wrong"); + + if (strcmp((char *) buff, hello) != 0) + Serial.println("Odd - decode 2 went wrong"); + } + + { + const unsigned char helloBytes[] = { 0x48, 0x56, 0x6c, 0x6c, 0x6f, 0x20, 0x57, 0x6f, 0x72, 0x6c, 0x64 }; + String helloHEX = "48566c6c6f20576f726c64"; + + + String out = HEXBuilder::bytes2hex(helloBytes, sizeof(helloBytes)); + if (out.length() != 2 * sizeof(helloBytes)) + Serial.println("Odd - length 3 is wrong"); + + // we need to ignore case - as a hex string can be spelled in uppercase and lowercase + if (!out.equalsIgnoreCase(helloHEX)) { + Serial.println("Odd - decode 3 went wrong"); + } + } + + { + const unsigned char helloBytes[] = { 0x6c, 0x6c, 0x6f, 0x20, 0x57, 0x6f, 0x72, 0x6c, 0x64 }; + const char helloHex[] = "6c6c6f20576f726c64"; + + char buff[256]; + size_t len = HEXBuilder::bytes2hex(buff, sizeof(buff), helloBytes, sizeof(helloBytes)); + if (len != 1 + 2 * sizeof(helloBytes)) + Serial.println("Odd - length 4 is wrong"); + + // we need to ignore case - as a hex string can be spelled in uppercase and lowercase + if (strcasecmp(buff, helloHex)) + Serial.println("Odd - decode 4 went wrong"); + } + Serial.println("Done."); +} + +void loop() {} diff --git a/libraries/ESP32/examples/Utilities/MD5Builder/MD5Builder.ino b/libraries/ESP32/examples/Utilities/MD5Builder/MD5Builder.ino new file mode 100644 index 00000000000..9b439587000 --- /dev/null +++ b/libraries/ESP32/examples/Utilities/MD5Builder/MD5Builder.ino @@ -0,0 +1,96 @@ +#include + +// Occasionally it is useful to compare a password that the user +// has entered to a build in string. However this means that the +// password ends up `in the clear' in the firmware and in your +// source code. +// +// MD5Builder helps you obfuscate this (it is not terribly secure, MD5 +// has been phased out as insecure eons ago) by letting you create an +// MD5 of the data the user entered; and then compare this to an MD5 +// string that you have put in your code. + +void setup() { + Serial.begin(115200); + while (!Serial) { delay(10); } + Serial.println("\n\n\nStart."); + + // Check if a password obfuscated in an MD5 actually + // matches the original string. + // + // echo -n "Hello World" | openssl md5 + { + String md5 = "b10a8db164e0754105b7a99be72e3fe5"; + String password = "Hello World"; + + MD5Builder md; + + md.begin(); + md.add(password); + md.calculate(); + + String result = md.toString(); + + if (!md5.equalsIgnoreCase(result)) + Serial.println("Odd - failing MD5 on String"); + else + Serial.println("OK!"); + } + + // Check that this also work if we add the password not as + // a normal string - but as a string with the HEX values. + { + String passwordAsHex = "48656c6c6f20576f726c64"; + String md5 = "b10a8db164e0754105b7a99be72e3fe5"; + + MD5Builder md; + + md.begin(); + md.addHexString(passwordAsHex); + md.calculate(); + + String result = md.toString(); + + if (!md5.equalsIgnoreCase(result)) { + Serial.println("Odd - failing MD5 on hex string"); + Serial.println(md5); + Serial.println(result); + } + else + Serial.println("OK!"); + + } + + // Check that this also work if we add the password as + // an unsigned byte array. + { + uint8_t password[] = { 0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x20, 0x57, 0x6f, 0x72, 0x6c, 0x64 }; + String md5 = "b10a8db164e0754105b7a99be72e3fe5"; + MD5Builder md; + + md.begin(); + md.add(password, sizeof(password)); + md.calculate(); + + String result = md.toString(); + + if (!md5.equalsIgnoreCase(result)) + Serial.println("Odd - failing MD5 on byte array"); + else + Serial.println("OK!"); + + // And also check that we can compare this as pure, raw, bytes + uint8_t raw[16] = { 0xb1, 0x0a, 0x8d, 0xb1, 0x64, 0xe0, 0x75, 0x41, + 0x05, 0xb7, 0xa9, 0x9b, 0xe7, 0x2e, 0x3f, 0xe5 + }; + uint8_t res[16]; + md.getBytes(res); + if (memcmp(raw, res, 16)) + Serial.println("Odd - failing MD5 on byte array when compared as bytes"); + else + Serial.println("OK!"); + + } +} + +void loop() {} diff --git a/libraries/ESP32/examples/Utilities/SHA1Builder/SHA1Builder.ino b/libraries/ESP32/examples/Utilities/SHA1Builder/SHA1Builder.ino new file mode 100644 index 00000000000..40270953473 --- /dev/null +++ b/libraries/ESP32/examples/Utilities/SHA1Builder/SHA1Builder.ino @@ -0,0 +1,97 @@ +#include + +// Occasionally it is useful to compare a password that the user +// has entered to a build in string. However this means that the +// password ends up `in the clear' in the firmware and in your +// source code. +// +// SHA1Builder helps you obfuscate this (This is not much more secure. +// SHA1 is past its retirement age and long obsolte/insecure, but it helps +// a little) by letting you create an (unsalted!) SHA1 of the data the +// user entered; and then compare this to an SHA1 string that you have put +// in your code. + +void setup() { + Serial.begin(115200); + while (!Serial) { delay(10); } + Serial.println("\n\n\nStart."); + + // Check if a password obfuscated in an SHA1 actually + // matches the original string. + // + // echo -n "Hello World" | openssl sha1 + { + String sha1_str = "0a4d55a8d778e5022fab701977c5d840bbc486d0"; + String password = "Hello World"; + + SHA1Builder sha; + + sha.begin(); + sha.add(password); + sha.calculate(); + + String result = sha.toString(); + + if (!sha1_str.equalsIgnoreCase(result)) + Serial.println("Odd - failing SHA1 on String"); + else + Serial.println("OK!"); + } + + // Check that this also work if we add the password not as + // a normal string - but as a string with the HEX values. + { + String passwordAsHex = "48656c6c6f20576f726c64"; + String sha1_str = "0a4d55a8d778e5022fab701977c5d840bbc486d0"; + + SHA1Builder sha; + + sha.begin(); + sha.addHexString(passwordAsHex); + sha.calculate(); + + String result = sha.toString(); + + if (!sha1_str.equalsIgnoreCase(result)) { + Serial.println("Odd - failing SHA1 on hex string"); + Serial.println(sha1_str); + Serial.println(result); + } + else + Serial.println("OK!"); + + } + + // Check that this also work if we add the password as + // an unsigned byte array. + { + uint8_t password[] = { 0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x20, 0x57, 0x6f, 0x72, 0x6c, 0x64 }; + String sha1_str = "0a4d55a8d778e5022fab701977c5d840bbc486d0"; + SHA1Builder sha; + + sha.begin(); + sha.add(password, sizeof(password)); + sha.calculate(); + + String result = sha.toString(); + + if (!sha1_str.equalsIgnoreCase(result)) + Serial.println("Odd - failing SHA1 on byte array"); + else + Serial.println("OK!"); + + // And also check that we can compare this as pure, raw, bytes + uint8_t raw[20] = { 0x0a, 0x4d, 0x55, 0xa8, 0xd7, 0x78, 0xe5, 0x02, 0x2f, 0xab, + 0x70, 0x19, 0x77, 0xc5, 0xd8, 0x40, 0xbb, 0xc4, 0x86, 0xd0 + }; + uint8_t res[20]; + sha.getBytes(res); + if (memcmp(raw, res, 20)) + Serial.println("Odd - failing SHA1 on byte array when compared as bytes"); + else + Serial.println("OK!"); + + } +} + +void loop() {} diff --git a/libraries/ESP32/examples/Zigbee/Zigbee_Light_Bulb/.skip.esp32 b/libraries/ESP32/examples/Zigbee/Zigbee_Light_Bulb/.skip.esp32 new file mode 100644 index 00000000000..e69de29bb2d diff --git a/libraries/ESP32/examples/Zigbee/Zigbee_Light_Bulb/.skip.esp32c3 b/libraries/ESP32/examples/Zigbee/Zigbee_Light_Bulb/.skip.esp32c3 new file mode 100644 index 00000000000..e69de29bb2d diff --git a/libraries/ESP32/examples/Zigbee/Zigbee_Light_Bulb/.skip.esp32c6 b/libraries/ESP32/examples/Zigbee/Zigbee_Light_Bulb/.skip.esp32c6 new file mode 100644 index 00000000000..e69de29bb2d diff --git a/libraries/ESP32/examples/Zigbee/Zigbee_Light_Bulb/.skip.esp32h2 b/libraries/ESP32/examples/Zigbee/Zigbee_Light_Bulb/.skip.esp32h2 new file mode 100644 index 00000000000..e69de29bb2d diff --git a/libraries/ESP32/examples/Zigbee/Zigbee_Light_Bulb/.skip.esp32s2 b/libraries/ESP32/examples/Zigbee/Zigbee_Light_Bulb/.skip.esp32s2 new file mode 100644 index 00000000000..e69de29bb2d diff --git a/libraries/ESP32/examples/Zigbee/Zigbee_Light_Bulb/.skip.esp32s3 b/libraries/ESP32/examples/Zigbee/Zigbee_Light_Bulb/.skip.esp32s3 new file mode 100644 index 00000000000..e69de29bb2d diff --git a/libraries/ESP32/examples/Zigbee/Zigbee_Light_Bulb/README.md b/libraries/ESP32/examples/Zigbee/Zigbee_Light_Bulb/README.md new file mode 100644 index 00000000000..a1de3abef2c --- /dev/null +++ b/libraries/ESP32/examples/Zigbee/Zigbee_Light_Bulb/README.md @@ -0,0 +1,70 @@ +# Arduino-ESP32 Zigbee Light Bulb Example + +This example shows how to configure the Zigbee end device and use it as a HA on/off light bulb. + +**This example is based on ESP-Zigbee-SDK example esp_zigbee_HA_sample/HA_on_off_light.** + +# Supported Targets + +Currently, this example supports the following targets. + +| Supported Targets | ESP32-C6 | ESP32-H2 | +| ----------------- | -------- | -------- | + +## Hardware Required + +* One development board (ESP32-H2 or ESP32-C6) acting as Zigbee coordinator (loaded with Zigbee_Light_switch example) +* A USB cable for power supply and programming +* Choose another board (ESP32-H2 or ESP32-C6) as Zigbee end device (loaded with Zigbee_Light_bulb example) + +### Configure the Project + +Set the LED GPIO by changing the `LED_PIN` definition. By default, the LED_PIN is `RGB_BUILTIN`. +By default, the `neoPixelWrite` function is used to control the LED. You can change it to digitalWrite to control a simple LED. + +#### Using Arduino IDE + +To get more information about the Espressif boards see [Espressif Development Kits](https://www.espressif.com/en/products/devkits). + +* Before Compile/Verify, select the correct board: `Tools -> Board`. +* Select the End device Zigbee mode: `Tools -> Zigbee mode: Zigbee ED (end device)` +* Select Partition Scheme for Zigbee: `Tools -> Partition Scheme: Zigbee 4MB with spiffs` +* Select the COM port: `Tools -> Port: xxx` where the `xxx` is the detected COM port. + +## Troubleshooting + +If the End device flashed with this example is not connecting to the coordinator, erase the flash before flashing it to the board. It is recommended to do this if you did changes to the coordinator. +You can do the following: + +* In the Arduino IDE go to the Tools menu and set `Erase All Flash Before Sketch Upload` to `Enabled` +* In the sketch uncomment function `esp_zb_nvram_erase_at_start(true);` located in `esp_zb_task` function. + +***Important: Make sure you are using a good quality USB cable and that you have a reliable power source*** + +* **LED not blinking:** Check the wiring connection and the IO selection. +* **Programming Fail:** If the programming/flash procedure fails, try reducing the serial connection speed. +* **COM port not detected:** Check the USB cable and the USB to Serial driver installation. + +If the error persists, you can ask for help at the official [ESP32 forum](https://esp32.com) or see [Contribute](#contribute). + +## Contribute + +To know how to contribute to this project, see [How to contribute.](https://github.com/espressif/arduino-esp32/blob/master/CONTRIBUTING.rst) + +If you have any **feedback** or **issue** to report on this example/library, please open an issue or fix it by creating a new PR. Contributions are more than welcome! + +Before creating a new issue, be sure to try Troubleshooting and check if the same issue was already created by someone else. + +## Resources + +The ESP Zigbee SDK provides more examples: +* ESP Zigbee SDK Docs: [Link](https://docs.espressif.com/projects/esp-zigbee-sdk) +* ESP Zigbee SDK Repo: [Link](https://github.com/espressif/esp-zigbee-sdk) + +* Official ESP32 Forum: [Link](https://esp32.com) +* Arduino-ESP32 Official Repository: [espressif/arduino-esp32](https://github.com/espressif/arduino-esp32) +* ESP32 Datasheet: [Link to datasheet](https://www.espressif.com/sites/default/files/documentation/esp32_datasheet_en.pdf) +* ESP32-S2 Datasheet: [Link to datasheet](https://www.espressif.com/sites/default/files/documentation/esp32-s2_datasheet_en.pdf) +* ESP32-C3 Datasheet: [Link to datasheet](https://www.espressif.com/sites/default/files/documentation/esp32-c3_datasheet_en.pdf) +* ESP32-S3 Datasheet: [Link to datasheet](https://www.espressif.com/sites/default/files/documentation/esp32-s3_datasheet_en.pdf) +* Official ESP-IDF documentation: [ESP-IDF](https://idf.espressif.com) diff --git a/libraries/ESP32/examples/Zigbee/Zigbee_Light_Bulb/Zigbee_Light_Bulb.ino b/libraries/ESP32/examples/Zigbee/Zigbee_Light_Bulb/Zigbee_Light_Bulb.ino new file mode 100644 index 00000000000..1fc99897d9d --- /dev/null +++ b/libraries/ESP32/examples/Zigbee/Zigbee_Light_Bulb/Zigbee_Light_Bulb.ino @@ -0,0 +1,191 @@ +// Copyright 2023 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at + +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/** + * @brief This example demonstrates simple Zigbee light bulb. + * + * The example demonstrates how to use ESP Zigbee stack to create a end device light bulb. + * The light bulb is a Zigbee end device, which is controlled by a Zigbee coordinator. + * + * Proper Zigbee mode must be selected in Tools->Zigbee mode + * and also the correct partition scheme must be selected in Tools->Partition Scheme. + * + * Please check the README.md for instructions and more detailed description. + */ + +#ifndef ZIGBEE_MODE_ED +#error "Zigbee end device mode is not selected in Tools->Zigbee mode" +#endif + +#include "esp_zigbee_core.h" +#include "freertos/FreeRTOS.h" +#include "freertos/task.h" +#include "ha/esp_zigbee_ha_standard.h" + +#define LED_PIN RGB_BUILTIN + +/* Default End Device config */ +#define ESP_ZB_ZED_CONFIG() \ + { \ + .esp_zb_role = ESP_ZB_DEVICE_TYPE_ED, \ + .install_code_policy = INSTALLCODE_POLICY_ENABLE, \ + .nwk_cfg = { \ + .zed_cfg = { \ + .ed_timeout = ED_AGING_TIMEOUT, \ + .keep_alive = ED_KEEP_ALIVE, \ + }, \ + }, \ + } + +#define ESP_ZB_DEFAULT_RADIO_CONFIG() \ + { \ + .radio_mode = RADIO_MODE_NATIVE, \ + } + +#define ESP_ZB_DEFAULT_HOST_CONFIG() \ + { \ + .host_connection_mode = HOST_CONNECTION_MODE_NONE, \ + } + +/* Zigbee configuration */ +#define INSTALLCODE_POLICY_ENABLE false /* enable the install code policy for security */ +#define ED_AGING_TIMEOUT ESP_ZB_ED_AGING_TIMEOUT_64MIN +#define ED_KEEP_ALIVE 3000 /* 3000 millisecond */ +#define HA_ESP_LIGHT_ENDPOINT 10 /* esp light bulb device endpoint, used to process light controlling commands */ +#define ESP_ZB_PRIMARY_CHANNEL_MASK ESP_ZB_TRANSCEIVER_ALL_CHANNELS_MASK /* Zigbee primary channel mask use in the example */ + +/********************* Zigbee functions **************************/ +static void bdb_start_top_level_commissioning_cb(uint8_t mode_mask) +{ + ESP_ERROR_CHECK(esp_zb_bdb_start_top_level_commissioning(mode_mask)); +} + +void esp_zb_app_signal_handler(esp_zb_app_signal_t *signal_struct) +{ + uint32_t *p_sg_p = signal_struct->p_app_signal; + esp_err_t err_status = signal_struct->esp_err_status; + esp_zb_app_signal_type_t sig_type = (esp_zb_app_signal_type_t)*p_sg_p; + switch (sig_type) { + case ESP_ZB_ZDO_SIGNAL_SKIP_STARTUP: + log_i("Zigbee stack initialized"); + esp_zb_bdb_start_top_level_commissioning(ESP_ZB_BDB_MODE_INITIALIZATION); + break; + case ESP_ZB_BDB_SIGNAL_DEVICE_FIRST_START: + case ESP_ZB_BDB_SIGNAL_DEVICE_REBOOT: + if (err_status == ESP_OK) { + log_i("Start network steering"); + esp_zb_bdb_start_top_level_commissioning(ESP_ZB_BDB_MODE_NETWORK_STEERING); + } else { + /* commissioning failed */ + log_w("Failed to initialize Zigbee stack (status: %s)", esp_err_to_name(err_status)); + } + break; + case ESP_ZB_BDB_SIGNAL_STEERING: + if (err_status == ESP_OK) { + esp_zb_ieee_addr_t extended_pan_id; + esp_zb_get_extended_pan_id(extended_pan_id); + log_i("Joined network successfully (Extended PAN ID: %02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x, PAN ID: 0x%04hx, Channel:%d, Short Address: 0x%04hx)", + extended_pan_id[7], extended_pan_id[6], extended_pan_id[5], extended_pan_id[4], + extended_pan_id[3], extended_pan_id[2], extended_pan_id[1], extended_pan_id[0], + esp_zb_get_pan_id(), esp_zb_get_current_channel(), esp_zb_get_short_address()); + } else { + log_i("Network steering was not successful (status: %s)", esp_err_to_name(err_status)); + esp_zb_scheduler_alarm((esp_zb_callback_t)bdb_start_top_level_commissioning_cb, ESP_ZB_BDB_MODE_NETWORK_STEERING, 1000); + } + break; + default: + log_i("ZDO signal: %s (0x%x), status: %s", esp_zb_zdo_signal_to_string(sig_type), sig_type, + esp_err_to_name(err_status)); + break; + } +} + +static esp_err_t zb_action_handler(esp_zb_core_action_callback_id_t callback_id, const void *message) +{ + esp_err_t ret = ESP_OK; + switch (callback_id) { + case ESP_ZB_CORE_SET_ATTR_VALUE_CB_ID: + ret = zb_attribute_handler((esp_zb_zcl_set_attr_value_message_t *)message); + break; + default: + log_w("Receive Zigbee action(0x%x) callback", callback_id); + break; + } + return ret; +} + +static void esp_zb_task(void *pvParameters) +{ + esp_zb_cfg_t zb_nwk_cfg = ESP_ZB_ZED_CONFIG(); + esp_zb_init(&zb_nwk_cfg); + esp_zb_on_off_light_cfg_t light_cfg = ESP_ZB_DEFAULT_ON_OFF_LIGHT_CONFIG(); + esp_zb_ep_list_t *esp_zb_on_off_light_ep = esp_zb_on_off_light_ep_create(HA_ESP_LIGHT_ENDPOINT, &light_cfg); + esp_zb_device_register(esp_zb_on_off_light_ep); + esp_zb_core_action_handler_register(zb_action_handler); + esp_zb_set_primary_network_channel_set(ESP_ZB_PRIMARY_CHANNEL_MASK); + + //Erase NVRAM before creating connection to new Coordinator + //esp_zb_nvram_erase_at_start(true); //Comment out this line to erase NVRAM data if you are conneting to new Coordinator + + ESP_ERROR_CHECK(esp_zb_start(false)); + esp_zb_main_loop_iteration(); +} + +/* Handle the light attribute */ + +static esp_err_t zb_attribute_handler(const esp_zb_zcl_set_attr_value_message_t *message) +{ + esp_err_t ret = ESP_OK; + bool light_state = 0; + + if(!message){ + log_e("Empty message"); + } + if(message->info.status != ESP_ZB_ZCL_STATUS_SUCCESS){ + log_e("Received message: error status(%d)", message->info.status); + } + + log_i("Received message: endpoint(%d), cluster(0x%x), attribute(0x%x), data size(%d)", message->info.dst_endpoint, message->info.cluster, + message->attribute.id, message->attribute.data.size); + if (message->info.dst_endpoint == HA_ESP_LIGHT_ENDPOINT) { + if (message->info.cluster == ESP_ZB_ZCL_CLUSTER_ID_ON_OFF) { + if (message->attribute.id == ESP_ZB_ZCL_ATTR_ON_OFF_ON_OFF_ID && message->attribute.data.type == ESP_ZB_ZCL_ATTR_TYPE_BOOL) { + light_state = message->attribute.data.value ? *(bool *)message->attribute.data.value : light_state; + log_i("Light sets to %s", light_state ? "On" : "Off"); + neopixelWrite(LED_PIN,255*light_state,255*light_state,255*light_state); // Toggle light + } + } + } + return ret; +} + +/********************* Arduino functions **************************/ +void setup() { + // Init Zigbee + esp_zb_platform_config_t config = { + .radio_config = ESP_ZB_DEFAULT_RADIO_CONFIG(), + .host_config = ESP_ZB_DEFAULT_HOST_CONFIG(), + }; + ESP_ERROR_CHECK(esp_zb_platform_config(&config)); + + // Init RMT and leave light OFF + neopixelWrite(LED_PIN,0,0,0); + + // Start Zigbee task + xTaskCreate(esp_zb_task, "Zigbee_main", 4096, NULL, 5, NULL); +} + +void loop() { + //empty, zigbee running in task +} diff --git a/libraries/ESP32/examples/Zigbee/Zigbee_Light_Switch/.skip.esp32 b/libraries/ESP32/examples/Zigbee/Zigbee_Light_Switch/.skip.esp32 new file mode 100644 index 00000000000..e69de29bb2d diff --git a/libraries/ESP32/examples/Zigbee/Zigbee_Light_Switch/.skip.esp32c3 b/libraries/ESP32/examples/Zigbee/Zigbee_Light_Switch/.skip.esp32c3 new file mode 100644 index 00000000000..e69de29bb2d diff --git a/libraries/ESP32/examples/Zigbee/Zigbee_Light_Switch/.skip.esp32c6 b/libraries/ESP32/examples/Zigbee/Zigbee_Light_Switch/.skip.esp32c6 new file mode 100644 index 00000000000..e69de29bb2d diff --git a/libraries/ESP32/examples/Zigbee/Zigbee_Light_Switch/.skip.esp32h2 b/libraries/ESP32/examples/Zigbee/Zigbee_Light_Switch/.skip.esp32h2 new file mode 100644 index 00000000000..e69de29bb2d diff --git a/libraries/ESP32/examples/Zigbee/Zigbee_Light_Switch/.skip.esp32s2 b/libraries/ESP32/examples/Zigbee/Zigbee_Light_Switch/.skip.esp32s2 new file mode 100644 index 00000000000..e69de29bb2d diff --git a/libraries/ESP32/examples/Zigbee/Zigbee_Light_Switch/.skip.esp32s3 b/libraries/ESP32/examples/Zigbee/Zigbee_Light_Switch/.skip.esp32s3 new file mode 100644 index 00000000000..e69de29bb2d diff --git a/libraries/ESP32/examples/Zigbee/Zigbee_Light_Switch/README.md b/libraries/ESP32/examples/Zigbee/Zigbee_Light_Switch/README.md new file mode 100644 index 00000000000..98f509150a1 --- /dev/null +++ b/libraries/ESP32/examples/Zigbee/Zigbee_Light_Switch/README.md @@ -0,0 +1,70 @@ +# Arduino-ESP32 Zigbee Light Switch Example + +This example shows how to configure Zigbee Coordinator and use it as an HA on/off light switch. + +**This example is based on ESP-Zigbee-SDK example esp_zigbee_HA_sample/HA_on_off_switch.** + +# Supported Targets + +Currently, this example supports the following targets. + +| Supported Targets | ESP32-C6 | ESP32-H2 | +| ----------------- | -------- | -------- | + +## Hardware Required + +* One development board (ESP32-H2 or ESP32-C6) acting as Zigbee end device (loaded with Zigbee_Light_bulb example). +* A USB cable for power supply and programming. +* Choose another board (ESP32-H2 or ESP32-C6) as Zigbee coordinator (loaded with Zigbee_Light_switch example). + +### Configure the Project + +Set the Button Switch GPIO by changing the `GPIO_INPUT_IO_TOGGLE_SWITCH` definition. By default, the LED_PIN is `GPIO_NUM_9`. + +#### Using Arduino IDE + +To get more information about the Espressif boards see [Espressif Development Kits](https://www.espressif.com/en/products/devkits). + +* Before Compile/Verify, select the correct board: `Tools -> Board`. +* Select the Coordinator Zigbee mode: `Tools -> Zigbee mode: Zigbee ZCZR (coordinator)`. +* Select Partition Scheme for Zigbee: `Tools -> Partition Scheme: Zigbee 4MB with spiffs`. +* Select the COM port: `Tools -> Port: xxx where the `xxx` is the detected COM port. +* Optional: Set debug level to info to see logs from Zigbee stack: `Tools -> Core Debug Level: Info`. + +## Troubleshooting + +If the End device flashed with the example `Zigbee_Light_Bulb` is not connecting to the coordinator, erase the flash of the End device before flashing the example to the board. It is recommended to do this if you re-flash the coordinator. +You can do the following: + +* In the Arduino IDE go to the Tools menu and set `Erase All Flash Before Sketch Upload` to `Enabled`. +* In the `Zigbee_Light_Bulb` example sketch uncomment function `esp_zb_nvram_erase_at_start(true);` located in `esp_zb_task` function. + +***Important: Make sure you are using a good quality USB cable and that you have a reliable power source*** + +* **LED not blinking:** Check the wiring connection and the IO selection. +* **Programming Fail:** If the programming/flash procedure fails, try reducing the serial connection speed. +* **COM port not detected:** Check the USB cable and the USB to Serial driver installation. + +If the error persists, you can ask for help at the official [ESP32 forum](https://esp32.com) or see [Contribute](#contribute). + +## Contribute + +To know how to contribute to this project, see [How to contribute.](https://github.com/espressif/arduino-esp32/blob/master/CONTRIBUTING.rst) + +If you have any **feedback** or **issue** to report on this example/library, please open an issue or fix it by creating a new PR. Contributions are more than welcome! + +Before creating a new issue, be sure to try Troubleshooting and check if the same issue was already created by someone else. + +## Resources + +The ESP Zigbee SDK provides more examples: +* ESP Zigbee SDK Docs: [Link](https://docs.espressif.com/projects/esp-zigbee-sdk) +* ESP Zigbee SDK Repo: [Link](https://github.com/espressif/esp-zigbee-sdk) + +* Official ESP32 Forum: [Link](https://esp32.com) +* Arduino-ESP32 Official Repository: [espressif/arduino-esp32](https://github.com/espressif/arduino-esp32) +* ESP32 Datasheet: [Link to datasheet](https://www.espressif.com/sites/default/files/documentation/esp32_datasheet_en.pdf) +* ESP32-S2 Datasheet: [Link to datasheet](https://www.espressif.com/sites/default/files/documentation/esp32-s2_datasheet_en.pdf) +* ESP32-C3 Datasheet: [Link to datasheet](https://www.espressif.com/sites/default/files/documentation/esp32-c3_datasheet_en.pdf) +* ESP32-S3 Datasheet: [Link to datasheet](https://www.espressif.com/sites/default/files/documentation/esp32-s3_datasheet_en.pdf) +* Official ESP-IDF documentation: [ESP-IDF](https://idf.espressif.com) diff --git a/libraries/ESP32/examples/Zigbee/Zigbee_Light_Switch/Zigbee_Light_Switch.ino b/libraries/ESP32/examples/Zigbee/Zigbee_Light_Switch/Zigbee_Light_Switch.ino new file mode 100644 index 00000000000..d0f2d5c2ee8 --- /dev/null +++ b/libraries/ESP32/examples/Zigbee/Zigbee_Light_Switch/Zigbee_Light_Switch.ino @@ -0,0 +1,302 @@ +// Copyright 2023 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at + +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/** + * @brief This example demonstrates simple Zigbee light switch. + * + * The example demonstrates how to use ESP Zigbee stack to control a light bulb. + * The light bulb is a Zigbee end device, which is controlled by a Zigbee coordinator. + * Button switch and Zigbee runs in separate tasks. + * + * Proper Zigbee mode must be selected in Tools->Zigbee mode + * and also the correct partition scheme must be selected in Tools->Partition Scheme. + * + * Please check the README.md for instructions and more detailed description. + */ + +#ifndef ZIGBEE_MODE_ZCZR +#error "Zigbee coordinator mode is not selected in Tools->Zigbee mode" +#endif + +#include "esp_zigbee_core.h" +#include "freertos/FreeRTOS.h" +#include "freertos/task.h" +#include "ha/esp_zigbee_ha_standard.h" + +/* Switch configuration */ +#define GPIO_INPUT_IO_TOGGLE_SWITCH GPIO_NUM_9 +#define PAIR_SIZE(TYPE_STR_PAIR) (sizeof(TYPE_STR_PAIR) / sizeof(TYPE_STR_PAIR[0])) + +typedef enum { + SWITCH_ON_CONTROL, + SWITCH_OFF_CONTROL, + SWITCH_ONOFF_TOGGLE_CONTROL, + SWITCH_LEVEL_UP_CONTROL, + SWITCH_LEVEL_DOWN_CONTROL, + SWITCH_LEVEL_CYCLE_CONTROL, + SWITCH_COLOR_CONTROL, +} switch_func_t; + +typedef struct { + uint8_t pin; + switch_func_t func; +} switch_func_pair_t; + +typedef enum { + SWITCH_IDLE, + SWITCH_PRESS_ARMED, + SWITCH_PRESS_DETECTED, + SWITCH_PRESSED, + SWITCH_RELEASE_DETECTED, +} switch_state_t; + +static switch_func_pair_t button_func_pair[] = { + {GPIO_INPUT_IO_TOGGLE_SWITCH, SWITCH_ONOFF_TOGGLE_CONTROL} +}; + +/* Default Coordinator config */ +#define ESP_ZB_ZC_CONFIG() \ + { \ + .esp_zb_role = ESP_ZB_DEVICE_TYPE_COORDINATOR, \ + .install_code_policy = INSTALLCODE_POLICY_ENABLE, \ + .nwk_cfg = { \ + .zczr_cfg = { \ + .max_children = MAX_CHILDREN, \ + }, \ + } \ + } + +#define ESP_ZB_DEFAULT_RADIO_CONFIG() \ + { \ + .radio_mode = RADIO_MODE_NATIVE, \ + } + +#define ESP_ZB_DEFAULT_HOST_CONFIG() \ + { \ + .host_connection_mode = HOST_CONNECTION_MODE_NONE, \ + } + +typedef struct light_bulb_device_params_s { + esp_zb_ieee_addr_t ieee_addr; + uint8_t endpoint; + uint16_t short_addr; +} light_bulb_device_params_t; + +/* Zigbee configuration */ +#define MAX_CHILDREN 10 /* the max amount of connected devices */ +#define INSTALLCODE_POLICY_ENABLE false /* enable the install code policy for security */ +#define HA_ONOFF_SWITCH_ENDPOINT 1 /* esp light switch device endpoint */ +#define ESP_ZB_PRIMARY_CHANNEL_MASK ESP_ZB_TRANSCEIVER_ALL_CHANNELS_MASK /* Zigbee primary channel mask use in the example */ + +/********************* Define functions **************************/ +static void esp_zb_buttons_handler(switch_func_pair_t *button_func_pair) +{ + if (button_func_pair->func == SWITCH_ONOFF_TOGGLE_CONTROL) { + /* implemented light switch toggle functionality */ + esp_zb_zcl_on_off_cmd_t cmd_req; + cmd_req.zcl_basic_cmd.src_endpoint = HA_ONOFF_SWITCH_ENDPOINT; + cmd_req.address_mode = ESP_ZB_APS_ADDR_MODE_DST_ADDR_ENDP_NOT_PRESENT; + cmd_req.on_off_cmd_id = ESP_ZB_ZCL_CMD_ON_OFF_TOGGLE_ID; + log_i("Send 'on_off toggle' command"); + esp_zb_zcl_on_off_cmd_req(&cmd_req); + } +} + +static void bdb_start_top_level_commissioning_cb(uint8_t mode_mask) +{ + ESP_ERROR_CHECK(esp_zb_bdb_start_top_level_commissioning(mode_mask)); +} + +static void bind_cb(esp_zb_zdp_status_t zdo_status, void *user_ctx) +{ + if (zdo_status == ESP_ZB_ZDP_STATUS_SUCCESS) { + log_i("Bound successfully!"); + if (user_ctx) { + light_bulb_device_params_t *light = (light_bulb_device_params_t *)user_ctx; + log_i("The light originating from address(0x%x) on endpoint(%d)", light->short_addr, light->endpoint); + free(light); + } + } +} + +static void user_find_cb(esp_zb_zdp_status_t zdo_status, uint16_t addr, uint8_t endpoint, void *user_ctx) +{ + if (zdo_status == ESP_ZB_ZDP_STATUS_SUCCESS) { + log_i("Found light"); + esp_zb_zdo_bind_req_param_t bind_req; + light_bulb_device_params_t *light = (light_bulb_device_params_t *)malloc(sizeof(light_bulb_device_params_t)); + light->endpoint = endpoint; + light->short_addr = addr; + esp_zb_ieee_address_by_short(light->short_addr, light->ieee_addr); + esp_zb_get_long_address(bind_req.src_address); + bind_req.src_endp = HA_ONOFF_SWITCH_ENDPOINT; + bind_req.cluster_id = ESP_ZB_ZCL_CLUSTER_ID_ON_OFF; + bind_req.dst_addr_mode = ESP_ZB_ZDO_BIND_DST_ADDR_MODE_64_BIT_EXTENDED; + memcpy(bind_req.dst_address_u.addr_long, light->ieee_addr, sizeof(esp_zb_ieee_addr_t)); + bind_req.dst_endp = endpoint; + bind_req.req_dst_addr = esp_zb_get_short_address(); + log_i("Try to bind On/Off"); + esp_zb_zdo_device_bind_req(&bind_req, bind_cb, (void *)light); + } +} + +void esp_zb_app_signal_handler(esp_zb_app_signal_t *signal_struct) +{ + uint32_t *p_sg_p = signal_struct->p_app_signal; + esp_err_t err_status = signal_struct->esp_err_status; + esp_zb_app_signal_type_t sig_type = (esp_zb_app_signal_type_t)*p_sg_p; + esp_zb_zdo_signal_device_annce_params_t *dev_annce_params = NULL; + switch (sig_type) { + case ESP_ZB_ZDO_SIGNAL_SKIP_STARTUP: + log_i("Zigbee stack initialized"); + esp_zb_bdb_start_top_level_commissioning(ESP_ZB_BDB_MODE_INITIALIZATION); + break; + case ESP_ZB_BDB_SIGNAL_DEVICE_FIRST_START: + case ESP_ZB_BDB_SIGNAL_DEVICE_REBOOT: + if (err_status == ESP_OK) { + log_i("Start network formation"); + esp_zb_bdb_start_top_level_commissioning(ESP_ZB_BDB_MODE_NETWORK_FORMATION); + } else { + log_e("Failed to initialize Zigbee stack (status: %s)", esp_err_to_name(err_status)); + } + break; + case ESP_ZB_BDB_SIGNAL_FORMATION: + if (err_status == ESP_OK) { + esp_zb_ieee_addr_t extended_pan_id; + esp_zb_get_extended_pan_id(extended_pan_id); + log_i("Formed network successfully (Extended PAN ID: %02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x, PAN ID: 0x%04hx, Channel:%d, Short Address: 0x%04hx)", + extended_pan_id[7], extended_pan_id[6], extended_pan_id[5], extended_pan_id[4], + extended_pan_id[3], extended_pan_id[2], extended_pan_id[1], extended_pan_id[0], + esp_zb_get_pan_id(), esp_zb_get_current_channel(), esp_zb_get_short_address()); + esp_zb_bdb_start_top_level_commissioning(ESP_ZB_BDB_MODE_NETWORK_STEERING); + } else { + log_i("Restart network formation (status: %s)", esp_err_to_name(err_status)); + esp_zb_scheduler_alarm((esp_zb_callback_t)bdb_start_top_level_commissioning_cb, ESP_ZB_BDB_MODE_NETWORK_FORMATION, 1000); + } + break; + case ESP_ZB_BDB_SIGNAL_STEERING: + if (err_status == ESP_OK) { + log_i("Network steering started"); + } + break; + case ESP_ZB_ZDO_SIGNAL_DEVICE_ANNCE: + dev_annce_params = (esp_zb_zdo_signal_device_annce_params_t *)esp_zb_app_signal_get_params(p_sg_p); + log_i("New device commissioned or rejoined (short: 0x%04hx)", dev_annce_params->device_short_addr); + esp_zb_zdo_match_desc_req_param_t cmd_req; + cmd_req.dst_nwk_addr = dev_annce_params->device_short_addr; + cmd_req.addr_of_interest = dev_annce_params->device_short_addr; + esp_zb_zdo_find_on_off_light(&cmd_req, user_find_cb, NULL); + break; + default: + log_i("ZDO signal: %s (0x%x), status: %s", esp_zb_zdo_signal_to_string(sig_type), sig_type, + esp_err_to_name(err_status)); + break; + } +} + +static void esp_zb_task(void *pvParameters) +{ + esp_zb_cfg_t zb_nwk_cfg = ESP_ZB_ZC_CONFIG(); + esp_zb_init(&zb_nwk_cfg); + esp_zb_on_off_switch_cfg_t switch_cfg = ESP_ZB_DEFAULT_ON_OFF_SWITCH_CONFIG(); + esp_zb_ep_list_t *esp_zb_on_off_switch_ep = esp_zb_on_off_switch_ep_create(HA_ONOFF_SWITCH_ENDPOINT, &switch_cfg); + esp_zb_device_register(esp_zb_on_off_switch_ep); + esp_zb_set_primary_network_channel_set(ESP_ZB_PRIMARY_CHANNEL_MASK); + ESP_ERROR_CHECK(esp_zb_start(false)); + esp_zb_main_loop_iteration(); +} + +/********************* GPIO functions **************************/ +static QueueHandle_t gpio_evt_queue = NULL; + +static void IRAM_ATTR gpio_isr_handler(void *arg) +{ + xQueueSendFromISR(gpio_evt_queue, (switch_func_pair_t *)arg, NULL); +} + +static void switch_gpios_intr_enabled(bool enabled) +{ + for (int i = 0; i < PAIR_SIZE(button_func_pair); ++i) { + if (enabled) { + enableInterrupt((button_func_pair[i]).pin); + } else { + disableInterrupt((button_func_pair[i]).pin); + } + } +} + +/********************* Arduino functions **************************/ +void setup() { + // Init Zigbee + esp_zb_platform_config_t config = { + .radio_config = ESP_ZB_DEFAULT_RADIO_CONFIG(), + .host_config = ESP_ZB_DEFAULT_HOST_CONFIG(), + }; + + ESP_ERROR_CHECK(esp_zb_platform_config(&config)); + + // Init button switch + for (int i = 0; i < PAIR_SIZE(button_func_pair); i++) { + pinMode(button_func_pair[i].pin, INPUT_PULLUP); + /* create a queue to handle gpio event from isr */ + gpio_evt_queue = xQueueCreate(10, sizeof(switch_func_pair_t)); + if ( gpio_evt_queue == 0) { + log_e("Queue was not created and must not be used"); + while(1); + } + attachInterruptArg(button_func_pair[i].pin, gpio_isr_handler, (void *) (button_func_pair + i), FALLING); + } + + // Start Zigbee task + xTaskCreate(esp_zb_task, "Zigbee_main", 4096, NULL, 5, NULL); +} + +void loop() { + // Handle button switch in loop() + uint8_t pin = 0; + switch_func_pair_t button_func_pair; + static switch_state_t switch_state = SWITCH_IDLE; + bool evt_flag = false; + + /* check if there is any queue received, if yes read out the button_func_pair */ + if (xQueueReceive(gpio_evt_queue, &button_func_pair, portMAX_DELAY)) { + pin = button_func_pair.pin; + switch_gpios_intr_enabled(false); + evt_flag = true; + } + while (evt_flag) { + bool value = digitalRead(pin); + switch (switch_state) { + case SWITCH_IDLE: + switch_state = (value == LOW) ? SWITCH_PRESS_DETECTED : SWITCH_IDLE; + break; + case SWITCH_PRESS_DETECTED: + switch_state = (value == LOW) ? SWITCH_PRESS_DETECTED : SWITCH_RELEASE_DETECTED; + break; + case SWITCH_RELEASE_DETECTED: + switch_state = SWITCH_IDLE; + /* callback to button_handler */ + (*esp_zb_buttons_handler)(&button_func_pair); + break; + default: + break; + } + if (switch_state == SWITCH_IDLE) { + switch_gpios_intr_enabled(true); + evt_flag = false; + break; + } + vTaskDelay(10 / portTICK_PERIOD_MS); + } +} diff --git a/libraries/ESP_I2S/examples/ES8388_loopback/ES8388.cpp b/libraries/ESP_I2S/examples/ES8388_loopback/ES8388.cpp new file mode 100644 index 00000000000..b072ddd84af --- /dev/null +++ b/libraries/ESP_I2S/examples/ES8388_loopback/ES8388.cpp @@ -0,0 +1,918 @@ +/* + This is a very basic driver for the ES8388 based on the driver written by + me for NuttX. It is not complete and is missing master mode, mono mode, many + features and configuration options. You can use readReg and writeReg to + access the registers directly and configure missing features. Feel free to + contribute by adding missing features and improving the driver. + It is intended to be used only with arduino-esp32. + + The default configuration can be found in the ES8388.h file. + + This was only tested with the ESP32-LyraT board using 44100Hz 16-bit stereo + audio. It may not work with other configurations. + + Created for arduino-esp32 on 20 Dec, 2023 + by Lucas Saavedra Vaz (lucasssvaz) +*/ + +#include + +#include "ESP_I2S.h" +#include "Wire.h" + +#include "ES8388.h" + +/**************************************************************************** + * Private Methods + ****************************************************************************/ + +/* + Name: start + + Description: + Unmute and start the ES8388 codec data transmission. +*/ + +void ES8388::start() +{ + uint8_t prev_regval = 0; + uint8_t regval = 0; + + log_v("Starting ES8388 transmission..."); + _running = true; + prev_regval = readReg(ES8388_DACCONTROL21); + + if (_audio_mode == ES_MODULE_LINE) + { + writeReg(ES8388_DACCONTROL16, + ES8388_RMIXSEL_RIN2 | + ES8388_LMIXSEL_LIN2); + + writeReg(ES8388_DACCONTROL17, + ES8388_LI2LOVOL(ES8388_MIXER_GAIN_0DB) | + ES8388_LI2LO_ENABLE | + ES8388_LD2LO_DISABLE); + + writeReg(ES8388_DACCONTROL20, + ES8388_RI2ROVOL(ES8388_MIXER_GAIN_0DB) | + ES8388_RI2RO_ENABLE | + ES8388_RD2RO_DISABLE); + + writeReg(ES8388_DACCONTROL21, + ES8388_DAC_DLL_PWD_NORMAL | + ES8388_ADC_DLL_PWD_NORMAL | + ES8388_MCLK_DIS_NORMAL | + ES8388_OFFSET_DIS_DISABLE | + ES8388_LRCK_SEL_ADC | + ES8388_SLRCK_SAME); + } + else + { + writeReg(ES8388_DACCONTROL21, + ES8388_DAC_DLL_PWD_NORMAL | + ES8388_ADC_DLL_PWD_NORMAL | + ES8388_MCLK_DIS_NORMAL | + ES8388_OFFSET_DIS_DISABLE | + ES8388_LRCK_SEL_DAC | + ES8388_SLRCK_SAME); + } + + regval = readReg(ES8388_DACCONTROL21); + + if (regval != prev_regval) + { + writeReg(ES8388_CHIPPOWER, + ES8388_DACVREF_PDN_PWRUP | + ES8388_ADCVREF_PDN_PWRUP | + ES8388_DACDLL_PDN_NORMAL | + ES8388_ADCDLL_PDN_NORMAL | + ES8388_DAC_STM_RST_RESET | + ES8388_ADC_STM_RST_RESET | + ES8388_DAC_DIGPDN_RESET | + ES8388_ADC_DIGPDN_RESET); + + writeReg(ES8388_CHIPPOWER, + ES8388_DACVREF_PDN_PWRUP | + ES8388_ADCVREF_PDN_PWRUP | + ES8388_DACDLL_PDN_NORMAL | + ES8388_ADCDLL_PDN_NORMAL | + ES8388_DAC_STM_RST_NORMAL | + ES8388_ADC_STM_RST_NORMAL | + ES8388_DAC_DIGPDN_NORMAL | + ES8388_ADC_DIGPDN_NORMAL); + } + + if (_audio_mode == ES_MODULE_LINE || _audio_mode == ES_MODULE_ADC_DAC || _audio_mode == ES_MODULE_ADC) + { + writeReg(ES8388_ADCPOWER, + ES8388_INT1LP_NORMAL | + ES8388_FLASHLP_NORMAL | + ES8388_PDNADCBIASGEN_NORMAL | + ES8388_PDNMICB_PWRON | + ES8388_PDNADCR_PWRUP | + ES8388_PDNADCL_PWRUP | + ES8388_PDNAINR_NORMAL | + ES8388_PDNAINL_NORMAL); + } + + if (_audio_mode == ES_MODULE_LINE || _audio_mode == ES_MODULE_ADC_DAC || _audio_mode == ES_MODULE_DAC) + { + writeReg(ES8388_DACPOWER, + ES8388_ROUT2_ENABLE | + ES8388_LOUT2_ENABLE | + ES8388_ROUT1_ENABLE | + ES8388_LOUT1_ENABLE | + ES8388_PDNDACR_PWRUP | + ES8388_PDNDACL_PWRUP); + } + + setmute(_audio_mode, false); + log_v("ES8388 transmission started."); +} + +/* + Name: reset + + Description: + Reset the ES8388 codec to a known state depending on the audio mode. +*/ + +void ES8388::reset() +{ + uint8_t regconfig; + + log_v("Resetting ES8388..."); + log_d("Current configuration: _bpsamp=%d, _samprate=%d, _nchannels=%d, _audio_mode=%d, _dac_output=%d, _adc_input=%d, _mic_gain=%d", + _bpsamp, _samprate, _nchannels, _audio_mode, _dac_output, _adc_input, _mic_gain); + + writeReg(ES8388_DACCONTROL3, + ES8388_DACMUTE_MUTED | + ES8388_DACLER_NORMAL | + ES8388_DACSOFTRAMP_DISABLE | + ES8388_DACRAMPRATE_4LRCK); + + writeReg(ES8388_CONTROL2, + ES8388_PDNVREFBUF_NORMAL | + ES8388_VREFLO_NORMAL | + ES8388_PDNIBIASGEN_NORMAL | + ES8388_PDNANA_NORMAL | + ES8388_LPVREFBUF_LP | + ES8388_LPVCMMOD_NORMAL | + (1 << 6)); /* Default value of undocumented bit */ + + writeReg(ES8388_CHIPPOWER, + ES8388_DACVREF_PDN_PWRUP | + ES8388_ADCVREF_PDN_PWRUP | + ES8388_DACDLL_PDN_NORMAL | + ES8388_ADCDLL_PDN_NORMAL | + ES8388_DAC_STM_RST_NORMAL | + ES8388_ADC_STM_RST_NORMAL | + ES8388_DAC_DIGPDN_NORMAL | + ES8388_ADC_DIGPDN_NORMAL); + + /* Disable the internal DLL to improve 8K sample rate */ + + writeReg(0x35, 0xa0); + writeReg(0x37, 0xd0); + writeReg(0x39, 0xd0); + + writeReg(ES8388_MASTERMODE, + ES8388_BCLKDIV(ES_MCLK_DIV_AUTO) | + ES8388_BCLK_INV_NORMAL | + ES8388_MCLKDIV2_NODIV | + ES8388_MSC_SLAVE); + + writeReg(ES8388_DACPOWER, + ES8388_ROUT2_DISABLE | + ES8388_LOUT2_DISABLE | + ES8388_ROUT1_DISABLE | + ES8388_LOUT1_DISABLE | + ES8388_PDNDACR_PWRDN | + ES8388_PDNDACL_PWRDN); + + writeReg(ES8388_CONTROL1, + ES8388_VMIDSEL_500K | + ES8388_ENREF_DISABLE | + ES8388_SEQEN_DISABLE | + ES8388_SAMEFS_SAME | + ES8388_DACMCLK_ADCMCLK | + ES8388_LRCM_ISOLATED | + ES8388_SCPRESET_NORMAL); + + setBitsPerSample(_bpsamp); + setSampleRate(_samprate); + + writeReg(ES8388_DACCONTROL16, + ES8388_RMIXSEL_RIN1 | ES8388_LMIXSEL_LIN1); + + writeReg(ES8388_DACCONTROL17, + ES8388_LI2LOVOL(ES8388_MIXER_GAIN_0DB) | + ES8388_LI2LO_DISABLE | + ES8388_LD2LO_ENABLE); + + writeReg(ES8388_DACCONTROL20, + ES8388_RI2ROVOL(ES8388_MIXER_GAIN_0DB) | + ES8388_RI2RO_DISABLE | + ES8388_RD2RO_ENABLE); + + writeReg(ES8388_DACCONTROL21, + ES8388_DAC_DLL_PWD_NORMAL | + ES8388_ADC_DLL_PWD_NORMAL | + ES8388_MCLK_DIS_NORMAL | + ES8388_OFFSET_DIS_DISABLE | + ES8388_LRCK_SEL_DAC | + ES8388_SLRCK_SAME); + + writeReg(ES8388_DACCONTROL23, ES8388_VROI_1_5K); + + writeReg(ES8388_DACCONTROL24, + ES8388_LOUT1VOL(ES8388_DAC_CHVOL_DB(0))); + + writeReg(ES8388_DACCONTROL25, + ES8388_ROUT1VOL(ES8388_DAC_CHVOL_DB(0))); + + writeReg(ES8388_DACCONTROL26, + ES8388_LOUT2VOL(ES8388_DAC_CHVOL_DB(0))); + + writeReg(ES8388_DACCONTROL27, + ES8388_ROUT2VOL(ES8388_DAC_CHVOL_DB(0))); + + setmute(ES_MODULE_DAC, ES8388_DEFAULT_MUTE); + setvolume(ES_MODULE_DAC, ES8388_DEFAULT_VOL_OUT, ES8388_DEFAULT_BALANCE); + + if (_dac_output == ES8388_DAC_OUTPUT_LINE2) + { + regconfig = ES_DAC_CHANNEL_LOUT1 | ES_DAC_CHANNEL_ROUT1; + } + else if (_dac_output == ES8388_DAC_OUTPUT_LINE1) + { + regconfig = ES_DAC_CHANNEL_LOUT2 | ES_DAC_CHANNEL_ROUT2; + } + else + { + regconfig = ES_DAC_CHANNEL_LOUT1 | ES_DAC_CHANNEL_ROUT1 | + ES_DAC_CHANNEL_LOUT2 | ES_DAC_CHANNEL_ROUT2; + } + + writeReg(ES8388_DACPOWER, regconfig); + + writeReg(ES8388_ADCPOWER, + ES8388_INT1LP_LP | + ES8388_FLASHLP_LP | + ES8388_PDNADCBIASGEN_LP | + ES8388_PDNMICB_PWRDN | + ES8388_PDNADCR_PWRDN | + ES8388_PDNADCL_PWRDN | + ES8388_PDNAINR_PWRDN | + ES8388_PDNAINL_PWRDN); + + setMicGain(24); /* +24 dB */ + + if (_adc_input == ES8388_ADC_INPUT_LINE1) + { + regconfig = ES_ADC_CHANNEL_LINPUT1_RINPUT1; + } + else if (_adc_input == ES8388_ADC_INPUT_LINE2) + { + regconfig = ES_ADC_CHANNEL_LINPUT2_RINPUT2; + } + else + { + regconfig = ES_ADC_CHANNEL_DIFFERENCE; + } + + writeReg(ES8388_ADCCONTROL2, regconfig); + + writeReg(ES8388_ADCCONTROL3, + (1 << 1) | /* Default value of undocumented bit */ + ES8388_TRI_NORMAL | + ES8388_MONOMIX_STEREO | + ES8388_DS_LINPUT1_RINPUT1); + + setBitsPerSample(_bpsamp); + setSampleRate(_samprate); + setmute(ES_MODULE_ADC, ES8388_DEFAULT_MUTE); + setvolume(ES_MODULE_ADC, ES8388_DEFAULT_VOL_IN, ES8388_DEFAULT_BALANCE); + + writeReg(ES8388_ADCPOWER, + ES8388_INT1LP_LP | + ES8388_FLASHLP_NORMAL | + ES8388_PDNADCBIASGEN_NORMAL | + ES8388_PDNMICB_PWRDN | + ES8388_PDNADCR_PWRUP | + ES8388_PDNADCL_PWRUP | + ES8388_PDNAINR_NORMAL | + ES8388_PDNAINL_NORMAL); + + /* Stop sequence to avoid noise at boot */ + + stop(); + + log_v("ES8388 reset."); +} + +/* + Name: stop + + Description: + Mute and stop the ES8388 codec data transmission. +*/ + +void ES8388::stop() +{ + log_v("Stopping ES8388 transmission..."); + _running = false; + + if (_audio_mode == ES_MODULE_LINE) + { + writeReg(ES8388_DACCONTROL21, + ES8388_DAC_DLL_PWD_NORMAL | + ES8388_ADC_DLL_PWD_NORMAL | + ES8388_MCLK_DIS_NORMAL | + ES8388_OFFSET_DIS_DISABLE | + ES8388_LRCK_SEL_DAC | + ES8388_SLRCK_SAME); + + writeReg(ES8388_DACCONTROL16, + ES8388_RMIXSEL_RIN1 | + ES8388_LMIXSEL_LIN1); + + writeReg(ES8388_DACCONTROL17, + ES8388_LI2LOVOL(ES8388_MIXER_GAIN_0DB) | + ES8388_LI2LO_DISABLE | + ES8388_LD2LO_ENABLE); + + writeReg(ES8388_DACCONTROL20, + ES8388_RI2ROVOL(ES8388_MIXER_GAIN_0DB) | + ES8388_RI2RO_DISABLE | + ES8388_RD2RO_ENABLE); + + goto stop_msg; + } + + if (_audio_mode == ES_MODULE_DAC || _audio_mode == ES_MODULE_ADC_DAC) + { + writeReg(ES8388_DACPOWER, + ES8388_ROUT2_DISABLE | + ES8388_LOUT2_DISABLE | + ES8388_ROUT1_DISABLE | + ES8388_LOUT1_DISABLE | + ES8388_PDNDACR_PWRUP | + ES8388_PDNDACL_PWRUP); + } + + if (_audio_mode == ES_MODULE_ADC || _audio_mode == ES_MODULE_ADC_DAC) + { + writeReg(ES8388_ADCPOWER, + ES8388_INT1LP_LP | + ES8388_FLASHLP_LP | + ES8388_PDNADCBIASGEN_LP | + ES8388_PDNMICB_PWRDN | + ES8388_PDNADCR_PWRDN | + ES8388_PDNADCL_PWRDN | + ES8388_PDNAINR_PWRDN | + ES8388_PDNAINL_PWRDN); + } + + if (_audio_mode == ES_MODULE_ADC_DAC) + { + writeReg(ES8388_DACCONTROL21, + ES8388_DAC_DLL_PWD_PWRDN | + ES8388_ADC_DLL_PWD_PWRDN | + ES8388_MCLK_DIS_DISABLE | + ES8388_OFFSET_DIS_DISABLE | + ES8388_LRCK_SEL_DAC | + ES8388_SLRCK_SAME); + } + +stop_msg: + setmute(_audio_mode, true); + log_v("ES8388 transmission stopped."); +} + +/* + Name: setvolume + + Description: + Set the volume of the ES8388 codec. + + Input Parameters: + module - Module to set the volume for. + volume - Volume level {0..1000}. + balance - Balance level {0..1000}. +*/ + +void ES8388::setvolume(es_module_e module, uint16_t volume, uint16_t balance) +{ + uint16_t leftlvl; + int16_t dbleftlvl; + uint16_t rightlvl; + int16_t dbrightlvl; + + log_d("Volume = %u, Balance = %u", volume, balance); + + if (volume > 1000) + { + log_w("Warning: Volume greater than 1000, setting to 1000."); + volume = 1000; + } + + if (balance > 1000) + { + log_w("Warning: Balance greater than 1000, setting to 1000."); + balance = 1000; + } + + _balance = balance; + + /* Calculate the left channel volume level {0..1000} */ + + if (_balance <= 500) + { + leftlvl = volume; + } + else if (_balance == 1000) + { + leftlvl = 0; + } + else + { + leftlvl = ((((1000 - _balance) * 100) / 500) * volume) / 100; + } + + /* Calculate the right channel volume level {0..1000} */ + + if (_balance >= 500) + { + rightlvl = volume; + } + else if (_balance == 0) + { + rightlvl = 0; + } + else + { + rightlvl = (((_balance * 100) / 500) * volume) / 100; + } + + /* Convert from (0..1000) to (-96..0) */ + + dbleftlvl = (int16_t) (leftlvl ? (20 * log10f((float)rightlvl / 1000)) : -96); + dbrightlvl = (int16_t) (rightlvl ? (20 * log10f((float)rightlvl / 1000)) : -96); + + log_v("Volume: dbleftlvl = %d, dbrightlvl = %d", dbleftlvl, dbrightlvl); + + /* Convert and truncate to 1 byte */ + + dbleftlvl = ((-dbleftlvl) << 1) & 0xff; + dbrightlvl = ((-dbrightlvl) << 1) & 0xff; + + /* Set the volume */ + + if (module == ES_MODULE_DAC || module == ES_MODULE_ADC_DAC) + { + writeReg(ES8388_DACCONTROL4, ES8388_LDACVOL(dbleftlvl)); + writeReg(ES8388_DACCONTROL5, ES8388_RDACVOL(dbrightlvl)); + _volume_out = volume; + } + + if (module == ES_MODULE_ADC || module == ES_MODULE_ADC_DAC) + { + writeReg(ES8388_ADCCONTROL8, ES8388_LADCVOL(dbleftlvl)); + writeReg(ES8388_ADCCONTROL9, ES8388_RADCVOL(dbrightlvl)); + _volume_in = volume; + } +} + +/* + Name: setmute + + Description: + Mute or unmute the selected ES8388 codec module. + + Input Parameters: + module - Module to mute or unmute. + enable - Mute or unmute. +*/ + +void ES8388::setmute(es_module_e module, bool enable) +{ + uint8_t reg = 0; + + log_d("module=%d, mute=%d", module, (int)enable); + + _mute = enable; + + if (module == ES_MODULE_DAC || module == ES_MODULE_ADC_DAC) + { + reg = readReg(ES8388_DACCONTROL3) & (~ES8388_DACMUTE_BITMASK); + writeReg(ES8388_DACCONTROL3, reg | ES8388_DACMUTE(enable)); + } + + if (module == ES_MODULE_ADC || module == ES_MODULE_ADC_DAC) + { + reg = readReg(ES8388_ADCCONTROL7) & (~ES8388_ADCMUTE_BITMASK); + writeReg(ES8388_ADCCONTROL7, reg | ES8388_ADCMUTE(enable)); + } +} + +/**************************************************************************** + * Public Methods + ****************************************************************************/ + +ES8388::~ES8388() +{ + end(); +} + +/* + Name: begin + + Description: + Initialize the ES8388 codec. Requires the I2S and I2C buses to be initialized + before calling this function. + + Input Parameters: + i2s - I2S bus instance. + i2c - I2C bus instance. Defaults to Wire. + addr - I2C address of the ES8388 codec. Defaults to 0x10. + + Return: + true - Success. + false - Failure. +*/ +bool ES8388::begin(I2SClass& i2s, TwoWire& i2c, uint8_t addr) +{ + log_v("Initializing ES8388..."); + + _i2c = &i2c; + _i2s = &i2s; + _addr = addr; + _fmt = ES8388_DEFAULT_FMT; + _mode = ES8388_DEFAULT_MODE; + _samprate = ES8388_DEFAULT_SAMPRATE; + _nchannels = ES8388_DEFAULT_NCHANNELS; + _bpsamp = ES8388_DEFAULT_BPSAMP; + _audio_mode = ES8388_DEFAULT_AUDIO_MODE; + _dac_output = ES8388_DEFAULT_DAC_OUTPUT; + _adc_input = ES8388_DEFAULT_ADC_INPUT; + _mic_gain = ES8388_DEFAULT_MIC_GAIN; + _running = false; + _lclk_div = ES_LCLK_DIV_256; + _word_length = ES_WORD_LENGTH_16BITS; + + _i2c->beginTransmission(_addr); + + if (_i2c->endTransmission() != 0) + { + log_e("Device not found at address 0x%02x. Check if the I2C and I2S buses are initialized.", _addr); + return false; + } + + reset(); + log_v("ES8388 initialized."); + return true; +} + +/* + Name: end + + Description: + Stop the ES8388 codec and reset it to a known state. +*/ + +void ES8388::end() +{ + log_v("Ending ES8388..."); + + stop(); + setmute(ES_MODULE_ADC_DAC, true); + _audio_mode = ES_MODULE_ADC_DAC; + reset(); + + log_v("ES8388 ended."); +} + +/* + Name: readReg + + Description: + Read a register from the ES8388 codec. + + Input Parameters: + reg - Register address. + + Return: + Register value. +*/ + +uint8_t ES8388::readReg(uint8_t reg) +{ + int data; + + _i2c->beginTransmission(_addr); + if (_i2c->write(reg) == 0) + { + log_e("Error writing register address 0x%02x.", reg); + return 0; + } + + if (_i2c->endTransmission(false) != 0) + { + log_e("Error ending transmission."); + return 0; + } + + if (!_i2c->requestFrom(_addr, (uint8_t)1)) + { + log_e("Error requesting data."); + return 0; + } + + if ((data = _i2c->read()) < 0) + { + log_e("Error reading data."); + return 0; + } + + return (uint8_t)data; +} + +/* + Name: writeReg + + Description: + Write a register to the ES8388 codec. + + Input Parameters: + reg - Register address. + data - Data to write. +*/ + +void ES8388::writeReg(uint8_t reg, uint8_t data) +{ + _i2c->beginTransmission(_addr); + + if (_i2c->write(reg) == 0) + { + log_e("Error writing register address 0x%02x.", reg); + return; + } + + if (_i2c->write(data) == 0) + { + log_e("Error writing data 0x%02x.", data); + return; + } + + if (_i2c->endTransmission(true) != 0) + { + log_e("Error ending transmission."); + return; + } +} + +/* + Name: setMicGain + + Description: + Set the microphone gain. + + Input Parameters: + gain - Gain level in dB {0..24}. +*/ + +void ES8388::setMicGain(uint8_t gain) +{ + static const es_mic_gain_e gain_map[] = + { + ES_MIC_GAIN_0DB, + ES_MIC_GAIN_3DB, + ES_MIC_GAIN_6DB, + ES_MIC_GAIN_9DB, + ES_MIC_GAIN_12DB, + ES_MIC_GAIN_15DB, + ES_MIC_GAIN_18DB, + ES_MIC_GAIN_21DB, + ES_MIC_GAIN_24DB, + }; + + log_d("gain=%d", gain); + + _mic_gain = gain_map[min(gain, (uint8_t) 24) / 3]; + + writeReg(ES8388_ADCCONTROL1, + ES8388_MICAMPR(_mic_gain) | + ES8388_MICAMPL(_mic_gain)); + + log_v("Mic gain set to %d", _mic_gain); +} + +/* + Name: setBitsPerSample + + Description: + Set the number of bits per sample. This also configures the I2S bus. + + Input Parameters: + bpsamp - Bits per sample {16, 24, 32}. +*/ + +void ES8388::setBitsPerSample(uint8_t bpsamp) +{ + /* ES8388 also supports 18 and 20 bits per sample, but the I2S bus does not */ + switch (bpsamp) + { + case 16: + _word_length = ES_WORD_LENGTH_16BITS; + break; + + case 24: + _word_length = ES_WORD_LENGTH_24BITS; + break; + + case 32: + _word_length = ES_WORD_LENGTH_32BITS; + break; + + default: + log_e("Data length not supported."); + return; + } + + _bpsamp = bpsamp; + _i2s->configureTX(_samprate, (i2s_data_bit_width_t)_bpsamp, I2S_SLOT_MODE_STEREO); + _i2s->configureRX(_samprate, (i2s_data_bit_width_t)_bpsamp, I2S_SLOT_MODE_STEREO); + + if (_audio_mode == ES_MODULE_ADC || _audio_mode == ES_MODULE_ADC_DAC) + { + writeReg(ES8388_ADCCONTROL4, + ES8388_ADCFORMAT(ES_I2S_NORMAL) | + ES8388_ADCWL(_word_length) | + ES8388_ADCLRP_NORM_2ND | + ES8388_DATSEL_LL); + } + + if (_audio_mode == ES_MODULE_DAC || _audio_mode == ES_MODULE_ADC_DAC) + { + writeReg(ES8388_DACCONTROL1, + ES8388_DACFORMAT(ES_I2S_NORMAL) | + ES8388_DACWL(_word_length) | + ES8388_DACLRP_NORM_2ND | + ES8388_DACLRSWAP_NORMAL); + } + + log_v("Datawidth set to %u", _bpsamp); +} + +/* + Name: setSampleRate + + Description: + Set the sample rate. This also configures the I2S bus. + The divider depends on the sample rate and the MCLK frequency. + This needs to be re-implemented to properly support all cases. + ES8388 should also support 88100Hz and 96000Hz sample rates in + double speed mode but setting it makes the audio sound distorted. + + Input Parameters: + rate - Sample rate {8000, 11025, 12000, 16000, 22050, 24000, 32000, + 44100, 48000}. +*/ + +void ES8388::setSampleRate(uint32_t rate) +{ + /* + According to the datasheet, this should only matter for the master mode + but it seems to affect the slave mode as well. + */ + + switch (rate) + { + case 8000: + _lclk_div = ES_LCLK_DIV_1536; + break; + + case 11025: + case 12000: + _lclk_div = ES_LCLK_DIV_1024; + break; + + case 16000: + _lclk_div = ES_LCLK_DIV_768; + break; + + case 22050: + case 24000: + _lclk_div = ES_LCLK_DIV_512; + break; + + case 32000: + _lclk_div = ES_LCLK_DIV_384; + break; + + case 44100: + case 48000: + _lclk_div = ES_LCLK_DIV_256; + break; + + default: + log_e("Sample rate not supported."); + return; + } + + _samprate = rate; + _i2s->configureTX(_samprate, (i2s_data_bit_width_t)_bpsamp, I2S_SLOT_MODE_STEREO); + _i2s->configureRX(_samprate, (i2s_data_bit_width_t)_bpsamp, I2S_SLOT_MODE_STEREO); + + if (_audio_mode == ES_MODULE_ADC || _audio_mode == ES_MODULE_ADC_DAC) + { + writeReg(ES8388_ADCCONTROL5, ES8388_ADCFSRATIO(_lclk_div)); + } + + if (_audio_mode == ES_MODULE_DAC || _audio_mode == ES_MODULE_ADC_DAC) + { + writeReg(ES8388_DACCONTROL2, ES8388_DACFSRATIO(_lclk_div)); + } + + log_v("Sample rate set to %d in single speed mode", _samprate); +} + +/* + Name: playWAV + + Description: + Wrapper for the I2SClass::playWAV() method. This method starts the ES8388 + codec before playing the WAV file and stops it after the WAV file has been + played. + + Input Parameters: + data - Pointer to the WAV file data. + len - Length of the WAV file data. +*/ + +void ES8388::playWAV(uint8_t* data, size_t len) +{ + _audio_mode = ES_MODULE_DAC; + reset(); + + log_v("Playing WAV file..."); + start(); + _i2s->playWAV(data, len); + stop(); + log_v("WAV file played."); +} + +/* + Name: recordWAV + + Description: + Wrapper for the I2SClass::recordWAV() method. This method starts the ES8388 + codec before recording the WAV file and stops it after the WAV file has been + recorded. + + Input Parameters: + rec_seconds - Length of the WAV file to record in seconds. + out_size - Pointer to the variable that will hold the size of the WAV file. + + Return: + Pointer to the WAV file data. +*/ + +uint8_t* ES8388::recordWAV(size_t rec_seconds, size_t* out_size) +{ + uint8_t* data; + size_t size; + + _audio_mode = ES_MODULE_ADC; + reset(); + + log_v("Recording WAV file..."); + start(); + data = _i2s->recordWAV(rec_seconds, &size); + stop(); + log_v("WAV file recorded."); + + *out_size = size; + return data; +} + +void ES8388::setOutputVolume(uint16_t volume, uint16_t balance) +{ + setvolume(ES_MODULE_DAC, volume, balance); +} + +void ES8388::setInputVolume(uint16_t volume, uint16_t balance) +{ + setvolume(ES_MODULE_ADC, volume, balance); +} + +void ES8388::setOutputMute(bool enable) +{ + setmute(ES_MODULE_DAC, enable); +} + +void ES8388::setInputMute(bool enable) +{ + setmute(ES_MODULE_ADC, enable); +} diff --git a/libraries/ESP_I2S/examples/ES8388_loopback/ES8388.h b/libraries/ESP_I2S/examples/ES8388_loopback/ES8388.h new file mode 100644 index 00000000000..e764286cfb7 --- /dev/null +++ b/libraries/ESP_I2S/examples/ES8388_loopback/ES8388.h @@ -0,0 +1,1093 @@ +/* + This is a very basic driver for the ES8388 based on the driver written by + me for NuttX. It is not complete and is missing master mode, mono mode,many + features and configuration options. You can use readReg and writeReg to + access the registers directly and configure missing features. Feel free to + contribute by adding missing features and improving the driver. + It is intended to be used only with arduino-esp32. + + The default configuration can be found in the ES8388.h file. + + This was only tested with the ESP32-LyraT board using 44100Hz 16-bit stereo + audio. It may not work with other configurations. + + Created for arduino-esp32 on 20 Dec, 2023 + by Lucas Saavedra Vaz (lucasssvaz) +*/ + +#pragma once + +#include "ESP_I2S.h" +#include "Wire.h" + +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + +#define ES8388_DAC_CHVOL_DB(v) (2*v/3 + 30) + +/* Registers Addresses ******************************************************/ + +#define ES8388_CONTROL1 0x00 +#define ES8388_CONTROL2 0x01 +#define ES8388_CHIPPOWER 0x02 +#define ES8388_ADCPOWER 0x03 +#define ES8388_DACPOWER 0x04 +#define ES8388_CHIPLOPOW1 0x05 +#define ES8388_CHIPLOPOW2 0x06 +#define ES8388_ANAVOLMANAG 0x07 +#define ES8388_MASTERMODE 0x08 +#define ES8388_ADCCONTROL1 0x09 +#define ES8388_ADCCONTROL2 0x0a +#define ES8388_ADCCONTROL3 0x0b +#define ES8388_ADCCONTROL4 0x0c +#define ES8388_ADCCONTROL5 0x0d +#define ES8388_ADCCONTROL6 0x0e +#define ES8388_ADCCONTROL7 0x0f +#define ES8388_ADCCONTROL8 0x10 +#define ES8388_ADCCONTROL9 0x11 +#define ES8388_ADCCONTROL10 0x12 +#define ES8388_ADCCONTROL11 0x13 +#define ES8388_ADCCONTROL12 0x14 +#define ES8388_ADCCONTROL13 0x15 +#define ES8388_ADCCONTROL14 0x16 +#define ES8388_DACCONTROL1 0x17 +#define ES8388_DACCONTROL2 0x18 +#define ES8388_DACCONTROL3 0x19 +#define ES8388_DACCONTROL4 0x1a +#define ES8388_DACCONTROL5 0x1b +#define ES8388_DACCONTROL6 0x1c +#define ES8388_DACCONTROL7 0x1d +#define ES8388_DACCONTROL8 0x1e +#define ES8388_DACCONTROL9 0x1f +#define ES8388_DACCONTROL10 0x20 +#define ES8388_DACCONTROL11 0x21 +#define ES8388_DACCONTROL12 0x22 +#define ES8388_DACCONTROL13 0x23 +#define ES8388_DACCONTROL14 0x24 +#define ES8388_DACCONTROL15 0x25 +#define ES8388_DACCONTROL16 0x26 +#define ES8388_DACCONTROL17 0x27 +#define ES8388_DACCONTROL18 0x28 +#define ES8388_DACCONTROL19 0x29 +#define ES8388_DACCONTROL20 0x2a +#define ES8388_DACCONTROL21 0x2b +#define ES8388_DACCONTROL22 0x2c +#define ES8388_DACCONTROL23 0x2d +#define ES8388_DACCONTROL24 0x2e +#define ES8388_DACCONTROL25 0x2f +#define ES8388_DACCONTROL26 0x30 +#define ES8388_DACCONTROL27 0x31 +#define ES8388_DACCONTROL28 0x32 +#define ES8388_DACCONTROL29 0x33 +#define ES8388_DACCONTROL30 0x34 + +/* Register Power-up Default Values *****************************************/ + +#define ES8388_CONTROL1_DEFAULT 0x06 +#define ES8388_CONTROL2_DEFAULT 0x5c +#define ES8388_CHIPPOWER_DEFAULT 0xc3 +#define ES8388_ADCPOWER_DEFAULT 0xfc +#define ES8388_DACPOWER_DEFAULT 0xc0 +#define ES8388_CHIPLOPOW1_DEFAULT 0x00 +#define ES8388_CHIPLOPOW2_DEFAULT 0x00 +#define ES8388_ANAVOLMANAG_DEFAULT 0x7c +#define ES8388_MASTERMODE_DEFAULT 0x80 +#define ES8388_ADCCONTROL1_DEFAULT 0x00 +#define ES8388_ADCCONTROL2_DEFAULT 0x00 +#define ES8388_ADCCONTROL3_DEFAULT 0x02 +#define ES8388_ADCCONTROL4_DEFAULT 0x00 +#define ES8388_ADCCONTROL5_DEFAULT 0x06 +#define ES8388_ADCCONTROL6_DEFAULT 0x30 +#define ES8388_ADCCONTROL7_DEFAULT 0x20 +#define ES8388_ADCCONTROL8_DEFAULT 0xc0 +#define ES8388_ADCCONTROL9_DEFAULT 0xc0 +#define ES8388_ADCCONTROL10_DEFAULT 0x38 +#define ES8388_ADCCONTROL11_DEFAULT 0xb0 +#define ES8388_ADCCONTROL12_DEFAULT 0x32 +#define ES8388_ADCCONTROL13_DEFAULT 0x06 +#define ES8388_ADCCONTROL14_DEFAULT 0x00 +#define ES8388_DACCONTROL1_DEFAULT 0x00 +#define ES8388_DACCONTROL2_DEFAULT 0x06 +#define ES8388_DACCONTROL3_DEFAULT 0x22 +#define ES8388_DACCONTROL4_DEFAULT 0xc0 +#define ES8388_DACCONTROL5_DEFAULT 0xc0 +#define ES8388_DACCONTROL6_DEFAULT 0x08 +#define ES8388_DACCONTROL7_DEFAULT 0x00 +#define ES8388_DACCONTROL8_DEFAULT 0x1f +#define ES8388_DACCONTROL9_DEFAULT 0xf7 +#define ES8388_DACCONTROL10_DEFAULT 0xfd +#define ES8388_DACCONTROL11_DEFAULT 0xff +#define ES8388_DACCONTROL12_DEFAULT 0x1f +#define ES8388_DACCONTROL13_DEFAULT 0xf7 +#define ES8388_DACCONTROL14_DEFAULT 0xfd +#define ES8388_DACCONTROL15_DEFAULT 0xff +#define ES8388_DACCONTROL16_DEFAULT 0x00 +#define ES8388_DACCONTROL17_DEFAULT 0x38 +#define ES8388_DACCONTROL18_DEFAULT 0x28 +#define ES8388_DACCONTROL19_DEFAULT 0x28 +#define ES8388_DACCONTROL20_DEFAULT 0x38 +#define ES8388_DACCONTROL21_DEFAULT 0x00 +#define ES8388_DACCONTROL22_DEFAULT 0x00 +#define ES8388_DACCONTROL23_DEFAULT 0x00 +#define ES8388_DACCONTROL24_DEFAULT 0x00 +#define ES8388_DACCONTROL25_DEFAULT 0x00 +#define ES8388_DACCONTROL26_DEFAULT 0x00 +#define ES8388_DACCONTROL27_DEFAULT 0x00 +#define ES8388_DACCONTROL28_DEFAULT 0x00 +#define ES8388_DACCONTROL29_DEFAULT 0xaa +#define ES8388_DACCONTROL30_DEFAULT 0xaa + +/* Register Bit Definitions *************************************************/ + +/* 0x00 Chip Control 1 */ + +#define ES8388_VMIDSEL_SHIFT (0) +#define ES8388_VMIDSEL_BITMASK (0x03 << ES8388_VMIDSEL_SHIFT) +#define ES8388_VMIDSEL_DISABLE (0 << ES8388_VMIDSEL_SHIFT) +#define ES8388_VMIDSEL_50K (1 << ES8388_VMIDSEL_SHIFT) +#define ES8388_VMIDSEL_500K (2 << ES8388_VMIDSEL_SHIFT) +#define ES8388_VMIDSEL_5K (3 << ES8388_VMIDSEL_SHIFT) + +#define ES8388_ENREF_SHIFT (2) +#define ES8388_ENREF_BITMASK (0x01 << ES8388_ENREF_SHIFT) +#define ES8388_ENREF_DISABLE (0 << ES8388_ENREF_SHIFT) +#define ES8388_ENREF_ENABLE (1 << ES8388_ENREF_SHIFT) + +#define ES8388_SEQEN_SHIFT (3) +#define ES8388_SEQEN_BITMASK (0x01 << ES8388_SEQEN_SHIFT) +#define ES8388_SEQEN_DISABLE (0 << ES8388_SEQEN_SHIFT) +#define ES8388_SEQEN_ENABLE (1 << ES8388_SEQEN_SHIFT) + +#define ES8388_SAMEFS_SHIFT (4) +#define ES8388_SAMEFS_BITMASK (0x01 << ES8388_SAMEFS_SHIFT) +#define ES8388_SAMEFS_DIFFER (0 << ES8388_SAMEFS_SHIFT) +#define ES8388_SAMEFS_SAME (1 << ES8388_SAMEFS_SHIFT) + +#define ES8388_DACMCLK_SHIFT (5) +#define ES8388_DACMCLK_BITMASK (0x01 << ES8388_DACMCLK_SHIFT) +#define ES8388_DACMCLK_ADCMCLK (0 << ES8388_DACMCLK_SHIFT) +#define ES8388_DACMCLK_DACMCLK (1 << ES8388_DACMCLK_SHIFT) + +#define ES8388_LRCM_SHIFT (6) +#define ES8388_LRCM_BITMASK (0x01 << ES8388_LRCM_SHIFT) +#define ES8388_LRCM_ISOLATED (0 << ES8388_LRCM_SHIFT) +#define ES8388_LRCM_ALL (1 << ES8388_LRCM_SHIFT) + +#define ES8388_SCPRESET_SHIFT (7) +#define ES8388_SCPRESET_BITMASK (0x01 << ES8388_SCPRESET_SHIFT) +#define ES8388_SCPRESET_NORMAL (0 << ES8388_SCPRESET_SHIFT) +#define ES8388_SCPRESET_RESET (1 << ES8388_SCPRESET_SHIFT) + +/* 0x01 Chip Control 2 */ + +#define ES8388_PDNVREFBUF_SHIFT (0) +#define ES8388_PDNVREFBUF_BITMASK (0x01 << ES8388_PDNVREFBUF_SHIFT) +#define ES8388_PDNVREFBUF_NORMAL (0 << ES8388_PDNVREFBUF_SHIFT) +#define ES8388_PDNVREFBUF_PWRDN (1 << ES8388_PDNVREFBUF_SHIFT) + +#define ES8388_VREFLO_SHIFT (1) +#define ES8388_VREFLO_BITMASK (0x01 << ES8388_VREFLO_SHIFT) +#define ES8388_VREFLO_NORMAL (0 << ES8388_VREFLO_SHIFT) +#define ES8388_VREFLO_LP (1 << ES8388_VREFLO_SHIFT) + +#define ES8388_PDNIBIASGEN_SHIFT (2) +#define ES8388_PDNIBIASGEN_BITMASK (0x01 << ES8388_PDNIBIASGEN_SHIFT) +#define ES8388_PDNIBIASGEN_NORMAL (0 << ES8388_PDNIBIASGEN_SHIFT) +#define ES8388_PDNIBIASGEN_PWRDN (1 << ES8388_PDNIBIASGEN_SHIFT) + +#define ES8388_PDNANA_SHIFT (3) +#define ES8388_PDNANA_BITMASK (0x01 << ES8388_PDNANA_SHIFT) +#define ES8388_PDNANA_NORMAL (0 << ES8388_PDNANA_SHIFT) +#define ES8388_PDNANA_PWRDN (1 << ES8388_PDNANA_SHIFT) + +#define ES8388_LPVREFBUF_SHIFT (4) +#define ES8388_LPVREFBUF_BITMASK (0x01 << ES8388_LPVREFBUF_SHIFT) +#define ES8388_LPVREFBUF_NORMAL (0 << ES8388_LPVREFBUF_SHIFT) +#define ES8388_LPVREFBUF_LP (1 << ES8388_LPVREFBUF_SHIFT) + +#define ES8388_LPVCMMOD_SHIFT (5) +#define ES8388_LPVCMMOD_BITMASK (0x01 << ES8388_LPVCMMOD_SHIFT) +#define ES8388_LPVCMMOD_NORMAL (0 << ES8388_LPVCMMOD_SHIFT) +#define ES8388_LPVCMMOD_LP (1 << ES8388_LPVCMMOD_SHIFT) + +/* 0x02 Chip Power Management */ + +#define ES8388_DACVREF_PDN_SHIFT (0) +#define ES8388_DACVREF_PDN_BITMASK (0x01 << ES8388_DACVREF_PDN_SHIFT) +#define ES8388_DACVREF_PDN_PWRUP (0 << ES8388_DACVREF_PDN_SHIFT) +#define ES8388_DACVREF_PDN_PWRDN (1 << ES8388_DACVREF_PDN_SHIFT) + +#define ES8388_ADCVREF_PDN_SHIFT (1) +#define ES8388_ADCVREF_PDN_BITMASK (0x01 << ES8388_ADCVREF_PDN_SHIFT) +#define ES8388_ADCVREF_PDN_PWRUP (0 << ES8388_ADCVREF_PDN_SHIFT) +#define ES8388_ADCVREF_PDN_PWRDN (1 << ES8388_ADCVREF_PDN_SHIFT) + +#define ES8388_DACDLL_PDN_SHIFT (2) +#define ES8388_DACDLL_PDN_BITMASK (0x01 << ES8388_DACDLL_PDN_SHIFT) +#define ES8388_DACDLL_PDN_NORMAL (0 << ES8388_DACDLL_PDN_SHIFT) +#define ES8388_DACDLL_PDN_PWRDN (1 << ES8388_DACDLL_PDN_SHIFT) + +#define ES8388_ADCDLL_PDN_SHIFT (3) +#define ES8388_ADCDLL_PDN_BITMASK (0x01 << ES8388_ADCDLL_PDN_SHIFT) +#define ES8388_ADCDLL_PDN_NORMAL (0 << ES8388_ADCDLL_PDN_SHIFT) +#define ES8388_ADCDLL_PDN_PWRDN (1 << ES8388_ADCDLL_PDN_SHIFT) + +#define ES8388_DAC_STM_RST_SHIFT (4) +#define ES8388_DAC_STM_RST_BITMASK (0x01 << ES8388_DAC_STM_RST_SHIFT) +#define ES8388_DAC_STM_RST_NORMAL (0 << ES8388_DAC_STM_RST_SHIFT) +#define ES8388_DAC_STM_RST_RESET (1 << ES8388_DAC_STM_RST_SHIFT) + +#define ES8388_ADC_STM_RST_SHIFT (5) +#define ES8388_ADC_STM_RST_BITMASK (0x01 << ES8388_ADC_STM_RST_SHIFT) +#define ES8388_ADC_STM_RST_NORMAL (0 << ES8388_ADC_STM_RST_SHIFT) +#define ES8388_ADC_STM_RST_RESET (1 << ES8388_ADC_STM_RST_SHIFT) + +#define ES8388_DAC_DIGPDN_SHIFT (6) +#define ES8388_DAC_DIGPDN_BITMASK (0x01 << ES8388_DAC_DIGPDN_SHIFT) +#define ES8388_DAC_DIGPDN_NORMAL (0 << ES8388_DAC_DIGPDN_SHIFT) +#define ES8388_DAC_DIGPDN_RESET (1 << ES8388_DAC_DIGPDN_SHIFT) + +#define ES8388_ADC_DIGPDN_SHIFT (7) +#define ES8388_ADC_DIGPDN_BITMASK (0x01 << ES8388_ADC_DIGPDN_SHIFT) +#define ES8388_ADC_DIGPDN_NORMAL (0 << ES8388_ADC_DIGPDN_SHIFT) +#define ES8388_ADC_DIGPDN_RESET (1 << ES8388_ADC_DIGPDN_SHIFT) + +/* 0x03 ADC Power Management */ + +#define ES8388_INT1LP_SHIFT (0) +#define ES8388_INT1LP_BITMASK (0x01 << ES8388_INT1LP_SHIFT) +#define ES8388_INT1LP_NORMAL (0 << ES8388_INT1LP_SHIFT) +#define ES8388_INT1LP_LP (1 << ES8388_INT1LP_SHIFT) + +#define ES8388_FLASHLP_SHIFT (1) +#define ES8388_FLASHLP_BITMASK (0x01 << ES8388_FLASHLP_SHIFT) +#define ES8388_FLASHLP_NORMAL (0 << ES8388_FLASHLP_SHIFT) +#define ES8388_FLASHLP_LP (1 << ES8388_FLASHLP_SHIFT) + +#define ES8388_PDNADCBIASGEN_SHIFT (2) +#define ES8388_PDNADCBIASGEN_BITMASK (0x01 << ES8388_PDNADCBIASGEN_SHIFT) +#define ES8388_PDNADCBIASGEN_NORMAL (0 << ES8388_PDNADCBIASGEN_SHIFT) +#define ES8388_PDNADCBIASGEN_LP (1 << ES8388_PDNADCBIASGEN_SHIFT) + +#define ES8388_PDNMICB_SHIFT (3) +#define ES8388_PDNMICB_BITMASK (0x01 << ES8388_PDNMICB_SHIFT) +#define ES8388_PDNMICB_PWRON (0 << ES8388_PDNMICB_SHIFT) +#define ES8388_PDNMICB_PWRDN (1 << ES8388_PDNMICB_SHIFT) + +#define ES8388_PDNADCR_SHIFT (4) +#define ES8388_PDNADCR_BITMASK (0x01 << ES8388_PDNADCR_SHIFT) +#define ES8388_PDNADCR_PWRUP (0 << ES8388_PDNADCR_SHIFT) +#define ES8388_PDNADCR_PWRDN (1 << ES8388_PDNADCR_SHIFT) + +#define ES8388_PDNADCL_SHIFT (5) +#define ES8388_PDNADCL_BITMASK (0x01 << ES8388_PDNADCL_SHIFT) +#define ES8388_PDNADCL_PWRUP (0 << ES8388_PDNADCL_SHIFT) +#define ES8388_PDNADCL_PWRDN (1 << ES8388_PDNADCL_SHIFT) + +#define ES8388_PDNAINR_SHIFT (6) +#define ES8388_PDNAINR_BITMASK (0x01 << ES8388_PDNAINR_SHIFT) +#define ES8388_PDNAINR_NORMAL (0 << ES8388_PDNAINR_SHIFT) +#define ES8388_PDNAINR_PWRDN (1 << ES8388_PDNAINR_SHIFT) + +#define ES8388_PDNAINL_SHIFT (7) +#define ES8388_PDNAINL_BITMASK (0x01 << ES8388_PDNAINL_SHIFT) +#define ES8388_PDNAINL_NORMAL (0 << ES8388_PDNAINL_SHIFT) +#define ES8388_PDNAINL_PWRDN (1 << ES8388_PDNAINL_SHIFT) + +/* 0x04 DAC Power Management */ + +#define ES8388_ROUT2_SHIFT (2) +#define ES8388_ROUT2_BITMASK (0x01 << ES8388_ROUT2_SHIFT) +#define ES8388_ROUT2_DISABLE (0 << ES8388_ROUT2_SHIFT) +#define ES8388_ROUT2_ENABLE (1 << ES8388_ROUT2_SHIFT) + +#define ES8388_LOUT2_SHIFT (3) +#define ES8388_LOUT2_BITMASK (0x01 << ES8388_LOUT2_SHIFT) +#define ES8388_LOUT2_DISABLE (0 << ES8388_LOUT2_SHIFT) +#define ES8388_LOUT2_ENABLE (1 << ES8388_LOUT2_SHIFT) + +#define ES8388_ROUT1_SHIFT (4) +#define ES8388_ROUT1_BITMASK (0x01 << ES8388_ROUT1_SHIFT) +#define ES8388_ROUT1_DISABLE (0 << ES8388_ROUT1_SHIFT) +#define ES8388_ROUT1_ENABLE (1 << ES8388_ROUT1_SHIFT) + +#define ES8388_LOUT1_SHIFT (5) +#define ES8388_LOUT1_BITMASK (0x01 << ES8388_LOUT1_SHIFT) +#define ES8388_LOUT1_DISABLE (0 << ES8388_LOUT1_SHIFT) +#define ES8388_LOUT1_ENABLE (1 << ES8388_LOUT1_SHIFT) + +#define ES8388_PDNDACR_SHIFT (6) +#define ES8388_PDNDACR_BITMASK (0x01 << ES8388_PDNDACR_SHIFT) +#define ES8388_PDNDACR_PWRUP (0 << ES8388_PDNDACR_SHIFT) +#define ES8388_PDNDACR_PWRDN (1 << ES8388_PDNDACR_SHIFT) + +#define ES8388_PDNDACL_SHIFT (7) +#define ES8388_PDNDACL_BITMASK (0x01 << ES8388_PDNDACL_SHIFT) +#define ES8388_PDNDACL_PWRUP (0 << ES8388_PDNDACL_SHIFT) +#define ES8388_PDNDACL_PWRDN (1 << ES8388_PDNDACL_SHIFT) + +/* 0x05 Chip Low Power 1 */ + +#define ES8388_LPLOUT2_SHIFT (3) +#define ES8388_LPLOUT2_BITMASK (0x01 << ES8388_LPLOUT2_SHIFT) +#define ES8388_LPLOUT2_NORMAL (0 << ES8388_LPLOUT2_SHIFT) +#define ES8388_LPLOUT2_LP (1 << ES8388_LPLOUT2_SHIFT) + +#define ES8388_LPLOUT1_SHIFT (5) +#define ES8388_LPLOUT1_BITMASK (0x01 << ES8388_LPLOUT1_SHIFT) +#define ES8388_LPLOUT1_NORMAL (0 << ES8388_LPLOUT1_SHIFT) +#define ES8388_LPLOUT1_LP (1 << ES8388_LPLOUT1_SHIFT) + +#define ES8388_LPDACR_SHIFT (6) +#define ES8388_LPDACR_BITMASK (0x01 << ES8388_LPDACR_SHIFT) +#define ES8388_LPDACR_NORMAL (0 << ES8388_LPDACR_SHIFT) +#define ES8388_LPDACR_LP (1 << ES8388_LPDACR_SHIFT) + +#define ES8388_LPDACL_SHIFT (7) +#define ES8388_LPDACL_BITMASK (0x01 << ES8388_LPDACL_SHIFT) +#define ES8388_LPDACL_NORMAL (0 << ES8388_LPDACL_SHIFT) +#define ES8388_LPDACL_LP (1 << ES8388_LPDACL_SHIFT) + +/* 0x06 Chip Low Power 2 */ + +#define ES8388_LPDACVRP_SHIFT (0) +#define ES8388_LPDACVRP_BITMASK (0x01 << ES8388_LPDACVRP_SHIFT) +#define ES8388_LPDACVRP_NORMAL (0 << ES8388_LPDACVRP_SHIFT) +#define ES8388_LPDACVRP_LP (1 << ES8388_LPDACVRP_SHIFT) + +#define ES8388_LPADCVRP_SHIFT (1) +#define ES8388_LPADCVRP_BITMASK (0x01 << ES8388_LPDACVRP_SHIFT) +#define ES8388_LPADCVRP_NORMAL (0 << ES8388_LPDACVRP_SHIFT) +#define ES8388_LPADCVRP_LP (1 << ES8388_LPDACVRP_SHIFT) + +#define ES8388_LPLMIX_SHIFT (6) +#define ES8388_LPLMIX_BITMASK (0x01 << ES8388_LPLMIX_SHIFT) +#define ES8388_LPLMIX_NORMAL (0 << ES8388_LPLMIX_SHIFT) +#define ES8388_LPLMIX_LP (1 << ES8388_LPLMIX_SHIFT) + +#define ES8388_LPPGA_SHIFT (7) +#define ES8388_LPPGA_BITMASK (0x01 << ES8388_LPPGA_SHIFT) +#define ES8388_LPPGA_NORMAL (0 << ES8388_LPPGA_SHIFT) +#define ES8388_LPPGA_LP (1 << ES8388_LPPGA_SHIFT) + +/* 0x08 Master Mode Control */ + +#define ES8388_BCLKDIV_SHIFT (0) +#define ES8388_BCLKDIV_BITMASK (0x1f << ES8388_BCLKDIV_SHIFT) +#define ES8388_BCLKDIV(a) (a << ES8388_BCLKDIV_SHIFT) + +#define ES8388_BCLK_INV_SHIFT (5) +#define ES8388_BCLK_INV_BITMASL (0x01 << ES8388_BCLK_INV_SHIFT) +#define ES8388_BCLK_INV_NORMAL (0 << ES8388_BCLK_INV_SHIFT) +#define ES8388_BCLK_INV_INVERTED (1 << ES8388_BCLK_INV_SHIFT) + +#define ES8388_MCLKDIV2_SHIFT (6) +#define ES8388_MCLKDIV2_BITMASK (0x01 << ES8388_MCLKDIV2_SHIFT) +#define ES8388_MCLKDIV2_NODIV (0 << ES8388_MCLKDIV2_SHIFT) +#define ES8388_MCLKDIV2_DIV2 (1 << ES8388_MCLKDIV2_SHIFT) + +#define ES8388_MSC_SHIFT (7) +#define ES8388_MSC_BITMASK (0x01 << ES8388_MSC_SHIFT) +#define ES8388_MSC_SLAVE (0 << ES8388_MSC_SHIFT) +#define ES8388_MSC_MASTER (1 << ES8388_MSC_SHIFT) + +/* 0x09 ADC Control 1 */ + +#define ES8388_MICAMPR_SHIFT (0) +#define ES8388_MICAMPR_BITMASK (0x0f << ES8388_MICAMPR_SHIFT) +#define ES8388_MICAMPR(a) (a << ES8388_MICAMPR_SHIFT) + +#define ES8388_MICAMPL_SHIFT (4) +#define ES8388_MICAMPL_BITMASK (0x0f << ES8388_MICAMPL_SHIFT) +#define ES8388_MICAMPL(a) (a << ES8388_MICAMPL_SHIFT) + +/* 0x0a ADC Control 2 */ + +#define ES8388_DSR_SHIFT (2) +#define ES8388_DSR_BITMASK (0x01 << ES8388_DSR_SHIFT) +#define ES8388_DSR_LINPUT1_RINPUT1 (0 << ES8388_DSR_SHIFT) +#define ES8388_DSR_LINPUT2_RINPUT2 (1 << ES8388_DSR_SHIFT) + +#define ES8388_DSSEL_SHIFT (3) +#define ES8388_DSSEL_BITMASK (0x01 << ES8388_DSSEL_SHIFT) +#define ES8388_DSSEL_ONE_REG (0 << ES8388_DSSEL_SHIFT) +#define ES8388_DSSEL_MULT_REG (1 << ES8388_DSSEL_SHIFT) + +#define ES8388_RINSEL_SHIFT (4) +#define ES8388_RINSEL_BITMASK (0x03 << ES8388_RINSEL_SHIFT) +#define ES8388_RINSEL_RINPUT1 (0 << ES8388_RINSEL_SHIFT) +#define ES8388_RINSEL_RINPUT2 (1 << ES8388_RINSEL_SHIFT) +#define ES8388_RINSEL_DIFF (3 << ES8388_RINSEL_SHIFT) + +#define ES8388_LINSEL_SHIFT (6) +#define ES8388_LINSEL_BITMASK (0x03 << ES8388_LINSEL_SHIFT) +#define ES8388_LINSEL_LINPUT1 (0 << ES8388_LINSEL_SHIFT) +#define ES8388_LINSEL_LINPUT2 (1 << ES8388_LINSEL_SHIFT) +#define ES8388_LINSEL_DIFF (3 << ES8388_LINSEL_SHIFT) + +/* 0x0b ADC Control 3 */ + +#define ES8388_TRI_SHIFT (2) +#define ES8388_TRI_BITMASK (0x01 << ES8388_TRI_SHIFT) +#define ES8388_TRI_NORMAL (0 << ES8388_TRI_SHIFT) +#define ES8388_TRI_TRISTATED (1 << ES8388_TRI_SHIFT) + +#define ES8388_MONOMIX_SHIFT (3) +#define ES8388_MONOMIX_BITMASK (0x03 << ES8388_MONOMIX_SHIFT) +#define ES8388_MONOMIX_STEREO (0 << ES8388_MONOMIX_SHIFT) +#define ES8388_MONOMIX_LADC (1 << ES8388_MONOMIX_SHIFT) +#define ES8388_MONOMIX_RADC (2 << ES8388_MONOMIX_SHIFT) + +#define ES8388_DS_SHIFT (7) +#define ES8388_DS_BITMASK (0x01 << ES8388_DS_SHIFT) +#define ES8388_DS_LINPUT1_RINPUT1 (0 << ES8388_DS_SHIFT) +#define ES8388_DS_LINPUT2_RINPUT2 (1 << ES8388_DS_SHIFT) + +/* 0x0c ADC Control 4 */ + +#define ES8388_ADCFORMAT_SHIFT (0) +#define ES8388_ADCFORMAT_BITMASK (0x03 << ES8388_ADCFORMAT_SHIFT) +#define ES8388_ADCFORMAT(a) (a << ES8388_ADCFORMAT_SHIFT) + +#define ES8388_ADCWL_SHIFT (2) +#define ES8388_ADCWL_BITMASK (0x07 << ES8388_ADCWL_SHIFT) +#define ES8388_ADCWL(a) (a << ES8388_ADCWL_SHIFT) + +#define ES8388_ADCLRP_SHIFT (5) +#define ES8388_ADCLRP_BITMASK (0x01 << ES8388_ADCLRP_SHIFT) +#define ES8388_ADCLRP_NORM_2ND (0 << ES8388_ADCLRP_SHIFT) +#define ES8388_ADCLRP_INV_1ST (1 << ES8388_ADCLRP_SHIFT) + +#define ES8388_DATSEL_SHIFT (6) +#define ES8388_DATSEL_BITMASK (0x03 << ES8388_DATSEL_SHIFT) +#define ES8388_DATSEL_LL (0 << ES8388_DATSEL_SHIFT) +#define ES8388_DATSEL_LR (1 << ES8388_DATSEL_SHIFT) +#define ES8388_DATSEL_RR (2 << ES8388_DATSEL_SHIFT) +#define ES8388_DATSEL_RL (3 << ES8388_DATSEL_SHIFT) + +/* 0x0d ADC Control 5 */ + +#define ES8388_ADCFSRATIO_SHIFT (0) +#define ES8388_ADCFSRATIO_BITMASK (0x1f << ES8388_ADCFSRATIO_SHIFT) +#define ES8388_ADCFSRATIO(a) (a << ES8388_ADCFSRATIO_SHIFT) + +#define ES8388_ADCFSMODE_SHIFT (5) +#define ES8388_ADCFSMODE_BITMASK (0x01 << ES8388_ADCFSMODE_SHIFT) +#define ES8388_ADCFSMODE_SINGLE (0 << ES8388_ADCFSMODE_SHIFT) +#define ES8388_ADCFSMODE_DOUBLE (1 << ES8388_ADCFSMODE_SHIFT) + +/* 0x0e ADC Control 6 */ + +#define ES8388_ADC_HPF_R_SHIFT (4) +#define ES8388_ADC_HPF_R_BITMASK (0x01 << ES8388_ADC_HPF_R_SHIFT) +#define ES8388_ADC_HPF_R_DISABLE (0 << ES8388_ADC_HPF_R_SHIFT) +#define ES8388_ADC_HPF_R_ENABLE (1 << ES8388_ADC_HPF_R_SHIFT) + +#define ES8388_ADC_HPF_L_SHIFT (5) +#define ES8388_ADC_HPF_L_BITMASK (0x01 << ES8388_ADC_HPF_L_SHIFT) +#define ES8388_ADC_HPF_L_DISABLE (0 << ES8388_ADC_HPF_L_SHIFT) +#define ES8388_ADC_HPF_L_ENABLE (1 << ES8388_ADC_HPF_L_SHIFT) + +#define ES8388_ADC_INVR_SHIFT (6) +#define ES8388_ADC_INVR_BITMASK (0x01 << ES8388_ADC_INVR_SHIFT) +#define ES8388_ADC_INVR_NORMAL (0 << ES8388_ADC_INVR_SHIFT) +#define ES8388_ADC_INVR_INVERTED (1 << ES8388_ADC_INVR_SHIFT) + +#define ES8388_ADC_INVL_SHIFT (7) +#define ES8388_ADC_INVL_BITMASK (0x01 << ES8388_ADC_INVL_SHIFT) +#define ES8388_ADC_INVL_NORMAL (0 << ES8388_ADC_INVL_SHIFT) +#define ES8388_ADC_INVL_INVERTED (1 << ES8388_ADC_INVL_SHIFT) + +/* 0x0f ADC Control 7 */ + +#define ES8388_ADCMUTE_SHIFT (2) +#define ES8388_ADCMUTE_BITMASK (0x01 << ES8388_ADCMUTE_SHIFT) +#define ES8388_ADCMUTE(a) (((int)a) << ES8388_ADCMUTE_SHIFT) +#define ES8388_ADCMUTE_NORMAL (0 << ES8388_ADCMUTE_SHIFT) +#define ES8388_ADCMUTE_MUTED (1 << ES8388_ADCMUTE_SHIFT) + +#define ES8388_ADCLER_SHIFT (3) +#define ES8388_ADCLER_BITMASK (0x01 << ES8388_ADCLER_SHIFT) +#define ES8388_ADCLER_NORMAL (0 << ES8388_ADCLER_SHIFT) +#define ES8388_ADCLER_ADCLEFT (1 << ES8388_ADCLER_SHIFT) + +#define ES8388_ADCSOFTRAMP_SHIFT (5) +#define ES8388_ADCSOFTRAMP_BITMASK (0x01 << ES8388_ADCSOFTRAMP_SHIFT) +#define ES8388_ADCSOFTRAMP_DISABLE (0 << ES8388_ADCSOFTRAMP_SHIFT) +#define ES8388_ADCSOFTRAMP_ENABLE (1 << ES8388_ADCSOFTRAMP_SHIFT) + +#define ES8388_ADCRAMPRATE_SHIFT (6) +#define ES8388_ADCRAMPRATE_BITMASK (0x03 << ES8388_ADCRAMPRATE_SHIFT) +#define ES8388_ADCRAMPRATE_4LRCK (0 << ES8388_ADCRAMPRATE_SHIFT) +#define ES8388_ADCRAMPRATE_8LRCK (1 << ES8388_ADCRAMPRATE_SHIFT) +#define ES8388_ADCRAMPRATE_16LRCK (2 << ES8388_ADCRAMPRATE_SHIFT) +#define ES8388_ADCRAMPRATE_32LRCK (3 << ES8388_ADCRAMPRATE_SHIFT) + +/* 0x10 ADC Control 8 */ + +#define ES8388_LADCVOL_SHIFT (0) +#define ES8388_LADCVOL_BITMASK (0xff << ES8388_LADCVOL_SHIFT) +#define ES8388_LADCVOL(a) (a << ES8388_LADCVOL_SHIFT) + +/* 0x11 ADC Control 9 */ + +#define ES8388_RADCVOL_SHIFT (0) +#define ES8388_RADCVOL_BITMASK (0xff << ES8388_RADCVOL_SHIFT) +#define ES8388_RADCVOL(a) (a << ES8388_RADCVOL_SHIFT) + +/* 0x12 ADC Control 10 */ + +#define ES8388_MINGAIN_SHIFT (0) +#define ES8388_MINGAIN_BITMASK (0x07 << ES8388_MINGAIN_SHIFT) +#define ES8388_MINGAIN(a) (a << ES8388_MINGAIN_SHIFT) + +#define ES8388_MAXGAIN_SHIFT (3) +#define ES8388_MAXGAIN_BITMASK (0x07 << ES8388_MAXGAIN_SHIFT) +#define ES8388_MAXGAIN(a) (a << ES8388_MAXGAIN_SHIFT) + +#define ES8388_ADCSEL_SHIFT (6) +#define ES8388_ADCSEL_BITMASK (0x03 << ES8388_ADCSEL_SHIFT) +#define ES8388_ADCSEL_OFF (0 << ES8388_ADCSEL_SHIFT) +#define ES8388_ADCSEL_RIGHT (1 << ES8388_ADCSEL_SHIFT) +#define ES8388_ADCSEL_LEFT (2 << ES8388_ADCSEL_SHIFT) +#define ES8388_ADCSEL_STEREO (3 << ES8388_ADCSEL_SHIFT) + +/* 0x13 ADC Control 11 */ + +#define ES8388_ALCHLD_SHIFT (0) +#define ES8388_ALCHLD_BITMASK (0x0f << ES8388_ALCHLD_SHIFT) +#define ES8388_ALCHLD(a) (a << ES8388_ALCHLD_SHIFT) + +#define ES8388_ALCLVL_SHIFT (4) +#define ES8388_ALCLVL_BITMASK (0x0f << ES8388_ALCLVL_SHIFT) +#define ES8388_ALCLVL(a) (a << ES8388_ALCLVL_SHIFT) + +/* 0x14 ADC Control 12 */ + +#define ES8388_ALCATK_SHIFT (0) +#define ES8388_ALCATK_BITMASK (0x0f << ES8388_ALCATK_SHIFT) +#define ES8388_ALCATK(a) (a << ES8388_ALCATK_SHIFT) + +#define ES8388_ALCDCY_SHIFT (4) +#define ES8388_ALCDCY_BITMASK (0x0f << ES8388_ALCDCY_SHIFT) +#define ES8388_ALCDCY(a) (a << ES8388_ALCDCY_SHIFT) + +/* 0x15 ADC Control 13 */ + +#define ES8388_WIN_SIZE_SHIFT (0) +#define ES8388_WIN_SIZE_BITMASK (0x1f << ES8388_WIN_SIZE_SHIFT) +#define ES8388_WIN_SIZE(a) (a << ES8388_WIN_SIZE_SHIFT) + +#define ES8388_TIME_OUT_SHIFT (5) +#define ES8388_TIME_OUT_BITMASK (0x01 << ES8388_TIME_OUT_SHIFT) +#define ES8388_TIME_OUT_DISABLE (0 << ES8388_TIME_OUT_SHIFT) +#define ES8388_TIME_OUT_ENABLE (1 << ES8388_TIME_OUT_SHIFT) + +#define ES8388_ALCZC_SHIFT (6) +#define ES8388_ALCZC_BITMASK (0x01 << ES8388_ALCZC_SHIFT) +#define ES8388_ALCZC_DISABLE (0 << ES8388_ALCZC_SHIFT) +#define ES8388_ALCZC_ENABLE (1 << ES8388_ALCZC_SHIFT) + +#define ES8388_ALCMODE_SHIFT (7) +#define ES8388_ALCMODE_BITMASK (0x01 << ES8388_ALCMODE_SHIFT) +#define ES8388_ALCMODE_NORMAL (0 << ES8388_ALCMODE_SHIFT) +#define ES8388_ALCMODE_LIMITER (1 << ES8388_ALCMODE_SHIFT) + +/* 0x16 ADC Control 14 */ + +#define ES8388_NGAT_SHIFT (0) +#define ES8388_NGAT_BITMASK (0x01 << ES8388_NGAT_SHIFT) +#define ES8388_NGAT_DISABLE (0 << ES8388_NGAT_SHIFT) +#define ES8388_NGAT_ENABLE (1 << ES8388_NGAT_SHIFT) + +#define ES8388_NGG_SHIFT (1) +#define ES8388_NGG_BITMASK (0x01 << ES8388_NGG_SHIFT) +#define ES8388_NGG_CONST (0 << ES8388_NGG_SHIFT) +#define ES8388_NGG_MUTE (1 << ES8388_NGG_SHIFT) + +#define ES8388_NGTH_SHIFT (3) +#define ES8388_NGTH_BITMASK (0x1f << ES8388_NGTH_SHIFT) +#define ES8388_NGTH(a) (a << ES8388_NGTH_SHIFT) + +/* 0x17 DAC Control 1 */ + +#define ES8388_DACFORMAT_SHIFT (1) +#define ES8388_DACFORMAT_BITMASK (0x03 << ES8388_DACFORMAT_SHIFT) +#define ES8388_DACFORMAT(a) (a << ES8388_DACFORMAT_SHIFT) + +#define ES8388_DACWL_SHIFT (3) +#define ES8388_DACWL_BITMASK (0x07 << ES8388_DACWL_SHIFT) +#define ES8388_DACWL(a) (a << ES8388_DACWL_SHIFT) + +#define ES8388_DACLRP_SHIFT (6) +#define ES8388_DACLRP_BITMASK (0x01 << ES8388_DACLRP_SHIFT) +#define ES8388_DACLRP_NORM_2ND (0 << ES8388_DACLRP_SHIFT) +#define ES8388_DACLRP_INV_1ST (1 << ES8388_DACLRP_SHIFT) + +#define ES8388_DACLRSWAP_SHIFT (7) +#define ES8388_DACLRSWAP_BITMASK (0x01 << ES8388_DACLRSWAP_SHIFT) +#define ES8388_DACLRSWAP_NORMAL (0 << ES8388_DACLRSWAP_SHIFT) +#define ES8388_DACLRSWAP_SWAP (1 << ES8388_DACLRSWAP_SHIFT) + +/* 0x18 DAC Control 2 */ + +#define ES8388_DACFSRATIO_SHIFT (0) +#define ES8388_DACFSRATIO_BITMASK (0x1f << ES8388_DACFSRATIO_SHIFT) +#define ES8388_DACFSRATIO(a) (a << ES8388_DACFSRATIO_SHIFT) + +#define ES8388_DACFSMODE_SHIFT (5) +#define ES8388_DACFSMODE_BITMASK (0x01 << ES8388_DACFSMODE_SHIFT) +#define ES8388_DACFSMODE_SINGLE (0 << ES8388_DACFSMODE_SHIFT) +#define ES8388_DACFSMODE_DOUBLE (1 << ES8388_DACFSMODE_SHIFT) + +/* 0x19 DAC Control 3 */ + +#define ES8388_DACMUTE_SHIFT (2) +#define ES8388_DACMUTE_BITMASK (0x01 << ES8388_DACMUTE_SHIFT) +#define ES8388_DACMUTE(a) (((int)a) << ES8388_DACMUTE_SHIFT) +#define ES8388_DACMUTE_NORMAL (0 << ES8388_DACMUTE_SHIFT) +#define ES8388_DACMUTE_MUTED (1 << ES8388_DACMUTE_SHIFT) + +#define ES8388_DACLER_SHIFT (3) +#define ES8388_DACLER_BITMASK (0x01 << ES8388_DACLER_SHIFT) +#define ES8388_DACLER_NORMAL (0 << ES8388_DACLER_SHIFT) +#define ES8388_DACLER_ADCLEFT (1 << ES8388_DACLER_SHIFT) + +#define ES8388_DACSOFTRAMP_SHIFT (5) +#define ES8388_DACSOFTRAMP_BITMASK (0x01 << ES8388_DACSOFTRAMP_SHIFT) +#define ES8388_DACSOFTRAMP_DISABLE (0 << ES8388_DACSOFTRAMP_SHIFT) +#define ES8388_DACSOFTRAMP_ENABLE (1 << ES8388_DACSOFTRAMP_SHIFT) + +#define ES8388_DACRAMPRATE_SHIFT (6) +#define ES8388_DACRAMPRATE_BITMASK (0x03 << ES8388_DACRAMPRATE_SHIFT) +#define ES8388_DACRAMPRATE_4LRCK (0 << ES8388_DACRAMPRATE_SHIFT) +#define ES8388_DACRAMPRATE_32LRCK (1 << ES8388_DACRAMPRATE_SHIFT) +#define ES8388_DACRAMPRATE_64LRCK (2 << ES8388_DACRAMPRATE_SHIFT) +#define ES8388_DACRAMPRATE_128LRCK (3 << ES8388_DACRAMPRATE_SHIFT) + +/* 0x1a DAC Control 4 */ + +#define ES8388_LDACVOL_SHIFT (0) +#define ES8388_LDACVOL_BITMASK (0xff << ES8388_LDACVOL_SHIFT) +#define ES8388_LDACVOL(a) (a << ES8388_LDACVOL_SHIFT) + +/* 0x1b DAC Control 5 */ + +#define ES8388_RDACVOL_SHIFT (0) +#define ES8388_RDACVOL_BITMASK (0xff << ES8388_RDACVOL_SHIFT) +#define ES8388_RDACVOL(a) (a << ES8388_RDACVOL_SHIFT) + +/* 0x1c DAC Control 6 */ + +#define ES8388_CLICKFREE_SHIFT (3) +#define ES8388_CLICKFREE_BITMASK (0x01 << ES8388_CLICKFREE_SHIFT) +#define ES8388_CLICKFREE_DISABLE (0 << ES8388_CLICKFREE_SHIFT) +#define ES8388_CLICKFREE_ENABLE (1 << ES8388_CLICKFREE_SHIFT) + +#define ES8388_DAC_INVR_SHIFT (4) +#define ES8388_DAC_INVR_BITMASK (0x01 << ES8388_DAC_INVR_SHIFT) +#define ES8388_DAC_INVR_NOINV (0 << ES8388_DAC_INVR_SHIFT) +#define ES8388_DAC_INVR_180INV (1 << ES8388_DAC_INVR_SHIFT) + +#define ES8388_DAC_INVL_SHIFT (5) +#define ES8388_DAC_INVL_BITMASK (0x01 << ES8388_DAC_INVL_SHIFT) +#define ES8388_DAC_INVL_NOINV (0 << ES8388_DAC_INVL_SHIFT) +#define ES8388_DAC_INVL_180INV (1 << ES8388_DAC_INVL_SHIFT) + +#define ES8388_DEEMP_SHIFT (6) +#define ES8388_DEEMP_BITMASK (0x03 << ES8388_DEEMP_SHIFT) +#define ES8388_DEEMP_DISABLE (0 << ES8388_DEEMP_SHIFT) +#define ES8388_DEEMP_32KHZ (1 << ES8388_DEEMP_SHIFT) +#define ES8388_DEEMP_44KHZ (2 << ES8388_DEEMP_SHIFT) +#define ES8388_DEEMP_48KHZ (3 << ES8388_DEEMP_SHIFT) + +/* 0x1d DAC Control 7 */ + +#define ES8388_VPP_SCALE_SHIFT (0) +#define ES8388_VPP_SCALE_BITMASK (0x03 << ES8388_VPP_SCALE_SHIFT) +#define ES8388_VPP_SCALE_3_5V (0 << ES8388_VPP_SCALE_SHIFT) +#define ES8388_VPP_SCALE_4_0V (1 << ES8388_VPP_SCALE_SHIFT) +#define ES8388_VPP_SCALE_3_0V (2 << ES8388_VPP_SCALE_SHIFT) +#define ES8388_VPP_SCALE_2_5V (3 << ES8388_VPP_SCALE_SHIFT) + +#define ES8388_SE_SHIFT (2) +#define ES8388_SE_BITMASK (0x07 << ES8388_SE_SHIFT) +#define ES8388_SE(a) (a << ES8388_SE_SHIFT) + +#define ES8388_MONO_SHIFT (5) +#define ES8388_MONO_BITMASK (0x01 << ES8388_MONO_SHIFT) +#define ES8388_MONO_STEREO (0 << ES8388_MONO_SHIFT) +#define ES8388_MONO_MONO (1 << ES8388_MONO_SHIFT) + +#define ES8388_ZEROR_SHIFT (6) +#define ES8388_ZEROR_BITMASK (0x01 << ES8388_ZEROR_SHIFT) +#define ES8388_ZEROR_NORMAL (0 << ES8388_ZEROR_SHIFT) +#define ES8388_ZEROR_ZERO (1 << ES8388_ZEROR_SHIFT) + +#define ES8388_ZEROL_SHIFT (7) +#define ES8388_ZEROL_BITMASK (0x01 << ES8388_ZEROL_SHIFT) +#define ES8388_ZEROL_NORMAL (0 << ES8388_ZEROL_SHIFT) +#define ES8388_ZEROL_ZERO (1 << ES8388_ZEROL_SHIFT) + +/* 0x1e DAC Control 8 + * 0x1f DAC Control 9 + * 0x20 DAC Control 10 + * 0x21 DAC Control 11 + * 0x22 DAC Control 12 + * 0x23 DAC Control 13 + * 0x24 DAC Control 14 + * 0x25 DAC Control 15 + */ + +#define ES8388_SHELVING_COEF_SHIFT (0) +#define ES8388_SHELVING_COEF_BITMASK (0xff << ES8388_SHELVING_COEF_SHIFT) +#define ES8388_SHELVING_COEF(a) (a << ES8388_SHELVING_COEF_SHIFT) + +/* 0x26 DAC Control 16 */ + +#define ES8388_RMIXSEL_SHIFT (0) +#define ES8388_RMIXSEL_BITMASK (0x07 << ES8388_RMIXSEL_SHIFT) +#define ES8388_RMIXSEL_RIN1 (0 << ES8388_RMIXSEL_SHIFT) +#define ES8388_RMIXSEL_RIN2 (1 << ES8388_RMIXSEL_SHIFT) +#define ES8388_RMIXSEL_PIN (3 << ES8388_RMIXSEL_SHIFT) +#define ES8388_RMIXSEL_NIN (4 << ES8388_RMIXSEL_SHIFT) + +#define ES8388_LMIXSEL_SHIFT (3) +#define ES8388_LMIXSEL_BITMASK (0x07 << ES8388_LMIXSEL_SHIFT) +#define ES8388_LMIXSEL_LIN1 (0 << ES8388_LMIXSEL_SHIFT) +#define ES8388_LMIXSEL_LIN2 (1 << ES8388_LMIXSEL_SHIFT) +#define ES8388_LMIXSEL_PIN (3 << ES8388_LMIXSEL_SHIFT) +#define ES8388_LMIXSEL_NIN (4 << ES8388_LMIXSEL_SHIFT) + +/* 0x27 DAC Control 17 */ + +#define ES8388_LI2LOVOL_SHIFT (3) +#define ES8388_LI2LOVOL_BITMASK (0x07 << ES8388_LI2LOVOL_SHIFT) +#define ES8388_LI2LOVOL(a) (a << ES8388_LI2LOVOL_SHIFT) + +#define ES8388_LI2LO_SHIFT (6) +#define ES8388_LI2LO_BITMASK (0x01 << ES8388_LI2LO_SHIFT) +#define ES8388_LI2LO_DISABLE (0 << ES8388_LI2LO_SHIFT) +#define ES8388_LI2LO_ENABLE (1 << ES8388_LI2LO_SHIFT) + +#define ES8388_LD2LO_SHIFT (7) +#define ES8388_LD2LO_BITMASK (0x01 << ES8388_LD2LO_SHIFT) +#define ES8388_LD2LO_DISABLE (0 << ES8388_LD2LO_SHIFT) +#define ES8388_LD2LO_ENABLE (1 << ES8388_LD2LO_SHIFT) + +/* 0x2a DAC Control 20 */ + +#define ES8388_RI2ROVOL_SHIFT (3) +#define ES8388_RI2ROVOL_BITMASK (0x07 << ES8388_RI2ROVOL_SHIFT) +#define ES8388_RI2ROVOL(a) (a << ES8388_RI2ROVOL_SHIFT) + +#define ES8388_RI2RO_SHIFT (6) +#define ES8388_RI2RO_BITMASK (0x01 << ES8388_RI2RO_SHIFT) +#define ES8388_RI2RO_DISABLE (0 << ES8388_RI2RO_SHIFT) +#define ES8388_RI2RO_ENABLE (1 << ES8388_RI2RO_SHIFT) + +#define ES8388_RD2RO_SHIFT (7) +#define ES8388_RD2RO_BITMASK (0x01 << ES8388_RD2RO_SHIFT) +#define ES8388_RD2RO_DISABLE (0 << ES8388_RD2RO_SHIFT) +#define ES8388_RD2RO_ENABLE (1 << ES8388_RD2RO_SHIFT) + +/* 0x2b DAC Control 21 */ + +#define ES8388_DAC_DLL_PWD_SHIFT (2) +#define ES8388_DAC_DLL_PWD_BITMASK (0x01 << ES8388_DAC_DLL_PWD_SHIFT) +#define ES8388_DAC_DLL_PWD_NORMAL (0 << ES8388_DAC_DLL_PWD_SHIFT) +#define ES8388_DAC_DLL_PWD_PWRDN (1 << ES8388_DAC_DLL_PWD_SHIFT) + +#define ES8388_ADC_DLL_PWD_SHIFT (3) +#define ES8388_ADC_DLL_PWD_BITMASK (0x01 << ES8388_ADC_DLL_PWD_SHIFT) +#define ES8388_ADC_DLL_PWD_NORMAL (0 << ES8388_ADC_DLL_PWD_SHIFT) +#define ES8388_ADC_DLL_PWD_PWRDN (1 << ES8388_ADC_DLL_PWD_SHIFT) + +#define ES8388_MCLK_DIS_SHIFT (4) +#define ES8388_MCLK_DIS_BITMASK (0x01 << ES8388_MCLK_DIS_SHIFT) +#define ES8388_MCLK_DIS_NORMAL (0 << ES8388_MCLK_DIS_SHIFT) +#define ES8388_MCLK_DIS_DISABLE (1 << ES8388_MCLK_DIS_SHIFT) + +#define ES8388_OFFSET_DIS_SHIFT (5) +#define ES8388_OFFSET_DIS_BITMASK (0x01 << ES8388_OFFSET_DIS_SHIFT) +#define ES8388_OFFSET_DIS_DISABLE (0 << ES8388_OFFSET_DIS_SHIFT) +#define ES8388_OFFSET_DIS_ENABLE (1 << ES8388_OFFSET_DIS_SHIFT) + +#define ES8388_LRCK_SEL_SHIFT (6) +#define ES8388_LRCK_SEL_BITMASK (0x01 << ES8388_LRCK_SEL_SHIFT) +#define ES8388_LRCK_SEL_DAC (0 << ES8388_LRCK_SEL_SHIFT) +#define ES8388_LRCK_SEL_ADC (1 << ES8388_LRCK_SEL_SHIFT) + +#define ES8388_SLRCK_SHIFT (7) +#define ES8388_SLRCK_BITMASK (0x01 << ES8388_SLRCK_SHIFT) +#define ES8388_SLRCK_SEPARATE (0 << ES8388_SLRCK_SHIFT) +#define ES8388_SLRCK_SAME (1 << ES8388_SLRCK_SHIFT) + +/* 0x2c DAC Control 22 */ + +#define ES8388_OFFSET_SHIFT (0) +#define ES8388_OFFSET_BITMASK (0xff << ES8388_OFFSET_SHIFT) +#define ES8388_OFFSET(a) (a << ES8388_OFFSET_SHIFT) + +/* 0x2d DAC Control 23 */ + +#define ES8388_VROI_SHIFT (4) +#define ES8388_VROI_BITMASK (0x01 << ES8388_VROI_SHIFT) +#define ES8388_VROI_1_5K (0 << ES8388_VROI_SHIFT) +#define ES8388_VROI_40K (1 << ES8388_VROI_SHIFT) + +/* 0x2e DAC Control 24 */ + +#define ES8388_LOUT1VOL_SHIFT (0) +#define ES8388_LOUT1VOL_BITMASK (0x3f << ES8388_LOUT1VOL_SHIFT) +#define ES8388_LOUT1VOL(a) (a << ES8388_LOUT1VOL_SHIFT) + +/* 0x2f DAC Control 25 */ + +#define ES8388_ROUT1VOL_SHIFT (0) +#define ES8388_ROUT1VOL_BITMASK (0x3f << ES8388_ROUT1VOL_SHIFT) +#define ES8388_ROUT1VOL(a) (a << ES8388_ROUT1VOL_SHIFT) + +/* 0x30 DAC Control 26 */ + +#define ES8388_LOUT2VOL_SHIFT (0) +#define ES8388_LOUT2VOL_BITMASK (0x3f << ES8388_LOUT2VOL_SHIFT) +#define ES8388_LOUT2VOL(a) (a << ES8388_LOUT2VOL_SHIFT) + +/* 0x31 DAC Control 27 */ + +#define ES8388_ROUT2VOL_SHIFT (0) +#define ES8388_ROUT2VOL_BITMASK (0x3f << ES8388_ROUT2VOL_SHIFT) +#define ES8388_ROUT2VOL(a) (a << ES8388_ROUT2VOL_SHIFT) + +/* Codec Default Parameters *************************************************/ + +#define ES8388_DEFAULT_SAMPRATE 44100 +#define ES8388_DEFAULT_NCHANNELS 2 +#define ES8388_DEFAULT_BPSAMP 16 +#define ES8388_DEFAULT_VOL_OUT 250 +#define ES8388_DEFAULT_VOL_IN 1000 +#define ES8388_DEFAULT_BALANCE 500 +#define ES8388_DEFAULT_MUTE true +#define ES8388_DEFAULT_AUDIO_MODE ES_MODULE_ADC_DAC +#define ES8388_DEFAULT_DAC_OUTPUT ES8388_DAC_OUTPUT_ALL +#define ES8388_DEFAULT_ADC_INPUT ES8388_ADC_INPUT_LINE1 +#define ES8388_DEFAULT_MIC_GAIN ES_MIC_GAIN_24DB +#define ES8388_DEFAULT_MODE ES_MODE_SLAVE +#define ES8388_DEFAULT_FMT ES_I2S_NORMAL + +/**************************************************************************** + * Public Types + ****************************************************************************/ + +typedef enum +{ + ES8388_DAC_OUTPUT_LINE1, + ES8388_DAC_OUTPUT_LINE2, + ES8388_DAC_OUTPUT_ALL, +} es8388_dac_output_e; + +typedef enum +{ + ES8388_ADC_INPUT_LINE1, + ES8388_ADC_INPUT_LINE2, + ES8388_ADC_INPUT_ALL, + ES8388_ADC_INPUT_DIFFERENCE, +} es8388_adc_input_e; + +typedef enum +{ + ES8388_MIXER_GAIN_6DB, + ES8388_MIXER_GAIN_3DB, + ES8388_MIXER_GAIN_0DB, + ES8388_MIXER_GAIN_N3DB, + ES8388_MIXER_GAIN_N6DB, + ES8388_MIXER_GAIN_N9DB, + ES8388_MIXER_GAIN_N12DB, + ES8388_MIXER_GAIN_N15DB, +} es8388_mixer_gain_e; + +typedef enum +{ + ES_WORD_LENGTH_16BITS = 0x03, + ES_WORD_LENGTH_18BITS = 0x02, + ES_WORD_LENGTH_20BITS = 0x01, + ES_WORD_LENGTH_24BITS = 0x00, + ES_WORD_LENGTH_32BITS = 0x04 +} es_word_length_e; + +typedef enum +{ + ES_MCLK_DIV_AUTO, + ES_MCLK_DIV_1, + ES_MCLK_DIV_2, + ES_MCLK_DIV_3, + ES_MCLK_DIV_4, + ES_MCLK_DIV_6, + ES_MCLK_DIV_8, + ES_MCLK_DIV_9, + ES_MCLK_DIV_11, + ES_MCLK_DIV_12, + ES_MCLK_DIV_16, + ES_MCLK_DIV_18, + ES_MCLK_DIV_22, + ES_MCLK_DIV_24, + ES_MCLK_DIV_33, + ES_MCLK_DIV_36, + ES_MCLK_DIV_44, + ES_MCLK_DIV_48, + ES_MCLK_DIV_66, + ES_MCLK_DIV_72, + ES_MCLK_DIV_5, + ES_MCLK_DIV_10, + ES_MCLK_DIV_15, + ES_MCLK_DIV_17, + ES_MCLK_DIV_20, + ES_MCLK_DIV_25, + ES_MCLK_DIV_30, + ES_MCLK_DIV_32, + ES_MCLK_DIV_34, + ES_MCLK_DIV_7, + ES_MCLK_DIV_13, + ES_MCLK_DIV_14 +} es_sclk_div_e; + +typedef enum +{ + ES_LCLK_DIV_128 = 0, + ES_LCLK_DIV_192 = 1, + ES_LCLK_DIV_256 = 2, + ES_LCLK_DIV_384 = 3, + ES_LCLK_DIV_512 = 4, + ES_LCLK_DIV_576 = 5, + ES_LCLK_DIV_768 = 6, + ES_LCLK_DIV_1024 = 7, + ES_LCLK_DIV_1152 = 8, + ES_LCLK_DIV_1408 = 9, + ES_LCLK_DIV_1536 = 10, + ES_LCLK_DIV_2112 = 11, + ES_LCLK_DIV_2304 = 12, + ES_LCLK_DIV_125 = 16, + ES_LCLK_DIV_136 = 17, + ES_LCLK_DIV_250 = 18, + ES_LCLK_DIV_272 = 19, + ES_LCLK_DIV_375 = 20, + ES_LCLK_DIV_500 = 21, + ES_LCLK_DIV_544 = 22, + ES_LCLK_DIV_750 = 23, + ES_LCLK_DIV_1000 = 24, + ES_LCLK_DIV_1088 = 25, + ES_LCLK_DIV_1496 = 26, + ES_LCLK_DIV_1500 = 27 +} es_lclk_div_e; + +typedef enum +{ + ES_D2SE_PGA_GAIN_DIS, + ES_D2SE_PGA_GAIN_EN +} es_d2se_pga_e; + +typedef enum +{ + ES_ADC_CHANNEL_LINPUT1_RINPUT1 = 0x00, + ES_ADC_CHANNEL_MIC1 = 0x05, + ES_ADC_CHANNEL_MIC2 = 0x06, + ES_ADC_CHANNEL_LINPUT2_RINPUT2 = 0x50, + ES_ADC_CHANNEL_DIFFERENCE = 0xf0 +} es_adc_channel_e; + +typedef enum +{ + ES_DAC_CHANNEL_LOUT1 = 0x04, + ES_DAC_CHANNEL_LOUT2 = 0x08, + ES_DAC_CHANNEL_SPK = 0x09, + ES_DAC_CHANNEL_ROUT1 = 0x10, + ES_DAC_CHANNEL_ROUT2 = 0x20, + ES_DAC_CHANNEL_ALL = 0x3c +} es_dac_channel_e; + +typedef enum +{ + ES_MIC_GAIN_0DB, + ES_MIC_GAIN_3DB, + ES_MIC_GAIN_6DB, + ES_MIC_GAIN_9DB, + ES_MIC_GAIN_12DB, + ES_MIC_GAIN_15DB, + ES_MIC_GAIN_18DB, + ES_MIC_GAIN_21DB, + ES_MIC_GAIN_24DB +} es_mic_gain_e; + +typedef enum +{ + ES_MODULE_ADC = 1, + ES_MODULE_DAC, + ES_MODULE_ADC_DAC, + ES_MODULE_LINE +} es_module_e; + +typedef enum +{ + ES_MODE_SLAVE, + ES_MODE_MASTER +} es_mode_e; + +typedef enum +{ + ES_I2S_NORMAL, + ES_I2S_LEFT, + ES_I2S_RIGHT, + ES_I2S_DSP +} es_i2s_fmt_e; + +/**************************************************************************** + * Class Definitions + ****************************************************************************/ + +class ES8388 +{ + private: + TwoWire* _i2c; /* The I2C bus */ + I2SClass* _i2s; /* The I2S bus */ + uint8_t _addr; /* The I2C address */ + es_i2s_fmt_e _fmt; /* The current I2S format */ + es_mode_e _mode; /* The current codec mode */ + uint32_t _samprate; /* Configured samprate (samples/sec) */ + uint16_t _balance; /* Current balance level {0..1000} */ + uint16_t _volume_out; /* Current output volume level {0..1000} */ + uint16_t _volume_in; /* Current input volume level {0..1000} */ + uint8_t _nchannels; /* Number of channels (1 or 2) */ + uint8_t _bpsamp; /* Bits per sample */ + bool _mute; /* True: Output is muted */ + es_module_e _audio_mode; /* The current audio mode of the ES8388 chip */ + es8388_dac_output_e _dac_output; /* The current output of the ES8388 DAC */ + es8388_adc_input_e _adc_input; /* The current input of the ES8388 ADC */ + es_mic_gain_e _mic_gain; /* The current microphone gain */ + bool _running; /* True: The ES8388 is running */ + es_lclk_div_e _lclk_div; /* The current LCLK divider */ + es_word_length_e _word_length; /* The current word length (enum of _bpsamp) */ + + void reset(); + void start(); + void stop(); + void setvolume(es_module_e module, uint16_t volume, uint16_t balance); + void setmute(es_module_e module, bool enable); + + public: + ~ES8388(); + bool begin(I2SClass& i2s, TwoWire& i2c = Wire, uint8_t addr = 0x10); + void end(); + void playWAV(uint8_t* data, size_t len); + uint8_t* recordWAV(size_t rec_seconds, size_t* out_size); + uint8_t readReg(uint8_t reg); + void writeReg(uint8_t reg, uint8_t data); + void setOutputVolume(uint16_t volume, uint16_t balance); + void setInputVolume(uint16_t volume, uint16_t balance); + void setOutputMute(bool enable); + void setInputMute(bool enable); + void setBitsPerSample(uint8_t bpsamp); + void setSampleRate(uint32_t rate); + void setMicGain(uint8_t gain); +}; diff --git a/libraries/ESP_I2S/examples/ES8388_loopback/ES8388_loopback.ino b/libraries/ESP_I2S/examples/ES8388_loopback/ES8388_loopback.ino new file mode 100644 index 00000000000..e709e7df428 --- /dev/null +++ b/libraries/ESP_I2S/examples/ES8388_loopback/ES8388_loopback.ino @@ -0,0 +1,86 @@ +/* + ESP32-LyraT I2S ES8388 loopback example + This simple example demonstrates using the I2S library in combination + with the ES8388 codec on the ESP32-LyraT board to record and play back + audio data. + + Don't forget to enable the PSRAM in the Tools menu! + + Created for arduino-esp32 on 20 Dec, 2023 + by Lucas Saavedra Vaz (lucasssvaz) +*/ + +#include "ESP_I2S.h" +#include "Wire.h" + +#include "ES8388.h" + +/* Pin definitions */ + +/* I2C */ +const uint8_t I2C_SCL = 23; +const uint8_t I2C_SDA = 18; +const uint32_t I2C_FREQ = 400000; + +/* I2S */ +const uint8_t I2S_MCLK = 0; /* Master clock */ +const uint8_t I2S_SCK = 5; /* Audio data bit clock */ +const uint8_t I2S_WS = 25; /* Audio data left and right clock */ +const uint8_t I2S_SDOUT = 26; /* ESP32 audio data output (to speakers) */ +const uint8_t I2S_SDIN = 35; /* ESP32 audio data input (from microphone) */ + +/* PA */ +const uint8_t PA_ENABLE = 21; /* Power amplifier enable */ + +void setup() { + I2SClass i2s; + ES8388 codec; + uint8_t *wav_buffer; + size_t wav_size; + + // Initialize the serial port + Serial.begin(115200); + while (!Serial) { delay(10); } + + pinMode(PA_ENABLE, OUTPUT); + digitalWrite(PA_ENABLE, HIGH); + + Serial.println("Initializing I2C bus..."); + + // Initialize the I2C bus + Wire.begin(I2C_SDA, I2C_SCL, I2C_FREQ); + + Serial.println("Initializing I2S bus..."); + + // Set up the pins used for audio input + i2s.setPins(I2S_SCK, I2S_WS, I2S_SDOUT, I2S_SDIN, I2S_MCLK); + + // Initialize the I2S bus in standard mode + if (!i2s.begin(I2S_MODE_STD, 44100, I2S_DATA_BIT_WIDTH_16BIT, I2S_SLOT_MODE_STEREO, I2S_STD_SLOT_BOTH)) { + Serial.println("Failed to initialize I2S bus!"); + return; + } + + Serial.println("Initializing ES8388..."); + + if (!codec.begin(i2s)) { + Serial.println("Failed to initialize ES8388!"); + return; + } + + Serial.println("Recording 10 seconds of audio data..."); + + // Record 10 seconds of audio data + wav_buffer = codec.recordWAV(10, &wav_size); + + Serial.println("Recording complete. Playing audio data in 3 seconds."); + delay(3000); + + // Play the audio data + Serial.println("Playing audio data..."); + codec.playWAV(wav_buffer, wav_size); + + Serial.println("Application complete."); +} + +void loop() {} diff --git a/libraries/ESP_I2S/examples/Record_to_WAV/.skip.esp32c3 b/libraries/ESP_I2S/examples/Record_to_WAV/.skip.esp32c3 new file mode 100644 index 00000000000..e69de29bb2d diff --git a/libraries/ESP_I2S/examples/Record_to_WAV/.skip.esp32c6 b/libraries/ESP_I2S/examples/Record_to_WAV/.skip.esp32c6 new file mode 100644 index 00000000000..e69de29bb2d diff --git a/libraries/ESP_I2S/examples/Record_to_WAV/.skip.esp32h2 b/libraries/ESP_I2S/examples/Record_to_WAV/.skip.esp32h2 new file mode 100644 index 00000000000..e69de29bb2d diff --git a/libraries/ESP_I2S/examples/Record_to_WAV/.skip.esp32s2 b/libraries/ESP_I2S/examples/Record_to_WAV/.skip.esp32s2 new file mode 100644 index 00000000000..e69de29bb2d diff --git a/libraries/ESP_I2S/examples/Record_to_WAV/Record_to_WAV.ino b/libraries/ESP_I2S/examples/Record_to_WAV/Record_to_WAV.ino new file mode 100644 index 00000000000..6d3fe038b00 --- /dev/null +++ b/libraries/ESP_I2S/examples/Record_to_WAV/Record_to_WAV.ino @@ -0,0 +1,90 @@ +/* + ESP32-S2-EYE I2S record to WAV example + This simple example demonstrates using the I2S library to record + 5 seconds of audio data and write it to a WAV file on the SD card. + + Don't forget to select the OPI PSRAM, 8MB flash size and Enable USB CDC + on boot in the Tools menu! + + Created for arduino-esp32 on 18 Dec, 2023 + by Lucas Saavedra Vaz (lucasssvaz) +*/ + +#include "ESP_I2S.h" +#include "FS.h" +#include "SD_MMC.h" + +const uint8_t I2S_SCK = 41; +const uint8_t I2S_WS = 42; +const uint8_t I2S_DIN = 2; + +const uint8_t SD_CMD = 38; +const uint8_t SD_CLK = 39; +const uint8_t SD_DATA0 = 40; + +void setup() { + // Create an instance of the I2SClass + I2SClass i2s; + + // Create variables to store the audio data + uint8_t *wav_buffer; + size_t wav_size; + + // Initialize the serial port + Serial.begin(115200); + while (!Serial) { delay(10); } + + Serial.println("Initializing I2S bus..."); + + // Set up the pins used for audio input + i2s.setPins(I2S_SCK, I2S_WS, -1, I2S_DIN); + + // Initialize the I2S bus in standard mode + if (!i2s.begin(I2S_MODE_STD, 16000, I2S_DATA_BIT_WIDTH_32BIT, I2S_SLOT_MODE_MONO, I2S_STD_SLOT_LEFT)) { + Serial.println("Failed to initialize I2S bus!"); + return; + } + + Serial.println("I2S bus initialized."); + Serial.println("Initializing SD card..."); + + // Set up the pins used for SD card access + if (!SD_MMC.setPins(SD_CLK, SD_CMD, SD_DATA0)) { + Serial.println("Failed to set SD pins!"); + return; + } + + // Mount the SD card + if(!SD_MMC.begin("/sdcard", true)){ + Serial.println("Failed to initialize SD card!"); + return; + } + + Serial.println("SD card initialized."); + Serial.println("Recording 5 seconds of audio data..."); + + // Record 5 seconds of audio data + wav_buffer = i2s.recordWAV(5, &wav_size); + + // Create a file on the SD card + File file = SD_MMC.open("/test.wav", FILE_WRITE); + if (!file) { + Serial.println("Failed to open file for writing!"); + return; + } + + Serial.println("Writing audio data to file..."); + + // Write the audio data to the file + if (file.write(wav_buffer, wav_size) != wav_size) { + Serial.println("Failed to write audio data to file!"); + return; + } + + // Close the file + file.close(); + + Serial.println("Application complete."); +} + +void loop() {} diff --git a/libraries/ESP_I2S/examples/Simple_tone/Simple_tone.ino b/libraries/ESP_I2S/examples/Simple_tone/Simple_tone.ino new file mode 100644 index 00000000000..a9da190cf43 --- /dev/null +++ b/libraries/ESP_I2S/examples/Simple_tone/Simple_tone.ino @@ -0,0 +1,68 @@ +/* + This example generates a square wave based tone at a specified frequency + and sample rate. Then outputs the data using the I2S interface to a + MAX08357 I2S Amp Breakout board. + I2S Circuit: + * Arduino/Genuino Zero, MKR family and Nano 33 IoT + * MAX08357: + * GND connected GND + * VIN connected 5V + * LRC connected to pin 0 (Zero) or 3 (MKR), A2 (Nano) or 25 (ESP32) + * BCLK connected to pin 1 (Zero) or 2 (MKR), A3 (Nano) or 5 (ESP32) + * DIN connected to pin 9 (Zero) or A6 (MKR), 4 (Nano) or 26 (ESP32) + DAC Circuit: + * ESP32 or ESP32-S2 + * Audio amplifier + - Note: + - ESP32 has DAC on GPIO pins 25 and 26. + - ESP32-S2 has DAC on GPIO pins 17 and 18. + - Connect speaker(s) or headphones. + created 17 November 2016 + by Sandeep Mistry + For ESP extended + Tomas Pilny + 2nd September 2021 + Lucas Saavedra Vaz (lucasssvaz) + 22nd December 2023 + */ + +#include + +const int frequency = 440; // frequency of square wave in Hz +const int amplitude = 500; // amplitude of square wave +const int sampleRate = 8000; // sample rate in Hz + +i2s_data_bit_width_t bps = I2S_DATA_BIT_WIDTH_16BIT; +i2s_mode_t mode = I2S_MODE_STD; +i2s_slot_mode_t slot = I2S_SLOT_MODE_STEREO; + +const int halfWavelength = (sampleRate / frequency); // half wavelength of square wave + +int32_t sample = amplitude; // current sample value +int count = 0; + +I2SClass i2s; + +void setup() { + Serial.begin(115200); + Serial.println("I2S simple tone"); + + // start I2S at the sample rate with 16-bits per sample + if (!i2s.begin(mode, sampleRate, bps, slot)) { + Serial.println("Failed to initialize I2S!"); + while (1); // do nothing + } +} + +void loop() { + if (count % halfWavelength == 0 ) { + // invert the sample every half wavelength count multiple to generate square wave + sample = -1 * sample; + } + + i2s.write(sample); // Right channel + i2s.write(sample); // Left channel + + // increment the counter for the next sample + count++; +} diff --git a/libraries/ESPmDNS/examples/mDNS-SD_Extended/mDNS-SD_Extended.ino b/libraries/ESPmDNS/examples/mDNS-SD_Extended/mDNS-SD_Extended.ino index 6f2dfddfb3b..9e582b3236a 100644 --- a/libraries/ESPmDNS/examples/mDNS-SD_Extended/mDNS-SD_Extended.ino +++ b/libraries/ESPmDNS/examples/mDNS-SD_Extended/mDNS-SD_Extended.ino @@ -70,7 +70,7 @@ void browseService(const char * service, const char * proto){ Serial.print(": "); Serial.print(MDNS.hostname(i)); Serial.print(" ("); - Serial.print(MDNS.IP(i)); + Serial.print(MDNS.address(i)); Serial.print(":"); Serial.print(MDNS.port(i)); Serial.println(")"); diff --git a/libraries/ESPmDNS/src/ESPmDNS.cpp b/libraries/ESPmDNS/src/ESPmDNS.cpp index bccc4de5758..21d93aa4e2a 100644 --- a/libraries/ESPmDNS/src/ESPmDNS.cpp +++ b/libraries/ESPmDNS/src/ESPmDNS.cpp @@ -265,7 +265,7 @@ String MDNSResponder::hostname(int idx) { return String(result->hostname); } -IPAddress MDNSResponder::IP(int idx) { +IPAddress MDNSResponder::address(int idx) { mdns_result_t * result = _getResult(idx); if(!result){ log_e("Result %d not found", idx); @@ -281,20 +281,20 @@ IPAddress MDNSResponder::IP(int idx) { return IPAddress(); } -IPv6Address MDNSResponder::IPv6(int idx) { +IPAddress MDNSResponder::addressV6(int idx) { mdns_result_t * result = _getResult(idx); if(!result){ log_e("Result %d not found", idx); - return IPv6Address(); + return IPAddress(IPv6); } mdns_ip_addr_t * addr = result->addr; while(addr){ if(addr->addr.type == MDNS_IP_PROTOCOL_V6){ - return IPv6Address(addr->addr.u_addr.ip6.addr); + return IPAddress(IPv6, (const uint8_t *)addr->addr.u_addr.ip6.addr, addr->addr.u_addr.ip6.zone); } addr = addr->next; } - return IPv6Address(); + return IPAddress(IPv6); } uint16_t MDNSResponder::port(int idx) { diff --git a/libraries/ESPmDNS/src/ESPmDNS.h b/libraries/ESPmDNS/src/ESPmDNS.h index 6a5cb56ffba..01ca7518d2f 100644 --- a/libraries/ESPmDNS/src/ESPmDNS.h +++ b/libraries/ESPmDNS/src/ESPmDNS.h @@ -42,7 +42,6 @@ License (MIT license): #define ESP32MDNS_H #include "Arduino.h" -#include "IPv6Address.h" #include "mdns.h" #include "esp_interface.h" @@ -108,8 +107,8 @@ class MDNSResponder { } String hostname(int idx); - IPAddress IP(int idx); - IPv6Address IPv6(int idx); + IPAddress address(int idx); + IPAddress addressV6(int idx); uint16_t port(int idx); int numTxt(int idx); bool hasTxt(int idx, const char * key); diff --git a/libraries/Ethernet/examples/ETH_LAN8720/ETH_LAN8720.ino b/libraries/Ethernet/examples/ETH_LAN8720/ETH_LAN8720.ino index 7914e66e6ee..e06e185cf9a 100644 --- a/libraries/Ethernet/examples/ETH_LAN8720/ETH_LAN8720.ino +++ b/libraries/Ethernet/examples/ETH_LAN8720/ETH_LAN8720.ino @@ -5,12 +5,14 @@ // Important to be defined BEFORE including ETH.h for ETH.begin() to work. // Example RMII LAN8720 (Olimex, etc.) +#ifndef ETH_PHY_TYPE #define ETH_PHY_TYPE ETH_PHY_LAN8720 #define ETH_PHY_ADDR 0 #define ETH_PHY_MDC 23 #define ETH_PHY_MDIO 18 #define ETH_PHY_POWER -1 #define ETH_CLK_MODE ETH_CLOCK_GPIO0_IN +#endif #include diff --git a/libraries/Ethernet/examples/ETH_TLK110/ETH_TLK110.ino b/libraries/Ethernet/examples/ETH_TLK110/ETH_TLK110.ino index 3a685994862..058e1c3f81f 100644 --- a/libraries/Ethernet/examples/ETH_TLK110/ETH_TLK110.ino +++ b/libraries/Ethernet/examples/ETH_TLK110/ETH_TLK110.ino @@ -5,12 +5,14 @@ #include -#define ETH_TYPE ETH_PHY_TLK110 -#define ETH_ADDR 31 -#define ETH_MDC_PIN 23 -#define ETH_MDIO_PIN 18 -#define ETH_POWER_PIN 17 +#ifndef ETH_PHY_TYPE +#define ETH_PHY_TYPE ETH_PHY_TLK110 +#define ETH_PHY_ADDR 31 +#define ETH_PHY_MDC 23 +#define ETH_PHY_MDIO 18 +#define ETH_PHY_POWER 17 #define ETH_CLK_MODE ETH_CLOCK_GPIO0_IN +#endif static bool eth_connected = false; @@ -73,7 +75,7 @@ void setup() { Serial.begin(115200); WiFi.onEvent(WiFiEvent); // Will call WiFiEvent() from another thread. - ETH.begin(ETH_TYPE, ETH_ADDR, ETH_MDC_PIN, ETH_MDIO_PIN, ETH_POWER_PIN, ETH_CLK_MODE); + ETH.begin(ETH_PHY_TYPE, ETH_PHY_ADDR, ETH_PHY_MDC, ETH_PHY_MDIO, ETH_PHY_POWER, ETH_CLK_MODE); } diff --git a/libraries/Ethernet/examples/ETH_W5500_Arduino_SPI/ETH_W5500_Arduino_SPI.ino b/libraries/Ethernet/examples/ETH_W5500_Arduino_SPI/ETH_W5500_Arduino_SPI.ino index 0b7e3cf1342..48ac0e83c5c 100644 --- a/libraries/Ethernet/examples/ETH_W5500_Arduino_SPI/ETH_W5500_Arduino_SPI.ino +++ b/libraries/Ethernet/examples/ETH_W5500_Arduino_SPI/ETH_W5500_Arduino_SPI.ino @@ -9,24 +9,28 @@ // Set this to 1 to enable dual Ethernet support #define USE_TWO_ETH_PORTS 0 -#define ETH_TYPE ETH_PHY_W5500 -#define ETH_ADDR 1 -#define ETH_CS 15 -#define ETH_IRQ 4 -#define ETH_RST 5 +#ifndef ETH_PHY_TYPE +#define ETH_PHY_TYPE ETH_PHY_W5500 +#define ETH_PHY_ADDR 1 +#define ETH_PHY_CS 15 +#define ETH_PHY_IRQ 4 +#define ETH_PHY_RST 5 +#endif // SPI pins -#define ETH_SPI_SCK 14 -#define ETH_SPI_MISO 12 -#define ETH_SPI_MOSI 13 +#define ETH_SPI_SCK 14 +#define ETH_SPI_MISO 12 +#define ETH_SPI_MOSI 13 #if USE_TWO_ETH_PORTS // Second port on shared SPI bus -#define ETH1_TYPE ETH_PHY_W5500 -#define ETH1_ADDR 1 -#define ETH1_CS 32 -#define ETH1_IRQ 33 -#define ETH1_RST 18 +#ifndef ETH1_PHY_TYPE +#define ETH1_PHY_TYPE ETH_PHY_W5500 +#define ETH1_PHY_ADDR 1 +#define ETH1_PHY_CS 32 +#define ETH1_PHY_IRQ 33 +#define ETH1_PHY_RST 18 +#endif ETHClass ETH1(1); #endif @@ -94,9 +98,9 @@ void setup() WiFi.onEvent(onEvent); SPI.begin(ETH_SPI_SCK, ETH_SPI_MISO, ETH_SPI_MOSI); - ETH.begin(ETH_TYPE, ETH_ADDR, ETH_CS, ETH_IRQ, ETH_RST, SPI); + ETH.begin(ETH_PHY_TYPE, ETH_PHY_ADDR, ETH_PHY_CS, ETH_PHY_IRQ, ETH_PHY_RST, SPI); #if USE_TWO_ETH_PORTS - ETH1.begin(ETH1_TYPE, ETH1_ADDR, ETH1_CS, ETH1_IRQ, ETH1_RST, SPI); + ETH1.begin(ETH1_PHY_TYPE, ETH1_PHY_ADDR, ETH1_PHY_CS, ETH1_PHY_IRQ, ETH1_PHY_RST, SPI); #endif } diff --git a/libraries/Ethernet/examples/ETH_W5500_IDF_SPI/ETH_W5500_IDF_SPI.ino b/libraries/Ethernet/examples/ETH_W5500_IDF_SPI/ETH_W5500_IDF_SPI.ino index d68b3e1d162..fe8fb725bc6 100644 --- a/libraries/Ethernet/examples/ETH_W5500_IDF_SPI/ETH_W5500_IDF_SPI.ino +++ b/libraries/Ethernet/examples/ETH_W5500_IDF_SPI/ETH_W5500_IDF_SPI.ino @@ -8,23 +8,27 @@ // Set this to 1 to enable dual Ethernet support #define USE_TWO_ETH_PORTS 0 -#define ETH_TYPE ETH_PHY_W5500 -#define ETH_ADDR 1 -#define ETH_CS 15 -#define ETH_IRQ 4 -#define ETH_RST 5 -#define ETH_SPI_HOST SPI2_HOST -#define ETH_SPI_SCK 14 -#define ETH_SPI_MISO 12 -#define ETH_SPI_MOSI 13 +#ifndef ETH_PHY_TYPE +#define ETH_PHY_TYPE ETH_PHY_W5500 +#define ETH_PHY_ADDR 1 +#define ETH_PHY_CS 15 +#define ETH_PHY_IRQ 4 +#define ETH_PHY_RST 5 +#define ETH_PHY_SPI_HOST SPI2_HOST +#define ETH_PHY_SPI_SCK 14 +#define ETH_PHY_SPI_MISO 12 +#define ETH_PHY_SPI_MOSI 13 +#endif #if USE_TWO_ETH_PORTS // Second port on shared SPI bus -#define ETH1_TYPE ETH_PHY_W5500 -#define ETH1_ADDR 1 -#define ETH1_CS 32 -#define ETH1_IRQ 33 -#define ETH1_RST 18 +#ifndef ETH1_PHY_TYPE +#define ETH1_PHY_TYPE ETH_PHY_W5500 +#define ETH1_PHY_ADDR 1 +#define ETH1_PHY_CS 32 +#define ETH1_PHY_IRQ 33 +#define ETH1_PHY_RST 18 +#endif ETHClass ETH1(1); #endif @@ -90,10 +94,10 @@ void setup() { Serial.begin(115200); WiFi.onEvent(onEvent); - ETH.begin(ETH_TYPE, ETH_ADDR, ETH_CS, ETH_IRQ, ETH_RST, ETH_SPI_HOST, ETH_SPI_SCK, ETH_SPI_MISO, ETH_SPI_MOSI); + ETH.begin(ETH_PHY_TYPE, ETH_PHY_ADDR, ETH_PHY_CS, ETH_PHY_IRQ, ETH_PHY_RST, ETH_PHY_SPI_HOST, ETH_PHY_SPI_SCK, ETH_PHY_SPI_MISO, ETH_PHY_SPI_MOSI); #if USE_TWO_ETH_PORTS // Since SPI bus is shared, we should skip the SPI pins when calling ETH1.begin() - ETH1.begin(ETH1_TYPE, ETH1_ADDR, ETH1_CS, ETH1_IRQ, ETH1_RST, ETH_SPI_HOST); + ETH1.begin(ETH1_PHY_TYPE, ETH1_PHY_ADDR, ETH1_PHY_CS, ETH1_PHY_IRQ, ETH1_PHY_RST, ETH_PHY_SPI_HOST); #endif } diff --git a/libraries/Ethernet/src/ETH.cpp b/libraries/Ethernet/src/ETH.cpp index 40c408ee69a..92d91b40a1a 100644 --- a/libraries/Ethernet/src/ETH.cpp +++ b/libraries/Ethernet/src/ETH.cpp @@ -401,13 +401,13 @@ bool ETHClass::beginSPI(eth_phy_type_t type, uint8_t phy_addr, int cs, int irq, // Init SPI bus if(_pin_sck >= 0 && _pin_miso >= 0 && _pin_mosi >= 0){ - spi_bus_config_t buscfg = { - .mosi_io_num = _pin_mosi, - .miso_io_num = _pin_miso, - .sclk_io_num = _pin_sck, - .quadwp_io_num = -1, - .quadhd_io_num = -1, - }; + spi_bus_config_t buscfg; + memset(&buscfg, 0, sizeof(spi_bus_config_t)); + buscfg.mosi_io_num = _pin_mosi; + buscfg.miso_io_num = _pin_miso; + buscfg.sclk_io_num = _pin_sck; + buscfg.quadwp_io_num = -1; + buscfg.quadhd_io_num = -1; ret = spi_bus_initialize(spi_host, &buscfg, SPI_DMA_CH_AUTO); if(ret != ESP_OK){ log_e("SPI bus initialize failed: %d", ret); @@ -433,13 +433,13 @@ bool ETHClass::beginSPI(eth_phy_type_t type, uint8_t phy_addr, int cs, int irq, phy_config.reset_gpio_num = _pin_rst; // Configure SPI interface for specific SPI module - spi_device_interface_config_t spi_devcfg = { - .mode = 0, - .clock_speed_hz = _spi_freq_mhz * 1000 * 1000, - .input_delay_ns = 20, - .spics_io_num = _pin_cs, - .queue_size = 20, - }; + spi_device_interface_config_t spi_devcfg; + memset(&spi_devcfg, 0, sizeof(spi_device_interface_config_t)); + spi_devcfg.mode = 0; + spi_devcfg.clock_speed_hz = _spi_freq_mhz * 1000 * 1000; + spi_devcfg.input_delay_ns = 20; + spi_devcfg.spics_io_num = _pin_cs; + spi_devcfg.queue_size = 20; esp_eth_mac_t *mac = NULL; esp_eth_phy_t *phy = NULL; @@ -861,24 +861,42 @@ bool ETHClass::setHostname(const char * hostname) return esp_netif_set_hostname(_esp_netif, hostname) == 0; } -bool ETHClass::enableIpV6() +bool ETHClass::enableIPv6(bool en) { - if(_esp_netif == NULL){ - return false; + // if(_esp_netif == NULL){ + // return false; + // } + // return esp_netif_create_ip6_linklocal(_esp_netif) == 0; + if (en) { + WiFiGenericClass::setStatusBits(ETH_WANT_IP6_BIT); + } else { + WiFiGenericClass::clearStatusBits(ETH_WANT_IP6_BIT); } - return esp_netif_create_ip6_linklocal(_esp_netif) == 0; + return true; } -IPv6Address ETHClass::localIPv6() +IPAddress ETHClass::localIPv6() { if(_esp_netif == NULL){ - return IPv6Address(); + return IPAddress(IPv6); } static esp_ip6_addr_t addr; if(esp_netif_get_ip6_linklocal(_esp_netif, &addr)){ - return IPv6Address(); + return IPAddress(IPv6); + } + return IPAddress(IPv6, (const uint8_t *)addr.addr, addr.zone); +} + +IPAddress ETHClass::globalIPv6() +{ + if(_esp_netif == NULL){ + return IPAddress(IPv6); } - return IPv6Address(addr.addr); + static esp_ip6_addr_t addr; + if(esp_netif_get_ip6_global(_esp_netif, &addr)){ + return IPAddress(IPv6); + } + return IPAddress(IPv6, (const uint8_t *)addr.addr, addr.zone); } const char * ETHClass::ifkey(void) @@ -1031,6 +1049,28 @@ void ETHClass::printInfo(Print & out){ out.print(dnsIP()); out.println(); + static const char * types[] = { "UNKNOWN", "GLOBAL", "LINK_LOCAL", "SITE_LOCAL", "UNIQUE_LOCAL", "IPV4_MAPPED_IPV6" }; + esp_ip6_addr_t if_ip6[CONFIG_LWIP_IPV6_NUM_ADDRESSES]; + int v6addrs = esp_netif_get_all_ip6(_esp_netif, if_ip6); + for (int i = 0; i < v6addrs; ++i){ + out.print(" "); + out.print("inet6 "); + IPAddress(IPv6, (const uint8_t *)if_ip6[i].addr, if_ip6[i].zone).printTo(out, true); + out.print(" type "); + out.print(types[esp_netif_ip6_get_addr_type(&if_ip6[i])]); + out.println(); + } + + // out.print(" "); + // out.print("inet6 "); + // localIPv6().printTo(out); + // out.println(); + + // out.print(" "); + // out.print("inet6 "); + // globalIPv6().printTo(out); + // out.println(); + out.println(); } diff --git a/libraries/Ethernet/src/ETH.h b/libraries/Ethernet/src/ETH.h index 7ef39ef561f..7159ebd4574 100644 --- a/libraries/Ethernet/src/ETH.h +++ b/libraries/Ethernet/src/ETH.h @@ -145,8 +145,9 @@ class ETHClass { IPAddress broadcastIP(); IPAddress networkID(); uint8_t subnetCIDR(); - bool enableIpV6(); - IPv6Address localIPv6(); + bool enableIPv6(bool en=true); + IPAddress localIPv6(); + IPAddress globalIPv6(); const char * ifkey(void); const char * desc(void); String impl_name(void); diff --git a/libraries/LittleFS/examples/LITTLEFS_PlatformIO/littlefsbuilder.py b/libraries/LittleFS/examples/LITTLEFS_PlatformIO/littlefsbuilder.py deleted file mode 100644 index 9cda26f5aba..00000000000 --- a/libraries/LittleFS/examples/LITTLEFS_PlatformIO/littlefsbuilder.py +++ /dev/null @@ -1,2 +0,0 @@ -Import("env") -env.Replace( MKFSTOOL=env.get("PROJECT_DIR") + '/mklittlefs' ) # PlatformIO now believes it has actually created a SPIFFS diff --git a/libraries/LittleFS/examples/LITTLEFS_PlatformIO/platformio.ini b/libraries/LittleFS/examples/LITTLEFS_PlatformIO/platformio.ini index 4d3087a3012..dce1ac84456 100644 --- a/libraries/LittleFS/examples/LITTLEFS_PlatformIO/platformio.ini +++ b/libraries/LittleFS/examples/LITTLEFS_PlatformIO/platformio.ini @@ -17,8 +17,6 @@ framework = arduino [env:esp32] platform = espressif32 board = esp32dev -;board_build.partitions = partitions_custom.csv +board_build.partitions = partitions_custom.csv monitor_filters = esp32_exception_decoder monitor_speed = 115200 - -extra_scripts = ./littlefsbuilder.py diff --git a/libraries/LittleFS/src/LittleFS.cpp b/libraries/LittleFS/src/LittleFS.cpp index f23a3cfe611..f20b4f16b4c 100644 --- a/libraries/LittleFS/src/LittleFS.cpp +++ b/libraries/LittleFS/src/LittleFS.cpp @@ -81,7 +81,9 @@ bool LittleFSFS::begin(bool formatOnFail, const char * basePath, uint8_t maxOpen esp_vfs_littlefs_conf_t conf = { .base_path = basePath, .partition_label = partitionLabel_, + .partition = NULL, .format_if_mount_failed = false, + .read_only = false, .dont_mount = false, .grow_on_mount = true }; diff --git a/libraries/SD/src/sd_diskio.cpp b/libraries/SD/src/sd_diskio.cpp index f6a8df5e42b..c6943ce4c8b 100644 --- a/libraries/SD/src/sd_diskio.cpp +++ b/libraries/SD/src/sd_diskio.cpp @@ -233,7 +233,7 @@ char sdWriteBytes(uint8_t pdrv, const char* buffer, char token) ardu_sdcard_t * card = s_cards[pdrv]; unsigned short crc = (card->supports_crc)?CRC16(buffer, 512):0xFFFF; if (!sdWait(pdrv, 500)) { - return false; + return 0; } card->spi->write(token); @@ -424,7 +424,7 @@ unsigned long sdGetSectorsCount(uint8_t pdrv) { for (int f = 0; f < 3; f++) { if(!sdSelectCard(pdrv)) { - return false; + return 0; } if (!sdCommand(pdrv, SEND_CSD, 0, NULL)) { @@ -818,7 +818,7 @@ bool sdcard_mount(uint8_t pdrv, const char* path, uint8_t max_files, bool format } //FRESULT f_mkfs (const TCHAR* path, const MKFS_PARM* opt, void* work, UINT len); const MKFS_PARM opt = {(BYTE)FM_ANY, 0, 0, 0, 0}; - res = f_mkfs(drv, &opt, work, sizeof(work)); + res = f_mkfs(drv, &opt, work, sizeof(BYTE) * FF_MAX_SS); free(work); if (res != FR_OK) { log_e("f_mkfs failed: %s", fferr2str[res]); diff --git a/libraries/SPI/src/SPI.cpp b/libraries/SPI/src/SPI.cpp index 251cc48c4fe..17142b38c60 100644 --- a/libraries/SPI/src/SPI.cpp +++ b/libraries/SPI/src/SPI.cpp @@ -124,15 +124,13 @@ void SPIClass::end() if(!_spi) { return; } - spiDetachSCK(_spi, _sck); - if(_miso >= 0){ - spiDetachMISO(_spi, _miso); - } - if(_mosi >= 0){ - spiDetachMOSI(_spi, _mosi); - } + spiDetachSCK(_spi); + spiDetachMISO(_spi); + spiDetachMOSI(_spi); setHwCs(false); - spiStopBus(_spi); + if(spiGetClockDiv(_spi) != 0) { + spiStopBus(_spi); + } _spi = NULL; } @@ -146,7 +144,7 @@ void SPIClass::setHwCs(bool use) spiSSEnable(_spi); } else if(!use && _use_hw_ss) { spiSSDisable(_spi); - spiDetachSS(_spi, _ss); + spiDetachSS(_spi); } _use_hw_ss = use; } diff --git a/libraries/Ticker/examples/Arguments/Arguments.ino b/libraries/Ticker/examples/Arguments/Arguments.ino deleted file mode 100644 index 7f5bc5cde21..00000000000 --- a/libraries/Ticker/examples/Arguments/Arguments.ino +++ /dev/null @@ -1,51 +0,0 @@ -/* - * This example demonstrates used of Ticker with arguments. - * You can call the same callback function with different argument on different times. - * Based on the argument the callback can perform different tasks. - */ - -#include -#include - -// Arguments for the function must remain valid (not run out of scope) otherwise the function would read garbage data. -int LED_PIN_1 = 4; -#ifdef LED_BUILTIN - int LED_PIN_2 = LED_BUILTIN; -#else - int LED_PIN_2 = 8; -#endif - -Ticker tickerSetHigh; -Ticker tickerSetLow; - -// Argument to callback must always be passed a reference -void swapState(int *pin) { - static int led_1_state = 1; - static int led_2_state = 1; - if(*pin == LED_PIN_1){ - Serial.printf("[%lu ms] set pin %d to state: %d\n", millis(), *pin, led_1_state); - digitalWrite(*pin, led_1_state); - led_1_state = led_1_state ? 0 : 1; // reverse for next pass - }else if(*pin == LED_PIN_2){ - Serial.printf("[%lu ms] set pin %d to state: %d\n", millis(), *pin, led_2_state); - digitalWrite(*pin, led_2_state); - led_2_state = led_2_state ? 0 : 1; // reverse for next pass - } -} - -void setup() { - Serial.begin(115200); - pinMode(LED_PIN_1, OUTPUT); - pinMode(LED_PIN_2, OUTPUT); - //digitalWrite(1, LOW); - - // Blink LED every 500 ms on LED_PIN_1 - tickerSetLow.attach_ms(500, swapState, &LED_PIN_1); - - // Blink LED every 1000 ms on LED_PIN_2 - tickerSetHigh.attach_ms(1000, swapState, &LED_PIN_2); -} - -void loop() { - -} diff --git a/libraries/Ticker/examples/TickerBasic/TickerBasic.ino b/libraries/Ticker/examples/TickerBasic/TickerBasic.ino new file mode 100644 index 00000000000..8de5a1282ad --- /dev/null +++ b/libraries/Ticker/examples/TickerBasic/TickerBasic.ino @@ -0,0 +1,49 @@ +/* + Basic Ticker usage + + Ticker is an object that will call a given function with a certain period. + Each Ticker calls one function. You can have as many Tickers as you like, + memory being the only limitation. + + A function may be attached to a ticker and detached from the ticker. + There are two variants of the attach function: attach and attach_ms. + The first one takes period in seconds, the second one in milliseconds. + + The built-in LED will be blinking. +*/ + +#include + +#ifndef LED_BUILTIN +#define LED_BUILTIN 13 +#endif + +Ticker flipper; + +int count = 0; + +void flip() { + int state = digitalRead(LED_BUILTIN); // get the current state of GPIO1 pin + digitalWrite(LED_BUILTIN, !state); // set pin to the opposite state + + ++count; + // when the counter reaches a certain value, start blinking like crazy + if (count == 20) { + flipper.attach(0.1, flip); + } + // when the counter reaches yet another value, stop blinking + else if (count == 120) { + flipper.detach(); + } +} + +void setup() { + pinMode(LED_BUILTIN, OUTPUT); + digitalWrite(LED_BUILTIN, LOW); + + // flip the pin every 0.3s + flipper.attach(0.3, flip); +} + +void loop() { +} diff --git a/libraries/Ticker/examples/TickerParameter/TickerParameter.ino b/libraries/Ticker/examples/TickerParameter/TickerParameter.ino new file mode 100644 index 00000000000..ceb79e32f54 --- /dev/null +++ b/libraries/Ticker/examples/TickerParameter/TickerParameter.ino @@ -0,0 +1,54 @@ +/* + Passing paramters to Ticker callbacks + + Apart from void(void) functions, the Ticker library supports + functions taking one argument. This argument's size has to be less or + equal to 4 bytes (so char, short, int, float, void*, char* types will do). + + This sample runs two tickers that both call one callback function, + but with different arguments. + + The built-in LED will be pulsing. +*/ + +#include + +#ifndef LED_BUILTIN +#define LED_BUILTIN 13 +#endif + +Ticker tickerSetLow; +Ticker tickerSetHigh; +Ticker tickerSetChar; + +void setPinLow() { + digitalWrite(LED_BUILTIN, 0); +} + +void setPinHigh() { + digitalWrite(LED_BUILTIN, 1); +} + +void setPin(int state) { + digitalWrite(LED_BUILTIN, state); +} + +void setPinChar(char state) { + digitalWrite(LED_BUILTIN, state); +} + +void setup() { + pinMode(LED_BUILTIN, OUTPUT); + + // every 25 ms, call setPinLow() + tickerSetLow.attach_ms(25, setPinLow); + + // every 26 ms, call setPinHigh() + tickerSetHigh.attach_ms(26, setPinHigh); + + // every 54 ms, call setPinChar(1) + tickerSetChar.attach_ms(26, setPinChar, (char)1); +} + +void loop() { +} diff --git a/libraries/Ticker/keywords.txt b/libraries/Ticker/keywords.txt index 81cce2c8ea5..f5f1266516d 100644 --- a/libraries/Ticker/keywords.txt +++ b/libraries/Ticker/keywords.txt @@ -10,5 +10,9 @@ Ticker KEYWORD1 attach KEYWORD2 attach_ms KEYWORD2 +attach_us KEYWORD2 once KEYWORD2 +once_ms KEYWORD2 +once_us KEYWORD2 detach KEYWORD2 +active KEYWORD2 diff --git a/libraries/Ticker/src/Ticker.cpp b/libraries/Ticker/src/Ticker.cpp index 629361b2dd0..6c996ed56b3 100644 --- a/libraries/Ticker/src/Ticker.cpp +++ b/libraries/Ticker/src/Ticker.cpp @@ -31,7 +31,7 @@ Ticker::~Ticker() { detach(); } -void Ticker::_attach_ms(uint32_t milliseconds, bool repeat, callback_with_arg_t callback, uint32_t arg) { +void Ticker::_attach_us(uint64_t micros, bool repeat, callback_with_arg_t callback, void* arg) { esp_timer_create_args_t _timerConfig; _timerConfig.arg = reinterpret_cast(arg); _timerConfig.callback = callback; @@ -43,9 +43,9 @@ void Ticker::_attach_ms(uint32_t milliseconds, bool repeat, callback_with_arg_t } esp_timer_create(&_timerConfig, &_timer); if (repeat) { - esp_timer_start_periodic(_timer, milliseconds * 1000ULL); + esp_timer_start_periodic(_timer, micros); } else { - esp_timer_start_once(_timer, milliseconds * 1000ULL); + esp_timer_start_once(_timer, micros); } } @@ -54,10 +54,19 @@ void Ticker::detach() { esp_timer_stop(_timer); esp_timer_delete(_timer); _timer = nullptr; + _callback_function = nullptr; } } -bool Ticker::active() { +bool Ticker::active() const { if (!_timer) return false; return esp_timer_is_active(_timer); } + +void Ticker::_static_callback(void* arg) +{ + Ticker* _this = reinterpret_cast(arg); + if (_this && _this->_callback_function) + _this->_callback_function(); +} + diff --git a/libraries/Ticker/src/Ticker.h b/libraries/Ticker/src/Ticker.h index 82804e0f37d..50ab424c275 100644 --- a/libraries/Ticker/src/Ticker.h +++ b/libraries/Ticker/src/Ticker.h @@ -28,79 +28,110 @@ extern "C" { #include "esp_timer.h" } +#include class Ticker { public: Ticker(); ~Ticker(); - typedef void (*callback_t)(void); + typedef void (*callback_with_arg_t)(void*); + typedef std::function callback_function_t; + + void attach(float seconds, callback_function_t callback) + { + _callback_function = std::move(callback); + _attach_us(1000000ULL * seconds, true, _static_callback, this); + } - void attach(float seconds, callback_t callback) + void attach_ms(uint64_t milliseconds, callback_function_t callback) { - _attach_ms(seconds * 1000, true, reinterpret_cast(callback), 0); + _callback_function = std::move(callback); + _attach_us(1000ULL * milliseconds, true, _static_callback, this); } - void attach_ms(uint32_t milliseconds, callback_t callback) + void attach_us(uint64_t micros, callback_function_t callback) { - _attach_ms(milliseconds, true, reinterpret_cast(callback), 0); + _callback_function = std::move(callback); + _attach_us(micros, true, _static_callback, this); } template void attach(float seconds, void (*callback)(TArg), TArg arg) { - static_assert(sizeof(TArg) <= sizeof(uint32_t), "attach() callback argument size must be <= 4 bytes"); + static_assert(sizeof(TArg) <= sizeof(void*), "attach() callback argument size must be <= sizeof(void*)"); // C-cast serves two purposes: // static_cast for smaller integer types, // reinterpret_cast + const_cast for pointer types - uint32_t arg32 = (uint32_t)arg; - _attach_ms(seconds * 1000, true, reinterpret_cast(callback), arg32); + _attach_us(1000000ULL * seconds, true, reinterpret_cast(callback), reinterpret_cast(arg)); + } + + template + void attach_ms(uint64_t milliseconds, void (*callback)(TArg), TArg arg) + { + static_assert(sizeof(TArg) <= sizeof(void*), "attach() callback argument size must be <= sizeof(void*)"); + _attach_us(1000ULL * milliseconds, true, reinterpret_cast(callback), reinterpret_cast(arg)); } template - void attach_ms(uint32_t milliseconds, void (*callback)(TArg), TArg arg) + void attach_us(uint64_t micros, void (*callback)(TArg), TArg arg) { - static_assert(sizeof(TArg) <= sizeof(uint32_t), "attach_ms() callback argument size must be <= 4 bytes"); - uint32_t arg32 = (uint32_t)arg; - _attach_ms(milliseconds, true, reinterpret_cast(callback), arg32); + static_assert(sizeof(TArg) <= sizeof(void*), "attach() callback argument size must be <= sizeof(void*)"); + _attach_us(micros, true, reinterpret_cast(callback), reinterpret_cast(arg)); } - void once(float seconds, callback_t callback) + void once(float seconds, callback_function_t callback) { - _attach_ms(seconds * 1000, false, reinterpret_cast(callback), 0); + _callback_function = std::move(callback); + _attach_us(1000000ULL * seconds, false, _static_callback, this); } - void once_ms(uint32_t milliseconds, callback_t callback) + void once_ms(uint64_t milliseconds, callback_function_t callback) { - _attach_ms(milliseconds, false, reinterpret_cast(callback), 0); + _callback_function = std::move(callback); + _attach_us(1000ULL * milliseconds, false, _static_callback, this); + } + + void once_us(uint64_t micros, callback_function_t callback) + { + _callback_function = std::move(callback); + _attach_us(micros, false, _static_callback, this); } template void once(float seconds, void (*callback)(TArg), TArg arg) { - static_assert(sizeof(TArg) <= sizeof(uint32_t), "attach() callback argument size must be <= 4 bytes"); - uint32_t arg32 = (uint32_t)(arg); - _attach_ms(seconds * 1000, false, reinterpret_cast(callback), arg32); + static_assert(sizeof(TArg) <= sizeof(void*), "attach() callback argument size must be <= sizeof(void*)"); + _attach_us(1000000ULL * seconds, false, reinterpret_cast(callback), reinterpret_cast(arg)); + } + + template + void once_ms(uint64_t milliseconds, void (*callback)(TArg), TArg arg) + { + static_assert(sizeof(TArg) <= sizeof(void*), "attach() callback argument size must be <= sizeof(void*)"); + _attach_us(1000ULL * milliseconds, false, reinterpret_cast(callback), reinterpret_cast(arg)); } template - void once_ms(uint32_t milliseconds, void (*callback)(TArg), TArg arg) + void once_us(uint64_t micros, void (*callback)(TArg), TArg arg) { - static_assert(sizeof(TArg) <= sizeof(uint32_t), "attach_ms() callback argument size must be <= 4 bytes"); - uint32_t arg32 = (uint32_t)(arg); - _attach_ms(milliseconds, false, reinterpret_cast(callback), arg32); + static_assert(sizeof(TArg) <= sizeof(void*), "attach() callback argument size must be <= sizeof(void*)"); + _attach_us(micros, false, reinterpret_cast(callback), reinterpret_cast(arg)); } void detach(); - bool active(); + bool active() const; protected: - void _attach_ms(uint32_t milliseconds, bool repeat, callback_with_arg_t callback, uint32_t arg); + static void _static_callback(void* arg); + callback_function_t _callback_function = nullptr; -protected: esp_timer_handle_t _timer; + +private: + void _attach_us(uint64_t micros, bool repeat, callback_with_arg_t callback, void* arg); }; diff --git a/libraries/USB/src/USBHIDKeyboard.h b/libraries/USB/src/USBHIDKeyboard.h index 1a2056e9083..0c75c7dcfc9 100644 --- a/libraries/USB/src/USBHIDKeyboard.h +++ b/libraries/USB/src/USBHIDKeyboard.h @@ -63,6 +63,7 @@ typedef union { #define KEY_DOWN_ARROW 0xD9 #define KEY_LEFT_ARROW 0xD8 #define KEY_RIGHT_ARROW 0xD7 +#define KEY_MENU 0xFE #define KEY_SPACE 0x20 #define KEY_BACKSPACE 0xB2 #define KEY_TAB 0xB3 @@ -74,6 +75,7 @@ typedef union { #define KEY_PAGE_DOWN 0xD6 #define KEY_HOME 0xD2 #define KEY_END 0xD5 +#define KEY_NUM_LOCK 0xDB #define KEY_CAPS_LOCK 0xC1 #define KEY_F1 0xC2 #define KEY_F2 0xC3 @@ -99,6 +101,9 @@ typedef union { #define KEY_F22 0xF9 #define KEY_F23 0xFA #define KEY_F24 0xFB +#define KEY_PRINT_SCREEN 0xCE +#define KEY_SCROLL_LOCK 0xCF +#define KEY_PAUSE 0xD0 #define LED_NUMLOCK 0x01 #define LED_CAPSLOCK 0x02 diff --git a/libraries/Update/examples/HTTP_Client_AES_OTA_Update/.skip.esp32h2 b/libraries/Update/examples/HTTP_Client_AES_OTA_Update/.skip.esp32h2 new file mode 100644 index 00000000000..e69de29bb2d diff --git a/libraries/Update/examples/HTTP_Client_AES_OTA_Update/HTTP_Client_AES_OTA_Update.ino b/libraries/Update/examples/HTTP_Client_AES_OTA_Update/HTTP_Client_AES_OTA_Update.ino new file mode 100644 index 00000000000..e9b1aa75a5e --- /dev/null +++ b/libraries/Update/examples/HTTP_Client_AES_OTA_Update/HTTP_Client_AES_OTA_Update.ino @@ -0,0 +1,333 @@ +/* +An example of how to use HTTPClient to download an encrypted and plain image files OTA from a web server. +This example uses Wifi & HTTPClient to connect to webserver and two functions for obtaining firmware image from webserver. +One uses the example 'updater.php' code on server to check and/or send relavent download firmware image file, +the other directly downloads the firmware file from web server. + +To use:- +Make a folder/directory on your webserver where your firmware images will be uploaded to. ie. /firmware +The 'updater.php' file can also be uploaded to the same folder. Edit and change definitions in 'update.php' to suit your needs. +In sketch: + set HTTPUPDATE_HOST to domain name or IP address if on LAN of your web server + set HTTPUPDATE_UPDATER_URI to path and file to call 'updater.php' +or set HTTPUPDATE_DIRECT_URI to path and firmware file to download + edit other HTTPUPDATE_ as needed + +Encrypted image will help protect your app image file from being copied and used on blank devices, encrypt your image file by using espressif IDF. +First install an app on device that has Update setup with the OTA decrypt mode on, same key, address and flash_crypt_conf as used in IDF to encrypt image file or vice versa. + +For easier development use the default U_AES_DECRYPT_AUTO decrypt mode. This mode allows both plain and encrypted app images to be uploaded. + +Note:- App image can also encrypted on device, by using espressif IDF to configure & enabled FLASH encryption, suggest the use of a different 'OTA_KEY' key for update from the eFuses 'flash_encryption' key used by device. + + ie. "Update.setupCrypt(OTA_KEY, OTA_ADDRESS, OTA_CFG);" + +defaults:- {if not set ie. "Update.setupCrypt();" } + OTA_KEY = 0 ( 0 = no key, disables decryption ) + OTA_ADDRESS = 0 ( suggest dont set address to app0=0x10000 usually or app1=varies ) + OTA_CFG = 0xf + OTA_MODE = U_AES_DECRYPT_AUTO + +OTA_MODE options:- + U_AES_DECRYPT_NONE decryption disabled, loads OTA image files as sent(plain) + U_AES_DECRYPT_AUTO auto loads both plain & encrypted OTA FLASH image files, and plain OTA SPIFFS image files + U_AES_DECRYPT_ON decrypts OTA image files + +https://docs.espressif.com/projects/esp-idf/en/latest/esp32/get-started/ + +Example: + espsecure.py encrypt_flash_data -k ota_key.bin --flash_crypt_conf 0xf -a 0x4320 -o output_filename.bin source_filename.bin + +espsecure.py encrypt_flash_data = runs the idf encryption function to make a encrypted output file from a source file + -k text = path/filename to the AES 256bit(32byte) encryption key file + --flash_crypt_conf 0xn = 0x0 to 0xf, the more bits set the higher the security of encryption(address salting, 0x0 would use ota_key with no address salting) + -a 0xnnnnnn00 = 0x00 to 0x00fffff0 address offset(must be a multiple of 16, but better to use multiple of 32), used to offset the salting (has no effect when = --flash_crypt_conf 0x0) + -o text = path/filename to save encrypted output file to + text = path/filename to open source file from +*/ + +#include +#include +#include +#include +#include + +//========================================================================== +//========================================================================== +const char* WIFI_SSID = "wifi-ssid"; +const char* WIFI_PASSWORD = "wifi-password"; + +const uint8_t OTA_KEY[32] = { 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, \ + 0x38, 0x39, 0x20, 0x74, 0x68, 0x69, 0x73, 0x20, \ + 0x61, 0x20, 0x73, 0x69, 0x6d, 0x70, 0x6c, 0x65, \ + 0x74, 0x65, 0x73, 0x74, 0x20, 0x6b, 0x65, 0x79 }; + +/* +const uint8_t OTA_KEY[32] = {'0', '1', '2', '3', '4', '5', '6', '7', + '8', '9', ' ', 't', 'h', 'i', 's', ' ', + 'a', ' ', 's', 'i', 'm', 'p', 'l', 'e', + 't', 'e', 's', 't', ' ', 'k', 'e', 'y' }; +*/ + +//const uint8_t OTA_KEY[33] = "0123456789 this a simpletest key"; + +const uint32_t OTA_ADDRESS = 0x4320; +const uint32_t OTA_CFG = 0x0f; +const uint32_t OTA_MODE = U_AES_DECRYPT_AUTO; + +const char* HTTPUPDATE_USERAGRENT = "ESP32-Updater"; +//const char* HTTPUPDATE_HOST = "www.yourdomain.com"; +const char* HTTPUPDATE_HOST = "192.168.1.2"; +const uint16_t HTTPUPDATE_PORT = 80; +const char* HTTPUPDATE_UPDATER_URI = "/firmware/updater.php"; //uri to 'updater.php' +const char* HTTPUPDATE_DIRECT_URI = "/firmware/HTTP_Client_AES_OTA_Update-v1.1.xbin"; //uri to image file + +const char* HTTPUPDATE_USER = NULL; //use NULL if no authentication needed +//const char* HTTPUPDATE_USER = "user"; +const char* HTTPUPDATE_PASSWORD = "password"; + +const char* HTTPUPDATE_BRAND = "21"; /* Brand ID */ +const char* HTTPUPDATE_MODEL = "HTTP_Client_AES_OTA_Update"; /* Project name */ +const char* HTTPUPDATE_FIRMWARE = "0.9"; /* Firmware version */ + +//========================================================================== +//========================================================================== +String urlEncode(const String& url, const char* safeChars="-_.~") { + String encoded = ""; + char temp[4]; + + for (int i = 0; i < url.length(); i++){ + temp[0] = url.charAt(i); + if(temp[0] == 32){//space + encoded.concat('+'); + }else if( (temp[0] >= 48 && temp[0] <= 57) /*0-9*/ + || (temp[0] >= 65 && temp[0] <= 90) /*A-Z*/ + || (temp[0] >= 97 && temp[0] <= 122) /*a-z*/ + || (strchr(safeChars, temp[0]) != NULL) /* "=&-_.~" */ + ){ + encoded.concat(temp[0]); + }else{ //character needs encoding + snprintf(temp, 4, "%%%02X", temp[0]); + encoded.concat(temp); + } + } + return encoded; +} + +//========================================================================== +bool addQuery(String* query, const String name, const String value) { + if( name.length() && value.length() ){ + if( query->length() < 3 ){ + *query = "?"; + }else{ + query->concat('&'); + } + query->concat( urlEncode(name) ); + query->concat('='); + query->concat( urlEncode(value) ); + return true; + } + return false; +} + +//========================================================================== +//========================================================================== +void printProgress(size_t progress, const size_t& size) { + static int last_progress=-1; + if(size>0){ + progress = (progress*100)/size; + progress = (progress>100 ? 100 : progress); //0-100 + if( progress != last_progress ){ + Serial.printf("Progress: %d%%\n", progress); + last_progress = progress; + } + } +} + +//========================================================================== +bool http_downloadUpdate(HTTPClient& http, uint32_t size=0) { + size = (size == 0 ? http.getSize() : size); + if(size == 0){ + return false; + } + WiFiClient *client = http.getStreamPtr(); + + if( !Update.begin(size, U_FLASH) ) { + Serial.printf("Update.begin failed! (%s)\n", Update.errorString() ); + return false; + } + + if( !Update.setupCrypt(OTA_KEY, OTA_ADDRESS, OTA_CFG, OTA_MODE)){ + Serial.println("Update.setupCrypt failed!"); + } + + if( Update.writeStream(*client) != size ) { + Serial.printf("Update.writeStream failed! (%s)\n", Update.errorString() ); + return false; + } + + if( !Update.end() ) { + Serial.printf("Update.end failed! (%s)\n", Update.errorString() ); + return false; + } + return true; +} + +//========================================================================== +int http_sendRequest(HTTPClient& http) { + +//set request Headers to be sent to server + http.useHTTP10(true); // use HTTP/1.0 for update since the update handler not support any transfer Encoding + http.setTimeout(8000); + http.addHeader("Cache-Control", "no-cache"); + +//set own name for HTTPclient user-agent + http.setUserAgent(HTTPUPDATE_USERAGRENT); + + int code = http.GET(); //send the GET request to HTTP server + int len = http.getSize(); + + if(code == HTTP_CODE_OK){ + return (len>0 ? len : 0); //return 0 or length of image to download + }else if(code < 0){ + Serial.printf("Error: %s\n", http.errorToString(code).c_str()); + return code; //error code should be minus between -1 to -11 + }else{ + Serial.printf("Error: HTTP Server response code %i\n", code); + return -code; //return code should be minus between -100 to -511 + } +} + +//========================================================================== +/* http_updater sends a GET request to 'update.php' on web server */ +bool http_updater(const String& host, const uint16_t& port, String uri, const bool& download, const char* user=NULL, const char* password=NULL) { +//add GET query params to be sent to server (are used by server 'updater.php' code to determine what action to take) + String query = ""; + addQuery(&query, "cmd",(download ? "download" :"check") ); //action command + +//setup HTTPclient to be ready to connect & send a request to HTTP server + HTTPClient http; + WiFiClient client; + uri.concat(query); //GET query added to end of uri path + if( !http.begin(client, host, port, uri) ){ + return false; //httpclient setup error + } + Serial.printf( "Sending HTTP request 'http://%s:%i%s'\n", host.c_str(), port, uri.c_str() ); + +//set basic authorization, if needed for webpage access + if(user != NULL && password != NULL){ + http.setAuthorization(user, password); //set basic Authorization to server, if needed be gain access + } + +//add unique Headers to be sent to server used by server 'update.php' code to determine there a suitable firmware update image avaliable + http.addHeader("Brand-Code", HTTPUPDATE_BRAND); + http.addHeader("Model", HTTPUPDATE_MODEL); + http.addHeader("Firmware", HTTPUPDATE_FIRMWARE); + +//set headers to look for to get returned values in servers http response to our http request + const char * headerkeys[] = { "update", "version" }; //server returns update 0=no update found, 1=update found, version=version of update found + size_t headerkeyssize = sizeof(headerkeys) / sizeof(char*); + http.collectHeaders(headerkeys, headerkeyssize); + +//connect & send HTTP request to server + int size = http_sendRequest(http); + +//is there an image to download + if( size > 0 || (!download && size == 0) ){ + if( !http.header("update") || http.header("update").toInt() == 0 ){ + Serial.println("No Firmware avaliable"); + }else if( !http.header("version") || http.header("version").toFloat() <= String(HTTPUPDATE_FIRMWARE).toFloat() ){ + Serial.println("Firmware is upto Date"); + }else{ +//image avaliabe to download & update + if(!download){ + Serial.printf( "Found V%s Firmware\n", http.header("version").c_str() ); + }else{ + Serial.printf( "Downloading & Installing V%s Firmware\n", http.header("version").c_str() ); + } + if( !download || http_downloadUpdate(http) ){ + http.end(); //end connection + return true; + } + } + } + + http.end(); //end connection + return false; +} + +//========================================================================== +/* this downloads Firmware image file directly from web server */ +bool http_direct(const String& host, const uint16_t& port, const String& uri, const char* user=NULL, const char* password=NULL) { +//setup HTTPclient to be ready to connect & send a request to HTTP server + HTTPClient http; + WiFiClient client; + if( !http.begin(client, host, port, uri) ){ + return false; //httpclient setup error + } + Serial.printf( "Sending HTTP request 'http://%s:%i%s'\n", host.c_str(), port, uri.c_str() ); + +//set basic authorization, if needed for webpage access + if(user != NULL && password != NULL){ + http.setAuthorization(user, password); //set basic Authorization to server, if needed be gain access + } + +//connect & send HTTP request to server + int size = http_sendRequest(http); + +//is there an image to download + if(size > 0){ + if( http_downloadUpdate(http) ){ + http.end(); + return true; //end connection + } + }else{ + Serial.println("Image File not found"); + } + + http.end(); //end connection + return false; +} + +//========================================================================== +//========================================================================== + +void setup() { + Serial.begin(115200); + Serial.println(); + Serial.printf("Booting %s V%s\n", HTTPUPDATE_MODEL, HTTPUPDATE_FIRMWARE); + + WiFi.mode(WIFI_AP_STA); + WiFi.begin(WIFI_SSID, WIFI_PASSWORD); + if(WiFi.waitForConnectResult() != WL_CONNECTED){ + Serial.println("WiFi failed, retrying."); + } + int i = 0; + while (WiFi.waitForConnectResult() != WL_CONNECTED){ + Serial.print("."); + if( (++i % 100) == 0){ + Serial.println(); + } + delay(100); + } + Serial.printf( "Connected to Wifi\nLocal IP: %s\n", WiFi.localIP().toString().c_str() ); + + Update.onProgress(printProgress); + + Serial.println("Checking with Server, if New Firmware avaliable"); + if( http_updater(HTTPUPDATE_HOST, HTTPUPDATE_PORT, HTTPUPDATE_UPDATER_URI, 0, HTTPUPDATE_USER, HTTPUPDATE_PASSWORD) ){ //check for new firmware + if( http_updater(HTTPUPDATE_HOST, HTTPUPDATE_PORT, HTTPUPDATE_UPDATER_URI, 1, HTTPUPDATE_USER, HTTPUPDATE_PASSWORD) ){ //update to new firmware + Serial.println("Firmware Update Sucessfull, rebooting"); + ESP.restart(); + } + } + + Serial.println("Checking Server for Firmware Image File to Download & Install"); + if( http_direct(HTTPUPDATE_HOST, HTTPUPDATE_PORT, HTTPUPDATE_DIRECT_URI, HTTPUPDATE_USER, HTTPUPDATE_PASSWORD) ){ + Serial.println("Firmware Update Sucessfull, rebooting"); + ESP.restart(); + } +} + +void loop() { +} diff --git a/libraries/Update/examples/HTTP_Client_AES_OTA_Update/updater.php b/libraries/Update/examples/HTTP_Client_AES_OTA_Update/updater.php new file mode 100644 index 00000000000..4edfb75a126 --- /dev/null +++ b/libraries/Update/examples/HTTP_Client_AES_OTA_Update/updater.php @@ -0,0 +1,64 @@ + $value) { + $headers += [$name => $value]; + } + verify( in_array($headers['Brand-Code'], $brand_codes) ); + + $GetArgs = filter_input_array(INPUT_GET); + verify( in_array($GetArgs['cmd'], $commands) ); + + if($GetArgs['cmd'] == "check" || $GetArgs['cmd'] == "download"){ +/*********************************************************************************/ +/* $firmware version & filename definitions for different Brands, Models & Firmware versions */ + if($headers['Brand-Code'] == "21"){ + if($headers['Model'] == "HTTP_Client_AES_OTA_Update"){ + + if($headers['Firmware'] < "0.9"){//ie. update to latest of this major version + $firmware = array('version'=>"0.9", 'filename'=>"HTTP_Client_AES_OTA_Update-v0.9.xbin"); + } + elseif($headers['Firmware'] == "0.9"){//ie. update between major versions + $firmware = array('version'=>"1.0", 'filename'=>"HTTP_Client_AES_OTA_Update-v1.0.xbin"); + } + elseif($headers['Firmware'] <= "1.4"){//ie. update to latest version + $firmware = array('version'=>"1.4", 'filename'=>"HTTP_Client_AES_OTA_Update-v1.4.xbin"); + } + + } + } +/* end of $firmware definitions for firmware update images on server */ +/*********************************************************************************/ + + if( !$firmware['filename'] || !file_exists($firmware['filename']) ){ + header('update: 0' );//no update avaliable + exit; + }else{ + header('update: 1' );//update avaliable + header('version: ' . $firmware['version'] ); + if($GetArgs['cmd'] == "download"){ +//Get file type and set it as Content Type + $finfo = finfo_open(FILEINFO_MIME_TYPE); + header('Content-Type: ' . finfo_file($finfo, $firmware['filename']));//application/octet-stream for binary file + finfo_close($finfo); +//Define file size + header('Content-Length: ' . filesize($firmware['filename'])); + readfile($firmware['filename']); //send file + } + exit; + } + } + + verify(false); +?> diff --git a/libraries/Update/examples/HTTP_Server_AES_OTA_Update/.skip.esp32h2 b/libraries/Update/examples/HTTP_Server_AES_OTA_Update/.skip.esp32h2 new file mode 100644 index 00000000000..e69de29bb2d diff --git a/libraries/Update/examples/HTTP_Server_AES_OTA_Update/HTTP_Server_AES_OTA_Update.ino b/libraries/Update/examples/HTTP_Server_AES_OTA_Update/HTTP_Server_AES_OTA_Update.ino new file mode 100644 index 00000000000..b4c611d2739 --- /dev/null +++ b/libraries/Update/examples/HTTP_Server_AES_OTA_Update/HTTP_Server_AES_OTA_Update.ino @@ -0,0 +1,235 @@ +/* +An example of how to use Update to upload encrypted and plain image files OTA. This example uses a simple webserver & Wifi connection via AP or STA with mDNS and DNS for simple host URI. + +Encrypted image will help protect your app image file from being copied and used on blank devices, encrypt your image file by using espressif IDF. +First install an app on device that has Update setup with the OTA decrypt mode on, same key, address and flash_crypt_conf as used in IDF to encrypt image file or vice versa. + +For easier development use the default U_AES_DECRYPT_AUTO decrypt mode. This mode allows both plain and encrypted app images to be uploaded. + +Note:- App image can also encrypted on device, by using espressif IDF to configure & enabled FLASH encryption, suggest the use of a different 'OTA_KEY' key for update from the eFuses 'flash_encryption' key used by device. + + ie. "Update.setupCrypt(OTA_KEY, OTA_ADDRESS, OTA_CFG);" + +defaults:- {if not set ie. "Update.setupCrypt();" } + OTA_KEY = 0 ( 0 = no key, disables decryption ) + OTA_ADDRESS = 0 ( suggest dont set address to app0=0x10000 usually or app1=varies ) + OTA_CFG = 0xf + OTA_MODE = U_AES_DECRYPT_AUTO + +OTA_MODE options:- + U_AES_DECRYPT_NONE decryption disabled, loads OTA image files as sent(plain) + U_AES_DECRYPT_AUTO auto loads both plain & encrypted OTA FLASH image files, and plain OTA SPIFFS image files + U_AES_DECRYPT_ON decrypts OTA image files + +https://docs.espressif.com/projects/esp-idf/en/latest/esp32/get-started/ + +Example: + espsecure.py encrypt_flash_data -k ota_key.bin --flash_crypt_conf 0xf -a 0x4320 -o output_filename.bin source_filename.bin + +espsecure.py encrypt_flash_data = runs the idf encryption function to make a encrypted output file from a source file + -k text = path/filename to the AES 256bit(32byte) encryption key file + --flash_crypt_conf 0xn = 0x0 to 0xf, the more bits set the higher the security of encryption(address salting, 0x0 would use ota_key with no address salting) + -a 0xnnnnnn00 = 0x00 to 0x00fffff0 address offset(must be a multiple of 16, but better to use multiple of 32), used to offset the salting (has no effect when = --flash_crypt_conf 0x0) + -o text = path/filename to save encrypted output file to + text = path/filename to open source file from +*/ + +#include +#include +#include +#include +#include +#include + +WebServer httpServer(80); + +//with WIFI_MODE_AP defined the ESP32 is a wifi AP, with it undefined ESP32 tries to connect to wifi STA +#define WIFI_MODE_AP + +#ifdef WIFI_MODE_AP + #include + DNSServer dnsServer; +#endif + +const char* host = "esp32-web"; +const char* ssid = "wifi-ssid"; +const char* password = "wifi-password"; + +const uint8_t OTA_KEY[32] = { 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, \ + 0x38, 0x39, 0x20, 0x74, 0x68, 0x69, 0x73, 0x20, \ + 0x61, 0x20, 0x73, 0x69, 0x6d, 0x70, 0x6c, 0x65, \ + 0x74, 0x65, 0x73, 0x74, 0x20, 0x6b, 0x65, 0x79 }; + +/* +const uint8_t OTA_KEY[32] = {'0', '1', '2', '3', '4', '5', '6', '7', + '8', '9', ' ', 't', 'h', 'i', 's', ' ', + 'a', ' ', 's', 'i', 'm', 'p', 'l', 'e', + 't', 'e', 's', 't', ' ', 'k', 'e', 'y' }; +*/ + +//const uint8_t OTA_KEY[33] = "0123456789 this a simpletest key"; + +const uint32_t OTA_ADDRESS = 0x4320; //OTA_ADDRESS value has no effect when OTA_CFG = 0x00 +const uint32_t OTA_CFG = 0x0f; +const uint32_t OTA_MODE = U_AES_DECRYPT_AUTO; + +/*=================================================================*/ +const char* update_path = "update"; + +static const char UpdatePage_HTML[] PROGMEM = +R"( + + + Image Upload + + + + +
+ Firmware:

+

+ +
+


+
+ FileSystem:

+

+ +
+ + )"; + +/*=================================================================*/ + +void printProgress(size_t progress, size_t size) { + static int last_progress=-1; + if(size>0){ + progress = (progress*100)/size; + progress = (progress>100 ? 100 : progress); //0-100 + if( progress != last_progress ){ + Serial.printf("\nProgress: %d%%", progress); + last_progress = progress; + } + } +} + +void setupHttpUpdateServer() { + //redirecting not found web pages back to update page + httpServer.onNotFound( [&]() { //webpage not found + httpServer.sendHeader("Location", String("../")+String(update_path) ); + httpServer.send(302, F("text/html"), "" ); + }); + + // handler for the update web page + httpServer.on(String("/")+String(update_path), HTTP_GET, [&]() { + httpServer.send_P(200, PSTR("text/html"), UpdatePage_HTML); + }); + + // handler for the update page form POST + httpServer.on( String("/")+String(update_path), HTTP_POST, [&]() { + // handler when file upload finishes + if (Update.hasError()) { + httpServer.send(200, F("text/html"), String(F("Update error: ")) + String(Update.errorString()) ); + } else { + httpServer.client().setNoDelay(true); + httpServer.send(200, PSTR("text/html"), String(F("Update Success! Rebooting...")) ); + delay(100); + httpServer.client().stop(); + ESP.restart(); + } + }, [&]() { + // handler for the file upload, get's the sketch bytes, and writes + // them through the Update object + HTTPUpload& upload = httpServer.upload(); + if (upload.status == UPLOAD_FILE_START) { + Serial.printf("Update: %s\n", upload.filename.c_str()); + if (upload.name == "filesystem") { + if (!Update.begin(SPIFFS.totalBytes(), U_SPIFFS)) {//start with max available size + Update.printError(Serial); + } + } else { + uint32_t maxSketchSpace = (ESP.getFreeSketchSpace() - 0x1000) & 0xFFFFF000; + if (!Update.begin(maxSketchSpace, U_FLASH)) {//start with max available size + Update.printError(Serial); + } + } + } else if ( upload.status == UPLOAD_FILE_ABORTED || Update.hasError() ) { + if(upload.status == UPLOAD_FILE_ABORTED){ + if(!Update.end(false)){ + Update.printError(Serial); + } + Serial.println("Update was aborted"); + } + } else if (upload.status == UPLOAD_FILE_WRITE) { + Serial.printf("."); + if (Update.write(upload.buf, upload.currentSize) != upload.currentSize) { + Update.printError(Serial); + } + } else if (upload.status == UPLOAD_FILE_END) { + if (Update.end(true)) { //true to set the size to the current progress + Serial.printf("Update Success: %u\nRebooting...\n", upload.totalSize); + } else { + Update.printError(Serial); + } + } + delay(0); + }); + + Update.onProgress(printProgress); +} + +/*=================================================================*/ + +void setup(void) { + Serial.begin(115200); + Serial.println(); + Serial.println("Booting Sketch..."); + WiFi.mode(WIFI_AP_STA); +#ifdef WIFI_MODE_AP + WiFi.softAP(ssid, password); + dnsServer.setErrorReplyCode(DNSReplyCode::NoError); + dnsServer.start(53, "*", WiFi.softAPIP() ); //if DNS started with "*" for domain name, it will reply with provided IP to all DNS request + Serial.printf("Wifi AP started, IP address: %s\n", WiFi.softAPIP().toString().c_str() ); + Serial.printf("You can connect to ESP32 AP use:-\n ssid: %s\npassword: %s\n\n", ssid, password); +#else + WiFi.begin(ssid, password); + if(WiFi.waitForConnectResult() != WL_CONNECTED){ + Serial.println("WiFi failed, retrying."); + } + int i = 0; + while (WiFi.waitForConnectResult() != WL_CONNECTED){ + Serial.print("."); + if( (++i % 100) == 0){ + Serial.println(); + } + delay(100); + } + Serial.printf("Connected to Wifi\nLocal IP: %s\n", WiFi.localIP().toString().c_str()); +#endif + + if( MDNS.begin(host) ) { + Serial.println("mDNS responder started"); + } + + setupHttpUpdateServer(); + + if( Update.setupCrypt(OTA_KEY, OTA_ADDRESS, OTA_CFG, OTA_MODE)){ + Serial.println("Upload Decryption Ready"); + } + + httpServer.begin(); + + MDNS.addService("http", "tcp", 80); +#ifdef WIFI_MODE_AP + Serial.printf("HTTPUpdateServer ready with Captive DNS!\nOpen http://anyname.xyz/%s in your browser\n", update_path); +#else + Serial.printf("HTTPUpdateServer ready!\nOpen http://%s.local/%s in your browser\n", host, update_path); +#endif +} + +void loop(void) { + httpServer.handleClient(); +#ifdef WIFI_MODE_AP + dnsServer.processNextRequest(); //DNS captive portal for easy access to this device webserver +#endif +} diff --git a/libraries/Update/src/Update.h b/libraries/Update/src/Update.h index d34efe73196..0a9680d4520 100644 --- a/libraries/Update/src/Update.h +++ b/libraries/Update/src/Update.h @@ -19,6 +19,7 @@ #define UPDATE_ERROR_NO_PARTITION (10) #define UPDATE_ERROR_BAD_ARGUMENT (11) #define UPDATE_ERROR_ABORT (12) +#define UPDATE_ERROR_DECRYPT (13) #define UPDATE_SIZE_UNKNOWN 0xFFFFFFFF @@ -26,7 +27,15 @@ #define U_SPIFFS 100 #define U_AUTH 200 -#define ENCRYPTED_BLOCK_SIZE 16 +#define ENCRYPTED_BLOCK_SIZE 16 +#define ENCRYPTED_TWEAK_BLOCK_SIZE 32 +#define ENCRYPTED_KEY_SIZE 32 + +#define U_AES_DECRYPT_NONE 0 +#define U_AES_DECRYPT_AUTO 1 +#define U_AES_DECRYPT_ON 2 +#define U_AES_DECRYPT_MODE_MASK 3 +#define U_AES_IMAGE_DECRYPTING_BIT 4 #define SPI_SECTORS_PER_BLOCK 16 // usually large erase block is 32k/64k #define SPI_FLASH_BLOCK_SIZE (SPI_SECTORS_PER_BLOCK*SPI_FLASH_SEC_SIZE) @@ -48,6 +57,15 @@ class UpdateClass { */ bool begin(size_t size=UPDATE_SIZE_UNKNOWN, int command = U_FLASH, int ledPin = -1, uint8_t ledOn = LOW, const char *label = NULL); + /* + Setup decryption configuration + Crypt Key is 32bytes(256bits) block of data, use the same key as used to encrypt image file + Crypt Address, use the same value as used to encrypt image file + Crypt Config, use the same value as used to encrypt image file + Crypt Mode, used to select if image files should be decrypted or not + */ + bool setupCrypt(const uint8_t *cryptKey=0, size_t cryptAddress=0, uint8_t cryptConfig=0xf, int cryptMode=U_AES_DECRYPT_AUTO); + /* Writes a buffer to the flash and increments the address Returns the amount written @@ -75,6 +93,26 @@ class UpdateClass { */ bool end(bool evenIfRemaining = false); + /* + sets AES256 key(32 bytes) used for decrypting image file + */ + bool setCryptKey(const uint8_t *cryptKey); + + /* + sets crypt mode used on image files + */ + bool setCryptMode(const int cryptMode); + + /* + sets address used for decrypting image file + */ + void setCryptAddress(const size_t cryptAddress){ _cryptAddress = cryptAddress & 0x00fffff0; } + + /* + sets crypt config used for decrypting image file + */ + void setCryptConfig(const uint8_t cryptConfig){ _cryptCfg = cryptConfig & 0x0f; } + /* Aborts the running update */ @@ -165,6 +203,8 @@ class UpdateClass { private: void _reset(); void _abort(uint8_t err); + void _cryptKeyTweak(size_t cryptAddress, uint8_t *tweaked_key); + bool _decryptBuffer(); bool _writeBuffer(); bool _verifyHeader(uint8_t data); bool _verifyEnd(); @@ -173,6 +213,8 @@ class UpdateClass { uint8_t _error; + uint8_t *_cryptKey; + uint8_t *_cryptBuffer; uint8_t *_buffer; uint8_t *_skipBuffer; size_t _bufferLen; @@ -188,6 +230,10 @@ class UpdateClass { int _ledPin; uint8_t _ledOn; + + uint8_t _cryptMode; + size_t _cryptAddress; + uint8_t _cryptCfg; }; #if !defined(NO_GLOBAL_INSTANCES) && !defined(NO_GLOBAL_UPDATE) diff --git a/libraries/Update/src/Updater.cpp b/libraries/Update/src/Updater.cpp index b519b76c380..d1a22aec7fb 100644 --- a/libraries/Update/src/Updater.cpp +++ b/libraries/Update/src/Updater.cpp @@ -3,6 +3,7 @@ #include "spi_flash_mmap.h" #include "esp_ota_ops.h" #include "esp_image_format.h" +#include "mbedtls/aes.h" static const char * _err2str(uint8_t _error){ if(_error == UPDATE_ERROR_OK){ @@ -31,6 +32,8 @@ static const char * _err2str(uint8_t _error){ return ("Bad Argument"); } else if(_error == UPDATE_ERROR_ABORT){ return ("Aborted"); + } else if(_error == UPDATE_ERROR_DECRYPT){ + return ("Decryption error"); } return ("UNKNOWN"); } @@ -59,7 +62,10 @@ bool UpdateClass::_enablePartition(const esp_partition_t* partition){ UpdateClass::UpdateClass() : _error(0) +, _cryptKey(0) +, _cryptBuffer(0) , _buffer(0) +, _skipBuffer(0) , _bufferLen(0) , _size(0) , _progress_callback(NULL) @@ -67,6 +73,9 @@ UpdateClass::UpdateClass() , _paroffset(0) , _command(U_FLASH) , _partition(NULL) +, _cryptMode(U_AES_DECRYPT_AUTO) +, _cryptAddress(0) +, _cryptCfg(0xf) { } @@ -83,6 +92,7 @@ void UpdateClass::_reset() { delete[] _skipBuffer; } + _cryptBuffer = nullptr; _buffer = nullptr; _skipBuffer = nullptr; _bufferLen = 0; @@ -176,6 +186,48 @@ bool UpdateClass::begin(size_t size, int command, int ledPin, uint8_t ledOn, con return true; } +bool UpdateClass::setupCrypt(const uint8_t *cryptKey, size_t cryptAddress, uint8_t cryptConfig, int cryptMode){ + if(setCryptKey(cryptKey)){ + if(setCryptMode(cryptMode)){ + setCryptAddress(cryptAddress); + setCryptConfig(cryptConfig); + return true; + } + } + return false; +} + +bool UpdateClass::setCryptKey(const uint8_t *cryptKey){ + if(!cryptKey){ + if (_cryptKey){ + delete[] _cryptKey; + _cryptKey = 0; + log_d("AES key unset"); + } + return false; //key cleared, no key to decrypt with + } + //initialize + if(!_cryptKey){ + _cryptKey = new (std::nothrow) uint8_t[ENCRYPTED_KEY_SIZE]; + } + if(!_cryptKey){ + log_e("new failed"); + return false; + } + memcpy(_cryptKey, cryptKey, ENCRYPTED_KEY_SIZE); + return true; +} + +bool UpdateClass::setCryptMode(const int cryptMode){ + if(cryptMode >= U_AES_DECRYPT_NONE && cryptMode <= U_AES_DECRYPT_ON){ + _cryptMode = cryptMode; + }else{ + log_e("bad crypt mode arguement %i", cryptMode); + return false; + } + return true; +} + void UpdateClass::_abort(uint8_t err){ _reset(); _error = err; @@ -185,7 +237,129 @@ void UpdateClass::abort(){ _abort(UPDATE_ERROR_ABORT); } +void UpdateClass::_cryptKeyTweak(size_t cryptAddress, uint8_t *tweaked_key){ + memcpy(tweaked_key, _cryptKey, ENCRYPTED_KEY_SIZE ); + if(_cryptCfg == 0) return; //no tweaking needed, use crypt key as-is + + const uint8_t pattern[] = { 23, 23, 23, 14, 23, 23, 23, 12, 23, 23, 23, 10, 23, 23, 23, 8 }; + int pattern_idx = 0; + int key_idx = 0; + int bit_len = 0; + uint32_t tweak = 0; + cryptAddress &= 0x00ffffe0; //bit 23-5 + cryptAddress <<= 8; //bit23 shifted to bit31(MSB) + while(pattern_idx < sizeof(pattern)){ + tweak = cryptAddress<<(23 - pattern[pattern_idx]); //bit shift for small patterns + // alternative to: tweak = rotl32(tweak,8 - bit_len); + tweak = (tweak<<(8 - bit_len)) | (tweak>>(24 + bit_len)); //rotate to line up with end of previous tweak bits + bit_len += pattern[pattern_idx++] - 4; //add number of bits in next pattern(23-4 = 19bits = 23bit to 5bit) + while(bit_len > 7){ + tweaked_key[key_idx++] ^= tweak; //XOR byte + // alternative to: tweak = rotl32(tweak, 8); + tweak = (tweak<<8) | (tweak>>24); //compiler should optimize to use rotate(fast) + bit_len -=8; + } + tweaked_key[key_idx] ^= tweak; //XOR remaining bits, will XOR zeros if no remaining bits + } + if(_cryptCfg == 0xf) return; //return with fully tweaked key + + //some of tweaked key bits need to be restore back to crypt key bits + const uint8_t cfg_bits[] = { 67, 65, 63, 61 }; + key_idx = 0; + pattern_idx = 0; + while(key_idx < ENCRYPTED_KEY_SIZE){ + bit_len += cfg_bits[pattern_idx]; + if( (_cryptCfg & (1< 0){ + if( bit_len > 7 || ((_cryptCfg & (2<>bit_len); + tweaked_key[key_idx] |= (_cryptKey[key_idx] & (~(0xff>>bit_len)) ); + } + key_idx++; + bit_len -= 8; + } + }else{ //keep tweaked key bits + while(bit_len > 0){ + if( bit_len <8 && ((_cryptCfg & (2<>bit_len)); + tweaked_key[key_idx] |= (_cryptKey[key_idx] & (0xff>>bit_len)); + } + key_idx++; + bit_len -= 8; + } + } + pattern_idx++; + } +} + +bool UpdateClass::_decryptBuffer(){ + if(!_cryptKey){ + log_w("AES key not set"); + return false; + } + if(_bufferLen%ENCRYPTED_BLOCK_SIZE !=0 ){ + log_e("buffer size error"); + return false; + } + if(!_cryptBuffer){ + _cryptBuffer = new (std::nothrow) uint8_t[ENCRYPTED_BLOCK_SIZE]; + } + if(!_cryptBuffer){ + log_e("new failed"); + return false; + } + uint8_t tweaked_key[ENCRYPTED_KEY_SIZE]; //tweaked crypt key + int done = 0; + + /* + Mbedtls functions will be replaced with esp_aes functions when hardware acceleration is available + + To Do: + Replace mbedtls for the cases where there's no hardware acceleration + */ + + mbedtls_aes_context ctx; //initialize AES + mbedtls_aes_init( &ctx ); + while((_bufferLen - done) >= ENCRYPTED_BLOCK_SIZE){ + for(int i=0; i < ENCRYPTED_BLOCK_SIZE; i++) _cryptBuffer[(ENCRYPTED_BLOCK_SIZE - 1) - i] = _buffer[i + done]; //reverse order 16 bytes to decrypt + if( ((_cryptAddress + _progress + done) % ENCRYPTED_TWEAK_BLOCK_SIZE) == 0 || done == 0 ){ + _cryptKeyTweak(_cryptAddress + _progress + done, tweaked_key); //update tweaked crypt key + if( mbedtls_aes_setkey_enc( &ctx, tweaked_key, 256 ) ){ + return false; + } + if( mbedtls_aes_setkey_dec( &ctx, tweaked_key, 256 ) ){ + return false; + } + } + if( mbedtls_aes_crypt_ecb( &ctx, MBEDTLS_AES_ENCRYPT, _cryptBuffer, _cryptBuffer ) ){ //use MBEDTLS_AES_ENCRYPT to decrypt flash code + return false; + } + for(int i=0; i < ENCRYPTED_BLOCK_SIZE; i++) _buffer[i + done] = _cryptBuffer[(ENCRYPTED_BLOCK_SIZE - 1) - i]; //reverse order 16 bytes from decrypt + done += ENCRYPTED_BLOCK_SIZE; + } + return true; +} + bool UpdateClass::_writeBuffer(){ + //first bytes of loading image, check to see if loading image needs decrypting + if(!_progress){ + _cryptMode &= U_AES_DECRYPT_MODE_MASK; + if( ( _cryptMode == U_AES_DECRYPT_ON ) + || ((_command == U_FLASH) && (_cryptMode & U_AES_DECRYPT_AUTO) && (_buffer[0] != ESP_IMAGE_HEADER_MAGIC)) + ){ + _cryptMode |= U_AES_IMAGE_DECRYPTING_BIT; //set to decrypt the loading image + log_d("Decrypting OTA Image"); + } + } + //check if data in buffer needs decrypting + if( _cryptMode & U_AES_IMAGE_DECRYPTING_BIT ){ + if( !_decryptBuffer() ){ + _abort(UPDATE_ERROR_DECRYPT); + return false; + } + } //first bytes of new firmware uint8_t skip = 0; if(!_progress && _command == U_FLASH){ @@ -393,6 +567,10 @@ size_t UpdateClass::writeStream(Stream &data) { if((_bufferLen == remaining() || _bufferLen == SPI_FLASH_SEC_SIZE) && !_writeBuffer()) return written; written += toRead; + + #if CONFIG_FREERTOS_UNICORE + delay(1); // Fix solo WDT + #endif } return written; } diff --git a/libraries/WebServer/examples/AdvancedWebServer/AdvancedWebServer.ino b/libraries/WebServer/examples/AdvancedWebServer/AdvancedWebServer.ino index e8e8153647a..9300b6c23b7 100644 --- a/libraries/WebServer/examples/AdvancedWebServer/AdvancedWebServer.ino +++ b/libraries/WebServer/examples/AdvancedWebServer/AdvancedWebServer.ino @@ -44,8 +44,9 @@ void handleRoot() { digitalWrite(led, 1); char temp[400]; int sec = millis() / 1000; - int min = sec / 60; - int hr = min / 60; + int hr = sec / 3600; + int min = (sec / 60) % 60; + sec = sec % 60; snprintf(temp, 400, @@ -64,7 +65,7 @@ void handleRoot() { \ ", - hr, min % 60, sec % 60 + hr, min, sec ); server.send(200, "text/html", temp); digitalWrite(led, 0); diff --git a/libraries/WebServer/examples/HttpAuthCallback/.skip.esp32h2 b/libraries/WebServer/examples/HttpAuthCallback/.skip.esp32h2 new file mode 100644 index 00000000000..e69de29bb2d diff --git a/libraries/WebServer/examples/HttpAuthCallback/HttpAuthCallback.ino b/libraries/WebServer/examples/HttpAuthCallback/HttpAuthCallback.ino new file mode 100644 index 00000000000..8cdded55a1c --- /dev/null +++ b/libraries/WebServer/examples/HttpAuthCallback/HttpAuthCallback.ino @@ -0,0 +1,64 @@ +#include +#include +#include +#include + +const char* ssid = "........"; +const char* password = "........"; + +WebServer server(80); + +typedef struct credentials_t { + String username; + String password; +} credentials_t; + +credentials_t passwdfile[] = { + { "admin", "esp32" }, + { "fred", "41234123" }, + { "charlie", "sdfsd" }, + { "alice", "vambdnkuhj" }, + { "bob", "svcdbjhws12" }, +}; +const size_t N_CREDENTIALS = sizeof(passwdfile) / sizeof(credentials_t); + +String * credentialsHandler(HTTPAuthMethod mode, String username, String params[]) +{ + for (int i = 0; i < N_CREDENTIALS; i++) { + if (username == passwdfile[i].username) + return new String(passwdfile[i].password); + } + return NULL; +} + +void setup() { + Serial.begin(115200); + while (!Serial) { delay(10); } + WiFi.mode(WIFI_STA); + WiFi.begin(ssid, password); + if (WiFi.waitForConnectResult() != WL_CONNECTED) { + Serial.println("WiFi Connect Failed! Rebooting..."); + delay(1000); + ESP.restart(); + } + ArduinoOTA.begin(); + + server.on("/", []() { + if (!server.authenticate(&credentialsHandler)) { + server.requestAuthentication(); + return; + } + server.send(200, "text/plain", "Login OK"); + }); + server.begin(); + + Serial.print("Open http://"); + Serial.print(WiFi.localIP()); + Serial.println("/ in your browser to see it working"); +} + +void loop() { + ArduinoOTA.handle(); + server.handleClient(); + delay(2);//allow the cpu to switch to other tasks +} diff --git a/libraries/WebServer/examples/HttpAuthCallbackInline/.skip.esp32h2 b/libraries/WebServer/examples/HttpAuthCallbackInline/.skip.esp32h2 new file mode 100644 index 00000000000..e69de29bb2d diff --git a/libraries/WebServer/examples/HttpAuthCallbackInline/HttpAuthCallbackInline.ino b/libraries/WebServer/examples/HttpAuthCallbackInline/HttpAuthCallbackInline.ino new file mode 100644 index 00000000000..48f0d3f8127 --- /dev/null +++ b/libraries/WebServer/examples/HttpAuthCallbackInline/HttpAuthCallbackInline.ino @@ -0,0 +1,67 @@ +#include +#include +#include +#include + +const char* ssid = "........"; +const char* password = "........"; + +WebServer server(80); + +typedef struct credentials_t { + char * username; + char * password; +} credentials_t; + +credentials_t passwdfile[] = { + { "admin", "esp32" }, + { "fred", "41234123" }, + { "charlie", "sdfsd" }, + { "alice", "vambdnkuhj" }, + { "bob", "svcdbjhws12" }, + { NULL, NULL } +}; + +void setup() { + Serial.begin(115200); + while (!Serial) { delay(10); } + WiFi.mode(WIFI_STA); + WiFi.begin(ssid, password); + if (WiFi.waitForConnectResult() != WL_CONNECTED) { + Serial.println("WiFi Connect Failed! Rebooting..."); + delay(1000); + ESP.restart(); + } + ArduinoOTA.begin(); + + server.on("/", []() { + if (!server.authenticate([](HTTPAuthMethod mode, String username, String params[]) -> String * { + // Scan the password list for the username and return the password if + // we find the username. + // + for (credentials_t * entry = passwdfile; entry->username; entry++) { + if (username == entry->username) { + return new String(entry->password); + }; + }; + // we've not found the user in the list. + return NULL; + })) + { + server.requestAuthentication(); + return; + } + server.send(200, "text/plain", "Login OK"); + }); + server.begin(); + + Serial.print("Open http://"); + Serial.print(WiFi.localIP()); + Serial.println("/ in your browser to see it working"); +} + +void loop() { + ArduinoOTA.handle(); + server.handleClient(); + delay(2);//allow the cpu to switch to other tasks +} diff --git a/libraries/WebServer/examples/HttpBasicAuthSHA1/.skip.esp32h2 b/libraries/WebServer/examples/HttpBasicAuthSHA1/.skip.esp32h2 new file mode 100644 index 00000000000..e69de29bb2d diff --git a/libraries/WebServer/examples/HttpBasicAuthSHA1/HttpBasicAuthSHA1.ino b/libraries/WebServer/examples/HttpBasicAuthSHA1/HttpBasicAuthSHA1.ino new file mode 100644 index 00000000000..bfc2df6d037 --- /dev/null +++ b/libraries/WebServer/examples/HttpBasicAuthSHA1/HttpBasicAuthSHA1.ino @@ -0,0 +1,72 @@ +#include +#include +#include +#include + +// Rather than specify the password as plaintext; we +// provide it as an (unsalted!) SHA1 hash. This is not +// much more secure (SHA1 is past its retirement age, +// and long obsolte/insecure) - but it helps a little. + +const char* ssid = "........"; +const char* password = "........"; + +WebServer server(80); + +// Passwords as plaintext - human readable and easily visible in +// the sourcecode and in the firmware/binary. +const char* www_username = "admin"; +const char* www_password = "esp32"; + +// The sha1 of 'esp32' (without the trailing \0) expressed as 20 +// bytes of hex. Created by for example 'echo -n esp32 | openssl sha1' +// or http://www.sha1-online.com. +const char* www_username_hex = "hexadmin"; +const char* www_password_hex = "8cb124f8c277c16ec0b2ee00569fd151a08e342b"; + +// The same; but now expressed as a base64 string (e.g. as commonly used +// by webservers). Created by ` echo -n esp32 | openssl sha1 -binary | openssl base64` +const char* www_username_base64 = "base64admin"; +const char* www_password_base64 = "jLEk+MJ3wW7Asu4AVp/RUaCONCs="; + +void setup() { + Serial.begin(115200); + while (!Serial) { delay(10); } + WiFi.mode(WIFI_STA); + WiFi.begin(ssid, password); + if (WiFi.waitForConnectResult() != WL_CONNECTED) { + Serial.println("WiFi Connect Failed! Rebooting..."); + delay(1000); + ESP.restart(); + } + ArduinoOTA.begin(); + + server.on("/", []() { + if (server.authenticate(www_username, www_password)) { + server.send(200, "text/plain", "Login against cleartext password OK"); + return; + } + if (server.authenticateBasicSHA1(www_username_hex, www_password_hex)) { + server.send(200, "text/plain", "Login against HEX of the SHA1 of the password OK"); + return; + } + if (server.authenticateBasicSHA1(www_username_base64, www_password_base64)) { + server.send(200, "text/plain", "Login against Base64 of the SHA1 of the password OK"); + return; + } + Serial.println("No/failed authentication"); + return server.requestAuthentication(); + }); + + server.begin(); + + Serial.print("Open http://"); + Serial.print(WiFi.localIP()); + Serial.println("/ in your browser to see it working"); +} + +void loop() { + ArduinoOTA.handle(); + server.handleClient(); + delay(2);//allow the cpu to switch to other tasks +} diff --git a/libraries/WebServer/examples/HttpBasicAuthSHA1orBearerToken/.skip.esp32h2 b/libraries/WebServer/examples/HttpBasicAuthSHA1orBearerToken/.skip.esp32h2 new file mode 100644 index 00000000000..e69de29bb2d diff --git a/libraries/WebServer/examples/HttpBasicAuthSHA1orBearerToken/HttpBasicAuthSHA1orBearerToken.ino b/libraries/WebServer/examples/HttpBasicAuthSHA1orBearerToken/HttpBasicAuthSHA1orBearerToken.ino new file mode 100644 index 00000000000..ecf04031181 --- /dev/null +++ b/libraries/WebServer/examples/HttpBasicAuthSHA1orBearerToken/HttpBasicAuthSHA1orBearerToken.ino @@ -0,0 +1,117 @@ +#include +#include +#include +#include +#include + +// We have two options - we either come in with a bearer +// token - i.e. a special header or API token; or we +// get a normal HTTP style basic auth prompt. +// +// To do a bearer fetch - use something like Swagger or with curl: +// +// curl https://myesp.com/ -H "Authorization: Bearer SecritToken" +// +// We avoid hardcoding this "SecritToken" into the code by +// using a SHA1 instead (which is not paricularly secure). + +// Create the secret token SHA1 with: +// echo -n SecritToken | openssl sha1 + +String secret_token_hex = "d2cce6b472959484a21c3194080c609b8a2c910b"; + +// Wifi credentials + +const char* ssid = "........"; +const char* password = "........"; + +WebServer server(80); + +// Rather than specify the admin password as plaintext; we +// provide it as an (unsalted!) SHA1 hash. This is not +// much more secure (SHA1 is past its retirement age, +// and long obsolte/insecure) - but it helps a little. + +// The sha1 of 'esp32' (without the trailing \0) expressed as 20 +// bytes of hex. Created by for example 'echo -n esp32 | openssl sha1' +// or http://www.sha1-online.com. +const char* www_username_hex = "admin"; +const char* www_password_hex = "8cb124f8c277c16ec0b2ee00569fd151a08e342b"; + +static unsigned char _bearer[20]; + +String* check_bearer_or_auth(HTTPAuthMethod mode, String authReq, String params[]) { + // we expect authReq to be "bearer some-secret" + String lcAuthReq = authReq; + lcAuthReq.toLowerCase(); + if (mode == OTHER_AUTH && (lcAuthReq.startsWith("bearer "))) { + String secret = authReq.substring(7); + secret.trim(); + + uint8_t sha1[20]; + SHA1Builder sha_builder; + + sha_builder.begin(); + sha_builder.add((uint8_t*) secret.c_str(), secret.length()); + sha_builder.calculate(); + sha_builder.getBytes(sha1); + + if (memcmp(_bearer, sha1, sizeof(_bearer)) == 0) { + Serial.println("Bearer token matches"); + return new String("anything non null"); + } else { + Serial.println("Bearer token does not match"); + } + } else if (mode == BASIC_AUTH) { + bool ret = server.authenticateBasicSHA1(www_username_hex, www_password_hex); + if (ret) { + Serial.println("Basic auth succeeded"); + return new String(params[0]); + } else { + Serial.println("Basic auth failed"); + } + } + + // No auth found + return NULL; +}; + +void setup() { + Serial.begin(115200); + while (!Serial) { delay(10); } + WiFi.mode(WIFI_STA); + WiFi.begin(ssid, password); + if (WiFi.waitForConnectResult() != WL_CONNECTED) { + Serial.println("WiFi Connect Failed! Rebooting..."); + delay(1000); + ESP.restart(); + } + ArduinoOTA.begin(); + + // Convert token to a convenient binary representation. + size_t len = HEXBuilder::hex2bytes(_bearer, sizeof(_bearer), secret_token_hex); + if (len != 20) + Serial.println("Bearer token does not look like a valid SHA1 hex string ?!"); + + server.on("/", []() { + if (!server.authenticate(&check_bearer_or_auth)) { + Serial.println("No/failed authentication"); + return server.requestAuthentication(); + } + Serial.println("Authentication succeeded"); + server.send(200, "text/plain", "Login OK"); + return; + }); + + server.begin(); + + Serial.print("Open http://"); + Serial.print(WiFi.localIP()); + Serial.println("/ in your browser to see it working"); +} + +void loop() { + ArduinoOTA.handle(); + server.handleClient(); + delay(2);//allow the cpu to switch to other tasks +} diff --git a/libraries/WebServer/src/Parsing.cpp b/libraries/WebServer/src/Parsing.cpp index 1debeb730ea..f3b19b19d6e 100644 --- a/libraries/WebServer/src/Parsing.cpp +++ b/libraries/WebServer/src/Parsing.cpp @@ -309,42 +309,14 @@ void WebServer::_uploadWriteByte(uint8_t b){ _currentUpload->buf[_currentUpload->currentSize++] = b; } -int WebServer::_uploadReadByte(WiFiClient& client){ +int WebServer::_uploadReadByte(WiFiClient& client) { int res = client.read(); - if(res < 0) { - // keep trying until you either read a valid byte or timeout - unsigned long startMillis = millis(); - long timeoutIntervalMillis = client.getTimeout(); - boolean timedOut = false; - for(;;) { - if (!client.connected()) return -1; - // loosely modeled after blinkWithoutDelay pattern - while(!timedOut && !client.available() && client.connected()){ - delay(2); - timedOut = millis() - startMillis >= timeoutIntervalMillis; - } - res = client.read(); - if(res >= 0) { - return res; // exit on a valid read - } - // NOTE: it is possible to get here and have all of the following - // assertions hold true - // - // -- client.available() > 0 - // -- client.connected == true - // -- res == -1 - // - // a simple retry strategy overcomes this which is to say the - // assertion is not permanent, but the reason that this works - // is elusive, and possibly indicative of a more subtle underlying - // issue - - timedOut = millis() - startMillis >= timeoutIntervalMillis; - if(timedOut) { - return res; // exit on a timeout - } - } + if (res < 0) { + while(!client.available() && client.connected()) + delay(2); + + res = client.read(); } return res; @@ -436,88 +408,59 @@ bool WebServer::_parseForm(WiFiClient& client, String boundary, uint32_t len){ if(_currentHandler && _currentHandler->canUpload(_currentUri)) _currentHandler->upload(*this, _currentUri, *_currentUpload); _currentUpload->status = UPLOAD_FILE_WRITE; - int argByte = _uploadReadByte(client); -readfile: - while(argByte != 0x0D){ - if(argByte < 0) return _parseFormUploadAborted(); - _uploadWriteByte(argByte); - argByte = _uploadReadByte(client); - } - - argByte = _uploadReadByte(client); - if(argByte < 0) return _parseFormUploadAborted(); - if (argByte == 0x0A){ - argByte = _uploadReadByte(client); - if(argByte < 0) return _parseFormUploadAborted(); - if ((char)argByte != '-'){ - //continue reading the file - _uploadWriteByte(0x0D); - _uploadWriteByte(0x0A); - goto readfile; - } else { - argByte = _uploadReadByte(client); - if(argByte < 0) return _parseFormUploadAborted(); - if ((char)argByte != '-'){ - //continue reading the file - _uploadWriteByte(0x0D); - _uploadWriteByte(0x0A); - _uploadWriteByte((uint8_t)('-')); - goto readfile; - } - } - - uint8_t endBuf[boundary.length()]; - uint32_t i = 0; - while(i < boundary.length()){ - argByte = _uploadReadByte(client); - if(argByte < 0) return _parseFormUploadAborted(); - if ((char)argByte == 0x0D){ - _uploadWriteByte(0x0D); - _uploadWriteByte(0x0A); - _uploadWriteByte((uint8_t)('-')); - _uploadWriteByte((uint8_t)('-')); - uint32_t j = 0; - while(j < i){ - _uploadWriteByte(endBuf[j++]); - } - goto readfile; - } - endBuf[i++] = (uint8_t)argByte; - } - - if (strstr((const char*)endBuf, boundary.c_str()) != NULL){ - if(_currentHandler && _currentHandler->canUpload(_currentUri)) - _currentHandler->upload(*this, _currentUri, *_currentUpload); - _currentUpload->totalSize += _currentUpload->currentSize; - _currentUpload->status = UPLOAD_FILE_END; - if(_currentHandler && _currentHandler->canUpload(_currentUri)) - _currentHandler->upload(*this, _currentUri, *_currentUpload); - log_v("End File: %s Type: %s Size: %d", _currentUpload->filename.c_str(), _currentUpload->type.c_str(), _currentUpload->totalSize); - line = client.readStringUntil(0x0D); - client.readStringUntil(0x0A); - if (line == "--"){ - log_v("Done Parsing POST"); - break; + int fastBoundaryLen = 4 /* \r\n-- */ + boundary.length() + 1 /* \0 */; + char fastBoundary[ fastBoundaryLen ]; + snprintf(fastBoundary, fastBoundaryLen, "\r\n--%s", boundary.c_str()); + int boundaryPtr = 0; + while ( true ) { + int ret = _uploadReadByte(client); + if (ret < 0) { + // Unexpected, we should have had data available per above + return _parseFormUploadAborted(); } - continue; - } else { - _uploadWriteByte(0x0D); - _uploadWriteByte(0x0A); - _uploadWriteByte((uint8_t)('-')); - _uploadWriteByte((uint8_t)('-')); - uint32_t i = 0; - while(i < boundary.length()){ - _uploadWriteByte(endBuf[i++]); + char in = (char) ret; + if (in == fastBoundary[ boundaryPtr ]) { + // The input matched the current expected character, advance and possibly exit this file + boundaryPtr++; + if (boundaryPtr == fastBoundaryLen - 1) { + // We read the whole boundary line, we're done here! + break; + } + } else { + // The char doesn't match what we want, so dump whatever matches we had, the read in char, and reset ptr to start + for (int i = 0; i < boundaryPtr; i++) { + _uploadWriteByte( fastBoundary[ i ] ); + } + if (in == fastBoundary[ 0 ]) { + // This could be the start of the real end, mark it so and don't emit/skip it + boundaryPtr = 1; + } else { + // Not the 1st char of our pattern, so emit and ignore + _uploadWriteByte( in ); + boundaryPtr = 0; + } } - argByte = _uploadReadByte(client); - goto readfile; - } - } else { - _uploadWriteByte(0x0D); - goto readfile; } - break; + // Found the boundary string, finish processing this file upload + if (_currentHandler && _currentHandler->canUpload(_currentUri)) + _currentHandler->upload(*this, _currentUri, *_currentUpload); + _currentUpload->totalSize += _currentUpload->currentSize; + _currentUpload->status = UPLOAD_FILE_END; + if (_currentHandler && _currentHandler->canUpload(_currentUri)) + _currentHandler->upload(*this, _currentUri, *_currentUpload); + log_v("End File: %s Type: %s Size: %d", + _currentUpload->filename.c_str(), + _currentUpload->type.c_str(), + (int)_currentUpload->totalSize); + if (!client.connected()) return _parseFormUploadAborted(); + line = client.readStringUntil('\r'); + client.readStringUntil('\n'); + if (line == "--") { // extra two dashes mean we reached the end of all form fields + log_v("Done Parsing POST"); + break; + } + continue; } } } diff --git a/libraries/WebServer/src/WebServer.cpp b/libraries/WebServer/src/WebServer.cpp index 0d99f3680a1..e423900ca52 100644 --- a/libraries/WebServer/src/WebServer.cpp +++ b/libraries/WebServer/src/WebServer.cpp @@ -23,6 +23,7 @@ #include #include +#include #include #include "esp_random.h" #include "WiFiServer.h" @@ -31,7 +32,8 @@ #include "FS.h" #include "detail/RequestHandlersImpl.h" #include "MD5Builder.h" - +#include "SHA1Builder.h" +#include "base64.h" static const char AUTHORIZATION_HEADER[] = "Authorization"; static const char qop_auth[] PROGMEM = "qop=auth"; @@ -40,7 +42,6 @@ static const char WWW_Authenticate[] = "WWW-Authenticate"; static const char Content_Length[] = "Content-Length"; static const char ETAG_HEADER[] = "If-None-Match"; - WebServer::WebServer(IPAddress addr, int port) : _corsEnabled(false) , _server(addr, port) @@ -128,91 +129,185 @@ static String md5str(String &in){ return md5.toString(); } -bool WebServer::authenticate(const char * username, const char * password){ - if(hasHeader(FPSTR(AUTHORIZATION_HEADER))) { - String authReq = header(FPSTR(AUTHORIZATION_HEADER)); - if(authReq.startsWith(F("Basic"))){ - authReq = authReq.substring(6); - authReq.trim(); - char toencodeLen = strlen(username)+strlen(password)+1; - char *toencode = (char *)malloc[toencodeLen + 1]; - if(toencode == NULL){ - authReq = ""; - return false; - } - char *encoded = (char *)malloc(base64_encode_expected_len(toencodeLen)+1); - if(encoded == NULL){ - authReq = ""; - free(toencode); - return false; - } - sprintf(toencode, "%s:%s", username, password); - if(base64_encode_chars(toencode, toencodeLen, encoded) > 0 && authReq.equalsConstantTime(encoded)) { - authReq = ""; - free(toencode); - free(encoded); - return true; - } - free(toencode); - free(encoded);; - } else if(authReq.startsWith(F("Digest"))) { - authReq = authReq.substring(7); - log_v("%s", authReq.c_str()); - String _username = _extractParam(authReq,F("username=\""),'\"'); - if(!_username.length() || _username != String(username)) { - authReq = ""; - return false; - } - // extracting required parameters for RFC 2069 simpler Digest - String _realm = _extractParam(authReq, F("realm=\""),'\"'); - String _nonce = _extractParam(authReq, F("nonce=\""),'\"'); - String _uri = _extractParam(authReq, F("uri=\""),'\"'); - String _response = _extractParam(authReq, F("response=\""),'\"'); - String _opaque = _extractParam(authReq, F("opaque=\""),'\"'); - - if((!_realm.length()) || (!_nonce.length()) || (!_uri.length()) || (!_response.length()) || (!_opaque.length())) { - authReq = ""; - return false; - } - if((_opaque != _sopaque) || (_nonce != _snonce) || (_realm != _srealm)) { - authReq = ""; - return false; - } - // parameters for the RFC 2617 newer Digest - String _nc,_cnonce; - if(authReq.indexOf(FPSTR(qop_auth)) != -1 || authReq.indexOf(FPSTR(qop_auth_quoted)) != -1) { - _nc = _extractParam(authReq, F("nc="), ','); - _cnonce = _extractParam(authReq, F("cnonce=\""),'\"'); - } - String _H1 = md5str(String(username) + ':' + _realm + ':' + String(password)); - log_v("Hash of user:realm:pass=%s", _H1.c_str()); - String _H2 = ""; - if(_currentMethod == HTTP_GET){ - _H2 = md5str(String(F("GET:")) + _uri); - }else if(_currentMethod == HTTP_POST){ - _H2 = md5str(String(F("POST:")) + _uri); - }else if(_currentMethod == HTTP_PUT){ - _H2 = md5str(String(F("PUT:")) + _uri); - }else if(_currentMethod == HTTP_DELETE){ - _H2 = md5str(String(F("DELETE:")) + _uri); - }else{ - _H2 = md5str(String(F("GET:")) + _uri); - } - log_v("Hash of GET:uri=%s", _H2.c_str()); - String _responsecheck = ""; - if(authReq.indexOf(FPSTR(qop_auth)) != -1 || authReq.indexOf(FPSTR(qop_auth_quoted)) != -1) { - _responsecheck = md5str(_H1 + ':' + _nonce + ':' + _nc + ':' + _cnonce + F(":auth:") + _H2); - } else { - _responsecheck = md5str(_H1 + ':' + _nonce + ':' + _H2); - } - log_v("The Proper response=%s", _responsecheck.c_str()); - if(_response == _responsecheck){ +bool WebServer::authenticateBasicSHA1(const char * _username, const char * _sha1Base64orHex) { + return WebServer::authenticate([_username,_sha1Base64orHex](HTTPAuthMethod mode, String username, String params[])->String * { + // rather than work on a password to compare with; we take the sha1 of the + // password received over the wire and compare that to the base64 encoded + // sha1 passed as _sha1base64. That way there is no need to have a + // plaintext password in the code/binary (though note that SHA1 is well + // past its retirement age). When that matches - we `cheat' by returning + // the password we got in the first place; so the normal BasicAuth + // can be completed. Note that this cannot work for a digest auth - + // as there the password in the clear is part of the calculation. + + if (params == nullptr) { + log_e("Something went wrong. params is NULL"); + return NULL; + } + + uint8_t sha1[20]; + char sha1calc[48]; // large enough for base64 and Hex represenation + String ret; + SHA1Builder sha_builder; + base64 b64; + + log_v("Trying to authenticate user %s using SHA1.", username.c_str()); + sha_builder.begin(); + sha_builder.add((uint8_t*) params[0].c_str(), params[0].length()); + sha_builder.calculate(); + sha_builder.getBytes(sha1); + + // we can either decode _sha1base64orHex and then compare the 20 bytes; + // or encode the sha we calculated. We pick the latter as encoding of a + // fixed array of 20 bytes is safer than operating on something external. + if (strlen(_sha1Base64orHex) == 20 * 2) { // 2 chars per byte + sha_builder.bytes2hex(sha1calc, sizeof(sha1calc), sha1, sizeof(sha1)); + log_v("Calculated SHA1 in hex: %s", sha1calc); + } else { + ret = b64.encode(sha1, sizeof(sha1)); + ret.toCharArray(sha1calc, sizeof(sha1calc)); + log_v("Calculated SHA1 in base64: %s", sha1calc); + } + + return ((username.equalsConstantTime(_username)) && + (String((char*)sha1calc).equalsConstantTime(_sha1Base64orHex)) && + (mode == BASIC_AUTH) /* to keep things somewhat time constant. */ + ) ? new String(params[0]) : NULL; + }); +} + +bool WebServer::authenticate(const char * _username, const char * _password) { + return WebServer::authenticate([_username,_password](HTTPAuthMethod mode, String username, String params[])->String * { + return username.equalsConstantTime(_username) ? new String(_password) : NULL; + }); +} + +bool WebServer::authenticate(THandlerFunctionAuthCheck fn) { + if (!hasHeader(FPSTR(AUTHORIZATION_HEADER))) { + return false; + } + + String authReq = header(FPSTR(AUTHORIZATION_HEADER)); + if (authReq.startsWith(AuthTypeBasic)) { + log_v("Trying to authenticate using Basic Auth"); + bool ret = false; + + authReq = authReq.substring(6); // length of AuthTypeBasic including the space at the end. + authReq.trim(); + + /* base64 encoded string is always shorter (or equal) in length */ + char* decoded = (authReq.length() < HTTP_MAX_BASIC_AUTH_LEN) ? new char[authReq.length()] : NULL; + if (decoded) { + char* p; + if (base64_decode_chars(authReq.c_str(), authReq.length(), decoded) && (p = index(decoded, ':')) && p) { authReq = ""; - return true; + /* Note: rfc7617 guarantees that there will not be an escaped colon in the username itself. + * Note: base64_decode_chars() guarantees a terminating \0 + */ + *p = '\0'; + char * _username = decoded, * _password = p + 1; + String params[] = { + _password, + _srealm + }; + String* password = fn(BASIC_AUTH, _username, params); + + if (password) { + ret = password->equalsConstantTime(_password); + // we're more concerned about the password; as the attacker already + // knows the _pasword. Arduino's string handling is simple; it reallocs + // even when smaller; so a memset is enough (no capacity/size). + memset((void *)password->c_str(), 0, password->length()); + delete password; + } } + delete[] decoded; } authReq = ""; + log_v("Authentication %s", ret ? "Success" : "Failed"); + return ret; + } else if (authReq.startsWith(AuthTypeDigest)) { + log_v("Trying to authenticate using Digest Auth"); + authReq = authReq.substring(7); + log_v("%s", authReq.c_str()); + + // extracting required parameters for RFC 2069 simpler Digest + String _username = _extractParam(authReq, F("username=\""), '\"'); + String _realm = _extractParam(authReq, F("realm=\""), '\"'); + String _uri = _extractParam(authReq, F("uri=\""), '\"'); + if (!_username.length()) + goto exf; + + String params[] = { + _realm, + _uri + }; + String* password = fn(DIGEST_AUTH, _username, params); + if (!password) + goto exf; + + String _H1 = md5str(String(_username) + ':' + _realm + ':' + * password); + // we're extra concerned; as digest request us to know the password + // in the clear. + memset((void *) password->c_str(), 0, password->length()); + delete password; + _username = ""; + + String _nonce = _extractParam(authReq, F("nonce=\""), '\"'); + String _response = _extractParam(authReq, F("response=\""), '\"'); + String _opaque = _extractParam(authReq, F("opaque=\""), '\"'); + + if ((!_realm.length()) || (!_nonce.length()) || (!_uri.length()) || (!_response.length()) || (!_opaque.length())) + goto exf; + + if ((_opaque != _sopaque) || (_nonce != _snonce) || (_realm != _srealm)) + goto exf; + + // parameters for the RFC 2617 newer Digest + String _nc, _cnonce; + if (authReq.indexOf(FPSTR(qop_auth)) != -1 || authReq.indexOf(FPSTR(qop_auth_quoted)) != -1) { + _nc = _extractParam(authReq, F("nc="), ','); + _cnonce = _extractParam(authReq, F("cnonce=\""), '\"'); + } + + log_v("Hash of user:realm:pass=%s", _H1.c_str()); + String _H2 = ""; + if (_currentMethod == HTTP_GET) { + _H2 = md5str(String(F("GET:")) + _uri); + } else if (_currentMethod == HTTP_POST) { + _H2 = md5str(String(F("POST:")) + _uri); + } else if (_currentMethod == HTTP_PUT) { + _H2 = md5str(String(F("PUT:")) + _uri); + } else if (_currentMethod == HTTP_DELETE) { + _H2 = md5str(String(F("DELETE:")) + _uri); + } else { + _H2 = md5str(String(F("GET:")) + _uri); + } + log_v("Hash of GET:uri=%s", _H2.c_str()); + String _responsecheck = ""; + if (authReq.indexOf(FPSTR(qop_auth)) != -1 || authReq.indexOf(FPSTR(qop_auth_quoted)) != -1) { + _responsecheck = md5str(_H1 + ':' + _nonce + ':' + _nc + ':' + _cnonce + F(":auth:") + _H2); + } else { + _responsecheck = md5str(_H1 + ':' + _nonce + ':' + _H2); + } + authReq = ""; + + log_v("The Proper response=%s", _responsecheck.c_str()); + bool ret = _response == _responsecheck; + log_v("Authentication %s", ret ? "Success" : "Failed"); + return ret; + } else if (authReq.length()) { + // OTHER_AUTH + log_v("Trying to authenticate using Other Auth, authReq=%s", authReq.c_str()); + String* ret = fn(OTHER_AUTH, authReq, {}); + if (ret) { + log_v("Authentication Success"); + return true; + } } +exf: + authReq = ""; + log_v("Authentication Failed"); return false; } @@ -232,11 +327,11 @@ void WebServer::requestAuthentication(HTTPAuthMethod mode, const char* realm, co _srealm = String(realm); } if(mode == BASIC_AUTH) { - sendHeader(String(FPSTR(WWW_Authenticate)), String(F("Basic realm=\"")) + _srealm + String(F("\""))); + sendHeader(String(FPSTR(WWW_Authenticate)), AuthTypeBasic + String(F(" realm=\"")) + _srealm + String(F("\""))); } else { _snonce=_getRandomHexString(); _sopaque=_getRandomHexString(); - sendHeader(String(FPSTR(WWW_Authenticate)), String(F("Digest realm=\"")) +_srealm + String(F("\", qop=\"auth\", nonce=\"")) + _snonce + String(F("\", opaque=\"")) + _sopaque + String(F("\""))); + sendHeader(String(FPSTR(WWW_Authenticate)), AuthTypeDigest + String(F(" realm=\"")) +_srealm + String(F("\", qop=\"auth\", nonce=\"")) + _snonce + String(F("\", opaque=\"")) + _sopaque + String(F("\""))); } using namespace mime; send(401, String(FPSTR(mimeTable[html].mimeType)), authFailMsg); @@ -307,6 +402,11 @@ void WebServer::handleClient() { _contentLength = CONTENT_LENGTH_NOT_SET; _handleRequest(); + if (_currentClient.isSSE()) { + _currentStatus = HC_WAIT_CLOSE; + _statusChange = millis(); + keepCurrentClient = true; + } // Fix for issue with Chrome based browsers: https://github.com/espressif/arduino-esp32/issues/3652 // if (_currentClient.connected()) { // _currentStatus = HC_WAIT_CLOSE; @@ -322,6 +422,10 @@ void WebServer::handleClient() { } break; case HC_WAIT_CLOSE: + if (_currentClient.isSSE()) { + // Never close connection + _statusChange = millis(); + } // Wait for client to close the connection if (millis() - _statusChange <= HTTP_MAX_CLOSE_WAIT) { keepCurrentClient = true; @@ -411,8 +515,8 @@ void WebServer::_prepareHeader(String& response, int code, const char* content_t } if (_corsEnabled) { sendHeader(String(FPSTR("Access-Control-Allow-Origin")), String("*")); - sendHeader(String(FPSTR("Access-Control-Allow-Methods")), String("*")); - sendHeader(String(FPSTR("Access-Control-Allow-Headers")), String("*")); + sendHeader(String(FPSTR("Access-Control-Allow-Methods")), String("*")); + sendHeader(String(FPSTR("Access-Control-Allow-Headers")), String("*")); } sendHeader(String(F("Connection")), String(F("close"))); @@ -543,9 +647,9 @@ String WebServer::pathArg(unsigned int i) { String WebServer::arg(String name) { for (int j = 0; j < _postArgsLen; ++j) { - if ( _postArgs[j].key == name ) - return _postArgs[j].value; - } + if ( _postArgs[j].key == name ) + return _postArgs[j].value; + } for (int i = 0; i < _currentArgCount; ++i) { if ( _currentArgs[i].key == name ) return _currentArgs[i].value; @@ -571,9 +675,9 @@ int WebServer::args() { bool WebServer::hasArg(String name) { for (int j = 0; j < _postArgsLen; ++j) { - if (_postArgs[j].key == name) - return true; - } + if (_postArgs[j].key == name) + return true; + } for (int i = 0; i < _currentArgCount; ++i) { if (_currentArgs[i].key == name) return true; diff --git a/libraries/WebServer/src/WebServer.h b/libraries/WebServer/src/WebServer.h index aa703059d13..d668c4e70e7 100644 --- a/libraries/WebServer/src/WebServer.h +++ b/libraries/WebServer/src/WebServer.h @@ -34,7 +34,7 @@ enum HTTPUploadStatus { UPLOAD_FILE_START, UPLOAD_FILE_WRITE, UPLOAD_FILE_END, UPLOAD_FILE_ABORTED }; enum HTTPClientStatus { HC_NONE, HC_WAIT_READ, HC_WAIT_CLOSE }; -enum HTTPAuthMethod { BASIC_AUTH, DIGEST_AUTH }; +enum HTTPAuthMethod { BASIC_AUTH, DIGEST_AUTH, OTHER_AUTH }; #define HTTP_DOWNLOAD_UNIT_SIZE 1436 @@ -46,6 +46,7 @@ enum HTTPAuthMethod { BASIC_AUTH, DIGEST_AUTH }; #define HTTP_MAX_POST_WAIT 5000 //ms to wait for POST data to arrive #define HTTP_MAX_SEND_WAIT 5000 //ms to wait for data chunk to be ACKed #define HTTP_MAX_CLOSE_WAIT 2000 //ms to wait for the client to close the connection +#define HTTP_MAX_BASIC_AUTH_LEN 256 // maximum length of a basic Auth base64 encoded username:password string #define CONTENT_LENGTH_UNKNOWN ((size_t) -1) #define CONTENT_LENGTH_NOT_SET ((size_t) -2) @@ -82,12 +83,41 @@ class WebServer virtual void close(); void stop(); + const String AuthTypeDigest = F("Digest"); + const String AuthTypeBasic = F("Basic"); + + /* Callbackhandler for authentication. The extra parameters depend on the + * HTTPAuthMethod mode: + * + * BASIC_AUTH enteredUsernameOrReq contains the username entered by the user + * param[0] password entered (in the clear) + * param[1] authentication realm. + * + * To return - the password the user entered password is compared to. Or Null on fail. + * + * DIGEST_AUTH enteredUsernameOrReq contains the username entered by the user + * param[0] autenticaiton realm + * param[1] authentication URI + * + * To return - the password of which the digest will be based on for comparison. Or NULL + * to fail. + * + * OTHER_AUTH enteredUsernameOrReq rest of the auth line. + * params empty array + * + * To return - NULL to fail; or any string. + */ + typedef std::function THandlerFunctionAuthCheck; + + bool authenticate(THandlerFunctionAuthCheck fn); bool authenticate(const char * username, const char * password); + bool authenticateBasicSHA1(const char * _username, const char * _sha1AsBase64orHex); + void requestAuthentication(HTTPAuthMethod mode = BASIC_AUTH, const char* realm = NULL, const String& authFailMsg = String("") ); typedef std::function THandlerFunction; void on(const Uri &uri, THandlerFunction fn); - void on(const Uri &uri, HTTPMethod method, THandlerFunction fn); + void on(const Uri &uri, HTTPMethod method, THandlerFunction fn); void on(const Uri &uri, HTTPMethod method, THandlerFunction fn, THandlerFunction ufn); //ufn handles file uploads void addHandler(RequestHandler* handler); void serveStatic(const char* uri, fs::FS& fs, const char* path, const char* cache_header = NULL ); diff --git a/libraries/WiFi/examples/WiFiBlueToothSwitch/WiFiBlueToothSwitch.ino b/libraries/WiFi/examples/WiFiBlueToothSwitch/WiFiBlueToothSwitch.ino index 771a531a480..be9aa239627 100644 --- a/libraries/WiFi/examples/WiFiBlueToothSwitch/WiFiBlueToothSwitch.ino +++ b/libraries/WiFi/examples/WiFiBlueToothSwitch/WiFiBlueToothSwitch.ino @@ -89,7 +89,6 @@ void WiFiEvent(WiFiEvent_t event){ break; case ARDUINO_EVENT_WIFI_STA_CONNECTED: Serial.println("STA Connected"); - WiFi.enableIpV6(); break; case ARDUINO_EVENT_WIFI_STA_GOT_IP6: Serial.print("STA IPv6: "); @@ -114,6 +113,7 @@ void setup() { Serial.begin(115200); pinMode(0, INPUT_PULLUP); WiFi.onEvent(WiFiEvent); // Will call WiFiEvent() from another thread. + WiFi.enableIPv6(); Serial.print("ESP32 SDK: "); Serial.println(ESP.getSdkVersion()); Serial.println("Press the button to select the next mode"); diff --git a/libraries/WiFi/examples/WiFiIPv6/WiFiIPv6.ino b/libraries/WiFi/examples/WiFiIPv6/WiFiIPv6.ino index 3dcba56eec2..c7edd384d82 100644 --- a/libraries/WiFi/examples/WiFiIPv6/WiFiIPv6.ino +++ b/libraries/WiFi/examples/WiFiIPv6/WiFiIPv6.ino @@ -70,16 +70,12 @@ void WiFiEvent(WiFiEvent_t event){ case ARDUINO_EVENT_WIFI_AP_START: //can set ap hostname here WiFi.softAPsetHostname(AP_SSID); - //enable ap ipv6 here - WiFi.softAPenableIpV6(); break; case ARDUINO_EVENT_WIFI_STA_START: //set sta hostname here WiFi.setHostname(AP_SSID); break; case ARDUINO_EVENT_WIFI_STA_CONNECTED: - //enable sta ipv6 here - WiFi.enableIpV6(); break; case ARDUINO_EVENT_WIFI_STA_GOT_IP6: Serial.print("STA IPv6: "); @@ -107,7 +103,11 @@ void setup(){ WiFi.disconnect(true); WiFi.onEvent(WiFiEvent); // Will call WiFiEvent() from another thread. WiFi.mode(WIFI_MODE_APSTA); + //enable ap ipv6 here + WiFi.softAPenableIPv6(); WiFi.softAP(AP_SSID); + //enable sta ipv6 here + WiFi.enableIPv6(); WiFi.begin(STA_SSID, STA_PASS); } diff --git a/libraries/WiFi/examples/WiFiMultiAdvanced/.skip.esp32h2 b/libraries/WiFi/examples/WiFiMultiAdvanced/.skip.esp32h2 new file mode 100644 index 00000000000..e69de29bb2d diff --git a/libraries/WiFi/examples/WiFiMultiAdvanced/WiFiMultiAdvanced.ino b/libraries/WiFi/examples/WiFiMultiAdvanced/WiFiMultiAdvanced.ino new file mode 100644 index 00000000000..55a3e4d49a6 --- /dev/null +++ b/libraries/WiFi/examples/WiFiMultiAdvanced/WiFiMultiAdvanced.ino @@ -0,0 +1,64 @@ +/* + * This sketch tries to connect to the best AP available + * and tests for captive portals on open networks + * + */ + +#include +#include +#include + +WiFiMulti wifiMulti; + +// callback used to check Internet connectivity +bool testConnection(){ + HTTPClient http; + http.begin("http://www.espressif.com"); + int httpCode = http.GET(); + // we expect to get a 301 because it will ask to use HTTPS instead of HTTP + if (httpCode == HTTP_CODE_MOVED_PERMANENTLY) return true; + return false; +} + +void setup() +{ + Serial.begin(115200); + delay(10); + + wifiMulti.addAP("ssid_from_AP_1", "your_password_for_AP_1"); + wifiMulti.addAP("ssid_from_AP_2", "your_password_for_AP_2"); + wifiMulti.addAP("ssid_from_AP_3", "your_password_for_AP_3"); + + // These options can help when you need ANY kind of wifi connection to get a config file, report errors, etc. + wifiMulti.setStrictMode(false); // Default is true. Library will disconnect and forget currently connected AP if it's not in the AP list. + wifiMulti.setAllowOpenAP(true); // Default is false. True adds open APs to the AP list. + wifiMulti.setConnectionTestCallbackFunc(testConnection); // Attempts to connect to a remote webserver in case of captive portals. + + Serial.println("Connecting Wifi..."); + if(wifiMulti.run() == WL_CONNECTED) { + Serial.println(""); + Serial.println("WiFi connected"); + Serial.println("IP address: "); + Serial.println(WiFi.localIP()); + } +} + +void loop() +{ + static bool isConnected = false; + uint8_t WiFiStatus = wifiMulti.run(); + + if (WiFiStatus == WL_CONNECTED) { + if (!isConnected) { + Serial.println(""); + Serial.println("WiFi connected"); + Serial.println("IP address: "); + Serial.println(WiFi.localIP()); + } + isConnected = true; + } else { + Serial.println("WiFi not connected!"); + isConnected = false; + delay(5000); + } +} diff --git a/libraries/WiFi/src/WiFi.h b/libraries/WiFi/src/WiFi.h index 457f913ae8e..30b9e31f744 100644 --- a/libraries/WiFi/src/WiFi.h +++ b/libraries/WiFi/src/WiFi.h @@ -26,7 +26,6 @@ #include "Print.h" #include "IPAddress.h" -#include "IPv6Address.h" #include "WiFiType.h" #include "WiFiSTA.h" diff --git a/libraries/WiFi/src/WiFiAP.cpp b/libraries/WiFi/src/WiFiAP.cpp index a88547f9a89..b02b929bce9 100644 --- a/libraries/WiFi/src/WiFiAP.cpp +++ b/libraries/WiFi/src/WiFiAP.cpp @@ -411,26 +411,35 @@ bool WiFiAPClass::softAPsetHostname(const char * hostname) * Enable IPv6 on the softAP interface. * @return true on success */ -bool WiFiAPClass::softAPenableIpV6() +bool WiFiAPClass::softAPenableIPv6(bool enable) { - if(WiFiGenericClass::getMode() == WIFI_MODE_NULL){ - return false; + if (enable) { + WiFiGenericClass::setStatusBits(AP_WANT_IP6_BIT); + } else { + WiFiGenericClass::clearStatusBits(AP_WANT_IP6_BIT); } - return esp_netif_create_ip6_linklocal(get_esp_interface_netif(ESP_IF_WIFI_AP)) == ESP_OK; + return true; + // if(WiFiGenericClass::getMode() == WIFI_MODE_NULL){ + // return false; + // } + // return esp_netif_create_ip6_linklocal(get_esp_interface_netif(ESP_IF_WIFI_AP)) == ESP_OK; } /** * Get the softAP interface IPv6 address. - * @return IPv6Address softAP IPv6 + * @return IPAddress softAP IPv6 */ -IPv6Address WiFiAPClass::softAPIPv6() + +IPAddress WiFiAPClass::softAPIPv6() { - esp_ip6_addr_t addr; + static esp_ip6_addr_t addr; if(WiFiGenericClass::getMode() == WIFI_MODE_NULL){ - return IPv6Address(); + return IPAddress(IPv6); } - if(esp_netif_get_ip6_linklocal(get_esp_interface_netif(ESP_IF_WIFI_AP), &addr)) { - return IPv6Address(); + + if(esp_netif_get_ip6_linklocal(get_esp_interface_netif(ESP_IF_WIFI_STA), &addr)){ + return IPAddress(IPv6); } - return IPv6Address(addr.addr); + return IPAddress(IPv6, (const uint8_t *)addr.addr, addr.zone); } + diff --git a/libraries/WiFi/src/WiFiAP.h b/libraries/WiFi/src/WiFiAP.h index 626a5b5b350..a07fab54335 100644 --- a/libraries/WiFi/src/WiFiAP.h +++ b/libraries/WiFi/src/WiFiAP.h @@ -56,8 +56,8 @@ class WiFiAPClass IPAddress softAPSubnetMask(); uint8_t softAPSubnetCIDR(); - bool softAPenableIpV6(); - IPv6Address softAPIPv6(); + bool softAPenableIPv6(bool enable=true); + IPAddress softAPIPv6(); const char * softAPgetHostname(); bool softAPsetHostname(const char * hostname); diff --git a/libraries/WiFi/src/WiFiClient.cpp b/libraries/WiFi/src/WiFiClient.cpp index 864c33322f3..96eab3b5602 100644 --- a/libraries/WiFi/src/WiFiClient.cpp +++ b/libraries/WiFi/src/WiFiClient.cpp @@ -23,6 +23,11 @@ #include #include +#define IN6_IS_ADDR_V4MAPPED(a) \ + ((((__const uint32_t *) (a))[0] == 0) \ + && (((__const uint32_t *) (a))[1] == 0) \ + && (((__const uint32_t *) (a))[2] == htonl (0xffff))) + #define WIFI_CLIENT_DEF_CONN_TIMEOUT_MS (3000) #define WIFI_CLIENT_MAX_WRITE_RETRY (10) #define WIFI_CLIENT_SELECT_TIMEOUT_US (1000000) @@ -182,7 +187,7 @@ class WiFiClientSocketHandle { } }; -WiFiClient::WiFiClient():_rxBuffer(nullptr),_connected(false),_timeout(WIFI_CLIENT_DEF_CONN_TIMEOUT_MS),next(NULL) +WiFiClient::WiFiClient():_rxBuffer(nullptr),_connected(false),_sse(false),_timeout(WIFI_CLIENT_DEF_CONN_TIMEOUT_MS),next(NULL) { } @@ -197,15 +202,6 @@ WiFiClient::~WiFiClient() stop(); } -WiFiClient & WiFiClient::operator=(const WiFiClient &other) -{ - stop(); - clientSocketHandle = other.clientSocketHandle; - _rxBuffer = other._rxBuffer; - _connected = other._connected; - return *this; -} - void WiFiClient::stop() { clientSocketHandle = NULL; @@ -219,22 +215,33 @@ int WiFiClient::connect(IPAddress ip, uint16_t port) { return connect(ip,port,_timeout); } + int WiFiClient::connect(IPAddress ip, uint16_t port, int32_t timeout_ms) { + struct sockaddr_storage serveraddr = {}; _timeout = timeout_ms; - int sockfd = socket(AF_INET, SOCK_STREAM, 0); + int sockfd = -1; + + if (ip.type() == IPv6) { + struct sockaddr_in6 *tmpaddr = (struct sockaddr_in6 *)&serveraddr; + sockfd = socket(AF_INET6, SOCK_STREAM, 0); + tmpaddr->sin6_family = AF_INET6; + memcpy(tmpaddr->sin6_addr.un.u8_addr, &ip[0], 16); + tmpaddr->sin6_port = htons(port); + tmpaddr->sin6_scope_id = ip.zone(); + } else { + struct sockaddr_in *tmpaddr = (struct sockaddr_in *)&serveraddr; + sockfd = socket(AF_INET, SOCK_STREAM, 0); + tmpaddr->sin_family = AF_INET; + tmpaddr->sin_addr.s_addr = ip; + tmpaddr->sin_port = htons(port); + } if (sockfd < 0) { log_e("socket: %d", errno); return 0; } fcntl( sockfd, F_SETFL, fcntl( sockfd, F_GETFL, 0 ) | O_NONBLOCK ); - uint32_t ip_addr = ip; - struct sockaddr_in serveraddr; - memset((char *) &serveraddr, 0, sizeof(serveraddr)); - serveraddr.sin_family = AF_INET; - memcpy((void *)&serveraddr.sin_addr.s_addr, (const void *)(&ip_addr), 4); - serveraddr.sin_port = htons(port); fd_set fdset; struct timeval tv; FD_ZERO(&fdset); @@ -340,7 +347,7 @@ int WiFiClient::setOption(int option, int *value) int WiFiClient::getOption(int option, int *value) { - socklen_t size = sizeof(int); + socklen_t size = sizeof(int); int res = getsockopt(fd(), IPPROTO_TCP, option, (char *)value, &size); if(res < 0) { log_e("fail on fd %d, errno: %d, \"%s\"", fd(), errno, strerror(errno)); @@ -574,8 +581,24 @@ IPAddress WiFiClient::remoteIP(int fd) const struct sockaddr_storage addr; socklen_t len = sizeof addr; getpeername(fd, (struct sockaddr*)&addr, &len); - struct sockaddr_in *s = (struct sockaddr_in *)&addr; - return IPAddress((uint32_t)(s->sin_addr.s_addr)); + + // IPv4 socket, old way + if (((struct sockaddr*)&addr)->sa_family == AF_INET) { + struct sockaddr_in *s = (struct sockaddr_in *)&addr; + return IPAddress((uint32_t)(s->sin_addr.s_addr)); + } + + // IPv6, but it might be IPv4 mapped address + if (((struct sockaddr*)&addr)->sa_family == AF_INET6) { + struct sockaddr_in6 *saddr6 = (struct sockaddr_in6 *)&addr; + if (IN6_IS_ADDR_V4MAPPED(saddr6->sin6_addr.un.u32_addr)) { + return IPAddress(IPv4, (uint8_t*)saddr6->sin6_addr.s6_addr+IPADDRESS_V4_BYTES_INDEX); + } else { + return IPAddress(IPv6, (uint8_t*)(saddr6->sin6_addr.s6_addr), saddr6->sin6_scope_id); + } + } + log_e("WiFiClient::remoteIP Not AF_INET or AF_INET6?"); + return (IPAddress(0,0,0,0)); } uint16_t WiFiClient::remotePort(int fd) const @@ -639,3 +662,13 @@ int WiFiClient::fd() const } } +void WiFiClient::setSSE(bool sse) +{ + _sse = sse; +} + +bool WiFiClient::isSSE() +{ + return _sse; +} + diff --git a/libraries/WiFi/src/WiFiClient.h b/libraries/WiFi/src/WiFiClient.h index 06e77c7cd1d..5eee16c8070 100644 --- a/libraries/WiFi/src/WiFiClient.h +++ b/libraries/WiFi/src/WiFiClient.h @@ -42,6 +42,7 @@ class WiFiClient : public ESPLwIPClient std::shared_ptr clientSocketHandle; std::shared_ptr _rxBuffer; bool _connected; + bool _sse; int _timeout; int _lastWriteTimeout; int _lastReadTimeout; @@ -66,12 +67,13 @@ class WiFiClient : public ESPLwIPClient void flush(); void stop(); uint8_t connected(); + void setSSE(bool sse); + bool isSSE(); operator bool() { return connected(); } - WiFiClient & operator=(const WiFiClient &other); bool operator==(const bool value) { return bool() == value; diff --git a/libraries/WiFi/src/WiFiGeneric.cpp b/libraries/WiFi/src/WiFiGeneric.cpp index 8ef803064c4..2fade00e450 100644 --- a/libraries/WiFi/src/WiFiGeneric.cpp +++ b/libraries/WiFi/src/WiFiGeneric.cpp @@ -42,6 +42,7 @@ extern "C" { #include "lwip/opt.h" #include "lwip/err.h" #include "lwip/dns.h" +#include "lwip/netif.h" #include "dhcpserver/dhcpserver.h" #include "dhcpserver/dhcpserver_options.h" @@ -191,16 +192,17 @@ esp_err_t set_esp_interface_ip(esp_interface_t interface, IPAddress local_ip=IPA lease.start_ip.addr = _byte_swap32(lease.start_ip.addr); lease.end_ip.addr = _byte_swap32(lease.end_ip.addr); log_v("DHCP Server Range: %s to %s", IPAddress(lease.start_ip.addr).toString().c_str(), IPAddress(lease.end_ip.addr).toString().c_str()); - err = esp_netif_dhcps_option( - esp_netif, - ESP_NETIF_OP_SET, - ESP_NETIF_SUBNET_MASK, - (void*)&info.netmask.addr, sizeof(info.netmask.addr) - ); - if(err){ - log_e("DHCPS Set Netmask Failed! 0x%04x", err); - return err; - } + // Following block is commented because it breaks AP DHCPS on recent ESP-IDF + // err = esp_netif_dhcps_option( + // esp_netif, + // ESP_NETIF_OP_SET, + // ESP_NETIF_SUBNET_MASK, + // (void*)&info.netmask.addr, sizeof(info.netmask.addr) + // ); + // if(err){ + // log_e("DHCPS Set Netmask Failed! 0x%04x", err); + // return err; + // } err = esp_netif_dhcps_option( esp_netif, ESP_NETIF_OP_SET, @@ -459,7 +461,13 @@ static void _arduino_event_cb(void* arg, esp_event_base_t event_base, int32_t ev } else if (event_base == IP_EVENT && event_id == IP_EVENT_GOT_IP6) { ip_event_got_ip6_t * event = (ip_event_got_ip6_t*)event_data; esp_interface_t iface = get_esp_netif_interface(event->esp_netif); - log_v("IF[%d] Got IPv6: IP Index: %d, Zone: %d, " IPV6STR, iface, event->ip_index, event->ip6_info.ip.zone, IPV62STR(event->ip6_info.ip)); +#if ARDUHAL_LOG_LEVEL >= ARDUHAL_LOG_LEVEL_VERBOSE + char if_name[NETIF_NAMESIZE] = {0,}; + netif_index_to_name(event->ip6_info.ip.zone, if_name); + esp_ip6_addr_type_t addr_type = esp_netif_ip6_get_addr_type(&event->ip6_info.ip); + static const char * addr_types[] = { "UNKNOWN", "GLOBAL", "LINK_LOCAL", "SITE_LOCAL", "UNIQUE_LOCAL", "IPV4_MAPPED_IPV6" }; + log_v("IF %s Got IPv6: Interface: %d, IP Index: %d, Type: %s, Zone: %d (%s), Address: " IPV6STR, esp_netif_get_desc(event->esp_netif), iface, event->ip_index, addr_types[addr_type], event->ip6_info.ip.zone, if_name, IPV62STR(event->ip6_info.ip)); +#endif memcpy(&arduino_event.event_info.got_ip6, event_data, sizeof(ip_event_got_ip6_t)); if(iface == ESP_IF_WIFI_STA){ arduino_event.event_id = ARDUINO_EVENT_WIFI_STA_GOT_IP6; @@ -554,6 +562,8 @@ static void _arduino_event_cb(void* arg, esp_event_base_t event_base, int32_t ev } } +static uint32_t _initial_bits = NET_DNS_IDLE_BIT; + static bool _start_network_event_task(){ if(!_arduino_event_group){ _arduino_event_group = xEventGroupCreate(); @@ -561,7 +571,7 @@ static bool _start_network_event_task(){ log_e("Network Event Group Create Failed!"); return false; } - xEventGroupSetBits(_arduino_event_group, WIFI_DNS_IDLE_BIT); + xEventGroupSetBits(_arduino_event_group, _initial_bits); } if(!_arduino_event_queue){ _arduino_event_queue = xQueueCreate(32, sizeof(arduino_event_t*)); @@ -909,21 +919,23 @@ bool WiFiGenericClass::setHostname(const char * hostname) int WiFiGenericClass::setStatusBits(int bits){ if(!_arduino_event_group){ - return 0; + _initial_bits |= bits; + return _initial_bits; } return xEventGroupSetBits(_arduino_event_group, bits); } int WiFiGenericClass::clearStatusBits(int bits){ if(!_arduino_event_group){ - return 0; + _initial_bits &= ~bits; + return _initial_bits; } return xEventGroupClearBits(_arduino_event_group, bits); } int WiFiGenericClass::getStatusBits(){ if(!_arduino_event_group){ - return 0; + return _initial_bits; } return xEventGroupGetBits(_arduino_event_group); } @@ -1051,12 +1063,16 @@ esp_err_t WiFiGenericClass::_eventCallback(arduino_event_t *event) } } else if(event->event_id == ARDUINO_EVENT_WIFI_STA_STOP) { WiFiSTAClass::_setStatus(WL_STOPPED); - clearStatusBits(STA_STARTED_BIT | STA_CONNECTED_BIT | STA_HAS_IP_BIT | STA_HAS_IP6_BIT); + clearStatusBits(STA_STARTED_BIT | STA_CONNECTED_BIT | STA_HAS_IP_BIT | STA_HAS_IP6_BIT | STA_HAS_IP6_GLOBAL_BIT); } else if(event->event_id == ARDUINO_EVENT_WIFI_STA_CONNECTED) { + if (getStatusBits() & STA_WANT_IP6_BIT){ + esp_err_t err = esp_netif_create_ip6_linklocal(get_esp_interface_netif(ESP_IF_WIFI_STA)); + if(err != ESP_OK){ + log_e("Failed to enable IPv6 Link Local on STA: [%d] %s", err, esp_err_to_name(err)); + } + } WiFiSTAClass::_setStatus(WL_IDLE_STATUS); setStatusBits(STA_CONNECTED_BIT); - - //esp_netif_create_ip6_linklocal(esp_netifs[ESP_IF_WIFI_STA]); } else if(event->event_id == ARDUINO_EVENT_WIFI_STA_DISCONNECTED) { uint8_t reason = event->event_info.wifi_sta_disconnected.reason; // Reason 0 causes crash, use reason 1 (UNSPECIFIED) instead @@ -1074,7 +1090,7 @@ esp_err_t WiFiGenericClass::_eventCallback(arduino_event_t *event) } else { WiFiSTAClass::_setStatus(WL_DISCONNECTED); } - clearStatusBits(STA_CONNECTED_BIT | STA_HAS_IP_BIT | STA_HAS_IP6_BIT); + clearStatusBits(STA_CONNECTED_BIT | STA_HAS_IP_BIT | STA_HAS_IP6_BIT | STA_HAS_IP6_GLOBAL_BIT); bool DoReconnect = false; if(reason == WIFI_REASON_ASSOC_LEAVE) { //Voluntarily disconnected. Don't reconnect! @@ -1113,6 +1129,12 @@ esp_err_t WiFiGenericClass::_eventCallback(arduino_event_t *event) } else if(event->event_id == ARDUINO_EVENT_WIFI_AP_START) { setStatusBits(AP_STARTED_BIT); + if (getStatusBits() & AP_WANT_IP6_BIT){ + esp_err_t err = esp_netif_create_ip6_linklocal(get_esp_interface_netif(ESP_IF_WIFI_AP)); + if(err != ESP_OK){ + log_e("Failed to enable IPv6 Link Local on AP: [%d] %s", err, esp_err_to_name(err)); + } + } } else if(event->event_id == ARDUINO_EVENT_WIFI_AP_STOP) { clearStatusBits(AP_STARTED_BIT | AP_HAS_CLIENT_BIT); } else if(event->event_id == ARDUINO_EVENT_WIFI_AP_STACONNECTED) { @@ -1126,11 +1148,17 @@ esp_err_t WiFiGenericClass::_eventCallback(arduino_event_t *event) } else if(event->event_id == ARDUINO_EVENT_ETH_START) { setStatusBits(ETH_STARTED_BIT); } else if(event->event_id == ARDUINO_EVENT_ETH_STOP) { - clearStatusBits(ETH_STARTED_BIT | ETH_CONNECTED_BIT | ETH_HAS_IP_BIT | ETH_HAS_IP6_BIT); + clearStatusBits(ETH_STARTED_BIT | ETH_CONNECTED_BIT | ETH_HAS_IP_BIT | ETH_HAS_IP6_BIT | ETH_HAS_IP6_GLOBAL_BIT); } else if(event->event_id == ARDUINO_EVENT_ETH_CONNECTED) { + if (getStatusBits() & ETH_WANT_IP6_BIT){ + esp_err_t err = esp_netif_create_ip6_linklocal(get_esp_interface_netif(ESP_IF_ETH)); + if(err != ESP_OK){ + log_e("Failed to enable IPv6 Link Local on ETH: [%d] %s", err, esp_err_to_name(err)); + } + } setStatusBits(ETH_CONNECTED_BIT); } else if(event->event_id == ARDUINO_EVENT_ETH_DISCONNECTED) { - clearStatusBits(ETH_CONNECTED_BIT | ETH_HAS_IP_BIT | ETH_HAS_IP6_BIT); + clearStatusBits(ETH_CONNECTED_BIT | ETH_HAS_IP_BIT | ETH_HAS_IP6_BIT | ETH_HAS_IP6_GLOBAL_BIT); } else if(event->event_id == ARDUINO_EVENT_ETH_GOT_IP) { #if ARDUHAL_LOG_LEVEL >= ARDUHAL_LOG_LEVEL_DEBUG uint8_t * ip = (uint8_t *)&(event->event_info.got_ip.ip_info.ip.addr); @@ -1146,11 +1174,26 @@ esp_err_t WiFiGenericClass::_eventCallback(arduino_event_t *event) clearStatusBits(ETH_HAS_IP_BIT); } else if(event->event_id == ARDUINO_EVENT_WIFI_STA_GOT_IP6) { - setStatusBits(STA_CONNECTED_BIT | STA_HAS_IP6_BIT); + setStatusBits(STA_CONNECTED_BIT); + esp_ip6_addr_type_t addr_type = esp_netif_ip6_get_addr_type((esp_ip6_addr_t*)&(event->event_info.got_ip6.ip6_info.ip)); + if(addr_type == ESP_IP6_ADDR_IS_GLOBAL){ + setStatusBits(STA_HAS_IP6_GLOBAL_BIT); + } else if(addr_type == ESP_IP6_ADDR_IS_LINK_LOCAL){ + setStatusBits(STA_HAS_IP6_BIT); + } } else if(event->event_id == ARDUINO_EVENT_WIFI_AP_GOT_IP6) { - setStatusBits(AP_HAS_IP6_BIT); + esp_ip6_addr_type_t addr_type = esp_netif_ip6_get_addr_type((esp_ip6_addr_t*)&(event->event_info.got_ip6.ip6_info.ip)); + if(addr_type == ESP_IP6_ADDR_IS_LINK_LOCAL){ + setStatusBits(AP_HAS_IP6_BIT); + } } else if(event->event_id == ARDUINO_EVENT_ETH_GOT_IP6) { - setStatusBits(ETH_CONNECTED_BIT | ETH_HAS_IP6_BIT); + setStatusBits(ETH_CONNECTED_BIT); + esp_ip6_addr_type_t addr_type = esp_netif_ip6_get_addr_type((esp_ip6_addr_t*)&(event->event_info.got_ip6.ip6_info.ip)); + if(addr_type == ESP_IP6_ADDR_IS_GLOBAL){ + setStatusBits(ETH_HAS_IP6_GLOBAL_BIT); + } else if(addr_type == ESP_IP6_ADDR_IS_LINK_LOCAL){ + setStatusBits(ETH_HAS_IP6_BIT); + } } else if(event->event_id == ARDUINO_EVENT_SC_GOT_SSID_PSWD) { WiFi.begin( (const char *)event->event_info.sc_got_ssid_pswd.ssid, @@ -1546,6 +1589,13 @@ bool WiFiGenericClass::setDualAntennaConfig(uint8_t gpio_ant1, uint8_t gpio_ant2 // ------------------------------------------------ Generic Network function --------------------------------------------- // ----------------------------------------------------------------------------------------------------------------------- +typedef struct gethostbynameParameters { + const char *hostname; + ip_addr_t addr; + uint8_t addr_type; + int result; +} gethostbynameParameters_t; + /** * DNS callback * @param name @@ -1554,18 +1604,18 @@ bool WiFiGenericClass::setDualAntennaConfig(uint8_t gpio_ant1, uint8_t gpio_ant2 */ static void wifi_dns_found_callback(const char *name, const ip_addr_t *ipaddr, void *callback_arg) { + gethostbynameParameters_t *parameters = static_cast(callback_arg); if(ipaddr) { - (*reinterpret_cast(callback_arg)) = ipaddr->u_addr.ip4.addr; + if(parameters->result == 0){ + memcpy(&(parameters->addr), ipaddr, sizeof(ip_addr_t)); + parameters->result = 1; + } + } else { + parameters->result = -1; } - xEventGroupSetBits(_arduino_event_group, WIFI_DNS_DONE_BIT); + xEventGroupSetBits(_arduino_event_group, NET_DNS_DONE_BIT); } -typedef struct gethostbynameParameters { - const char *hostname; - ip_addr_t addr; - void *callback_arg; -} gethostbynameParameters_t; - /** * Callback to execute dns_gethostbyname in lwIP's TCP/IP context * @param param Parameters for dns_gethostbyname call @@ -1573,39 +1623,60 @@ typedef struct gethostbynameParameters { static esp_err_t wifi_gethostbyname_tcpip_ctx(void *param) { gethostbynameParameters_t *parameters = static_cast(param); - return dns_gethostbyname(parameters->hostname, ¶meters->addr, &wifi_dns_found_callback, parameters->callback_arg); + return dns_gethostbyname_addrtype(parameters->hostname, ¶meters->addr, &wifi_dns_found_callback, parameters, parameters->addr_type); } /** - * Resolve the given hostname to an IP address. If passed hostname is an IP address, it will be parsed into IPAddress structure. - * @param aHostname Name to be resolved or string containing IP address + * Resolve the given hostname to an IP address. + * @param aHostname Name to be resolved * @param aResult IPAddress structure to store the returned IP address * @return 1 if aIPAddrString was successfully converted to an IP address, * else error code */ -int WiFiGenericClass::hostByName(const char* aHostname, IPAddress& aResult) +int WiFiGenericClass::hostByName(const char* aHostname, IPAddress& aResult, bool preferV6) { - if (!aResult.fromString(aHostname)) - { - gethostbynameParameters_t params; - params.hostname = aHostname; - params.callback_arg = &aResult; - aResult = static_cast(0); - waitStatusBits(WIFI_DNS_IDLE_BIT, 16000); - clearStatusBits(WIFI_DNS_IDLE_BIT | WIFI_DNS_DONE_BIT); - err_t err = esp_netif_tcpip_exec(wifi_gethostbyname_tcpip_ctx, ¶ms); - if(err == ERR_OK && params.addr.u_addr.ip4.addr) { - aResult = params.addr.u_addr.ip4.addr; - } else if(err == ERR_INPROGRESS) { - waitStatusBits(WIFI_DNS_DONE_BIT, 15000); //real internal timeout in lwip library is 14[s] - clearStatusBits(WIFI_DNS_DONE_BIT); - } - setStatusBits(WIFI_DNS_IDLE_BIT); - if((uint32_t)aResult == 0){ - log_e("DNS Failed for %s", aHostname); + err_t err = ERR_OK; + gethostbynameParameters_t params; + + // This should generally check if we have a global address assigned to one of the interfaces. + // If such address is not assigned, there is no point in trying to get V6 from DNS as we will not be able to reach it. + // That is of course, if 'preferV6' is not set to true + static bool hasGlobalV6 = false; + bool hasGlobalV6Now = (getStatusBits() & NET_HAS_IP6_GLOBAL_BIT) != 0; + if(hasGlobalV6 != hasGlobalV6Now){ + hasGlobalV6 = hasGlobalV6Now; + dns_clear_cache(); + log_d("Clearing DNS cache"); + } + + aResult = static_cast(0); + params.hostname = aHostname; + params.addr_type = (preferV6 || hasGlobalV6)?LWIP_DNS_ADDRTYPE_IPV6_IPV4:LWIP_DNS_ADDRTYPE_IPV4; + params.result = 0; + aResult.to_ip_addr_t(&(params.addr)); + + if (!aResult.fromString(aHostname)) { + waitStatusBits(NET_DNS_IDLE_BIT, 16000); + clearStatusBits(NET_DNS_IDLE_BIT | NET_DNS_DONE_BIT); + + err = esp_netif_tcpip_exec(wifi_gethostbyname_tcpip_ctx, ¶ms); + if (err == ERR_OK) { + aResult.from_ip_addr_t(&(params.addr)); + } else if (err == ERR_INPROGRESS) { + waitStatusBits(NET_DNS_DONE_BIT, 15000); //real internal timeout in lwip library is 14[s] + clearStatusBits(NET_DNS_DONE_BIT); + if (params.result == 1) { + aResult.from_ip_addr_t(&(params.addr)); + err = ERR_OK; + } } + setStatusBits(NET_DNS_IDLE_BIT); + } + if (err == ERR_OK) { + return 1; } - return (uint32_t)aResult != 0; + log_e("DNS Failed for '%s' with error '%d' and result '%d'", aHostname, err, params.result); + return err; } IPAddress WiFiGenericClass::calculateNetworkID(IPAddress ip, IPAddress subnet) { diff --git a/libraries/WiFi/src/WiFiGeneric.h b/libraries/WiFi/src/WiFiGeneric.h index 38396f5a72e..3de43905416 100644 --- a/libraries/WiFi/src/WiFiGeneric.h +++ b/libraries/WiFi/src/WiFiGeneric.h @@ -32,6 +32,7 @@ #include "esp_netif_types.h" #include "esp_eth_driver.h" #include "wifi_provisioning/manager.h" +#include "lwip/ip_addr.h" ESP_EVENT_DECLARE_BASE(ARDUINO_EVENTS); @@ -111,6 +112,34 @@ typedef void (*WiFiEventSysCb)(arduino_event_t *event); typedef size_t wifi_event_id_t; +// General Flags +static const int NET_DNS_IDLE_BIT = BIT0; +static const int NET_DNS_DONE_BIT = BIT1; +// WiFi Scan Flags +static const int WIFI_SCANNING_BIT = BIT2; +static const int WIFI_SCAN_DONE_BIT = BIT3; +// AP Flags +static const int AP_STARTED_BIT = BIT4; +static const int AP_HAS_IP6_BIT = BIT5; +static const int AP_HAS_CLIENT_BIT = BIT6; +static const int AP_WANT_IP6_BIT = BIT7; +// STA Flags +static const int STA_STARTED_BIT = BIT8; +static const int STA_CONNECTED_BIT = BIT9; +static const int STA_HAS_IP_BIT = BIT10; +static const int STA_HAS_IP6_BIT = BIT11; +static const int STA_HAS_IP6_GLOBAL_BIT = BIT12; +static const int STA_WANT_IP6_BIT = BIT13; +// ETH Flags +static const int ETH_STARTED_BIT = BIT14; +static const int ETH_CONNECTED_BIT = BIT15; +static const int ETH_HAS_IP_BIT = BIT16; +static const int ETH_HAS_IP6_BIT = BIT17; +static const int ETH_HAS_IP6_GLOBAL_BIT = BIT18; +static const int ETH_WANT_IP6_BIT = BIT19; +// Masks +static const int NET_HAS_IP6_GLOBAL_BIT = STA_HAS_IP6_GLOBAL_BIT | ETH_HAS_IP6_GLOBAL_BIT; + typedef enum { WIFI_POWER_19_5dBm = 78,// 19.5dBm WIFI_POWER_19dBm = 76,// 19dBm @@ -126,22 +155,6 @@ typedef enum { WIFI_POWER_MINUS_1dBm = -4// -1dBm } wifi_power_t; -static const int AP_STARTED_BIT = BIT0; -static const int AP_HAS_IP6_BIT = BIT1; -static const int AP_HAS_CLIENT_BIT = BIT2; -static const int STA_STARTED_BIT = BIT3; -static const int STA_CONNECTED_BIT = BIT4; -static const int STA_HAS_IP_BIT = BIT5; -static const int STA_HAS_IP6_BIT = BIT6; -static const int ETH_STARTED_BIT = BIT7; -static const int ETH_CONNECTED_BIT = BIT8; -static const int ETH_HAS_IP_BIT = BIT9; -static const int ETH_HAS_IP6_BIT = BIT10; -static const int WIFI_SCANNING_BIT = BIT11; -static const int WIFI_SCAN_DONE_BIT= BIT12; -static const int WIFI_DNS_IDLE_BIT = BIT13; -static const int WIFI_DNS_DONE_BIT = BIT14; - typedef enum { WIFI_RX_ANT0 = 0, WIFI_RX_ANT1, @@ -216,7 +229,7 @@ class WiFiGenericClass static bool _isReconnectableReason(uint8_t reason); public: - static int hostByName(const char *aHostname, IPAddress &aResult); + static int hostByName(const char *aHostname, IPAddress &aResult, bool preferV6=false); static IPAddress calculateNetworkID(IPAddress ip, IPAddress subnet); static IPAddress calculateBroadcast(IPAddress ip, IPAddress subnet); @@ -226,6 +239,7 @@ class WiFiGenericClass friend class WiFiSTAClass; friend class WiFiScanClass; friend class WiFiAPClass; + friend class ETHClass; }; #endif /* ESP32WIFIGENERIC_H_ */ diff --git a/libraries/WiFi/src/WiFiMulti.cpp b/libraries/WiFi/src/WiFiMulti.cpp index 3d69e481293..60a25be4285 100644 --- a/libraries/WiFi/src/WiFiMulti.cpp +++ b/libraries/WiFi/src/WiFiMulti.cpp @@ -30,12 +30,12 @@ WiFiMulti::WiFiMulti() { + ipv6_support = false; } -WiFiMulti::~WiFiMulti() +void WiFiMulti::APlistClean(void) { - for(uint32_t i = 0; i < APlist.size(); i++) { - WifiAPlist_t entry = APlist[i]; + for(auto entry : APlist) { if(entry.ssid) { free(entry.ssid); } @@ -46,17 +46,22 @@ WiFiMulti::~WiFiMulti() APlist.clear(); } +WiFiMulti::~WiFiMulti() +{ + APlistClean(); +} + bool WiFiMulti::addAP(const char* ssid, const char *passphrase) { WifiAPlist_t newAP; - if(!ssid || *ssid == 0x00 || strlen(ssid) > 31) { + if(!ssid || *ssid == '\0' || strlen(ssid) > 31) { // fail SSID too long or missing! log_e("[WIFI][APlistAdd] no ssid or ssid too long"); return false; } - if(passphrase && strlen(passphrase) > 64) { + if(passphrase && strlen(passphrase) > 63) { // fail passphrase too long! log_e("[WIFI][APlistAdd] passphrase too long"); return false; @@ -69,7 +74,7 @@ bool WiFiMulti::addAP(const char* ssid, const char *passphrase) return false; } - if(passphrase && *passphrase != 0x00) { + if(passphrase && *passphrase != '\0') { newAP.passphrase = strdup(passphrase); if(!newAP.passphrase) { log_e("[WIFI][APlistAdd] fail newAP.passphrase == 0"); @@ -79,20 +84,32 @@ bool WiFiMulti::addAP(const char* ssid, const char *passphrase) } else { newAP.passphrase = NULL; } - + newAP.hasFailed = false; APlist.push_back(newAP); log_i("[WIFI][APlistAdd] add SSID: %s", newAP.ssid); return true; } -uint8_t WiFiMulti::run(uint32_t connectTimeout) +uint8_t WiFiMulti::run(uint32_t connectTimeout, bool scanHidden) { int8_t scanResult; + unsigned long startTime; uint8_t status = WiFi.status(); if(status == WL_CONNECTED) { - for(uint32_t x = 0; x < APlist.size(); x++) { - if(WiFi.SSID()==APlist[x].ssid) { + if (!_bWFMInit && _connectionTestCBFunc != NULL){ + if (_connectionTestCBFunc() == true) { + _bWFMInit = true; + return status; + } + } else { + if (!_bStrict) { return status; + } else { + for(auto ap : APlist) { + if(WiFi.SSID() == ap.ssid) { + return status; + } + } } } WiFi.disconnect(false,false); @@ -100,23 +117,28 @@ uint8_t WiFiMulti::run(uint32_t connectTimeout) status = WiFi.status(); } - scanResult = WiFi.scanNetworks(); - if(scanResult == WIFI_SCAN_RUNNING) { + scanResult = WiFi.scanNetworks(false, scanHidden); + if (scanResult == WIFI_SCAN_RUNNING) { // scan is running return WL_NO_SSID_AVAIL; - } else if(scanResult >= 0) { + } else if (scanResult >= 0) { // scan done analyze - WifiAPlist_t bestNetwork { NULL, NULL }; + int32_t bestIndex = -1; + WifiAPlist_t bestNetwork { NULL, NULL, false }; int bestNetworkDb = INT_MIN; + int bestNetworkSec = WIFI_AUTH_MAX; uint8_t bestBSSID[6]; int32_t bestChannel = 0; log_i("[WIFI] scan done"); - if(scanResult == 0) { + if (scanResult == 0) { log_e("[WIFI] no networks found"); } else { log_i("[WIFI] %d networks found", scanResult); + + int8_t failCount = 0; + int8_t foundCount = 0; for(int8_t i = 0; i < scanResult; ++i) { String ssid_scan; @@ -124,47 +146,133 @@ uint8_t WiFiMulti::run(uint32_t connectTimeout) uint8_t sec_scan; uint8_t* BSSID_scan; int32_t chan_scan; + bool hidden_scan; WiFi.getNetworkInfo(i, ssid_scan, sec_scan, rssi_scan, BSSID_scan, chan_scan); + hidden_scan = (ssid_scan.length() == 0) && scanHidden; + // add any Open WiFi AP to the list, if allowed with setAllowOpenAP(true) + if (_bAllowOpenAP && sec_scan == WIFI_AUTH_OPEN){ + bool found = false; + for(auto check : APlist) { + if (ssid_scan == check.ssid){ + found = true; + break; + } + } + // If we didn't find it, add this Open WiFi AP to the list + if (!found){ + log_i("[WIFI][APlistAdd] adding Open WiFi SSID: %s", ssid_scan.c_str()); + addAP(ssid_scan.c_str()); + } + } + + if (hidden_scan) { + log_v("hidden ssid on channel %d found, trying to connect with known credentials...", chan_scan); + } bool known = false; - for(uint32_t x = APlist.size() ; x > 0; x--) { - WifiAPlist_t entry = APlist[x-1]; - - if(ssid_scan == entry.ssid) { // SSID match - known = true; - if(rssi_scan > bestNetworkDb) { // best network - if(sec_scan == WIFI_AUTH_OPEN || entry.passphrase) { // check for passphrase if not open wlan - bestNetworkDb = rssi_scan; - bestChannel = chan_scan; - memcpy((void*) &bestNetwork, (void*) &entry, sizeof(bestNetwork)); - memcpy((void*) &bestBSSID, (void*) BSSID_scan, sizeof(bestBSSID)); + for(uint32_t x = 0; x < APlist.size(); x++) { + WifiAPlist_t entry = APlist[x]; + + if(ssid_scan == entry.ssid || hidden_scan) { // SSID match or hidden network found + if (!hidden_scan) { + log_v("known ssid: %s, has failed: %s", entry.ssid, entry.hasFailed ? "yes" : "no"); + foundCount++; + } + if (!entry.hasFailed) { + if (hidden_scan) { + WiFi.begin(entry.ssid, entry.passphrase, chan_scan, BSSID_scan); + + // If the ssid returned from the scan is empty, it is a hidden SSID + // it appears that the WiFi.begin() function is asynchronous and takes + // additional time to connect to a hidden SSID. Therefore a delay of 1000ms + // is added for hidden SSIDs before calling WiFi.status() + delay(1000); + + status = WiFi.status(); + startTime = millis(); + + while (status != WL_CONNECTED && (millis() - startTime) <= connectTimeout) + { + delay(10); + status = WiFi.status(); + } + + WiFi.disconnect(); + delay(10); + + if (status == WL_CONNECTED) { + log_v("hidden ssid %s found", entry.ssid); + ssid_scan = entry.ssid; + foundCount++; + } else { + continue; + } + } + known = true; + log_v("rssi_scan: %d, bestNetworkDb: %d", rssi_scan, bestNetworkDb); + if(rssi_scan > bestNetworkDb) { // best network + if(_bAllowOpenAP || (sec_scan == WIFI_AUTH_OPEN || entry.passphrase)) { // check for passphrase if not open wlan + log_v("best network is now: %s", ssid_scan); + bestIndex = x; + bestNetworkSec = sec_scan; + bestNetworkDb = rssi_scan; + bestChannel = chan_scan; + memcpy((void*) &bestNetwork, (void*) &entry, sizeof(bestNetwork)); + memcpy((void*) &bestBSSID, (void*) BSSID_scan, sizeof(bestBSSID)); + } } + break; + } else { + failCount++; } - break; } } - if(known) { - log_d(" ---> %d: [%d][%02X:%02X:%02X:%02X:%02X:%02X] %s (%d) %c", i, chan_scan, BSSID_scan[0], BSSID_scan[1], BSSID_scan[2], BSSID_scan[3], BSSID_scan[4], BSSID_scan[5], ssid_scan.c_str(), rssi_scan, (sec_scan == WIFI_AUTH_OPEN) ? ' ' : '*'); + if (known) { + log_d(" ---> %d: [%d][%02X:%02X:%02X:%02X:%02X:%02X] %s (%d) (%c) (%s)", + i, + chan_scan, + BSSID_scan[0], BSSID_scan[1], BSSID_scan[2], BSSID_scan[3], BSSID_scan[4], BSSID_scan[5], + ssid_scan.c_str(), + rssi_scan, + (sec_scan == WIFI_AUTH_OPEN) ? ' ' : '*', + (hidden_scan) ? "hidden" : "visible"); } else { - log_d(" %d: [%d][%02X:%02X:%02X:%02X:%02X:%02X] %s (%d) %c", i, chan_scan, BSSID_scan[0], BSSID_scan[1], BSSID_scan[2], BSSID_scan[3], BSSID_scan[4], BSSID_scan[5], ssid_scan.c_str(), rssi_scan, (sec_scan == WIFI_AUTH_OPEN) ? ' ' : '*'); + log_d(" %d: [%d][%02X:%02X:%02X:%02X:%02X:%02X] %s (%d) (%c) (%s)", + i, + chan_scan, + BSSID_scan[0], BSSID_scan[1], BSSID_scan[2], BSSID_scan[3], BSSID_scan[4], BSSID_scan[5], + ssid_scan.c_str(), + rssi_scan, + (sec_scan == WIFI_AUTH_OPEN) ? ' ' : '*', + (hidden_scan) ? "hidden" : "visible"); } } + log_v("foundCount = %d, failCount = %d", foundCount, failCount); + // if all the APs in the list have failed, reset the failure flags + if (foundCount == failCount) { + resetFails(); // keeps trying the APs in the list + } } - // clean up ram WiFi.scanDelete(); - if(bestNetwork.ssid) { + if(bestIndex >= 0) { log_i("[WIFI] Connecting BSSID: %02X:%02X:%02X:%02X:%02X:%02X SSID: %s Channel: %d (%d)", bestBSSID[0], bestBSSID[1], bestBSSID[2], bestBSSID[3], bestBSSID[4], bestBSSID[5], bestNetwork.ssid, bestChannel, bestNetworkDb); - WiFi.begin(bestNetwork.ssid, bestNetwork.passphrase, bestChannel, bestBSSID); + if (ipv6_support == true) { + WiFi.enableIPv6(); + } + WiFi.disconnect(); + delay(10); + WiFi.begin(bestNetwork.ssid, (_bAllowOpenAP && bestNetworkSec == WIFI_AUTH_OPEN) ? NULL : bestNetwork.passphrase, bestChannel, bestBSSID); status = WiFi.status(); + _bWFMInit = true; - auto startTime = millis(); + startTime = millis(); // wait for connection, fail, or timeout - while(status != WL_CONNECTED && status != WL_NO_SSID_AVAIL && status != WL_CONNECT_FAILED && (millis() - startTime) <= connectTimeout) { + while(status != WL_CONNECTED && (millis() - startTime) <= connectTimeout) { // && status != WL_NO_SSID_AVAIL && status != WL_CONNECT_FAILED delay(10); status = WiFi.status(); } @@ -176,15 +284,32 @@ uint8_t WiFiMulti::run(uint32_t connectTimeout) log_d("[WIFI] IP: %s", WiFi.localIP().toString().c_str()); log_d("[WIFI] MAC: %s", WiFi.BSSIDstr().c_str()); log_d("[WIFI] Channel: %d", WiFi.channel()); + + if (_connectionTestCBFunc != NULL) { + // We connected to an AP but if it's a captive portal we're not going anywhere. Test it. + if (_connectionTestCBFunc()) { + resetFails(); + } else { + markAsFailed(bestIndex); + WiFi.disconnect(); + delay(10); + status = WiFi.status(); + } + } else { + resetFails(); + } break; case WL_NO_SSID_AVAIL: log_e("[WIFI] Connecting Failed AP not found."); + markAsFailed(bestIndex); break; case WL_CONNECT_FAILED: log_e("[WIFI] Connecting Failed."); + markAsFailed(bestIndex); break; default: log_e("[WIFI] Connecting Failed (%d).", status); + markAsFailed(bestIndex); break; } } else { @@ -202,3 +327,31 @@ uint8_t WiFiMulti::run(uint32_t connectTimeout) return status; } + +void WiFiMulti::enableIPv6(bool state) { + ipv6_support = state; +} + +void WiFiMulti::markAsFailed(int32_t i) { + APlist[i].hasFailed = true; + log_d("[WIFI] Marked SSID %s as failed", APlist[i].ssid); +} + +void WiFiMulti::resetFails(){ + for(uint32_t i = 0; i < APlist.size(); i++) { + APlist[i].hasFailed = false; + } + log_d("[WIFI] Resetting failure flags"); +} + +void WiFiMulti::setStrictMode(bool bStrict) { + _bStrict = bStrict; +} + +void WiFiMulti::setAllowOpenAP(bool bAllowOpenAP) { + _bAllowOpenAP = bAllowOpenAP; +} + +void WiFiMulti::setConnectionTestCallbackFunc(ConnectionTestCB_t cbFunc) { + _connectionTestCBFunc = cbFunc; +} diff --git a/libraries/WiFi/src/WiFiMulti.h b/libraries/WiFi/src/WiFiMulti.h index 38ddb5d9f95..9dfac2c4204 100644 --- a/libraries/WiFi/src/WiFiMulti.h +++ b/libraries/WiFi/src/WiFiMulti.h @@ -32,8 +32,11 @@ typedef struct { char * ssid; char * passphrase; + bool hasFailed; } WifiAPlist_t; +typedef std::function ConnectionTestCB_t; + class WiFiMulti { public: @@ -41,11 +44,36 @@ class WiFiMulti ~WiFiMulti(); bool addAP(const char* ssid, const char *passphrase = NULL); + uint8_t run(uint32_t connectTimeout=5000, bool scanHidden=false); + void enableIPv6(bool state); + + // Force (default: true) to only keep connected or to connect to an AP from the provided WiFiMulti list. + // When bStrict is false, it will keep the last/current connected AP even if not in the WiFiMulti List. + void setStrictMode(bool bStrict = true); + + // allows (true) to connect to ANY open AP, even if not in the user list + // default false (do not connect to an open AP that has not been explicitaly added by the user to list) + void setAllowOpenAP(bool bAllowOpenAP = false); + + // clears the current list of Multi APs and frees the memory + void APlistClean(void); - uint8_t run(uint32_t connectTimeout=5000); + // allow the user to define a callback function that will validate the connection to the Internet. + // if the callback returns true, the connection is considered valid and the AP will added to the validated AP list. + // set the callback to NULL to disable the feature and validate any SSID that is in the list. + void setConnectionTestCallbackFunc(ConnectionTestCB_t cbFunc); private: std::vector APlist; + bool ipv6_support; + + bool _bStrict = true; + bool _bAllowOpenAP = false; + ConnectionTestCB_t _connectionTestCBFunc = NULL; + bool _bWFMInit = false; + + void markAsFailed(int32_t i); + void resetFails(); }; #endif /* WIFICLIENTMULTI_H_ */ diff --git a/libraries/WiFi/src/WiFiSTA.cpp b/libraries/WiFi/src/WiFiSTA.cpp index 505940015f9..02e930943c3 100644 --- a/libraries/WiFi/src/WiFiSTA.cpp +++ b/libraries/WiFi/src/WiFiSTA.cpp @@ -367,13 +367,12 @@ bool WiFiSTAClass::reconnect() * @param eraseap `true` to erase the AP configuration from the NVS memory. * @return `true` when successful. */ -bool WiFiSTAClass::disconnect(bool wifioff, bool eraseap) +bool WiFiSTAClass::disconnectAsync(bool wifioff, bool eraseap) { wifi_config_t conf; wifi_sta_config(&conf); if(WiFi.getMode() & WIFI_MODE_STA){ - _useStaticIp = false; if(eraseap){ if(esp_wifi_set_config((wifi_interface_t)ESP_IF_WIFI_STA, &conf)){ log_e("clear config failed!"); @@ -392,6 +391,31 @@ bool WiFiSTAClass::disconnect(bool wifioff, bool eraseap) return false; } +/** + * Disconnect from the network. + * @param wifioff `true` to turn the Wi-Fi radio off. + * @param eraseap `true` to erase the AP configuration from the NVS memory. + * @param timeoutLength timeout to wait for status change + * @return `true` when successful. + */ +bool WiFiSTAClass::disconnect(bool wifioff, bool eraseap, unsigned long timeoutLength) +{ + if (!disconnectAsync(wifioff, eraseap)) { + return false; + } + if (!timeoutLength) { + return true; + } + const unsigned long start = millis(); + while ((WiFiGenericClass::getStatusBits() & STA_CONNECTED_BIT) != 0) { + if((millis() - start) >= timeoutLength){ + return false; + } + delay(2); + } + return true; +} + /** * @brief Reset WiFi settings in NVS to default values. * @return true if erase succeeded @@ -806,30 +830,50 @@ int8_t WiFiSTAClass::RSSI(void) /** * Enable IPv6 on the station interface. + * Should be called before WiFi.begin() + * * @return true on success */ -bool WiFiSTAClass::enableIpV6() +bool WiFiSTAClass::enableIPv6(bool en) +{ + if (en) { + WiFiGenericClass::setStatusBits(STA_WANT_IP6_BIT); + } else { + WiFiGenericClass::clearStatusBits(STA_WANT_IP6_BIT); + } + return true; +} + +/** + * Get the station interface link-local IPv6 address. + * @return IPAddress + */ +IPAddress WiFiSTAClass::localIPv6() { + static esp_ip6_addr_t addr; if(WiFiGenericClass::getMode() == WIFI_MODE_NULL){ - return false; + return IPAddress(IPv6); + } + if(esp_netif_get_ip6_linklocal(get_esp_interface_netif(ESP_IF_WIFI_STA), &addr)){ + return IPAddress(IPv6); } - return esp_netif_create_ip6_linklocal(get_esp_interface_netif(ESP_IF_WIFI_STA)) == ESP_OK; + return IPAddress(IPv6, (const uint8_t *)addr.addr, addr.zone); } /** - * Get the station interface IPv6 address. - * @return IPv6Address + * Get the station interface global IPv6 address. + * @return IPAddress */ -IPv6Address WiFiSTAClass::localIPv6() +IPAddress WiFiSTAClass::globalIPv6() { - esp_ip6_addr_t addr; + static esp_ip6_addr_t addr; if(WiFiGenericClass::getMode() == WIFI_MODE_NULL){ - return IPv6Address(); + return IPAddress(IPv6); } - if(esp_netif_get_ip6_linklocal(get_esp_interface_netif(ESP_IF_WIFI_STA), &addr)) { - return IPv6Address(); + if(esp_netif_get_ip6_global(get_esp_interface_netif(ESP_IF_WIFI_STA), &addr)){ + return IPAddress(IPv6); } - return IPv6Address(addr.addr); + return IPAddress(IPv6, (const uint8_t *)addr.addr, addr.zone); } diff --git a/libraries/WiFi/src/WiFiSTA.h b/libraries/WiFi/src/WiFiSTA.h index 07f01922cef..f66a9e3aa0c 100644 --- a/libraries/WiFi/src/WiFiSTA.h +++ b/libraries/WiFi/src/WiFiSTA.h @@ -61,7 +61,8 @@ class WiFiSTAClass bool bandwidth(wifi_bandwidth_t bandwidth); bool reconnect(); - bool disconnect(bool wifioff = false, bool eraseap = false); + bool disconnectAsync(bool wifioff = false, bool eraseap = false); + bool disconnect(bool wifioff = false, bool eraseap = false, unsigned long timeoutLength = 100); bool eraseAP(void); bool isConnected(); @@ -93,8 +94,9 @@ class WiFiSTAClass IPAddress networkID(); uint8_t subnetCIDR(); - bool enableIpV6(); - IPv6Address localIPv6(); + bool enableIPv6(bool en=true); + IPAddress localIPv6(); + IPAddress globalIPv6(); // STA WiFi info static wl_status_t status(); diff --git a/libraries/WiFi/src/WiFiServer.cpp b/libraries/WiFi/src/WiFiServer.cpp index ef59cf14d6d..2e8dcc9e350 100644 --- a/libraries/WiFi/src/WiFiServer.cpp +++ b/libraries/WiFi/src/WiFiServer.cpp @@ -32,12 +32,6 @@ int WiFiServer::setTimeout(uint32_t seconds){ return setsockopt(sockfd, SOL_SOCKET, SO_SNDTIMEO, (char *)&tv, sizeof(struct timeval)); } -size_t WiFiServer::write(const uint8_t *data, size_t len){ - return 0; -} - -void WiFiServer::stopAll(){} - WiFiClient WiFiServer::available(){ return accept(); } @@ -51,8 +45,8 @@ WiFiClient WiFiServer::accept(){ _accepted_sockfd = -1; } else { - struct sockaddr_in _client; - int cs = sizeof(struct sockaddr_in); + struct sockaddr_in6 _client; + int cs = sizeof(struct sockaddr_in6); #ifdef ESP_IDF_VERSION_MAJOR client_sock = lwip_accept(sockfd, (struct sockaddr *)&_client, (socklen_t*)&cs); #else @@ -80,14 +74,21 @@ void WiFiServer::begin(uint16_t port, int enable){ if(port){ _port = port; } - struct sockaddr_in server; - sockfd = socket(AF_INET , SOCK_STREAM, 0); + struct sockaddr_in6 server; + sockfd = socket(AF_INET6 , SOCK_STREAM, 0); if (sockfd < 0) return; setsockopt(sockfd, SOL_SOCKET, SO_REUSEADDR, &enable, sizeof(int)); - server.sin_family = AF_INET; - server.sin_addr.s_addr = _addr; - server.sin_port = htons(_port); + server.sin6_family = AF_INET6; + if (_addr.type() == IPv4) { + memcpy(server.sin6_addr.s6_addr+11, (uint8_t*)&_addr[0], 4); + server.sin6_addr.s6_addr[10] = 0xFF; + server.sin6_addr.s6_addr[11] = 0xFF; + } else { + memcpy(server.sin6_addr.s6_addr, (uint8_t*)&_addr[0], 16); + } + memset(server.sin6_addr.s6_addr, 0x0, 16); + server.sin6_port = htons(_port); if(bind(sockfd, (struct sockaddr *)&server, sizeof(server)) < 0) return; if(listen(sockfd , _max_clients) < 0) @@ -110,8 +111,8 @@ bool WiFiServer::hasClient() { if (_accepted_sockfd >= 0) { return true; } - struct sockaddr_in _client; - int cs = sizeof(struct sockaddr_in); + struct sockaddr_in6 _client; + int cs = sizeof(struct sockaddr_in6); #ifdef ESP_IDF_VERSION_MAJOR _accepted_sockfd = lwip_accept(sockfd, (struct sockaddr *)&_client, (socklen_t*)&cs); #else @@ -140,4 +141,3 @@ void WiFiServer::close(){ void WiFiServer::stop(){ end(); } - diff --git a/libraries/WiFi/src/WiFiServer.h b/libraries/WiFi/src/WiFiServer.h index b9db726b9b7..bef9b9b1e3b 100644 --- a/libraries/WiFi/src/WiFiServer.h +++ b/libraries/WiFi/src/WiFiServer.h @@ -24,7 +24,7 @@ #include "WiFiClient.h" #include "IPAddress.h" -class WiFiServer : public Server { +class WiFiServer { private: int sockfd; int _accepted_sockfd = -1; @@ -37,7 +37,6 @@ class WiFiServer : public Server { public: void listenOnLocalhost(){} - // _addr(INADDR_ANY) is the same as _addr() ==> 0.0.0.0 WiFiServer(uint16_t port=80, uint8_t max_clients=4):sockfd(-1),_accepted_sockfd(-1),_addr(),_port(port),_max_clients(max_clients),_listening(false),_noDelay(false) { log_v("WiFiServer::WiFiServer(port=%d, ...)", port); } @@ -52,18 +51,12 @@ class WiFiServer : public Server { void setNoDelay(bool nodelay); bool getNoDelay(); bool hasClient(); - size_t write(const uint8_t *data, size_t len); - size_t write(uint8_t data){ - return write(&data, 1); - } - using Print::write; void end(); void close(); void stop(); operator bool(){return _listening;} int setTimeout(uint32_t seconds); - void stopAll(); }; #endif /* _WIFISERVER_H_ */ diff --git a/libraries/WiFi/src/WiFiUdp.cpp b/libraries/WiFi/src/WiFiUdp.cpp index 6b053bbbd14..5d8b513a2d8 100644 --- a/libraries/WiFi/src/WiFiUdp.cpp +++ b/libraries/WiFi/src/WiFiUdp.cpp @@ -51,7 +51,11 @@ uint8_t WiFiUDP::begin(IPAddress address, uint16_t port){ } tx_buffer_len = 0; +#if LWIP_IPV6 + if ((udp_server=socket((address.type() == IPv6) ? AF_INET6 : AF_INET, SOCK_DGRAM, 0)) == -1){ +#else if ((udp_server=socket(AF_INET, SOCK_DGRAM, 0)) == -1){ +#endif log_e("could not create socket: %d", errno); return 0; } @@ -63,12 +67,31 @@ uint8_t WiFiUDP::begin(IPAddress address, uint16_t port){ return 0; } - struct sockaddr_in addr; - memset((char *) &addr, 0, sizeof(addr)); - addr.sin_family = AF_INET; - addr.sin_port = htons(server_port); - addr.sin_addr.s_addr = (in_addr_t)address; - if(bind(udp_server , (struct sockaddr*)&addr, sizeof(addr)) == -1){ + struct sockaddr_storage serveraddr = {}; + size_t sock_size = 0; +#if LWIP_IPV6 + if (address.type() == IPv6) { + struct sockaddr_in6 *tmpaddr = (struct sockaddr_in6 *)&serveraddr; + ip_addr_t addr; + address.to_ip_addr_t(&addr); + memset((char *) tmpaddr, 0, sizeof(struct sockaddr_in)); + tmpaddr->sin6_family = AF_INET6; + tmpaddr->sin6_port = htons(server_port); + tmpaddr->sin6_scope_id = addr.u_addr.ip6.zone; + inet6_addr_from_ip6addr(&tmpaddr->sin6_addr, ip_2_ip6(&addr)); + tmpaddr->sin6_flowinfo = 0; + sock_size = sizeof(sockaddr_in6); + } else +#endif + { + struct sockaddr_in *tmpaddr = (struct sockaddr_in *)&serveraddr; + memset((char *) tmpaddr, 0, sizeof(struct sockaddr_in)); + tmpaddr->sin_family = AF_INET; + tmpaddr->sin_port = htons(server_port); + tmpaddr->sin_addr.s_addr = (in_addr_t)address; + sock_size = sizeof(sockaddr_in); + } + if(bind(udp_server , (sockaddr*)&serveraddr, sock_size) == -1){ log_e("could not bind socket: %d", errno); stop(); return 0; @@ -78,23 +101,48 @@ uint8_t WiFiUDP::begin(IPAddress address, uint16_t port){ } uint8_t WiFiUDP::begin(uint16_t p){ - return begin(IPAddress(INADDR_ANY), p); + return begin(IPAddress(), p); } -uint8_t WiFiUDP::beginMulticast(IPAddress a, uint16_t p){ - if(begin(IPAddress(INADDR_ANY), p)){ - if((uint32_t)a != 0){ - struct ip_mreq mreq; - mreq.imr_multiaddr.s_addr = (in_addr_t)a; - mreq.imr_interface.s_addr = INADDR_ANY; - if (setsockopt(udp_server, IPPROTO_IP, IP_ADD_MEMBERSHIP, &mreq, sizeof(mreq)) < 0) { +uint8_t WiFiUDP::beginMulticast(IPAddress address, uint16_t p){ + if(begin(IPAddress(), p)){ + ip_addr_t addr; + address.to_ip_addr_t(&addr); + if (ip_addr_ismulticast(&addr)) { +#if LWIP_IPV6 + if (address.type() == IPv6) { + struct ipv6_mreq mreq; + bool joined = false; + inet6_addr_from_ip6addr(&mreq.ipv6mr_multiaddr, ip_2_ip6(&addr)); + + // iterate on each interface + for (netif* intf = netif_list; intf != nullptr; intf = intf->next) { + mreq.ipv6mr_interface = intf->num + 1; + if (intf->name[0] != 'l' || intf->name[1] != 'o') { // skip 'lo' local interface + int ret = setsockopt(udp_server, IPPROTO_IPV6, IPV6_JOIN_GROUP, &mreq, sizeof(mreq)); + if (ret >= 0) { joined = true; } + } + } + if (!joined) { log_e("could not join igmp: %d", errno); stop(); return 0; + } + } else +#endif + { + struct ip_mreq mreq; + mreq.imr_multiaddr.s_addr = (in_addr_t)address; + mreq.imr_interface.s_addr = INADDR_ANY; + if (setsockopt(udp_server, IPPROTO_IP, IP_ADD_MEMBERSHIP, &mreq, sizeof(mreq)) < 0) { + log_e("could not join igmp: %d", errno); + stop(); + return 0; + } } - multicast_ip = a; + multicast_ip = address; + return 1; } - return 1; } return 0; } @@ -112,19 +160,38 @@ void WiFiUDP::stop(){ } if(udp_server == -1) return; - if((uint32_t)multicast_ip != 0){ - struct ip_mreq mreq; - mreq.imr_multiaddr.s_addr = (in_addr_t)multicast_ip; - mreq.imr_interface.s_addr = (in_addr_t)0; - setsockopt(udp_server, IPPROTO_IP, IP_DROP_MEMBERSHIP, &mreq, sizeof(mreq)); - multicast_ip = IPAddress(INADDR_ANY); + ip_addr_t addr; + multicast_ip.to_ip_addr_t(&addr); + if (!ip_addr_isany(&addr)) { +#if LWIP_IPV6 + if (multicast_ip.type() == IPv6) { + struct ipv6_mreq mreq; + inet6_addr_from_ip6addr(&mreq.ipv6mr_multiaddr, ip_2_ip6(&addr)); + + // iterate on each interface + for (netif* intf = netif_list; intf != nullptr; intf = intf->next) { + mreq.ipv6mr_interface = intf->num + 1; + if (intf->name[0] != 'l' || intf->name[1] != 'o') { // skip 'lo' local interface + setsockopt(udp_server, IPPROTO_IPV6, IPV6_LEAVE_GROUP, &mreq, sizeof(mreq)); + } + } + } else +#endif + { + struct ip_mreq mreq; + mreq.imr_multiaddr.s_addr = (in_addr_t)multicast_ip; + mreq.imr_interface.s_addr = (in_addr_t)0; + setsockopt(udp_server, IPPROTO_IP, IP_DROP_MEMBERSHIP, &mreq, sizeof(mreq)); + } + // now common code for v4/v6 + multicast_ip = IPAddress(); } close(udp_server); udp_server = -1; } int WiFiUDP::beginMulticastPacket(){ - if(!server_port || multicast_ip == IPAddress(INADDR_ANY)) + if(!server_port || multicast_ip == IPAddress()) return 0; remote_ip = multicast_ip; remote_port = server_port; @@ -176,14 +243,31 @@ int WiFiUDP::beginPacket(const char *host, uint16_t port){ } int WiFiUDP::endPacket(){ - struct sockaddr_in recipient; - recipient.sin_addr.s_addr = (uint32_t)remote_ip; - recipient.sin_family = AF_INET; - recipient.sin_port = htons(remote_port); - int sent = sendto(udp_server, tx_buffer, tx_buffer_len, 0, (struct sockaddr*) &recipient, sizeof(recipient)); - if(sent < 0){ - log_e("could not send data: %d", errno); - return 0; + ip_addr_t addr; + remote_ip.to_ip_addr_t(&addr); + + if (remote_ip.type() == IPv4) { + struct sockaddr_in recipient; + recipient.sin_addr.s_addr = (uint32_t)remote_ip; + recipient.sin_family = AF_INET; + recipient.sin_port = htons(remote_port); + int sent = sendto(udp_server, tx_buffer, tx_buffer_len, 0, (struct sockaddr*) &recipient, sizeof(recipient)); + if(sent < 0){ + log_e("could not send data: %d", errno); + return 0; + } + } else { + struct sockaddr_in6 recipient; + recipient.sin6_flowinfo = 0; + recipient.sin6_addr = *(in6_addr*)(ip_addr_t*)(&addr); + recipient.sin6_family = AF_INET6; + recipient.sin6_port = htons(remote_port); + recipient.sin6_scope_id = remote_ip.zone(); + int sent = sendto(udp_server, tx_buffer, tx_buffer_len, 0, (struct sockaddr*) &recipient, sizeof(recipient)); + if(sent < 0){ + log_e("could not send data: %d", errno); + return 0; + } } return 1; } @@ -207,13 +291,14 @@ size_t WiFiUDP::write(const uint8_t *buffer, size_t size){ int WiFiUDP::parsePacket(){ if(rx_buffer) return 0; - struct sockaddr_in si_other; - int slen = sizeof(si_other) , len; + struct sockaddr_storage si_other_storage; // enough storage for v4 and v6 + socklen_t slen = sizeof(sockaddr_storage); + int len; char *buf = (char *)malloc(1460); if(!buf) { return 0; } - if ((len = recvfrom(udp_server, buf, 1460, MSG_DONTWAIT, (struct sockaddr *) &si_other, (socklen_t *)&slen)) == -1){ + if ((len = recvfrom(udp_server, buf, 1460, MSG_DONTWAIT, (struct sockaddr *) &si_other_storage, (socklen_t *)&slen)) == -1){ free(buf); if(errno == EWOULDBLOCK){ return 0; @@ -221,8 +306,30 @@ int WiFiUDP::parsePacket(){ log_e("could not receive data: %d", errno); return 0; } - remote_ip = IPAddress(si_other.sin_addr.s_addr); - remote_port = ntohs(si_other.sin_port); + if (si_other_storage.ss_family == AF_INET) { + struct sockaddr_in &si_other = (sockaddr_in&) si_other_storage; + remote_ip = IPAddress(si_other.sin_addr.s_addr); + remote_port = ntohs(si_other.sin_port); + } +#if LWIP_IPV6 + else if (si_other_storage.ss_family == AF_INET6) { + struct sockaddr_in6 &si_other = (sockaddr_in6&) si_other_storage; + remote_ip = IPAddress(IPv6, (uint8_t*)&si_other.sin6_addr, si_other.sin6_scope_id); // force IPv6 + ip_addr_t addr; + remote_ip.to_ip_addr_t(&addr); + /* Dual-stack: Unmap IPv4 mapped IPv6 addresses */ + if (remote_ip.type() == IPv6 && ip6_addr_isipv4mappedipv6(ip_2_ip6(&addr))) { + unmap_ipv4_mapped_ipv6(ip_2_ip4(&addr), ip_2_ip6(&addr)); + IP_SET_TYPE_VAL(addr, IPADDR_TYPE_V4); + remote_ip.from_ip_addr_t(&addr); + } + remote_port = ntohs(si_other.sin6_port); + } +#endif // LWIP_IPV6=1 + else { + remote_ip = ip_addr_any.u_addr.ip4.addr; + remote_port = 0; + } if (len > 0) { rx_buffer = new(std::nothrow) cbuf(len); rx_buffer->write(buf, len); diff --git a/libraries/WiFiClientSecure/examples/WiFiClientInsecure/WiFiClientInsecure.ino b/libraries/WiFiClientSecure/examples/WiFiClientInsecure/WiFiClientInsecure.ino index 75c23122b5d..9c519736fda 100644 --- a/libraries/WiFiClientSecure/examples/WiFiClientInsecure/WiFiClientInsecure.ino +++ b/libraries/WiFiClientSecure/examples/WiFiClientInsecure/WiFiClientInsecure.ino @@ -1,5 +1,13 @@ #include +/* This is a very INSECURE approach. + * If for some reason the secure, proper example WiFiClientSecure + * does not work for you; then you may want to check the + * WiFiClientTrustOnFirstUse example first. It is less secure than + * WiFiClientSecure, but a lot better than this totally insecure + * approach shown below. + */ + const char* ssid = "your-ssid"; // your network SSID (name of wifi network) const char* password = "your-password"; // your network password diff --git a/libraries/WiFiClientSecure/examples/WiFiClientSecureProtocolUpgrade/.skip.esp32h2 b/libraries/WiFiClientSecure/examples/WiFiClientSecureProtocolUpgrade/.skip.esp32h2 new file mode 100644 index 00000000000..e69de29bb2d diff --git a/libraries/WiFiClientSecure/examples/WiFiClientSecureProtocolUpgrade/WiFiClientSecureProtocolUpgrade.ino b/libraries/WiFiClientSecure/examples/WiFiClientSecureProtocolUpgrade/WiFiClientSecureProtocolUpgrade.ino new file mode 100644 index 00000000000..06c19d105c4 --- /dev/null +++ b/libraries/WiFiClientSecure/examples/WiFiClientSecureProtocolUpgrade/WiFiClientSecureProtocolUpgrade.ino @@ -0,0 +1,176 @@ +/* STARTSSL example + + Inline upgrading from a clear-text connection to an SSL/TLS connection. + + Some protocols such as SMTP, XMPP, Mysql, Postgress and others allow, or require, + that you start the connection without encryption; and then send a command to switch + over to encryption. + + E.g. a typical SMTP submission would entail a dialogue such as this: + + 1. client connects to server in the clear + 2. server says hello + 3. client sents a EHLO + 4. server tells the client that it supports SSL/TLS + 5. client sends a 'STARTTLS' to make use of this faciltiy + 6. client/server negiotiate a SSL or TLS connection. + 7. client sends another EHLO + 8. server now tells the client what (else) is supported; such as additional authentication options. + ... conversation continues encrypted. + + This can be enabled in WiFiClientSecure by telling it to start in plaintext: + + client.setPlainStart(); + + and client is than a plain, TCP, connection (just as WiFiClient would be); until the client calls + the method: + + client.startTLS(); // returns zero on error; non zero on success. + + After which things switch to TLS/SSL. +*/ + +#include + +#ifndef WIFI_NETWORK +#define WIFI_NETWORK "YOUR Wifi SSID" +#endif + +#ifndef WIFI_PASSWD +#define WIFI_PASSWD "your-secret-password" +#endif + +#ifndef SMTP_HOST +#define SMTP_HOST "smtp.gmail.com" +#endif + +#ifndef SMTP_PORT +#define SMTP_PORT (587) // Standard (plaintext) submission port +#endif + +const char* ssid = WIFI_NETWORK; // your network SSID (name of wifi network) +const char* password = WIFI_PASSWD; // your network password +const char* server = SMTP_HOST; // Server URL +const int submission_port = SMTP_PORT; // submission port. + +WiFiClientSecure client; + +static bool readAllSMTPLines(); + +void setup() { + int ret; + //Initialize serial and wait for port to open: + Serial.begin(115200); + delay(100); + + Serial.print("Attempting to connect to SSID: "); + Serial.print(ssid); + WiFi.begin(ssid, password); + + // attempt to connect to Wifi network: + while (WiFi.status() != WL_CONNECTED) { + Serial.print("."); + // wait 1 second for re-trying + delay(1000); + } + + Serial.print("Connected to "); + Serial.println(ssid); + + Serial.printf("\nStarting connection to server: %s:%d\n", server, submission_port); + + + // skip verification for this demo. In production one should at the very least + // enable TOFU; or ideally hardcode a (CA) certificate that is trusted. + client.setInsecure(); + + // Enable a plain-test start. + client.setPlainStart(); + + if (!client.connect(server, SMTP_PORT)) { + Serial.println("Connection failed!"); + return; + }; + + Serial.println("Connected to server (in the clear, in plaintest)"); + + if (!readAllSMTPLines()) goto err; + + Serial.println("Sending : EHLO\t\tin the clear"); + client.print("EHLO there\r\n"); + + if (!readAllSMTPLines()) goto err; + + Serial.println("Sending : STARTTLS\t\tin the clear"); + client.print("STARTTLS\r\n"); + + if (!readAllSMTPLines()) goto err; + + Serial.println("Upgrading connection to TLS"); + if ((ret=client.startTLS()) <= 0) { + Serial.printf("Upgrade connection failed: err %d\n", ret); + goto err; + } + + Serial.println("Sending : EHLO again\t\tover the now encrypted connection"); + client.print("EHLO again\r\n"); + + if (!readAllSMTPLines()) goto err; + + // normally, as this point - we'd be authenticating and then be submitting + // an email. This has been left out of this example. + + Serial.println("Sending : QUIT\t\t\tover the now encrypted connection"); + client.print("QUIT\r\n"); + + if (!readAllSMTPLines()) goto err; + + Serial.println("Completed OK\n"); +err: + Serial.println("Closing connection"); + client.stop(); +} + +// SMTP command repsponse start with three digits and a space; +// or, for continuation, with three digits and a '-'. +static bool readAllSMTPLines() { + String s = ""; + int i; + + // blocking read; we cannot rely on a timeout + // of a WiFiClientSecure read; as it is non + // blocking. + const unsigned long timeout = 15 * 1000; + unsigned long start = millis(); // the timeout is for the entire CMD block response; not per character/line. + while (1) { + while ((i = client.available()) == 0 && millis() - start < timeout) { + /* .. wait */ + }; + if (i == 0) { + Serial.println("Timeout reading SMTP response"); + return false; + }; + if (i < 0) + break; + + i = client.read(); + if (i < 0) + break; + + if (i > 31 && i < 128) s += (char)i; + if (i == 0x0A) { + Serial.print("Receiving: "); + Serial.println(s); + if (s.charAt(3) == ' ') + return true; + s = ""; + } + } + Serial.printf("Error reading SMTP command response line: %d\n", i); + return false; +} + +void loop() { + // do nothing +} + diff --git a/libraries/WiFiClientSecure/examples/WiFiClientTrustOnFirstUse/.skip.esp32h2 b/libraries/WiFiClientSecure/examples/WiFiClientTrustOnFirstUse/.skip.esp32h2 new file mode 100644 index 00000000000..e69de29bb2d diff --git a/libraries/WiFiClientSecure/examples/WiFiClientTrustOnFirstUse/WiFiClientTrustOnFirstUse.ino b/libraries/WiFiClientSecure/examples/WiFiClientTrustOnFirstUse/WiFiClientTrustOnFirstUse.ino new file mode 100644 index 00000000000..a8b508f9db1 --- /dev/null +++ b/libraries/WiFiClientSecure/examples/WiFiClientTrustOnFirstUse/WiFiClientTrustOnFirstUse.ino @@ -0,0 +1,264 @@ +/* For any secure connection - it is (at least) essential for the + the client to verify that it is talking with the server it + thinks it is talking to. And not some (invisible) man in the middle. + + See https://en.wikipedia.org/wiki/Man-in-the-middle_attack, + https://www.ai.rug.nl/mas/finishedprojects/2011/TLS/hermsencomputerservices.nl/mas/mitm.html or + https://medium.com/@munteanu210/ssl-certificates-vs-man-in-the-middle-attacks-3fb7846fa5db + for some background on this. + + Unfortunatley this means that one needs to hardcode a server + public key, certificate or some cryptographically strong hash + thereoff into the code, to verify that you are indeed talking to + the right server. This is sometimes somewhat impractical. Especially + if you do not know the server in advance; or if your code needs to be + stable ovr very long times - during which the server may change. + + However completely dispensing with any checks (See the WifiClientInSecure + example) is also not a good idea either. + + This example gives you some middle ground; "Trust on First Use" -- + TOFU - see https://developer.mozilla.org/en-US/docs/Glossary/TOFU or + https://en.wikipedia.org/wiki/Trust_on_first_use). + + In this scheme; we start the very first time without any security checks + but once we have our first connection; we store the public crytpographic + details (or a proxy, such as a sha256 of this). And then we use this for + any subsequent connections. + + The assumption here is that we do our very first connection in a somewhat + trusted network environment; where the chance of a man in the middle is + very low; or one where the person doing the first run can check the + details manually. + + So this is not quite as good as building a CA certificate into your + code (as per the WifiClientSecure example). But not as bad as something + with no trust management at all. + + To make it possible for the enduser to 'reset' this trust; the + startup sequence checks if a certain GPIO is low (assumed to be wired + to some physical button or jumper on the PCB). And we only allow + the TOFU to be configured when this pin is LOW. +*/ +#ifndef WIFI_NETWORK +#define WIFI_NETWORK "Your Wifi SSID" +#endif + +#ifndef WIFI_PASSWD +#define WIFI_PASSWD "your-secret-wifi-password" +#endif + +const char* ssid = WIFI_NETWORK; // your network SSID (name of wifi network) +const char* password = WIFI_PASSWD; // your network password +const char* server = "www.howsmyssl.com"; // Server to test with. + +const int TOFU_RESET_BUTTON = 35; /* Trust reset button wired between GPIO 35 and GND (pulldown) */ + +#include +#include + +/* Set aside some persistant memory (i.e. memory that is preserved on reboots and + power cycling; and will generally survive software updates as well. +*/ +EEPROMClass TOFU("tofu0"); + +// Utility function; checks if a given buffer is entirly +// with with 0 bytes over its full length. Returns 0 on +// succes; a non zero value on fail. +// +static int memcmpzero(unsigned char * ptr, size_t len) { + while (len--) if (0xff != *ptr++) return -1; + return 0; +}; + +static void printSHA256(unsigned char * ptr) { + for (int i = 0; i < 32; i++) Serial.printf("%s%02x", i ? ":" : "", ptr[i]); + Serial.println(""); +}; + +WiFiClientSecure client; + +bool get_tofu(); +bool doTOFU_Protected_Connection(uint8_t * fingerprint_tofu); + +void setup() { + bool tofu_reset = false; + //Initialize serial and wait for port to open: + Serial.begin(115200); + delay(100); + + if (!TOFU.begin(32)) { + Serial.println("Could not initialsize the EEPROM"); + return; + } + uint8_t fingerprint_tofu[32]; + + // reset the trust if the tofu reset button is pressed. + // + pinMode(TOFU_RESET_BUTTON, INPUT_PULLUP); + if (digitalRead(TOFU_RESET_BUTTON) == LOW) { + Serial.println("The TOFU reset button is pressed."); + tofu_reset = true; + } + /* if the button is not pressed; see if we can get the TOFU + fingerprint from the EEPROM. + */ + else if (32 != TOFU.readBytes(0, fingerprint_tofu, 32)) { + Serial.println("Failed to get the fingerprint from memory."); + tofu_reset = true; + } + /* And check that the EEPROM value is not all 0's; in which + case we also need to do a TOFU. + */ + else if (!memcmpzero(fingerprint_tofu, 32)) { + Serial.println("TOFU fingerprint in memory all zero."); + tofu_reset = true; + }; + if (!tofu_reset) { + Serial.print("TOFU pegged to fingerprint: SHA256="); + printSHA256(fingerprint_tofu); + Serial.print("Note: You can check this fingerprint by going to the URL\n" + " and then click on the lock icon.\n"); + }; + + // attempt to connect to Wifi network: + Serial.print("Attempting to connect to SSID: "); + Serial.println(ssid); + WiFi.begin(ssid, password); + while (WiFi.status() != WL_CONNECTED) { + Serial.print("."); + // wait 1 second for re-trying + delay(1000); + } + + Serial.print("Connected to "); + Serial.println(ssid); + + if (tofu_reset) { + Serial.println("Resetting trust fingerprint."); + if (!get_tofu()) { + Serial.println("Trust reset failed. Giving up"); + return; + } + Serial.println("(New) Trust of First used configured. Rebooting in 3 seconds"); + delay(3 * 1000); + ESP.restart(); + }; + + Serial.println("Trying to connect to a server; using TOFU details from the eeprom"); + + if (doTOFU_Protected_Connection(fingerprint_tofu)) + Serial.println("ALL OK"); +} + +bool get_tofu() { + Serial.println("\nStarting our insecure connection to server..."); + client.setInsecure();//skip verification + + if (!client.connect(server, 443)) { + Serial.println("Connection failed!"); + client.stop(); + return false; + }; + + Serial.println("Connected to server. Extracting trust data."); + + // Now extract the data of the certificate and show it to + // the user over the serial connection for optional + // verification. + const mbedtls_x509_crt* peer = client.getPeerCertificate(); + char buf[1024]; + int l = mbedtls_x509_crt_info(buf, sizeof(buf), "", peer); + if (l <= 0) { + Serial.println("Peer conversion to printable buffer failed"); + client.stop(); + return false; + }; + Serial.println(); + Serial.println(buf); + + // Extract the fingerprint - and store this in our EEPROM + // to be used for future validation. + + uint8_t fingerprint_remote[32]; + if (!client.getFingerprintSHA256(fingerprint_remote)) { + Serial.println("Failed to get the fingerprint"); + client.stop(); + return false; + } + if ( + (32 != TOFU.writeBytes(0, fingerprint_remote, 32)) || + (!TOFU.commit()) + ) { + Serial.println("Could not write the fingerprint to the EEPROM"); + client.stop(); + return false; + }; + TOFU.end(); + client.stop(); + + Serial.print("TOFU pegged to fingerprint: SHA256="); + printSHA256(fingerprint_remote); + + return true; +}; + +bool doTOFU_Protected_Connection(uint8_t * fingerprint_tofu) { + + // As we're not using a (CA) certificate to check the + // connection; but the hash of the peer - we need to initially + // allow the connection to be set up without the CA check. + client.setInsecure();//skip verification + + if (!client.connect(server, 443)) { + Serial.println("Connection failed!"); + client.stop(); + return false; + }; + + // Now that we're connected - we can check that we have + // end to end trust - by comparing the fingerprint we (now) + // see (of the server certificate) to the one we have stored + // in our EEPROM as part of an earlier trust-on-first use. + uint8_t fingerprint_remote[32]; + if (!client.getFingerprintSHA256(fingerprint_remote)) { + Serial.println("Failed to get the fingerprint of the server"); + client.stop(); + return false; + } + if (memcmp(fingerprint_remote, fingerprint_tofu, 32)) { + Serial.println("TOFU fingerprint not the same as the one from the server."); + Serial.print("TOFU : SHA256="); + printSHA256(fingerprint_tofu); + Serial.print("Remote: SHA256="); + printSHA256(fingerprint_remote); + Serial.println(" : NOT identical -- Aborting!"); + client.stop(); + return false; + }; + + Serial.println("All well - you are talking to the same server as\n" + "when you set up TOFU. So we can now do a GET.\n\n"); + + client.println("GET /a/check HTTP/1.0"); + client.print("Host: " ); client.println(server); + client.println("Connection: close"); + client.println(); + + bool inhdr = true; + while (client.connected()) { + String line = client.readStringUntil('\n'); + Serial.println(line); + if (inhdr && line == "\r") { + inhdr = false; + Serial.println("-- headers received. Payload follows\n\n"); + } + } + Serial.println("\n\n-- Payload ended."); + client.stop(); + return true; +} + +void loop() {} diff --git a/libraries/WiFiClientSecure/src/WiFiClientSecure.cpp b/libraries/WiFiClientSecure/src/WiFiClientSecure.cpp index 2f9da58f9ad..d7f443fa2cb 100644 --- a/libraries/WiFiClientSecure/src/WiFiClientSecure.cpp +++ b/libraries/WiFiClientSecure/src/WiFiClientSecure.cpp @@ -91,15 +91,12 @@ WiFiClientSecure &WiFiClientSecure::operator=(const WiFiClientSecure &other) void WiFiClientSecure::stop() { - if (sslclient->socket >= 0) { - close(sslclient->socket); - sslclient->socket = -1; - _connected = false; - _peek = -1; - _lastReadTimeout = 0; - _lastWriteTimeout = 0; - } stop_ssl_socket(sslclient, _CA_cert, _cert, _private_key); + + _connected = false; + _peek = -1; + _lastReadTimeout = 0; + _lastWriteTimeout = 0; } int WiFiClientSecure::connect(IPAddress ip, uint16_t port) @@ -143,9 +140,16 @@ int WiFiClientSecure::connect(const char *host, uint16_t port, const char *CA_ce int WiFiClientSecure::connect(IPAddress ip, uint16_t port, const char *host, const char *CA_cert, const char *cert, const char *private_key) { int ret = start_ssl_client(sslclient, ip, port, host, _timeout, CA_cert, _use_ca_bundle, cert, private_key, NULL, NULL, _use_insecure, _alpn_protos); + + if (ret >=0 && ! _stillinPlainStart) + ret = ssl_starttls_handshake(sslclient); + else + log_i("Actual TLS start posponed."); + _lastError = ret; + if (ret < 0) { - log_e("start_ssl_client: %d", ret); + log_e("start_ssl_client: connect failed: %d", ret); stop(); return 0; } @@ -153,6 +157,23 @@ int WiFiClientSecure::connect(IPAddress ip, uint16_t port, const char *host, con return 1; } +int WiFiClientSecure::startTLS() +{ + int ret = 1; + if (_stillinPlainStart) { + log_i("startTLS: starting TLS/SSL on this dplain connection"); + ret = ssl_starttls_handshake(sslclient); + if (ret < 0) { + log_e("startTLS: %d", ret); + stop(); + return 0; + }; + _stillinPlainStart = false; + } else + log_i("startTLS: ignoring StartTLS - as we should be secure already"); + return 1; +} + int WiFiClientSecure::connect(IPAddress ip, uint16_t port, const char *pskIdent, const char *psKey) { return connect(ip.toString().c_str(), port, pskIdent, psKey); } @@ -167,7 +188,7 @@ int WiFiClientSecure::connect(const char *host, uint16_t port, const char *pskId int ret = start_ssl_client(sslclient, address, port, host, _timeout, NULL, false, NULL, NULL, pskIdent, psKey, _use_insecure, _alpn_protos); _lastError = ret; if (ret < 0) { - log_e("start_ssl_client: %d", ret); + log_e("start_ssl_client: connect failed %d", ret); stop(); return 0; } @@ -192,10 +213,7 @@ int WiFiClientSecure::read() { uint8_t data = -1; int res = read(&data, 1); - if (res < 0) { - return res; - } - return data; + return res < 0 ? res: data; } size_t WiFiClientSecure::write(const uint8_t *buf, size_t size) @@ -203,6 +221,10 @@ size_t WiFiClientSecure::write(const uint8_t *buf, size_t size) if (!_connected) { return 0; } + + if (_stillinPlainStart) + return send_net_data(sslclient, buf, size); + if(_lastWriteTimeout != _timeout){ struct timeval timeout_tv; timeout_tv.tv_sec = _timeout / 1000; @@ -212,9 +234,9 @@ size_t WiFiClientSecure::write(const uint8_t *buf, size_t size) _lastWriteTimeout = _timeout; } } - int res = send_ssl_data(sslclient, buf, size); if (res < 0) { + log_e("Closing connection on failed write"); stop(); res = 0; } @@ -223,6 +245,9 @@ size_t WiFiClientSecure::write(const uint8_t *buf, size_t size) int WiFiClientSecure::read(uint8_t *buf, size_t size) { + if(_stillinPlainStart) + return get_net_receive(sslclient, buf, size); + if(_lastReadTimeout != _timeout){ if(fd() >= 0){ struct timeval timeout_tv; @@ -235,7 +260,7 @@ int WiFiClientSecure::read(uint8_t *buf, size_t size) } } - int peeked = 0; + int peeked = 0, res = -1; int avail = available(); if ((!buf && size) || avail <= 0) { return -1; @@ -254,9 +279,10 @@ int WiFiClientSecure::read(uint8_t *buf, size_t size) buf++; peeked = 1; } - - int res = get_ssl_receive(sslclient, buf, size); + res = get_ssl_receive(sslclient, buf, size); + if (res < 0) { + log_e("Closing connection on failed read"); stop(); return peeked?peeked:res; } @@ -265,12 +291,17 @@ int WiFiClientSecure::read(uint8_t *buf, size_t size) int WiFiClientSecure::available() { - int peeked = (_peek >= 0); + if (_stillinPlainStart) + return peek_net_receive(sslclient,0); + + int peeked = (_peek >= 0), res = -1; if (!_connected) { return peeked; } - int res = data_to_read(sslclient); - if (res < 0) { + res = data_to_read(sslclient); + + if (res < 0 && !_stillinPlainStart) { + log_e("Closing connection on failed available check"); stop(); return peeked?peeked:res; } @@ -406,3 +437,4 @@ int WiFiClientSecure::fd() const { return sslclient->socket; } + diff --git a/libraries/WiFiClientSecure/src/WiFiClientSecure.h b/libraries/WiFiClientSecure/src/WiFiClientSecure.h index 8c130f450cc..31daebbdb42 100644 --- a/libraries/WiFiClientSecure/src/WiFiClientSecure.h +++ b/libraries/WiFiClientSecure/src/WiFiClientSecure.h @@ -34,6 +34,7 @@ class WiFiClientSecure : public WiFiClient int _peek = -1; int _timeout; bool _use_insecure; + bool _stillinPlainStart = false; const char *_CA_cert; const char *_cert; const char *_private_key; @@ -78,6 +79,17 @@ class WiFiClientSecure : public WiFiClient bool verify(const char* fingerprint, const char* domain_name); void setHandshakeTimeout(unsigned long handshake_timeout); void setAlpnProtocols(const char **alpn_protos); + + // Certain protocols start in plain-text; and then have the client + // give some STARTSSL command to `upgrade' the connection to TLS + // or SSL. Setting PlainStart to true (the default is false) enables + // this. It is up to the application code to then call 'startTLS()' + // at the right point to initialise the SSL or TLS upgrade. + + void setPlainStart() { _stillinPlainStart = true; }; + bool stillInPlainStart() { return _stillinPlainStart; }; + int startTLS(); + const mbedtls_x509_crt* getPeerCertificate() { return mbedtls_ssl_get_peer_cert(&sslclient->ssl_ctx); }; bool getFingerprintSHA256(uint8_t sha256_result[32]) { return get_peer_fingerprint(sslclient, sha256_result); }; int fd() const; diff --git a/libraries/WiFiClientSecure/src/ssl_client.cpp b/libraries/WiFiClientSecure/src/ssl_client.cpp index 8dcf05877ba..a4308abb1e8 100644 --- a/libraries/WiFiClientSecure/src/ssl_client.cpp +++ b/libraries/WiFiClientSecure/src/ssl_client.cpp @@ -55,8 +55,7 @@ void ssl_init(sslclient_context *ssl_client) int start_ssl_client(sslclient_context *ssl_client, const IPAddress& ip, uint32_t port, const char* hostname, int timeout, const char *rootCABuff, bool useRootCABundle, const char *cli_cert, const char *cli_key, const char *pskIdent, const char *psKey, bool insecure, const char **alpn_protos) { - char buf[512]; - int ret, flags; + int ret; int enable = 1; log_v("Free internal heap before TLS %u", ESP.getFreeHeap()); @@ -226,6 +225,9 @@ int start_ssl_client(sslclient_context *ssl_client, const IPAddress& ip, uint32_ return -1; } + // Note - this check for BOTH key and cert is relied on + // later during cleanup. + if (!insecure && cli_cert != NULL && cli_key != NULL) { mbedtls_x509_crt_init(&ssl_client->client_cert); mbedtls_pk_init(&ssl_client->client_key); @@ -267,6 +269,13 @@ int start_ssl_client(sslclient_context *ssl_client, const IPAddress& ip, uint32_ } mbedtls_ssl_set_bio(&ssl_client->ssl_ctx, &ssl_client->socket, mbedtls_net_send, mbedtls_net_recv, NULL ); + return ssl_client->socket; +} + +int ssl_starttls_handshake(sslclient_context *ssl_client) +{ + char buf[512]; + int ret, flags; log_v("Performing the SSL/TLS handshake..."); unsigned long handshake_start_time=millis(); @@ -280,7 +289,7 @@ int start_ssl_client(sslclient_context *ssl_client, const IPAddress& ip, uint32_ } - if (cli_cert != NULL && cli_key != NULL) { + if (ssl_client->client_cert.version) { log_d("Protocol is %s Ciphersuite is %s", mbedtls_ssl_get_version(&ssl_client->ssl_ctx), mbedtls_ssl_get_ciphersuite(&ssl_client->ssl_ctx)); if ((ret = mbedtls_ssl_get_record_expansion(&ssl_client->ssl_ctx)) >= 0) { log_d("Record expansion is %d", ret); @@ -300,15 +309,16 @@ int start_ssl_client(sslclient_context *ssl_client, const IPAddress& ip, uint32_ log_v("Certificate verified."); } - if (rootCABuff != NULL) { + if (ssl_client->ca_cert.version) { mbedtls_x509_crt_free(&ssl_client->ca_cert); } - if (cli_cert != NULL) { + // We know that we always have a client cert/key pair -- and we + // cannot look into the private client_key pk struct for newer + // versions of mbedtls. So rely on a public field of the cert + // and infer that there is a key too. + if (ssl_client->client_cert.version) { mbedtls_x509_crt_free(&ssl_client->client_cert); - } - - if (cli_key != NULL) { mbedtls_pk_free(&ssl_client->client_key); } @@ -317,7 +327,6 @@ int start_ssl_client(sslclient_context *ssl_client, const IPAddress& ip, uint32_ return ssl_client->socket; } - void stop_ssl_socket(sslclient_context *ssl_client, const char *rootCABuff, const char *cli_cert, const char *cli_key) { log_v("Cleaning SSL connection."); @@ -328,13 +337,13 @@ void stop_ssl_socket(sslclient_context *ssl_client, const char *rootCABuff, cons } // avoid memory leak if ssl connection attempt failed - //if (ssl_client->ssl_conf.ca_chain != NULL) { + // if (ssl_client->ssl_conf.ca_chain != NULL) { mbedtls_x509_crt_free(&ssl_client->ca_cert); - //} - //if (ssl_client->ssl_conf.key_cert != NULL) { + // } + // if (ssl_client->ssl_conf.key_cert != NULL) { mbedtls_x509_crt_free(&ssl_client->client_cert); mbedtls_pk_free(&ssl_client->client_key); - //} + // } mbedtls_ssl_free(&ssl_client->ssl_ctx); mbedtls_ssl_config_free(&ssl_client->ssl_conf); mbedtls_ctr_drbg_free(&ssl_client->drbg_ctx); @@ -368,10 +377,8 @@ int data_to_read(sslclient_context *ssl_client) int send_ssl_data(sslclient_context *ssl_client, const uint8_t *data, size_t len) { - log_v("Writing HTTP request with %d bytes...", len); //for low level debug - int ret = -1; - unsigned long write_start_time=millis(); + int ret = -1; while ((ret = mbedtls_ssl_write(&ssl_client->ssl_ctx, data, len)) <= 0) { if((millis()-write_start_time)>ssl_client->socket_timeout) { @@ -391,14 +398,60 @@ int send_ssl_data(sslclient_context *ssl_client, const uint8_t *data, size_t len return ret; } -int get_ssl_receive(sslclient_context *ssl_client, uint8_t *data, int length) +// Some protocols, such as SMTP, XMPP, MySQL/Posgress and various others +// do a 'in-line' upgrade from plaintext to SSL or TLS (usually with some +// sort of 'STARTTLS' textual command from client to sever). For this +// we need to have access to the 'raw' socket; i.e. without TLS/SSL state +// handling before the handshake starts; but after setting up the TLS +// connection. +// +int peek_net_receive(sslclient_context *ssl_client, int timeout) { +#if MBEDTLS_FIXED_LINKING_NET_POLL + int ret = mbedtls_net_poll((mbedtls_net_context*)ssl_client, MBEDTLS_NET_POLL_READ, timeout); + ret == MBEDTLS_NET_POLL_READ ? 1 : ret; +#else + // We should be using mbedtls_net_poll(); which is part of mbedtls and + // included in the EspressifSDK. Unfortunately - it did not make it into + // the statically linked library file. So, for now, we replace it by + // substancially similar code. + // + struct timeval tv = { .tv_sec = timeout / 1000, .tv_usec = (timeout % 1000) * 1000 }; + + fd_set fdset; + FD_SET(ssl_client->socket, &fdset); + + int ret = select(ssl_client->socket + 1, &fdset, nullptr, nullptr, timeout<0 ? nullptr : &tv); + if (ret < 0) { + log_e("select on read fd %d, errno: %d, \"%s\"", ssl_client->socket, errno, strerror(errno)); + lwip_close(ssl_client->socket); + ssl_client->socket = -1; + return -1; + }; +#endif + return ret; +}; + +int get_net_receive(sslclient_context *ssl_client, uint8_t *data, int length) { - //log_d( "Reading HTTP response..."); //for low level debug - int ret = -1; + int ret = peek_net_receive(ssl_client,ssl_client->socket_timeout); + if (ret > 0) + ret = mbedtls_net_recv(ssl_client, data, length); - ret = mbedtls_ssl_read(&ssl_client->ssl_ctx, data, length); + // log_v( "%d bytes NET read of %d", ret, length); //for low level debug + return ret; +} - //log_v( "%d bytes read", ret); //for low level debug +int send_net_data(sslclient_context *ssl_client, const uint8_t *data, size_t len) { + int ret = mbedtls_net_send(ssl_client, data, len); + // log_v("Net sending %d btes->ret %d", len, ret); //for low level debug + return ret; +} + + +int get_ssl_receive(sslclient_context *ssl_client, uint8_t *data, int length) +{ + int ret = mbedtls_ssl_read(&ssl_client->ssl_ctx, data, length); + // log_v( "%d bytes SSL read", ret); //for low level debug return ret; } diff --git a/libraries/WiFiClientSecure/src/ssl_client.h b/libraries/WiFiClientSecure/src/ssl_client.h index 69e49707cba..f42ad534139 100644 --- a/libraries/WiFiClientSecure/src/ssl_client.h +++ b/libraries/WiFiClientSecure/src/ssl_client.h @@ -31,10 +31,14 @@ typedef struct sslclient_context { void ssl_init(sslclient_context *ssl_client); int start_ssl_client(sslclient_context *ssl_client, const IPAddress& ip, uint32_t port, const char* hostname, int timeout, const char *rootCABuff, bool useRootCABundle, const char *cli_cert, const char *cli_key, const char *pskIdent, const char *psKey, bool insecure, const char **alpn_protos); +int ssl_starttls_handshake(sslclient_context *ssl_client); void stop_ssl_socket(sslclient_context *ssl_client, const char *rootCABuff, const char *cli_cert, const char *cli_key); int data_to_read(sslclient_context *ssl_client); int send_ssl_data(sslclient_context *ssl_client, const uint8_t *data, size_t len); int get_ssl_receive(sslclient_context *ssl_client, uint8_t *data, int length); +int send_net_data(sslclient_context *ssl_client, const uint8_t *data, size_t len); +int get_net_receive(sslclient_context *ssl_client, uint8_t *data, int length); +int peek_net_receive(sslclient_context *ssl_client, int timeout); bool verify_ssl_fingerprint(sslclient_context *ssl_client, const char* fp, const char* domain_name); bool verify_ssl_dn(sslclient_context *ssl_client, const char* domain_name); bool get_peer_fingerprint(sslclient_context *ssl_client, uint8_t sha256[32]); diff --git a/libraries/Wire/src/Wire.cpp b/libraries/Wire/src/Wire.cpp index 4b81d99f70d..ac8c353575f 100644 --- a/libraries/Wire/src/Wire.cpp +++ b/libraries/Wire/src/Wire.cpp @@ -149,7 +149,7 @@ bool TwoWire::setPins(int sdaPin, int sclPin) return !i2cIsInit(num); } -bool TwoWire::allocateWireBuffer(void) +bool TwoWire::allocateWireBuffer() { // or both buffer can be allocated or none will be if (rxBuffer == NULL) { @@ -171,7 +171,7 @@ bool TwoWire::allocateWireBuffer(void) return true; } -void TwoWire::freeWireBuffer(void) +void TwoWire::freeWireBuffer() { if (rxBuffer != NULL) { free(rxBuffer); @@ -424,7 +424,7 @@ uint16_t TwoWire::getTimeOut() return _timeOutMillis; } -void TwoWire::beginTransmission(uint16_t address) +void TwoWire::beginTransmission(uint8_t address) { #if SOC_I2C_SUPPORT_SLAVE if(is_slave){ @@ -492,7 +492,12 @@ uint8_t TwoWire::endTransmission(bool sendStop) return 4; } -size_t TwoWire::requestFrom(uint16_t address, size_t size, bool sendStop) +uint8_t TwoWire::endTransmission() +{ + return endTransmission(true); +} + +size_t TwoWire::requestFrom(uint8_t address, size_t size, bool sendStop) { #if SOC_I2C_SUPPORT_SLAVE if(is_slave){ @@ -550,6 +555,10 @@ size_t TwoWire::requestFrom(uint16_t address, size_t size, bool sendStop) return rxLength; } +size_t TwoWire::requestFrom(uint8_t address, size_t size){ + return requestFrom(address, size, true); +} + size_t TwoWire::write(uint8_t data) { if (txBuffer == NULL){ @@ -574,13 +583,13 @@ size_t TwoWire::write(const uint8_t *data, size_t quantity) } -int TwoWire::available(void) +int TwoWire::available() { int result = rxLength - rxIndex; return result; } -int TwoWire::read(void) +int TwoWire::read() { int value = -1; if (rxBuffer == NULL){ @@ -593,7 +602,7 @@ int TwoWire::read(void) return value; } -int TwoWire::peek(void) +int TwoWire::peek() { int value = -1; if (rxBuffer == NULL){ @@ -606,7 +615,7 @@ int TwoWire::peek(void) return value; } -void TwoWire::flush(void) +void TwoWire::flush() { rxIndex = 0; rxLength = 0; @@ -614,62 +623,19 @@ void TwoWire::flush(void) //i2cFlush(num); // cleanup } -size_t TwoWire::requestFrom(uint8_t address, size_t len, bool sendStop) -{ - return requestFrom(static_cast(address), static_cast(len), static_cast(sendStop)); -} - -uint8_t TwoWire::requestFrom(uint8_t address, uint8_t len, uint8_t sendStop) -{ - return requestFrom(static_cast(address), static_cast(len), static_cast(sendStop)); -} - -uint8_t TwoWire::requestFrom(uint16_t address, uint8_t len, uint8_t sendStop) -{ - return requestFrom(address, static_cast(len), static_cast(sendStop)); -} - -/* Added to match the Arduino function definition: https://github.com/arduino/ArduinoCore-API/blob/173e8eadced2ad32eeb93bcbd5c49f8d6a055ea6/api/HardwareI2C.h#L39 - * See: https://github.com/arduino-libraries/ArduinoECCX08/issues/25 -*/ -uint8_t TwoWire::requestFrom(uint16_t address, uint8_t len, bool stopBit) -{ - return requestFrom((uint16_t)address, (size_t)len, stopBit); -} - -uint8_t TwoWire::requestFrom(uint8_t address, uint8_t len) -{ - return requestFrom(static_cast(address), static_cast(len), true); -} - -uint8_t TwoWire::requestFrom(uint16_t address, uint8_t len) -{ - return requestFrom(address, static_cast(len), true); -} - -uint8_t TwoWire::requestFrom(int address, int len) -{ - return requestFrom(static_cast(address), static_cast(len), true); -} - -uint8_t TwoWire::requestFrom(int address, int len, int sendStop) -{ - return static_cast(requestFrom(static_cast(address), static_cast(len), static_cast(sendStop))); -} - -void TwoWire::beginTransmission(int address) -{ - beginTransmission(static_cast(address)); -} - -void TwoWire::beginTransmission(uint8_t address) +void TwoWire::onReceive( void (*function)(int) ) { - beginTransmission(static_cast(address)); +#if SOC_I2C_SUPPORT_SLAVE + user_onReceive = function; +#endif } -uint8_t TwoWire::endTransmission(void) +// sets function called on slave read +void TwoWire::onRequest( void (*function)(void) ) { - return endTransmission(true); +#if SOC_I2C_SUPPORT_SLAVE + user_onRequest = function; +#endif } #if SOC_I2C_SUPPORT_SLAVE @@ -714,17 +680,6 @@ void TwoWire::onRequestService(uint8_t num, void * arg) } } -void TwoWire::onReceive( void (*function)(int) ) -{ - user_onReceive = function; -} - -// sets function called on slave read -void TwoWire::onRequest( void (*function)(void) ) -{ - user_onRequest = function; -} - #endif /* SOC_I2C_SUPPORT_SLAVE */ TwoWire Wire = TwoWire(0); diff --git a/libraries/Wire/src/Wire.h b/libraries/Wire/src/Wire.h index 569d3abf1a0..2a5e9b4215d 100644 --- a/libraries/Wire/src/Wire.h +++ b/libraries/Wire/src/Wire.h @@ -30,11 +30,13 @@ #if SOC_I2C_SUPPORTED #include +#include #if !CONFIG_DISABLE_HAL_LOCKS #include "freertos/FreeRTOS.h" #include "freertos/task.h" #include "freertos/semphr.h" #endif +#include "HardwareI2C.h" #include "Stream.h" // WIRE_HAS_BUFFER_SIZE means Wire has setBufferSize() @@ -50,7 +52,7 @@ typedef void(*user_onRequest)(void); typedef void(*user_onReceive)(uint8_t*, int); #endif /* SOC_I2C_SUPPORT_SLAVE */ -class TwoWire: public Stream +class TwoWire: public HardwareI2C { protected: uint8_t num; @@ -81,12 +83,41 @@ class TwoWire: public Stream static void onReceiveService(uint8_t, uint8_t*, size_t, bool, void *); #endif /* SOC_I2C_SUPPORT_SLAVE */ bool initPins(int sdaPin, int sclPin); - bool allocateWireBuffer(void); - void freeWireBuffer(void); + bool allocateWireBuffer(); + void freeWireBuffer(); public: TwoWire(uint8_t bus_num); ~TwoWire(); + + bool begin() override final + { + return begin(-1, -1); + } + + bool begin(uint8_t address) override final + { +#if SOC_I2C_SUPPORT_SLAVE + return begin(address, -1, -1, 0); +#else + log_e("I2C slave is not supported on " CONFIG_IDF_TARGET); + return false; +#endif + } + + bool end() override; + + bool setClock(uint32_t freq) override; + + void beginTransmission(uint8_t address) override; + uint8_t endTransmission(bool stopBit) override; + uint8_t endTransmission() override; + + size_t requestFrom(uint8_t address, size_t len, bool stopBit) override; + size_t requestFrom(uint8_t address, size_t len) override; + + void onReceive(void(*)(int)) override; + void onRequest(void(*)(void)) override; //call setPins() first, so that begin() can be called without arguments from libraries bool setPins(int sda, int scl); @@ -95,78 +126,22 @@ class TwoWire: public Stream #if SOC_I2C_SUPPORT_SLAVE bool begin(uint8_t slaveAddr, int sda, int scl, uint32_t frequency); #endif /* SOC_I2C_SUPPORT_SLAVE */ - // Explicit Overload for Arduino MainStream API compatibility - inline bool begin() - { - return begin(-1, -1, static_cast(0)); - } -#if SOC_I2C_SUPPORT_SLAVE - inline bool begin(uint8_t addr) - { - return begin(addr, -1, -1, 0); - } - inline bool begin(int addr) - { - return begin(static_cast(addr), -1, -1, 0); - } -#endif /* SOC_I2C_SUPPORT_SLAVE */ - bool end(); size_t setBufferSize(size_t bSize); void setTimeOut(uint16_t timeOutMillis); // default timeout of i2c transactions is 50ms uint16_t getTimeOut(); - bool setClock(uint32_t); uint32_t getClock(); - void beginTransmission(uint16_t address); - void beginTransmission(uint8_t address); - void beginTransmission(int address); - - uint8_t endTransmission(bool sendStop); - uint8_t endTransmission(void); - - size_t requestFrom(uint16_t address, size_t size, bool sendStop); - uint8_t requestFrom(uint16_t address, uint8_t size, bool sendStop); - uint8_t requestFrom(uint16_t address, uint8_t size, uint8_t sendStop); - size_t requestFrom(uint8_t address, size_t len, bool stopBit); - uint8_t requestFrom(uint16_t address, uint8_t size); - uint8_t requestFrom(uint8_t address, uint8_t size, uint8_t sendStop); - uint8_t requestFrom(uint8_t address, uint8_t size); - uint8_t requestFrom(int address, int size, int sendStop); - uint8_t requestFrom(int address, int size); - - size_t write(uint8_t); - size_t write(const uint8_t *, size_t); - int available(void); - int read(void); - int peek(void); - void flush(void); - - inline size_t write(const char * s) - { - return write((uint8_t*) s, strlen(s)); - } - inline size_t write(unsigned long n) - { - return write((uint8_t)n); - } - inline size_t write(long n) - { - return write((uint8_t)n); - } - inline size_t write(unsigned int n) - { - return write((uint8_t)n); - } - inline size_t write(int n) - { - return write((uint8_t)n); - } + size_t write(uint8_t) override; + size_t write(const uint8_t *, size_t) override; + int available() override; + int read() override; + int peek() override; + void flush() override; + #if SOC_I2C_SUPPORT_SLAVE - void onReceive( void (*)(int) ); - void onRequest( void (*)(void) ); size_t slaveWrite(const uint8_t *, size_t); #endif /* SOC_I2C_SUPPORT_SLAVE */ }; diff --git a/platform.txt b/platform.txt index 0ff2eae7395..08b3bb8e78b 100644 --- a/platform.txt +++ b/platform.txt @@ -9,26 +9,22 @@ tools.xtensa-esp-elf-gdb.path={runtime.platform.path}/tools/xtensa-esp-elf-gdb tools.riscv32-esp-elf-gcc.path={runtime.platform.path}/tools/riscv32-esp-elf tools.riscv32-esp-elf-gdb.path={runtime.platform.path}/tools/riscv32-esp-elf-gdb -debug.server.openocd.path={runtime.platform.path}/tools/openocd-esp32/bin/openocd -debug.server.openocd.scripts_dir={runtime.platform.path}/tools/openocd-esp32/share/openocd/scripts/ -debug.server.openocd.scripts_dir.windows={runtime.platform.path}\tools\openocd-esp32\share\openocd\scripts\ - tools.esptool_py.path={runtime.platform.path}/tools/esptool tools.esptool_py.cmd=esptool tools.esptool_py.cmd.linux=esptool.py tools.esptool_py.cmd.windows=esptool.exe tools.esptool_py.network_cmd=python3 "{runtime.platform.path}/tools/espota.py" -r -tools.esptool_py.network_cmd.windows="{runtime.platform.path}/tools/espota.exe" -r +tools.esptool_py.network_cmd.windows="{runtime.platform.path}\tools\espota.exe" -r tools.esp_ota.cmd=python3 "{runtime.platform.path}/tools/espota.py" -r -tools.esp_ota.cmd.windows="{runtime.platform.path}/tools/espota.exe" -r +tools.esp_ota.cmd.windows="{runtime.platform.path}\tools\espota.exe" -r tools.gen_esp32part.cmd=python3 "{runtime.platform.path}/tools/gen_esp32part.py" -tools.gen_esp32part.cmd.windows="{runtime.platform.path}/tools/gen_esp32part.exe" +tools.gen_esp32part.cmd.windows="{runtime.platform.path}\tools\gen_esp32part.exe" tools.gen_insights_pkg.cmd=python3 "{runtime.platform.path}"/tools/gen_insights_package.py -tools.gen_insights_pkg.cmd.windows="{runtime.platform.path}/tools/gen_insights_package.exe" +tools.gen_insights_pkg.cmd.windows="{runtime.platform.path}\tools\gen_insights_package.exe" compiler.path={tools.{build.tarch}-{build.target}-elf-gcc.path}/bin/ compiler.prefix={build.tarch}-{build.target}-elf- @@ -105,19 +101,6 @@ build.extra_flags=-DARDUINO_HOST_OS="{runtime.os}" -DARDUINO_FQBN="{build.fqbn}" build.extra_libs= build.memory_type={build.boot}_qspi -# OpenOCD default configs -build.copy_jtag_files=0 -build.openocdscript.esp32=esp32-wrover-kit-3.3v.cfg -build.openocdscript.esp32s2=esp32s2-kaluga-1.cfg -build.openocdscript.esp32s3=esp32s3-builtin.cfg -build.openocdscript.esp32c3=esp32c3-builtin.cfg -build.openocdscript.esp32c6=esp32c6-builtin.cfg -build.openocdscript.esp32c6=esp32h2-builtin.cfg -build.openocdscript={build.openocdscript.{build.mcu}} - -# Debug plugin configuration -build.debugconfig={build.mcu}.json - # Custom build options build.opt.name=build_opt.h build.opt.path={build.path}/{build.opt.name} @@ -135,7 +118,7 @@ recipe.hooks.prebuild.3.pattern.windows=cmd /c if not exist "{build.path}\partit recipe.hooks.prebuild.4.pattern_args=--chip {build.mcu} elf2image --flash_mode {build.flash_mode} --flash_freq {build.img_freq} --flash_size {build.flash_size} -o recipe.hooks.prebuild.4.pattern=/usr/bin/env bash -c "[ -f "{build.source.path}"/bootloader.bin ] && cp -f "{build.source.path}"/bootloader.bin "{build.path}"/{build.project_name}.bootloader.bin || ( [ -f "{build.variant.path}"/{build.custom_bootloader}.bin ] && cp "{build.variant.path}"/{build.custom_bootloader}.bin "{build.path}"/{build.project_name}.bootloader.bin || "{tools.esptool_py.path}"/{tools.esptool_py.cmd} {recipe.hooks.prebuild.4.pattern_args} "{build.path}"/{build.project_name}.bootloader.bin "{compiler.sdk.path}"/bin/bootloader_{build.boot}_{build.boot_freq}.elf )" recipe.hooks.prebuild.4.pattern.linux=/usr/bin/env bash -c "[ -f "{build.source.path}"/bootloader.bin ] && cp -f "{build.source.path}"/bootloader.bin "{build.path}"/{build.project_name}.bootloader.bin || ( [ -f "{build.variant.path}"/{build.custom_bootloader}.bin ] && cp "{build.variant.path}"/{build.custom_bootloader}.bin "{build.path}"/{build.project_name}.bootloader.bin || python3 "{tools.esptool_py.path}"/{tools.esptool_py.cmd} {recipe.hooks.prebuild.4.pattern_args} "{build.path}"/{build.project_name}.bootloader.bin "{compiler.sdk.path}"/bin/bootloader_{build.boot}_{build.boot_freq}.elf )" -recipe.hooks.prebuild.4.pattern.windows=cmd /c IF EXIST "{build.source.path}\bootloader.bin" ( COPY /y "{build.source.path}\bootloader.bin" "{build.path}\{build.project_name}.bootloader.bin" ) ELSE ( IF EXIST "{build.variant.path}\{build.custom_bootloader}.bin" ( COPY "{build.variant.path}\{build.custom_bootloader}.bin" "{build.path}\{build.project_name}.bootloader.bin" ) ELSE ( "{tools.esptool_py.path}/{tools.esptool_py.cmd}" {recipe.hooks.prebuild.4.pattern_args} "{build.path}\{build.project_name}.bootloader.bin" "{compiler.sdk.path}\bin\bootloader_{build.boot}_{build.boot_freq}.elf" ) ) +recipe.hooks.prebuild.4.pattern.windows=cmd /c IF EXIST "{build.source.path}\bootloader.bin" ( COPY /y "{build.source.path}\bootloader.bin" "{build.path}\{build.project_name}.bootloader.bin" ) ELSE ( IF EXIST "{build.variant.path}\{build.custom_bootloader}.bin" ( COPY "{build.variant.path}\{build.custom_bootloader}.bin" "{build.path}\{build.project_name}.bootloader.bin" ) ELSE ( "{tools.esptool_py.path}\{tools.esptool_py.cmd}" {recipe.hooks.prebuild.4.pattern_args} "{build.path}\{build.project_name}.bootloader.bin" "{compiler.sdk.path}\bin\bootloader_{build.boot}_{build.boot_freq}.elf" ) ) # Check if custom build options exist in the sketch folder recipe.hooks.prebuild.5.pattern=/usr/bin/env bash -c "[ ! -f "{build.source.path}"/build_opt.h ] || cp -f "{build.source.path}"/build_opt.h "{build.path}"/build_opt.h" @@ -146,25 +129,13 @@ recipe.hooks.prebuild.6.pattern.windows=cmd /c if not exist "{build.path}\build_ # Set -DARDUINO_CORE_BUILD only on core file compilation file_opts.path={build.path}/file_opts -recipe.hooks.prebuild.set_core_build_flag.pattern=/usr/bin/env bash -c ": > '{file_opts.path}'" -recipe.hooks.core.prebuild.set_core_build_flag.pattern=/usr/bin/env bash -c "echo -DARDUINO_CORE_BUILD > '{file_opts.path}'" -recipe.hooks.core.postbuild.set_core_build_flag.pattern=/usr/bin/env bash -c ": > '{file_opts.path}'" - -recipe.hooks.prebuild.set_core_build_flag.pattern.windows=cmd /c type nul > "{file_opts.path}" -recipe.hooks.core.prebuild.set_core_build_flag.pattern.windows=cmd /c echo "-DARDUINO_CORE_BUILD" > "{file_opts.path}" -recipe.hooks.core.postbuild.set_core_build_flag.pattern.windows=cmd /c type nul > "{file_opts.path}" +recipe.hooks.prebuild.7.pattern=/usr/bin/env bash -c ": > '{file_opts.path}'" +recipe.hooks.core.prebuild.1.pattern=/usr/bin/env bash -c "echo -DARDUINO_CORE_BUILD > '{file_opts.path}'" +recipe.hooks.core.postbuild.1.pattern=/usr/bin/env bash -c ": > '{file_opts.path}'" -# Generate debug.cfg (must be postbuild) -recipe.hooks.postbuild.1.pattern=/usr/bin/env bash -c "[ {build.copy_jtag_files} -eq 0 ] || cp -f "{debug.server.openocd.scripts_dir}"board/{build.openocdscript} "{build.source.path}"/debug.cfg" -recipe.hooks.postbuild.1.pattern.windows=cmd /c IF {build.copy_jtag_files}==1 COPY /y "{debug.server.openocd.scripts_dir}board\{build.openocdscript}" "{build.source.path}\debug.cfg" - -# Generate debug_custom.json -recipe.hooks.postbuild.2.pattern=/usr/bin/env bash -c "[ {build.copy_jtag_files} -eq 0 ] || cp -f "{runtime.platform.path}"/tools/ide-debug/{build.debugconfig} "{build.source.path}"/debug_custom.json" -recipe.hooks.postbuild.2.pattern.windows=cmd /c IF {build.copy_jtag_files}==1 COPY /y "{runtime.platform.path}\tools\ide-debug\{build.debugconfig}" "{build.source.path}\debug_custom.json" - -# Generate chip.svd -recipe.hooks.postbuild.3.pattern=/usr/bin/env bash -c "[ {build.copy_jtag_files} -eq 0 ] || cp -f "{runtime.platform.path}"/tools/ide-debug/svd/{build.mcu}.svd "{build.source.path}"/debug.svd" -recipe.hooks.postbuild.3.pattern.windows=cmd /c IF {build.copy_jtag_files}==1 COPY /y "{runtime.platform.path}\tools\ide-debug\svd\{build.mcu}.svd" "{build.source.path}\debug.svd" +recipe.hooks.prebuild.7.pattern.windows=cmd /c type nul > "{file_opts.path}" +recipe.hooks.core.prebuild.1.pattern.windows=cmd /c echo "-DARDUINO_CORE_BUILD" > "{file_opts.path}" +recipe.hooks.core.postbuild.1.pattern.windows=cmd /c type nul > "{file_opts.path}" ## Compile c files recipe.c.o.pattern="{compiler.path}{compiler.c.cmd}" {compiler.c.extra_flags} {compiler.c.flags} -DF_CPU={build.f_cpu} -DARDUINO={runtime.ide.version} -DARDUINO_{build.board} -DARDUINO_ARCH_{build.arch} -DARDUINO_BOARD="{build.board}" -DARDUINO_VARIANT="{build.variant}" -DARDUINO_PARTITION_{build.partitions} {build.extra_flags} {compiler.cpreprocessor.flags} {includes} "@{build.opt.path}" "@{file_opts.path}" "{source_file}" -o "{object_file}" @@ -217,16 +188,83 @@ pluggable_monitor.required.serial=builtin:serial-monitor ## Upload/Debug tools ## ------------------ -# Debugger configuration (general options) -# ---------------------------------------- -# EXPERIMENTAL feature: -# - this is alpha and may be subject to change without notice +# Debugger configuration +# ---------------------- + +# ESP32 debug configuration +debug_script.esp32=esp32-wrover-kit-3.3v.cfg +debug_config.esp32.cortex-debug.custom.name=Arduino on ESP32 +debug_config.esp32.cortex-debug.custom.postAttachCommands.0=set remote hardware-watchpoint-limit 2 +debug_config.esp32.cortex-debug.custom.postAttachCommands.1=monitor reset halt +debug_config.esp32.cortex-debug.custom.postAttachCommands.2=monitor gdb_sync +debug_config.esp32.cortex-debug.custom.postAttachCommands.3=thb setup +debug_config.esp32.cortex-debug.custom.postAttachCommands.4=c +debug_config.esp32.cortex-debug.custom.overrideRestartCommands.0=monitor reset halt +debug_config.esp32.cortex-debug.custom.overrideRestartCommands.1=monitor gdb_sync +debug_config.esp32.cortex-debug.custom.overrideRestartCommands.2=thb setup +debug_config.esp32.cortex-debug.custom.overrideRestartCommands.3=c + +# ESP32-S2 debug configuration +debug_script.esp32s2=esp32s2-kaluga-1.cfg +debug_config.esp32s2.cortex-debug.custom.name=Arduino on ESP32-S2 +debug_config.esp32s2.cortex-debug.custom.postAttachCommands.0=set remote hardware-watchpoint-limit 2 +debug_config.esp32s2.cortex-debug.custom.postAttachCommands.1=monitor reset halt +debug_config.esp32s2.cortex-debug.custom.postAttachCommands.2=monitor gdb_sync +debug_config.esp32s2.cortex-debug.custom.postAttachCommands.3=thb setup +debug_config.esp32s2.cortex-debug.custom.postAttachCommands.4=c +debug_config.esp32s2.cortex-debug.custom.overrideRestartCommands.0=monitor reset halt +debug_config.esp32s2.cortex-debug.custom.overrideRestartCommands.1=monitor gdb_sync +debug_config.esp32s2.cortex-debug.custom.overrideRestartCommands.2=thb setup +debug_config.esp32s2.cortex-debug.custom.overrideRestartCommands.3=c + +# ESP32-S3 debug configuration +debug_script.esp32s3=esp32s3-builtin.cfg +debug_config.esp32s3.cortex-debug.custom.name=Arduino on ESP32-S3 +debug_config.esp32s3.cortex-debug.custom.overrideAttachCommands.0=set remote hardware-watchpoint-limit 2 +debug_config.esp32s3.cortex-debug.custom.overrideAttachCommands.1=monitor reset halt +debug_config.esp32s3.cortex-debug.custom.overrideAttachCommands.2=monitor gdb_sync +debug_config.esp32s3.cortex-debug.custom.overrideAttachCommands.3=thb setup +debug_config.esp32s3.cortex-debug.custom.overrideAttachCommands.4=c +debug_config.esp32s3.cortex-debug.custom.overrideRestartCommands.0=monitor reset halt +debug_config.esp32s3.cortex-debug.custom.overrideRestartCommands.1=monitor gdb_sync + +# ESP32-C3 debug configuration +debug_script.esp32c3=esp32c3-builtin.cfg +debug_config.esp32c3.cortex-debug.custom.name=Arduino on ESP32-C3 +debug_config.esp32c3.cortex-debug.custom.serverArgs.0=-d3 +debug_config.esp32c3.cortex-debug.custom.overrideAttachCommands.0=set remote hardware-watchpoint-limit 8 +debug_config.esp32c3.cortex-debug.custom.overrideAttachCommands.1=monitor reset +debug_config.esp32c3.cortex-debug.custom.overrideAttachCommands.2=monitor halt +debug_config.esp32c3.cortex-debug.custom.overrideAttachCommands.3=monitor gdb_sync +debug_config.esp32c3.cortex-debug.custom.overrideAttachCommands.4=thb setup +debug_config.esp32c3.cortex-debug.custom.overrideRestartCommands.0=monitor reset +debug_config.esp32c3.cortex-debug.custom.overrideRestartCommands.1=monitor halt +debug_config.esp32c3.cortex-debug.custom.overrideRestartCommands.2=monitor gdb_sync +debug_config.esp32c3.cortex-debug.custom.overrideRestartCommands.3=thb setup + +# ESP32-C6 debug configuration (TBD) +debug_script.esp32c6=esp32c6-builtin.cfg +debug_config.esp32c6= + +# ESP32-H2 debug configuration (TBD) +debug_script.esp32h2=esp32h2-builtin.cfg +debug_config.esp32h2= + +# Debug API variable definitions debug.executable={build.path}/{build.project_name}.elf debug.toolchain=gcc debug.toolchain.path={tools.{build.tarch}-esp-elf-gdb.path}/bin/ -debug.toolchain.prefix={build.tarch}-{build.target}-elf- +debug.toolchain.prefix={build.tarch}-{build.target}-elf debug.server=openocd -debug.server.openocd.script=debug.cfg +debug.server.openocd.path={runtime.platform.path}/tools/openocd-esp32/bin/openocd +debug.server.openocd.scripts_dir={runtime.platform.path}/tools/openocd-esp32/share/openocd/scripts/ +debug.server.openocd.scripts_dir.windows={runtime.platform.path}\tools\openocd-esp32\share\openocd\scripts\ +debug.server.openocd.scripts.0=board/{debug_script.{build.mcu}} +debug.svd_file={runtime.platform.path}/tools/ide-debug/svd/{build.mcu}.svd + +debug.cortex-debug.custom.objdumpPath={compiler.path}{compiler.prefix}objdump +debug.cortex-debug.custom.request=attach +debug.additional_config=debug_config.{build.mcu} ## ## ESPTool diff --git a/tests/periman/periman.ino b/tests/periman/periman.ino new file mode 100644 index 00000000000..dd9d61724a9 --- /dev/null +++ b/tests/periman/periman.ino @@ -0,0 +1,297 @@ +/* Peripheral Manager test + * + * This test is using Serial to check if the peripheral manager is able to + * attach and detach peripherals correctly on shared pins. + * Make sure that the peripheral names contain only letters, numbers and underscores. + * + * This test skips the following peripherals: + * - USB: USB is not able to be detached + * - SDMMC: SDMMC requires a card to be mounted before the pins are attached + * - ETH: ETH requires a ethernet port to be connected before the pins are attached + */ + +#if SOC_I2S_SUPPORTED +#include "ESP_I2S.h" +#endif + +#if SOC_I2C_SUPPORTED +#include "Wire.h" +#endif + +#if SOC_GPSPI_SUPPORTED +#include "SPI.h" +#endif + +/* Definitions */ + +#define UART1_RX_DEFAULT 4 +#define UART1_TX_DEFAULT 5 + +#define ADC1_DEFAULT A4 + +#if CONFIG_IDF_TARGET_ESP32 +# define ADC2_DEFAULT A5 +#else +# define ADC2_DEFAULT A3 +#endif + +#if CONFIG_IDF_TARGET_ESP32 +# define TOUCH1_DEFAULT T0 +# define TOUCH2_DEFAULT T2 +#else +# define TOUCH1_DEFAULT T4 +# define TOUCH2_DEFAULT T5 +#endif + +/* Global variables */ + +bool test_executed = false; +String current_test; +int8_t uart1_rx_pin; +int8_t uart1_tx_pin; + +/* Callback functions */ + +void onReceive_cb(void) { + // This is a callback function that will be activated on UART RX events + size_t available = Serial1.available(); + while (available --) { + Serial.print((char)Serial1.read()); + } +} + +// This function is called by before each test is run +void setup_test(String test_name, int8_t rx_pin = UART1_RX_DEFAULT, int8_t tx_pin = UART1_TX_DEFAULT) { + log_v("Setting up %s test", test_name.c_str()); + + current_test = test_name; + uart1_rx_pin = rx_pin; + uart1_tx_pin = tx_pin; + test_executed = false; + + pinMode(uart1_rx_pin, INPUT_PULLUP); + pinMode(uart1_tx_pin, OUTPUT); + Serial1.setPins(uart1_rx_pin, uart1_tx_pin); + uart_internal_loopback(1, uart1_rx_pin); + delay(100); + log_v("Running %s test", test_name.c_str()); +} + +// This function is called after each test is run +void teardown_test(void) { + log_v("Tearing down %s test", current_test.c_str()); + if (test_executed) { + pinMode(uart1_rx_pin, INPUT_PULLUP); + pinMode(uart1_tx_pin, OUTPUT); + Serial1.print(current_test); + Serial1.println(" test: This should not be printed"); + Serial1.flush(); + + Serial1.setPins(uart1_rx_pin, uart1_tx_pin); + uart_internal_loopback(1, uart1_rx_pin); + delay(100); + } + + Serial1.print(current_test); + Serial1.println(" test: This should be printed"); + Serial1.flush(); + + log_v("Finished %s test", current_test.c_str()); +} + +/* Test functions */ +/* These functions must call "setup_test" and "teardown_test" and set "test_executed" to true + * if the test is executed + */ + +void gpio_test(void) { + setup_test("GPIO"); + test_executed = true; + pinMode(uart1_rx_pin, INPUT); + pinMode(uart1_tx_pin, OUTPUT); + digitalRead(uart1_rx_pin); + digitalWrite(uart1_tx_pin, HIGH); + teardown_test(); +} + +void sigmadelta_test(void) { + setup_test("SigmaDelta"); +#if SOC_SDM_SUPPORTED + test_executed = true; + if (!sigmaDeltaAttach(uart1_rx_pin, 312500)) { + Serial.println("SigmaDelta init failed"); + } + if (!sigmaDeltaAttach(uart1_tx_pin, 312500)) { + Serial.println("SigmaDelta init failed"); + } +#endif + teardown_test(); +} + +void adc_oneshot_test(void) { +#if !SOC_ADC_SUPPORTED + setup_test("ADC_Oneshot"); +#else + setup_test("ADC_Oneshot", ADC1_DEFAULT, ADC2_DEFAULT); + test_executed = true; + analogReadResolution(12); + pinMode(ADC1_DEFAULT, INPUT); + pinMode(ADC2_DEFAULT, INPUT); + analogRead(ADC1_DEFAULT); + analogRead(ADC2_DEFAULT); +#endif + teardown_test(); +} + +#if SOC_ADC_SUPPORTED +volatile bool adc_coversion_done = false; +void ARDUINO_ISR_ATTR adcComplete() { + adc_coversion_done = true; +} +#endif + +void adc_continuous_test(void) { +#if !SOC_ADC_SUPPORTED + setup_test("ADC_Continuous"); +#else + setup_test("ADC_Continuous", ADC1_DEFAULT, ADC2_DEFAULT); + test_executed = true; + uint8_t adc_pins[] = {ADC1_DEFAULT, ADC2_DEFAULT}; + uint8_t adc_pins_count = 2; + adc_continuos_data_t * result = NULL; + + analogContinuousSetWidth(12); + analogContinuousSetAtten(ADC_11db); + + analogContinuous(adc_pins, adc_pins_count, 6, 20000, &adcComplete); + analogContinuousStart(); + + while (adc_coversion_done == false) { + delay(1); + } + + if (!analogContinuousRead(&result, 0)) { + Serial.println("ADC continuous read failed"); + } + + analogContinuousStop(); +#endif + teardown_test(); +} + +void dac_test(void) { +#if !SOC_DAC_SUPPORTED + setup_test("DAC"); +#else + setup_test("DAC", DAC1, DAC2); + test_executed = true; + dacWrite(DAC1, 255); + dacWrite(DAC2, 255); +#endif + teardown_test(); +} + +void ledc_test(void) { + setup_test("LEDC"); +#if SOC_LEDC_SUPPORTED + test_executed = true; + if (!ledcAttach(uart1_rx_pin, 5000, 12)) { + Serial.println("LEDC init failed"); + } + if (!ledcAttach(uart1_tx_pin, 5000, 12)) { + Serial.println("LEDC init failed"); + } +#endif + teardown_test(); +} + +void rmt_test(void) { + setup_test("RMT"); +#if SOC_RMT_SUPPORTED + test_executed = true; + if (!rmtInit(uart1_rx_pin, RMT_TX_MODE, RMT_MEM_NUM_BLOCKS_1, 10000000)) { + Serial.println("RMT init failed"); + } + if (!rmtInit(uart1_tx_pin, RMT_RX_MODE, RMT_MEM_NUM_BLOCKS_1, 10000000)) { + Serial.println("RMT init failed"); + } +#endif + teardown_test(); +} + +void i2s_test(void) { + setup_test("I2S"); +#if SOC_I2S_SUPPORTED + test_executed = true; + I2SClass i2s; + + i2s.setPins(uart1_rx_pin, uart1_tx_pin, -1); + i2s.setTimeout(1000); + if (!i2s.begin(I2S_MODE_STD, 16000, I2S_DATA_BIT_WIDTH_16BIT, I2S_SLOT_MODE_STEREO)) { + Serial.println("I2S init failed"); + } +#endif + teardown_test(); +} + +void i2c_test(void) { + setup_test("I2C"); +#if SOC_I2C_SUPPORTED + test_executed = true; + if (!Wire.begin(uart1_rx_pin, uart1_tx_pin)) { + Serial.println("I2C init failed"); + } +#endif + teardown_test(); +} + +void spi_test(void) { + setup_test("SPI"); +#if SOC_GPSPI_SUPPORTED + test_executed = true; + SPI.begin(uart1_rx_pin, uart1_tx_pin, -1, -1); +#endif + teardown_test(); +} + +void touch_test(void) { +#if !SOC_TOUCH_SENSOR_SUPPORTED + setup_test("Touch"); +#else + setup_test("Touch", TOUCH1_DEFAULT, TOUCH2_DEFAULT); + test_executed = true; + touchRead(TOUCH1_DEFAULT); + touchRead(TOUCH2_DEFAULT); +#endif + teardown_test(); +} + +/* Main functions */ + +void setup() { + Serial.begin(115200); + while(!Serial) { delay(10); } + + Serial1.setPins(UART1_RX_DEFAULT, UART1_TX_DEFAULT); + Serial1.begin(115200); + while(!Serial1) { delay(10); } + Serial1.onReceive(onReceive_cb); + uart_internal_loopback(1, uart1_rx_pin); + + gpio_test(); + sigmadelta_test(); + ledc_test(); + rmt_test(); + i2s_test(); + i2c_test(); + spi_test(); + adc_oneshot_test(); + adc_continuous_test(); + dac_test(); + touch_test(); + + // Print to Serial1 to avoid buffering issues + Serial1.println("Peripheral Manager test done"); +} + +void loop() {} diff --git a/tests/periman/test_periman.py b/tests/periman/test_periman.py new file mode 100644 index 00000000000..4bce226bfad --- /dev/null +++ b/tests/periman/test_periman.py @@ -0,0 +1,26 @@ +def test_periman(dut): + peripherals = ["GPIO", "SigmaDelta", "LEDC", "RMT", "I2S", "I2C", "SPI", + "ADC_Oneshot", "ADC_Continuous", "DAC", "Touch"] + + pattern = rb"(?:\b\w+\b test: This should(?: not)? be printed|Peripheral Manager test done)" + + while True: + try: + res = dut.expect(pattern, timeout=10) + except: + assert False, f"Could not detect end of test" + + console_output = res.group(0).decode("utf-8") + peripheral = console_output.split()[0] + + if "Peripheral Manager test done" in console_output: + break + + if peripheral in peripherals: + if "not" in console_output: + assert False, f"Peripheral {peripheral} printed when it should not" + peripherals.remove(peripheral) + else: + assert False, f"Unknown peripheral: {peripheral}" + + assert peripherals == [], f"Missing peripherals output: {peripherals}" diff --git a/tests/uart/uart.ino b/tests/uart/uart.ino index d056dcc1b39..c10dfc58b24 100644 --- a/tests/uart/uart.ino +++ b/tests/uart/uart.ino @@ -78,11 +78,11 @@ void start_serial(unsigned long baudrate = 115200) { // This function stops all the available test UARTs void stop_serial(bool hard_stop = false) { #if SOC_UART_NUM >= 2 - Serial1.end(hard_stop); + Serial1.end(/*hard_stop*/); #endif #if SOC_UART_NUM >= 3 - Serial2.end(hard_stop); + Serial2.end(/*hard_stop*/); #endif } @@ -139,6 +139,19 @@ void task_delayed_msg(void *pvParameters) { // This function is automatically called by unity before each test is run void setUp(void) { start_serial(115200); +#if SOC_UART_NUM == 2 + log_d("Setup internal loop-back from and back to Serial1 (UART1) TX >> Serial1 (UART1) RX"); + + Serial1.onReceive([]() {onReceive_cb(Serial1);}); + uart_internal_loopback(1, RX1); +#elif SOC_UART_NUM == 3 + log_d("Setup internal loop-back between Serial1 (UART1) <<--->> Serial2 (UART2)"); + + Serial1.onReceive([]() {onReceive_cb(Serial1);}); + Serial2.onReceive([]() {onReceive_cb(Serial2);}); + uart_internal_loopback(1, RX2); + uart_internal_loopback(2, RX1); +#endif } // This function is automatically called by unity after each test is run @@ -393,7 +406,7 @@ void disabled_uart_calls_test(void) { // This test checks if the pins can be changed and if the message can be transmitted and received correctly after the change void change_pins_test(void) { - stop_serial(); + //stop_serial(); log_d("Disabling UART loopback"); @@ -453,7 +466,7 @@ void auto_baudrate_test(void) { selected_serial = &Serial2; #endif - selected_serial->end(false); + //selected_serial->end(false); log_d("Starting delayed task to send message"); diff --git a/tools/ide-debug/esp32.json b/tools/ide-debug/esp32.json deleted file mode 100644 index 4dbe4314e62..00000000000 --- a/tools/ide-debug/esp32.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "name":"Arduino on ESP32", - "toolchainPrefix":"xtensa-esp32-elf", - "svdFile":"debug.svd", - "request":"attach", - "postAttachCommands":[ - "set remote hardware-watchpoint-limit 2", - "monitor reset halt", - "monitor gdb_sync", - "thb setup", - "c" - ], - "overrideRestartCommands":[ - "monitor reset halt", - "monitor gdb_sync", - "thb setup", - "c" - ] -} \ No newline at end of file diff --git a/tools/ide-debug/esp32c3.json b/tools/ide-debug/esp32c3.json deleted file mode 100644 index 5af69052ff3..00000000000 --- a/tools/ide-debug/esp32c3.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "name":"Arduino on ESP32-C3", - "toolchainPrefix":"riscv32-esp-elf", - "svdFile":"debug.svd", - "request":"attach", - "serverArgs":[ - "-d3" - ], - "overrideAttachCommands":[ - "set remote hardware-watchpoint-limit 8", - "monitor reset", - "monitor halt", - "monitor gdb_sync", - "thb setup" - ], - "overrideRestartCommands":[ - "monitor reset", - "monitor halt", - "monitor gdb_sync", - "thb setup" - ] -} \ No newline at end of file diff --git a/tools/ide-debug/esp32s2.json b/tools/ide-debug/esp32s2.json deleted file mode 100644 index c60e912c0b8..00000000000 --- a/tools/ide-debug/esp32s2.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "name":"Arduino on ESP32-S2", - "toolchainPrefix":"xtensa-esp32s2-elf", - "svdFile":"debug.svd", - "request":"attach", - "postAttachCommands":[ - "set remote hardware-watchpoint-limit 2", - "monitor reset halt", - "monitor gdb_sync", - "thb setup", - "c" - ], - "overrideRestartCommands":[ - "monitor reset halt", - "monitor gdb_sync", - "thb setup", - "c" - ] -} \ No newline at end of file diff --git a/tools/ide-debug/esp32s3-arduino.json b/tools/ide-debug/esp32s3-arduino.json deleted file mode 100644 index 559d2878cbe..00000000000 --- a/tools/ide-debug/esp32s3-arduino.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "name":"Arduino on ESP32-S3", - "toolchainPrefix":"xtensa-esp32s3-elf", - "svdFile":"debug.svd", - "request":"attach", - "overrideAttachCommands":[ - "set remote hardware-watchpoint-limit 2", - "monitor reset halt", - "monitor gdb_sync", - "thb setup", - "interrupt" - ], - "overrideRestartCommands":[ - "monitor reset halt", - "monitor gdb_sync", - "interrupt" - ] -} diff --git a/tools/ide-debug/esp32s3.json b/tools/ide-debug/esp32s3.json deleted file mode 100644 index 9f44e603f4c..00000000000 --- a/tools/ide-debug/esp32s3.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "name":"Arduino on ESP32-S3", - "toolchainPrefix":"xtensa-esp32s3-elf", - "svdFile":"debug.svd", - "request":"attach", - "overrideAttachCommands":[ - "set remote hardware-watchpoint-limit 2", - "monitor reset halt", - "monitor gdb_sync", - "thb setup", - "c" - ], - "overrideRestartCommands":[ - "monitor reset halt", - "monitor gdb_sync" - ] -} \ No newline at end of file diff --git a/tools/partitions/default_ffat_8MB.csv b/tools/partitions/default_ffat_8MB.csv new file mode 100644 index 00000000000..2791bf7912e --- /dev/null +++ b/tools/partitions/default_ffat_8MB.csv @@ -0,0 +1,7 @@ +# Name, Type, SubType, Offset, Size, Flags +nvs, data, nvs, 0x9000, 0x5000, +otadata, data, ota, 0xe000, 0x2000, +app0, app, ota_0, 0x10000, 0x330000, +app1, app, ota_1, 0x340000,0x330000, +ffat, data, fat, 0x670000,0x180000, +coredump, data, coredump,0x7F0000,0x10000, diff --git a/tools/partitions/large_ffat_8MB.csv b/tools/partitions/large_ffat_8MB.csv new file mode 100644 index 00000000000..20632d6c512 --- /dev/null +++ b/tools/partitions/large_ffat_8MB.csv @@ -0,0 +1,7 @@ +# Name, Type, SubType, Offset, Size, Flags +nvs, data, nvs, 0x9000, 0x5000, +otadata, data, ota, 0xe000, 0x2000, +app0, app, ota_0, 0x10000, 0x140000, +app1, app, ota_1, 0x150000,0x140000, +ffat, data, fat, 0x290000,0x560000, +coredump, data, coredump,0x7F0000,0x10000, diff --git a/tools/partitions/large_spiffs_8MB.csv b/tools/partitions/large_spiffs_8MB.csv new file mode 100644 index 00000000000..ecf87c6d280 --- /dev/null +++ b/tools/partitions/large_spiffs_8MB.csv @@ -0,0 +1,7 @@ +# Name, Type, SubType, Offset, Size, Flags +nvs, data, nvs, 0x9000, 0x5000, +otadata, data, ota, 0xe000, 0x2000, +app0, app, ota_0, 0x10000, 0x140000, +app1, app, ota_1, 0x150000,0x140000, +spiffs, data, spiffs, 0x290000,0x560000, +coredump, data, coredump,0x7F0000,0x10000, diff --git a/variants/m5stack_cores3/partitions_16MB_factory_4_apps.csv b/tools/partitions/m5stack_partitions_16MB_factory_4_apps.csv similarity index 100% rename from variants/m5stack_cores3/partitions_16MB_factory_4_apps.csv rename to tools/partitions/m5stack_partitions_16MB_factory_4_apps.csv diff --git a/variants/m5stack_cores3/partitions_16MB_factory_6_apps.csv b/tools/partitions/m5stack_partitions_16MB_factory_6_apps.csv similarity index 100% rename from variants/m5stack_cores3/partitions_16MB_factory_6_apps.csv rename to tools/partitions/m5stack_partitions_16MB_factory_6_apps.csv diff --git a/tools/partitions/zigbee_zczr.csv b/tools/partitions/zigbee_zczr.csv index 984bf0d081f..5bceac4a5a6 100644 --- a/tools/partitions/zigbee_zczr.csv +++ b/tools/partitions/zigbee_zczr.csv @@ -3,7 +3,7 @@ nvs, data, nvs, 0x9000, 0x5000, otadata, data, ota, 0xe000, 0x2000, app0, app, ota_0, 0x10000, 0x140000, app1, app, ota_1, 0x150000,0x140000, -spiffs, data, spiffs, 0x28F000,0x15A000, +spiffs, data, spiffs, 0x290000,0x15A000, zb_storage, data, fat, 0x3EA000,0x4000, zb_fct, data, fat, 0x3EE000,0x1000, rcp_fw, data, spiffs, 0x3EF000,0x1000, diff --git a/tools/platformio-build.py b/tools/platformio-build.py index e9dc5387187..0127f835d8e 100644 --- a/tools/platformio-build.py +++ b/tools/platformio-build.py @@ -102,7 +102,7 @@ def generate_bootloader_image(bootloader_elf): '"$PYTHONEXE" "$OBJCOPY"', "--chip", build_mcu, "elf2image", "--flash_mode", "${__get_board_flash_mode(__env__)}", - "--flash_freq", "${__get_board_f_flash(__env__)}", + "--flash_freq", "${__get_board_f_image(__env__)}", "--flash_size", board_config.get("upload.flash_size", "4MB"), "-o", "$TARGET", "$SOURCES" ]), "Building $TARGET"), diff --git a/variants/adafruit_camera_esp32s3/bootloader-tinyuf2.bin b/variants/adafruit_camera_esp32s3/bootloader-tinyuf2.bin index 721a1a1c70c..f0169612e13 100644 Binary files a/variants/adafruit_camera_esp32s3/bootloader-tinyuf2.bin and b/variants/adafruit_camera_esp32s3/bootloader-tinyuf2.bin differ diff --git a/variants/adafruit_camera_esp32s3/pins_arduino.h b/variants/adafruit_camera_esp32s3/pins_arduino.h index 26c72ad392c..62132dcadc3 100644 --- a/variants/adafruit_camera_esp32s3/pins_arduino.h +++ b/variants/adafruit_camera_esp32s3/pins_arduino.h @@ -24,7 +24,7 @@ static const uint8_t LED_BUILTIN = PIN_NEOPIXEL+SOC_GPIO_PIN_COUNT; #define RGB_BRIGHTNESS 64 -//static const uint8_t TFT_BACKLIGHT = 41; +static const uint8_t TFT_BACKLIGHT = 45; static const uint8_t TFT_DC = 40; static const uint8_t TFT_CS = 39; static const uint8_t TFT_RESET = 38; @@ -32,10 +32,10 @@ static const uint8_t TFT_RST = 38; static const uint8_t SD_CS = 48; static const uint8_t SD_CHIP_SELECT = 48; -static const uint8_t SPEAKER = 41; +static const uint8_t SPEAKER = 46; -static const uint8_t SDA = 33; -static const uint8_t SCL = 34; +static const uint8_t SCL = 33; +static const uint8_t SDA = 34; static const uint8_t SS = 48; static const uint8_t MOSI = 35; @@ -55,19 +55,16 @@ static const uint8_t DAC2 = 18; #define AWEXP_SPKR_SD 0 #define AWEXP_BUTTON_SEL 1 -#define AWEXP_BACKLIGHT 2 -#define AWEXP_CAM_PWDN 7 #define AWEXP_SD_DET 8 #define AWEXP_SD_PWR 9 -#define AWEXP_CAM_RST 10 #define AWEXP_BUTTON_OK 11 #define AWEXP_BUTTON_RIGHT 12 #define AWEXP_BUTTON_UP 13 #define AWEXP_BUTTON_LEFT 14 #define AWEXP_BUTTON_DOWN 15 -#define PWDN_GPIO_NUM -1 // connected through expander -#define RESET_GPIO_NUM -1 // connected through expander +#define RESET_GPIO_NUM 47 +#define PWDN_GPIO_NUM 21 #define XCLK_GPIO_NUM 8 #define SIOD_GPIO_NUM SDA #define SIOC_GPIO_NUM SCL diff --git a/variants/adafruit_camera_esp32s3/tinyuf2.bin b/variants/adafruit_camera_esp32s3/tinyuf2.bin index 21e91284e05..0247a171331 100644 Binary files a/variants/adafruit_camera_esp32s3/tinyuf2.bin and b/variants/adafruit_camera_esp32s3/tinyuf2.bin differ diff --git a/variants/adafruit_camera_esp32s3/variant.cpp b/variants/adafruit_camera_esp32s3/variant.cpp index dd3170f994a..06e5c24cb76 100644 --- a/variants/adafruit_camera_esp32s3/variant.cpp +++ b/variants/adafruit_camera_esp32s3/variant.cpp @@ -31,6 +31,15 @@ extern "C" { // Initialize variant/board, called before setup() void initVariant(void) { - + pinMode(TFT_BACKLIGHT, OUTPUT); + digitalWrite(TFT_BACKLIGHT, LOW); + pinMode(SD_CS, OUTPUT); + digitalWrite(SD_CS, HIGH); + pinMode(TFT_CS, OUTPUT); + digitalWrite(TFT_CS, HIGH); + pinMode(TFT_RESET, OUTPUT); + digitalWrite(TFT_RESET, LOW); + delay(1); + digitalWrite(TFT_RESET, HIGH); } } diff --git a/variants/adafruit_metro_esp32s3/bootloader-tinyuf2.bin b/variants/adafruit_metro_esp32s3/bootloader-tinyuf2.bin index 73e8c06b33b..2ed855b65a5 100644 Binary files a/variants/adafruit_metro_esp32s3/bootloader-tinyuf2.bin and b/variants/adafruit_metro_esp32s3/bootloader-tinyuf2.bin differ diff --git a/variants/adafruit_metro_esp32s3/pins_arduino.h b/variants/adafruit_metro_esp32s3/pins_arduino.h index 9963d1aa476..e9769f113f6 100644 --- a/variants/adafruit_metro_esp32s3/pins_arduino.h +++ b/variants/adafruit_metro_esp32s3/pins_arduino.h @@ -14,7 +14,7 @@ #define BUILTIN_LED LED_BUILTIN // backward compatibility // Neopixel -#define PIN_NEOPIXEL 45 +#define PIN_NEOPIXEL 46 // RGB_BUILTIN and RGB_BRIGHTNESS can be used in new Arduino API neopixelWrite() and digitalWrite() for blinking #define RGB_BUILTIN (PIN_NEOPIXEL+SOC_GPIO_PIN_COUNT) #define RGB_BRIGHTNESS 64 diff --git a/variants/adafruit_metro_esp32s3/tinyuf2.bin b/variants/adafruit_metro_esp32s3/tinyuf2.bin index d57e5b75b55..25a5ba66b1e 100644 Binary files a/variants/adafruit_metro_esp32s3/tinyuf2.bin and b/variants/adafruit_metro_esp32s3/tinyuf2.bin differ diff --git a/variants/adafruit_metro_esp32s3/variant.cpp b/variants/adafruit_metro_esp32s3/variant.cpp index 811a6d508c9..485f08b4aef 100644 --- a/variants/adafruit_metro_esp32s3/variant.cpp +++ b/variants/adafruit_metro_esp32s3/variant.cpp @@ -30,7 +30,8 @@ extern "C" { // Initialize variant/board, called before setup() void initVariant(void) { - // default SD_CS to input pullup + // default SD_CS to input pullup (we cannot have built in pullup since its + // a strapping pin!) pinMode(SS, INPUT_PULLUP); } diff --git a/variants/arduino_nano_nora/pins_arduino.h b/variants/arduino_nano_nora/pins_arduino.h index ea5d882573c..e1d0f6aa9af 100644 --- a/variants/arduino_nano_nora/pins_arduino.h +++ b/variants/arduino_nano_nora/pins_arduino.h @@ -76,6 +76,12 @@ static constexpr uint8_t A7 = 14; #endif +// Aliases + +static constexpr uint8_t LEDR = LED_RED; +static constexpr uint8_t LEDG = LED_GREEN; +static constexpr uint8_t LEDB = LED_BLUE; + // alternate pin functions static constexpr uint8_t LED_BUILTIN = D13; diff --git a/variants/esp32s3_powerfeather/pins_arduino.h b/variants/esp32s3_powerfeather/pins_arduino.h index d1c486901c7..2066cf3e002 100644 --- a/variants/esp32s3_powerfeather/pins_arduino.h +++ b/variants/esp32s3_powerfeather/pins_arduino.h @@ -9,12 +9,12 @@ #define USB_PRODUCT "ESP32-S3 PowerFeather" #define USB_SERIAL "" -static const uint8_t ALARM = 7; +static const uint8_t ALARM = 21; static const uint8_t INT = 5; static const uint8_t LED = 46; static const uint8_t BTN = 0; -static const uint8_t EN = 13; +static const uint8_t EN = 7; static const uint8_t TX = 44; static const uint8_t RX = 42; @@ -37,6 +37,8 @@ static const uint8_t A5 = 1; static const uint8_t D5 = 15; static const uint8_t D6 = 16; +static const uint8_t D7 = 37; +static const uint8_t D8 = 6; static const uint8_t D9 = 17; static const uint8_t D10 = 18; static const uint8_t D11 = 45; diff --git a/variants/heltec_wireless_stick_V1/pins_arduino.h b/variants/heltec_wireless_stick_V1/pins_arduino.h new file mode 100644 index 00000000000..1c1b2196da3 --- /dev/null +++ b/variants/heltec_wireless_stick_V1/pins_arduino.h @@ -0,0 +1,68 @@ +#ifndef Pins_Arduino_h +#define Pins_Arduino_h + +#include + +#define Wireless_Stick true +#define DISPLAY_HEIGHT 32 +#define DISPLAY_WIDTH 64 + +static const uint8_t LED_BUILTIN = 25; +#define BUILTIN_LED LED_BUILTIN // backward compatibility +#define LED_BUILTIN LED_BUILTIN // allow testing #ifdef LED_BUILTIN + +static const uint8_t KEY_BUILTIN = 0; + +static const uint8_t TX = 1; +static const uint8_t RX = 3; + +static const uint8_t SDA = 21; +static const uint8_t SCL = 22; + +static const uint8_t SS = 18; +static const uint8_t MOSI = 27; +static const uint8_t MISO = 19; +static const uint8_t SCK = 5; + +static const uint8_t A0 = 36; +static const uint8_t A3 = 39; +static const uint8_t A4 = 32; +static const uint8_t A5 = 33; +static const uint8_t A6 = 34; +static const uint8_t A7 = 35; +static const uint8_t A10 = 4; +static const uint8_t A11 = 0; +static const uint8_t A12 = 2; +static const uint8_t A13 = 15; +static const uint8_t A14 = 13; +static const uint8_t A15 = 12; +static const uint8_t A16 = 14; +static const uint8_t A17 = 27; +static const uint8_t A18 = 25; +static const uint8_t A19 = 26; + +static const uint8_t T0 = 4; +static const uint8_t T1 = 0; +static const uint8_t T2 = 2; +static const uint8_t T3 = 15; +static const uint8_t T4 = 13; +static const uint8_t T5 = 12; +static const uint8_t T6 = 14; +static const uint8_t T7 = 27; +static const uint8_t T8 = 33; +static const uint8_t T9 = 32; + +static const uint8_t DAC1 = 25; +static const uint8_t DAC2 = 26; + +static const uint8_t Vext = 21; +static const uint8_t LED = 25; +static const uint8_t RST_OLED = 16; +static const uint8_t SCL_OLED = 15; +static const uint8_t SDA_OLED = 4; +static const uint8_t RST_LoRa = 14; +static const uint8_t DIO0 = 26; +static const uint8_t DIO1 = 33; +static const uint8_t DIO2 = 32; + +#endif /* Pins_Arduino_h */ diff --git a/variants/heltec_wireless_tracker/pins_arduino.h b/variants/heltec_wireless_tracker/pins_arduino.h new file mode 100644 index 00000000000..d8a759a094c --- /dev/null +++ b/variants/heltec_wireless_tracker/pins_arduino.h @@ -0,0 +1,71 @@ +#ifndef Pins_Arduino_h +#define Pins_Arduino_h + +#include +#include "soc/soc_caps.h" + +#define USB_VID 0x303a +#define USB_PID 0x1001 + +// Some boards have too low voltage on this pin (board design bug) +// Use different pin with 3V and connect with 48 +// and change this setup for the chosen pin (for example 38) +static const uint8_t LED_BUILTIN = SOC_GPIO_PIN_COUNT+48; +#define BUILTIN_LED LED_BUILTIN // backward compatibility +#define LED_BUILTIN LED_BUILTIN +#define RGB_BUILTIN LED_BUILTIN +#define RGB_BRIGHTNESS 64 + +static const uint8_t TX = 43; +static const uint8_t RX = 44; + +static const uint8_t SDA = 41; +static const uint8_t SCL = 42; + +static const uint8_t SS = 8; +static const uint8_t MOSI = 10; +static const uint8_t MISO = 11; +static const uint8_t SCK = 9; + +static const uint8_t A0 = 1; +static const uint8_t A1 = 2; +static const uint8_t A2 = 3; +static const uint8_t A3 = 4; +static const uint8_t A4 = 5; +static const uint8_t A5 = 6; +static const uint8_t A6 = 7; +static const uint8_t A7 = 8; +static const uint8_t A8 = 9; +static const uint8_t A9 = 10; +static const uint8_t A10 = 11; +static const uint8_t A11 = 12; +static const uint8_t A12 = 13; +static const uint8_t A13 = 14; +static const uint8_t A14 = 15; +static const uint8_t A15 = 16; +static const uint8_t A16 = 17; +static const uint8_t A17 = 18; +static const uint8_t A18 = 19; +static const uint8_t A19 = 20; + +static const uint8_t T1 = 1; +static const uint8_t T2 = 2; +static const uint8_t T3 = 3; +static const uint8_t T4 = 4; +static const uint8_t T5 = 5; +static const uint8_t T6 = 6; +static const uint8_t T7 = 7; +static const uint8_t T8 = 8; +static const uint8_t T9 = 9; +static const uint8_t T10 = 10; +static const uint8_t T11 = 11; +static const uint8_t T12 = 12; +static const uint8_t T13 = 13; +static const uint8_t T14 = 14; + +static const uint8_t Vext = 3; +static const uint8_t LED = 18; +static const uint8_t RST_OLED = 39; +static const uint8_t SCL_OLED = 41; +static const uint8_t SDA_OLED = 42; +#endif /* Pins_Arduino_h */ diff --git a/variants/m5stack_atom/pins_arduino.h b/variants/m5stack_atom/pins_arduino.h index 00f3d130743..06a3ec76f64 100644 --- a/variants/m5stack_atom/pins_arduino.h +++ b/variants/m5stack_atom/pins_arduino.h @@ -6,12 +6,10 @@ static const uint8_t TX = 1; static const uint8_t RX = 3; -static const uint8_t TXD2 = 32; -static const uint8_t RXD2 = 26; - static const uint8_t SDA = 26; static const uint8_t SCL = 32; + static const uint8_t G12 = 12; static const uint8_t G19 = 19; static const uint8_t G21 = 21; diff --git a/variants/m5stack_atoms3/pins_arduino.h b/variants/m5stack_atoms3/pins_arduino.h index 4da5a93b978..2fab4d136b1 100644 --- a/variants/m5stack_atoms3/pins_arduino.h +++ b/variants/m5stack_atoms3/pins_arduino.h @@ -7,9 +7,12 @@ #define USB_VID 0x303a #define USB_PID 0x1001 -static const uint8_t LED_BUILTIN = SOC_GPIO_PIN_COUNT + 35; -#define BUILTIN_LED LED_BUILTIN // backward compatibility -#define LED_BUILTIN LED_BUILTIN // allow testing #ifdef LED_BUILTIN +// Some boards have too low voltage on this pin (board design bug) +// Use different pin with 3V and connect with 48 +// and change this setup for the chosen pin (for example 38) +static const uint8_t LED_BUILTIN = SOC_GPIO_PIN_COUNT + 48; +#define BUILTIN_LED LED_BUILTIN // backward compatibility +#define LED_BUILTIN LED_BUILTIN #define RGB_BUILTIN LED_BUILTIN #define RGB_BRIGHTNESS 64 diff --git a/variants/m5stack_capsule/pins_arduino.h b/variants/m5stack_capsule/pins_arduino.h new file mode 100644 index 00000000000..2f3473bb368 --- /dev/null +++ b/variants/m5stack_capsule/pins_arduino.h @@ -0,0 +1,51 @@ +#ifndef Pins_Arduino_h +#define Pins_Arduino_h + +#include +#include "soc/soc_caps.h" + +#define USB_VID 0x303a +#define USB_PID 0x1001 + +static const uint8_t TX = 43; +static const uint8_t RX = 44; + +static const uint8_t TXD2 = 1; +static const uint8_t RXD2 = 2; + +static const uint8_t SDA = 13; +static const uint8_t SCL = 15; + +static const uint8_t SS = 11; +static const uint8_t MOSI = 12; +static const uint8_t MISO = 39; +static const uint8_t SCK = 14; + +static const uint8_t G0 = 0; +static const uint8_t G1 = 1; +static const uint8_t G2 = 2; +static const uint8_t G3 = 3; +static const uint8_t G4 = 4; +static const uint8_t G5 = 5; +static const uint8_t G6 = 6; +static const uint8_t G7 = 7; +static const uint8_t G8 = 8; +static const uint8_t G9 = 9; +static const uint8_t G10 = 10; +static const uint8_t G11 = 11; +static const uint8_t G12 = 12; +static const uint8_t G13 = 13; +static const uint8_t G14 = 14; +static const uint8_t G15 = 15; +static const uint8_t G39 = 39; +static const uint8_t G40 = 40; +static const uint8_t G41 = 41; +static const uint8_t G42 = 42; +static const uint8_t G43 = 43; +static const uint8_t G44 = 44; +static const uint8_t G46 = 46; + +static const uint8_t ADC1 = 7; +static const uint8_t ADC2 = 8; + +#endif /* Pins_Arduino_h */ diff --git a/variants/m5stack_cardputer/pins_arduino.h b/variants/m5stack_cardputer/pins_arduino.h new file mode 100644 index 00000000000..14a7d56fa06 --- /dev/null +++ b/variants/m5stack_cardputer/pins_arduino.h @@ -0,0 +1,53 @@ +#ifndef Pins_Arduino_h +#define Pins_Arduino_h + +#include +#include "soc/soc_caps.h" + +#define USB_VID 0x303a +#define USB_PID 0x1001 + +static const uint8_t TX = 43; +static const uint8_t RX = 44; + +static const uint8_t TXD2 = 1; +static const uint8_t RXD2 = 2; + +static const uint8_t SDA = 13; +static const uint8_t SCL = 15; + +static const uint8_t SS = 12; +static const uint8_t MOSI = 14; +static const uint8_t MISO = 39; +static const uint8_t SCK = 40; + +static const uint8_t G0 = 0; +static const uint8_t G1 = 1; +static const uint8_t G2 = 2; +static const uint8_t G3 = 3; +static const uint8_t G4 = 4; +static const uint8_t G5 = 5; +static const uint8_t G6 = 6; +static const uint8_t G7 = 7; +static const uint8_t G8 = 8; +static const uint8_t G9 = 9; +static const uint8_t G10 = 10; +static const uint8_t G11 = 11; +static const uint8_t G12 = 12; +static const uint8_t G13 = 13; +static const uint8_t G14 = 14; +static const uint8_t G15 = 15; +static const uint8_t G39 = 39; +static const uint8_t G40 = 40; +static const uint8_t G41 = 41; +static const uint8_t G42 = 42; +static const uint8_t G43 = 43; +static const uint8_t G44 = 44; +static const uint8_t G46 = 46; + +static const uint8_t ADC1 = 7; +static const uint8_t ADC2 = 8; + + + +#endif /* Pins_Arduino_h */ diff --git a/variants/m5stack_core_esp32/pins_arduino.h b/variants/m5stack_core/pins_arduino.h similarity index 100% rename from variants/m5stack_core_esp32/pins_arduino.h rename to variants/m5stack_core/pins_arduino.h diff --git a/variants/m5stack_cores3/pins_arduino.h b/variants/m5stack_cores3/pins_arduino.h index fd6e5b886d3..c9bbb02c72f 100644 --- a/variants/m5stack_cores3/pins_arduino.h +++ b/variants/m5stack_cores3/pins_arduino.h @@ -2,11 +2,19 @@ #define Pins_Arduino_h #include +#include "soc/soc_caps.h" #define USB_VID 0x303a #define USB_PID 0x1001 -// CoreS3 has no builtin LED / NeoLED +// Some boards have too low voltage on this pin (board design bug) +// Use different pin with 3V and connect with 48 +// and change this setup for the chosen pin (for example 38) +static const uint8_t LED_BUILTIN = SOC_GPIO_PIN_COUNT + 48; +#define BUILTIN_LED LED_BUILTIN // backward compatibility +#define LED_BUILTIN LED_BUILTIN +#define RGB_BUILTIN LED_BUILTIN +#define RGB_BRIGHTNESS 64 static const uint8_t TX = 43; static const uint8_t RX = 44; diff --git a/variants/m5stack_dial/pins_arduino.h b/variants/m5stack_dial/pins_arduino.h new file mode 100644 index 00000000000..14a7d56fa06 --- /dev/null +++ b/variants/m5stack_dial/pins_arduino.h @@ -0,0 +1,53 @@ +#ifndef Pins_Arduino_h +#define Pins_Arduino_h + +#include +#include "soc/soc_caps.h" + +#define USB_VID 0x303a +#define USB_PID 0x1001 + +static const uint8_t TX = 43; +static const uint8_t RX = 44; + +static const uint8_t TXD2 = 1; +static const uint8_t RXD2 = 2; + +static const uint8_t SDA = 13; +static const uint8_t SCL = 15; + +static const uint8_t SS = 12; +static const uint8_t MOSI = 14; +static const uint8_t MISO = 39; +static const uint8_t SCK = 40; + +static const uint8_t G0 = 0; +static const uint8_t G1 = 1; +static const uint8_t G2 = 2; +static const uint8_t G3 = 3; +static const uint8_t G4 = 4; +static const uint8_t G5 = 5; +static const uint8_t G6 = 6; +static const uint8_t G7 = 7; +static const uint8_t G8 = 8; +static const uint8_t G9 = 9; +static const uint8_t G10 = 10; +static const uint8_t G11 = 11; +static const uint8_t G12 = 12; +static const uint8_t G13 = 13; +static const uint8_t G14 = 14; +static const uint8_t G15 = 15; +static const uint8_t G39 = 39; +static const uint8_t G40 = 40; +static const uint8_t G41 = 41; +static const uint8_t G42 = 42; +static const uint8_t G43 = 43; +static const uint8_t G44 = 44; +static const uint8_t G46 = 46; + +static const uint8_t ADC1 = 7; +static const uint8_t ADC2 = 8; + + + +#endif /* Pins_Arduino_h */ diff --git a/variants/m5stack_fire/pins_arduino.h b/variants/m5stack_fire/pins_arduino.h index 1984ab6bc6e..0cb66c9eb50 100644 --- a/variants/m5stack_fire/pins_arduino.h +++ b/variants/m5stack_fire/pins_arduino.h @@ -6,9 +6,6 @@ static const uint8_t TX = 1; static const uint8_t RX = 3; -static const uint8_t TXD2 = 17; -static const uint8_t RXD2 = 16; - static const uint8_t SDA = 21; static const uint8_t SCL = 22; diff --git a/variants/m5stack_paper/pins_arduino.h b/variants/m5stack_paper/pins_arduino.h new file mode 100644 index 00000000000..68b64386bef --- /dev/null +++ b/variants/m5stack_paper/pins_arduino.h @@ -0,0 +1,48 @@ +#ifndef Pins_Arduino_h +#define Pins_Arduino_h + +#include + +#define TX2 14 +#define RX2 13 + +static const uint8_t TX = 1; +static const uint8_t RX = 3; + +static const uint8_t SDA = 25; +static const uint8_t SCL = 32; + +static const uint8_t SS = 15; +static const uint8_t MOSI = 12; +static const uint8_t MISO = 13; +static const uint8_t SCK = 14; + +static const uint8_t G25 = 25; +static const uint8_t G32 = 32; + +static const uint8_t G26 = 26; +static const uint8_t G33 = 33; + +static const uint8_t G18 = 18; +static const uint8_t G19 = 19; + +static const uint8_t G21 = 21; +static const uint8_t G22 = 22; + +static const uint8_t G36 = 36; +static const uint8_t G2 = 2; +static const uint8_t G4 = 4; +static const uint8_t G5 = 5; +static const uint8_t G23 = 23; + +static const uint8_t G37 = 37; +static const uint8_t G38 = 38; +static const uint8_t G39 = 39; + +static const uint8_t DAC1 = 25; +static const uint8_t DAC2 = 26; + +static const uint8_t ADC1 = 35; +static const uint8_t ADC2 = 36; + +#endif /* Pins_Arduino_h */ diff --git a/variants/m5stack_poe_cam/pins_arduino.h b/variants/m5stack_poe_cam/pins_arduino.h new file mode 100644 index 00000000000..75c8831b923 --- /dev/null +++ b/variants/m5stack_poe_cam/pins_arduino.h @@ -0,0 +1,48 @@ +#ifndef Pins_Arduino_h +#define Pins_Arduino_h + +#include + +static const uint8_t TX = 1; +static const uint8_t RX = 3; + +static const uint8_t SDA = 25; +static const uint8_t SCL = 33; + +// Modified elsewhere +static const uint8_t SS = -1; +static const uint8_t MOSI = -1; +static const uint8_t MISO = -1; +static const uint8_t SCK = -1; + +static const uint8_t G23 = 23; +static const uint8_t G25 = 25; +static const uint8_t G27 = 27; +static const uint8_t G22 = 22; +static const uint8_t G26 = 26; +static const uint8_t G21 = 21; +static const uint8_t G32 = 32; +static const uint8_t G35 = 35; +static const uint8_t G34 = 34; +static const uint8_t G5 = 5; +static const uint8_t G39 = 39; +static const uint8_t G18 = 18; +static const uint8_t G36 = 36; +static const uint8_t G19 = 19; +static const uint8_t G15 = 15; + +static const uint8_t G2 = 2; +static const uint8_t G33 = 33; + +static const uint8_t G13 = 13; +static const uint8_t G4 = 4; + +static const uint8_t G0 = 0; + +static const uint8_t DAC1 = 25; +static const uint8_t DAC2 = 26; + +static const uint8_t ADC1 = 35; +static const uint8_t ADC2 = 36; + +#endif /* Pins_Arduino_h */ diff --git a/variants/m5stack_stamp_c3/pins_arduino.h b/variants/m5stack_stamp_c3/pins_arduino.h new file mode 100644 index 00000000000..66399b0c04b --- /dev/null +++ b/variants/m5stack_stamp_c3/pins_arduino.h @@ -0,0 +1,24 @@ +#ifndef Pins_Arduino_h +#define Pins_Arduino_h + +#include + +static const uint8_t TX = 21; +static const uint8_t RX = 20; + +static const uint8_t SDA = 8; +static const uint8_t SCL = 9; + +static const uint8_t SS = 7; +static const uint8_t MOSI = 6; +static const uint8_t MISO = 5; +static const uint8_t SCK = 4; + +static const uint8_t A0 = 0; +static const uint8_t A1 = 1; +static const uint8_t A2 = 2; +static const uint8_t A3 = 3; +static const uint8_t A4 = 4; +static const uint8_t A5 = 5; + +#endif /* Pins_Arduino_h */ diff --git a/variants/m5stack_stamp_pico/pins_arduino.h b/variants/m5stack_stamp_pico/pins_arduino.h index 705890facea..d052243f92a 100644 --- a/variants/m5stack_stamp_pico/pins_arduino.h +++ b/variants/m5stack_stamp_pico/pins_arduino.h @@ -9,6 +9,11 @@ static const uint8_t RX = 3; static const uint8_t SDA = 21; static const uint8_t SCL = 22; +static const uint8_t SS = 19; +static const uint8_t MOSI = 26; +static const uint8_t MISO = 36; +static const uint8_t SCK = 18; + static const uint8_t G26 = 26; static const uint8_t G36 = 36; static const uint8_t G18 = 18; @@ -23,9 +28,4 @@ static const uint8_t G0 = 0; static const uint8_t G32 = 32; static const uint8_t G33 = 33; -static const uint8_t SS = 19; -static const uint8_t MOSI = 26; -static const uint8_t MISO = 36; -static const uint8_t SCK = 18; - -#endif /* Pins_Arduino_h */ \ No newline at end of file +#endif /* Pins_Arduino_h */ diff --git a/variants/m5stack_stamp_s3/pins_arduino.h b/variants/m5stack_stamp_s3/pins_arduino.h index 999d8c753a5..d2af16ecaf9 100644 --- a/variants/m5stack_stamp_s3/pins_arduino.h +++ b/variants/m5stack_stamp_s3/pins_arduino.h @@ -2,6 +2,7 @@ #define Pins_Arduino_h #include +#include "soc/soc_caps.h" #define USB_VID 0x303a #define USB_PID 0x1001 @@ -12,14 +13,15 @@ static const uint8_t RX = 44; static const uint8_t TXD2 = 1; static const uint8_t RXD2 = 2; -static const uint8_t SS = 7; -static const uint8_t MOSI = 6; -static const uint8_t MISO = 5; -static const uint8_t SCK = 4; - static const uint8_t SDA = 13; static const uint8_t SCL = 15; +// Modified elsewhere +static const uint8_t SS = -1; +static const uint8_t MOSI = -1; +static const uint8_t MISO = -1; +static const uint8_t SCK = -1; + static const uint8_t G0 = 0; static const uint8_t G1 = 1; static const uint8_t G2 = 2; diff --git a/variants/m5stick_c/pins_arduino.h b/variants/m5stack_stickc/pins_arduino.h similarity index 92% rename from variants/m5stick_c/pins_arduino.h rename to variants/m5stack_stickc/pins_arduino.h index 35092416486..6a32c71f697 100644 --- a/variants/m5stick_c/pins_arduino.h +++ b/variants/m5stack_stickc/pins_arduino.h @@ -6,9 +6,6 @@ static const uint8_t TX = 1; static const uint8_t RX = 3; -static const uint8_t TXD2 = 33; -static const uint8_t RXD2 = 32; - static const uint8_t SDA = 32; static const uint8_t SCL = 33; diff --git a/variants/m5stack_stickc_plus/pins_arduino.h b/variants/m5stack_stickc_plus/pins_arduino.h new file mode 100644 index 00000000000..6a32c71f697 --- /dev/null +++ b/variants/m5stack_stickc_plus/pins_arduino.h @@ -0,0 +1,33 @@ +#ifndef Pins_Arduino_h +#define Pins_Arduino_h + +#include + +static const uint8_t TX = 1; +static const uint8_t RX = 3; + +static const uint8_t SDA = 32; +static const uint8_t SCL = 33; + +static const uint8_t SS = 5; +static const uint8_t MOSI = 15; +static const uint8_t MISO = 36; +static const uint8_t SCK = 13; + +static const uint8_t G9 = 9; +static const uint8_t G10 = 10; +static const uint8_t G37 = 37; +static const uint8_t G39 = 39; +static const uint8_t G32 = 32; +static const uint8_t G33 = 33; +static const uint8_t G26 = 26; +static const uint8_t G36 = 36; +static const uint8_t G0 = 0; + +static const uint8_t DAC1 = 25; +static const uint8_t DAC2 = 26; + +static const uint8_t ADC1 = 35; +static const uint8_t ADC2 = 36; + +#endif /* Pins_Arduino_h */ diff --git a/variants/m5stack_stickc_plus2/pins_arduino.h b/variants/m5stack_stickc_plus2/pins_arduino.h new file mode 100644 index 00000000000..6a32c71f697 --- /dev/null +++ b/variants/m5stack_stickc_plus2/pins_arduino.h @@ -0,0 +1,33 @@ +#ifndef Pins_Arduino_h +#define Pins_Arduino_h + +#include + +static const uint8_t TX = 1; +static const uint8_t RX = 3; + +static const uint8_t SDA = 32; +static const uint8_t SCL = 33; + +static const uint8_t SS = 5; +static const uint8_t MOSI = 15; +static const uint8_t MISO = 36; +static const uint8_t SCK = 13; + +static const uint8_t G9 = 9; +static const uint8_t G10 = 10; +static const uint8_t G37 = 37; +static const uint8_t G39 = 39; +static const uint8_t G32 = 32; +static const uint8_t G33 = 33; +static const uint8_t G26 = 26; +static const uint8_t G36 = 36; +static const uint8_t G0 = 0; + +static const uint8_t DAC1 = 25; +static const uint8_t DAC2 = 26; + +static const uint8_t ADC1 = 35; +static const uint8_t ADC2 = 36; + +#endif /* Pins_Arduino_h */ diff --git a/variants/m5stack_timer_cam/pins_arduino.h b/variants/m5stack_timer_cam/pins_arduino.h index f26bac1482c..5a2cc5dcdb4 100644 --- a/variants/m5stack_timer_cam/pins_arduino.h +++ b/variants/m5stack_timer_cam/pins_arduino.h @@ -5,7 +5,6 @@ static const uint8_t LED_BUILTIN = 2; #define BUILTIN_LED LED_BUILTIN // backward compatibility -#define LED_BUILTIN LED_BUILTIN // allow testing #ifdef LED_BUILTIN static const uint8_t TX = 1; static const uint8_t RX = 3; diff --git a/variants/m5stack_tough/pins_arduino.h b/variants/m5stack_tough/pins_arduino.h new file mode 100644 index 00000000000..c5ea5d78eee --- /dev/null +++ b/variants/m5stack_tough/pins_arduino.h @@ -0,0 +1,52 @@ +#ifndef Pins_Arduino_h +#define Pins_Arduino_h + +#include + +#define TX2 14 +#define RX2 13 + +static const uint8_t TX = 1; +static const uint8_t RX = 3; + +static const uint8_t SDA = 32; +static const uint8_t SCL = 33; + +static const uint8_t SS = 5; +static const uint8_t MOSI = 23; +static const uint8_t MISO = 38; +static const uint8_t SCK = 18; + +static const uint8_t G23 = 23; +static const uint8_t G38 = 38; +static const uint8_t G18 = 18; +static const uint8_t G3 = 3; +static const uint8_t G13 = 13; +static const uint8_t G21 = 21; +static const uint8_t G32 = 32; +static const uint8_t G27 = 27; +static const uint8_t G2 = 2; +static const uint8_t G35 = 35; +static const uint8_t G36 = 36; +static const uint8_t G25 = 25; +static const uint8_t G26 = 26; +static const uint8_t G1 = 1; +static const uint8_t G14 = 14; +static const uint8_t G22 = 22; +static const uint8_t G33 = 33; +static const uint8_t G19 = 19; +static const uint8_t G0 = 0; +static const uint8_t G34 = 34; + +static const uint8_t G12 = 12; +static const uint8_t G15 = 15; +static const uint8_t G17 = 17; +static const uint8_t G5 = 5; + +static const uint8_t DAC1 = 25; +static const uint8_t DAC2 = 26; + +static const uint8_t ADC1 = 35; +static const uint8_t ADC2 = 36; + +#endif /* Pins_Arduino_h */ diff --git a/variants/m5stack_unit_cam/pins_arduino.h b/variants/m5stack_unit_cam/pins_arduino.h new file mode 100644 index 00000000000..5697b1303ba --- /dev/null +++ b/variants/m5stack_unit_cam/pins_arduino.h @@ -0,0 +1,50 @@ +#ifndef Pins_Arduino_h +#define Pins_Arduino_h + +#include + +static const uint8_t LED_BUILTIN = 4; +#define BUILTIN_LED LED_BUILTIN // backward compatibility + +static const uint8_t TX = 1; +static const uint8_t RX = 3; + +static const uint8_t SDA = 17; +static const uint8_t SCL = 16; + +static const uint8_t SS = 5; +static const uint8_t MOSI = 23; +static const uint8_t MISO = 19; +static const uint8_t SCK = 18; + +static const uint8_t G23 = 23; +static const uint8_t G25 = 25; +static const uint8_t G27 = 27; +static const uint8_t G22 = 22; +static const uint8_t G26 = 26; +static const uint8_t G21 = 21; +static const uint8_t G32 = 32; +static const uint8_t G35 = 35; +static const uint8_t G34 = 34; +static const uint8_t G5 = 5; +static const uint8_t G39 = 39; +static const uint8_t G18 = 18; +static const uint8_t G36 = 36; +static const uint8_t G19 = 19; +static const uint8_t G15 = 15; + +static const uint8_t G2 = 2; +static const uint8_t G33 = 33; + +static const uint8_t G13 = 13; +static const uint8_t G4 = 4; + +static const uint8_t G0 = 0; + +static const uint8_t DAC1 = 25; +static const uint8_t DAC2 = 26; + +static const uint8_t ADC1 = 35; +static const uint8_t ADC2 = 36; + +#endif /* Pins_Arduino_h */ diff --git a/variants/m5stack_unit_cams3/pins_arduino.h b/variants/m5stack_unit_cams3/pins_arduino.h new file mode 100644 index 00000000000..d2af16ecaf9 --- /dev/null +++ b/variants/m5stack_unit_cams3/pins_arduino.h @@ -0,0 +1,52 @@ +#ifndef Pins_Arduino_h +#define Pins_Arduino_h + +#include +#include "soc/soc_caps.h" + +#define USB_VID 0x303a +#define USB_PID 0x1001 + +static const uint8_t TX = 43; +static const uint8_t RX = 44; + +static const uint8_t TXD2 = 1; +static const uint8_t RXD2 = 2; + +static const uint8_t SDA = 13; +static const uint8_t SCL = 15; + +// Modified elsewhere +static const uint8_t SS = -1; +static const uint8_t MOSI = -1; +static const uint8_t MISO = -1; +static const uint8_t SCK = -1; + +static const uint8_t G0 = 0; +static const uint8_t G1 = 1; +static const uint8_t G2 = 2; +static const uint8_t G3 = 3; +static const uint8_t G4 = 4; +static const uint8_t G5 = 5; +static const uint8_t G6 = 6; +static const uint8_t G7 = 7; +static const uint8_t G8 = 8; +static const uint8_t G9 = 9; +static const uint8_t G10 = 10; +static const uint8_t G11 = 11; +static const uint8_t G12 = 12; +static const uint8_t G13 = 13; +static const uint8_t G14 = 14; +static const uint8_t G15 = 15; +static const uint8_t G39 = 39; +static const uint8_t G40 = 40; +static const uint8_t G41 = 41; +static const uint8_t G42 = 42; +static const uint8_t G43 = 43; +static const uint8_t G44 = 44; +static const uint8_t G46 = 46; + +static const uint8_t ADC1 = 7; +static const uint8_t ADC2 = 8; + +#endif /* Pins_Arduino_h */ diff --git a/variants/makergo_c3_supermini/pins_arduino.h b/variants/makergo_c3_supermini/pins_arduino.h new file mode 100644 index 00000000000..f62df83dbf5 --- /dev/null +++ b/variants/makergo_c3_supermini/pins_arduino.h @@ -0,0 +1,34 @@ +#ifndef Pins_Arduino_h +#define Pins_Arduino_h + +#include + +#define TX1 0 +#define RX1 1 + +static const uint8_t LED_BUILTIN = 8; +#define BUILTIN_LED LED_BUILTIN // backward compatibility +#define LED_BUILTIN LED_BUILTIN // allow testing #ifdef LED_BUILTIN + +static const uint8_t BOOT_BUILTIN = 9; // built-in boot button + +static const uint8_t TX = 21; +static const uint8_t RX = 20; + +static const uint8_t SDA = 8; +static const uint8_t SCL = 9; + +static const uint8_t SS = 7; +static const uint8_t MOSI = 6; +static const uint8_t MISO = 5; +static const uint8_t SCK = 4; + +static const uint8_t A0 = 0; +static const uint8_t A1 = 1; +static const uint8_t A2 = 2; +static const uint8_t A3 = 3; +static const uint8_t A4 = 4; +static const uint8_t A5 = 5; + +#endif /* Pins_Arduino_h */ + diff --git a/variants/nologo_esp32c3_super_mini/pins_arduino.h b/variants/nologo_esp32c3_super_mini/pins_arduino.h new file mode 100644 index 00000000000..3b4c144cca6 --- /dev/null +++ b/variants/nologo_esp32c3_super_mini/pins_arduino.h @@ -0,0 +1,28 @@ +#ifndef Pins_Arduino_h +#define Pins_Arduino_h + +#include + +static const uint8_t LED_BUILTIN = 8; +#define BUILTIN_LED LED_BUILTIN // backward compatibility +#define LED_BUILTIN LED_BUILTIN // allow testing #ifdef LED_BUILTIN + +static const uint8_t TX = 21; +static const uint8_t RX = 20; + +static const uint8_t SDA = 8; +static const uint8_t SCL = 9; + +static const uint8_t SS = 7; +static const uint8_t MOSI = 6; +static const uint8_t MISO = 5; +static const uint8_t SCK = 4; + +static const uint8_t A0 = 0; +static const uint8_t A1 = 1; +static const uint8_t A2 = 2; +static const uint8_t A3 = 3; +static const uint8_t A4 = 4; +static const uint8_t A5 = 5; + +#endif /* Pins_Arduino_h */ diff --git a/variants/nologo_esp32s3_pico/pins_arduino.h b/variants/nologo_esp32s3_pico/pins_arduino.h new file mode 100644 index 00000000000..42109e0c12b --- /dev/null +++ b/variants/nologo_esp32s3_pico/pins_arduino.h @@ -0,0 +1,37 @@ +#ifndef Pins_Arduino_h +#define Pins_Arduino_h + +#include +#include "soc/soc_caps.h" + +#define USB_VID 0x303a +#define USB_PID 0x1001 + +static const uint8_t LED_BUILTIN = 21; +#define BUILTIN_LED LED_BUILTIN +#define LED_BUILTIN LED_BUILTIN +#define RGB_BUILTIN SOC_GPIO_PIN_COUNT + LED_BUILTIN +#define RGB_BRIGHTNESS 64 + +// SPI - unused but you can create your own definition in your sketch +static const int8_t SCK = -1; +static const int8_t MISO = -1; +static const int8_t MOSI = -1; +static const int8_t SS = -1; + +// I2C - unused but you can create your own definition in your sketch +static const uint8_t SDA = -1; +static const uint8_t SCL = -1; + +static const uint8_t A0 = 1; +static const uint8_t A1 = 2; +static const uint8_t A2 = 3; +static const uint8_t A3 = 4; +static const uint8_t A4 = 5; +static const uint8_t A5 = 6; +static const uint8_t A6 = 7; +static const uint8_t A7 = 8; +static const uint8_t A8 = 9; +static const uint8_t A9 = 10; + +#endif /* Pins_Arduino_h */ diff --git a/variants/sparkfun_esp32c6_thing_plus/pins_arduino.h b/variants/sparkfun_esp32c6_thing_plus/pins_arduino.h new file mode 100644 index 00000000000..60bd42884d1 --- /dev/null +++ b/variants/sparkfun_esp32c6_thing_plus/pins_arduino.h @@ -0,0 +1,35 @@ +#ifndef Pins_Arduino_h +#define Pins_Arduino_h + +#include +#include "soc/soc_caps.h" + +#define PIN_NEOPIXEL 23 +// BUILTIN_LED can be used in new Arduino API digitalWrite() like in Blink.ino +static const uint8_t LED_BUILTIN = SOC_GPIO_PIN_COUNT+PIN_NEOPIXEL; +#define BUILTIN_LED LED_BUILTIN // backward compatibility +#define LED_BUILTIN LED_BUILTIN // allow testing #ifdef LED_BUILTIN +// RGB_BUILTIN and RGB_BRIGHTNESS can be used in new Arduino API neopixelWrite() +#define RGB_BUILTIN LED_BUILTIN +#define RGB_BRIGHTNESS 64 + +static const uint8_t TX = 16; +static const uint8_t RX = 17; + +static const uint8_t SDA = 6; +static const uint8_t SCL = 7; + +static const uint8_t SS = 5; +static const uint8_t MOSI = 20; +static const uint8_t MISO = 21; +static const uint8_t SCK = 19; + +static const uint8_t A0 = 0; +static const uint8_t A1 = 1; +static const uint8_t A2 = 2; +static const uint8_t A3 = 3; +static const uint8_t A4 = 4; +static const uint8_t A5 = 5; +static const uint8_t A6 = 6; + +#endif /* Pins_Arduino_h */ diff --git a/variants/sparkfun_pro_micro_esp32c3/pins_arduino.h b/variants/sparkfun_pro_micro_esp32c3/pins_arduino.h new file mode 100644 index 00000000000..8c29399fc63 --- /dev/null +++ b/variants/sparkfun_pro_micro_esp32c3/pins_arduino.h @@ -0,0 +1,48 @@ +#ifndef Pins_Arduino_h +#define Pins_Arduino_h + +#include + +#define USB_VID 0x1B4F +#define USB_PID 0x0035 +#define USB_MANUFACTURER "SparkFun" +#define USB_PRODUCT "SparkFun_Pro_Micro-ESP32C3" +#define USB_SERIAL "" // Empty string for MAC adddress + +static const uint8_t LED_BUILTIN = 10; + +static const uint8_t TX = 21; +static const uint8_t RX = 20; + +static const uint8_t A0 = 0; +static const uint8_t A1 = 1; +static const uint8_t A2 = 2; +static const uint8_t A3 = 3; +static const uint8_t A4 = 4; + +static const uint8_t D0 = 0; +static const uint8_t D1 = 1; +static const uint8_t D2 = 2; +static const uint8_t D3 = 3; +static const uint8_t D4 = 4; +static const uint8_t D5 = 5; +static const uint8_t D6 = 6; +static const uint8_t D7 = 7; +static const uint8_t D8 = 8; +static const uint8_t D9 = 9; +static const uint8_t D10 = 10; + +static const uint8_t SDA = 5; +static const uint8_t SCL = 6; + +static const uint8_t SS = 10; +static const uint8_t MOSI = 3; +static const uint8_t MISO = 1; +static const uint8_t SCK = 0; + +static const uint8_t PIN_I2S_SCK = 6; // Frame clock, no bit clock +static const uint8_t PIN_I2S_SD_DOUT = 7; // data out +static const uint8_t PIN_I2S_SD_IN = 5; // data in +static const uint8_t PIN_I2S_FS = 10; // frame select + +#endif /* Pins_Arduino_h */