From 25b006f183d7bc6b18555cd7546ab53c8f24fbba Mon Sep 17 00:00:00 2001 From: Philip Lundrigan Date: Fri, 21 Jun 2024 13:11:28 -0600 Subject: [PATCH 1/4] Add CI --- .github/workflows/build.yml | 28 ++++++++++++++++++++++++++++ .github/workflows/check-code.yml | 25 +++++++++++++++++++++++++ platformio.ini | 16 ++++++++++++++++ 3 files changed, 69 insertions(+) create mode 100644 .github/workflows/build.yml create mode 100644 .github/workflows/check-code.yml create mode 100644 platformio.ini diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..2131abb --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,28 @@ +name: Build Project +on: [push] +jobs: + build: + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-latest, macos-latest, windows-latest] + + steps: + - uses: actions/checkout@v4 + + - uses: actions/cache@v4 + with: + path: | + ~/.cache/pip + ~/.platformio/.cache + key: ${{ runner.os }}-pio + + - uses: actions/setup-python@v5 + with: + python-version: '3.11' + + - name: Install PlatformIO Core + run: pip install --upgrade platformio + + - name: Build Project + run: pio ci --board esp32-s3-devkitc-1 --lib='.' examples/test_all_features.cpp diff --git a/.github/workflows/check-code.yml b/.github/workflows/check-code.yml new file mode 100644 index 0000000..e44d0b3 --- /dev/null +++ b/.github/workflows/check-code.yml @@ -0,0 +1,25 @@ +name: Static Code Analysis +on: [push] +jobs: + check: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - uses: actions/cache@v4 + with: + path: | + ~/.cache/pip + ~/.platformio/.cache + key: ${{ runner.os }}-pio + + - uses: actions/setup-python@v5 + with: + python-version: '3.11' + + - name: Install PlatformIO Core + run: pip install --upgrade platformio + + - name: Check code + run: pio check --fail-on-defect low diff --git a/platformio.ini b/platformio.ini new file mode 100644 index 0000000..207ace0 --- /dev/null +++ b/platformio.ini @@ -0,0 +1,16 @@ +; PlatformIO Project Configuration File +; +; Build options: build flags, source filter +; Upload options: custom upload port, speed and extra flags +; Library options: dependencies, extra library storages +; Advanced options: extra scripting +; +; Please visit documentation for the other options and examples +; https://docs.platformio.org/page/projectconf.html + +[env:esp32] +platform = espressif32 +board = esp32-s3-devkitc-1 +framework = arduino +check_tool = cppcheck +check_flags = --suppress=unusedFunction --suppress=cstyleCast From 0d94dc69cb0ca64b5fae8419b36bb6839e100b44 Mon Sep 17 00:00:00 2001 From: Philip Lundrigan Date: Fri, 21 Jun 2024 13:17:12 -0600 Subject: [PATCH 2/4] Fix cppcheck errors --- include/yboard.h | 1 - src/yboard.cpp | 3 ++- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/include/yboard.h b/include/yboard.h index 2942532..ef97cb9 100644 --- a/include/yboard.h +++ b/include/yboard.h @@ -98,7 +98,6 @@ class YBoardV2 { private: Adafruit_NeoPixel strip; - hw_timer_t *interrupt_timer; void setup_leds(); void setup_switches(); diff --git a/src/yboard.cpp b/src/yboard.cpp index 382957c..6987b0e 100644 --- a/src/yboard.cpp +++ b/src/yboard.cpp @@ -10,6 +10,7 @@ void YBoardV2::setup() { setup_leds(); setup_switches(); setup_buttons(); + setup_timer(); } ////////////////////////////// LEDs /////////////////////////////// @@ -83,7 +84,7 @@ int YBoardV2::get_knob() { void timer_isr() {} void YBoardV2::setup_timer() { // Prescaler = 80, So timer clock = 80MHZ/80 = 1MHz = 1us period - interrupt_timer = timerBegin(0, 80, true); + hw_timer_t *interrupt_timer = timerBegin(0, 80, true); timerAttachInterrupt(interrupt_timer, &timer_isr, true); From 50a185ebdd81a0c7faca2f084a51d1ac6209b3d2 Mon Sep 17 00:00:00 2001 From: Philip Lundrigan Date: Fri, 21 Jun 2024 13:17:33 -0600 Subject: [PATCH 3/4] Fix compile error --- examples/test_all_features.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/test_all_features.cpp b/examples/test_all_features.cpp index f3666d6..827c2cc 100644 --- a/examples/test_all_features.cpp +++ b/examples/test_all_features.cpp @@ -23,7 +23,7 @@ void loop() { if (Yboard.get_button(1)) { Yboard.set_led_color(3, 255, 0, 0); while (Yboard.get_button(1)) { - Yboard.play_note(NOTE_C4, 10); + Yboard.play_note_background(NOTE_C4, 10); delay(10); } } else { From 5df8a4bc5e3d18b239608bbb731f089f430bee6b Mon Sep 17 00:00:00 2001 From: Philip Lundrigan Date: Fri, 21 Jun 2024 13:17:40 -0600 Subject: [PATCH 4/4] Add supporting files --- .gitignore | 5 +++++ .vscode/extensions.json | 10 ++++++++++ 2 files changed, 15 insertions(+) create mode 100644 .gitignore create mode 100644 .vscode/extensions.json diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..89cc49c --- /dev/null +++ b/.gitignore @@ -0,0 +1,5 @@ +.pio +.vscode/.browse.c_cpp.db* +.vscode/c_cpp_properties.json +.vscode/launch.json +.vscode/ipch diff --git a/.vscode/extensions.json b/.vscode/extensions.json new file mode 100644 index 0000000..080e70d --- /dev/null +++ b/.vscode/extensions.json @@ -0,0 +1,10 @@ +{ + // See http://go.microsoft.com/fwlink/?LinkId=827846 + // for the documentation about the extensions.json format + "recommendations": [ + "platformio.platformio-ide" + ], + "unwantedRecommendations": [ + "ms-vscode.cpptools-extension-pack" + ] +}