Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 22 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,23 +23,26 @@ jobs:
- name: Install AVR toolchain
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends gcc-avr avr-libc binutils-avr
sudo apt-get install -y --no-install-recommends gcc-avr avr-libc binutils-avr make

- name: Toolchain versions
run: |
avr-gcc --version | head -1
avr-g++ --version | head -1
dpkg -s avr-libc | grep '^Version'
make --version | head -1

- name: Compile each .cpp standalone (-c, mmcu=${{ matrix.mcu }})
run: |
set -e
shopt -s nullglob
for f in AVR++/*.cpp; do
# BDShot.cpp references `BDShotConfig::Debug::Pin` which the
# consumer is expected to declare. Can't compile standalone.
# BDShot.cpp is not a standalone translation unit — it's
# `#include`d by the consumer (along with an explicit template
# instantiation, per the README). Exercised separately below
# via tests/bdshot_compile_test.cpp.
case "$f" in
AVR++/BDShot.cpp) echo "::notice::skipping $f (needs user config)"; continue;;
AVR++/BDShot.cpp) echo "::notice::skipping $f (intended to be included, not compiled standalone)"; continue;;
esac
echo "::group::$f"
avr-g++ -c "$f" -o /dev/null \
Expand Down Expand Up @@ -71,3 +74,18 @@ jobs:
-I . \
-DF_CPU=16000000UL \
-Wall

- name: Compile BDShot test (user-facing #include <AVR++/BDShot.cpp> pattern)
run: |
avr-g++ -c tests/bdshot_compile_test.cpp -o /dev/null \
-mmcu=${{ matrix.mcu }} \
-std=gnu++17 \
-fno-exceptions \
-funsigned-char \
-funsigned-bitfields \
-fpack-struct \
-fshort-enums \
-Os \
-I . \
-DF_CPU=16000000UL \
-Wall
20 changes: 20 additions & 0 deletions tests/bdshot_compile_test.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// CI smoke test for the BDShot driver. BDShot.cpp is intended to be
// `#include`d by the consumer (yes, a .cpp file) — it has no separate
// translation unit. To exercise it in CI we follow the README pattern: the
// consumer includes the .cpp, declares an explicit template instantiation
// for the pin combination they want, then references the type.
//
// BDShotConfig::Debug::Pin defaults to AVR::Output<Ports::B, 8> which is
// the sentinel "dummy pin" (Pin 8 → no-op IOpin), so no stub config is
// required here.

#include <AVR++/BDShot.cpp>

template class AVR::DShot::BDShot<AVR::Ports::C, 7>;

namespace {
[[maybe_unused]] inline void touch() {
using ESC = AVR::DShot::BDShot<AVR::Ports::C, 7>;
ESC::init();
}
} // namespace
Loading