Merge branch 'esp32-s3-support' into rainmaker-fix
This commit is contained in:
commit
7846ab3b07
1951 changed files with 127412 additions and 24146 deletions
13
.github/scripts/install-platformio-esp32.sh
vendored
13
.github/scripts/install-platformio-esp32.sh
vendored
|
|
@ -3,9 +3,7 @@
|
|||
export PLATFORMIO_ESP32_PATH="$HOME/.platformio/packages/framework-arduinoespressif32"
|
||||
PLATFORMIO_ESP32_URL="https://github.com/platformio/platform-espressif32.git#feature/arduino-idf-master"
|
||||
|
||||
XTENSA32_TOOLCHAIN_VERSION="8.4.0+2021r2-patch2"
|
||||
XTENSA32S2_TOOLCHAIN_VERSION="8.4.0+2021r2-patch2"
|
||||
RISCV_TOOLCHAIN_VERSION="8.4.0+2021r2-patch2"
|
||||
TOOLCHAIN_VERSION="8.4.0+2021r2-patch2"
|
||||
ESPTOOLPY_VERSION="~1.30100.0"
|
||||
ESPRESSIF_ORGANIZATION_NAME="espressif"
|
||||
|
||||
|
|
@ -30,9 +28,12 @@ replace_script+="data['packages']['toolchain-xtensa-esp32']['owner']='$ESPRESSIF
|
|||
replace_script+="data['packages']['toolchain-xtensa-esp32s2']['owner']='$ESPRESSIF_ORGANIZATION_NAME';"
|
||||
replace_script+="data['packages']['toolchain-riscv32-esp']['owner']='$ESPRESSIF_ORGANIZATION_NAME';"
|
||||
# Update versions to use the upstream
|
||||
replace_script+="data['packages']['toolchain-xtensa-esp32']['version']='$XTENSA32_TOOLCHAIN_VERSION';"
|
||||
replace_script+="data['packages']['toolchain-xtensa-esp32s2']['version']='$XTENSA32S2_TOOLCHAIN_VERSION';"
|
||||
replace_script+="data['packages']['toolchain-riscv32-esp']['version']='$RISCV_TOOLCHAIN_VERSION';"
|
||||
replace_script+="data['packages']['toolchain-xtensa-esp32']['version']='$TOOLCHAIN_VERSION';"
|
||||
replace_script+="data['packages']['toolchain-xtensa-esp32s2']['version']='$TOOLCHAIN_VERSION';"
|
||||
replace_script+="data['packages']['toolchain-riscv32-esp']['version']='$TOOLCHAIN_VERSION';"
|
||||
# Add ESP32-S3 Toolchain
|
||||
replace_script+="data['packages'].update({'toolchain-xtensa-esp32s3':{'type':'toolchain','optional':True,'owner':'$ESPRESSIF_ORGANIZATION_NAME','version':'$TOOLCHAIN_VERSION'}});"
|
||||
replace_script+="data['packages']['toolchain-xtensa-esp32'].update({'optional':False});"
|
||||
# esptool.py may require an upstream version (for now platformio is the owner)
|
||||
replace_script+="data['packages']['tool-esptoolpy']['version']='$ESPTOOLPY_VERSION';"
|
||||
# Save results
|
||||
|
|
|
|||
24
.github/scripts/on-push.sh
vendored
24
.github/scripts/on-push.sh
vendored
|
|
@ -2,6 +2,8 @@
|
|||
|
||||
set -e
|
||||
|
||||
export ARDUINO_BUILD_DIR="$HOME/.arduino/build.tmp"
|
||||
|
||||
function build(){
|
||||
local target=$1
|
||||
local fqbn=$2
|
||||
|
|
@ -58,11 +60,12 @@ fi
|
|||
|
||||
SCRIPTS_DIR="./.github/scripts"
|
||||
if [ "$BUILD_PIO" -eq 0 ]; then
|
||||
source ./.github/scripts/install-arduino-ide.sh
|
||||
source ${SCRIPTS_DIR}/install-arduino-ide.sh
|
||||
source ${SCRIPTS_DIR}/install-arduino-core-esp32.sh
|
||||
|
||||
FQBN_ESP32="espressif:esp32:esp32:PSRAM=enabled,PartitionScheme=huge_app"
|
||||
FQBN_ESP32S2="espressif:esp32:esp32s2:PSRAM=enabled,PartitionScheme=huge_app"
|
||||
FQBN_ESP32S3="espressif:esp32:esp32s3:PSRAM=opi,USBMode=default,PartitionScheme=huge_app"
|
||||
FQBN_ESP32C3="espressif:esp32:esp32c3:PartitionScheme=huge_app"
|
||||
|
||||
SKETCHES_ESP32="\
|
||||
|
|
@ -76,11 +79,12 @@ if [ "$BUILD_PIO" -eq 0 ]; then
|
|||
$ARDUINO_ESP32_PATH/libraries/WiFi/examples/WiFiClient/WiFiClient.ino\
|
||||
"
|
||||
|
||||
build "esp32" $FQBN_ESP32 $CHUNK_INDEX $CHUNKS_CNT $SKETCHES_ESP32
|
||||
build "esp32s3" $FQBN_ESP32S3 $CHUNK_INDEX $CHUNKS_CNT $SKETCHES_ESP32
|
||||
build "esp32s2" $FQBN_ESP32S2 $CHUNK_INDEX $CHUNKS_CNT $SKETCHES_ESP32XX
|
||||
build "esp32c3" $FQBN_ESP32C3 $CHUNK_INDEX $CHUNKS_CNT $SKETCHES_ESP32XX
|
||||
build "esp32" $FQBN_ESP32 $CHUNK_INDEX $CHUNKS_CNT $SKETCHES_ESP32
|
||||
else
|
||||
source ./${SCRIPTS_DIR}/install-platformio-esp32.sh
|
||||
source ${SCRIPTS_DIR}/install-platformio-esp32.sh
|
||||
# PlatformIO ESP32 Test
|
||||
BOARD="esp32dev"
|
||||
OPTIONS="board_build.partitions = huge_app.csv"
|
||||
|
|
@ -96,6 +100,20 @@ else
|
|||
# build_pio_sketch "$BOARD" "$OPTIONS" "$PLATFORMIO_ESP32_PATH/libraries/WiFiClientSecure/examples/WiFiClientSecure/WiFiClientSecure.ino"
|
||||
|
||||
python -m platformio ci --board "$BOARD" "$PLATFORMIO_ESP32_PATH/libraries/WiFi/examples/WiFiClient" --project-option="board_build.mcu = esp32s2" --project-option="board_build.partitions = huge_app.csv"
|
||||
python -m platformio ci --board "$BOARD" "$PLATFORMIO_ESP32_PATH/libraries/WiFi/examples/WiFiClient" --project-option="board_build.mcu = esp32c3" --project-option="board_build.partitions = huge_app.csv"
|
||||
|
||||
echo "Hacking in S3 support ..."
|
||||
replace_script="import json; import os;"
|
||||
replace_script+="fp=open(os.path.expanduser('~/.platformio/platforms/espressif32/platform.json'), 'r+');"
|
||||
replace_script+="data=json.load(fp);"
|
||||
replace_script+="data['packages']['toolchain-xtensa-esp32']['optional']=True;"
|
||||
replace_script+="data['packages']['toolchain-xtensa-esp32s3']['optional']=False;"
|
||||
replace_script+="data['packages']['tool-esptoolpy']['owner']='tasmota';"
|
||||
replace_script+="data['packages']['tool-esptoolpy']['version']='https://github.com/tasmota/esptool/releases/download/v3.2.1/esptool-3.2.1.zip';"
|
||||
replace_script+="fp.seek(0);fp.truncate();json.dump(data, fp, indent=2);fp.close()"
|
||||
python -c "$replace_script"
|
||||
|
||||
python -m platformio ci --board "$BOARD" "$PLATFORMIO_ESP32_PATH/libraries/WiFi/examples/WiFiClient" --project-option="board_build.mcu = esp32s3" --project-option="board_build.partitions = huge_app.csv"
|
||||
|
||||
#build_pio_sketches "$BOARD" "$OPTIONS" "$PLATFORMIO_ESP32_PATH/libraries"
|
||||
fi
|
||||
|
|
|
|||
17
.github/scripts/sketch_utils.sh
vendored
17
.github/scripts/sketch_utils.sh
vendored
|
|
@ -8,6 +8,11 @@ function build_sketch(){ # build_sketch <ide_path> <user_path> <fqbn> <path-to-i
|
|||
fi
|
||||
|
||||
ARDUINO_CACHE_DIR="$HOME/.arduino/cache.tmp"
|
||||
if [ -z "$ARDUINO_BUILD_DIR" ]; then
|
||||
build_dir="$(dirname $sketch)/build"
|
||||
else
|
||||
build_dir="$ARDUINO_BUILD_DIR"
|
||||
fi
|
||||
local ide_path=$1
|
||||
local usr_path=$2
|
||||
local fqbn=$3
|
||||
|
|
@ -15,7 +20,7 @@ function build_sketch(){ # build_sketch <ide_path> <user_path> <fqbn> <path-to-i
|
|||
local xtra_opts=$5
|
||||
local win_opts=$6
|
||||
|
||||
build_dir="$(dirname $sketch)/build"
|
||||
rm -rf "$build_dir"
|
||||
mkdir -p "$build_dir"
|
||||
mkdir -p "$ARDUINO_CACHE_DIR"
|
||||
$ide_path/arduino-builder -compile -logger=human -core-api-version=10810 \
|
||||
|
|
@ -32,13 +37,13 @@ function build_sketch(){ # build_sketch <ide_path> <user_path> <fqbn> <path-to-i
|
|||
$win_opts $xtra_opts "$sketch"
|
||||
}
|
||||
|
||||
function count_sketches(){ # count_sketches <path> <target>
|
||||
function count_sketches(){ # count_sketches <path> [target]
|
||||
local path=$1
|
||||
local target=$2
|
||||
|
||||
if [ $# -lt 2 ]; then
|
||||
if [ $# -lt 1 ]; then
|
||||
echo "ERROR: Illegal number of parameters"
|
||||
echo "USAGE: ${0} count <path> <target>"
|
||||
echo "USAGE: ${0} count <path> [target]"
|
||||
fi
|
||||
|
||||
rm -rf sketches.txt
|
||||
|
|
@ -47,7 +52,7 @@ function count_sketches(){ # count_sketches <path> <target>
|
|||
return 0
|
||||
fi
|
||||
|
||||
local sketches=$(find $path -name *.ino)
|
||||
local sketches=$(find $path -name *.ino | sort)
|
||||
local sketchnum=0
|
||||
for sketch in $sketches; do
|
||||
local sketchdir=$(dirname $sketch)
|
||||
|
|
@ -55,7 +60,7 @@ function count_sketches(){ # count_sketches <path> <target>
|
|||
local sketchname=$(basename $sketch)
|
||||
if [[ "$sketchdirname.ino" != "$sketchname" ]]; then
|
||||
continue
|
||||
elif [[ -f "$sketchdir/.skip.$target" ]]; then
|
||||
elif [[ -n $target ]] && [[ -f "$sketchdir/.skip.$target" ]]; then
|
||||
continue
|
||||
else
|
||||
echo $sketch >> sketches.txt
|
||||
|
|
|
|||
58
.github/scripts/tests_build.sh
vendored
Executable file
58
.github/scripts/tests_build.sh
vendored
Executable file
|
|
@ -0,0 +1,58 @@
|
|||
#!/bin/bash
|
||||
|
||||
SCRIPTS_DIR="./.github/scripts"
|
||||
BUILD_CMD=""
|
||||
|
||||
if [ $# -eq 3 ]; then
|
||||
chunk_build=1
|
||||
elif [ $# -eq 2 ]; then
|
||||
chunk_build=0
|
||||
else
|
||||
echo "ERROR: Illegal number of parameters"
|
||||
echo "USAGE:
|
||||
${0} <target> <sketch_dir>
|
||||
${0} <target> <chunk> <total_chunks>
|
||||
"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
target=$1
|
||||
|
||||
case "$target" in
|
||||
"esp32") fqbn="espressif:esp32:esp32:PSRAM=enabled,PartitionScheme=huge_app"
|
||||
;;
|
||||
"esp32s2") fqbn="espressif:esp32:esp32s2:PSRAM=enabled,PartitionScheme=huge_app"
|
||||
;;
|
||||
"esp32c3") fqbn="espressif:esp32:esp32c3:PartitionScheme=huge_app"
|
||||
;;
|
||||
"esp32s3") fqbn="espressif:esp32:esp32s3:PSRAM=opi,USBMode=default,PartitionScheme=huge_app"
|
||||
;;
|
||||
esac
|
||||
|
||||
if [ -z $fqbn ]; then
|
||||
echo "Unvalid chip $1"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
source ${SCRIPTS_DIR}/install-arduino-ide.sh
|
||||
source ${SCRIPTS_DIR}/install-arduino-core-esp32.sh
|
||||
|
||||
args="$ARDUINO_IDE_PATH $ARDUINO_USR_PATH \"$fqbn\""
|
||||
|
||||
if [ $chunk_build -eq 1 ]; then
|
||||
chunk_index=$2
|
||||
chunk_max=$3
|
||||
|
||||
if [ "$chunk_index" -gt "$chunk_max" ] && [ "$chunk_max" -ge 2 ]; then
|
||||
chunk_index=$chunk_max
|
||||
fi
|
||||
BUILD_CMD="${SCRIPTS_DIR}/sketch_utils.sh chunk_build"
|
||||
args+=" $target $PWD/tests $chunk_index $chunk_max"
|
||||
else
|
||||
sketchdir=$2
|
||||
BUILD_CMD="${SCRIPTS_DIR}/sketch_utils.sh build"
|
||||
args+=" $PWD/tests/$sketchdir/$sketchdir.ino"
|
||||
fi
|
||||
|
||||
${BUILD_CMD} ${args}
|
||||
|
||||
71
.github/scripts/tests_run.sh
vendored
Executable file
71
.github/scripts/tests_run.sh
vendored
Executable file
|
|
@ -0,0 +1,71 @@
|
|||
#!/bin/bash
|
||||
|
||||
target=$1
|
||||
chunk_idex=$2
|
||||
chunks_num=$3
|
||||
|
||||
SCRIPTS_DIR="./.github/scripts"
|
||||
COUNT_SKETCHES="${SCRIPTS_DIR}/sketch_utils.sh count"
|
||||
|
||||
source ${SCRIPTS_DIR}/install-arduino-ide.sh
|
||||
|
||||
if [ "$chunks_num" -le 0 ]; then
|
||||
echo "ERROR: Chunks count must be positive number"
|
||||
return 1
|
||||
fi
|
||||
if [ "$chunk_idex" -ge "$chunks_num" ] && [ "$chunks_num" -ge 2 ]; then
|
||||
echo "ERROR: Chunk index must be less than chunks count"
|
||||
return 1
|
||||
fi
|
||||
|
||||
set +e
|
||||
${COUNT_SKETCHES} $PWD/tests $target
|
||||
sketchcount=$?
|
||||
set -e
|
||||
sketches=$(cat sketches.txt)
|
||||
rm -rf sketches.txt
|
||||
|
||||
chunk_size=$(( $sketchcount / $chunks_num ))
|
||||
all_chunks=$(( $chunks_num * $chunk_size ))
|
||||
if [ "$all_chunks" -lt "$sketchcount" ]; then
|
||||
chunk_size=$(( $chunk_size + 1 ))
|
||||
fi
|
||||
|
||||
start_index=0
|
||||
end_index=0
|
||||
if [ "$chunk_idex" -ge "$chunks_num" ]; then
|
||||
start_index=$chunk_idex
|
||||
end_index=$sketchcount
|
||||
else
|
||||
start_index=$(( $chunk_idex * $chunk_size ))
|
||||
if [ "$sketchcount" -le "$start_index" ]; then
|
||||
echo "Skipping job"
|
||||
return 0
|
||||
fi
|
||||
|
||||
end_index=$(( $(( $chunk_idex + 1 )) * $chunk_size ))
|
||||
if [ "$end_index" -gt "$sketchcount" ]; then
|
||||
end_index=$sketchcount
|
||||
fi
|
||||
fi
|
||||
|
||||
start_num=$(( $start_index + 1 ))
|
||||
sketchnum=0
|
||||
|
||||
for sketch in $sketches; do
|
||||
sketchdir=$(dirname $sketch)
|
||||
sketchdirname=$(basename $sketchdir)
|
||||
sketchname=$(basename $sketch)
|
||||
sketchnum=$(($sketchnum + 1))
|
||||
if [ "$sketchnum" -le "$start_index" ] \
|
||||
|| [ "$sketchnum" -gt "$end_index" ]; then
|
||||
continue
|
||||
fi
|
||||
echo ""
|
||||
echo "Test for Sketch Index $(($sketchnum - 1)) - $sketchdirname"
|
||||
pytest tests -k test_$sketchdirname --junit-xml=tests/$sketchdirname/$sketchdirname.xml
|
||||
result=$?
|
||||
if [ $result -ne 0 ]; then
|
||||
return $result
|
||||
fi
|
||||
done
|
||||
35
.github/scripts/update-version.sh
vendored
Executable file
35
.github/scripts/update-version.sh
vendored
Executable file
|
|
@ -0,0 +1,35 @@
|
|||
#!/bin/bash
|
||||
|
||||
if [ ! $# -eq 3 ]; then
|
||||
echo "Bad number of arguments: $#" >&2
|
||||
echo "usage: $0 <major> <minor> <patch>" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
re='^[0-9]+$'
|
||||
if [[ ! $1 =~ $re ]] || [[ ! $2 =~ $re ]] || [[ ! $3 =~ $re ]] ; then
|
||||
echo "error: Not a valid version: $1.$2.$3" >&2
|
||||
echo "usage: $0 <major> <minor> <patch>" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
ESP_ARDUINO_VERSION_MAJOR="$1"
|
||||
ESP_ARDUINO_VERSION_MINOR="$2"
|
||||
ESP_ARDUINO_VERSION_PATCH="$3"
|
||||
ESP_ARDUINO_VERSION="$ESP_ARDUINO_VERSION_MAJOR.$ESP_ARDUINO_VERSION_MINOR.$ESP_ARDUINO_VERSION_PATCH"
|
||||
|
||||
echo "New Arduino Version: $ESP_ARDUINO_VERSION"
|
||||
|
||||
echo "Updating platform.txt..."
|
||||
cat platform.txt | sed "s/version=.*/version=$ESP_ARDUINO_VERSION/g" > __platform.txt && mv __platform.txt platform.txt
|
||||
|
||||
echo "Updating package.json..."
|
||||
cat package.json | sed "s/.*\"version\":.*/ \"version\": \"$ESP_ARDUINO_VERSION\",/g" > __package.json && mv __package.json package.json
|
||||
|
||||
echo "Updating cores/esp32/esp_arduino_version.h..."
|
||||
cat cores/esp32/esp_arduino_version.h | \
|
||||
sed "s/#define ESP_ARDUINO_VERSION_MAJOR.*/#define ESP_ARDUINO_VERSION_MAJOR $ESP_ARDUINO_VERSION_MAJOR/g" | \
|
||||
sed "s/#define ESP_ARDUINO_VERSION_MINOR.*/#define ESP_ARDUINO_VERSION_MINOR $ESP_ARDUINO_VERSION_MINOR/g" | \
|
||||
sed "s/#define ESP_ARDUINO_VERSION_PATCH.*/#define ESP_ARDUINO_VERSION_PATCH $ESP_ARDUINO_VERSION_PATCH/g" > __esp_arduino_version.h && mv __esp_arduino_version.h cores/esp32/esp_arduino_version.h
|
||||
|
||||
exit 0
|
||||
121
.github/workflows/hil.yml
vendored
Normal file
121
.github/workflows/hil.yml
vendored
Normal file
|
|
@ -0,0 +1,121 @@
|
|||
name: Run tests in hardware
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
types: [opened, reopened, synchronize, labeled]
|
||||
|
||||
schedule:
|
||||
- cron: '0 2 * * *'
|
||||
|
||||
env:
|
||||
MAX_CHUNKS: 15
|
||||
|
||||
concurrency:
|
||||
group: hil-${{github.event.pull_request.number || github.ref}}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
gen_chunks:
|
||||
if: |
|
||||
contains(github.event.pull_request.labels.*.name, 'hil_test') ||
|
||||
github.event_name == 'schedule'
|
||||
name: Generate Chunks matrix
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
chunks: ${{ steps.gen-chunks.outputs.chunks }}
|
||||
steps:
|
||||
- name: Checkout Repository
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Generate Chunks matrix
|
||||
id: gen-chunks
|
||||
run: |
|
||||
set +e
|
||||
bash .github/scripts/sketch_utils.sh count tests
|
||||
sketches=$((? - 1))
|
||||
if [[ $sketches -gt ${{env.MAX_CHUNKS}} ]]; then
|
||||
$sketches=${{env.MAX_CHUNKS}}
|
||||
fi
|
||||
set -e
|
||||
rm sketches.txt
|
||||
CHUNKS=$(jq -c -n '$ARGS.positional' --args `seq 0 1 $sketches`)
|
||||
echo "::set-output name=chunks::${CHUNKS}"
|
||||
|
||||
Build:
|
||||
needs: gen_chunks
|
||||
name: ${{matrix.chip}}-Build#${{matrix.chunks}}
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
chip: ['esp32', 'esp32s2', 'esp32s3', 'esp32c3']
|
||||
chunks: ${{fromJson(needs.gen_chunks.outputs.chunks)}}
|
||||
|
||||
steps:
|
||||
- name: Checkout Repository
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Build sketches
|
||||
run: |
|
||||
bash .github/scripts/tests_build.sh ${{matrix.chip}} ${{matrix.chunks}} ${{env.MAX_CHUNKS}}
|
||||
- name: Upload ${{matrix.chip}}-${{matrix.chunks}} artifacts
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: ${{matrix.chip}}-${{matrix.chunks}}.artifacts
|
||||
path: |
|
||||
tests/*/build/*.bin
|
||||
tests/*/build/*.json
|
||||
Test:
|
||||
needs: [gen_chunks, Build]
|
||||
name: ${{matrix.chip}}-Test#${{matrix.chunks}}
|
||||
runs-on: ESP32
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
chip: ['esp32', 'esp32s2', 'esp32s3', 'esp32c3']
|
||||
chunks: ${{fromJson(needs.gen_chunks.outputs.chunks)}}
|
||||
container:
|
||||
image: python:3.10.1-bullseye
|
||||
options: --privileged
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Download ${{matrix.chip}}-${{matrix.chunks}} artifacts
|
||||
uses: actions/download-artifact@v2
|
||||
with:
|
||||
name: ${{matrix.chip}}-${{matrix.chunks}}.artifacts
|
||||
path: tests/
|
||||
|
||||
- name: Check Artifacts
|
||||
run: |
|
||||
ls -R tests
|
||||
cat tests/*/build/build.options.json
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
pip install -U pip
|
||||
pip install -r tests/requirements.txt
|
||||
|
||||
- name: Run Tests
|
||||
run: |
|
||||
bash .github/scripts/tests_run.sh ${{matrix.chip}} ${{matrix.chunks}} ${{env.MAX_CHUNKS}}
|
||||
|
||||
- name: Upload test result artifacts
|
||||
uses: actions/upload-artifact@v2
|
||||
if: always()
|
||||
with:
|
||||
name: test_results-${{matrix.chip}}-${{matrix.chunks}}
|
||||
path: tests/*/*.xml
|
||||
|
||||
event_file:
|
||||
name: "Event File"
|
||||
if: ${{ always() }}
|
||||
needs: Test
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Upload
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: Event File
|
||||
path: ${{github.event_path}}
|
||||
33
.github/workflows/publish.yml
vendored
Normal file
33
.github/workflows/publish.yml
vendored
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
name: Unit Test Results
|
||||
|
||||
on:
|
||||
workflow_run:
|
||||
workflows: [Run tests in hardware]
|
||||
|
||||
types:
|
||||
- completed
|
||||
|
||||
jobs:
|
||||
unit-test-results:
|
||||
name: Unit Test Results
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Download and Extract Artifacts
|
||||
env:
|
||||
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
|
||||
run: |
|
||||
mkdir -p artifacts && cd artifacts
|
||||
artifacts_url=${{ github.event.workflow_run.artifacts_url }}
|
||||
gh api "$artifacts_url" -q '.artifacts[] | [.name, .archive_download_url] | @tsv' | while read artifact
|
||||
do
|
||||
IFS=$'\t' read name url <<< "$artifact"
|
||||
gh api $url > "$name.zip"
|
||||
unzip -d "$name" "$name.zip"
|
||||
done
|
||||
- name: Publish Unit Test Results
|
||||
uses: EnricoMi/publish-unit-test-result-action@v1
|
||||
with:
|
||||
commit: ${{ github.event.workflow_run.head_sha }}
|
||||
event_file: artifacts/Event File/event.json
|
||||
event_name: ${{ github.event.workflow_run.event }}
|
||||
files: "artifacts/**/*.xml"
|
||||
28
.github/workflows/test_selfhosted_runner.yml
vendored
28
.github/workflows/test_selfhosted_runner.yml
vendored
|
|
@ -1,28 +0,0 @@
|
|||
name: Test Github action on self hosted RPI runnes
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
pull_request:
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Dummy test - self hosted GHR
|
||||
runs-on: self-hosted
|
||||
if: github.repository == 'espressif/arduino-esp32'
|
||||
steps:
|
||||
- name: Check out repo
|
||||
uses: actions/checkout@v2
|
||||
- name: Test message 1
|
||||
run: echo "This is test message"
|
||||
- name: Test message 2
|
||||
run: echo "This is test message2"
|
||||
- name: List directory
|
||||
run: ls
|
||||
- name: Create copy of README
|
||||
run: cp README.md README2.md
|
||||
- name: Read README2
|
||||
run: cat README2.md
|
||||
- name: Delete README2
|
||||
run: rm README2.md
|
||||
3
.gitignore
vendored
3
.gitignore
vendored
|
|
@ -23,3 +23,6 @@ boards.sloeber.txt
|
|||
# Ignore docs build (Sphinx)
|
||||
docs/build
|
||||
docs/source/_build
|
||||
|
||||
# Test log files
|
||||
*.log
|
||||
|
|
|
|||
|
|
@ -57,6 +57,7 @@ set(CORE_SRCS
|
|||
cores/esp32/stdlib_noniso.c
|
||||
cores/esp32/Stream.cpp
|
||||
cores/esp32/StreamString.cpp
|
||||
cores/esp32/Tone.cpp
|
||||
cores/esp32/HWCDC.cpp
|
||||
cores/esp32/USB.cpp
|
||||
cores/esp32/USBCDC.cpp
|
||||
|
|
@ -174,6 +175,7 @@ set(includedirs
|
|||
libraries/EEPROM/src
|
||||
libraries/ESP32/src
|
||||
libraries/ESPmDNS/src
|
||||
libraries/Ethernet/src
|
||||
libraries/FFat/src
|
||||
libraries/FS/src
|
||||
libraries/HTTPClient/src
|
||||
|
|
|
|||
801
boards.txt
801
boards.txt
|
|
@ -16,6 +16,7 @@ menu.LORAWAN_REGION=LoRaWan Region
|
|||
menu.LoRaWanDebugLevel=LoRaWan Debug Level
|
||||
menu.LoopCore=Arduino Runs On
|
||||
menu.EventsCore=Events Run On
|
||||
menu.MemoryType=Memory Type
|
||||
|
||||
##############################################################
|
||||
### DO NOT PUT BOARDS ABOVE THE OFFICIAL ESPRESSIF BOARDS! ###
|
||||
|
|
@ -53,11 +54,66 @@ esp32s3.build.flash_size=4MB
|
|||
esp32s3.build.flash_freq=80m
|
||||
esp32s3.build.flash_mode=dio
|
||||
esp32s3.build.boot=qio
|
||||
esp32s3.build.boot_freq=80m
|
||||
esp32s3.build.partitions=default
|
||||
esp32s3.build.defines=
|
||||
esp32s3.build.extra_libs="-L{compiler.sdk.path}/lib/spiram"
|
||||
esp32s3.build.loop_core=
|
||||
esp32s3.build.event_core=
|
||||
esp32s3.build.flash_type=qspi
|
||||
esp32s3.build.psram_type=qspi
|
||||
esp32s3.build.memory_type={build.flash_type}_{build.psram_type}
|
||||
|
||||
#esp32s3.menu.MemoryType.default=QSPI Flash and PSRAM
|
||||
#esp32s3.menu.MemoryType.default.build.memory_type=qspi_qspi
|
||||
#esp32s3.menu.MemoryType.qspi_opi=QSPI Flash and OPI PSRAM
|
||||
#esp32s3.menu.MemoryType.qspi_opi.build.memory_type=qspi_opi
|
||||
#esp32s3.menu.MemoryType.opi_opi=OPI Flash and PSRAM
|
||||
#esp32s3.menu.MemoryType.opi_opi.build.memory_type=opi_opi
|
||||
|
||||
esp32s3.menu.PSRAM.disabled=Disabled
|
||||
esp32s3.menu.PSRAM.disabled.build.defines=
|
||||
esp32s3.menu.PSRAM.disabled.build.psram_type=qspi
|
||||
esp32s3.menu.PSRAM.enabled=QSPI PSRAM
|
||||
esp32s3.menu.PSRAM.enabled.build.defines=-DBOARD_HAS_PSRAM
|
||||
esp32s3.menu.PSRAM.enabled.build.psram_type=qspi
|
||||
esp32s3.menu.PSRAM.opi=OPI PSRAM
|
||||
esp32s3.menu.PSRAM.opi.build.defines=-DBOARD_HAS_PSRAM
|
||||
esp32s3.menu.PSRAM.opi.build.psram_type=opi
|
||||
|
||||
esp32s3.menu.FlashMode.qio=QIO 80MHz
|
||||
esp32s3.menu.FlashMode.qio.build.flash_mode=dio
|
||||
esp32s3.menu.FlashMode.qio.build.boot=qio
|
||||
esp32s3.menu.FlashMode.qio.build.boot_freq=80m
|
||||
esp32s3.menu.FlashMode.qio.build.flash_freq=80m
|
||||
esp32s3.menu.FlashMode.qio.build.flash_type=qspi
|
||||
esp32s3.menu.FlashMode.qio120=QIO 120MHz
|
||||
esp32s3.menu.FlashMode.qio120.build.flash_mode=dio
|
||||
esp32s3.menu.FlashMode.qio120.build.boot=qio
|
||||
esp32s3.menu.FlashMode.qio120.build.boot_freq=120m
|
||||
esp32s3.menu.FlashMode.qio120.build.flash_freq=80m
|
||||
esp32s3.menu.FlashMode.qio120.build.flash_type=qspi
|
||||
esp32s3.menu.FlashMode.dio=DIO 80MHz
|
||||
esp32s3.menu.FlashMode.dio.build.flash_mode=dio
|
||||
esp32s3.menu.FlashMode.dio.build.boot=dio
|
||||
esp32s3.menu.FlashMode.dio.build.boot_freq=80m
|
||||
esp32s3.menu.FlashMode.dio.build.flash_freq=80m
|
||||
esp32s3.menu.FlashMode.dio.build.flash_type=qspi
|
||||
esp32s3.menu.FlashMode.opi=OPI 80MHz
|
||||
esp32s3.menu.FlashMode.opi.build.flash_mode=dout
|
||||
esp32s3.menu.FlashMode.opi.build.boot=opi
|
||||
esp32s3.menu.FlashMode.opi.build.boot_freq=80m
|
||||
esp32s3.menu.FlashMode.opi.build.flash_freq=80m
|
||||
esp32s3.menu.FlashMode.opi.build.flash_type=opi
|
||||
|
||||
esp32s3.menu.FlashSize.4M=4MB (32Mb)
|
||||
esp32s3.menu.FlashSize.4M.build.flash_size=4MB
|
||||
esp32s3.menu.FlashSize.8M=8MB (64Mb)
|
||||
esp32s3.menu.FlashSize.8M.build.flash_size=8MB
|
||||
esp32s3.menu.FlashSize.8M.build.partitions=default_8MB
|
||||
esp32s3.menu.FlashSize.16M=16MB (128Mb)
|
||||
esp32s3.menu.FlashSize.16M.build.flash_size=16MB
|
||||
#esp32s3.menu.FlashSize.32M=32MB (256Mb)
|
||||
#esp32s3.menu.FlashSize.32M.build.flash_size=32MB
|
||||
|
||||
esp32s3.menu.LoopCore.1=Core 1
|
||||
esp32s3.menu.LoopCore.1.build.loop_core=-DARDUINO_RUNNING_CORE=1
|
||||
|
|
@ -96,16 +152,6 @@ esp32s3.menu.UploadMode.cdc=Internal USB
|
|||
esp32s3.menu.UploadMode.cdc.upload.use_1200bps_touch=true
|
||||
esp32s3.menu.UploadMode.cdc.upload.wait_for_upload_port=true
|
||||
|
||||
esp32s3.menu.PSRAM.disabled=Disabled
|
||||
esp32s3.menu.PSRAM.disabled.build.defines=
|
||||
esp32s3.menu.PSRAM.disabled.build.extra_libs="-L{compiler.sdk.path}/lib/spiram"
|
||||
esp32s3.menu.PSRAM.qspi=QSPI
|
||||
esp32s3.menu.PSRAM.qspi.build.defines=-DBOARD_HAS_PSRAM
|
||||
esp32s3.menu.PSRAM.qspi.build.extra_libs="-L{compiler.sdk.path}/lib/spiram"
|
||||
esp32s3.menu.PSRAM.opi=OPI
|
||||
esp32s3.menu.PSRAM.opi.build.defines=-DBOARD_HAS_PSRAM -DCONFIG_SPIRAM_BOOT_INIT -DCONFIG_SPIRAM_MODE_OCT=1
|
||||
esp32s3.menu.PSRAM.opi.build.extra_libs="-L{compiler.sdk.path}/lib/opiram"
|
||||
|
||||
esp32s3.menu.PartitionScheme.default=Default 4MB with spiffs (1.2MB APP/1.5MB SPIFFS)
|
||||
esp32s3.menu.PartitionScheme.default.build.partitions=default
|
||||
esp32s3.menu.PartitionScheme.defaultffat=Default 4MB with ffat (1.2MB APP/1.5MB FATFS)
|
||||
|
|
@ -153,35 +199,6 @@ esp32s3.menu.CPUFreq.20.build.f_cpu=20000000L
|
|||
esp32s3.menu.CPUFreq.10=10MHz
|
||||
esp32s3.menu.CPUFreq.10.build.f_cpu=10000000L
|
||||
|
||||
esp32s3.menu.FlashMode.qio=QIO
|
||||
esp32s3.menu.FlashMode.qio.build.flash_mode=dio
|
||||
esp32s3.menu.FlashMode.qio.build.boot=qio
|
||||
esp32s3.menu.FlashMode.dio=DIO
|
||||
esp32s3.menu.FlashMode.dio.build.flash_mode=dio
|
||||
esp32s3.menu.FlashMode.dio.build.boot=dio
|
||||
esp32s3.menu.FlashMode.qout=QOUT
|
||||
esp32s3.menu.FlashMode.qout.build.flash_mode=dout
|
||||
esp32s3.menu.FlashMode.qout.build.boot=qout
|
||||
esp32s3.menu.FlashMode.dout=DOUT
|
||||
esp32s3.menu.FlashMode.dout.build.flash_mode=dout
|
||||
esp32s3.menu.FlashMode.dout.build.boot=dout
|
||||
|
||||
esp32s3.menu.FlashFreq.80=80MHz
|
||||
esp32s3.menu.FlashFreq.80.build.flash_freq=80m
|
||||
esp32s3.menu.FlashFreq.40=40MHz
|
||||
esp32s3.menu.FlashFreq.40.build.flash_freq=40m
|
||||
|
||||
esp32s3.menu.FlashSize.4M=4MB (32Mb)
|
||||
esp32s3.menu.FlashSize.4M.build.flash_size=4MB
|
||||
esp32s3.menu.FlashSize.8M=8MB (64Mb)
|
||||
esp32s3.menu.FlashSize.8M.build.flash_size=8MB
|
||||
esp32s3.menu.FlashSize.8M.build.partitions=default_8MB
|
||||
esp32s3.menu.FlashSize.2M=2MB (16Mb)
|
||||
esp32s3.menu.FlashSize.2M.build.flash_size=2MB
|
||||
esp32s3.menu.FlashSize.2M.build.partitions=minimal
|
||||
esp32s3.menu.FlashSize.16M=16MB (128Mb)
|
||||
esp32s3.menu.FlashSize.16M.build.flash_size=16MB
|
||||
|
||||
esp32s3.menu.UploadSpeed.921600=921600
|
||||
esp32s3.menu.UploadSpeed.921600.upload.speed=921600
|
||||
esp32s3.menu.UploadSpeed.115200=115200
|
||||
|
|
@ -679,6 +696,155 @@ esp32.menu.DebugLevel.verbose.build.code_debug=5
|
|||
|
||||
##############################################################
|
||||
|
||||
esp32da.name=ESP32-WROOM-DA Module
|
||||
|
||||
esp32da.upload.tool=esptool_py
|
||||
esp32da.upload.maximum_size=1310720
|
||||
esp32da.upload.maximum_data_size=327680
|
||||
esp32da.upload.flags=
|
||||
esp32da.upload.extra_flags=
|
||||
|
||||
esp32da.serial.disableDTR=true
|
||||
esp32da.serial.disableRTS=true
|
||||
|
||||
esp32da.build.tarch=xtensa
|
||||
esp32da.build.bootloader_addr=0x1000
|
||||
esp32da.build.target=esp32
|
||||
esp32da.build.mcu=esp32
|
||||
esp32da.build.core=esp32
|
||||
esp32da.build.variant=esp32da
|
||||
esp32da.build.board=ESP32_WROOM_DA
|
||||
|
||||
esp32da.build.f_cpu=240000000L
|
||||
esp32da.build.flash_size=4MB
|
||||
esp32da.build.flash_freq=40m
|
||||
esp32da.build.flash_mode=dio
|
||||
esp32da.build.boot=dio
|
||||
esp32da.build.partitions=default
|
||||
esp32da.build.defines=
|
||||
esp32da.build.loop_core=
|
||||
esp32da.build.event_core=
|
||||
|
||||
esp32da.menu.PartitionScheme.default=Default 4MB with spiffs (1.2MB APP/1.5MB SPIFFS)
|
||||
esp32da.menu.PartitionScheme.default.build.partitions=default
|
||||
esp32da.menu.PartitionScheme.defaultffat=Default 4MB with ffat (1.2MB APP/1.5MB FATFS)
|
||||
esp32da.menu.PartitionScheme.defaultffat.build.partitions=default_ffat
|
||||
esp32da.menu.PartitionScheme.default_8MB=8M Flash (3MB APP/1.5MB FAT)
|
||||
esp32da.menu.PartitionScheme.default_8MB.build.partitions=default_8MB
|
||||
esp32da.menu.PartitionScheme.default_8MB.upload.maximum_size=3342336
|
||||
esp32da.menu.PartitionScheme.minimal=Minimal (1.3MB APP/700KB SPIFFS)
|
||||
esp32da.menu.PartitionScheme.minimal.build.partitions=minimal
|
||||
esp32da.menu.PartitionScheme.no_ota=No OTA (2MB APP/2MB SPIFFS)
|
||||
esp32da.menu.PartitionScheme.no_ota.build.partitions=no_ota
|
||||
esp32da.menu.PartitionScheme.no_ota.upload.maximum_size=2097152
|
||||
esp32da.menu.PartitionScheme.noota_3g=No OTA (1MB APP/3MB SPIFFS)
|
||||
esp32da.menu.PartitionScheme.noota_3g.build.partitions=noota_3g
|
||||
esp32da.menu.PartitionScheme.noota_3g.upload.maximum_size=1048576
|
||||
esp32da.menu.PartitionScheme.noota_ffat=No OTA (2MB APP/2MB FATFS)
|
||||
esp32da.menu.PartitionScheme.noota_ffat.build.partitions=noota_ffat
|
||||
esp32da.menu.PartitionScheme.noota_ffat.upload.maximum_size=2097152
|
||||
esp32da.menu.PartitionScheme.noota_3gffat=No OTA (1MB APP/3MB FATFS)
|
||||
esp32da.menu.PartitionScheme.noota_3gffat.build.partitions=noota_3gffat
|
||||
esp32da.menu.PartitionScheme.noota_3gffat.upload.maximum_size=1048576
|
||||
esp32da.menu.PartitionScheme.huge_app=Huge APP (3MB No OTA/1MB SPIFFS)
|
||||
esp32da.menu.PartitionScheme.huge_app.build.partitions=huge_app
|
||||
esp32da.menu.PartitionScheme.huge_app.upload.maximum_size=3145728
|
||||
esp32da.menu.PartitionScheme.min_spiffs=Minimal SPIFFS (1.9MB APP with OTA/190KB SPIFFS)
|
||||
esp32da.menu.PartitionScheme.min_spiffs.build.partitions=min_spiffs
|
||||
esp32da.menu.PartitionScheme.min_spiffs.upload.maximum_size=1966080
|
||||
esp32da.menu.PartitionScheme.fatflash=16M Flash (2MB APP/12.5MB FAT)
|
||||
esp32da.menu.PartitionScheme.fatflash.build.partitions=ffat
|
||||
esp32da.menu.PartitionScheme.fatflash.upload.maximum_size=2097152
|
||||
esp32da.menu.PartitionScheme.app3M_fat9M_16MB=16M Flash (3MB APP/9MB FATFS)
|
||||
esp32da.menu.PartitionScheme.app3M_fat9M_16MB.build.partitions=app3M_fat9M_16MB
|
||||
esp32da.menu.PartitionScheme.app3M_fat9M_16MB.upload.maximum_size=3145728
|
||||
esp32da.menu.PartitionScheme.rainmaker=RainMaker
|
||||
esp32da.menu.PartitionScheme.rainmaker.build.partitions=rainmaker
|
||||
esp32da.menu.PartitionScheme.rainmaker.upload.maximum_size=3145728
|
||||
|
||||
esp32da.menu.CPUFreq.240=240MHz (WiFi/BT)
|
||||
esp32da.menu.CPUFreq.240.build.f_cpu=240000000L
|
||||
esp32da.menu.CPUFreq.160=160MHz (WiFi/BT)
|
||||
esp32da.menu.CPUFreq.160.build.f_cpu=160000000L
|
||||
esp32da.menu.CPUFreq.80=80MHz (WiFi/BT)
|
||||
esp32da.menu.CPUFreq.80.build.f_cpu=80000000L
|
||||
esp32da.menu.CPUFreq.40=40MHz (40MHz XTAL)
|
||||
esp32da.menu.CPUFreq.40.build.f_cpu=40000000L
|
||||
esp32da.menu.CPUFreq.26=26MHz (26MHz XTAL)
|
||||
esp32da.menu.CPUFreq.26.build.f_cpu=26000000L
|
||||
esp32da.menu.CPUFreq.20=20MHz (40MHz XTAL)
|
||||
esp32da.menu.CPUFreq.20.build.f_cpu=20000000L
|
||||
esp32da.menu.CPUFreq.13=13MHz (26MHz XTAL)
|
||||
esp32da.menu.CPUFreq.13.build.f_cpu=13000000L
|
||||
esp32da.menu.CPUFreq.10=10MHz (40MHz XTAL)
|
||||
esp32da.menu.CPUFreq.10.build.f_cpu=10000000L
|
||||
|
||||
esp32da.menu.FlashMode.qio=QIO
|
||||
esp32da.menu.FlashMode.qio.build.flash_mode=dio
|
||||
esp32da.menu.FlashMode.qio.build.boot=qio
|
||||
esp32da.menu.FlashMode.dio=DIO
|
||||
esp32da.menu.FlashMode.dio.build.flash_mode=dio
|
||||
esp32da.menu.FlashMode.dio.build.boot=dio
|
||||
esp32da.menu.FlashMode.qout=QOUT
|
||||
esp32da.menu.FlashMode.qout.build.flash_mode=dout
|
||||
esp32da.menu.FlashMode.qout.build.boot=qout
|
||||
esp32da.menu.FlashMode.dout=DOUT
|
||||
esp32da.menu.FlashMode.dout.build.flash_mode=dout
|
||||
esp32da.menu.FlashMode.dout.build.boot=dout
|
||||
|
||||
esp32da.menu.FlashFreq.80=80MHz
|
||||
esp32da.menu.FlashFreq.80.build.flash_freq=80m
|
||||
esp32da.menu.FlashFreq.40=40MHz
|
||||
esp32da.menu.FlashFreq.40.build.flash_freq=40m
|
||||
|
||||
esp32da.menu.FlashSize.4M=4MB (32Mb)
|
||||
esp32da.menu.FlashSize.4M.build.flash_size=4MB
|
||||
esp32da.menu.FlashSize.8M=8MB (64Mb)
|
||||
esp32da.menu.FlashSize.8M.build.flash_size=8MB
|
||||
esp32da.menu.FlashSize.8M.build.partitions=default_8MB
|
||||
esp32da.menu.FlashSize.16M=16MB (128Mb)
|
||||
esp32da.menu.FlashSize.16M.build.flash_size=16MB
|
||||
|
||||
esp32da.menu.UploadSpeed.921600=921600
|
||||
esp32da.menu.UploadSpeed.921600.upload.speed=921600
|
||||
esp32da.menu.UploadSpeed.115200=115200
|
||||
esp32da.menu.UploadSpeed.115200.upload.speed=115200
|
||||
esp32da.menu.UploadSpeed.256000.windows=256000
|
||||
esp32da.menu.UploadSpeed.256000.upload.speed=256000
|
||||
esp32da.menu.UploadSpeed.230400.windows.upload.speed=256000
|
||||
esp32da.menu.UploadSpeed.230400=230400
|
||||
esp32da.menu.UploadSpeed.230400.upload.speed=230400
|
||||
esp32da.menu.UploadSpeed.460800.linux=460800
|
||||
esp32da.menu.UploadSpeed.460800.macosx=460800
|
||||
esp32da.menu.UploadSpeed.460800.upload.speed=460800
|
||||
esp32da.menu.UploadSpeed.512000.windows=512000
|
||||
esp32da.menu.UploadSpeed.512000.upload.speed=512000
|
||||
|
||||
esp32da.menu.LoopCore.1=Core 1
|
||||
esp32da.menu.LoopCore.1.build.loop_core=-DARDUINO_RUNNING_CORE=1
|
||||
esp32da.menu.LoopCore.0=Core 0
|
||||
esp32da.menu.LoopCore.0.build.loop_core=-DARDUINO_RUNNING_CORE=0
|
||||
|
||||
esp32da.menu.EventsCore.1=Core 1
|
||||
esp32da.menu.EventsCore.1.build.event_core=-DARDUINO_EVENT_RUNNING_CORE=1
|
||||
esp32da.menu.EventsCore.0=Core 0
|
||||
esp32da.menu.EventsCore.0.build.event_core=-DARDUINO_EVENT_RUNNING_CORE=0
|
||||
|
||||
esp32da.menu.DebugLevel.none=None
|
||||
esp32da.menu.DebugLevel.none.build.code_debug=0
|
||||
esp32da.menu.DebugLevel.error=Error
|
||||
esp32da.menu.DebugLevel.error.build.code_debug=1
|
||||
esp32da.menu.DebugLevel.warn=Warn
|
||||
esp32da.menu.DebugLevel.warn.build.code_debug=2
|
||||
esp32da.menu.DebugLevel.info=Info
|
||||
esp32da.menu.DebugLevel.info.build.code_debug=3
|
||||
esp32da.menu.DebugLevel.debug=Debug
|
||||
esp32da.menu.DebugLevel.debug.build.code_debug=4
|
||||
esp32da.menu.DebugLevel.verbose=Verbose
|
||||
esp32da.menu.DebugLevel.verbose.build.code_debug=5
|
||||
|
||||
##############################################################
|
||||
|
||||
esp32wrover.name=ESP32 Wrover Module
|
||||
|
||||
esp32wrover.upload.tool=esptool_py
|
||||
|
|
@ -884,8 +1050,8 @@ esp32s3box.build.flash_freq=80m
|
|||
esp32s3box.build.flash_mode=dio
|
||||
esp32s3box.build.boot=qio
|
||||
esp32s3box.build.partitions=default
|
||||
esp32s3box.build.extra_libs="-L{compiler.sdk.path}/lib/opiram"
|
||||
esp32s3box.build.defines=-DBOARD_HAS_PSRAM -DCONFIG_SPIRAM_BOOT_INIT -DCONFIG_SPIRAM_MODE_OCT=1
|
||||
esp32s3box.build.defines=-DBOARD_HAS_PSRAM
|
||||
esp32s3box.build.memory_type=qspi_opi
|
||||
esp32s3box.build.loop_core=-DARDUINO_RUNNING_CORE=1
|
||||
esp32s3box.build.event_core=-DARDUINO_EVENT_RUNNING_CORE=1
|
||||
|
||||
|
|
@ -955,6 +1121,118 @@ esp32s3box.menu.DebugLevel.verbose.build.code_debug=5
|
|||
|
||||
##############################################################
|
||||
|
||||
esp32s3camlcd.name=ESP32S3 CAM LCD
|
||||
esp32s3camlcd.vid.0=0x303a
|
||||
esp32s3camlcd.pid.0=0x1001
|
||||
|
||||
esp32s3camlcd.upload.tool=esptool_py
|
||||
esp32s3camlcd.upload.maximum_size=1310720
|
||||
esp32s3camlcd.upload.maximum_data_size=327680
|
||||
esp32s3camlcd.upload.flags=
|
||||
esp32s3camlcd.upload.extra_flags=
|
||||
esp32s3camlcd.upload.use_1200bps_touch=false
|
||||
esp32s3camlcd.upload.wait_for_upload_port=false
|
||||
|
||||
esp32s3camlcd.serial.disableDTR=false
|
||||
esp32s3camlcd.serial.disableRTS=false
|
||||
|
||||
esp32s3camlcd.build.tarch=xtensa
|
||||
esp32s3camlcd.build.bootloader_addr=0x0
|
||||
esp32s3camlcd.build.target=esp32s3
|
||||
esp32s3camlcd.build.mcu=esp32s3
|
||||
esp32s3camlcd.build.core=esp32
|
||||
esp32s3camlcd.build.variant=esp32s3camlcd
|
||||
esp32s3camlcd.build.board=ESP32S3_CAM_LCD
|
||||
|
||||
esp32s3camlcd.build.usb_mode=1
|
||||
esp32s3camlcd.build.cdc_on_boot=0
|
||||
esp32s3camlcd.build.msc_on_boot=0
|
||||
esp32s3camlcd.build.dfu_on_boot=0
|
||||
esp32s3camlcd.build.f_cpu=240000000L
|
||||
esp32s3camlcd.build.flash_size=4MB
|
||||
esp32s3camlcd.build.flash_freq=80m
|
||||
esp32s3camlcd.build.flash_mode=dout
|
||||
esp32s3camlcd.build.boot=opi
|
||||
esp32s3camlcd.build.partitions=default
|
||||
esp32s3camlcd.build.defines=-DBOARD_HAS_PSRAM
|
||||
esp32s3camlcd.build.memory_type=opi_opi
|
||||
esp32s3camlcd.build.loop_core=
|
||||
esp32s3camlcd.build.event_core=
|
||||
|
||||
esp32s3camlcd.menu.LoopCore.1=Core 1
|
||||
esp32s3camlcd.menu.LoopCore.1.build.loop_core=-DARDUINO_RUNNING_CORE=1
|
||||
esp32s3camlcd.menu.LoopCore.0=Core 0
|
||||
esp32s3camlcd.menu.LoopCore.0.build.loop_core=-DARDUINO_RUNNING_CORE=0
|
||||
|
||||
esp32s3camlcd.menu.EventsCore.1=Core 1
|
||||
esp32s3camlcd.menu.EventsCore.1.build.event_core=-DARDUINO_EVENT_RUNNING_CORE=1
|
||||
esp32s3camlcd.menu.EventsCore.0=Core 0
|
||||
esp32s3camlcd.menu.EventsCore.0.build.event_core=-DARDUINO_EVENT_RUNNING_CORE=0
|
||||
|
||||
esp32s3camlcd.menu.PartitionScheme.default=Default 4MB with spiffs (1.2MB APP/1.5MB SPIFFS)
|
||||
esp32s3camlcd.menu.PartitionScheme.default.build.partitions=default
|
||||
esp32s3camlcd.menu.PartitionScheme.defaultffat=Default 4MB with ffat (1.2MB APP/1.5MB FATFS)
|
||||
esp32s3camlcd.menu.PartitionScheme.defaultffat.build.partitions=default_ffat
|
||||
esp32s3camlcd.menu.PartitionScheme.default_8MB=8M Flash (3MB APP/1.5MB FAT)
|
||||
esp32s3camlcd.menu.PartitionScheme.default_8MB.build.partitions=default_8MB
|
||||
esp32s3camlcd.menu.PartitionScheme.default_8MB.upload.maximum_size=3342336
|
||||
esp32s3camlcd.menu.PartitionScheme.minimal=Minimal (1.3MB APP/700KB SPIFFS)
|
||||
esp32s3camlcd.menu.PartitionScheme.minimal.build.partitions=minimal
|
||||
esp32s3camlcd.menu.PartitionScheme.no_ota=No OTA (2MB APP/2MB SPIFFS)
|
||||
esp32s3camlcd.menu.PartitionScheme.no_ota.build.partitions=no_ota
|
||||
esp32s3camlcd.menu.PartitionScheme.no_ota.upload.maximum_size=2097152
|
||||
esp32s3camlcd.menu.PartitionScheme.noota_3g=No OTA (1MB APP/3MB SPIFFS)
|
||||
esp32s3camlcd.menu.PartitionScheme.noota_3g.build.partitions=noota_3g
|
||||
esp32s3camlcd.menu.PartitionScheme.noota_3g.upload.maximum_size=1048576
|
||||
esp32s3camlcd.menu.PartitionScheme.noota_ffat=No OTA (2MB APP/2MB FATFS)
|
||||
esp32s3camlcd.menu.PartitionScheme.noota_ffat.build.partitions=noota_ffat
|
||||
esp32s3camlcd.menu.PartitionScheme.noota_ffat.upload.maximum_size=2097152
|
||||
esp32s3camlcd.menu.PartitionScheme.noota_3gffat=No OTA (1MB APP/3MB FATFS)
|
||||
esp32s3camlcd.menu.PartitionScheme.noota_3gffat.build.partitions=noota_3gffat
|
||||
esp32s3camlcd.menu.PartitionScheme.noota_3gffat.upload.maximum_size=1048576
|
||||
esp32s3camlcd.menu.PartitionScheme.huge_app=Huge APP (3MB No OTA/1MB SPIFFS)
|
||||
esp32s3camlcd.menu.PartitionScheme.huge_app.build.partitions=huge_app
|
||||
esp32s3camlcd.menu.PartitionScheme.huge_app.upload.maximum_size=3145728
|
||||
esp32s3camlcd.menu.PartitionScheme.min_spiffs=Minimal SPIFFS (1.9MB APP with OTA/190KB SPIFFS)
|
||||
esp32s3camlcd.menu.PartitionScheme.min_spiffs.build.partitions=min_spiffs
|
||||
esp32s3camlcd.menu.PartitionScheme.min_spiffs.upload.maximum_size=1966080
|
||||
esp32s3camlcd.menu.PartitionScheme.fatflash=16M Flash (2MB APP/12.5MB FAT)
|
||||
esp32s3camlcd.menu.PartitionScheme.fatflash.build.partitions=ffat
|
||||
esp32s3camlcd.menu.PartitionScheme.fatflash.upload.maximum_size=2097152
|
||||
esp32s3camlcd.menu.PartitionScheme.app3M_fat9M_16MB=16M Flash (3MB APP/9MB FATFS)
|
||||
esp32s3camlcd.menu.PartitionScheme.app3M_fat9M_16MB.build.partitions=app3M_fat9M_16MB
|
||||
esp32s3camlcd.menu.PartitionScheme.app3M_fat9M_16MB.upload.maximum_size=3145728
|
||||
|
||||
esp32s3camlcd.menu.UploadSpeed.921600=921600
|
||||
esp32s3camlcd.menu.UploadSpeed.921600.upload.speed=921600
|
||||
esp32s3camlcd.menu.UploadSpeed.115200=115200
|
||||
esp32s3camlcd.menu.UploadSpeed.115200.upload.speed=115200
|
||||
esp32s3camlcd.menu.UploadSpeed.256000.windows=256000
|
||||
esp32s3camlcd.menu.UploadSpeed.256000.upload.speed=256000
|
||||
esp32s3camlcd.menu.UploadSpeed.230400.windows.upload.speed=256000
|
||||
esp32s3camlcd.menu.UploadSpeed.230400=230400
|
||||
esp32s3camlcd.menu.UploadSpeed.230400.upload.speed=230400
|
||||
esp32s3camlcd.menu.UploadSpeed.460800.linux=460800
|
||||
esp32s3camlcd.menu.UploadSpeed.460800.macosx=460800
|
||||
esp32s3camlcd.menu.UploadSpeed.460800.upload.speed=460800
|
||||
esp32s3camlcd.menu.UploadSpeed.512000.windows=512000
|
||||
esp32s3camlcd.menu.UploadSpeed.512000.upload.speed=512000
|
||||
|
||||
esp32s3camlcd.menu.DebugLevel.none=None
|
||||
esp32s3camlcd.menu.DebugLevel.none.build.code_debug=0
|
||||
esp32s3camlcd.menu.DebugLevel.error=Error
|
||||
esp32s3camlcd.menu.DebugLevel.error.build.code_debug=1
|
||||
esp32s3camlcd.menu.DebugLevel.warn=Warn
|
||||
esp32s3camlcd.menu.DebugLevel.warn.build.code_debug=2
|
||||
esp32s3camlcd.menu.DebugLevel.info=Info
|
||||
esp32s3camlcd.menu.DebugLevel.info.build.code_debug=3
|
||||
esp32s3camlcd.menu.DebugLevel.debug=Debug
|
||||
esp32s3camlcd.menu.DebugLevel.debug.build.code_debug=4
|
||||
esp32s3camlcd.menu.DebugLevel.verbose=Verbose
|
||||
esp32s3camlcd.menu.DebugLevel.verbose.build.code_debug=5
|
||||
|
||||
##############################################################
|
||||
|
||||
esp32s2usb.name=ESP32S2 Native USB
|
||||
esp32s2usb.vid.0=0x303a
|
||||
esp32s2usb.pid.0=0x0003
|
||||
|
|
@ -4070,6 +4348,286 @@ d32_pro.menu.DebugLevel.verbose.build.code_debug=5
|
|||
|
||||
##############################################################
|
||||
|
||||
lolin_c3_mini.name=LOLIN C3 Mini
|
||||
lolin_c3_mini.vid.0=0x303a
|
||||
lolin_c3_mini.pid.0=0x1001
|
||||
|
||||
lolin_c3_mini.upload.tool=esptool_py
|
||||
lolin_c3_mini.upload.maximum_size=1310720
|
||||
lolin_c3_mini.upload.maximum_data_size=327680
|
||||
lolin_c3_mini.upload.flags=
|
||||
lolin_c3_mini.upload.extra_flags=
|
||||
lolin_c3_mini.upload.use_1200bps_touch=false
|
||||
lolin_c3_mini.upload.wait_for_upload_port=false
|
||||
|
||||
lolin_c3_mini.serial.disableDTR=true
|
||||
lolin_c3_mini.serial.disableRTS=true
|
||||
|
||||
lolin_c3_mini.build.tarch=riscv32
|
||||
lolin_c3_mini.build.target=esp
|
||||
lolin_c3_mini.build.mcu=esp32c3
|
||||
lolin_c3_mini.build.core=esp32
|
||||
lolin_c3_mini.build.variant=lolin_c3_mini
|
||||
lolin_c3_mini.build.board=LOLIN_C3_MINI
|
||||
lolin_c3_mini.build.bootloader_addr=0x0
|
||||
|
||||
lolin_c3_mini.build.cdc_on_boot=1
|
||||
lolin_c3_mini.build.f_cpu=160000000L
|
||||
lolin_c3_mini.build.flash_size=4MB
|
||||
lolin_c3_mini.build.flash_freq=80m
|
||||
lolin_c3_mini.build.flash_mode=dio
|
||||
lolin_c3_mini.build.boot=qio
|
||||
lolin_c3_mini.build.partitions=default
|
||||
lolin_c3_mini.build.defines=
|
||||
|
||||
lolin_c3_mini.menu.CDCOnBoot.default=Enabled
|
||||
lolin_c3_mini.menu.CDCOnBoot.default.build.cdc_on_boot=1
|
||||
lolin_c3_mini.menu.CDCOnBoot.dis_cdc=Disabled
|
||||
lolin_c3_mini.menu.CDCOnBoot.dis_cdc.build.cdc_on_boot=0
|
||||
|
||||
lolin_c3_mini.menu.PartitionScheme.default=Default 4MB with spiffs (1.2MB APP/1.5MB SPIFFS)
|
||||
lolin_c3_mini.menu.PartitionScheme.default.build.partitions=default
|
||||
lolin_c3_mini.menu.PartitionScheme.defaultffat=Default 4MB with ffat (1.2MB APP/1.5MB FATFS)
|
||||
lolin_c3_mini.menu.PartitionScheme.defaultffat.build.partitions=default_ffat
|
||||
lolin_c3_mini.menu.PartitionScheme.no_ota=No OTA (2MB APP/2MB SPIFFS)
|
||||
lolin_c3_mini.menu.PartitionScheme.no_ota.build.partitions=no_ota
|
||||
lolin_c3_mini.menu.PartitionScheme.no_ota.upload.maximum_size=2097152
|
||||
lolin_c3_mini.menu.PartitionScheme.noota_3g=No OTA (1MB APP/3MB SPIFFS)
|
||||
lolin_c3_mini.menu.PartitionScheme.noota_3g.build.partitions=noota_3g
|
||||
lolin_c3_mini.menu.PartitionScheme.noota_3g.upload.maximum_size=1048576
|
||||
lolin_c3_mini.menu.PartitionScheme.noota_ffat=No OTA (2MB APP/2MB FATFS)
|
||||
lolin_c3_mini.menu.PartitionScheme.noota_ffat.build.partitions=noota_ffat
|
||||
lolin_c3_mini.menu.PartitionScheme.noota_ffat.upload.maximum_size=2097152
|
||||
lolin_c3_mini.menu.PartitionScheme.noota_3gffat=No OTA (1MB APP/3MB FATFS)
|
||||
lolin_c3_mini.menu.PartitionScheme.noota_3gffat.build.partitions=noota_3gffat
|
||||
lolin_c3_mini.menu.PartitionScheme.noota_3gffat.upload.maximum_size=1048576
|
||||
lolin_c3_mini.menu.PartitionScheme.huge_app=Huge APP (3MB No OTA/1MB SPIFFS)
|
||||
lolin_c3_mini.menu.PartitionScheme.huge_app.build.partitions=huge_app
|
||||
lolin_c3_mini.menu.PartitionScheme.huge_app.upload.maximum_size=3145728
|
||||
|
||||
|
||||
lolin_c3_mini.menu.CPUFreq.160=160MHz (WiFi)
|
||||
lolin_c3_mini.menu.CPUFreq.160.build.f_cpu=160000000L
|
||||
lolin_c3_mini.menu.CPUFreq.80=80MHz (WiFi)
|
||||
lolin_c3_mini.menu.CPUFreq.80.build.f_cpu=80000000L
|
||||
lolin_c3_mini.menu.CPUFreq.40=40MHz
|
||||
lolin_c3_mini.menu.CPUFreq.40.build.f_cpu=40000000L
|
||||
lolin_c3_mini.menu.CPUFreq.20=20MHz
|
||||
lolin_c3_mini.menu.CPUFreq.20.build.f_cpu=20000000L
|
||||
lolin_c3_mini.menu.CPUFreq.10=10MHz
|
||||
lolin_c3_mini.menu.CPUFreq.10.build.f_cpu=10000000L
|
||||
|
||||
|
||||
|
||||
lolin_c3_mini.menu.FlashFreq.80=80MHz
|
||||
lolin_c3_mini.menu.FlashFreq.80.build.flash_freq=80m
|
||||
lolin_c3_mini.menu.FlashFreq.40=40MHz
|
||||
lolin_c3_mini.menu.FlashFreq.40.build.flash_freq=40m
|
||||
|
||||
lolin_c3_mini.menu.UploadSpeed.921600=921600
|
||||
lolin_c3_mini.menu.UploadSpeed.921600.upload.speed=921600
|
||||
lolin_c3_mini.menu.UploadSpeed.115200=115200
|
||||
lolin_c3_mini.menu.UploadSpeed.115200.upload.speed=115200
|
||||
lolin_c3_mini.menu.UploadSpeed.256000.windows=256000
|
||||
lolin_c3_mini.menu.UploadSpeed.256000.upload.speed=256000
|
||||
lolin_c3_mini.menu.UploadSpeed.230400.windows.upload.speed=256000
|
||||
lolin_c3_mini.menu.UploadSpeed.230400=230400
|
||||
lolin_c3_mini.menu.UploadSpeed.230400.upload.speed=230400
|
||||
lolin_c3_mini.menu.UploadSpeed.460800.linux=460800
|
||||
lolin_c3_mini.menu.UploadSpeed.460800.macosx=460800
|
||||
lolin_c3_mini.menu.UploadSpeed.460800.upload.speed=460800
|
||||
lolin_c3_mini.menu.UploadSpeed.512000.windows=512000
|
||||
lolin_c3_mini.menu.UploadSpeed.512000.upload.speed=512000
|
||||
|
||||
lolin_c3_mini.menu.DebugLevel.none=None
|
||||
lolin_c3_mini.menu.DebugLevel.none.build.code_debug=0
|
||||
lolin_c3_mini.menu.DebugLevel.error=Error
|
||||
lolin_c3_mini.menu.DebugLevel.error.build.code_debug=1
|
||||
lolin_c3_mini.menu.DebugLevel.warn=Warn
|
||||
lolin_c3_mini.menu.DebugLevel.warn.build.code_debug=2
|
||||
lolin_c3_mini.menu.DebugLevel.info=Info
|
||||
lolin_c3_mini.menu.DebugLevel.info.build.code_debug=3
|
||||
lolin_c3_mini.menu.DebugLevel.debug=Debug
|
||||
lolin_c3_mini.menu.DebugLevel.debug.build.code_debug=4
|
||||
lolin_c3_mini.menu.DebugLevel.verbose=Verbose
|
||||
lolin_c3_mini.menu.DebugLevel.verbose.build.code_debug=5
|
||||
|
||||
##############################################################
|
||||
|
||||
lolin_s2_mini.name=LOLIN S2 Mini
|
||||
lolin_s2_mini.vid.0=0x303a
|
||||
lolin_s2_mini.pid.0=0x80C2
|
||||
|
||||
lolin_s2_mini.upload.tool=esptool_py
|
||||
lolin_s2_mini.upload.maximum_size=1310720
|
||||
lolin_s2_mini.upload.maximum_data_size=327680
|
||||
lolin_s2_mini.upload.flags=
|
||||
lolin_s2_mini.upload.extra_flags=
|
||||
lolin_s2_mini.upload.use_1200bps_touch=true
|
||||
lolin_s2_mini.upload.wait_for_upload_port=true
|
||||
lolin_s2_mini.upload.speed=921600
|
||||
|
||||
lolin_s2_mini.serial.disableDTR=false
|
||||
lolin_s2_mini.serial.disableRTS=false
|
||||
|
||||
lolin_s2_mini.build.tarch=xtensa
|
||||
lolin_s2_mini.build.bootloader_addr=0x1000
|
||||
lolin_s2_mini.build.target=esp32s2
|
||||
lolin_s2_mini.build.mcu=esp32s2
|
||||
lolin_s2_mini.build.core=esp32
|
||||
lolin_s2_mini.build.variant=lolin_s2_mini
|
||||
lolin_s2_mini.build.board=LOLIN_S2_MINI
|
||||
|
||||
lolin_s2_mini.build.cdc_on_boot=1
|
||||
lolin_s2_mini.build.msc_on_boot=1
|
||||
lolin_s2_mini.build.dfu_on_boot=1
|
||||
lolin_s2_mini.build.f_cpu=240000000L
|
||||
lolin_s2_mini.build.flash_size=4MB
|
||||
lolin_s2_mini.build.flash_freq=80m
|
||||
lolin_s2_mini.build.flash_mode=dio
|
||||
lolin_s2_mini.build.boot=qio
|
||||
lolin_s2_mini.build.partitions=default
|
||||
lolin_s2_mini.build.defines=
|
||||
|
||||
lolin_s2_mini.build.defines=-DBOARD_HAS_PSRAM
|
||||
|
||||
lolin_s2_mini.menu.CDCOnBoot.default=Enabled
|
||||
lolin_s2_mini.menu.CDCOnBoot.default.build.cdc_on_boot=1
|
||||
lolin_s2_mini.menu.CDCOnBoot.dis_cdc=Disabled
|
||||
lolin_s2_mini.menu.CDCOnBoot.dis_cdc.build.cdc_on_boot=0
|
||||
|
||||
lolin_s2_mini.menu.MSCOnBoot.default=Disabled
|
||||
lolin_s2_mini.menu.MSCOnBoot.default.build.msc_on_boot=0
|
||||
lolin_s2_mini.menu.MSCOnBoot.msc=Enabled
|
||||
lolin_s2_mini.menu.MSCOnBoot.msc.build.msc_on_boot=1
|
||||
|
||||
lolin_s2_mini.menu.DFUOnBoot.default=Disabled
|
||||
lolin_s2_mini.menu.DFUOnBoot.default.build.dfu_on_boot=0
|
||||
lolin_s2_mini.menu.DFUOnBoot.dfu=Enabled
|
||||
lolin_s2_mini.menu.DFUOnBoot.dfu.build.dfu_on_boot=1
|
||||
|
||||
lolin_s2_mini.menu.PartitionScheme.default=Default 4MB with spiffs (1.2MB APP/1.5MB SPIFFS)
|
||||
lolin_s2_mini.menu.PartitionScheme.default.build.partitions=default
|
||||
lolin_s2_mini.menu.PartitionScheme.defaultffat=Default 4MB with ffat (1.2MB APP/1.5MB FATFS)
|
||||
lolin_s2_mini.menu.PartitionScheme.defaultffat.build.partitions=default_ffat
|
||||
lolin_s2_mini.menu.PartitionScheme.no_ota=No OTA (2MB APP/2MB SPIFFS)
|
||||
lolin_s2_mini.menu.PartitionScheme.no_ota.build.partitions=no_ota
|
||||
lolin_s2_mini.menu.PartitionScheme.no_ota.upload.maximum_size=2097152
|
||||
lolin_s2_mini.menu.PartitionScheme.noota_3g=No OTA (1MB APP/3MB SPIFFS)
|
||||
lolin_s2_mini.menu.PartitionScheme.noota_3g.build.partitions=noota_3g
|
||||
lolin_s2_mini.menu.PartitionScheme.noota_3g.upload.maximum_size=1048576
|
||||
lolin_s2_mini.menu.PartitionScheme.noota_ffat=No OTA (2MB APP/2MB FATFS)
|
||||
lolin_s2_mini.menu.PartitionScheme.noota_ffat.build.partitions=noota_ffat
|
||||
lolin_s2_mini.menu.PartitionScheme.noota_ffat.upload.maximum_size=2097152
|
||||
lolin_s2_mini.menu.PartitionScheme.noota_3gffat=No OTA (1MB APP/3MB FATFS)
|
||||
lolin_s2_mini.menu.PartitionScheme.noota_3gffat.build.partitions=noota_3gffat
|
||||
lolin_s2_mini.menu.PartitionScheme.noota_3gffat.upload.maximum_size=1048576
|
||||
lolin_s2_mini.menu.PartitionScheme.huge_app=Huge APP (3MB No OTA/1MB SPIFFS)
|
||||
lolin_s2_mini.menu.PartitionScheme.huge_app.build.partitions=huge_app
|
||||
lolin_s2_mini.menu.PartitionScheme.huge_app.upload.maximum_size=3145728
|
||||
|
||||
lolin_s2_mini.menu.DebugLevel.none=None
|
||||
lolin_s2_mini.menu.DebugLevel.none.build.code_debug=0
|
||||
lolin_s2_mini.menu.DebugLevel.error=Error
|
||||
lolin_s2_mini.menu.DebugLevel.error.build.code_debug=1
|
||||
lolin_s2_mini.menu.DebugLevel.warn=Warn
|
||||
lolin_s2_mini.menu.DebugLevel.warn.build.code_debug=2
|
||||
lolin_s2_mini.menu.DebugLevel.info=Info
|
||||
lolin_s2_mini.menu.DebugLevel.info.build.code_debug=3
|
||||
lolin_s2_mini.menu.DebugLevel.debug=Debug
|
||||
lolin_s2_mini.menu.DebugLevel.debug.build.code_debug=4
|
||||
lolin_s2_mini.menu.DebugLevel.verbose=Verbose
|
||||
lolin_s2_mini.menu.DebugLevel.verbose.build.code_debug=5
|
||||
|
||||
##############################################################
|
||||
|
||||
lolin_s2_pico.name=LOLIN S2 PICO
|
||||
lolin_s2_pico.vid.0=0x303a
|
||||
lolin_s2_pico.pid.0=0x80C5
|
||||
|
||||
lolin_s2_pico.upload.tool=esptool_py
|
||||
lolin_s2_pico.upload.maximum_size=1310720
|
||||
lolin_s2_pico.upload.maximum_data_size=327680
|
||||
lolin_s2_pico.upload.flags=
|
||||
lolin_s2_pico.upload.extra_flags=
|
||||
lolin_s2_pico.upload.use_1200bps_touch=true
|
||||
lolin_s2_pico.upload.wait_for_upload_port=true
|
||||
lolin_s2_pico.upload.speed=921600
|
||||
|
||||
lolin_s2_pico.serial.disableDTR=false
|
||||
lolin_s2_pico.serial.disableRTS=false
|
||||
|
||||
lolin_s2_pico.build.tarch=xtensa
|
||||
lolin_s2_pico.build.bootloader_addr=0x1000
|
||||
lolin_s2_pico.build.target=esp32s2
|
||||
lolin_s2_pico.build.mcu=esp32s2
|
||||
lolin_s2_pico.build.core=esp32
|
||||
lolin_s2_pico.build.variant=lolin_s2_pico
|
||||
lolin_s2_pico.build.board=LOLIN_S2_PICO
|
||||
|
||||
lolin_s2_pico.build.cdc_on_boot=1
|
||||
lolin_s2_pico.build.msc_on_boot=1
|
||||
lolin_s2_pico.build.dfu_on_boot=1
|
||||
lolin_s2_pico.build.f_cpu=240000000L
|
||||
lolin_s2_pico.build.flash_size=4MB
|
||||
lolin_s2_pico.build.flash_freq=80m
|
||||
lolin_s2_pico.build.flash_mode=dio
|
||||
lolin_s2_pico.build.boot=qio
|
||||
lolin_s2_pico.build.partitions=default
|
||||
lolin_s2_pico.build.defines=
|
||||
|
||||
lolin_s2_pico.build.defines=-DBOARD_HAS_PSRAM
|
||||
|
||||
lolin_s2_pico.menu.CDCOnBoot.default=Enabled
|
||||
lolin_s2_pico.menu.CDCOnBoot.default.build.cdc_on_boot=1
|
||||
lolin_s2_pico.menu.CDCOnBoot.dis_cdc=Disabled
|
||||
lolin_s2_pico.menu.CDCOnBoot.dis_cdc.build.cdc_on_boot=0
|
||||
|
||||
lolin_s2_pico.menu.MSCOnBoot.default=Disabled
|
||||
lolin_s2_pico.menu.MSCOnBoot.default.build.msc_on_boot=0
|
||||
lolin_s2_pico.menu.MSCOnBoot.msc=Enabled
|
||||
lolin_s2_pico.menu.MSCOnBoot.msc.build.msc_on_boot=1
|
||||
|
||||
lolin_s2_pico.menu.DFUOnBoot.default=Disabled
|
||||
lolin_s2_pico.menu.DFUOnBoot.default.build.dfu_on_boot=0
|
||||
lolin_s2_pico.menu.DFUOnBoot.dfu=Enabled
|
||||
lolin_s2_pico.menu.DFUOnBoot.dfu.build.dfu_on_boot=1
|
||||
|
||||
lolin_s2_pico.menu.PartitionScheme.default=Default 4MB with spiffs (1.2MB APP/1.5MB SPIFFS)
|
||||
lolin_s2_pico.menu.PartitionScheme.default.build.partitions=default
|
||||
lolin_s2_pico.menu.PartitionScheme.defaultffat=Default 4MB with ffat (1.2MB APP/1.5MB FATFS)
|
||||
lolin_s2_pico.menu.PartitionScheme.defaultffat.build.partitions=default_ffat
|
||||
lolin_s2_pico.menu.PartitionScheme.no_ota=No OTA (2MB APP/2MB SPIFFS)
|
||||
lolin_s2_pico.menu.PartitionScheme.no_ota.build.partitions=no_ota
|
||||
lolin_s2_pico.menu.PartitionScheme.no_ota.upload.maximum_size=2097152
|
||||
lolin_s2_pico.menu.PartitionScheme.noota_3g=No OTA (1MB APP/3MB SPIFFS)
|
||||
lolin_s2_pico.menu.PartitionScheme.noota_3g.build.partitions=noota_3g
|
||||
lolin_s2_pico.menu.PartitionScheme.noota_3g.upload.maximum_size=1048576
|
||||
lolin_s2_pico.menu.PartitionScheme.noota_ffat=No OTA (2MB APP/2MB FATFS)
|
||||
lolin_s2_pico.menu.PartitionScheme.noota_ffat.build.partitions=noota_ffat
|
||||
lolin_s2_pico.menu.PartitionScheme.noota_ffat.upload.maximum_size=2097152
|
||||
lolin_s2_pico.menu.PartitionScheme.noota_3gffat=No OTA (1MB APP/3MB FATFS)
|
||||
lolin_s2_pico.menu.PartitionScheme.noota_3gffat.build.partitions=noota_3gffat
|
||||
lolin_s2_pico.menu.PartitionScheme.noota_3gffat.upload.maximum_size=1048576
|
||||
lolin_s2_pico.menu.PartitionScheme.huge_app=Huge APP (3MB No OTA/1MB SPIFFS)
|
||||
lolin_s2_pico.menu.PartitionScheme.huge_app.build.partitions=huge_app
|
||||
lolin_s2_pico.menu.PartitionScheme.huge_app.upload.maximum_size=3145728
|
||||
|
||||
lolin_s2_pico.menu.DebugLevel.none=None
|
||||
lolin_s2_pico.menu.DebugLevel.none.build.code_debug=0
|
||||
lolin_s2_pico.menu.DebugLevel.error=Error
|
||||
lolin_s2_pico.menu.DebugLevel.error.build.code_debug=1
|
||||
lolin_s2_pico.menu.DebugLevel.warn=Warn
|
||||
lolin_s2_pico.menu.DebugLevel.warn.build.code_debug=2
|
||||
lolin_s2_pico.menu.DebugLevel.info=Info
|
||||
lolin_s2_pico.menu.DebugLevel.info.build.code_debug=3
|
||||
lolin_s2_pico.menu.DebugLevel.debug=Debug
|
||||
lolin_s2_pico.menu.DebugLevel.debug.build.code_debug=4
|
||||
lolin_s2_pico.menu.DebugLevel.verbose=Verbose
|
||||
lolin_s2_pico.menu.DebugLevel.verbose.build.code_debug=5
|
||||
|
||||
##############################################################
|
||||
|
||||
lolin32.name=WEMOS LOLIN32
|
||||
|
||||
lolin32.upload.tool=esptool_py
|
||||
|
|
@ -6075,7 +6633,7 @@ adafruit_qtpy_esp32c3.menu.DebugLevel.verbose=Verbose
|
|||
adafruit_qtpy_esp32c3.menu.DebugLevel.verbose.build.code_debug=5
|
||||
|
||||
|
||||
adafruit_qtpy_esp32_pico.name=Adafruit QT Py ESP32 Pico
|
||||
adafruit_qtpy_esp32_pico.name=Adafruit QT Py ESP32
|
||||
|
||||
adafruit_qtpy_esp32_pico.upload.tool=esptool_py
|
||||
adafruit_qtpy_esp32_pico.upload.maximum_size=1310720
|
||||
|
|
@ -9227,6 +9785,31 @@ esp32cam.menu.FlashMode.dout=DOUT
|
|||
esp32cam.menu.FlashMode.dout.build.flash_mode=dout
|
||||
esp32cam.menu.FlashMode.dout.build.boot=dout
|
||||
|
||||
esp32cam.menu.PartitionScheme.huge_app=Huge APP (3MB No OTA/1MB SPIFFS)
|
||||
esp32cam.menu.PartitionScheme.huge_app.build.partitions=huge_app
|
||||
esp32cam.menu.PartitionScheme.huge_app.upload.maximum_size=3145728
|
||||
esp32cam.menu.PartitionScheme.min_spiffs=Minimal SPIFFS (1.9MB APP with OTA/190KB SPIFFS)
|
||||
esp32cam.menu.PartitionScheme.min_spiffs.build.partitions=min_spiffs
|
||||
esp32cam.menu.PartitionScheme.min_spiffs.upload.maximum_size=1966080
|
||||
esp32cam.menu.PartitionScheme.default=Regular 4MB with spiffs (1.2MB APP/1.5MB SPIFFS)
|
||||
esp32cam.menu.PartitionScheme.default.build.partitions=default
|
||||
esp32cam.menu.PartitionScheme.defaultffat=Regular 4MB with ffat (1.2MB APP/1.5MB FATFS)
|
||||
esp32cam.menu.PartitionScheme.defaultffat.build.partitions=default_ffat
|
||||
esp32cam.menu.PartitionScheme.minimal=Minimal (1.3MB APP/700KB SPIFFS)
|
||||
esp32cam.menu.PartitionScheme.minimal.build.partitions=minimal
|
||||
esp32cam.menu.PartitionScheme.no_ota=No OTA (2MB APP/2MB SPIFFS)
|
||||
esp32cam.menu.PartitionScheme.no_ota.build.partitions=no_ota
|
||||
esp32cam.menu.PartitionScheme.no_ota.upload.maximum_size=2097152
|
||||
esp32cam.menu.PartitionScheme.noota_3g=No OTA (1MB APP/3MB SPIFFS)
|
||||
esp32cam.menu.PartitionScheme.noota_3g.build.partitions=noota_3g
|
||||
esp32cam.menu.PartitionScheme.noota_3g.upload.maximum_size=1048576
|
||||
esp32cam.menu.PartitionScheme.noota_ffat=No OTA (2MB APP/2MB FATFS)
|
||||
esp32cam.menu.PartitionScheme.noota_ffat.build.partitions=noota_ffat
|
||||
esp32cam.menu.PartitionScheme.noota_ffat.upload.maximum_size=2097152
|
||||
esp32cam.menu.PartitionScheme.noota_3gffat=No OTA (1MB APP/3MB FATFS)
|
||||
esp32cam.menu.PartitionScheme.noota_3gffat.build.partitions=noota_3gffat
|
||||
esp32cam.menu.PartitionScheme.noota_3gffat.upload.maximum_size=1048576
|
||||
|
||||
esp32cam.menu.FlashFreq.80=80MHz
|
||||
esp32cam.menu.FlashFreq.80.build.flash_freq=80m
|
||||
esp32cam.menu.FlashFreq.40=40MHz
|
||||
|
|
@ -11179,6 +11762,11 @@ deneyapkart.menu.PartitionScheme.min_spiffs.build.partitions=min_spiffs
|
|||
deneyapkart.menu.PartitionScheme.min_spiffs.upload.maximum_size=1966080
|
||||
deneyapkart.menu.PartitionScheme.fatflash=16M Flash (2MB APP/12.5MB FAT)
|
||||
deneyapkart.menu.PartitionScheme.fatflash.build.partitions=ffat
|
||||
deneyapkart.menu.PartitionScheme.app3M_fat9M_16MB.build.partitions=app3M_fat9M_16MB
|
||||
deneyapkart.menu.PartitionScheme.app3M_fat9M_16MB.upload.maximum_size=3145728
|
||||
deneyapkart.menu.PartitionScheme.rainmaker=RainMaker
|
||||
deneyapkart.menu.PartitionScheme.rainmaker.build.partitions=rainmaker
|
||||
deneyapkart.menu.PartitionScheme.rainmaker.upload.maximum_size=3145728
|
||||
|
||||
deneyapkart.menu.CPUFreq.240=240MHz (WiFi/BT)
|
||||
deneyapkart.menu.CPUFreq.240.build.f_cpu=240000000L
|
||||
|
|
@ -12302,4 +12890,131 @@ watchy.menu.DebugLevel.debug.build.code_debug=4
|
|||
watchy.menu.DebugLevel.verbose=Verbose
|
||||
watchy.menu.DebugLevel.verbose.build.code_debug=5
|
||||
|
||||
##############################################################
|
||||
|
||||
deneyapkart1A.name=Deneyap Kart 1A
|
||||
|
||||
deneyapkart1A.upload.tool=esptool_py
|
||||
deneyapkart1A.upload.maximum_size=1310720
|
||||
deneyapkart1A.upload.maximum_data_size=327680
|
||||
deneyapkart1A.upload.wait_for_upload_port=true
|
||||
deneyapkart1A.upload.flags=
|
||||
deneyapkart1A.upload.extra_flags=
|
||||
|
||||
deneyapkart1A.serial.disableDTR=true
|
||||
deneyapkart1A.serial.disableRTS=true
|
||||
|
||||
deneyapkart1A.build.tarch=xtensa
|
||||
deneyapkart1A.build.bootloader_addr=0x1000
|
||||
deneyapkart1A.build.target=esp32
|
||||
deneyapkart1A.build.mcu=esp32
|
||||
deneyapkart1A.build.core=esp32
|
||||
deneyapkart1A.build.variant=deneyapkart1A
|
||||
deneyapkart1A.build.board=DYDK1A
|
||||
|
||||
deneyapkart1A.build.f_cpu=240000000L
|
||||
deneyapkart1A.build.flash_size=4MB
|
||||
deneyapkart1A.build.flash_freq=40m
|
||||
deneyapkart1A.build.flash_mode=dio
|
||||
deneyapkart1A.build.boot=dio
|
||||
deneyapkart1A.build.partitions=default
|
||||
deneyapkart1A.build.defines=-DBOARD_HAS_PSRAM -mfix-esp32-psram-cache-issue -mfix-esp32-psram-cache-strategy=memw
|
||||
deneyapkart1A.build.extra_libs=
|
||||
|
||||
deneyapkart1A.menu.PartitionScheme.default=Default 4MB with spiffs (1.2MB APP/1.5MB SPIFFS)
|
||||
deneyapkart1A.menu.PartitionScheme.default.build.partitions=default
|
||||
deneyapkart1A.menu.PartitionScheme.defaultffat=Default 4MB with ffat (1.2MB APP/1.5MB FATFS)
|
||||
deneyapkart1A.menu.PartitionScheme.defaultffat.build.partitions=default_ffat
|
||||
deneyapkart1A.menu.PartitionScheme.default_8MB=8M Flash (3MB APP/1.5MB FAT)
|
||||
deneyapkart1A.menu.PartitionScheme.default_8MB.build.partitions=default_8MB
|
||||
deneyapkart1A.menu.PartitionScheme.default_8MB.upload.maximum_size=3342336
|
||||
deneyapkart1A.menu.PartitionScheme.minimal=Minimal (1.3MB APP/700KB SPIFFS)
|
||||
deneyapkart1A.menu.PartitionScheme.minimal.build.partitions=minimal
|
||||
deneyapkart1A.menu.PartitionScheme.no_ota=No OTA (2MB APP/2MB SPIFFS)
|
||||
deneyapkart1A.menu.PartitionScheme.no_ota.build.partitions=no_ota
|
||||
deneyapkart1A.menu.PartitionScheme.no_ota.upload.maximum_size=2097152
|
||||
deneyapkart1A.menu.PartitionScheme.noota_3g=No OTA (1MB APP/3MB SPIFFS)
|
||||
deneyapkart1A.menu.PartitionScheme.noota_3g.build.partitions=noota_3g
|
||||
deneyapkart1A.menu.PartitionScheme.noota_3g.upload.maximum_size=1048576
|
||||
deneyapkart1A.menu.PartitionScheme.noota_ffat=No OTA (2MB APP/2MB FATFS)
|
||||
deneyapkart1A.menu.PartitionScheme.noota_ffat.build.partitions=noota_ffat
|
||||
deneyapkart1A.menu.PartitionScheme.noota_ffat.upload.maximum_size=2097152
|
||||
deneyapkart1A.menu.PartitionScheme.noota_3gffat=No OTA (1MB APP/3MB FATFS)
|
||||
deneyapkart1A.menu.PartitionScheme.noota_3gffat.build.partitions=noota_3gffat
|
||||
deneyapkart1A.menu.PartitionScheme.noota_3gffat.upload.maximum_size=1048576
|
||||
deneyapkart1A.menu.PartitionScheme.huge_app=Huge APP (3MB No OTA/1MB SPIFFS)
|
||||
deneyapkart1A.menu.PartitionScheme.huge_app.build.partitions=huge_app
|
||||
deneyapkart1A.menu.PartitionScheme.huge_app.upload.maximum_size=3145728
|
||||
deneyapkart1A.menu.PartitionScheme.min_spiffs=Minimal SPIFFS (1.9MB APP with OTA/190KB SPIFFS)
|
||||
deneyapkart1A.menu.PartitionScheme.min_spiffs.build.partitions=min_spiffs
|
||||
deneyapkart1A.menu.PartitionScheme.min_spiffs.upload.maximum_size=1966080
|
||||
deneyapkart1A.menu.PartitionScheme.fatflash=16M Flash (2MB APP/12.5MB FAT)
|
||||
deneyapkart1A.menu.PartitionScheme.fatflash.build.partitions=ffat
|
||||
deneyapkart1A.menu.PartitionScheme.fatflash.upload.maximum_size=2097152
|
||||
deneyapkart1A.menu.PartitionScheme.app3M_fat9M_16MB=16M Flash (3MB APP/9MB FATFS)
|
||||
deneyapkart1A.menu.PartitionScheme.app3M_fat9M_16MB.build.partitions=app3M_fat9M_16MB
|
||||
deneyapkart1A.menu.PartitionScheme.app3M_fat9M_16MB.upload.maximum_size=3145728
|
||||
deneyapkart1A.menu.PartitionScheme.rainmaker=RainMaker
|
||||
deneyapkart1A.menu.PartitionScheme.rainmaker.build.partitions=rainmaker
|
||||
deneyapkart1A.menu.PartitionScheme.rainmaker.upload.maximum_size=3145728
|
||||
|
||||
deneyapkart1A.menu.CPUFreq.240=240MHz (WiFi/BT)
|
||||
deneyapkart1A.menu.CPUFreq.240.build.f_cpu=240000000L
|
||||
deneyapkart1A.menu.CPUFreq.160=160MHz (WiFi/BT)
|
||||
deneyapkart1A.menu.CPUFreq.160.build.f_cpu=160000000L
|
||||
deneyapkart1A.menu.CPUFreq.80=80MHz (WiFi/BT)
|
||||
deneyapkart1A.menu.CPUFreq.80.build.f_cpu=80000000L
|
||||
deneyapkart1A.menu.CPUFreq.40=40MHz
|
||||
deneyapkart1A.menu.CPUFreq.40.build.f_cpu=40000000L
|
||||
deneyapkart1A.menu.CPUFreq.20=20MHz
|
||||
deneyapkart1A.menu.CPUFreq.20.build.f_cpu=20000000L
|
||||
deneyapkart1A.menu.CPUFreq.10=10MHz
|
||||
deneyapkart1A.menu.CPUFreq.10.build.f_cpu=10000000L
|
||||
|
||||
deneyapkart1A.menu.FlashMode.qio=QIO
|
||||
deneyapkart1A.menu.FlashMode.qio.build.flash_mode=dio
|
||||
deneyapkart1A.menu.FlashMode.qio.build.boot=qio
|
||||
deneyapkart1A.menu.FlashMode.dio=DIO
|
||||
deneyapkart1A.menu.FlashMode.dio.build.flash_mode=dio
|
||||
deneyapkart1A.menu.FlashMode.dio.build.boot=dio
|
||||
deneyapkart1A.menu.FlashMode.qout=QOUT
|
||||
deneyapkart1A.menu.FlashMode.qout.build.flash_mode=dout
|
||||
deneyapkart1A.menu.FlashMode.qout.build.boot=qout
|
||||
deneyapkart1A.menu.FlashMode.dout=DOUT
|
||||
deneyapkart1A.menu.FlashMode.dout.build.flash_mode=dout
|
||||
deneyapkart1A.menu.FlashMode.dout.build.boot=dout
|
||||
|
||||
deneyapkart1A.menu.FlashFreq.80=80MHz
|
||||
deneyapkart1A.menu.FlashFreq.80.build.flash_freq=80m
|
||||
deneyapkart1A.menu.FlashFreq.40=40MHz
|
||||
deneyapkart1A.menu.FlashFreq.40.build.flash_freq=40m
|
||||
|
||||
deneyapkart1A.menu.UploadSpeed.921600=921600
|
||||
deneyapkart1A.menu.UploadSpeed.921600.upload.speed=921600
|
||||
deneyapkart1A.menu.UploadSpeed.115200=115200
|
||||
deneyapkart1A.menu.UploadSpeed.115200.upload.speed=115200
|
||||
deneyapkart1A.menu.UploadSpeed.256000.windows=256000
|
||||
deneyapkart1A.menu.UploadSpeed.256000.upload.speed=256000
|
||||
deneyapkart1A.menu.UploadSpeed.230400.windows.upload.speed=256000
|
||||
deneyapkart1A.menu.UploadSpeed.230400=230400
|
||||
deneyapkart1A.menu.UploadSpeed.230400.upload.speed=230400
|
||||
deneyapkart1A.menu.UploadSpeed.460800.linux=460800
|
||||
deneyapkart1A.menu.UploadSpeed.460800.macosx=460800
|
||||
deneyapkart1A.menu.UploadSpeed.460800.upload.speed=460800
|
||||
deneyapkart1A.menu.UploadSpeed.512000.windows=512000
|
||||
deneyapkart1A.menu.UploadSpeed.512000.upload.speed=512000
|
||||
|
||||
deneyapkart1A.menu.DebugLevel.none=None
|
||||
deneyapkart1A.menu.DebugLevel.none.build.code_debug=0
|
||||
deneyapkart1A.menu.DebugLevel.error=Error
|
||||
deneyapkart1A.menu.DebugLevel.error.build.code_debug=1
|
||||
deneyapkart1A.menu.DebugLevel.warn=Warn
|
||||
deneyapkart1A.menu.DebugLevel.warn.build.code_debug=2
|
||||
deneyapkart1A.menu.DebugLevel.info=Info
|
||||
deneyapkart1A.menu.DebugLevel.info.build.code_debug=3
|
||||
deneyapkart1A.menu.DebugLevel.debug=Debug
|
||||
deneyapkart1A.menu.DebugLevel.debug.build.code_debug=4
|
||||
deneyapkart1A.menu.DebugLevel.verbose=Verbose
|
||||
deneyapkart1A.menu.DebugLevel.verbose.build.code_debug=5
|
||||
|
||||
##############################################################
|
||||
|
|
@ -195,6 +195,10 @@ extern "C" void configTime(long gmtOffset_sec, int daylightOffset_sec,
|
|||
extern "C" void configTzTime(const char* tz,
|
||||
const char* server1, const char* server2 = nullptr, const char* server3 = nullptr);
|
||||
|
||||
void setToneChannel(uint8_t channel = 0);
|
||||
void tone(uint8_t _pin, unsigned int frequency, unsigned long duration = 0);
|
||||
void noTone(uint8_t _pin);
|
||||
|
||||
// WMath prototypes
|
||||
long random(long);
|
||||
#endif /* __cplusplus */
|
||||
|
|
|
|||
|
|
@ -381,10 +381,12 @@ void HWCDC::setDebugOutput(bool en)
|
|||
}
|
||||
}
|
||||
|
||||
#if ARDUINO_USB_CDC_ON_BOOT && ARDUINO_USB_MODE //Serial used for USB CDC
|
||||
#if ARDUINO_USB_MODE
|
||||
#if ARDUINO_USB_CDC_ON_BOOT//Serial used for USB CDC
|
||||
HWCDC Serial;
|
||||
#else
|
||||
HWCDC USBSerial;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif /* CONFIG_TINYUSB_CDC_ENABLED */
|
||||
|
|
|
|||
|
|
@ -98,10 +98,12 @@ public:
|
|||
|
||||
};
|
||||
|
||||
#if ARDUINO_USB_CDC_ON_BOOT && ARDUINO_USB_MODE//Serial used for USB CDC
|
||||
#if ARDUINO_USB_MODE
|
||||
#if ARDUINO_USB_CDC_ON_BOOT//Serial used for USB CDC
|
||||
extern HWCDC Serial;
|
||||
#else
|
||||
extern HWCDC USBSerial;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif /* CONFIG_IDF_TARGET_ESP32C3 */
|
||||
|
|
|
|||
|
|
@ -6,6 +6,8 @@
|
|||
#include "pins_arduino.h"
|
||||
#include "HardwareSerial.h"
|
||||
#include "soc/soc_caps.h"
|
||||
#include "driver/uart.h"
|
||||
#include "freertos/queue.h"
|
||||
|
||||
#ifndef SOC_RX0
|
||||
#if CONFIG_IDF_TARGET_ESP32
|
||||
|
|
@ -110,8 +112,131 @@ void serialEventRun(void)
|
|||
}
|
||||
#endif
|
||||
|
||||
#if !CONFIG_DISABLE_HAL_LOCKS
|
||||
#define HSERIAL_MUTEX_LOCK() do {} while (xSemaphoreTake(_lock, portMAX_DELAY) != pdPASS)
|
||||
#define HSERIAL_MUTEX_UNLOCK() xSemaphoreGive(_lock)
|
||||
#else
|
||||
#define HSERIAL_MUTEX_LOCK()
|
||||
#define HSERIAL_MUTEX_UNLOCK()
|
||||
#endif
|
||||
|
||||
HardwareSerial::HardwareSerial(int uart_nr) : _uart_nr(uart_nr), _uart(NULL), _rxBufferSize(256) {}
|
||||
HardwareSerial::HardwareSerial(int uart_nr) :
|
||||
_uart_nr(uart_nr),
|
||||
_uart(NULL),
|
||||
_rxBufferSize(256),
|
||||
_onReceiveCB(NULL),
|
||||
_onReceiveErrorCB(NULL),
|
||||
_eventTask(NULL)
|
||||
#if !CONFIG_DISABLE_HAL_LOCKS
|
||||
,_lock(NULL)
|
||||
#endif
|
||||
{
|
||||
#if !CONFIG_DISABLE_HAL_LOCKS
|
||||
if(_lock == NULL){
|
||||
_lock = xSemaphoreCreateMutex();
|
||||
if(_lock == NULL){
|
||||
log_e("xSemaphoreCreateMutex failed");
|
||||
return;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
HardwareSerial::~HardwareSerial()
|
||||
{
|
||||
end();
|
||||
#if !CONFIG_DISABLE_HAL_LOCKS
|
||||
if(_lock != NULL){
|
||||
vSemaphoreDelete(_lock);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
void HardwareSerial::_createEventTask(void *args)
|
||||
{
|
||||
// Creating UART event Task
|
||||
xTaskCreate(_uartEventTask, "uart_event_task", 2048, this, configMAX_PRIORITIES - 1, &_eventTask);
|
||||
if (_eventTask == NULL) {
|
||||
log_e(" -- UART%d Event Task not Created!", _uart_nr);
|
||||
}
|
||||
}
|
||||
|
||||
void HardwareSerial::_destroyEventTask(void)
|
||||
{
|
||||
if (_eventTask != NULL) {
|
||||
vTaskDelete(_eventTask);
|
||||
_eventTask = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
void HardwareSerial::onReceiveError(OnReceiveErrorCb function)
|
||||
{
|
||||
HSERIAL_MUTEX_LOCK();
|
||||
// function may be NULL to cancel onReceive() from its respective task
|
||||
_onReceiveErrorCB = function;
|
||||
// this can be called after Serial.begin(), therefore it shall create the event task
|
||||
if (function != NULL && _uart != NULL && _eventTask == NULL) {
|
||||
_createEventTask(this);
|
||||
}
|
||||
HSERIAL_MUTEX_UNLOCK();
|
||||
}
|
||||
|
||||
void HardwareSerial::onReceive(OnReceiveCb function)
|
||||
{
|
||||
HSERIAL_MUTEX_LOCK();
|
||||
// function may be NULL to cancel onReceive() from its respective task
|
||||
_onReceiveCB = function;
|
||||
// this can be called after Serial.begin(), therefore it shall create the event task
|
||||
if (function != NULL && _uart != NULL && _eventTask == NULL) {
|
||||
_createEventTask(this);
|
||||
}
|
||||
HSERIAL_MUTEX_UNLOCK();
|
||||
}
|
||||
|
||||
void HardwareSerial::_uartEventTask(void *args)
|
||||
{
|
||||
HardwareSerial *uart = (HardwareSerial *)args;
|
||||
uart_event_t event;
|
||||
QueueHandle_t uartEventQueue = NULL;
|
||||
uartGetEventQueue(uart->_uart, &uartEventQueue);
|
||||
if (uartEventQueue != NULL) {
|
||||
for(;;) {
|
||||
//Waiting for UART event.
|
||||
if(xQueueReceive(uartEventQueue, (void * )&event, (portTickType)portMAX_DELAY)) {
|
||||
switch(event.type) {
|
||||
case UART_DATA:
|
||||
if(uart->_onReceiveCB && uart->available() > 0) uart->_onReceiveCB();
|
||||
break;
|
||||
case UART_FIFO_OVF:
|
||||
log_w("UART%d FIFO Overflow. Consider adding Hardware Flow Control to your Application.", uart->_uart_nr);
|
||||
if(uart->_onReceiveErrorCB) uart->_onReceiveErrorCB(UART_FIFO_OVF_ERROR);
|
||||
break;
|
||||
case UART_BUFFER_FULL:
|
||||
log_w("UART%d Buffer Full. Consider encreasing your buffer size of your Application.", uart->_uart_nr);
|
||||
if(uart->_onReceiveErrorCB) uart->_onReceiveErrorCB(UART_BUFFER_FULL_ERROR);
|
||||
break;
|
||||
case UART_BREAK:
|
||||
log_w("UART%d RX break.", uart->_uart_nr);
|
||||
if(uart->_onReceiveErrorCB) uart->_onReceiveErrorCB(UART_BREAK_ERROR);
|
||||
break;
|
||||
case UART_PARITY_ERR:
|
||||
log_w("UART%d parity error.", uart->_uart_nr);
|
||||
if(uart->_onReceiveErrorCB) uart->_onReceiveErrorCB(UART_PARITY_ERROR);
|
||||
break;
|
||||
case UART_FRAME_ERR:
|
||||
log_w("UART%d frame error.", uart->_uart_nr);
|
||||
if(uart->_onReceiveErrorCB) uart->_onReceiveErrorCB(UART_FRAME_ERROR);
|
||||
break;
|
||||
default:
|
||||
log_w("UART%d unknown event type %d.", uart->_uart_nr, event.type);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
vTaskDelete(NULL);
|
||||
}
|
||||
|
||||
void HardwareSerial::begin(unsigned long baud, uint32_t config, int8_t rxPin, int8_t txPin, bool invert, unsigned long timeout_ms, uint8_t rxfifo_full_thrhd)
|
||||
{
|
||||
|
|
@ -119,28 +244,53 @@ void HardwareSerial::begin(unsigned long baud, uint32_t config, int8_t rxPin, in
|
|||
log_e("Serial number is invalid, please use numers from 0 to %u", SOC_UART_NUM - 1);
|
||||
return;
|
||||
}
|
||||
|
||||
#if !CONFIG_DISABLE_HAL_LOCKS
|
||||
if(_lock == NULL){
|
||||
log_e("MUTEX Lock failed. Can't begin.");
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
HSERIAL_MUTEX_LOCK();
|
||||
// First Time or after end() --> set default Pins
|
||||
if (!uartIsDriverInstalled(_uart)) {
|
||||
switch (_uart_nr) {
|
||||
case UART_NUM_0:
|
||||
if (rxPin < 0 && txPin < 0) {
|
||||
rxPin = SOC_RX0;
|
||||
txPin = SOC_TX0;
|
||||
}
|
||||
break;
|
||||
#if SOC_UART_NUM > 1 // may save some flash bytes...
|
||||
case UART_NUM_1:
|
||||
if (rxPin < 0 && txPin < 0) {
|
||||
rxPin = RX1;
|
||||
txPin = TX1;
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
#if SOC_UART_NUM > 2 // may save some flash bytes...
|
||||
case UART_NUM_2:
|
||||
if (rxPin < 0 && txPin < 0) {
|
||||
rxPin = RX2;
|
||||
txPin = TX2;
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
log_e("Bad UART Number");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
if(_uart_nr == 0 && rxPin < 0 && txPin < 0) {
|
||||
rxPin = SOC_RX0;
|
||||
txPin = SOC_TX0;
|
||||
}
|
||||
#if SOC_UART_NUM > 1
|
||||
if(_uart_nr == 1 && rxPin < 0 && txPin < 0) {
|
||||
rxPin = RX1;
|
||||
txPin = TX1;
|
||||
}
|
||||
#endif
|
||||
#if SOC_UART_NUM > 2
|
||||
if(_uart_nr == 2 && rxPin < 0 && txPin < 0) {
|
||||
rxPin = RX2;
|
||||
txPin = TX2;
|
||||
}
|
||||
#endif
|
||||
|
||||
// IDF UART driver keeps Pin setting on restarting. Negative Pin number will keep it unmodified.
|
||||
_uart = uartBegin(_uart_nr, baud ? baud : 9600, config, rxPin, txPin, _rxBufferSize, invert, rxfifo_full_thrhd);
|
||||
if (!baud) {
|
||||
// using baud rate as zero, forces it to try to detect the current baud rate in place
|
||||
|
|
@ -161,11 +311,12 @@ void HardwareSerial::begin(unsigned long baud, uint32_t config, int8_t rxPin, in
|
|||
_uart = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void HardwareSerial::onReceive(void(*function)(void))
|
||||
{
|
||||
uartOnReceive(_uart, function);
|
||||
// create a task to deal with Serial Events when, for example, calling begin() twice to change the baudrate,
|
||||
// or when setting the callback before calling begin()
|
||||
if (_uart != NULL && (_onReceiveCB != NULL || _onReceiveErrorCB != NULL) && _eventTask == NULL) {
|
||||
_createEventTask(this);
|
||||
}
|
||||
HSERIAL_MUTEX_UNLOCK();
|
||||
}
|
||||
|
||||
void HardwareSerial::updateBaudRate(unsigned long baud)
|
||||
|
|
@ -173,14 +324,21 @@ void HardwareSerial::updateBaudRate(unsigned long baud)
|
|||
uartSetBaudRate(_uart, baud);
|
||||
}
|
||||
|
||||
void HardwareSerial::end(bool turnOffDebug)
|
||||
void HardwareSerial::end(bool fullyTerminate)
|
||||
{
|
||||
if(turnOffDebug && uartGetDebug() == _uart_nr) {
|
||||
uartSetDebug(0);
|
||||
// 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);
|
||||
}
|
||||
}
|
||||
delay(10);
|
||||
uartEnd(_uart);
|
||||
_uart = 0;
|
||||
_destroyEventTask();
|
||||
}
|
||||
|
||||
void HardwareSerial::setDebugOutput(bool en)
|
||||
|
|
@ -276,9 +434,16 @@ void HardwareSerial::setRxInvert(bool invert)
|
|||
uartSetRxInvert(_uart, invert);
|
||||
}
|
||||
|
||||
void HardwareSerial::setPins(uint8_t rxPin, uint8_t txPin)
|
||||
// negative Pin value will keep it unmodified
|
||||
void HardwareSerial::setPins(int8_t rxPin, int8_t txPin, int8_t ctsPin, int8_t rtsPin)
|
||||
{
|
||||
uartSetPins(_uart, rxPin, txPin);
|
||||
uartSetPins(_uart, rxPin, txPin, ctsPin, rtsPin);
|
||||
}
|
||||
|
||||
// Enables or disables Hardware Flow Control using RTS and/or CTS pins (must use setAllPins() before)
|
||||
void HardwareSerial::setHwFlowCtrlMode(uint8_t mode, uint8_t threshold)
|
||||
{
|
||||
uartSetHwFlowCtrlMode(_uart, mode, threshold);
|
||||
}
|
||||
|
||||
size_t HardwareSerial::setRxBufferSize(size_t new_size) {
|
||||
|
|
|
|||
|
|
@ -46,23 +46,40 @@
|
|||
#define HardwareSerial_h
|
||||
|
||||
#include <inttypes.h>
|
||||
|
||||
#include <functional>
|
||||
#include "Stream.h"
|
||||
#include "esp32-hal.h"
|
||||
#include "soc/soc_caps.h"
|
||||
#include "HWCDC.h"
|
||||
|
||||
#include "freertos/FreeRTOS.h"
|
||||
#include "freertos/task.h"
|
||||
#include "freertos/semphr.h"
|
||||
|
||||
typedef enum {
|
||||
UART_BREAK_ERROR,
|
||||
UART_BUFFER_FULL_ERROR,
|
||||
UART_FIFO_OVF_ERROR,
|
||||
UART_FRAME_ERROR,
|
||||
UART_PARITY_ERROR
|
||||
} hardwareSerial_error_t;
|
||||
|
||||
typedef std::function<void(void)> OnReceiveCb;
|
||||
typedef std::function<void(hardwareSerial_error_t)> OnReceiveErrorCb;
|
||||
|
||||
class HardwareSerial: public Stream
|
||||
{
|
||||
public:
|
||||
HardwareSerial(int uart_nr);
|
||||
~HardwareSerial();
|
||||
|
||||
// onReceive will setup a callback for whenever UART data is received
|
||||
// it will work as UART Rx interrupt
|
||||
void onReceive(void(*function)(void));
|
||||
|
||||
// it will work as UART Rx interrupt -- Using C++ 11 std::fuction
|
||||
void onReceive(OnReceiveCb function);
|
||||
void onReceiveError(OnReceiveErrorCb function);
|
||||
|
||||
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 turnOffDebug = true);
|
||||
void end(bool fullyTerminate = true);
|
||||
void updateBaudRate(unsigned long baud);
|
||||
int available(void);
|
||||
int availableForWrite(void);
|
||||
|
|
@ -107,13 +124,29 @@ public:
|
|||
void setDebugOutput(bool);
|
||||
|
||||
void setRxInvert(bool);
|
||||
void setPins(uint8_t rxPin, uint8_t txPin);
|
||||
|
||||
// Negative Pin Number will keep it unmodified, thus this function can set individual pins
|
||||
// SetPins shall be called after Serial begin()
|
||||
void setPins(int8_t rxPin, int8_t txPin, int8_t ctsPin = -1, int8_t rtsPin = -1);
|
||||
// Enables or disables Hardware Flow Control using RTS and/or CTS pins (must use setAllPins() before)
|
||||
void setHwFlowCtrlMode(uint8_t mode = HW_FLOWCTRL_CTS_RTS, uint8_t threshold = 64); // 64 is half FIFO Length
|
||||
|
||||
size_t setRxBufferSize(size_t new_size);
|
||||
|
||||
protected:
|
||||
int _uart_nr;
|
||||
uart_t* _uart;
|
||||
size_t _rxBufferSize;
|
||||
OnReceiveCb _onReceiveCB;
|
||||
OnReceiveErrorCb _onReceiveErrorCB;
|
||||
TaskHandle_t _eventTask;
|
||||
|
||||
void _createEventTask(void *args);
|
||||
void _destroyEventTask(void);
|
||||
static void _uartEventTask(void *args);
|
||||
#if !CONFIG_DISABLE_HAL_LOCKS
|
||||
SemaphoreHandle_t _lock;
|
||||
#endif
|
||||
};
|
||||
|
||||
extern void serialEventRun(void) __attribute__((weak));
|
||||
|
|
|
|||
131
cores/esp32/Tone.cpp
Normal file
131
cores/esp32/Tone.cpp
Normal file
|
|
@ -0,0 +1,131 @@
|
|||
#include <Arduino.h>
|
||||
#include "esp32-hal-ledc.h"
|
||||
#include "freertos/task.h"
|
||||
#include "freertos/queue.h"
|
||||
#include "freertos/semphr.h"
|
||||
|
||||
static TaskHandle_t _tone_task = NULL;
|
||||
static QueueHandle_t _tone_queue = NULL;
|
||||
static uint8_t _channel = 0;
|
||||
|
||||
typedef enum{
|
||||
TONE_START,
|
||||
TONE_END,
|
||||
TONE_SET_CHANNEL
|
||||
} tone_cmd_t;
|
||||
|
||||
typedef struct{
|
||||
tone_cmd_t tone_cmd;
|
||||
uint8_t pin;
|
||||
unsigned int frequency;
|
||||
unsigned long duration;
|
||||
uint8_t channel;
|
||||
} tone_msg_t;
|
||||
|
||||
static void tone_task(void*){
|
||||
tone_msg_t tone_msg;
|
||||
while(1){
|
||||
xQueueReceive(_tone_queue, &tone_msg, portMAX_DELAY);
|
||||
switch(tone_msg.tone_cmd){
|
||||
case TONE_START:
|
||||
log_d("Task received from queue TONE_START: _pin=%d, frequency=%u Hz, duration=%u ms", tone_msg.pin, tone_msg.frequency, tone_msg.duration);
|
||||
|
||||
log_d("Setup LED controll on channel %d", _channel);
|
||||
// ledcSetup(_channel, tone_msg.frequency, 11);
|
||||
// ledcAttachPin(tone_msg.pin, _channel);
|
||||
// ledcWrite(_channel, 1024);
|
||||
ledcWriteTone(_channel, tone_msg.frequency);
|
||||
ledcAttachPin(tone_msg.pin, _channel);
|
||||
|
||||
if(tone_msg.duration){
|
||||
delay(tone_msg.duration);
|
||||
ledcDetachPin(tone_msg.pin);
|
||||
ledcWriteTone(_channel, 0);
|
||||
}
|
||||
break;
|
||||
|
||||
case TONE_END:
|
||||
log_d("Task received from queue TONE_END: pin=%d", tone_msg.pin);
|
||||
ledcDetachPin(tone_msg.pin);
|
||||
ledcWriteTone(_channel, 0);
|
||||
break;
|
||||
|
||||
case TONE_SET_CHANNEL:
|
||||
log_d("Task received from queue TONE_SET_CHANNEL: channel=%d", tone_msg.channel);
|
||||
_channel = tone_msg.channel;
|
||||
break;
|
||||
|
||||
default: ; // do nothing
|
||||
} // switch
|
||||
} // infinite loop
|
||||
}
|
||||
|
||||
static int tone_init(){
|
||||
if(_tone_queue == NULL){
|
||||
log_v("Creating tone queue");
|
||||
_tone_queue = xQueueCreate(128, sizeof(tone_msg_t));
|
||||
if(_tone_queue == NULL){
|
||||
log_e("Could not create tone queue");
|
||||
return 0; // ERR
|
||||
}
|
||||
log_v("Tone queue created");
|
||||
}
|
||||
|
||||
if(_tone_task == NULL){
|
||||
log_v("Creating tone task");
|
||||
xTaskCreate(
|
||||
tone_task, // Function to implement the task
|
||||
"toneTask", // Name of the task
|
||||
3500, // Stack size in words
|
||||
NULL, // Task input parameter
|
||||
1, // Priority of the task
|
||||
&_tone_task // Task handle.
|
||||
);
|
||||
if(_tone_task == NULL){
|
||||
log_e("Could not create tone task");
|
||||
return 0; // ERR
|
||||
}
|
||||
log_v("Tone task created");
|
||||
}
|
||||
return 1; // OK
|
||||
}
|
||||
|
||||
void setToneChannel(uint8_t channel){
|
||||
log_d("channel=%d", channel);
|
||||
if(tone_init()){
|
||||
tone_msg_t tone_msg = {
|
||||
.tone_cmd = TONE_SET_CHANNEL,
|
||||
.channel = channel
|
||||
};
|
||||
xQueueSend(_tone_queue, &tone_msg, portMAX_DELAY);
|
||||
}
|
||||
}
|
||||
|
||||
void noTone(uint8_t _pin){
|
||||
log_d("noTone was called");
|
||||
if(tone_init()){
|
||||
tone_msg_t tone_msg = {
|
||||
.tone_cmd = TONE_END,
|
||||
.pin = _pin
|
||||
};
|
||||
xQueueSend(_tone_queue, &tone_msg, portMAX_DELAY);
|
||||
}
|
||||
}
|
||||
|
||||
// parameters:
|
||||
// _pin - pin number which will output the signal
|
||||
// frequency - PWM frequency in Hz
|
||||
// duration - time in ms - how long will the signal be outputted.
|
||||
// If not provided, or 0 you must manually call noTone to end output
|
||||
void tone(uint8_t _pin, unsigned int frequency, unsigned long duration){
|
||||
log_d("_pin=%d, frequency=%u Hz, duration=%u ms", _pin, frequency, duration);
|
||||
if(tone_init()){
|
||||
tone_msg_t tone_msg = {
|
||||
.tone_cmd = TONE_START,
|
||||
.pin = _pin,
|
||||
.frequency = frequency,
|
||||
.duration = duration
|
||||
};
|
||||
xQueueSend(_tone_queue, &tone_msg, portMAX_DELAY);
|
||||
}
|
||||
}
|
||||
|
|
@ -27,6 +27,7 @@
|
|||
#include "soc/rtc_io_reg.h"
|
||||
#include "esp32/rom/ets_sys.h"
|
||||
#include "esp_intr_alloc.h"
|
||||
#include "soc/dac_channel.h"
|
||||
#define DEFAULT_VREF 1100
|
||||
static esp_adc_cal_characteristics_t *__analogCharacteristics[2] = {NULL, NULL};
|
||||
static uint16_t __analogVRef = 0;
|
||||
|
|
@ -35,6 +36,7 @@ static uint8_t __analogVRefPin = 0;
|
|||
#include "esp32s2/rom/ets_sys.h"
|
||||
#include "soc/sens_reg.h"
|
||||
#include "soc/rtc_io_reg.h"
|
||||
#include "soc/dac_channel.h"
|
||||
#elif CONFIG_IDF_TARGET_ESP32S3
|
||||
#include "esp32s3/rom/ets_sys.h"
|
||||
#include "soc/sens_reg.h"
|
||||
|
|
@ -145,10 +147,10 @@ bool __adcAttachPin(uint8_t pin){
|
|||
}
|
||||
#endif
|
||||
}
|
||||
#if CONFIG_IDF_TARGET_ESP32 || CONFIG_IDF_TARGET_ESP32S2
|
||||
else if(pin == 25){
|
||||
#if SOC_DAC_SUPPORTED
|
||||
else if(pin == DAC_CHANNEL_1_GPIO_NUM){
|
||||
CLEAR_PERI_REG_MASK(RTC_IO_PAD_DAC1_REG, RTC_IO_PDAC1_XPD_DAC | RTC_IO_PDAC1_DAC_XPD_FORCE);//stop dac1
|
||||
} else if(pin == 26){
|
||||
} else if(pin == DAC_CHANNEL_2_GPIO_NUM){
|
||||
CLEAR_PERI_REG_MASK(RTC_IO_PAD_DAC2_REG, RTC_IO_PDAC2_XPD_DAC | RTC_IO_PDAC2_DAC_XPD_FORCE);//stop dac2
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -13,50 +13,14 @@
|
|||
// limitations under the License.
|
||||
|
||||
#include "esp32-hal-gpio.h"
|
||||
#include "pins_arduino.h"
|
||||
#include "freertos/FreeRTOS.h"
|
||||
#include "freertos/task.h"
|
||||
#include "esp_attr.h"
|
||||
#include "soc/gpio_reg.h"
|
||||
#include "soc/io_mux_reg.h"
|
||||
#include "soc/gpio_struct.h"
|
||||
#include "driver/gpio.h"
|
||||
#include "esp_system.h"
|
||||
|
||||
#ifdef ESP_IDF_VERSION_MAJOR // IDF 4+
|
||||
#if CONFIG_IDF_TARGET_ESP32 // ESP32/PICO-D4
|
||||
#include "esp32/rom/ets_sys.h"
|
||||
#include "esp32/rom/gpio.h"
|
||||
#include "esp_intr_alloc.h"
|
||||
#include "soc/rtc_io_reg.h"
|
||||
#define GPIO_FUNC 2
|
||||
#elif CONFIG_IDF_TARGET_ESP32S2
|
||||
#include "esp32s2/rom/ets_sys.h"
|
||||
#include "esp32s2/rom/gpio.h"
|
||||
#include "esp_intr_alloc.h"
|
||||
#include "soc/periph_defs.h"
|
||||
#include "soc/rtc_io_reg.h"
|
||||
#define GPIO_FUNC 1
|
||||
#elif CONFIG_IDF_TARGET_ESP32C3
|
||||
#include "esp32c3/rom/ets_sys.h"
|
||||
#include "esp32c3/rom/gpio.h"
|
||||
#include "esp_intr_alloc.h"
|
||||
#include "soc/periph_defs.h"
|
||||
#define USE_ESP_IDF_GPIO 1
|
||||
#else
|
||||
#define USE_ESP_IDF_GPIO 1
|
||||
#endif
|
||||
#else // ESP32 Before IDF 4.0
|
||||
#include "rom/ets_sys.h"
|
||||
#include "rom/gpio.h"
|
||||
#include "esp_intr.h"
|
||||
#endif
|
||||
|
||||
#include "hal/gpio_hal.h"
|
||||
#include "soc/soc_caps.h"
|
||||
|
||||
// It fixes lack of pin definition for S3 and for any future SoC
|
||||
// this function works for ESP32, ESP32-S2 and ESP32-S3 - including the C3, it will return -1 for any pin
|
||||
#if SOC_TOUCH_SENSOR_NUM > 0
|
||||
#include "soc/touch_sensor_periph.h"
|
||||
|
||||
int8_t digitalPinToTouchChannel(uint8_t pin)
|
||||
{
|
||||
int8_t ret = -1;
|
||||
|
|
@ -78,128 +42,41 @@ int8_t digitalPinToTouchChannel(uint8_t pin)
|
|||
}
|
||||
#endif
|
||||
|
||||
#if CONFIG_IDF_TARGET_ESP32
|
||||
const int8_t esp32_adc2gpio[20] = {36, 37, 38, 39, 32, 33, 34, 35, -1, -1, 4, 0, 2, 15, 13, 12, 14, 27, 25, 26};
|
||||
#elif CONFIG_IDF_TARGET_ESP32S2
|
||||
const int8_t esp32_adc2gpio[20] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20};
|
||||
#endif
|
||||
#ifdef SOC_ADC_SUPPORTED
|
||||
#include "soc/adc_periph.h"
|
||||
|
||||
const DRAM_ATTR esp32_gpioMux_t esp32_gpioMux[SOC_GPIO_PIN_COUNT]={
|
||||
#if CONFIG_IDF_TARGET_ESP32
|
||||
{0x44, 11, 11, 1},
|
||||
{0x88, -1, -1, -1},
|
||||
{0x40, 12, 12, 2},
|
||||
{0x84, -1, -1, -1},
|
||||
{0x48, 10, 10, 0},
|
||||
{0x6c, -1, -1, -1},
|
||||
{0x60, -1, -1, -1},
|
||||
{0x64, -1, -1, -1},
|
||||
{0x68, -1, -1, -1},
|
||||
{0x54, -1, -1, -1},
|
||||
{0x58, -1, -1, -1},
|
||||
{0x5c, -1, -1, -1},
|
||||
{0x34, 15, 15, 5},
|
||||
{0x38, 14, 14, 4},
|
||||
{0x30, 16, 16, 6},
|
||||
{0x3c, 13, 13, 3},
|
||||
{0x4c, -1, -1, -1},
|
||||
{0x50, -1, -1, -1},
|
||||
{0x70, -1, -1, -1},
|
||||
{0x74, -1, -1, -1},
|
||||
{0x78, -1, -1, -1},
|
||||
{0x7c, -1, -1, -1},
|
||||
{0x80, -1, -1, -1},
|
||||
{0x8c, -1, -1, -1},
|
||||
{0, -1, -1, -1},
|
||||
{0x24, 6, 18, -1}, //DAC1
|
||||
{0x28, 7, 19, -1}, //DAC2
|
||||
{0x2c, 17, 17, 7},
|
||||
{0, -1, -1, -1},
|
||||
{0, -1, -1, -1},
|
||||
{0, -1, -1, -1},
|
||||
{0, -1, -1, -1},
|
||||
{0x1c, 9, 4, 8},
|
||||
{0x20, 8, 5, 9},
|
||||
{0x14, 4, 6, -1},
|
||||
{0x18, 5, 7, -1},
|
||||
{0x04, 0, 0, -1},
|
||||
{0x08, 1, 1, -1},
|
||||
{0x0c, 2, 2, -1},
|
||||
{0x10, 3, 3, -1}
|
||||
#elif CONFIG_IDF_TARGET_ESP32S2
|
||||
{0x04, 0, -1, -1},
|
||||
{0x08, 1, 0, 1},
|
||||
{0x0c, 2, 1, 2},
|
||||
{0x10, 3, 2, 3},
|
||||
{0x14, 4, 3, 4},
|
||||
{0x18, 5, 4, 5},
|
||||
{0x1c, 6, 5, 6},
|
||||
{0x20, 7, 6, 7},
|
||||
{0x24, 8, 7, 8},
|
||||
{0x28, 9, 8, 9},//FSPI_HD
|
||||
{0x2c, 10, 9, 10},//FSPI_CS0 / FSPI_D4
|
||||
{0x30, 11, 10, 11},//FSPI_D / FSPI_D5
|
||||
{0x34, 12, 11, 12},//FSPI_CLK / FSPI_D6
|
||||
{0x38, 13, 12, 13},//FSPI_Q / FSPI_D7
|
||||
{0x3c, 14, 13, 14},//FSPI_WP / FSPI_DQS
|
||||
{0x40, 15, 14, -1},//32K+ / RTS0
|
||||
{0x44, 16, 15, -1},//32K- / CTS0
|
||||
{0x48, 17, 16, -1},//DAC1 / TXD1
|
||||
{0x4c, 18, 17, -1},//DAC2 / RXD1
|
||||
{0x50, 19, 18, -1},//USB D- / RTS1
|
||||
{0x54, 20, 19, -1},//USB D+ / CTS1
|
||||
{0x58, 21, -1, -1},//SDA?
|
||||
{ 0, -1, -1, -1},//UNAVAILABLE
|
||||
{ 0, -1, -1, -1},//UNAVAILABLE
|
||||
{ 0, -1, -1, -1},//UNAVAILABLE
|
||||
{ 0, -1, -1, -1},//UNAVAILABLE
|
||||
{0x6c, -1, -1, -1},//RESERVED SPI_CS1
|
||||
{0x70, -1, -1, -1},//RESERVED SPI_HD
|
||||
{0x74, -1, -1, -1},//RESERVED SPI_WP
|
||||
{0x78, -1, -1, -1},//RESERVED SPI_CS0
|
||||
{0x7c, -1, -1, -1},//RESERVED SPI_CLK
|
||||
{0x80, -1, -1, -1},//RESERVED SPI_Q
|
||||
{0x84, -1, -1, -1},//RESERVED SPI_D
|
||||
{0x88, -1, -1, -1},//FSPI_HD
|
||||
{0x8c, -1, -1, -1},//FSPI_CS0
|
||||
{0x90, -1, -1, -1},//FSPI_D
|
||||
{0x94, -1, -1, -1},//FSPI_CLK
|
||||
{0x98, -1, -1, -1},//FSPI_Q
|
||||
{0x9c, -1, -1, -1},//FSPI_WP
|
||||
{0xa0, -1, -1, -1},//MTCK
|
||||
{0xa4, -1, -1, -1},//MTDO
|
||||
{0xa8, -1, -1, -1},//MTDI
|
||||
{0xac, -1, -1, -1},//MTMS
|
||||
{0xb0, -1, -1, -1},//TXD0
|
||||
{0xb4, -1, -1, -1},//RXD0
|
||||
{0xb8, -1, -1, -1},//SCL?
|
||||
{0xbc, -1, -1, -1},//INPUT ONLY
|
||||
{0, -1, -1, -1}
|
||||
#elif CONFIG_IDF_TARGET_ESP32C3
|
||||
{0x04, -1, 0, -1}, // ADC1_CH0
|
||||
{0x08, -1, 1, -1}, // ADC1_CH1
|
||||
{0x0c, -1, 2, -1}, // ADC1_CH2 | FSPIQ
|
||||
{0x10, -1, 3, -1}, // ADC1_CH3
|
||||
{0x14, -1, 4, -1}, // MTMS | ADC1_CH4 | FSPIHD
|
||||
{0x18, -1, 5, -1}, // MTDI | ADC2_CH0 | FSPIWP
|
||||
{0x1c, -1, -1, -1}, // MTCK | FSPICLK
|
||||
{0x20, -1, -1, -1}, // MTDO | FSPID
|
||||
{0x24, -1, -1, -1}, //
|
||||
{0x28, -1, -1, -1}, //
|
||||
{0x2c, -1, -1, -1}, // FSPICSO
|
||||
{0x30, -1, -1, -1}, //
|
||||
{0x34, -1, -1, -1}, // SPIHD
|
||||
{0x38, -1, -1, -1}, // SPIWP
|
||||
{0x3c, -1, -1, -1}, // SPICSO
|
||||
{0x40, -1, -1, -1}, // SPICLK
|
||||
{0x44, -1, -1, -1}, // SPID
|
||||
{0x48, -1, -1, -1}, // SPIQ
|
||||
{0x4c, -1, -1, -1}, // USB-
|
||||
{0x50, -1, -1, -1}, // USB+
|
||||
{0x54, -1, -1, -1}, // U0RXD
|
||||
{0x58, -1, -1, -1}, // U0TXD
|
||||
int8_t digitalPinToAnalogChannel(uint8_t pin)
|
||||
{
|
||||
uint8_t channel = 0;
|
||||
if (pin < SOC_GPIO_PIN_COUNT) {
|
||||
for (uint8_t i = 0; i < SOC_ADC_PERIPH_NUM; i++) {
|
||||
for (uint8_t j = 0; j < SOC_ADC_MAX_CHANNEL_NUM; j++) {
|
||||
if (adc_channel_io_map[i][j] == pin) {
|
||||
return channel;
|
||||
}
|
||||
channel++;
|
||||
}
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
int8_t analogChannelToDigitalPin(uint8_t channel)
|
||||
{
|
||||
if (channel >= (SOC_ADC_PERIPH_NUM * SOC_ADC_MAX_CHANNEL_NUM)) {
|
||||
return -1;
|
||||
}
|
||||
uint8_t adc_unit = (channel / SOC_ADC_MAX_CHANNEL_NUM);
|
||||
uint8_t adc_chan = (channel % SOC_ADC_MAX_CHANNEL_NUM);
|
||||
return adc_channel_io_map[adc_unit][adc_chan];
|
||||
}
|
||||
#else
|
||||
// No Analog channels availible
|
||||
int8_t analogChannelToDigitalPin(uint8_t channel)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
#endif
|
||||
};
|
||||
|
||||
typedef void (*voidFuncPtr)(void);
|
||||
typedef void (*voidFuncPtrArg)(void*);
|
||||
|
|
@ -214,8 +91,8 @@ static InterruptHandle_t __pinInterruptHandlers[SOC_GPIO_PIN_COUNT] = {0,};
|
|||
|
||||
extern void ARDUINO_ISR_ATTR __pinMode(uint8_t pin, uint8_t mode)
|
||||
{
|
||||
#if USE_ESP_IDF_GPIO
|
||||
if (!GPIO_IS_VALID_GPIO(pin)) {
|
||||
log_e("Invalid pin selected");
|
||||
return;
|
||||
}
|
||||
gpio_config_t conf = {
|
||||
|
|
@ -237,157 +114,23 @@ extern void ARDUINO_ISR_ATTR __pinMode(uint8_t pin, uint8_t mode)
|
|||
conf.pull_down_en = GPIO_PULLDOWN_ENABLE;
|
||||
}
|
||||
}
|
||||
gpio_config(&conf);
|
||||
|
||||
if(mode == SPECIAL){
|
||||
#if CONFIG_IDF_TARGET_ESP32
|
||||
PIN_FUNC_SELECT(GPIO_PIN_MUX_REG[pin], (uint32_t)(((pin)==RX||(pin)==TX)?0:1));
|
||||
#elif CONFIG_IDF_TARGET_ESP32S2
|
||||
PIN_FUNC_SELECT(GPIO_PIN_MUX_REG[pin], (uint32_t)(((pin)==RX||(pin)==TX)?0:2));
|
||||
#endif
|
||||
} else if(mode == ANALOG){
|
||||
#if !CONFIG_IDF_TARGET_ESP32C3
|
||||
//adc_gpio_init(ADC_UNIT_1, ADC_CHANNEL_0);
|
||||
#endif
|
||||
} else if(mode >= 0x20 && mode < ANALOG) {//function
|
||||
PIN_FUNC_SELECT(GPIO_PIN_MUX_REG[pin], mode >> 5);
|
||||
}
|
||||
#else
|
||||
if(!digitalPinIsValid(pin)) {
|
||||
if(gpio_config(&conf) != ESP_OK)
|
||||
{
|
||||
log_e("GPIO config failed");
|
||||
return;
|
||||
}
|
||||
|
||||
int8_t rtc_io = esp32_gpioMux[pin].rtc;
|
||||
uint32_t rtc_reg = (rtc_io != -1)?rtc_io_desc[rtc_io].reg:0;
|
||||
if(mode == ANALOG) {
|
||||
if(!rtc_reg) {
|
||||
return;//not rtc pin
|
||||
}
|
||||
#if CONFIG_IDF_TARGET_ESP32S2
|
||||
SENS.sar_io_mux_conf.iomux_clk_gate_en = 1;
|
||||
#endif
|
||||
SET_PERI_REG_MASK(rtc_io_desc[rtc_io].reg, (rtc_io_desc[rtc_io].mux));
|
||||
SET_PERI_REG_BITS(rtc_io_desc[rtc_io].reg, RTC_IO_TOUCH_PAD1_FUN_SEL_V, 0, rtc_io_desc[rtc_io].func);
|
||||
|
||||
RTCIO.pin[rtc_io].pad_driver = 0;//OD = 1
|
||||
RTCIO.enable_w1tc.w1tc = (1U << rtc_io);
|
||||
CLEAR_PERI_REG_MASK(rtc_io_desc[rtc_io].reg, rtc_io_desc[rtc_io].ie);
|
||||
|
||||
if (rtc_io_desc[rtc_io].pullup) {
|
||||
CLEAR_PERI_REG_MASK(rtc_io_desc[rtc_io].reg, rtc_io_desc[rtc_io].pullup);
|
||||
}
|
||||
if (rtc_io_desc[rtc_io].pulldown) {
|
||||
CLEAR_PERI_REG_MASK(rtc_io_desc[rtc_io].reg, rtc_io_desc[rtc_io].pulldown);
|
||||
}
|
||||
ESP_REG(DR_REG_IO_MUX_BASE + esp32_gpioMux[pin].reg) = ((uint32_t)GPIO_FUNC << MCU_SEL_S) | ((uint32_t)2 << FUN_DRV_S) | FUN_IE;
|
||||
return;
|
||||
}
|
||||
|
||||
//RTC pins PULL settings
|
||||
if(rtc_reg) {
|
||||
ESP_REG(rtc_reg) = ESP_REG(rtc_reg) & ~(rtc_io_desc[rtc_io].mux);
|
||||
if(mode & PULLUP) {
|
||||
ESP_REG(rtc_reg) = (ESP_REG(rtc_reg) | rtc_io_desc[rtc_io].pullup) & ~(rtc_io_desc[rtc_io].pulldown);
|
||||
} else if(mode & PULLDOWN) {
|
||||
ESP_REG(rtc_reg) = (ESP_REG(rtc_reg) | rtc_io_desc[rtc_io].pulldown) & ~(rtc_io_desc[rtc_io].pullup);
|
||||
} else {
|
||||
ESP_REG(rtc_reg) = ESP_REG(rtc_reg) & ~(rtc_io_desc[rtc_io].pullup | rtc_io_desc[rtc_io].pulldown);
|
||||
}
|
||||
}
|
||||
|
||||
uint32_t pinFunction = 0, pinControl = 0;
|
||||
|
||||
if(mode & INPUT) {
|
||||
if(pin < 32) {
|
||||
GPIO.enable_w1tc = ((uint32_t)1 << pin);
|
||||
} else {
|
||||
GPIO.enable1_w1tc.val = ((uint32_t)1 << (pin - 32));
|
||||
}
|
||||
} else if(mode & OUTPUT) {
|
||||
if(pin >= NUM_OUPUT_PINS){
|
||||
return;
|
||||
} else if(pin < 32) {
|
||||
GPIO.enable_w1ts = ((uint32_t)1 << pin);
|
||||
} else {
|
||||
GPIO.enable1_w1ts.val = ((uint32_t)1 << (pin - 32));
|
||||
}
|
||||
}
|
||||
|
||||
if(mode & PULLUP) {
|
||||
pinFunction |= FUN_PU;
|
||||
} else if(mode & PULLDOWN) {
|
||||
pinFunction |= FUN_PD;
|
||||
}
|
||||
|
||||
pinFunction |= ((uint32_t)2 << FUN_DRV_S);//what are the drivers?
|
||||
pinFunction |= FUN_IE;//input enable but required for output as well?
|
||||
|
||||
if(mode & (INPUT | OUTPUT)) {
|
||||
pinFunction |= ((uint32_t)PIN_FUNC_GPIO << MCU_SEL_S);
|
||||
} else if(mode == SPECIAL) {
|
||||
#if CONFIG_IDF_TARGET_ESP32
|
||||
pinFunction |= ((uint32_t)(((pin)==RX||(pin)==TX)?0:1) << MCU_SEL_S);
|
||||
#elif CONFIG_IDF_TARGET_ESP32S2
|
||||
pinFunction |= ((uint32_t)(((pin)==RX||(pin)==TX)?0:2) << MCU_SEL_S);
|
||||
#endif
|
||||
} else {
|
||||
pinFunction |= ((uint32_t)(mode >> 5) << MCU_SEL_S);
|
||||
}
|
||||
|
||||
ESP_REG(DR_REG_IO_MUX_BASE + esp32_gpioMux[pin].reg) = pinFunction;
|
||||
|
||||
if(mode & OPEN_DRAIN) {
|
||||
pinControl = (1 << GPIO_PIN0_PAD_DRIVER_S);
|
||||
}
|
||||
|
||||
GPIO.pin[pin].val = pinControl;
|
||||
#endif
|
||||
}
|
||||
|
||||
extern void ARDUINO_ISR_ATTR __digitalWrite(uint8_t pin, uint8_t val)
|
||||
{
|
||||
#if USE_ESP_IDF_GPIO
|
||||
gpio_set_level((gpio_num_t)pin, val);
|
||||
#elif CONFIG_IDF_TARGET_ESP32C3
|
||||
if (val) {
|
||||
GPIO.out_w1ts.out_w1ts = (1 << pin);
|
||||
} else {
|
||||
GPIO.out_w1tc.out_w1tc = (1 << pin);
|
||||
}
|
||||
#else
|
||||
if(val) {
|
||||
if(pin < 32) {
|
||||
GPIO.out_w1ts = ((uint32_t)1 << pin);
|
||||
} else if(pin < NUM_OUPUT_PINS) {
|
||||
GPIO.out1_w1ts.val = ((uint32_t)1 << (pin - 32));
|
||||
}
|
||||
} else {
|
||||
if(pin < 32) {
|
||||
GPIO.out_w1tc = ((uint32_t)1 << pin);
|
||||
} else if(pin < NUM_OUPUT_PINS) {
|
||||
GPIO.out1_w1tc.val = ((uint32_t)1 << (pin - 32));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
extern int ARDUINO_ISR_ATTR __digitalRead(uint8_t pin)
|
||||
{
|
||||
#if USE_ESP_IDF_GPIO
|
||||
return gpio_get_level((gpio_num_t)pin);
|
||||
#elif CONFIG_IDF_TARGET_ESP32C3
|
||||
return (GPIO.in.data >> pin) & 0x1;
|
||||
#else
|
||||
if(pin < 32) {
|
||||
return (GPIO.in >> pin) & 0x1;
|
||||
} else if(pin < GPIO_PIN_COUNT) {
|
||||
return (GPIO.in1.val >> (pin - 32)) & 0x1;
|
||||
}
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
#if USE_ESP_IDF_GPIO
|
||||
static void ARDUINO_ISR_ATTR __onPinInterrupt(void * arg) {
|
||||
InterruptHandle_t * isr = (InterruptHandle_t*)arg;
|
||||
if(isr->fn) {
|
||||
|
|
@ -398,49 +141,6 @@ static void ARDUINO_ISR_ATTR __onPinInterrupt(void * arg) {
|
|||
}
|
||||
}
|
||||
}
|
||||
#else
|
||||
static intr_handle_t gpio_intr_handle = NULL;
|
||||
|
||||
static void ARDUINO_ISR_ATTR __onPinInterrupt()
|
||||
{
|
||||
uint32_t gpio_intr_status_l=0;
|
||||
uint32_t gpio_intr_status_h=0;
|
||||
|
||||
gpio_intr_status_l = GPIO.status;
|
||||
gpio_intr_status_h = GPIO.status1.val;
|
||||
GPIO.status_w1tc = gpio_intr_status_l;//Clear intr for gpio0-gpio31
|
||||
GPIO.status1_w1tc.val = gpio_intr_status_h;//Clear intr for gpio32-39
|
||||
|
||||
uint8_t pin=0;
|
||||
if(gpio_intr_status_l) {
|
||||
do {
|
||||
if(gpio_intr_status_l & ((uint32_t)1 << pin)) {
|
||||
if(__pinInterruptHandlers[pin].fn) {
|
||||
if(__pinInterruptHandlers[pin].arg){
|
||||
((voidFuncPtrArg)__pinInterruptHandlers[pin].fn)(__pinInterruptHandlers[pin].arg);
|
||||
} else {
|
||||
__pinInterruptHandlers[pin].fn();
|
||||
}
|
||||
}
|
||||
}
|
||||
} while(++pin<32);
|
||||
}
|
||||
if(gpio_intr_status_h) {
|
||||
pin=32;
|
||||
do {
|
||||
if(gpio_intr_status_h & ((uint32_t)1 << (pin - 32))) {
|
||||
if(__pinInterruptHandlers[pin].fn) {
|
||||
if(__pinInterruptHandlers[pin].arg){
|
||||
((voidFuncPtrArg)__pinInterruptHandlers[pin].fn)(__pinInterruptHandlers[pin].arg);
|
||||
} else {
|
||||
__pinInterruptHandlers[pin].fn();
|
||||
}
|
||||
}
|
||||
}
|
||||
} while(++pin<GPIO_PIN_COUNT);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
extern void cleanupFunctional(void* arg);
|
||||
|
||||
|
|
@ -449,13 +149,8 @@ extern void __attachInterruptFunctionalArg(uint8_t pin, voidFuncPtrArg userFunc,
|
|||
static bool interrupt_initialized = false;
|
||||
|
||||
if(!interrupt_initialized) {
|
||||
#if USE_ESP_IDF_GPIO
|
||||
esp_err_t err = gpio_install_isr_service((int)ARDUINO_ISR_FLAG);
|
||||
interrupt_initialized = (err == ESP_OK) || (err == ESP_ERR_INVALID_STATE);
|
||||
#else
|
||||
interrupt_initialized = true;
|
||||
esp_intr_alloc(ETS_GPIO_INTR_SOURCE, (int)ARDUINO_ISR_FLAG, __onPinInterrupt, NULL, &gpio_intr_handle);
|
||||
#endif
|
||||
}
|
||||
if(!interrupt_initialized) {
|
||||
log_e("GPIO ISR Service Failed To Start");
|
||||
|
|
@ -471,27 +166,18 @@ extern void __attachInterruptFunctionalArg(uint8_t pin, voidFuncPtrArg userFunc,
|
|||
__pinInterruptHandlers[pin].arg = arg;
|
||||
__pinInterruptHandlers[pin].functional = functional;
|
||||
|
||||
#if USE_ESP_IDF_GPIO
|
||||
gpio_set_intr_type((gpio_num_t)pin, (gpio_int_type_t)(intr_type & 0x7));
|
||||
if(intr_type & 0x8){
|
||||
gpio_wakeup_enable((gpio_num_t)pin, (gpio_int_type_t)(intr_type & 0x7));
|
||||
}
|
||||
gpio_isr_handler_add((gpio_num_t)pin, __onPinInterrupt, &__pinInterruptHandlers[pin]);
|
||||
gpio_intr_enable((gpio_num_t)pin);
|
||||
#else
|
||||
esp_intr_disable(gpio_intr_handle);
|
||||
#if CONFIG_IDF_TARGET_ESP32
|
||||
if(esp_intr_get_cpu(gpio_intr_handle)) { //APP_CPU
|
||||
#endif
|
||||
GPIO.pin[pin].int_ena = 1;
|
||||
#if CONFIG_IDF_TARGET_ESP32
|
||||
} else { //PRO_CPU
|
||||
GPIO.pin[pin].int_ena = 4;
|
||||
}
|
||||
#endif
|
||||
GPIO.pin[pin].int_type = intr_type;
|
||||
esp_intr_enable(gpio_intr_handle);
|
||||
#endif
|
||||
|
||||
|
||||
//FIX interrupts on peripherals outputs (eg. LEDC,...)
|
||||
//Enable input in GPIO register
|
||||
gpio_hal_context_t gpiohal;
|
||||
gpiohal.dev = GPIO_LL_GET_HW(GPIO_PORT_0);
|
||||
gpio_hal_input_enable(&gpiohal, pin);
|
||||
}
|
||||
|
||||
extern void __attachInterruptArg(uint8_t pin, voidFuncPtrArg userFunc, void * arg, int intr_type)
|
||||
|
|
@ -505,13 +191,9 @@ extern void __attachInterrupt(uint8_t pin, voidFuncPtr userFunc, int intr_type)
|
|||
|
||||
extern void __detachInterrupt(uint8_t pin)
|
||||
{
|
||||
#if USE_ESP_IDF_GPIO
|
||||
gpio_intr_disable((gpio_num_t)pin);
|
||||
gpio_isr_handler_remove((gpio_num_t)pin);
|
||||
gpio_isr_handler_remove((gpio_num_t)pin); //remove handle and disable isr for pin
|
||||
gpio_wakeup_disable((gpio_num_t)pin);
|
||||
#else
|
||||
esp_intr_disable(gpio_intr_handle);
|
||||
#endif
|
||||
|
||||
if (__pinInterruptHandlers[pin].functional && __pinInterruptHandlers[pin].arg)
|
||||
{
|
||||
cleanupFunctional(__pinInterruptHandlers[pin].arg);
|
||||
|
|
@ -520,13 +202,7 @@ extern void __detachInterrupt(uint8_t pin)
|
|||
__pinInterruptHandlers[pin].arg = NULL;
|
||||
__pinInterruptHandlers[pin].functional = false;
|
||||
|
||||
#if USE_ESP_IDF_GPIO
|
||||
gpio_set_intr_type((gpio_num_t)pin, GPIO_INTR_DISABLE);
|
||||
#else
|
||||
GPIO.pin[pin].int_ena = 0;
|
||||
GPIO.pin[pin].int_type = 0;
|
||||
esp_intr_enable(gpio_intr_handle);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -68,21 +68,11 @@ extern "C" {
|
|||
#define ONLOW_WE 0x0C
|
||||
#define ONHIGH_WE 0x0D
|
||||
|
||||
typedef struct {
|
||||
uint8_t reg; /*!< GPIO register offset from DR_REG_IO_MUX_BASE */
|
||||
int8_t rtc; /*!< RTC GPIO number (-1 if not RTC GPIO pin) */
|
||||
int8_t adc; /*!< ADC Channel number (-1 if not ADC pin) */
|
||||
int8_t touch; /*!< Touch Channel number (-1 if not Touch pin) */
|
||||
} esp32_gpioMux_t;
|
||||
#define digitalPinIsValid(pin) GPIO_IS_VALID_GPIO(pin)
|
||||
#define digitalPinCanOutput(pin) GPIO_IS_VALID_OUTPUT_GPIO(pin)
|
||||
|
||||
extern const esp32_gpioMux_t esp32_gpioMux[SOC_GPIO_PIN_COUNT];
|
||||
extern const int8_t esp32_adc2gpio[20];
|
||||
|
||||
#define digitalPinIsValid(pin) ((pin) < SOC_GPIO_PIN_COUNT && esp32_gpioMux[(pin)].reg)
|
||||
#define digitalPinCanOutput(pin) ((pin) < NUM_OUPUT_PINS && esp32_gpioMux[(pin)].reg)
|
||||
#define digitalPinToRtcPin(pin) (((pin) < SOC_GPIO_PIN_COUNT)?esp32_gpioMux[(pin)].rtc:-1)
|
||||
#define digitalPinToAnalogChannel(pin) (((pin) < SOC_GPIO_PIN_COUNT)?esp32_gpioMux[(pin)].adc:-1)
|
||||
#define digitalPinToDacChannel(pin) (((pin) == PIN_DAC1)?0:((pin) == PIN_DAC2)?1:-1)
|
||||
#define digitalPinToRtcPin(pin) ((RTC_GPIO_IS_VALID_GPIO(pin))?rtc_io_number_get(pin):-1)
|
||||
#define digitalPinToDacChannel(pin) (((pin) == DAC_CHANNEL_1_GPIO_NUM)?0:((pin) == DAC_CHANNEL_2_GPIO_NUM)?1:-1)
|
||||
|
||||
void pinMode(uint8_t pin, uint8_t mode);
|
||||
void digitalWrite(uint8_t pin, uint8_t val);
|
||||
|
|
@ -93,6 +83,8 @@ void attachInterruptArg(uint8_t pin, void (*)(void*), void * arg, int mode);
|
|||
void detachInterrupt(uint8_t pin);
|
||||
|
||||
int8_t digitalPinToTouchChannel(uint8_t pin);
|
||||
int8_t digitalPinToAnalogChannel(uint8_t pin);
|
||||
int8_t analogChannelToDigitalPin(uint8_t channel);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
|||
|
|
@ -56,10 +56,11 @@ uint8_t channels_resolution[LEDC_CHANNELS] = {0};
|
|||
|
||||
double ledcSetup(uint8_t chan, double freq, uint8_t bit_num)
|
||||
{
|
||||
if(chan >= LEDC_CHANNELS){
|
||||
log_e("No more LEDC channels available! You can have maximum %u", LEDC_CHANNELS);
|
||||
if(chan >= LEDC_CHANNELS || bit_num > 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 0;
|
||||
}
|
||||
|
||||
uint8_t group=(chan/8), timer=((chan/2)%4);
|
||||
|
||||
ledc_timer_config_t ledc_timer = {
|
||||
|
|
@ -69,9 +70,12 @@ double ledcSetup(uint8_t chan, double freq, uint8_t bit_num)
|
|||
.freq_hz = freq,
|
||||
.clk_cfg = LEDC_DEFAULT_CLK
|
||||
};
|
||||
ledc_timer_config(&ledc_timer);
|
||||
if(ledc_timer_config(&ledc_timer) != ESP_OK)
|
||||
{
|
||||
log_e("ledc setup failed!");
|
||||
return 0;
|
||||
}
|
||||
channels_resolution[chan] = bit_num;
|
||||
|
||||
return ledc_get_freq(group,timer);
|
||||
}
|
||||
|
||||
|
|
@ -95,7 +99,7 @@ void ledcWrite(uint8_t chan, uint32_t duty)
|
|||
|
||||
uint32_t ledcRead(uint8_t chan)
|
||||
{
|
||||
if(chan >= LEDC_CHANNELS){
|
||||
if(chan >= LEDC_CHANNELS){
|
||||
return 0;
|
||||
}
|
||||
uint8_t group=(chan/8), channel=(chan%8);
|
||||
|
|
@ -130,7 +134,12 @@ double ledcWriteTone(uint8_t chan, double freq)
|
|||
.freq_hz = freq,
|
||||
.clk_cfg = LEDC_DEFAULT_CLK
|
||||
};
|
||||
ledc_timer_config(&ledc_timer);
|
||||
|
||||
if(ledc_timer_config(&ledc_timer) != ESP_OK)
|
||||
{
|
||||
log_e("ledcSetup failed!");
|
||||
return 0;
|
||||
}
|
||||
channels_resolution[chan] = 10;
|
||||
|
||||
double res_freq = ledc_get_freq(group,timer);
|
||||
|
|
@ -153,7 +162,7 @@ double ledcWriteNote(uint8_t chan, note_t note, uint8_t octave){
|
|||
|
||||
void ledcAttachPin(uint8_t pin, uint8_t chan)
|
||||
{
|
||||
if(chan >= LEDC_CHANNELS){
|
||||
if(chan >= LEDC_CHANNELS){
|
||||
return;
|
||||
}
|
||||
uint8_t group=(chan/8), channel=(chan%8), timer=((chan/2)%4);
|
||||
|
|
@ -168,12 +177,6 @@ void ledcAttachPin(uint8_t pin, uint8_t chan)
|
|||
.hpoint = 0
|
||||
};
|
||||
ledc_channel_config(&ledc_channel);
|
||||
|
||||
//Making attachInterrupt to work.
|
||||
//WILL BE REMOVED AFTER REFACTORING GPIO to use ESP-IDF API
|
||||
#if CONFIG_IDF_TARGET_ESP32 || CONFIG_IDF_TARGET_ESP32S2
|
||||
pinMode(pin,OUTPUT);
|
||||
#endif
|
||||
}
|
||||
|
||||
void ledcDetachPin(uint8_t pin)
|
||||
|
|
@ -183,7 +186,8 @@ void ledcDetachPin(uint8_t pin)
|
|||
|
||||
double ledcChangeFrequency(uint8_t chan, double freq, uint8_t bit_num)
|
||||
{
|
||||
if(chan >= LEDC_CHANNELS){
|
||||
if(chan >= LEDC_CHANNELS || bit_num > LEDC_MAX_BIT_WIDTH){
|
||||
log_e("LEDC channel not available! (maximum %u) or bit width too big (maximum %u)", LEDC_CHANNELS, LEDC_MAX_BIT_WIDTH);
|
||||
return 0;
|
||||
}
|
||||
uint8_t group=(chan/8), timer=((chan/2)%4);
|
||||
|
|
@ -195,9 +199,13 @@ double ledcChangeFrequency(uint8_t chan, double freq, uint8_t bit_num)
|
|||
.freq_hz = freq,
|
||||
.clk_cfg = LEDC_DEFAULT_CLK
|
||||
};
|
||||
ledc_timer_config(&ledc_timer);
|
||||
channels_resolution[chan] = bit_num;
|
||||
|
||||
if(ledc_timer_config(&ledc_timer) != ESP_OK)
|
||||
{
|
||||
log_e("ledcChangeFrequency failed!");
|
||||
return 0;
|
||||
}
|
||||
channels_resolution[chan] = bit_num;
|
||||
return ledc_get_freq(group,timer);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -38,9 +38,11 @@ extern "C"
|
|||
#else
|
||||
#define ARDUHAL_LOG_LEVEL CORE_DEBUG_LEVEL
|
||||
#ifdef USE_ESP_IDF_LOG
|
||||
#ifndef LOG_LOCAL_LEVEL
|
||||
#define LOG_LOCAL_LEVEL CORE_DEBUG_LEVEL
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef CONFIG_ARDUHAL_LOG_COLORS
|
||||
#define CONFIG_ARDUHAL_LOG_COLORS 0
|
||||
|
|
@ -158,7 +160,7 @@ void log_print_buf(const uint8_t *b, size_t len);
|
|||
#define isr_log_e(format, ...) ets_printf(ARDUHAL_LOG_FORMAT(E, format), ##__VA_ARGS__)
|
||||
#define log_buf_e(b,l) do{ARDUHAL_LOG_COLOR_PRINT(E);log_print_buf(b,l);ARDUHAL_LOG_COLOR_PRINT_END;}while(0)
|
||||
#else
|
||||
#define log_e(format, ...) do {log_to_esp(TAG, ESP_LOG_ERROR, format, ##__VA_ARGS__);}while(0)
|
||||
#define log_e(format, ...) do {ESP_LOG_LEVEL_LOCAL(ESP_LOG_ERROR, TAG, format, ##__VA_ARGS__);}while(0)
|
||||
#define isr_log_e(format, ...) do {ets_printf(LOG_FORMAT(E, format), esp_log_timestamp(), TAG, ##__VA_ARGS__);}while(0)
|
||||
#define log_buf_e(b,l) do {ESP_LOG_BUFFER_HEXDUMP(TAG, b, l, ESP_LOG_ERROR);}while(0)
|
||||
#endif
|
||||
|
|
@ -187,9 +189,9 @@ void log_print_buf(const uint8_t *b, size_t len);
|
|||
#include "esp_log.h"
|
||||
|
||||
#ifdef USE_ESP_IDF_LOG
|
||||
#ifndef TAG
|
||||
#define TAG "ARDUINO"
|
||||
#endif
|
||||
//#ifndef TAG
|
||||
//#define TAG "ARDUINO"
|
||||
//#endif
|
||||
//#define log_n(format, ...) myLog(ESP_LOG_NONE, format, ##__VA_ARGS__)
|
||||
#else
|
||||
#ifdef CONFIG_ARDUHAL_ESP_LOG
|
||||
|
|
|
|||
|
|
@ -96,6 +96,7 @@ struct rmt_obj_s
|
|||
void * arg;
|
||||
TaskHandle_t rxTaskHandle;
|
||||
bool rx_completed;
|
||||
bool tx_not_rx;
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
@ -109,15 +110,15 @@ static xSemaphoreHandle g_rmt_objlocks[MAX_CHANNELS] = {
|
|||
};
|
||||
|
||||
static rmt_obj_t g_rmt_objects[MAX_CHANNELS] = {
|
||||
{ false, NULL, 0, 0, 0, NULL, NULL, NULL, NULL, true},
|
||||
{ false, NULL, 0, 0, 0, NULL, NULL, NULL, NULL, true},
|
||||
{ false, NULL, 0, 0, 0, NULL, NULL, NULL, NULL, true},
|
||||
{ false, NULL, 0, 0, 0, NULL, NULL, NULL, NULL, true},
|
||||
{ false, NULL, 0, 0, 0, NULL, NULL, NULL, NULL, true, true},
|
||||
{ false, NULL, 0, 0, 0, NULL, NULL, NULL, NULL, true, true},
|
||||
{ false, NULL, 0, 0, 0, NULL, NULL, NULL, NULL, true, true},
|
||||
{ false, NULL, 0, 0, 0, NULL, NULL, NULL, NULL, true, true},
|
||||
#if MAX_CHANNELS > 4
|
||||
{ false, NULL, 0, 0, 0, NULL, NULL, NULL, NULL, true},
|
||||
{ false, NULL, 0, 0, 0, NULL, NULL, NULL, NULL, true},
|
||||
{ false, NULL, 0, 0, 0, NULL, NULL, NULL, NULL, true},
|
||||
{ false, NULL, 0, 0, 0, NULL, NULL, NULL, NULL, true},
|
||||
{ false, NULL, 0, 0, 0, NULL, NULL, NULL, NULL, true, true},
|
||||
{ false, NULL, 0, 0, 0, NULL, NULL, NULL, NULL, true, true},
|
||||
{ false, NULL, 0, 0, 0, NULL, NULL, NULL, NULL, true, true},
|
||||
{ false, NULL, 0, 0, 0, NULL, NULL, NULL, NULL, true, true},
|
||||
#endif
|
||||
};
|
||||
|
||||
|
|
@ -248,6 +249,26 @@ static bool _rmtCreateRxTask(rmt_obj_t* rmt)
|
|||
return true;
|
||||
}
|
||||
|
||||
// Helper function to test if an RMT channel is correctly assigned to TX or RX, issuing an error message if necessary
|
||||
// Also test RMT pointer for NULL and returns false in case it is NULL
|
||||
// return true when it is correctly assigned, false otherwise
|
||||
static bool _rmtCheckTXnotRX(rmt_obj_t* rmt, bool tx_not_rx)
|
||||
{
|
||||
if (!rmt) { // also returns false on NULL
|
||||
return false;
|
||||
}
|
||||
|
||||
if (rmt->tx_not_rx == tx_not_rx) { // matches expected RX/TX channel
|
||||
return true;
|
||||
}
|
||||
|
||||
if (tx_not_rx) { // expected TX channel
|
||||
log_e("Can't write on a RX RMT Channel");
|
||||
} else{ // expected RX channel
|
||||
log_e("Can't read on a TX RMT Channel");
|
||||
}
|
||||
return false; // missmatched
|
||||
}
|
||||
|
||||
/**
|
||||
* Public method definitions
|
||||
|
|
@ -255,7 +276,7 @@ static bool _rmtCreateRxTask(rmt_obj_t* rmt)
|
|||
|
||||
bool rmtSetCarrier(rmt_obj_t* rmt, bool carrier_en, bool carrier_level, uint32_t low, uint32_t high)
|
||||
{
|
||||
if (!rmt || low > 0xFFFF || high > 0xFFFF) {
|
||||
if (!_rmtCheckTXnotRX(rmt, RMT_TX_MODE) || low > 0xFFFF || high > 0xFFFF) {
|
||||
return false;
|
||||
}
|
||||
size_t channel = rmt->channel;
|
||||
|
|
@ -268,7 +289,7 @@ bool rmtSetCarrier(rmt_obj_t* rmt, bool carrier_en, bool carrier_level, uint32_t
|
|||
|
||||
bool rmtSetFilter(rmt_obj_t* rmt, bool filter_en, uint32_t filter_level)
|
||||
{
|
||||
if (!rmt || filter_level > 0xFF) {
|
||||
if (!_rmtCheckTXnotRX(rmt, RMT_RX_MODE) || filter_level > 0xFF) {
|
||||
return false;
|
||||
}
|
||||
size_t channel = rmt->channel;
|
||||
|
|
@ -281,7 +302,7 @@ bool rmtSetFilter(rmt_obj_t* rmt, bool filter_en, uint32_t filter_level)
|
|||
|
||||
bool rmtSetRxThreshold(rmt_obj_t* rmt, uint32_t value)
|
||||
{
|
||||
if (!rmt || value > 0xFFFF) {
|
||||
if (!_rmtCheckTXnotRX(rmt, RMT_RX_MODE) || value > 0xFFFF) {
|
||||
return false;
|
||||
}
|
||||
size_t channel = rmt->channel;
|
||||
|
|
@ -306,14 +327,17 @@ bool rmtDeinit(rmt_obj_t *rmt)
|
|||
|
||||
RMT_MUTEX_LOCK(rmt->channel);
|
||||
// force stopping rmt processing
|
||||
rmt_rx_stop(rmt->channel);
|
||||
rmt_tx_stop(rmt->channel);
|
||||
if (rmt->tx_not_rx) {
|
||||
rmt_tx_stop(rmt->channel);
|
||||
} else {
|
||||
rmt_rx_stop(rmt->channel);
|
||||
if(rmt->rxTaskHandle){
|
||||
vTaskDelete(rmt->rxTaskHandle);
|
||||
rmt->rxTaskHandle = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
if(rmt->rxTaskHandle){
|
||||
vTaskDelete(rmt->rxTaskHandle);
|
||||
rmt->rxTaskHandle = NULL;
|
||||
}
|
||||
rmt_driver_uninstall(rmt->channel);
|
||||
rmt_driver_uninstall(rmt->channel);
|
||||
|
||||
size_t from = rmt->channel;
|
||||
size_t to = rmt->buffers + rmt->channel;
|
||||
|
|
@ -330,6 +354,7 @@ bool rmtDeinit(rmt_obj_t *rmt)
|
|||
#if !CONFIG_DISABLE_HAL_LOCKS
|
||||
if(g_rmt_objlocks[from] != NULL) {
|
||||
vSemaphoreDelete(g_rmt_objlocks[from]);
|
||||
g_rmt_objlocks[from] = NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
@ -338,10 +363,9 @@ bool rmtDeinit(rmt_obj_t *rmt)
|
|||
|
||||
bool rmtLoop(rmt_obj_t* rmt, rmt_data_t* data, size_t size)
|
||||
{
|
||||
if (!rmt) {
|
||||
if (!_rmtCheckTXnotRX(rmt, RMT_TX_MODE)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
int channel = rmt->channel;
|
||||
RMT_MUTEX_LOCK(channel);
|
||||
rmt_tx_stop(channel);
|
||||
|
|
@ -353,10 +377,9 @@ bool rmtLoop(rmt_obj_t* rmt, rmt_data_t* data, size_t size)
|
|||
|
||||
bool rmtWrite(rmt_obj_t* rmt, rmt_data_t* data, size_t size)
|
||||
{
|
||||
if (!rmt) {
|
||||
if (!_rmtCheckTXnotRX(rmt, RMT_TX_MODE)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
int channel = rmt->channel;
|
||||
RMT_MUTEX_LOCK(channel);
|
||||
rmt_tx_stop(channel);
|
||||
|
|
@ -368,10 +391,9 @@ bool rmtWrite(rmt_obj_t* rmt, rmt_data_t* data, size_t size)
|
|||
|
||||
bool rmtWriteBlocking(rmt_obj_t* rmt, rmt_data_t* data, size_t size)
|
||||
{
|
||||
if (!rmt) {
|
||||
if (!_rmtCheckTXnotRX(rmt, RMT_TX_MODE)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
int channel = rmt->channel;
|
||||
RMT_MUTEX_LOCK(channel);
|
||||
rmt_tx_stop(channel);
|
||||
|
|
@ -383,10 +405,9 @@ bool rmtWriteBlocking(rmt_obj_t* rmt, rmt_data_t* data, size_t size)
|
|||
|
||||
bool rmtReadData(rmt_obj_t* rmt, uint32_t* data, size_t size)
|
||||
{
|
||||
if (!rmt) {
|
||||
if (!_rmtCheckTXnotRX(rmt, RMT_RX_MODE)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
rmtReadAsync(rmt, (rmt_data_t*) data, size, NULL, false, 0);
|
||||
return true;
|
||||
}
|
||||
|
|
@ -394,7 +415,7 @@ bool rmtReadData(rmt_obj_t* rmt, uint32_t* data, size_t size)
|
|||
|
||||
bool rmtBeginReceive(rmt_obj_t* rmt)
|
||||
{
|
||||
if (!rmt) {
|
||||
if (!_rmtCheckTXnotRX(rmt, RMT_RX_MODE)) {
|
||||
return false;
|
||||
}
|
||||
int channel = rmt->channel;
|
||||
|
|
@ -418,7 +439,7 @@ bool rmtReceiveCompleted(rmt_obj_t* rmt)
|
|||
|
||||
bool rmtRead(rmt_obj_t* rmt, rmt_rx_data_cb_t cb, void * arg)
|
||||
{
|
||||
if (!rmt || !cb) {
|
||||
if (!_rmtCheckTXnotRX(rmt, RMT_RX_MODE)) {
|
||||
return false;
|
||||
}
|
||||
int channel = rmt->channel;
|
||||
|
|
@ -449,15 +470,19 @@ bool rmtEnd(rmt_obj_t* rmt)
|
|||
int channel = rmt->channel;
|
||||
|
||||
RMT_MUTEX_LOCK(channel);
|
||||
rmt_rx_stop(channel);
|
||||
rmt->rx_completed = true;
|
||||
if (rmt->tx_not_rx) {
|
||||
rmt_tx_stop(channel);
|
||||
} else {
|
||||
rmt_rx_stop(channel);
|
||||
rmt->rx_completed = true;
|
||||
}
|
||||
RMT_MUTEX_UNLOCK(channel);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool rmtReadAsync(rmt_obj_t* rmt, rmt_data_t* data, size_t size, void* eventFlag, bool waitForData, uint32_t timeout)
|
||||
{
|
||||
if (!rmt) {
|
||||
if (!_rmtCheckTXnotRX(rmt, RMT_RX_MODE)) {
|
||||
return false;
|
||||
}
|
||||
int channel = rmt->channel;
|
||||
|
|
@ -568,6 +593,7 @@ rmt_obj_t* rmtInit(int pin, bool tx_not_rx, rmt_reserve_memsize_t memsize)
|
|||
rmt->data_size = 0;
|
||||
rmt->rx_completed = false;
|
||||
rmt->events = NULL;
|
||||
rmt->tx_not_rx = tx_not_rx;
|
||||
|
||||
#if !CONFIG_DISABLE_HAL_LOCKS
|
||||
if(g_rmt_objlocks[channel] == NULL) {
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ bool timerGetAutoReload(hw_timer_t *timer);
|
|||
|
||||
void timerAlarmEnable(hw_timer_t *timer);
|
||||
void timerAlarmDisable(hw_timer_t *timer);
|
||||
void timerAlarmWrite(hw_timer_t *timer, uint64_t interruptAt, bool autoreload);
|
||||
void timerAlarmWrite(hw_timer_t *timer, uint64_t alarm_value, bool autoreload);
|
||||
|
||||
bool timerAlarmEnabled(hw_timer_t *timer);
|
||||
uint64_t timerAlarmRead(hw_timer_t *timer);
|
||||
|
|
|
|||
|
|
@ -34,9 +34,7 @@ struct uart_struct_t {
|
|||
uint8_t num;
|
||||
bool has_peek;
|
||||
uint8_t peek_byte;
|
||||
QueueHandle_t uart_event_queue;
|
||||
void (*onReceive)(void);
|
||||
TaskHandle_t envent_task;
|
||||
QueueHandle_t uart_event_queue; // export it by some uartGetEventQueue() function
|
||||
};
|
||||
|
||||
#if CONFIG_DISABLE_HAL_LOCKS
|
||||
|
|
@ -45,12 +43,12 @@ struct uart_struct_t {
|
|||
#define UART_MUTEX_UNLOCK()
|
||||
|
||||
static uart_t _uart_bus_array[] = {
|
||||
{0, false, 0, NULL, NULL, NULL},
|
||||
{0, false, 0, NULL},
|
||||
#if SOC_UART_NUM > 1
|
||||
{1, false, 0, NULL, NULL, NULL},
|
||||
{1, false, 0, NULL},
|
||||
#endif
|
||||
#if SOC_UART_NUM > 2
|
||||
{2, false, 0, NULL, NULL, NULL},
|
||||
{2, false, 0, NULL},
|
||||
#endif
|
||||
};
|
||||
|
||||
|
|
@ -60,12 +58,12 @@ static uart_t _uart_bus_array[] = {
|
|||
#define UART_MUTEX_UNLOCK() xSemaphoreGive(uart->lock)
|
||||
|
||||
static uart_t _uart_bus_array[] = {
|
||||
{NULL, 0, false, 0, NULL, NULL, NULL},
|
||||
{NULL, 0, false, 0, NULL},
|
||||
#if SOC_UART_NUM > 1
|
||||
{NULL, 1, false, 0, NULL, NULL, NULL},
|
||||
{NULL, 1, false, 0, NULL},
|
||||
#endif
|
||||
#if SOC_UART_NUM > 2
|
||||
{NULL, 2, false, 0, NULL, NULL, NULL},
|
||||
{NULL, 2, false, 0, NULL},
|
||||
#endif
|
||||
};
|
||||
|
||||
|
|
@ -84,69 +82,22 @@ uint32_t _get_effective_baudrate(uint32_t baudrate)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
void uartOnReceive(uart_t* uart, void(*function)(void))
|
||||
// Routines that take care of UART events will be in the HardwareSerial Class code
|
||||
void uartGetEventQueue(uart_t* uart, QueueHandle_t *q)
|
||||
{
|
||||
if(uart == NULL || function == NULL) {
|
||||
// passing back NULL for the Queue pointer when UART is not initialized yet
|
||||
*q = NULL;
|
||||
if(uart == NULL) {
|
||||
return;
|
||||
}
|
||||
UART_MUTEX_LOCK();
|
||||
uart->onReceive = function;
|
||||
UART_MUTEX_UNLOCK();
|
||||
*q = uart->uart_event_queue;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
static void uart_event_task(void *args)
|
||||
{
|
||||
uart_t* uart = (uart_t *)args;
|
||||
uart_event_t event;
|
||||
for(;;) {
|
||||
//Waiting for UART event.
|
||||
if(xQueueReceive(uart->uart_event_queue, (void * )&event, (portTickType)portMAX_DELAY)) {
|
||||
switch(event.type) {
|
||||
//Event of UART receving data
|
||||
case UART_DATA:
|
||||
if(uart->onReceive) uart->onReceive();
|
||||
break;
|
||||
//Event of HW FIFO overflow detected
|
||||
case UART_FIFO_OVF:
|
||||
log_w("UART%d FIFO Overflow. Flushing data. Consider adding Flow Control to your Application.", uart->num);
|
||||
uart_flush_input(uart->num);
|
||||
xQueueReset(uart->uart_event_queue);
|
||||
break;
|
||||
//Event of UART ring buffer full
|
||||
case UART_BUFFER_FULL:
|
||||
log_w("UART%d Buffer Full. Flushing data. Consider encreasing your buffer size of your Application.", uart->num);
|
||||
uart_flush_input(uart->num);
|
||||
xQueueReset(uart->uart_event_queue);
|
||||
break;
|
||||
//Event of UART RX break detected
|
||||
case UART_BREAK:
|
||||
log_w("UART%d RX break.", uart->num);
|
||||
break;
|
||||
//Event of UART parity check error
|
||||
case UART_PARITY_ERR:
|
||||
log_w("UART%d parity error.", uart->num);
|
||||
break;
|
||||
//Event of UART frame error
|
||||
case UART_FRAME_ERR:
|
||||
log_w("UART%d frame error.", uart->num);
|
||||
break;
|
||||
//Others
|
||||
default:
|
||||
log_w("UART%d unknown event type %d.", uart->num, event.type);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
vTaskDelete(NULL);
|
||||
}
|
||||
|
||||
|
||||
bool uartIsDriverInstalled(uart_t* uart)
|
||||
{
|
||||
if(uart == NULL) {
|
||||
return 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (uart_is_driver_installed(uart->num)) {
|
||||
|
|
@ -155,15 +106,27 @@ bool uartIsDriverInstalled(uart_t* uart)
|
|||
return false;
|
||||
}
|
||||
|
||||
void uartSetPins(uart_t* uart, uint8_t rxPin, uint8_t txPin)
|
||||
// Valid pin UART_PIN_NO_CHANGE is defined to (-1)
|
||||
// Negative Pin Number will keep it unmodified, thus this function can set individual pins
|
||||
void uartSetPins(uart_t* uart, int8_t rxPin, int8_t txPin, int8_t ctsPin, int8_t rtsPin)
|
||||
{
|
||||
if(uart == NULL || rxPin >= SOC_GPIO_PIN_COUNT || txPin >= SOC_GPIO_PIN_COUNT) {
|
||||
if(uart == NULL) {
|
||||
return;
|
||||
}
|
||||
UART_MUTEX_LOCK();
|
||||
ESP_ERROR_CHECK(uart_set_pin(uart->num, txPin, rxPin, UART_PIN_NO_CHANGE, UART_PIN_NO_CHANGE));
|
||||
UART_MUTEX_UNLOCK();
|
||||
|
||||
// IDF uart_set_pin() will issue necessary Error Message and take care of all GPIO Number validation.
|
||||
uart_set_pin(uart->num, txPin, rxPin, ctsPin, rtsPin);
|
||||
UART_MUTEX_UNLOCK();
|
||||
}
|
||||
|
||||
//
|
||||
void uartSetHwFlowCtrlMode(uart_t *uart, uint8_t mode, uint8_t threshold) {
|
||||
if(uart == NULL) {
|
||||
return;
|
||||
}
|
||||
// IDF will issue corresponding error message when mode or threshold are wrong and prevent crashing
|
||||
// IDF will check (mode > HW_FLOWCTRL_CTS_RTS || threshold >= SOC_UART_FIFO_LEN)
|
||||
uart_set_hw_flow_ctrl(uart->num, (uart_hw_flowcontrol_t) mode, threshold);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -173,10 +136,6 @@ uart_t* uartBegin(uint8_t uart_nr, uint32_t baudrate, uint32_t config, int8_t rx
|
|||
return NULL;
|
||||
}
|
||||
|
||||
if(rxPin == -1 && txPin == -1) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
uart_t* uart = &_uart_bus_array[uart_nr];
|
||||
|
||||
if (uart_is_driver_installed(uart_nr)) {
|
||||
|
|
@ -214,12 +173,6 @@ uart_t* uartBegin(uint8_t uart_nr, uint32_t baudrate, uint32_t config, int8_t rx
|
|||
ESP_ERROR_CHECK(uart_set_line_inverse(uart_nr, UART_SIGNAL_TXD_INV | UART_SIGNAL_RXD_INV));
|
||||
}
|
||||
|
||||
// Creating UART event Task
|
||||
xTaskCreate(uart_event_task, "uart_event_task", 2048, uart, configMAX_PRIORITIES - 1, &(uart->envent_task));
|
||||
if (!uart->envent_task) {
|
||||
log_e(" -- UART%d Event Task not Created!", uart_nr);
|
||||
}
|
||||
|
||||
UART_MUTEX_UNLOCK();
|
||||
|
||||
uartFlush(uart);
|
||||
|
|
@ -234,11 +187,6 @@ void uartEnd(uart_t* uart)
|
|||
|
||||
UART_MUTEX_LOCK();
|
||||
uart_driver_delete(uart->num);
|
||||
if (uart->envent_task) {
|
||||
vTaskDelete(uart->envent_task);
|
||||
uart->envent_task = NULL;
|
||||
uart->onReceive = NULL;
|
||||
}
|
||||
UART_MUTEX_UNLOCK();
|
||||
}
|
||||
|
||||
|
|
@ -473,11 +421,12 @@ int log_printf(const char *format, ...)
|
|||
va_list copy;
|
||||
va_start(arg, format);
|
||||
va_copy(copy, arg);
|
||||
len = vsnprintf(NULL, 0, format, arg);
|
||||
len = vsnprintf(NULL, 0, format, copy);
|
||||
va_end(copy);
|
||||
if(len >= sizeof(loc_buf)){
|
||||
temp = (char*)malloc(len+1);
|
||||
if(temp == NULL) {
|
||||
va_end(arg);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,6 +22,8 @@ extern "C" {
|
|||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdlib.h>
|
||||
#include "freertos/FreeRTOS.h"
|
||||
#include "freertos/queue.h"
|
||||
|
||||
#define SERIAL_5N1 0x8000010
|
||||
#define SERIAL_6N1 0x8000014
|
||||
|
|
@ -48,13 +50,22 @@ extern "C" {
|
|||
#define SERIAL_7O2 0x800003b
|
||||
#define SERIAL_8O2 0x800003f
|
||||
|
||||
// These are Hardware Flow Contol possible usage
|
||||
// equivalent to UDF enum uart_hw_flowcontrol_t from
|
||||
// https://github.com/espressif/esp-idf/blob/master/components/hal/include/hal/uart_types.h#L75-L81
|
||||
#define HW_FLOWCTRL_DISABLE 0x0 // disable HW Flow Control
|
||||
#define HW_FLOWCTRL_RTS 0x1 // use only RTS PIN for HW Flow Control
|
||||
#define HW_FLOWCTRL_CTS 0x2 // use only CTS PIN for HW Flow Control
|
||||
#define HW_FLOWCTRL_CTS_RTS 0x3 // use both CTS and RTS PIN for HW Flow Control
|
||||
|
||||
struct uart_struct_t;
|
||||
typedef struct uart_struct_t uart_t;
|
||||
|
||||
uart_t* uartBegin(uint8_t uart_nr, uint32_t baudrate, uint32_t config, int8_t rxPin, int8_t txPin, uint16_t queueLen, bool inverted, uint8_t rxfifo_full_thrhd);
|
||||
void uartEnd(uart_t* uart);
|
||||
|
||||
void uartOnReceive(uart_t* uart, void(*function)(void));
|
||||
// This is used to retrieve the Event Queue pointer from a UART IDF Driver in order to allow user to deal with its events
|
||||
void uartGetEventQueue(uart_t* uart, QueueHandle_t *q);
|
||||
|
||||
uint32_t uartAvailable(uart_t* uart);
|
||||
uint32_t uartAvailableForWrite(uart_t* uart);
|
||||
|
|
@ -76,7 +87,12 @@ void uartSetDebug(uart_t* uart);
|
|||
int uartGetDebug();
|
||||
|
||||
bool uartIsDriverInstalled(uart_t* uart);
|
||||
void uartSetPins(uart_t* uart, uint8_t rxPin, uint8_t txPin);
|
||||
|
||||
// Negative Pin Number will keep it unmodified, thus this function can set individual pins
|
||||
void uartSetPins(uart_t* uart, int8_t rxPin, int8_t txPin, int8_t ctsPin, int8_t rtsPin);
|
||||
|
||||
// Enables or disables HW Flow Control function -- needs also to set CTS and/or RTS pins
|
||||
void uartSetHwFlowCtrlMode(uart_t *uart, uint8_t mode, uint8_t threshold);
|
||||
|
||||
void uartStartDetectBaudrate(uart_t *uart);
|
||||
unsigned long uartDetectBaudrate(uart_t *uart);
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ extern "C" {
|
|||
/** Minor version number (x.X.x) */
|
||||
#define ESP_ARDUINO_VERSION_MINOR 0
|
||||
/** Patch version number (x.x.X) */
|
||||
#define ESP_ARDUINO_VERSION_PATCH 0
|
||||
#define ESP_ARDUINO_VERSION_PATCH 3
|
||||
|
||||
/**
|
||||
* Macro to convert ARDUINO version number into an integer
|
||||
|
|
|
|||
|
|
@ -3,3 +3,4 @@
|
|||
#
|
||||
# matplotlib is currently required only by the script generate_chart.py
|
||||
sphinx-copybutton==0.3.0
|
||||
sphinx-tabs==3.2.0
|
||||
BIN
docs/source/_static/logo_arduino.png
Normal file
BIN
docs/source/_static/logo_arduino.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 22 KiB |
BIN
docs/source/_static/logo_pio.png
Normal file
BIN
docs/source/_static/logo_pio.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 25 KiB |
BIN
docs/source/_static/usb_msc_drive.png
Normal file
BIN
docs/source/_static/usb_msc_drive.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 74 KiB |
208
docs/source/api/adc.rst
Normal file
208
docs/source/api/adc.rst
Normal file
|
|
@ -0,0 +1,208 @@
|
|||
###
|
||||
ADC
|
||||
###
|
||||
|
||||
About
|
||||
-----
|
||||
|
||||
ADC (analog to digital converter) is a very common peripheral used to convert an analog signal such as voltage
|
||||
to a digital form so that it can be read and processed by a microcontroller.
|
||||
|
||||
ADCs are very useful in control and monitoring applications since most sensors
|
||||
(e.g., temperature, pressure, force) produce analogue output voltages.
|
||||
|
||||
.. note:: Each SoC or module has a different number of ADC's with a different number of channels and pins availible. Refer to datasheet of each board for more info.
|
||||
|
||||
Arduino-ESP32 ADC API
|
||||
---------------------
|
||||
|
||||
ADC common API
|
||||
**************
|
||||
|
||||
analogRead
|
||||
^^^^^^^^^^
|
||||
|
||||
This function is used to get the ADC raw value for a given pin/ADC channel.
|
||||
|
||||
.. code-block:: arduino
|
||||
|
||||
uint16_t analogRead(uint8_t pin);
|
||||
|
||||
* ``pin`` GPIO pin to read analog value
|
||||
|
||||
This function will return analog raw value.
|
||||
|
||||
analogReadMillivolts
|
||||
^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
This function is used to get ADC value for a given pin/ADC channel in millivolts.
|
||||
|
||||
.. code-block:: arduino
|
||||
|
||||
uint32_t analogReadMilliVolts(uint8_t pin);
|
||||
|
||||
* ``pin`` GPIO pin to read analog value
|
||||
|
||||
This function will return analog value in millivolts.
|
||||
|
||||
analogReadResolution
|
||||
^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
This function is used to set the resolution of ``analogRead`` return value. Default is 12 bits (range from 0 to 4096)
|
||||
for all chips except ESP32S3 where default is 13 bits (range from 0 to 8192).
|
||||
When different resolution is set, the values read will be shifted to match the given resolution.
|
||||
|
||||
Range is 1 - 16 .The default value will be used, if this function is not used.
|
||||
|
||||
.. note:: For the ESP32, the resolution is between 9 to12 and it will change the ADC hardware resolution. Else value will be shifted.
|
||||
|
||||
.. code-block:: arduino
|
||||
|
||||
void analogReadResolution(uint8_t bits);
|
||||
|
||||
* ``bits`` sets analog read resolution
|
||||
|
||||
analogSetClockDiv
|
||||
^^^^^^^^^^^^^^^^^
|
||||
|
||||
This function is used to set the divider for the ADC clock.
|
||||
|
||||
Range is 1 - 255. Default value is 1.
|
||||
|
||||
.. code-block:: arduino
|
||||
|
||||
void analogSetClockDiv(uint8_t clockDiv);
|
||||
|
||||
* ``clockDiv`` sets the divider for ADC clock.
|
||||
|
||||
analogSetAttenuation
|
||||
^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
This function is used to set the attenuation for all channels.
|
||||
|
||||
Input voltages can be attenuated before being input to the ADCs.
|
||||
There are 4 available attenuation options, the higher the attenuation is, the higher the measurable input voltage could be.
|
||||
|
||||
The measurable input voltage differs for each chip, see table below for detailed information.
|
||||
|
||||
.. tabs::
|
||||
|
||||
.. tab:: ESP32
|
||||
|
||||
===================== ===========================================
|
||||
Attenuation Measurable input voltage range
|
||||
===================== ===========================================
|
||||
``ADC_ATTEN_DB_0`` 100 mV ~ 950 mV
|
||||
``ADC_ATTEN_DB_2_5`` 100 mV ~ 1250 mV
|
||||
``ADC_ATTEN_DB_6`` 150 mV ~ 1750 mV
|
||||
``ADC_ATTEN_DB_11`` 150 mV ~ 2450 mV
|
||||
===================== ===========================================
|
||||
|
||||
.. tab:: ESP32-S2
|
||||
|
||||
===================== ===========================================
|
||||
Attenuation Measurable input voltage range
|
||||
===================== ===========================================
|
||||
``ADC_ATTEN_DB_0`` 0 mV ~ 750 mV
|
||||
``ADC_ATTEN_DB_2_5`` 0 mV ~ 1050 mV
|
||||
``ADC_ATTEN_DB_6`` 0 mV ~ 1300 mV
|
||||
``ADC_ATTEN_DB_11`` 0 mV ~ 2500 mV
|
||||
===================== ===========================================
|
||||
|
||||
.. tab:: ESP32-C3
|
||||
|
||||
===================== ===========================================
|
||||
Attenuation Measurable input voltage range
|
||||
===================== ===========================================
|
||||
``ADC_ATTEN_DB_0`` 0 mV ~ 750 mV
|
||||
``ADC_ATTEN_DB_2_5`` 0 mV ~ 1050 mV
|
||||
``ADC_ATTEN_DB_6`` 0 mV ~ 1300 mV
|
||||
``ADC_ATTEN_DB_11`` 0 mV ~ 2500 mV
|
||||
===================== ===========================================
|
||||
|
||||
.. tab:: ESP32-S3
|
||||
|
||||
===================== ===========================================
|
||||
Attenuation Measurable input voltage range
|
||||
===================== ===========================================
|
||||
``ADC_ATTEN_DB_0`` 0 mV ~ 950 mV
|
||||
``ADC_ATTEN_DB_2_5`` 0 mV ~ 1250 mV
|
||||
``ADC_ATTEN_DB_6`` 0 mV ~ 1750 mV
|
||||
``ADC_ATTEN_DB_11`` 0 mV ~ 3100 mV
|
||||
===================== ===========================================
|
||||
|
||||
.. code-block:: arduino
|
||||
|
||||
void analogSetAttenuation(adc_attenuation_t attenuation);
|
||||
|
||||
* ``attenuation`` sets the attenuation.
|
||||
|
||||
analogSetPinAttenuation
|
||||
^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
This function is used to set the attenuation for a specific pin/ADC channel. For more information refer to `analogSetAttenuation`_.
|
||||
|
||||
.. code-block:: arduino
|
||||
|
||||
void analogSetPinAttenuation(uint8_t pin, adc_attenuation_t attenuation);
|
||||
|
||||
* ``pin`` selects specific pin for attenuation settings.
|
||||
* ``attenuation`` sets the attenuation.
|
||||
|
||||
adcAttachPin
|
||||
^^^^^^^^^^^^
|
||||
|
||||
This function is used to attach the pin to ADC (it will also clear any other analog mode that could be on)
|
||||
|
||||
.. code-block:: arduino
|
||||
|
||||
bool adcAttachPin(uint8_t pin);
|
||||
|
||||
This function will return ``true`` if configuration is successful. Else returns ``false``.
|
||||
|
||||
ADC API specific for ESP32 chip
|
||||
*******************************
|
||||
|
||||
analogSetWidth
|
||||
^^^^^^^^^^^^^^
|
||||
|
||||
This function is used to set the hardware sample bits and read resolution.
|
||||
Default is 12bit (0 - 4095).
|
||||
Range is 9 - 12.
|
||||
|
||||
.. code-block:: arduino
|
||||
|
||||
void analogSetWidth(uint8_t bits);
|
||||
|
||||
analogSetVRefPin
|
||||
^^^^^^^^^^^^^^^^
|
||||
|
||||
This function is used to set pin to use for ADC calibration if the esp is not already calibrated (pins 25, 26 or 27).
|
||||
|
||||
.. code-block:: arduino
|
||||
|
||||
void analogSetVRefPin(uint8_t pin);
|
||||
|
||||
* ``pin`` GPIO pin to set VRefPin for ADC calibration
|
||||
|
||||
hallRead
|
||||
^^^^^^^^
|
||||
|
||||
This function is used to get the ADC value of the HALL sensor conneted to pins 36(SVP) and 39(SVN).
|
||||
|
||||
.. code-block:: arduino
|
||||
|
||||
int hallRead();
|
||||
|
||||
This function will return the hall sensor value.
|
||||
|
||||
|
||||
Example Applications
|
||||
********************
|
||||
|
||||
Here is an example of how to use the ADC.
|
||||
|
||||
.. literalinclude:: ../../../libraries/ESP32/examples/AnalogRead/AnalogRead.ino
|
||||
:language: arduino
|
||||
|
||||
Or you can run Arduino example 01.Basics -> AnalogReadSerial.
|
||||
47
docs/source/api/dac.rst
Normal file
47
docs/source/api/dac.rst
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
###
|
||||
DAC
|
||||
###
|
||||
|
||||
About
|
||||
-----
|
||||
|
||||
DAC (digital to analog converter) is a very common peripheral used to convert a digital signal to an
|
||||
analog form.
|
||||
|
||||
ESP32 and ESP32-S2 have two 8-bit DAC channels. The DAC driver allows these channels to be set to arbitrary voltages.
|
||||
|
||||
DACs can be used for generating a specific (and dynamic) reference voltage for external sensors,
|
||||
controlling transistors, etc.
|
||||
|
||||
========= ========= =========
|
||||
ESP32 SoC DAC_1 pin DAC_2 pin
|
||||
========= ========= =========
|
||||
ESP32 GPIO 25 GPIO 26
|
||||
ESP32-S2 GPIO 17 GPIO 18
|
||||
========= ========= =========
|
||||
|
||||
Arduino-ESP32 DAC API
|
||||
---------------------
|
||||
|
||||
dacWrite
|
||||
********
|
||||
|
||||
This function is used to set the DAC value for a given pin/DAC channel.
|
||||
|
||||
.. code-block:: arduino
|
||||
|
||||
void dacWrite(uint8_t pin, uint8_t value);
|
||||
|
||||
* ``pin`` GPIO pin.
|
||||
* ``value`` to be set. Range is 0 - 255 (equals 0V - 3.3V).
|
||||
|
||||
dacDisable
|
||||
**********
|
||||
|
||||
This function is used to disable DAC output on a given pin/DAC channel.
|
||||
|
||||
.. code-block:: arduino
|
||||
|
||||
void dacDisable(uint8_t pin);
|
||||
|
||||
* ``pin`` GPIO pin.
|
||||
183
docs/source/api/ledc.rst
Normal file
183
docs/source/api/ledc.rst
Normal file
|
|
@ -0,0 +1,183 @@
|
|||
##################
|
||||
LED Control (LEDC)
|
||||
##################
|
||||
|
||||
About
|
||||
-----
|
||||
The LED control (LEDC) peripheral is primarly designed to control the intensity of LEDs,
|
||||
although it can also be used to generate PWM signals for other purposes.
|
||||
|
||||
ESP32 SoCs has from 6 to 16 channels (variates on socs, see table below) which can generate independent waveforms, that can be used for example to drive RGB LED devices.
|
||||
|
||||
========= =======================
|
||||
ESP32 SoC Number of LEDC channels
|
||||
========= =======================
|
||||
ESP32 16
|
||||
ESP32-S2 8
|
||||
ESP32-C3 6
|
||||
ESP32-S3 8
|
||||
========= =======================
|
||||
|
||||
Arduino-ESP32 LEDC API
|
||||
----------------------
|
||||
|
||||
ledcSetup
|
||||
*********
|
||||
|
||||
This function is used to setup the LEDC channel frequency and resolution.
|
||||
|
||||
.. code-block:: arduino
|
||||
|
||||
double ledcSetup(uint8_t channel, double freq, uint8_t resolution_bits);
|
||||
|
||||
* ``channel`` select LEDC channel to config.
|
||||
* ``freq`` select frequency of pwm.
|
||||
* ``resolution_bits`` select resolution for ledc channel.
|
||||
|
||||
* range is 1-14 bits (1-20 bits for ESP32).
|
||||
|
||||
This function will return ``frequency`` configured for LEDC channel.
|
||||
If ``0`` is returned, error occurs and ledc channel was not configured.
|
||||
|
||||
ledcWrite
|
||||
*********
|
||||
|
||||
This function is used to set duty for the LEDC channel.
|
||||
|
||||
.. code-block:: arduino
|
||||
|
||||
void ledcWrite(uint8_t chan, uint32_t duty);
|
||||
|
||||
* ``chan`` select the LEDC channel for writing duty.
|
||||
* ``duty`` select duty to be set for selected channel.
|
||||
|
||||
ledcRead
|
||||
********
|
||||
|
||||
This function is used to get configured duty for the LEDC channel.
|
||||
|
||||
.. code-block:: arduino
|
||||
|
||||
uint32_t ledcRead(uint8_t chan);
|
||||
|
||||
* ``chan`` select LEDC channel to read the configured duty.
|
||||
|
||||
This function will return ``duty`` set for selected LEDC channel.
|
||||
|
||||
ledcReadFreq
|
||||
************
|
||||
|
||||
This function is used to get configured frequency for the LEDC channel.
|
||||
|
||||
.. code-block:: arduino
|
||||
|
||||
double ledcReadFreq(uint8_t chan);
|
||||
|
||||
* ``chan`` select the LEDC channel to read the configured frequency.
|
||||
|
||||
This function will return ``frequency`` configured for selected LEDC channel.
|
||||
|
||||
ledcWriteTone
|
||||
*************
|
||||
|
||||
This function is used to setup the LEDC channel to 50 % PWM tone on selected frequency.
|
||||
|
||||
.. code-block:: arduino
|
||||
|
||||
double ledcWriteTone(uint8_t chan, double freq);
|
||||
|
||||
* ``chan`` select LEDC channel.
|
||||
* ``freq`` select frequency of pwm signal.
|
||||
|
||||
This function will return ``frequency`` set for channel.
|
||||
If ``0`` is returned, error occurs and ledc cahnnel was not configured.
|
||||
|
||||
ledcWriteNote
|
||||
*************
|
||||
|
||||
This function is used to setup the LEDC channel to specific note.
|
||||
|
||||
.. code-block:: arduino
|
||||
|
||||
double ledcWriteNote(uint8_t chan, note_t note, uint8_t octave);
|
||||
|
||||
* ``chan`` select LEDC channel.
|
||||
* ``note`` select note to be set.
|
||||
|
||||
======= ======= ======= ======= ======= ======
|
||||
NOTE_C NOTE_Cs NOTE_D NOTE_Eb NOTE_E NOTE_F
|
||||
NOTE_Fs NOTE_G NOTE_Gs NOTE_A NOTE_Bb NOTE_B
|
||||
======= ======= ======= ======= ======= ======
|
||||
|
||||
* ``octave`` select octave for note.
|
||||
|
||||
This function will return ``frequency`` configured for the LEDC channel according to note and octave inputs.
|
||||
If ``0`` is returned, error occurs and the LEDC channel was not configured.
|
||||
|
||||
ledcAttachPin
|
||||
*************
|
||||
|
||||
This function is used to attach the pin to the LEDC channel.
|
||||
|
||||
.. code-block:: arduino
|
||||
|
||||
void ledcAttachPin(uint8_t pin, uint8_t chan);
|
||||
|
||||
* ``pin`` select GPIO pin.
|
||||
* ``chan`` select LEDC channel.
|
||||
|
||||
ledcDetachPin
|
||||
*************
|
||||
|
||||
This function is used to detach the pin from LEDC.
|
||||
|
||||
.. code-block:: arduino
|
||||
|
||||
void ledcDetachPin(uint8_t pin);
|
||||
|
||||
* ``pin`` select GPIO pin.
|
||||
|
||||
ledcChangeFrequency
|
||||
*******************
|
||||
|
||||
This function is used to set frequency for the LEDC channel.
|
||||
|
||||
.. code-block:: arduino
|
||||
|
||||
double ledcChangeFrequency(uint8_t chan, double freq, uint8_t bit_num);
|
||||
|
||||
* ``channel`` select LEDC channel.
|
||||
* ``freq`` select frequency of pwm.
|
||||
* ``bit_num`` select resolution for LEDC channel.
|
||||
|
||||
* range is 1-14 bits (1-20 bits for ESP32).
|
||||
|
||||
This function will return ``frequency`` configured for the LEDC channel.
|
||||
If ``0`` is returned, error occurs and the LEDC channel frequency was not set.
|
||||
|
||||
analogWrite
|
||||
***********
|
||||
|
||||
This function is used to write an analog value (PWM wave) on the pin.
|
||||
It is compatible with Arduinos analogWrite function.
|
||||
|
||||
.. code-block:: arduino
|
||||
|
||||
void analogWrite(uint8_t pin, int value);
|
||||
|
||||
* ``pin`` select the GPIO pin.
|
||||
* ``value`` select the duty cycle of pwm.
|
||||
* range is from 0 (always off) to 255 (always on).
|
||||
|
||||
Example Applications
|
||||
********************
|
||||
|
||||
LEDC software fade example:
|
||||
|
||||
.. literalinclude:: ../../../libraries/ESP32/examples/AnalogOut/LEDCSoftwareFade/LEDCSoftwareFade.ino
|
||||
:language: arduino
|
||||
|
||||
LEDC Write RGB example:
|
||||
|
||||
.. literalinclude:: ../../../libraries/ESP32/examples/AnalogOut/ledcWrite_RGB/ledcWrite_RGB.ino
|
||||
:language: arduino
|
||||
84
docs/source/api/sigmadelta.rst
Normal file
84
docs/source/api/sigmadelta.rst
Normal file
|
|
@ -0,0 +1,84 @@
|
|||
##########
|
||||
SigmaDelta
|
||||
##########
|
||||
|
||||
About
|
||||
-----
|
||||
|
||||
ESP32 provides a second-order sigma delta modulation module and 8 (4 for ESP32-C3)
|
||||
independent modulation channels. The channels are capable to output 1-bit
|
||||
signals (output index: 100 ~ 107) with sigma delta modulation.
|
||||
|
||||
========= =============================
|
||||
ESP32 SoC Number of SigmaDelta channels
|
||||
========= =============================
|
||||
ESP32 8
|
||||
ESP32-S2 8
|
||||
ESP32-C3 4
|
||||
ESP32-S3 8
|
||||
========= =============================
|
||||
|
||||
Arduino-ESP32 SigmaDelta API
|
||||
----------------------------
|
||||
|
||||
sigmaDeltaSetup
|
||||
***************
|
||||
|
||||
This function is used to setup the SigmaDelta channel frequency and resolution.
|
||||
|
||||
.. code-block:: arduino
|
||||
|
||||
double ledcSetup(uint8_t channel, double freq, uint8_t resolution_bits);
|
||||
|
||||
* ``pin`` select GPIO pin.
|
||||
* ``channel`` select SigmaDelta channel.
|
||||
* ``freq`` select frequency.
|
||||
|
||||
* range is 1-14 bits (1-20 bits for ESP32).
|
||||
|
||||
This function will return ``frequency`` configured for the SigmaDelta channel.
|
||||
If ``0`` is returned, error occurs and the SigmaDelta channel was not configured.
|
||||
|
||||
sigmaDeltaWrite
|
||||
***************
|
||||
|
||||
This function is used to set duty for the SigmaDelta channel.
|
||||
|
||||
.. code-block:: arduino
|
||||
|
||||
void sigmaDeltaWrite(uint8_t channel, uint8_t duty);
|
||||
|
||||
* ``channel`` select SigmaDelta channel.
|
||||
* ``duty`` select duty to be set for selected channel.
|
||||
|
||||
sigmaDeltaRead
|
||||
**************
|
||||
|
||||
This function is used to get configured duty for the SigmaDelta channel.
|
||||
|
||||
.. code-block:: arduino
|
||||
|
||||
uint8_t sigmaDeltaRead(uint8_t channel)
|
||||
|
||||
* ``channnel`` select SigmaDelta channel.
|
||||
|
||||
This function will return ``duty`` configured for the selected SigmaDelta channel.
|
||||
|
||||
sigmaDeltaDetachPin
|
||||
*******************
|
||||
|
||||
This function is used to detach pin from SigmaDelta.
|
||||
|
||||
.. code-block:: arduino
|
||||
|
||||
void sigmaDeltaDetachPin(uint8_t pin);
|
||||
|
||||
* ``pin`` select GPIO pin.
|
||||
|
||||
Example Applications
|
||||
********************
|
||||
|
||||
Here is example use of SigmaDelta:
|
||||
|
||||
.. literalinclude:: ../../../libraries/ESP32/examples/AnalogOut/SigmaDelta/SigmaDelta.ino
|
||||
:language: arduino
|
||||
377
docs/source/api/timer.rst
Normal file
377
docs/source/api/timer.rst
Normal file
|
|
@ -0,0 +1,377 @@
|
|||
##########
|
||||
Timer
|
||||
##########
|
||||
|
||||
About
|
||||
-----
|
||||
|
||||
The ESP32 SoCs contains from 2 to 4 hardware timers.
|
||||
They are all 64-bit (54-bit for ESP32-C3) generic timers based on 16-bit pre-scalers and 64-bit (54-bit for ESP32-C3)
|
||||
up / down counters which are capable of being auto-reloaded.
|
||||
|
||||
========= ================
|
||||
ESP32 SoC Number of timers
|
||||
========= ================
|
||||
ESP32 4
|
||||
ESP32-S2 4
|
||||
ESP32-C3 2
|
||||
ESP32-S3 4
|
||||
========= ================
|
||||
|
||||
Arduino-ESP32 Timer API
|
||||
----------------------------
|
||||
|
||||
timerBegin
|
||||
**********
|
||||
|
||||
This function is used to configure the timer. After successful setup the timer will automatically start.
|
||||
|
||||
.. code-block:: arduino
|
||||
|
||||
hw_timer_t * timerBegin(uint8_t num, uint16_t divider, bool countUp);
|
||||
|
||||
* ``num`` select timer number.
|
||||
* ``divider`` select timer divider.
|
||||
* ``resolution`` select timer resolution.
|
||||
|
||||
* range is 1-14 bits (1-20 bits for ESP32).
|
||||
|
||||
This function will return ``timer`` structure if configuration is successful.
|
||||
If ``NULL`` is returned, error occurs and the timer was not configured.
|
||||
|
||||
timerEnd
|
||||
********
|
||||
|
||||
This function is used to end timer.
|
||||
|
||||
.. code-block:: arduino
|
||||
|
||||
void timerEnd(hw_timer_t *timer);
|
||||
|
||||
* ``timer`` timer struct.
|
||||
|
||||
timerSetConfig
|
||||
**************
|
||||
|
||||
This function is used to configure initialized timer (timerBegin() called).
|
||||
|
||||
.. code-block:: arduino
|
||||
|
||||
uint32_t timerGetConfig(hw_timer_t *timer);
|
||||
|
||||
* ``timer`` timer struct.
|
||||
|
||||
This function will return ``configuration`` as uint32_t number.
|
||||
This can be translated by inserting it to struct ``timer_cfg_t.val``.
|
||||
|
||||
timerAttachInterrupt
|
||||
********************
|
||||
|
||||
This function is used to attach interrupt to timer.
|
||||
|
||||
.. code-block:: arduino
|
||||
|
||||
void timerAttachInterrupt(hw_timer_t *timer, void (*fn)(void), bool edge);
|
||||
|
||||
* ``timer`` timer struct.
|
||||
* ``fn`` funtion to be called when interrupt is triggered.
|
||||
* ``edge`` select edge to trigger interrupt (only LEVEL trigger is currently supported).
|
||||
|
||||
timerDetachInterrupt
|
||||
********************
|
||||
|
||||
This function is used to detach interrupt from timer.
|
||||
|
||||
.. code-block:: arduino
|
||||
|
||||
void timerDetachInterrupt(hw_timer_t *timer);
|
||||
|
||||
* ``timer`` timer struct.
|
||||
|
||||
timerStart
|
||||
**********
|
||||
|
||||
This function is used to start counter of the timer.
|
||||
|
||||
.. code-block:: arduino
|
||||
|
||||
void timerStart(hw_timer_t *timer);
|
||||
|
||||
* ``timer`` timer struct.
|
||||
|
||||
timerStop
|
||||
*********
|
||||
|
||||
This function is used to stop counter of the timer.
|
||||
|
||||
.. code-block:: arduino
|
||||
|
||||
void timerStop(hw_timer_t *timer);
|
||||
|
||||
* ``timer`` timer struct.
|
||||
|
||||
timerRestart
|
||||
************
|
||||
|
||||
This function is used to restart counter of the timer.
|
||||
|
||||
.. code-block:: arduino
|
||||
|
||||
void timerRestart(hw_timer_t *timer);
|
||||
|
||||
* ``timer`` timer struct.
|
||||
|
||||
timerWrite
|
||||
**********
|
||||
|
||||
This function is used to set counter value of the timer.
|
||||
|
||||
.. code-block:: arduino
|
||||
|
||||
void timerWrite(hw_timer_t *timer, uint64_t val);
|
||||
|
||||
* ``timer`` timer struct.
|
||||
* ``val`` counter value to be set.
|
||||
|
||||
timerSetDivider
|
||||
***************
|
||||
|
||||
This function is used to set the divider of the timer.
|
||||
|
||||
.. code-block:: arduino
|
||||
|
||||
void timerSetDivider(hw_timer_t *timer, uint16_t divider);
|
||||
|
||||
* ``timer`` timer struct.
|
||||
* ``divider`` divider to be set.
|
||||
|
||||
timerSetCountUp
|
||||
***************
|
||||
|
||||
This function is used to configure counting direction of the timer.
|
||||
|
||||
.. code-block:: arduino
|
||||
|
||||
void timerSetCountUp(hw_timer_t *timer, bool countUp);
|
||||
|
||||
* ``timer`` timer struct.
|
||||
* ``countUp`` select counting direction (``true`` = increment).
|
||||
|
||||
timerSetAutoReload
|
||||
******************
|
||||
|
||||
This function is used to set counter value of the timer.
|
||||
|
||||
.. code-block:: arduino
|
||||
|
||||
void timerSetAutoReload(hw_timer_t *timer, bool autoreload);
|
||||
|
||||
* ``timer`` timer struct.
|
||||
* ``autoreload`` select autoreload (``true`` = enabled).
|
||||
|
||||
timerStarted
|
||||
************
|
||||
|
||||
This function is used to get if the timer is running.
|
||||
|
||||
.. code-block:: arduino
|
||||
|
||||
bool timerStarted(hw_timer_t *timer);
|
||||
|
||||
* ``timer`` timer struct.
|
||||
|
||||
This function will return ``true`` if the timer is running. If ``false`` is returned, timer is stopped.
|
||||
|
||||
timerRead
|
||||
*********
|
||||
|
||||
This function is used to read counter value of the timer.
|
||||
|
||||
.. code-block:: arduino
|
||||
|
||||
uint64_t timerRead(hw_timer_t *timer);
|
||||
|
||||
* ``timer`` timer struct.
|
||||
|
||||
This function will return ``counter value`` of the timer.
|
||||
|
||||
timerReadMicros
|
||||
***************
|
||||
|
||||
This function is used to read counter value in microseconds of the timer.
|
||||
|
||||
.. code-block:: arduino
|
||||
|
||||
uint64_t timerReadMicros(hw_timer_t *timer);
|
||||
|
||||
* ``timer`` timer struct.
|
||||
|
||||
This function will return ``counter value`` of the timer in microseconds.
|
||||
|
||||
timerReadMilis
|
||||
**************
|
||||
|
||||
This function is used to read counter value in miliseconds of the timer.
|
||||
|
||||
.. code-block:: arduino
|
||||
|
||||
uint64_t timerReadMilis(hw_timer_t *timer);
|
||||
|
||||
* ``timer`` timer struct.
|
||||
|
||||
This function will return ``counter value`` of the timer in miliseconds.
|
||||
|
||||
timerReadSeconds
|
||||
****************
|
||||
|
||||
This function is used to read counter value in seconds of the timer.
|
||||
|
||||
.. code-block:: arduino
|
||||
|
||||
double timerReadSeconds(hw_timer_t *timer);
|
||||
|
||||
* ``timer`` timer struct.
|
||||
|
||||
This function will return ``counter value`` of the timer in seconds.
|
||||
|
||||
timerGetDivider
|
||||
***************
|
||||
|
||||
This function is used to get divider of the timer.
|
||||
|
||||
.. code-block:: arduino
|
||||
|
||||
uint16_t timerGetDivider(hw_timer_t *timer);
|
||||
|
||||
* ``timer`` timer struct.
|
||||
|
||||
This function will return ``divider`` of the timer.
|
||||
|
||||
timerGetCountUp
|
||||
***************
|
||||
|
||||
This function is used get counting direction of the timer.
|
||||
|
||||
.. code-block:: arduino
|
||||
|
||||
bool timerGetCountUp(hw_timer_t *timer);
|
||||
|
||||
* ``timer`` timer struct.
|
||||
|
||||
This function will return ``true`` if the timer counting direction is UP (incrementing).
|
||||
If ``false`` returned, the timer counting direction is DOWN (decrementing).
|
||||
|
||||
timerGetAutoReload
|
||||
******************
|
||||
|
||||
This function is used to get configuration of auto reload of the timer.
|
||||
|
||||
.. code-block:: arduino
|
||||
|
||||
bool timerGetAutoReload(hw_timer_t *timer);
|
||||
|
||||
* ``timer`` timer struct.
|
||||
|
||||
This function will return ``true`` if the timer auto reload is enabled.
|
||||
If ``false`` returned, the timer auto reload is disabled.
|
||||
|
||||
timerAlarmEnable
|
||||
****************
|
||||
|
||||
This function is used to enable generation of timer alarm events.
|
||||
|
||||
.. code-block:: arduino
|
||||
|
||||
void timerAlarmEnable(hw_timer_t *timer);
|
||||
|
||||
* ``timer`` timer struct.
|
||||
|
||||
timerAlarmDisable
|
||||
*****************
|
||||
|
||||
This function is used to disable generation of timer alarm events.
|
||||
|
||||
.. code-block:: arduino
|
||||
|
||||
void timerAlarmDisable(hw_timer_t *timer);
|
||||
|
||||
* ``timer`` timer struct.
|
||||
|
||||
timerAlarmWrite
|
||||
***************
|
||||
|
||||
This function is used to configure alarm value and autoreload of the timer.
|
||||
|
||||
.. code-block:: arduino
|
||||
|
||||
void timerAlarmWrite(hw_timer_t *timer, uint64_t alarm_value, bool autoreload);
|
||||
|
||||
* ``timer`` timer struct.
|
||||
* ``alarm_value`` alarm value to generate event.
|
||||
* ``autoreload`` enabled/disabled autorealod.
|
||||
|
||||
timerAlarmEnabled
|
||||
*****************
|
||||
|
||||
This function is used to get status of timer alarm.
|
||||
|
||||
.. code-block:: arduino
|
||||
|
||||
bool timerAlarmEnabled(hw_timer_t *timer);
|
||||
|
||||
* ``timer`` timer struct.
|
||||
|
||||
This function will return ``true`` if the timer alarm is enabled.
|
||||
If ``false`` returned, the timer alarm is disabled.
|
||||
|
||||
timerAlarmRead
|
||||
**************
|
||||
|
||||
This function is used to read alarm value of the timer.
|
||||
|
||||
.. code-block:: arduino
|
||||
|
||||
uint64_t timerAlarmRead(hw_timer_t *timer);
|
||||
|
||||
* ``timer`` timer struct.
|
||||
|
||||
timerAlarmReadMicros
|
||||
********************
|
||||
|
||||
This function is used to read alarm value of the timer in microseconds.
|
||||
|
||||
.. code-block:: arduino
|
||||
|
||||
uint64_t timerAlarmReadMicros(hw_timer_t *timer);
|
||||
|
||||
* ``timer`` timer struct.
|
||||
|
||||
This function will return ``alarm value`` of the timer in microseconds.
|
||||
|
||||
timerAlarmReadSeconds
|
||||
*********************
|
||||
|
||||
This function is used to read alarm value of the timer in seconds.
|
||||
|
||||
.. code-block:: arduino
|
||||
|
||||
double timerAlarmReadSeconds(hw_timer_t *timer);
|
||||
|
||||
* ``timer`` timer struct.
|
||||
|
||||
This function will return ``alarm value`` of the timer in seconds.
|
||||
|
||||
Example Applications
|
||||
********************
|
||||
|
||||
There are 2 examples uses of Timer:
|
||||
|
||||
Repeat timer example:
|
||||
|
||||
.. literalinclude:: ../../../libraries/ESP32/examples/Timer/RepeatTimer/RepeatTimer.ino
|
||||
:language: arduino
|
||||
|
||||
Watchdog timer example:
|
||||
|
||||
.. literalinclude:: ../../../libraries/ESP32/examples/Timer/WatchdogTimer/WatchdogTimer.ino
|
||||
:language: arduino
|
||||
|
|
@ -67,6 +67,35 @@ Use static allocation if you want to have more performance and if your applicati
|
|||
|
||||
By default, the memory allocation will be set to **dynamic** if this function is not being used.
|
||||
|
||||
setDualAntennaConfig
|
||||
********************
|
||||
|
||||
Configures the Dual antenna functionallity. This function should be used only on the **ESP32-WROOM-DA** module or any other ESP32 with RF switch.
|
||||
|
||||
.. code-block:: arduino
|
||||
|
||||
bool setDualAntennaConfig(uint8_t gpio_ant1, uint8_t gpio_ant2, wifi_rx_ant_t rx_mode, wifi_tx_ant_t tx_mode);
|
||||
|
||||
|
||||
* ``gpio_ant1`` Configure the GPIO number for the antenna 1 connected to the RF switch (default ``GPIO2`` on ESP32-WROOM-DA)
|
||||
* ``gpio_ant2`` Configure the GPIO number for the antenna 2 connected to the RF switch (default ``GPIO25`` on ESP32-WROOM-DA)
|
||||
* ``rx_mode`` Set the RX antenna mode. See wifi_rx_ant_t for the options.
|
||||
* ``tx_mode`` Set the TX antenna mode. See wifi_tx_ant_t for the options.
|
||||
|
||||
Return ``true`` if the configuration was successful.
|
||||
|
||||
For the ``rx_mode`` you can use the following configuration:
|
||||
|
||||
* ``WIFI_RX_ANT0`` Selects the antenna 1 for all RX activity.
|
||||
* ``WIFI_RX_ANT1`` Selects the antenna 2 for all RX activity.
|
||||
* ``WIFI_RX_ANT_AUTO`` Selects the antenna for RX automatically.
|
||||
|
||||
For the ``tx_mode`` you can use the following configuration:
|
||||
|
||||
* ``WIFI_TX_ANT0`` Selects the antenna 1 for all TX activity.
|
||||
* ``WIFI_TX_ANT1`` Selects the antenna 2 for all TX activity.
|
||||
* ``WIFI_TX_ANT_AUTO`` Selects the antenna for TX automatically.
|
||||
|
||||
WiFiAP
|
||||
------
|
||||
|
||||
|
|
|
|||
|
|
@ -30,7 +30,8 @@ release = '2.0.2'
|
|||
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
|
||||
# ones.
|
||||
extensions = [
|
||||
'sphinx_copybutton'
|
||||
'sphinx_copybutton',
|
||||
'sphinx_tabs.tabs'
|
||||
]
|
||||
|
||||
# Add any paths that contain templates here, relative to this directory.
|
||||
|
|
|
|||
|
|
@ -1,20 +1,31 @@
|
|||
##############################
|
||||
Arduino as a ESP-IDF component
|
||||
##############################
|
||||
###############################
|
||||
Arduino as an ESP-IDF component
|
||||
###############################
|
||||
|
||||
This method is recommended for advanced users. To use this method, you will need to have the ESP-IDF toolchain installed.
|
||||
|
||||
For a simplified method, see `Installing using Boards Manager <https://docs.espressif.com/projects/arduino-esp32/en/latest/installing.html#installing-using-boards-manager>`_.
|
||||
|
||||
ESP32 Arduino lib-builder
|
||||
-------------------------
|
||||
|
||||
For a simplified method, see `lib-builder <https://github.com/espressif/esp32-arduino-lib-builder>`_.
|
||||
If you don't need any modifications in the default Arduino ESP32 core, we recommend you to install using the Boards Manager.
|
||||
|
||||
Arduino Lib Builder is the tool that integrates ESP-IDF into Arduino. It allows you to customize the default settings used by Espressif and try them in Arduino IDE.
|
||||
|
||||
For more information see `Arduino lib builder <https://github.com/espressif/esp32-arduino-lib-builder>`_
|
||||
|
||||
|
||||
Installation
|
||||
------------
|
||||
|
||||
.. note:: Latest Arduino Core ESP32 version is now compatible with `ESP-IDF v4.4 <https://github.com/espressif/esp-idf/tree/release/v4.4>`_. Please consider this compability when using Arduino as component in ESP-IDF.
|
||||
.. note:: Latest Arduino Core ESP32 version is now compatible with `ESP-IDF v4.4 <https://github.com/espressif/esp-idf/tree/release/v4.4>`_. Please consider this compatibility when using Arduino as a component in ESP-IDF.
|
||||
|
||||
- Download and install `ESP-IDF <https://github.com/espressif/esp-idf>`_.
|
||||
- Create blank ESP-IDF project (use sample_project from /examples/get-started) or choose one of the examples.
|
||||
- In the project folder, create a new folder called `components` and clone this repository inside the new created folder.
|
||||
#. Download and install `ESP-IDF <https://github.com/espressif/esp-idf>`_.
|
||||
|
||||
* For more information see `Get Started <https://docs.espressif.com/projects/esp-idf/en/latest/esp32/get-started/index.html#installation-step-by-step>`_.
|
||||
#. Create a blank ESP-IDF project (use sample_project from /examples/get-started) or choose one of the examples.
|
||||
#. In the project folder, create a new folder called ``components`` and clone this repository inside the newly created folder.
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
|
|
@ -26,19 +37,33 @@ Installation
|
|||
cd ../.. && \
|
||||
idf.py menuconfig
|
||||
|
||||
Configuration
|
||||
-------------
|
||||
|
||||
Depending on one of the two following options, in the menuconfig set the appropriate settings.
|
||||
|
||||
Go to the section ``Arduino Configuration --->``
|
||||
|
||||
1. For usage of ``app_main()`` function - Turn off ``Autostart Arduino setup and loop on boot``
|
||||
2. For usage of ``setup()`` and ``loop()`` functions - Turn on ``Autostart Arduino setup and loop on boot``
|
||||
|
||||
Experienced users can explore other options in the Arduino section.
|
||||
|
||||
After the setup you can save and exit:
|
||||
|
||||
- Save [S]
|
||||
- Confirm default filename [Enter]
|
||||
- Close confirmation window [Enter] or [Space] or [Esc]
|
||||
- Quit [Q]
|
||||
|
||||
Option 1. Using Arduino setup() and loop()
|
||||
******************************************
|
||||
|
||||
- The `idf.py menuconfig` has some Arduino options.
|
||||
- Turn on `Autostart Arduino setup and loop on boot`.
|
||||
- In main folder rename file `main.c` to `main.cpp`.
|
||||
- In main folder open file `CMakeList.txt` and change `main.c` to `main.cpp` as described below.
|
||||
- In main folder rename file `main.c` to `main.cpp`.
|
||||
|
||||
.. code-block:: bash
|
||||
- In main folder open file `CMakeList.txt` and change `main.c` to `main.cpp` as described below.
|
||||
|
||||
idf_component_register(SRCS "main.cpp" INCLUDE_DIRS ".")
|
||||
|
||||
- Your main.cpp should be formated like any other sketch.
|
||||
- Your main.cpp should be formatted like any other sketch.
|
||||
|
||||
.. code-block:: c
|
||||
|
||||
|
|
@ -46,7 +71,10 @@ Option 1. Using Arduino setup() and loop()
|
|||
#include "Arduino.h"
|
||||
|
||||
void setup(){
|
||||
Serial.begin(115200);
|
||||
Serial.begin(115200);
|
||||
while(!Serial){
|
||||
; // wait for serial port to connect
|
||||
}
|
||||
}
|
||||
|
||||
void loop(){
|
||||
|
|
@ -57,10 +85,10 @@ Option 1. Using Arduino setup() and loop()
|
|||
Option 2. Using ESP-IDF appmain()
|
||||
*********************************
|
||||
|
||||
- You need to implement ``app_main()`` and call ``initArduino();`` in it.
|
||||
In main.c or 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.
|
||||
If you plan to base your code on examples provided in `examples <https://github.com/espressif/esp-idf/tree/master/examples>`_, please make sure to move the app_main() function in main.cpp from the files in the example.
|
||||
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
|
||||
|
||||
|
|
@ -69,28 +97,39 @@ If you plan to base your code on examples provided in `examples <https://github.
|
|||
|
||||
extern "C" void app_main()
|
||||
{
|
||||
initArduino();
|
||||
pinMode(4, OUTPUT);
|
||||
digitalWrite(4, HIGH);
|
||||
//do your own thing
|
||||
}
|
||||
initArduino();
|
||||
|
||||
- "Disable mutex locks for HAL"
|
||||
- If enabled, there will be no protection on the drivers from concurently accessing them from another thread/interrupt/core
|
||||
- "Autoconnect WiFi on boot"
|
||||
- If enabled, WiFi will start with the last known configuration
|
||||
- Otherwise it will wait for WiFi.begin
|
||||
// Arduino-like setup()
|
||||
Serial.begin(115200);
|
||||
while(!Serial){
|
||||
; // wait for serial port to connect
|
||||
}
|
||||
|
||||
// Arduino-like loop()
|
||||
while(true){
|
||||
Serial.println("loop");
|
||||
}
|
||||
|
||||
// WARNING: if program reaches end of function app_main() the MCU will restart.
|
||||
}
|
||||
|
||||
Build, flash and monitor
|
||||
************************
|
||||
|
||||
- For both options use command ``idf.py -p <your-board-serial-port> flash monitor``
|
||||
- It will build, upload and open serial monitor to your board.
|
||||
|
||||
- The project will build, upload and open the serial monitor to your board
|
||||
|
||||
- Some boards require button combo press on the board: press-and-hold Boot button + press-and-release RST button, release Boot button
|
||||
|
||||
- After a successful flash, you may need to press the RST button again
|
||||
|
||||
- To terminate the serial monitor press [Ctrl] + [ ] ]
|
||||
|
||||
Logging To Serial
|
||||
-----------------
|
||||
|
||||
If you are writing code that does not require Arduino to compile and you want your `ESP_LOGx` macros to work in Arduino IDE, you can enable the compatibility by adding the following lines after:
|
||||
If you are writing code that does not require Arduino to compile and you want your `ESP_LOGx` macros to work in Arduino IDE, you can enable the compatibility by adding the following lines:
|
||||
|
||||
.. code-block:: c
|
||||
|
||||
|
|
@ -107,4 +146,4 @@ To fix that behavior, you need to set FreeRTOS tick rate to 1000Hz in `make menu
|
|||
Compilation Errors
|
||||
------------------
|
||||
|
||||
As commits are made to esp-idf and submodules, the codebases can develop incompatibilities which cause compilation errors. If you have problems compiling, follow the instructions in `Issue #1142 <https://github.com/espressif/arduino-esp32/issues/1142>`_ to roll esp-idf back to a different version.
|
||||
As commits are made to esp-idf and submodules, the codebases can develop incompatibilities that cause compilation errors. If you have problems compiling, follow the instructions in `Issue #1142 <https://github.com/espressif/arduino-esp32/issues/1142>`_ to roll esp-idf back to a different version.
|
||||
|
|
|
|||
|
|
@ -26,6 +26,9 @@ power consumption.
|
|||
|
||||
The ESP32 series is available as a chip or module.
|
||||
|
||||
|
||||
.. _supported_socs:
|
||||
|
||||
Supported SoC's
|
||||
---------------
|
||||
|
||||
|
|
@ -63,6 +66,20 @@ Supported Operating Systems
|
|||
.. |linux-logo| image:: _static/logo_linux.png
|
||||
.. |macos-logo| image:: _static/logo_macos.png
|
||||
|
||||
Supported IDEs
|
||||
---------------------------
|
||||
|
||||
Here is the list of supported IDE for Arduino ESP32 support integration.
|
||||
|
||||
+-------------------+-------------------+
|
||||
| |arduino-logo| | |pio-logo| |
|
||||
+-------------------+-------------------+
|
||||
| Arduino IDE | PlatformIO |
|
||||
+-------------------+-------------------+
|
||||
|
||||
.. |arduino-logo| image:: _static/logo_arduino.png
|
||||
.. |pio-logo| image:: _static/logo_pio.png
|
||||
|
||||
See `Installing Guides <installing.html>`_ for more details on how to install the Arduino ESP32 support.
|
||||
|
||||
Support
|
||||
|
|
|
|||
10
docs/source/guides/guides.rst
Normal file
10
docs/source/guides/guides.rst
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
######
|
||||
Guides
|
||||
######
|
||||
|
||||
.. toctree::
|
||||
:caption: Guides:
|
||||
:maxdepth: 1
|
||||
:glob:
|
||||
|
||||
*
|
||||
248
docs/source/guides/tools_menu.rst
Normal file
248
docs/source/guides/tools_menu.rst
Normal file
|
|
@ -0,0 +1,248 @@
|
|||
######################
|
||||
Arduino IDE Tools Menu
|
||||
######################
|
||||
|
||||
Introduction
|
||||
------------
|
||||
|
||||
This guide is a walkthrough of the Arduino IDE configuration menu for the ESP32 System on Chip (SoC's). In this guide, you will see the most relevant configuration
|
||||
to get your project optimized and working.
|
||||
|
||||
Since some boards and SoC's may vary in terms of hardware configuration, be sure you know all the board characteristics that you are using, like flash memory size, SoC variant (ESP32 family), PSRAM, etc.
|
||||
|
||||
.. note:: To help you identify the characteristics, you can see the `Espressif Product Selector`_.
|
||||
|
||||
Arduino IDE
|
||||
-----------
|
||||
|
||||
The Arduino IDE is widely used for ESP32 on Arduino development and offers a wide variety of configurations.
|
||||
|
||||
Tools Menu
|
||||
----------
|
||||
|
||||
To properly configure your project build and flash, some settings must be done in order to get it compiled and flashed without any issues.
|
||||
Some boards are natively supported and almost no configuration is required. However, if your is not yet supported or you have a custom board, you need to configure the environment by yourself.
|
||||
|
||||
For more details or to add a new board, see the `boards.txt`_ file.
|
||||
|
||||
Generic Options
|
||||
---------------
|
||||
|
||||
Most of the options are available for every ESP32 family. Some options will be available only for specific targets, like the USB configuration.
|
||||
|
||||
Board
|
||||
*****
|
||||
|
||||
This option is the target board and must be selected in order to get all the default configuration settings. Once you select the correct board, you will see that some configurations will be automatically selected, but be aware that some boards can have multiple versions (i.e different flash sizes).
|
||||
|
||||
To select the board, go to ``Tools -> Board -> ESP32 Arduino`` and select the target board.
|
||||
|
||||
If your board is not present on this list, you can select the generic ``ESP32-XX Dev Module``.
|
||||
|
||||
Currently, we have one generic development module for each of the supported targets.
|
||||
|
||||
If the board selected belongs to another SoC family, you will see the following information at the build output:
|
||||
|
||||
``A fatal error occurred: This chip is ESP32 not ESP32-S2. Wrong --chip argument?``
|
||||
|
||||
Upload Speed
|
||||
************
|
||||
|
||||
To select the flashing speed, change the ``Tools -> Upload Speed``. This value will be used for flashing the code to the device.
|
||||
|
||||
.. note:: If you have issues while flashing the device at high speed, try to decrease this value. This could be due to the external serial-to-USB chip limitations.
|
||||
|
||||
CPU Frequency
|
||||
*************
|
||||
|
||||
On this option, you can select the CPU clock frequency. This option is critical and must be selected according to the high-frequency crystal present on the board and the radio usage (Wi-Fi and Bluetooth).
|
||||
|
||||
In some applications, reducing the CPU clock frequency is recommended in order to reduce power consumption.
|
||||
|
||||
If you don't know why you should change this frequency, leave the default option.
|
||||
|
||||
Flash Frequency
|
||||
***************
|
||||
|
||||
Use this function to select the flash memory frequency. The frequency will be dependent on the memory model.
|
||||
|
||||
* **40MHz**
|
||||
* **80MHz**
|
||||
|
||||
If you don't know if your memory supports **80Mhz**, you can try to upload the sketch using the **80MHz** option and watch the log output via the serial monitor.
|
||||
|
||||
.. note:: In some boards/SoC, the flash frequency is automatically selected according to the flash mode. In some cases (i.e ESP32-S3), the flash frequency is up to 120MHz.
|
||||
|
||||
Flash Mode
|
||||
**********
|
||||
|
||||
This option is used to select the SPI communication mode with the flash memory.
|
||||
|
||||
Depending on the application, this mode can be changed in order to increase the flash communication speed.
|
||||
|
||||
* **QIO** - Quad I/O Fast Read
|
||||
* Four SPI pins are used to write to the flash and to read from the flash.
|
||||
|
||||
* **DIO** - Dual I/O Fast Read
|
||||
* Two SPI pins are used to write to the flash and to read from the flash.
|
||||
|
||||
* **QOUT** - Quad Output Fast Read
|
||||
* Four SPI pins are used to read the flash data.
|
||||
|
||||
* **DOUT** - Dual Output Fast Read
|
||||
* Two SPI pins are used to read flash data.
|
||||
|
||||
* **OPI** - Octal I/O
|
||||
* Eight SPI pins are used to write and to read from the flash.
|
||||
|
||||
If you don't know how the board flash is physically connected or the flash memory model, try the **QIO** at **80MHz** first.
|
||||
|
||||
Flash Size
|
||||
**********
|
||||
|
||||
This option is used to select the flash size. The flash size should be selected according to the flash model used on your board.
|
||||
|
||||
* **2MB** (16Mb)
|
||||
* **4MB** (32Mb)
|
||||
* **8MB** (64Mb)
|
||||
* **16MB** (128Mb)
|
||||
|
||||
If you choose the wrong size, you may have issues when selecting the partition scheme.
|
||||
|
||||
Embedded Flash
|
||||
^^^^^^^^^^^^^^
|
||||
|
||||
Some SoC has embedded flash. The ESP32-S3 is a good example.
|
||||
|
||||
.. note:: Check the manufacturer part number of your SoC/module to see the right version.
|
||||
|
||||
Example: **ESP32-S3FH4R2**
|
||||
|
||||
This particular ESP32-S3 variant comes with 4MB Flash and 2MB PSRAM.
|
||||
|
||||
**Options for Embedded Flash**
|
||||
|
||||
* **Fx4** 4MB Flash (*QIO*)
|
||||
* **Fx8** 8MB Flash (*QIO*)
|
||||
* **V** 1.8V SPI
|
||||
|
||||
The **x** stands for the temperature range specification.
|
||||
|
||||
* **H** High Temperature (*-40 to 85ºC*)
|
||||
* **N** Low Temeprature (*-40 to 65ºC*)
|
||||
|
||||
For more details, please see the corresponding datasheet at `Espressif Product Selector`_.
|
||||
|
||||
Partition Scheme
|
||||
****************
|
||||
|
||||
This option is used to select the partition model according to the flash size and the resources needed, like storage area and OTA (Over The Air updates).
|
||||
|
||||
.. note:: Be careful selecting the right partition according to the flash size. If you select the wrong partition, the system will crash.
|
||||
|
||||
Core Debug Level
|
||||
****************
|
||||
|
||||
This option is used to select the Arduino core debugging level to be printed to the serial debug.
|
||||
|
||||
* **None** - Prints nothing.
|
||||
* **Error** - Only at error level.
|
||||
* **Warning** - Only at warning level and above.
|
||||
* **Info** - Only at info level and above.
|
||||
* **Debug** - Only at debug level and above.
|
||||
* **Verbose** - Prints everything.
|
||||
|
||||
PSRAM
|
||||
*****
|
||||
|
||||
The PSRAM is an internal or external extended RAM present on some boards, modules or SoC.
|
||||
|
||||
This option can be used to ``Enable`` or ``Disable`` PSRAM. In some SoCs, you can select the PSRAM mode as the following.
|
||||
|
||||
* **QSPI PSRAM** - Quad PSRAM
|
||||
* **OPI PSRAM** - Octal PSRAM
|
||||
|
||||
Embedded PSRAM
|
||||
^^^^^^^^^^^^^^
|
||||
|
||||
Some SoC has embedded PSRAM. The ESP32-S3 is a good example.
|
||||
|
||||
Example: **ESP32-S3FH4R2**
|
||||
|
||||
This particular ESP32-S3 comes with 4MB Flash and 2MB PSRAM.
|
||||
|
||||
**Options for Embedded Flash and PSRAM**
|
||||
|
||||
* **R2** 2MB PSRAM (*QSPI*)
|
||||
* **R8** 8MB PSRAM (*OPI*)
|
||||
* **V** 1.8V SPI
|
||||
|
||||
The **x** stands for the temperature range specification.
|
||||
|
||||
* **H** High Temperature (*-40 to 85ºC*)
|
||||
* **N** Low Temeprature (*-40 to 65ºC*)
|
||||
|
||||
For more details, please see the corresponding datasheet at `Espressif Product Selector`_.
|
||||
|
||||
Arduino Runs On
|
||||
***************
|
||||
|
||||
This function is used to select the core that runs the Arduino core. This is only valid if the target SoC has 2 cores.
|
||||
|
||||
When you have some heavy task running, you might want to run this task on a different core than the Arduino tasks. For this reason, you have this configuration to select the right core.
|
||||
|
||||
Events Run On
|
||||
*************
|
||||
|
||||
This function is also used to select the core that runs the Arduino events. This is only valid if the target SoC has 2 cores.
|
||||
|
||||
Port
|
||||
****
|
||||
|
||||
This option is used to select the serial port to be used on the flashing and monitor.
|
||||
|
||||
USB Options
|
||||
-----------
|
||||
|
||||
Some ESP32 families have a USB peripheral. This peripheral can be used for flashing and debugging.
|
||||
|
||||
To see the supported list for each SoC, see this section: `Libraries <../libraries.html>`_.
|
||||
|
||||
The USB option will be available only if the correct target is selected.
|
||||
|
||||
USB CDC On Boot
|
||||
***************
|
||||
|
||||
The USB Communications Device Class, or USB CDC, is a class used for basic communication to be used as a regular serial controller (like RS-232).
|
||||
|
||||
This class is used for flashing the device without any other external device attached to the SoC.
|
||||
|
||||
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 serial port will appear in the list of the serial ports.
|
||||
Use this new serial port for flashing the device.
|
||||
|
||||
This option can be used as well for debugging via the ``Serial Monitor`` using **CDC** instead of the **UART0**.
|
||||
|
||||
To use the UART as serial output, you can use ``Serial0.print("Hello World!");`` instead of ``Serial.print("Hello World!");`` which will be printed using USB CDC.
|
||||
|
||||
USB Firmware MSC On Boot
|
||||
************************
|
||||
|
||||
The USB Mass Storage Class, or USB MSC, is a class used for storage devices, like a USB flash drive.
|
||||
|
||||
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
|
||||
:align: center
|
||||
:width: 720
|
||||
:figclass: align-center
|
||||
|
||||
USB DFU On Boot
|
||||
***************
|
||||
|
||||
The USB Device Firmware Upgrade is a class used for flashing the device through USB.
|
||||
|
||||
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, the device will appear as a USB DFU capable device.
|
||||
|
||||
.. _Espressif Product Selector: https://products.espressif.com/
|
||||
.. _boards.txt: https://github.com/espressif/arduino-esp32/blob/master/boards.txt
|
||||
|
|
@ -13,6 +13,7 @@ Here you will find all the relevant information about the project.
|
|||
|
||||
Getting Started <getting_started>
|
||||
Libraries <libraries>
|
||||
Guides <guides/guides>
|
||||
Tutorials <tutorials/tutorials>
|
||||
Advanced Utilities <advanced_utils>
|
||||
FAQ <faq>
|
||||
|
|
|
|||
|
|
@ -7,16 +7,21 @@ This guide will show how to install the Arduino-ESP32 support.
|
|||
Before Installing
|
||||
-----------------
|
||||
|
||||
We recommend you install the support using the Boards Manager, but other options are available depending on your operating system.
|
||||
We recommend you install the support using your favorite IDE, but other options are available depending on your operating system.
|
||||
To install Arduino-ESP32 support, you can use one of the following options.
|
||||
|
||||
Installing using Boards Manager
|
||||
-------------------------------
|
||||
Installing using Arduino IDE
|
||||
----------------------------
|
||||
|
||||
This is the preferred and easiest way to install Arduino-ESP32.
|
||||
.. figure:: _static/logo_arduino.png
|
||||
:align: center
|
||||
:width: 200
|
||||
:figclass: align-center
|
||||
|
||||
This is the way to install Arduino-ESP32 directly from the Arduino IDE.
|
||||
|
||||
.. note::
|
||||
Currently, the support for new chips (ESP32-S2 and ESP32-C3) is in the development release. Consider installing the development release if you need to test the new supported SoC in beta.
|
||||
For overview of SoC's support, take a look on `Supported Soc's table <https://docs.espressif.com/projects/arduino-esp32/en/latest/getting_started.html#supported-soc-s>`_ where you can find if the particular chip is under stable or development release.
|
||||
|
||||
- Stable release link::
|
||||
|
||||
|
|
@ -58,8 +63,70 @@ To start the installation process using the Boards Managaer, follow these steps:
|
|||
|
||||
- Restart Arduino IDE.
|
||||
|
||||
Windows
|
||||
-------
|
||||
Installing using PlatformIO
|
||||
---------------------------
|
||||
|
||||
.. figure:: _static/logo_pio.png
|
||||
:align: center
|
||||
:width: 200
|
||||
:figclass: align-center
|
||||
|
||||
PlatformIO is one of most popular embedded development tool. Currently, it supports Arduino ESP32 and ESP-IDF from Espressif (other platforms are also supported).
|
||||
|
||||
To install PIO, you can follow this Getting Started, provided by PIO at `docs.platformio.org`_.
|
||||
|
||||
To test the latest Arduino ESP32, you need to change your project *platform.ini* accordingly.
|
||||
|
||||
- Start a new project and select one of the available board. You can change after by changing the *platform.ini* file.
|
||||
|
||||
- For ESP32
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
[env:arduino-esp32]
|
||||
platform = https://github.com/platformio/platform-espressif32.git#feature/arduino-upstream
|
||||
board = esp32dev
|
||||
framework = arduino
|
||||
platform_packages =
|
||||
framework-arduinoespressif32 @ https://github.com/espressif/arduino-esp32#master
|
||||
|
||||
- For ESP32-S2 (ESP32-S2-Saola-1 board)
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
[env:arduino-esp32s2]
|
||||
platform = https://github.com/platformio/platform-espressif32.git#feature/arduino-upstream
|
||||
board = esp32-s2-saola-1
|
||||
framework = arduino
|
||||
platform_packages =
|
||||
framework-arduinoespressif32 @ https://github.com/espressif/arduino-esp32#master
|
||||
|
||||
- For ESP32-C3 (ESP32-S3-DevKitM-1 board)
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
[env:arduino-esp32c3]
|
||||
platform = https://github.com/platformio/platform-espressif32.git#feature/arduino-upstream
|
||||
board = esp32-c3-devkitm-1
|
||||
framework = arduino
|
||||
platform_packages =
|
||||
framework-arduinoespressif32 @ https://github.com/espressif/arduino-esp32#master
|
||||
|
||||
Now you're able to use the latest Arduino ESP32 support directly from Espressif GitHub repository.
|
||||
|
||||
To get more information about PlatformIO, see the following links:
|
||||
|
||||
- `PlatformIO Core (CLI) <https://docs.platformio.org/en/latest/core/index.html>`_
|
||||
|
||||
- `PlatformIO Home <https://docs.platformio.org/en/latest/home/index.html>`_
|
||||
|
||||
- `Tutorials and Examples <https://docs.platformio.org/en/latest/tutorials/index.html>`_
|
||||
|
||||
- `Library Management <https://docs.platformio.org/en/latest/librarymanager/index.html>`_
|
||||
|
||||
|
||||
Windows (manual installation)
|
||||
-----------------------------
|
||||
|
||||
.. warning:: Arduino ESP32 core v2.x.x cannot be used on Windows 8.x x86 (32 bits), Windows 7 or earlier. The Windows 32 bits OS is no longer supported by this toolchain.
|
||||
|
||||
|
|
@ -150,6 +217,11 @@ How to update to the latest code
|
|||
Linux
|
||||
-----
|
||||
|
||||
.. figure:: _static/logo_linux.png
|
||||
:align: center
|
||||
:width: 200
|
||||
:figclass: align-center
|
||||
|
||||
Debian/Ubuntu
|
||||
*************
|
||||
|
||||
|
|
@ -263,20 +335,5 @@ Where ``~/Documents/Arduino`` represents your sketch book location as per "Ardui
|
|||
|
||||
- Restart Arduino IDE.
|
||||
|
||||
PlatformIO
|
||||
----------
|
||||
|
||||
- `What is PlatformIO? <https://docs.platformio.org/en/latest/what-is-platformio.html?utm_source=github&utm_medium=arduino-esp32>`_
|
||||
|
||||
- `PlatformIO IDE <https://platformio.org/platformio-ide?utm_source=github&utm_medium=arduino-esp32>`_
|
||||
|
||||
- `PlatformIO Core <https://docs.platformio.org/en/latest/core.html?utm_source=github&utm_medium=arduino-esp32>`_
|
||||
|
||||
- `Advanced usage <https://docs.platformio.org/en/latest/platforms/espressif32.html?utm_source=github&utm_medium=arduino-esp32>`_: Custom settings, uploading to SPIFFS, Over-the-Air (OTA), staging version
|
||||
|
||||
- `Integration with Cloud and Standalone IDEs <https://docs.platformio.org/en/latest/ide.html?utm_source=github&utm_medium=arduino-esp32>`_: Cloud9, Codeanywhere, Eclipse Che (Codenvy), Atom, CLion, Eclipse, Emacs, NetBeans, Qt Creator, Sublime Text, VIM, Visual Studio, and VSCode
|
||||
|
||||
- `Project Examples <https://docs.platformio.org/en/latest/platforms/espressif32.html?utm_source=github&utm_medium=arduino-esp32#examples>`_
|
||||
|
||||
|
||||
.. _Arduino.cc: https://www.arduino.cc/en/Main/Software
|
||||
.. _docs.platformio.org: https://docs.platformio.org/en/latest/integration/ide/pioide.html
|
||||
|
|
|
|||
|
|
@ -2,37 +2,178 @@
|
|||
Library Builder
|
||||
###############
|
||||
|
||||
How to Use Library Builder
|
||||
--------------------------
|
||||
About
|
||||
-----
|
||||
|
||||
Espressif has provided a `tool <https://github.com/espressif/esp32-arduino-lib-builder>`_ to simplify building your own compiled libraries for use in Arduino IDE (or your favorite IDE).
|
||||
To generate custom libraries, follow these steps:
|
||||
Espressif provides a `tool <https://github.com/espressif/esp32-arduino-lib-builder>`_ to simplify building your own compiled libraries for use in Arduino IDE (or your favorite IDE).
|
||||
|
||||
This tool can be used to change the project or a specific configuration according to your needs.
|
||||
|
||||
- Step 1 - Clone the ESP32 Arduino lib builder::
|
||||
Installing
|
||||
----------
|
||||
|
||||
To install the Library Builder into your environment, please, follow the instructions below.
|
||||
|
||||
- Clone the ESP32 Arduino lib builder:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
git clone https://github.com/espressif/esp32-arduino-lib-builder
|
||||
|
||||
- Step 2 - Go to the ``esp32-arduino-lib-builder`` folder::
|
||||
- Go to the ``esp32-arduino-lib-builder`` folder:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
cd esp32-arduino-lib-builder
|
||||
|
||||
- Step 3 - Run the ``update-components`` script::
|
||||
- Build:
|
||||
|
||||
./tools/update-components.sh`
|
||||
.. code-block:: bash
|
||||
|
||||
- Step 4 - Run ``install-esp-idf`` installation script (if you already have an ``$IDF_PATH`` defined, it will use your local copy of the repository)::
|
||||
./build.sh
|
||||
|
||||
./tools/install-esp-idf.sh
|
||||
If everything works, you may see the following message: ``Successfully created esp32 image.``
|
||||
|
||||
- Step 5 - Copy the configuration (recommended) or directly edit sdkconfig using ``idf.py menuconfig``::
|
||||
Dependencies
|
||||
************
|
||||
|
||||
cp sdkconfig.esp32s2 sdkconfig
|
||||
To build the library you will need to install some dependencies. Maybe you already have installed it, but it is a good idea to check before building.
|
||||
|
||||
- Step 6 - Build::
|
||||
- Install all dependencies (**Ubuntu**):
|
||||
|
||||
idf.py build
|
||||
.. code-block:: bash
|
||||
|
||||
The script automates the process of building `Arduino as an ESP-IDF component <https://github.com/espressif/arduino-esp32/blob/master/docs/esp-idf_component.md>`_.
|
||||
Once it is complete, you can cherry pick the needed libraries from ``out/tools/sdk/lib``, or run ``tools/copy-to-arduino.sh`` to copy the entire built system.
|
||||
``tools/config.sh`` contains a number of variables that control the process, particularly the ``$IDF_BRANCH`` variable. You can adjust this to try building against newer versions, but there are absolutely no guarantees that any components will work or even successfully compile against a newer IDF.
|
||||
sudo apt-get install git wget curl libssl-dev libncurses-dev flex bison gperf cmake ninja-build ccache jq
|
||||
|
||||
- Install Python and upgrade pip:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
sudo apt-get install python3
|
||||
sudo pip install --upgrade pip
|
||||
|
||||
- Install all required packages:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
pip install --user setuptools pyserial click cryptography future pyparsing pyelftools
|
||||
|
||||
Building
|
||||
--------
|
||||
|
||||
If you have all the dependencies met, it is time to build the libraries.
|
||||
|
||||
To build using the default configuration:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
./build.sh
|
||||
|
||||
Custom Build
|
||||
************
|
||||
|
||||
There are some options to help you create custom libraries. You can use the following options:
|
||||
|
||||
Usage
|
||||
^^^^^
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
build.sh [-s] [-A arduino_branch] [-I idf_branch] [-i idf_commit] [-c path] [-t <target>] [-b <build|menuconfig|idf_libs|copy_bootloader|mem_variant>] [config ...]
|
||||
|
||||
Skip Install/Update
|
||||
^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
Skip installing/updating of ESP-IDF and all components
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
./build.sh -s
|
||||
|
||||
This option can be used if you already have the ESP-IDF and all components already in your environment.
|
||||
|
||||
Set Arduino-ESP32 Branch
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
Set which branch of arduino-esp32 to be used for compilation
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
./build.sh -A <arduino_branch>
|
||||
|
||||
Set ESP-IDF Branch
|
||||
^^^^^^^^^^^^^^^^^^
|
||||
|
||||
Set which branch of ESP-IDF is to be used for compilation
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
./build.sh -I <idf_branch>
|
||||
|
||||
Set the ESP-IDF Commit
|
||||
^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
Set which commit of ESP-IDF to be used for compilation
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
./build.sh -i <idf_commit>
|
||||
|
||||
Deploy
|
||||
^^^^^^
|
||||
|
||||
Deploy the build to github arduino-esp32
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
./build.sh -d
|
||||
|
||||
Set the Arduino-ESP32 Destination Folder
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
Set the arduino-esp32 folder to copy the result to. ex. '$HOME/Arduino/hardware/espressif/esp32'
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
./build.sh -c <path>
|
||||
|
||||
This function is used to copy the compiled libraries to the Arduino folder.
|
||||
|
||||
Set the Target
|
||||
^^^^^^^^^^^^^^
|
||||
|
||||
Set the build target(chip). ex. 'esp32s3'
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
./build.sh -t <target>
|
||||
|
||||
This build command will build for the ESP32-S3 target. You can specify other targets.
|
||||
|
||||
* esp32
|
||||
* esp32s2
|
||||
* esp32c3
|
||||
* esp32s3
|
||||
|
||||
Set Build Type
|
||||
^^^^^^^^^^^^^^
|
||||
|
||||
Set the build type. ex. 'build' to build the project and prepare for uploading to a board.
|
||||
|
||||
.. note:: This command depends on the ``-t`` argument.
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
./build.sh -t esp32 -b <build|menuconfig|idf_libs|copy_bootloader|mem_variant>
|
||||
|
||||
Additional Configuration
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
Specify additional configs to be applied. ex. 'qio 80m' to compile for QIO Flash@80MHz. Requires -b
|
||||
|
||||
.. note:: This command requires the ``-b`` to work properly.
|
||||
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
./build.sh -t esp32 -b idf_libs qio 80m
|
||||
|
|
|
|||
|
|
@ -3,10 +3,8 @@ Tutorials
|
|||
#########
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 2
|
||||
:caption: Tutorials:
|
||||
:maxdepth: 1
|
||||
:glob:
|
||||
|
||||
Blink <blink>
|
||||
Basic <basic>
|
||||
DFU <dfu>
|
||||
GPIO Matrix and Pin Mux <io_mux>
|
||||
*
|
||||
|
|
|
|||
|
|
@ -67,7 +67,7 @@ struct DNSHeader
|
|||
struct DNSQuestion
|
||||
{
|
||||
uint8_t QName[256] ; //need 1 Byte for zero termination!
|
||||
uint8_t QNameLength ;
|
||||
uint16_t QNameLength ;
|
||||
uint16_t QType ;
|
||||
uint16_t QClass ;
|
||||
} ;
|
||||
|
|
|
|||
|
|
@ -13,8 +13,8 @@
|
|||
// use first channel of 16 channels (started from zero)
|
||||
#define LEDC_CHANNEL_0 0
|
||||
|
||||
// use 13 bit precission for LEDC timer
|
||||
#define LEDC_TIMER_13_BIT 13
|
||||
// use 12 bit precission for LEDC timer
|
||||
#define LEDC_TIMER_12_BIT 12
|
||||
|
||||
// use 5000 Hz as a LEDC base frequency
|
||||
#define LEDC_BASE_FREQ 5000
|
||||
|
|
@ -28,8 +28,8 @@ int fadeAmount = 5; // how many points to fade the LED by
|
|||
// Arduino like analogWrite
|
||||
// value has to be between 0 and valueMax
|
||||
void ledcAnalogWrite(uint8_t channel, uint32_t value, uint32_t valueMax = 255) {
|
||||
// calculate duty, 8191 from 2 ^ 13 - 1
|
||||
uint32_t duty = (8191 / valueMax) * min(value, valueMax);
|
||||
// calculate duty, 4095 from 2 ^ 12 - 1
|
||||
uint32_t duty = (4095 / valueMax) * min(value, valueMax);
|
||||
|
||||
// write duty to LEDC
|
||||
ledcWrite(channel, duty);
|
||||
|
|
@ -37,7 +37,7 @@ void ledcAnalogWrite(uint8_t channel, uint32_t value, uint32_t valueMax = 255) {
|
|||
|
||||
void setup() {
|
||||
// Setup timer and attach timer to a led pin
|
||||
ledcSetup(LEDC_CHANNEL_0, LEDC_BASE_FREQ, LEDC_TIMER_13_BIT);
|
||||
ledcSetup(LEDC_CHANNEL_0, LEDC_BASE_FREQ, LEDC_TIMER_12_BIT);
|
||||
ledcAttachPin(LED_PIN, LEDC_CHANNEL_0);
|
||||
}
|
||||
|
||||
|
|
|
|||
19
libraries/ESP32/examples/AnalogRead/AnalogRead.ino
Normal file
19
libraries/ESP32/examples/AnalogRead/AnalogRead.ino
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
void setup() {
|
||||
// initialize serial communication at 115200 bits per second:
|
||||
Serial.begin(115200);
|
||||
|
||||
//set the resolution to 12 bits (0-4096)
|
||||
analogReadResolution(12);
|
||||
}
|
||||
|
||||
void loop() {
|
||||
// read the analog / millivolts value for pin 2:
|
||||
int analogValue = analogRead(2);
|
||||
int analogVolts = analogReadMilliVolts(2);
|
||||
|
||||
// print out the values you read:
|
||||
Serial.printf("ADC analog value = %d\n",analogValue);
|
||||
Serial.printf("ADC millivolts value = %d\n",analogVolts);
|
||||
|
||||
delay(100); // delay in between reads for clear read from serial
|
||||
}
|
||||
|
|
@ -17,7 +17,6 @@
|
|||
#include "img_converters.h"
|
||||
#include "fb_gfx.h"
|
||||
#include "driver/ledc.h"
|
||||
//#include "camera_index.h"
|
||||
#include "sdkconfig.h"
|
||||
#include "camera_index.h"
|
||||
|
||||
|
|
|
|||
|
|
@ -19,6 +19,8 @@
|
|||
#include "esp32s2/rom/rtc.h"
|
||||
#elif CONFIG_IDF_TARGET_ESP32C3
|
||||
#include "esp32c3/rom/rtc.h"
|
||||
#elif CONFIG_IDF_TARGET_ESP32S3
|
||||
#include "esp32s3/rom/rtc.h"
|
||||
#else
|
||||
#error Target CONFIG_IDF_TARGET is not supported
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -245,6 +245,8 @@ bool ETHClass::begin(uint8_t phy_addr, int power, int mdc, int mdio, eth_phy_typ
|
|||
#endif
|
||||
#if CONFIG_ETH_USE_ESP32_EMAC
|
||||
eth_mac_config_t mac_config = ETH_MAC_DEFAULT_CONFIG();
|
||||
mac_config.clock_config.rmii.clock_mode = (eth_clock_mode) ? EMAC_CLK_OUT : EMAC_CLK_EXT_IN;
|
||||
mac_config.clock_config.rmii.clock_gpio = (1 == eth_clock_mode) ? EMAC_APPL_CLK_OUT_GPIO : (2 == eth_clock_mode) ? EMAC_CLK_OUT_GPIO : (3 == eth_clock_mode) ? EMAC_CLK_OUT_180_GPIO : EMAC_CLK_IN_GPIO;
|
||||
mac_config.smi_mdc_gpio_num = mdc;
|
||||
mac_config.smi_mdio_gpio_num = mdio;
|
||||
mac_config.sw_reset_timeout_ms = 1000;
|
||||
|
|
@ -305,7 +307,7 @@ bool ETHClass::begin(uint8_t phy_addr, int power, int mdc, int mdio, eth_phy_typ
|
|||
|
||||
eth_handle = NULL;
|
||||
esp_eth_config_t eth_config = ETH_DEFAULT_CONFIG(eth_mac, eth_phy);
|
||||
eth_config.on_lowlevel_init_done = on_lowlevel_init_done;
|
||||
//eth_config.on_lowlevel_init_done = on_lowlevel_init_done;
|
||||
//eth_config.on_lowlevel_deinit_done = on_lowlevel_deinit_done;
|
||||
if(esp_eth_driver_install(ð_config, ð_handle) != ESP_OK || eth_handle == NULL){
|
||||
log_e("esp_eth_driver_install failed");
|
||||
|
|
@ -386,7 +388,7 @@ bool ETHClass::config(IPAddress local_ip, IPAddress gateway, IPAddress subnet, I
|
|||
{
|
||||
esp_err_t err = ESP_OK;
|
||||
tcpip_adapter_ip_info_t info;
|
||||
|
||||
|
||||
if(local_ip != (uint32_t)0x00000000 && local_ip != INADDR_NONE){
|
||||
info.ip.addr = static_cast<uint32_t>(local_ip);
|
||||
info.gw.addr = static_cast<uint32_t>(gateway);
|
||||
|
|
|
|||
|
|
@ -386,9 +386,7 @@ void HTTPClient::disconnect(bool preserveClient)
|
|||
if(connected()) {
|
||||
if(_client->available() > 0) {
|
||||
log_d("still data in buffer (%d), clean up.\n", _client->available());
|
||||
while(_client->available() > 0) {
|
||||
_client->read();
|
||||
}
|
||||
_client->flush();
|
||||
}
|
||||
|
||||
if(_reuse && _canReuse) {
|
||||
|
|
@ -1543,6 +1541,10 @@ void HTTPClient::clearAllCookies()
|
|||
|
||||
void HTTPClient::setCookie(String date, String headerValue)
|
||||
{
|
||||
if (!_cookieJar)
|
||||
{
|
||||
return;
|
||||
}
|
||||
#define HTTP_TIME_PATTERN "%a, %d %b %Y %H:%M:%S"
|
||||
|
||||
Cookie cookie;
|
||||
|
|
@ -1574,7 +1576,7 @@ void HTTPClient::setCookie(String date, String headerValue)
|
|||
value = headerValue.substring(pos1, pos2);
|
||||
else
|
||||
value = headerValue.substring(pos1);
|
||||
|
||||
|
||||
strptime(value.c_str(), HTTP_TIME_PATTERN, &tm);
|
||||
cookie.expires.date = mktime(&tm);
|
||||
cookie.expires.valid = true;
|
||||
|
|
@ -1589,7 +1591,7 @@ void HTTPClient::setCookie(String date, String headerValue)
|
|||
value = headerValue.substring(pos1, pos2);
|
||||
else
|
||||
value = headerValue.substring(pos1);
|
||||
|
||||
|
||||
cookie.max_age.duration = value.toInt();
|
||||
cookie.max_age.valid = true;
|
||||
}
|
||||
|
|
@ -1639,10 +1641,10 @@ void HTTPClient::setCookie(String date, String headerValue)
|
|||
// overwrite or delete cookie in/from cookie jar
|
||||
time_t now_local = time(NULL);
|
||||
time_t now_gmt = mktime(gmtime(&now_local));
|
||||
|
||||
|
||||
bool found = false;
|
||||
|
||||
for (auto c = _cookieJar->begin(); c != _cookieJar->end(); ++c) {
|
||||
for (auto c = _cookieJar->begin(); c != _cookieJar->end(); ++c) {
|
||||
if (c->domain == cookie.domain && c->name == cookie.name) {
|
||||
// when evaluating, max-age takes precedence over expires if both are defined
|
||||
if ((cookie.max_age.valid && ((cookie.date + cookie.max_age.duration) < now_gmt)) || cookie.max_age.duration <= 0
|
||||
|
|
@ -1670,6 +1672,10 @@ bool HTTPClient::generateCookieString(String *cookieString)
|
|||
*cookieString = "";
|
||||
bool found = false;
|
||||
|
||||
if (!_cookieJar)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
for (auto c = _cookieJar->begin(); c != _cookieJar->end(); ++c) {
|
||||
if ((c->max_age.valid && ((c->date + c->max_age.duration) < now_gmt)) || (!c->max_age.valid && c->expires.valid && c->expires.date < now_gmt)) {
|
||||
_cookieJar->erase(c);
|
||||
|
|
@ -1682,5 +1688,6 @@ bool HTTPClient::generateCookieString(String *cookieString)
|
|||
found = true;
|
||||
}
|
||||
}
|
||||
|
||||
return found;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -114,4 +114,4 @@ esp_err_t RMakerClass::enableOTA(ota_type_t type, const char *cert)
|
|||
}
|
||||
|
||||
RMakerClass RMaker;
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -206,4 +206,4 @@ esp_err_t Device::updateAndReportParam(const char *param_name, const char *my_va
|
|||
}
|
||||
return ESP_OK;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -30,4 +30,4 @@ esp_err_t Param::updateAndReport(param_val_t val)
|
|||
}
|
||||
return err;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD
|
||||
// Copyright 2015-2021 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.
|
||||
|
|
@ -12,29 +12,77 @@
|
|||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#include "pins_arduino.h"
|
||||
#include "SD_MMC.h"
|
||||
#if !defined(CONFIG_IDF_TARGET_ESP32S2) && !defined(CONFIG_IDF_TARGET_ESP32C3) //SDMMC does not work on ESP32S2
|
||||
#ifdef SOC_SDMMC_HOST_SUPPORTED
|
||||
#include "vfs_api.h"
|
||||
|
||||
extern "C" {
|
||||
#include <sys/unistd.h>
|
||||
#include <sys/stat.h>
|
||||
#include <dirent.h>
|
||||
#include "esp_vfs_fat.h"
|
||||
#include "driver/sdmmc_host.h"
|
||||
#include "driver/sdmmc_defs.h"
|
||||
#include "sdmmc_cmd.h"
|
||||
}
|
||||
#include "soc/sdmmc_pins.h"
|
||||
#include "ff.h"
|
||||
|
||||
using namespace fs;
|
||||
/*
|
||||
|
||||
*/
|
||||
|
||||
SDMMCFS::SDMMCFS(FSImplPtr impl)
|
||||
: FS(impl), _card(NULL)
|
||||
{}
|
||||
: FS(impl), _card(nullptr)
|
||||
{
|
||||
#if defined(SOC_SDMMC_USE_GPIO_MATRIX) && defined(BOARD_HAS_SDMMC)
|
||||
_pin_clk = SDMMC_CLK;
|
||||
_pin_cmd = SDMMC_CMD;
|
||||
_pin_d0 = SDMMC_D0;
|
||||
#ifndef BOARD_HAS_1BIT_SDMMC
|
||||
_pin_d1 = SDMMC_D1;
|
||||
_pin_d2 = SDMMC_D2;
|
||||
_pin_d3 = SDMMC_D3;
|
||||
#endif // BOARD_HAS_1BIT_SDMMC
|
||||
#endif // defined(SOC_SDMMC_USE_GPIO_MATRIX) && defined(BOARD_HAS_SDMMC)
|
||||
}
|
||||
|
||||
bool SDMMCFS::setPins(int clk, int cmd, int d0)
|
||||
{
|
||||
return setPins(clk, cmd, d0, GPIO_NUM_NC, GPIO_NUM_NC, GPIO_NUM_NC);
|
||||
}
|
||||
|
||||
bool SDMMCFS::setPins(int clk, int cmd, int d0, int d1, int d2, int d3)
|
||||
{
|
||||
if (_card != nullptr) {
|
||||
log_e("SD_MMC.setPins must be called before SD_MMC.begin");
|
||||
return false;
|
||||
}
|
||||
#ifdef SOC_SDMMC_USE_GPIO_MATRIX
|
||||
// SoC supports SDMMC pin configuration via GPIO matrix. Save the pins for later use in SDMMCFS::begin.
|
||||
_pin_clk = (int8_t) clk;
|
||||
_pin_cmd = (int8_t) cmd;
|
||||
_pin_d0 = (int8_t) d0;
|
||||
_pin_d1 = (int8_t) d1;
|
||||
_pin_d2 = (int8_t) d2;
|
||||
_pin_d3 = (int8_t) d3;
|
||||
return true;
|
||||
#elif CONFIG_IDF_TARGET_ESP32
|
||||
// ESP32 doesn't support SDMMC pin configuration via GPIO matrix.
|
||||
// Since SDMMCFS::begin hardcodes the usage of slot 1, only check if
|
||||
// the pins match slot 1 pins.
|
||||
bool pins_ok = (clk == SDMMC_SLOT1_IOMUX_PIN_NUM_CLK) &&
|
||||
(cmd == SDMMC_SLOT1_IOMUX_PIN_NUM_CMD) &&
|
||||
(d0 == SDMMC_SLOT1_IOMUX_PIN_NUM_D0) &&
|
||||
((d1 == d2 == d3 == -1) ||
|
||||
(d1 == SDMMC_SLOT1_IOMUX_PIN_NUM_D1) &&
|
||||
(d1 == SDMMC_SLOT1_IOMUX_PIN_NUM_D2) &&
|
||||
(d1 == SDMMC_SLOT1_IOMUX_PIN_NUM_D3));
|
||||
if (!pins_ok) {
|
||||
log_e("SDMMCFS: specified pins are not supported by this chip.");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
#else
|
||||
#error SoC not supported
|
||||
#endif
|
||||
}
|
||||
|
||||
bool SDMMCFS::begin(const char * mountpoint, bool mode1bit, bool format_if_mount_failed, int sdmmc_frequency)
|
||||
{
|
||||
|
|
@ -43,27 +91,33 @@ bool SDMMCFS::begin(const char * mountpoint, bool mode1bit, bool format_if_mount
|
|||
}
|
||||
//mount
|
||||
sdmmc_slot_config_t slot_config = SDMMC_SLOT_CONFIG_DEFAULT();
|
||||
sdmmc_host_t host;
|
||||
#ifdef SOC_SDMMC_USE_GPIO_MATRIX
|
||||
// SoC supports SDMMC pin configuration via GPIO matrix.
|
||||
// Chech that the pins have been set either in the constructor or setPins function.
|
||||
if (_pin_cmd == -1 || _pin_clk == -1 || _pin_d0 == -1
|
||||
|| (!mode1bit && (_pin_d1 == -1 || _pin_d2 == -1 || _pin_d3 == -1))) {
|
||||
log_e("SDMMCFS: some SD pins are not set");
|
||||
return false;
|
||||
}
|
||||
|
||||
slot_config.clk = (gpio_num_t) _pin_clk;
|
||||
slot_config.cmd = (gpio_num_t) _pin_cmd;
|
||||
slot_config.d0 = (gpio_num_t) _pin_d0;
|
||||
slot_config.d1 = (gpio_num_t) _pin_d1;
|
||||
slot_config.d2 = (gpio_num_t) _pin_d2;
|
||||
slot_config.d3 = (gpio_num_t) _pin_d3;
|
||||
slot_config.width = 4;
|
||||
#endif // SOC_SDMMC_USE_GPIO_MATRIX
|
||||
sdmmc_host_t host = SDMMC_HOST_DEFAULT();
|
||||
host.flags = SDMMC_HOST_FLAG_4BIT;
|
||||
host.slot = SDMMC_HOST_SLOT_1;
|
||||
host.max_freq_khz = sdmmc_frequency;
|
||||
host.io_voltage = 3.3f;
|
||||
host.init = &sdmmc_host_init;
|
||||
host.set_bus_width = &sdmmc_host_set_bus_width;
|
||||
host.get_bus_width = &sdmmc_host_get_slot_width;
|
||||
host.set_bus_ddr_mode = &sdmmc_host_set_bus_ddr_mode;
|
||||
host.set_card_clk = &sdmmc_host_set_card_clk;
|
||||
host.do_transaction = &sdmmc_host_do_transaction;
|
||||
host.deinit = &sdmmc_host_deinit;
|
||||
host.io_int_enable = &sdmmc_host_io_int_enable;
|
||||
host.io_int_wait = &sdmmc_host_io_int_wait;
|
||||
host.command_timeout_ms = 0;
|
||||
#ifdef BOARD_HAS_1BIT_SDMMC
|
||||
mode1bit = true;
|
||||
#endif
|
||||
if(mode1bit) {
|
||||
host.flags = SDMMC_HOST_FLAG_1BIT; //use 1-line SD mode
|
||||
slot_config.width = 1;
|
||||
slot_config.width = 1;
|
||||
}
|
||||
|
||||
esp_vfs_fat_sdmmc_mount_config_t mount_config = {
|
||||
|
|
@ -81,7 +135,7 @@ bool SDMMCFS::begin(const char * mountpoint, bool mode1bit, bool format_if_mount
|
|||
log_w("SD Already mounted");
|
||||
return true;
|
||||
} else {
|
||||
log_e("Failed to initialize the card (%d). Make sure SD card lines have pull-up resistors in place.", ret);
|
||||
log_e("Failed to initialize the card (0x%x). Make sure SD card lines have pull-up resistors in place.", ret);
|
||||
}
|
||||
_card = NULL;
|
||||
return false;
|
||||
|
|
@ -144,4 +198,4 @@ uint64_t SDMMCFS::usedBytes()
|
|||
}
|
||||
|
||||
SDMMCFS SD_MMC = SDMMCFS(FSImplPtr(new VFSImpl()));
|
||||
#endif /* CONFIG_IDF_TARGET_ESP32 */
|
||||
#endif /* SOC_SDMMC_HOST_SUPPORTED */
|
||||
|
|
|
|||
|
|
@ -15,7 +15,8 @@
|
|||
#define _SDMMC_H_
|
||||
|
||||
#include "sdkconfig.h"
|
||||
#ifndef CONFIG_IDF_TARGET_ESP32S2
|
||||
#include "soc/soc_caps.h"
|
||||
#ifdef SOC_SDMMC_HOST_SUPPORTED
|
||||
|
||||
#include "FS.h"
|
||||
#include "driver/sdmmc_types.h"
|
||||
|
|
@ -36,8 +37,19 @@ class SDMMCFS : public FS
|
|||
protected:
|
||||
sdmmc_card_t* _card;
|
||||
|
||||
#ifdef SOC_SDMMC_USE_GPIO_MATRIX
|
||||
int8_t _pin_clk = -1;
|
||||
int8_t _pin_cmd = -1;
|
||||
int8_t _pin_d0 = -1;
|
||||
int8_t _pin_d1 = -1;
|
||||
int8_t _pin_d2 = -1;
|
||||
int8_t _pin_d3 = -1;
|
||||
#endif
|
||||
|
||||
public:
|
||||
SDMMCFS(FSImplPtr impl);
|
||||
bool setPins(int clk, int cmd, int d0);
|
||||
bool setPins(int clk, int cmd, int d0, int d1, int d2, int d3);
|
||||
bool begin(const char * mountpoint="/sdcard", bool mode1bit=false, bool format_if_mount_failed=false, int sdmmc_frequency=BOARD_MAX_SDMMC_FREQ);
|
||||
void end();
|
||||
sdcard_type_t cardType();
|
||||
|
|
@ -50,5 +62,5 @@ public:
|
|||
|
||||
extern fs::SDMMCFS SD_MMC;
|
||||
|
||||
#endif /* CONFIG_IDF_TARGET_ESP32S2 */
|
||||
#endif /* SOC_SDMMC_HOST_SUPPORTED */
|
||||
#endif /* _SDMMC_H_ */
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@
|
|||
#define HSPI_SS 15
|
||||
#endif
|
||||
|
||||
#if CONFIG_IDF_TARGET_ESP32S2
|
||||
#if CONFIG_IDF_TARGET_ESP32S2 || CONFIG_IDF_TARGET_ESP32S3
|
||||
#define VSPI FSPI
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -1,3 +1,8 @@
|
|||
#if ARDUINO_USB_MODE
|
||||
#warning This sketch should be used when USB is in OTG mode
|
||||
void setup(){}
|
||||
void loop(){}
|
||||
#else
|
||||
#include "USB.h"
|
||||
#include "USBHIDMouse.h"
|
||||
#include "USBHIDKeyboard.h"
|
||||
|
|
@ -211,3 +216,4 @@ void loop() {
|
|||
}
|
||||
}
|
||||
}
|
||||
#endif /* ARDUINO_USB_MODE */
|
||||
|
|
|
|||
|
|
@ -1,3 +1,8 @@
|
|||
#if ARDUINO_USB_MODE
|
||||
#warning This sketch should be used when USB is in OTG mode
|
||||
void setup(){}
|
||||
void loop(){}
|
||||
#else
|
||||
#include "USB.h"
|
||||
#include "USBHIDConsumerControl.h"
|
||||
USBHIDConsumerControl ConsumerControl;
|
||||
|
|
@ -19,3 +24,4 @@ void loop() {
|
|||
}
|
||||
previousButtonState = buttonState;
|
||||
}
|
||||
#endif /* ARDUINO_USB_MODE */
|
||||
|
|
|
|||
|
|
@ -1,3 +1,8 @@
|
|||
#if ARDUINO_USB_MODE
|
||||
#warning This sketch should be used when USB is in OTG mode
|
||||
void setup(){}
|
||||
void loop(){}
|
||||
#else
|
||||
#include "USB.h"
|
||||
#include "USBHID.h"
|
||||
USBHID HID;
|
||||
|
|
@ -50,6 +55,7 @@ public:
|
|||
};
|
||||
|
||||
CustomHIDDevice Device;
|
||||
#endif /* ARDUINO_USB_MODE */
|
||||
|
||||
const int buttonPin = 0;
|
||||
int previousButtonState = HIGH;
|
||||
|
|
|
|||
|
|
@ -1,3 +1,8 @@
|
|||
#if ARDUINO_USB_MODE
|
||||
#warning This sketch should be used when USB is in OTG mode
|
||||
void setup(){}
|
||||
void loop(){}
|
||||
#else
|
||||
#include "USB.h"
|
||||
#include "FirmwareMSC.h"
|
||||
|
||||
|
|
@ -72,3 +77,4 @@ void setup() {
|
|||
void loop() {
|
||||
// put your main code here, to run repeatedly
|
||||
}
|
||||
#endif /* ARDUINO_USB_MODE */
|
||||
|
|
|
|||
|
|
@ -1,3 +1,8 @@
|
|||
#if ARDUINO_USB_MODE
|
||||
#warning This sketch should be used when USB is in OTG mode
|
||||
void setup(){}
|
||||
void loop(){}
|
||||
#else
|
||||
#include "USB.h"
|
||||
#include "USBHIDGamepad.h"
|
||||
USBHIDGamepad Gamepad;
|
||||
|
|
@ -19,3 +24,4 @@ void loop() {
|
|||
}
|
||||
previousButtonState = buttonState;
|
||||
}
|
||||
#endif /* ARDUINO_USB_MODE */
|
||||
|
|
|
|||
|
|
@ -1,3 +1,8 @@
|
|||
#if ARDUINO_USB_MODE
|
||||
#warning This sketch should be used when USB is in OTG mode
|
||||
void setup(){}
|
||||
void loop(){}
|
||||
#else
|
||||
#include "USB.h"
|
||||
#include "USBHIDVendor.h"
|
||||
USBHIDVendor Vendor;
|
||||
|
|
@ -50,3 +55,4 @@ void loop() {
|
|||
Serial.write(Vendor.read());
|
||||
}
|
||||
}
|
||||
#endif /* ARDUINO_USB_MODE */
|
||||
|
|
|
|||
|
|
@ -24,6 +24,11 @@
|
|||
|
||||
http://www.arduino.cc/en/Tutorial/KeyboardLogout
|
||||
*/
|
||||
#if ARDUINO_USB_MODE
|
||||
#warning This sketch should be used when USB is in OTG mode
|
||||
void setup(){}
|
||||
void loop(){}
|
||||
#else
|
||||
|
||||
#define OSX 0
|
||||
#define WINDOWS 1
|
||||
|
|
@ -90,3 +95,4 @@ void loop() {
|
|||
// do nothing:
|
||||
while (true) delay(1000);
|
||||
}
|
||||
#endif /* ARDUINO_USB_MODE */
|
||||
|
|
|
|||
|
|
@ -19,6 +19,11 @@
|
|||
|
||||
http://www.arduino.cc/en/Tutorial/KeyboardMessage
|
||||
*/
|
||||
#if ARDUINO_USB_MODE
|
||||
#warning This sketch should be used when USB is in OTG mode
|
||||
void setup(){}
|
||||
void loop(){}
|
||||
#else
|
||||
|
||||
#include "USB.h"
|
||||
#include "USBHIDKeyboard.h"
|
||||
|
|
@ -53,3 +58,4 @@ void loop() {
|
|||
// save the current button state for comparison next time:
|
||||
previousButtonState = buttonState;
|
||||
}
|
||||
#endif /* ARDUINO_USB_MODE */
|
||||
|
|
|
|||
|
|
@ -24,6 +24,11 @@
|
|||
|
||||
http://www.arduino.cc/en/Tutorial/KeyboardReprogram
|
||||
*/
|
||||
#if ARDUINO_USB_MODE
|
||||
#warning This sketch should be used when USB is in OTG mode
|
||||
void setup(){}
|
||||
void loop(){}
|
||||
#else
|
||||
|
||||
#include "USB.h"
|
||||
#include "USBHIDKeyboard.h"
|
||||
|
|
@ -104,3 +109,4 @@ void loop() {
|
|||
// wait for the sweet oblivion of reprogramming:
|
||||
while (true)delay(1000);
|
||||
}
|
||||
#endif /* ARDUINO_USB_MODE */
|
||||
|
|
|
|||
|
|
@ -16,6 +16,11 @@
|
|||
|
||||
http://www.arduino.cc/en/Tutorial/KeyboardSerial
|
||||
*/
|
||||
#if ARDUINO_USB_MODE
|
||||
#warning This sketch should be used when USB is in OTG mode
|
||||
void setup(){}
|
||||
void loop(){}
|
||||
#else
|
||||
|
||||
#include "USB.h"
|
||||
#include "USBHIDKeyboard.h"
|
||||
|
|
@ -38,3 +43,4 @@ void loop() {
|
|||
Keyboard.write(inChar + 1);
|
||||
}
|
||||
}
|
||||
#endif /* ARDUINO_USB_MODE */
|
||||
|
|
|
|||
|
|
@ -18,6 +18,11 @@
|
|||
|
||||
http://www.arduino.cc/en/Tutorial/KeyboardAndMouseControl
|
||||
*/
|
||||
#if ARDUINO_USB_MODE
|
||||
#warning This sketch should be used when USB is in OTG mode
|
||||
void setup(){}
|
||||
void loop(){}
|
||||
#else
|
||||
|
||||
#include "USB.h"
|
||||
#include "USBHIDMouse.h"
|
||||
|
|
@ -93,3 +98,4 @@ void loop() {
|
|||
}
|
||||
delay(5);
|
||||
}
|
||||
#endif /* ARDUINO_USB_MODE */
|
||||
|
|
|
|||
|
|
@ -20,6 +20,11 @@
|
|||
|
||||
http://www.arduino.cc/en/Tutorial/ButtonMouseControl
|
||||
*/
|
||||
#if ARDUINO_USB_MODE
|
||||
#warning This sketch should be used when USB is in OTG mode
|
||||
void setup(){}
|
||||
void loop(){}
|
||||
#else
|
||||
|
||||
#include "USB.h"
|
||||
#include "USBHIDMouse.h"
|
||||
|
|
@ -84,3 +89,4 @@ void loop() {
|
|||
// a delay so the mouse doesn't move too fast:
|
||||
delay(responseDelay);
|
||||
}
|
||||
#endif /* ARDUINO_USB_MODE */
|
||||
|
|
|
|||
|
|
@ -1,3 +1,8 @@
|
|||
#if ARDUINO_USB_MODE
|
||||
#warning This sketch should be used when USB is in OTG mode
|
||||
void setup(){}
|
||||
void loop(){}
|
||||
#else
|
||||
#include "USB.h"
|
||||
#include "USBHIDSystemControl.h"
|
||||
USBHIDSystemControl SystemControl;
|
||||
|
|
@ -19,3 +24,4 @@ void loop() {
|
|||
}
|
||||
previousButtonState = buttonState;
|
||||
}
|
||||
#endif /* ARDUINO_USB_MODE */
|
||||
|
|
|
|||
|
|
@ -1,3 +1,8 @@
|
|||
#if ARDUINO_USB_MODE
|
||||
#warning This sketch should be used when USB is in OTG mode
|
||||
void setup(){}
|
||||
void loop(){}
|
||||
#else
|
||||
#include "USB.h"
|
||||
#include "USBMSC.h"
|
||||
|
||||
|
|
@ -190,3 +195,4 @@ void setup() {
|
|||
void loop() {
|
||||
// put your main code here, to run repeatedly:
|
||||
}
|
||||
#endif /* ARDUINO_USB_MODE */
|
||||
|
|
|
|||
|
|
@ -1,3 +1,8 @@
|
|||
#if ARDUINO_USB_MODE
|
||||
#warning This sketch should be used when USB is in OTG mode
|
||||
void setup(){}
|
||||
void loop(){}
|
||||
#else
|
||||
#include "USB.h"
|
||||
|
||||
#if ARDUINO_USB_CDC_ON_BOOT
|
||||
|
|
@ -78,3 +83,4 @@ void loop() {
|
|||
USBSerial.write(b, l);
|
||||
}
|
||||
}
|
||||
#endif /* ARDUINO_USB_MODE */
|
||||
|
|
|
|||
|
|
@ -1,3 +1,8 @@
|
|||
#if ARDUINO_USB_MODE
|
||||
#warning This sketch should be used when USB is in OTG mode
|
||||
void setup(){}
|
||||
void loop(){}
|
||||
#else
|
||||
#include "USB.h"
|
||||
#include "USBVendor.h"
|
||||
|
||||
|
|
@ -189,3 +194,4 @@ void loop() {
|
|||
Vendor.write(b, l);
|
||||
}
|
||||
}
|
||||
#endif /* ARDUINO_USB_MODE */
|
||||
|
|
|
|||
|
|
@ -114,7 +114,6 @@ class USBHIDKeyboard: public USBHIDDevice, public Print
|
|||
private:
|
||||
USBHID hid;
|
||||
KeyReport _keyReport;
|
||||
void sendReport(KeyReport* keys);
|
||||
public:
|
||||
USBHIDKeyboard(void);
|
||||
void begin(void);
|
||||
|
|
@ -124,6 +123,7 @@ public:
|
|||
size_t press(uint8_t k);
|
||||
size_t release(uint8_t k);
|
||||
void releaseAll(void);
|
||||
void sendReport(KeyReport* keys);
|
||||
|
||||
//raw functions work with TinyUSB's HID_KEY_* macros
|
||||
size_t pressRaw(uint8_t k);
|
||||
|
|
|
|||
70
libraries/WiFi/examples/WiFiScanDualAntenna/README.md
Normal file
70
libraries/WiFi/examples/WiFiScanDualAntenna/README.md
Normal file
|
|
@ -0,0 +1,70 @@
|
|||
# WiFiScan Example
|
||||
|
||||
This example demonstrates how to use the WiFi library to scan available WiFi networks and print the results.
|
||||
|
||||
This example shows the basic functionality of the dual antenna capability.
|
||||
|
||||
# Supported Targets
|
||||
|
||||
This example is compatible with the ESP32-WROOM-DA.
|
||||
|
||||
## How to Use Example
|
||||
|
||||
* How to install the Arduino IDE: [Install Arduino IDE](https://github.com/espressif/arduino-esp32/tree/master/docs/arduino-ide).
|
||||
|
||||
#### Using Arduino IDE
|
||||
|
||||
* Before Compile/Verify, select the correct board: `Tools -> Board`.
|
||||
* Select the COM port: `Tools -> Port: xxx` where the `xxx` is the detected COM port.
|
||||
|
||||
#### Using Platform IO
|
||||
|
||||
* Select the COM port: `Devices` or set the `upload_port` option on the `platformio.ini` file.
|
||||
|
||||
## Example/Log Output
|
||||
|
||||
```
|
||||
ets Jul 29 2019 12:21:46
|
||||
|
||||
rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
|
||||
configsip: 0, SPIWP:0xee
|
||||
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
|
||||
mode:DIO, clock div:1
|
||||
load:0x3fff0030,len:1412
|
||||
load:0x40078000,len:13400
|
||||
load:0x40080400,len:3672
|
||||
entry 0x400805f8
|
||||
Setup done
|
||||
scan start
|
||||
scan done
|
||||
17 networks found
|
||||
1: IoTNetwork (-62)*
|
||||
2: WiFiSSID (-62)*
|
||||
3: B3A7992 (-63)*
|
||||
4: WiFi (-63)
|
||||
5: IoTNetwork2 (-64)*
|
||||
...
|
||||
```
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
***Important: Be sure you're using a good quality USB cable and you have enough power source for your project.***
|
||||
|
||||
* **Programming Fail:** If the programming/flash procedure fails, try to reduce the serial connection speed.
|
||||
* **COM port not detected:** Check the USB cable connection 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 the Troubleshooting and to check if the same issue was already created by someone else.
|
||||
|
||||
## Resources
|
||||
|
||||
* 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-WROOM-DA Datasheet: [Link to datasheet](https://www.espressif.com/sites/default/files/documentation/esp32-wroom-da_datasheet_en.pdf)
|
||||
|
|
@ -0,0 +1,79 @@
|
|||
/*
|
||||
* This sketch demonstrates how to scan WiFi networks.
|
||||
* The API is almost the same as with the WiFi Shield library,
|
||||
* the most obvious difference being the different file you need to include:
|
||||
*/
|
||||
#include "WiFi.h"
|
||||
|
||||
/* These are the GPIOs connected to the antenna switch on the ESP32-WROOM-DA.
|
||||
* Both GPIOs are not exposed to the module pins and cannot be used except to
|
||||
* control the antnnas switch.
|
||||
*
|
||||
* For more details, see the datashhet at:
|
||||
* https://www.espressif.com/sites/default/files/documentation/esp32-wroom-da_datasheet_en.pdf
|
||||
*/
|
||||
|
||||
#define GPIO_ANT1 2 // GPIO for antenna 1
|
||||
#define GPIO_ANT2 25 // GPIO for antenna 2 (default)
|
||||
|
||||
void setup()
|
||||
{
|
||||
bool err = ESP_FAIL;
|
||||
Serial.begin(115200);
|
||||
|
||||
// Set WiFi to station mode and disconnect from an AP if it was previously connected
|
||||
WiFi.mode(WIFI_STA);
|
||||
|
||||
/* Attention: This is the manual prodecure for the dual antenna configuration.
|
||||
* If you choose the ESP32-WROOM-DA module from the Tools -> Board, this configuration
|
||||
* is not necessary!
|
||||
*
|
||||
* Set WiFi dual antenna configuration by passing the GPIO and antenna mode for RX ant TX
|
||||
*/
|
||||
err = WiFi.setDualAntennaConfig(GPIO_ANT1, GPIO_ANT2, WIFI_RX_ANT_AUTO, WIFI_TX_ANT_AUTO);
|
||||
|
||||
/* For more details on how to use this feature, see our docs:
|
||||
* https://docs.espressif.com/projects/arduino-esp32/en/latest/api/wifi.html
|
||||
*/
|
||||
|
||||
if(err == ESP_FAIL) {
|
||||
Serial.println("Dual Antenna configuration failed!");
|
||||
} else {
|
||||
Serial.println("Dual Antenna configuration successfuly done!");
|
||||
}
|
||||
|
||||
WiFi.disconnect();
|
||||
delay(100);
|
||||
|
||||
Serial.println("Setup done");
|
||||
}
|
||||
|
||||
void loop()
|
||||
{
|
||||
Serial.println("scan start");
|
||||
|
||||
// WiFi.scanNetworks will return the number of networks found
|
||||
int n = WiFi.scanNetworks();
|
||||
Serial.println("scan done");
|
||||
if (n == 0) {
|
||||
Serial.println("no networks found");
|
||||
} else {
|
||||
Serial.print(n);
|
||||
Serial.println(" networks found");
|
||||
for (int i = 0; i < n; ++i) {
|
||||
// Print SSID and RSSI for each network found
|
||||
Serial.print(i + 1);
|
||||
Serial.print(": ");
|
||||
Serial.print(WiFi.SSID(i));
|
||||
Serial.print(" (");
|
||||
Serial.print(WiFi.RSSI(i));
|
||||
Serial.print(")");
|
||||
Serial.println((WiFi.encryptionType(i) == WIFI_AUTH_OPEN)?" ":"*");
|
||||
delay(10);
|
||||
}
|
||||
}
|
||||
Serial.println("");
|
||||
|
||||
// Wait a bit before scanning again
|
||||
delay(5000);
|
||||
}
|
||||
|
|
@ -138,9 +138,20 @@ esp_err_t set_esp_interface_ip(esp_interface_t interface, IPAddress local_ip=IPA
|
|||
|
||||
dhcps_lease_t lease;
|
||||
lease.enable = true;
|
||||
lease.start_ip.addr = static_cast<uint32_t>(local_ip) + (1 << 24);
|
||||
lease.end_ip.addr = static_cast<uint32_t>(local_ip) + (11 << 24);
|
||||
|
||||
uint32_t dhcp_ipaddr = static_cast<uint32_t>(local_ip);
|
||||
// prevents DHCP lease range to overflow subnet/24 range
|
||||
// there will be 11 addresses for DHCP to lease
|
||||
uint8_t leaseStart = (uint8_t)(~subnet[3] - 12);
|
||||
if ((local_ip[3]) < leaseStart) {
|
||||
lease.start_ip.addr = dhcp_ipaddr + (1 << 24);
|
||||
lease.end_ip.addr = dhcp_ipaddr + (11 << 24);
|
||||
} else {
|
||||
// make range stay in the begining of the netmask range
|
||||
dhcp_ipaddr = (dhcp_ipaddr & 0x00FFFFFF);
|
||||
lease.start_ip.addr = dhcp_ipaddr + (1 << 24);
|
||||
lease.end_ip.addr = dhcp_ipaddr + (11 << 24);
|
||||
}
|
||||
log_v("DHCP Server Range: %s to %s", IPAddress(lease.start_ip.addr).toString(), IPAddress(lease.end_ip.addr).toString());
|
||||
err = tcpip_adapter_dhcps_option(
|
||||
(tcpip_adapter_dhcp_option_mode_t)TCPIP_ADAPTER_OP_SET,
|
||||
(tcpip_adapter_dhcp_option_id_t)REQUESTED_IP_ADDRESS,
|
||||
|
|
@ -555,6 +566,10 @@ void WiFiGenericClass::useStaticBuffers(bool bufferMode){
|
|||
_wifiUseStaticBuffers = bufferMode;
|
||||
}
|
||||
|
||||
// Temporary fix to ensure that CDC+JTAG stay on on ESP32-C3
|
||||
#if CONFIG_IDF_TARGET_ESP32C3
|
||||
extern "C" void phy_bbpll_en_usb(bool en);
|
||||
#endif
|
||||
|
||||
bool wifiLowLevelInit(bool persistent){
|
||||
if(!lowLevelInitDone){
|
||||
|
|
@ -587,6 +602,10 @@ bool wifiLowLevelInit(bool persistent){
|
|||
lowLevelInitDone = false;
|
||||
return lowLevelInitDone;
|
||||
}
|
||||
// Temporary fix to ensure that CDC+JTAG stay on on ESP32-C3
|
||||
#if CONFIG_IDF_TARGET_ESP32C3
|
||||
phy_bbpll_en_usb(true);
|
||||
#endif
|
||||
if(!persistent){
|
||||
lowLevelInitDone = esp_wifi_set_storage(WIFI_STORAGE_RAM) == ESP_OK;
|
||||
}
|
||||
|
|
@ -827,6 +846,8 @@ const char * system_event_reasons[] = { "UNSPECIFIED", "AUTH_EXPIRE", "AUTH_LEAV
|
|||
#endif
|
||||
esp_err_t WiFiGenericClass::_eventCallback(arduino_event_t *event)
|
||||
{
|
||||
static bool first_connect = true;
|
||||
|
||||
if(event->event_id < ARDUINO_EVENT_MAX) {
|
||||
log_d("Arduino Event: %d - %s", event->event_id, arduino_event_names[event->event_id]);
|
||||
}
|
||||
|
|
@ -852,7 +873,7 @@ esp_err_t WiFiGenericClass::_eventCallback(arduino_event_t *event)
|
|||
log_w("Reason: %u - %s", reason, reason2str(reason));
|
||||
if(reason == WIFI_REASON_NO_AP_FOUND) {
|
||||
WiFiSTAClass::_setStatus(WL_NO_SSID_AVAIL);
|
||||
} else if(reason == WIFI_REASON_AUTH_FAIL) {
|
||||
} else if((reason == WIFI_REASON_AUTH_FAIL) && !first_connect){
|
||||
WiFiSTAClass::_setStatus(WL_CONNECT_FAILED);
|
||||
} else if(reason == WIFI_REASON_BEACON_TIMEOUT || reason == WIFI_REASON_HANDSHAKE_TIMEOUT) {
|
||||
WiFiSTAClass::_setStatus(WL_CONNECTION_LOST);
|
||||
|
|
@ -862,7 +883,15 @@ esp_err_t WiFiGenericClass::_eventCallback(arduino_event_t *event)
|
|||
WiFiSTAClass::_setStatus(WL_DISCONNECTED);
|
||||
}
|
||||
clearStatusBits(STA_CONNECTED_BIT | STA_HAS_IP_BIT | STA_HAS_IP6_BIT);
|
||||
if(WiFi.getAutoReconnect()){
|
||||
if(first_connect && ((reason == WIFI_REASON_AUTH_EXPIRE) ||
|
||||
(reason >= WIFI_REASON_BEACON_TIMEOUT)))
|
||||
{
|
||||
log_d("WiFi Reconnect Running");
|
||||
WiFi.disconnect();
|
||||
WiFi.begin();
|
||||
first_connect = false;
|
||||
}
|
||||
else if(WiFi.getAutoReconnect()){
|
||||
if((reason == WIFI_REASON_AUTH_EXPIRE) ||
|
||||
(reason >= WIFI_REASON_BEACON_TIMEOUT && reason != WIFI_REASON_AUTH_FAIL))
|
||||
{
|
||||
|
|
@ -1043,6 +1072,14 @@ bool WiFiGenericClass::mode(wifi_mode_t m)
|
|||
if(!espWiFiStart()){
|
||||
return false;
|
||||
}
|
||||
|
||||
#ifdef BOARD_HAS_DUAL_ANTENNA
|
||||
if(!setDualAntennaConfig(ANT1, ANT2, WIFI_RX_ANT_AUTO, WIFI_TX_ANT_AUTO)){
|
||||
log_e("Dual Antenna Config failed!");
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -186,7 +186,7 @@ class WiFiGenericClass
|
|||
|
||||
bool initiateFTM(uint8_t frm_count=16, uint16_t burst_period=2, uint8_t channel=1, const uint8_t * mac=NULL);
|
||||
|
||||
bool setDualAntennaConfig(uint8_t gpio_ant1, uint8_t gpio_ant2, wifi_rx_ant_t rx_mode, wifi_tx_ant_t tx_mode);
|
||||
static bool setDualAntennaConfig(uint8_t gpio_ant1, uint8_t gpio_ant2, wifi_rx_ant_t rx_mode, wifi_tx_ant_t tx_mode);
|
||||
|
||||
static const char * getHostname();
|
||||
static bool setHostname(const char * hostname);
|
||||
|
|
|
|||
|
|
@ -655,8 +655,15 @@ IPv6Address WiFiSTAClass::localIPv6()
|
|||
bool WiFiSTAClass::_smartConfigStarted = false;
|
||||
bool WiFiSTAClass::_smartConfigDone = false;
|
||||
|
||||
|
||||
bool WiFiSTAClass::beginSmartConfig() {
|
||||
/**
|
||||
* @brief
|
||||
*
|
||||
* @param type Select type of SmartConfig. Default type is SC_TYPE_ESPTOUCH
|
||||
* @param crypt_key When using type SC_TYPE_ESPTOUTCH_V2 crypt key needed, else ignored. Lenght should be 16 chars.
|
||||
* @return true if configuration is successful.
|
||||
* @return false if configuration fails.
|
||||
*/
|
||||
bool WiFiSTAClass::beginSmartConfig(smartconfig_type_t type, char* crypt_key) {
|
||||
esp_err_t err;
|
||||
if (_smartConfigStarted) {
|
||||
return false;
|
||||
|
|
@ -668,7 +675,13 @@ bool WiFiSTAClass::beginSmartConfig() {
|
|||
esp_wifi_disconnect();
|
||||
|
||||
smartconfig_start_config_t conf = SMARTCONFIG_START_CONFIG_DEFAULT();
|
||||
err = esp_smartconfig_set_type(SC_TYPE_ESPTOUCH);
|
||||
|
||||
if (type == SC_TYPE_ESPTOUCH_V2){
|
||||
conf.esp_touch_v2_enable_crypt = true;
|
||||
conf.esp_touch_v2_key = crypt_key;
|
||||
}
|
||||
|
||||
err = esp_smartconfig_set_type(type);
|
||||
if (err != ESP_OK) {
|
||||
log_e("SmartConfig Set Type Failed!");
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -92,7 +92,7 @@ protected:
|
|||
static bool _autoReconnect;
|
||||
|
||||
public:
|
||||
bool beginSmartConfig();
|
||||
bool beginSmartConfig(smartconfig_type_t type = SC_TYPE_ESPTOUCH, char* crypt_key = NULL);
|
||||
bool stopSmartConfig();
|
||||
bool smartConfigDone();
|
||||
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue