Skip to content

Conversation

@wiktorkwiatkowski
Copy link
Contributor

@wiktorkwiatkowski wiktorkwiatkowski commented Feb 2, 2026

Add test that verifies PWM duty cycle accuracy by sampling the
output pin via GPIO reads. The test uses a timer to sample GPIO state
and calculates measured duty cycle from high versus total samples.

Each test configures PWM duty, collects samples via timer callback,
and validates measured duty falls within tolerance.

Test requires physical loopback between PWM output and GPIO input pin.

Related to #3566

Wiktor Kwiatkowski added 2 commits January 30, 2026 15:11
The framework provides macros for defining test cases and test
suites with automatic counting of passed and failed tests.

Features:
- MTEST_CASE macro for defining individual test cases
- MTEST_SUITE macro for grouping test cases into suites
- MTEST_INIT_ASSERT, MTEST_CLEANUP_ASSERT, and MTEST_CASE_ASSERT
  macros for test assertions with formatted output per test phase
- MTEST_INIT and MTEST_CLEANUP for initializing/deinitializing
  necessary resources
- MTEST_RUN_INIT and MTEST_RUN_CLEANUP for executing
  initialization and cleanup

Init and cleanup are optional for the user to define. Any
configuration to be done must be run explicitly by the user
via the defined macros MTEST_RUN_INIT and MTEST_RUN_CLEANUP
at the beginning and end of the suite, test cases should be
placed between those two macros.
Add test that verifies PWM duty cycle accuracy by sampling the
output pin via GPIO reads. The test uses a timer to sample GPIO state
and calculates measured duty cycle from high versus total samples.

Each test configures PWM duty, collects samples via timer callback,
and validates measured duty falls within tolerance.

Test requires physical loopback between PWM output and GPIO input pin.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant