-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit a0afad3
Showing
33 changed files
with
2,661 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,136 @@ | ||
#!/bin/bash | ||
|
||
# Function: Check version format | ||
# Input parameters: $1 The version number | ||
# Return value: 0 if the version numbers are correct, 1 if the first version is incorrect, | ||
check_version_format() { | ||
version_regex="^v[0-9]+\.[0-9]+\.[0-9]+$" | ||
|
||
if [[ ! $1 =~ $version_regex ]]; then | ||
return 1 | ||
fi | ||
|
||
return 0 | ||
} | ||
|
||
if [ $# -lt 1 ]; then | ||
latest_version="0.0.0" | ||
echo "Don't get the lastest version, use \"0.0.0\" as default" | ||
else | ||
# Get the first input parameter as the version to be compared | ||
latest_version="$1" | ||
# Check the version format | ||
check_version_format "${latest_version}" | ||
result=$? | ||
if [ ${result} -ne 0 ]; then | ||
echo "The latest release version (${latest_version}) format is incorrect." | ||
exit 1 | ||
fi | ||
fi | ||
|
||
# Specify the directory path | ||
target_directory="./" | ||
|
||
echo "Checking directory: ${target_directory}" | ||
|
||
# Function: Check if a file exists | ||
# Input parameters: $1 The file to check | ||
# Return value: 0 if the file exists, 1 if the file does not exist | ||
check_file_exists() { | ||
if [ ! -f "$1" ]; then | ||
echo "File '$1' not found." | ||
return 1 | ||
fi | ||
return 0 | ||
} | ||
|
||
# Function: Compare version numbers | ||
# Input parameters: $1 The first version number, $2 The second version number | ||
# Return value: 0 if the version numbers are equal, 1 if the first version is greater, | ||
# 2 if the second version is greater, | ||
compare_versions() { | ||
version_regex="^v[0-9]+\.[0-9]+\.[0-9]+$" | ||
|
||
version1=$(echo "$1" | cut -c 2-) # Remove the 'v' at the beginning of the version number | ||
version2=$(echo "$2" | cut -c 2-) | ||
|
||
IFS='.' read -ra v1_parts <<< "$version1" | ||
IFS='.' read -ra v2_parts <<< "$version2" | ||
|
||
for ((i=0; i<${#v1_parts[@]}; i++)); do | ||
if [[ "${v1_parts[$i]}" -lt "${v2_parts[$i]}" ]]; then | ||
return 2 | ||
elif [[ "${v1_parts[$i]}" -gt "${v2_parts[$i]}" ]]; then | ||
return 1 | ||
fi | ||
done | ||
|
||
return 0 | ||
} | ||
|
||
echo "Checking file: library.properties" | ||
# Check if "library.properties" file exists | ||
check_file_exists "${target_directory}/library.properties" | ||
if [ $? -ne 0 ]; then | ||
exit 1 | ||
fi | ||
# Read the version information from the file | ||
arduino_version=v$(grep -E '^version=' "${target_directory}/library.properties" | cut -d '=' -f 2) | ||
echo "Get Arduino version: ${arduino_version}" | ||
# Check the version format | ||
check_version_format "${arduino_version}" | ||
result=$? | ||
if [ ${result} -ne 0 ]; then | ||
echo "Arduino version (${arduino_version}) format is incorrect." | ||
exit 1 | ||
fi | ||
|
||
# Compare Arduino Library version with the latest release version | ||
compare_versions "${arduino_version}" "${latest_version}" | ||
result=$? | ||
if [ ${result} -ne 1 ]; then | ||
if [ ${result} -eq 3 ]; then | ||
echo "Arduino version (${arduino_version}) is incorrect." | ||
else | ||
echo "Arduino version (${arduino_version}) is not greater than the latest release version (${latest_version})." | ||
exit 1 | ||
fi | ||
fi | ||
|
||
echo "Checking file: idf_component.yml" | ||
# Check if "idf_component.yml" file exists | ||
check_file_exists "${target_directory}/idf_component.yml" | ||
if [ $? -eq 0 ]; then | ||
# Read the version information from the file | ||
idf_version=v$(grep -E '^version:' "${target_directory}/idf_component.yml" | awk -F'"' '{print $2}') | ||
echo "Get IDF component version: ${idf_version}" | ||
# Check the version format | ||
check_version_format "${idf_version}" | ||
result=$? | ||
if [ ${result} -ne 0 ]; then | ||
echo "IDF component (${idf_version}) format is incorrect." | ||
exit 1 | ||
fi | ||
# Compare IDF Component version with Arduino Library version | ||
compare_versions ${idf_version} ${arduino_version} | ||
result=$? | ||
if [ ${result} -ne 0 ]; then | ||
if [ ${result} -eq 3 ]; then | ||
echo "IDF component version (${idf_version}) is incorrect." | ||
else | ||
echo "IDF component version (${idf_version}) is not equal to the Arduino version (${arduino_version})." | ||
exit 1 | ||
fi | ||
fi | ||
# Compare IDF Component version with the latest release version | ||
compare_versions ${idf_version} ${latest_version} | ||
result=$? | ||
if [ ${result} -ne 1 ]; then | ||
if [ ${result} -eq 3 ]; then | ||
echo "IDF component version (${idf_version}) is incorrect." | ||
else | ||
echo "IDF component version (${idf_version}) is not greater than the latest release version (${latest_version})." | ||
exit 1 | ||
fi | ||
fi | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
name: Arduino Lint Action | ||
|
||
on: | ||
workflow_dispatch: | ||
pull_request: | ||
types: [opened, reopened, synchronize] | ||
|
||
jobs: | ||
lint: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: arduino/arduino-lint-action@v1 | ||
with: | ||
library-manager: update |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
name: Build Test Application | ||
|
||
on: | ||
workflow_dispatch: | ||
pull_request: | ||
types: [opened, reopened, synchronize] | ||
|
||
jobs: | ||
build: | ||
strategy: | ||
matrix: | ||
idf_ver: ["v4.4.5", "v5.0", "v5.1"] | ||
idf_target: ["esp32", "esp32s2", "esp32c3", "esp32s3"] | ||
runs-on: ubuntu-20.04 | ||
container: espressif/idf:${{ matrix.idf_ver }} | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Build ESP_IOExpander Test Application | ||
env: | ||
IDF_TARGET: ${{ matrix.idf_target }} | ||
working-directory: test_apps | ||
shell: bash | ||
run: | | ||
. ${IDF_PATH}/export.sh | ||
export PEDANTIC_FLAGS="-DIDF_CI_BUILD -Werror -Werror=deprecated-declarations -Werror=unused-variable -Werror=unused-but-set-variable -Werror=unused-function" | ||
export EXTRA_CFLAGS="${PEDANTIC_FLAGS} -Wstrict-prototypes" | ||
export EXTRA_CXXFLAGS="${PEDANTIC_FLAGS}" | ||
idf.py build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
name: Check Versions | ||
|
||
on: | ||
pull_request: | ||
types: [opened, reopened, synchronize] | ||
|
||
jobs: | ||
check_versions: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Get latest release info of repository | ||
id: last_release | ||
uses: InsonusK/[email protected] | ||
with: | ||
myToken: ${{ github.token }} | ||
exclude_types: "draft|prerelease" | ||
view_top: 1 | ||
- name: Print result | ||
run: | | ||
echo "id: ${{ steps.last_release.outputs.id }}" | ||
echo "name: ${{ steps.last_release.outputs.name }}" | ||
echo "tag_name: ${{ steps.last_release.outputs.tag_name }}" | ||
echo "created_at: ${{ steps.last_release.outputs.created_at }}" | ||
echo "draft: ${{ steps.last_release.outputs.draft }}" | ||
echo "prerelease: ${{ steps.last_release.outputs.prerelease }}" | ||
echo "url: ${{ steps.last_release.outputs.url }}" | ||
- name: Check & Compare versions | ||
run: bash ./.github/scripts/check_versions.sh ${{ steps.last_release.outputs.tag_name }} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
name: pre-commit | ||
|
||
on: | ||
workflow_dispatch: | ||
pull_request: | ||
types: [opened, reopened, synchronize] | ||
|
||
jobs: | ||
pre-commit: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/setup-python@v2 | ||
- uses: pre-commit/[email protected] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
.config | ||
*.o | ||
*.pyc | ||
*.orig | ||
|
||
# gtags | ||
GTAGS | ||
GRTAGS | ||
GPATH | ||
|
||
# emacs | ||
.dir-locals.el | ||
|
||
# emacs temp file suffixes | ||
*~ | ||
.#* | ||
\#*# | ||
|
||
# eclipse setting | ||
.settings | ||
|
||
# MacOS directory files | ||
.DS_Store | ||
|
||
# Unit Test CMake compile log folder | ||
log_ut_cmake | ||
|
||
TEST_LOGS | ||
|
||
# gcov coverage reports | ||
*.gcda | ||
*.gcno | ||
coverage.info | ||
coverage_report/ | ||
|
||
test_multi_heap_host | ||
|
||
# VS Code Settings | ||
.vscode/ | ||
|
||
# VIM files | ||
*.swp | ||
*.swo | ||
|
||
# Clion IDE CMake build & config | ||
.idea/ | ||
cmake-build-*/ | ||
|
||
# Results for the checking of the Python coding style and static analysis | ||
.mypy_cache | ||
flake8_output.txt | ||
|
||
# esp-idf default build directory name | ||
build | ||
build_esp*/ | ||
build_linux*/ | ||
size_info.txt | ||
sdkconfig | ||
sdkconfig.old | ||
|
||
# lock files for examples and components | ||
dependencies.lock | ||
|
||
# managed_components for examples | ||
managed_components | ||
|
||
# pytest log | ||
pytest_embedded_log/ | ||
pytest_log/ | ||
.pytest_cache/ | ||
XUNIT_RESULT.xml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
repos: | ||
- repo: https://github.com/igrr/astyle_py.git | ||
rev: master | ||
hooks: | ||
- id: astyle_py | ||
args: ['--style=otbs', '--attach-namespaces', '--attach-classes', '--indent=spaces=4', '--convert-tabs', '--align-pointer=name', '--align-reference=name', '--keep-one-line-statements', '--pad-header', '--pad-oper'] | ||
|
||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: v4.3.0 | ||
hooks: | ||
- id: trailing-whitespace | ||
types_or: [c, c++] | ||
- id: end-of-file-fixer | ||
types_or: [c, c++] | ||
- id: check-merge-conflict | ||
- id: mixed-line-ending | ||
types_or: [c, c++] | ||
args: ['--fix=lf'] | ||
description: Forces to replace line ending by the UNIX 'lf' character | ||
|
||
- repo: https://github.com/espressif/check-copyright/ | ||
rev: v1.0.3 | ||
hooks: | ||
- id: check-copyright | ||
args: ['--config', 'check_copyright_config.yaml'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# ChangeLog | ||
|
||
## v0.0.1 - 2023-09-20 | ||
|
||
### Enhancements: | ||
|
||
* Support for various IO expander chips. | ||
* Support to control individual IO in the same way as Arduino | ||
* Support to control multiple IOs at the same time. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
set(SRCS_DIR "src") | ||
|
||
file(GLOB_RECURSE CPP_SRCS "${SRCS_DIR}/*.cpp") | ||
file(GLOB_RECURSE C_SRCS "${SRCS_DIR}/*.c") | ||
|
||
idf_component_register( | ||
SRCS | ||
${C_SRCS} | ||
${CPP_SRCS} | ||
INCLUDE_DIRS | ||
${SRCS_DIR} | ||
REQUIRES | ||
driver | ||
) | ||
|
||
target_compile_options(${COMPONENT_LIB} PRIVATE -Wno-missing-field-initializers) |
Oops, something went wrong.