From a170440cc9ff2ef18812a8586dcd2f38f2549d78 Mon Sep 17 00:00:00 2001 From: Raffael Rostagno Date: Thu, 5 Dec 2024 14:40:53 -0300 Subject: [PATCH] tests: drivers: pwm: Revert PWM capture change for pulse check Reverts a change regarding how the test checks the pulse output from a capture event. A pulse capture will produce a value that has the same polarity (and range) as programmed by pwm_capture(). Checking 'pulse_capture' against 'period - pulse' means expecting the driver to return a capture value that is not inverted as well, which would cause test cases to fail. Signed-off-by: Raffael Rostagno --- tests/drivers/pwm/pwm_loopback/src/test_pwm_loopback.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/tests/drivers/pwm/pwm_loopback/src/test_pwm_loopback.c b/tests/drivers/pwm/pwm_loopback/src/test_pwm_loopback.c index dbf4db8b036f5..5320d087de560 100644 --- a/tests/drivers/pwm/pwm_loopback/src/test_pwm_loopback.c +++ b/tests/drivers/pwm/pwm_loopback/src/test_pwm_loopback.c @@ -99,12 +99,9 @@ static void test_capture(uint32_t period, uint32_t pulse, enum test_pwm_unit uni "period capture off by more than 1%"); } - if (flags & PWM_POLARITY_INVERTED) { - zassert_within(pulse_capture, period - pulse, (period - pulse) / 100, - "pulse capture off by more than 1%"); - } else { + if (flags & PWM_CAPTURE_TYPE_PULSE) { zassert_within(pulse_capture, pulse, pulse / 100, - "pulse capture off by more than 1%"); + "pulse capture off by more than 1%"); } }