Skip to content

Commit 221c4d3

Browse files
ioannis-karachalioskartben
authored andcommitted
tests: pwm_loopback: Fix inverted pulse measurement deviation
For the inverted pulse measurements, that should reflect the duty-cycle off interval, the 1% deviation in test_capture should be adjusted so it reflects duty-cycle off. Signed-off-by: Ioannis Karachalios <[email protected]>
1 parent b1e863e commit 221c4d3

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

tests/drivers/pwm/pwm_loopback/src/test_pwm_loopback.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,9 +99,12 @@ static void test_capture(uint32_t period, uint32_t pulse, enum test_pwm_unit uni
9999
"period capture off by more than 1%");
100100
}
101101

102-
if (flags & PWM_CAPTURE_TYPE_PULSE) {
102+
if (flags & PWM_POLARITY_INVERTED) {
103+
zassert_within(pulse_capture, period - pulse, (period - pulse) / 100,
104+
"pulse capture off by more than 1%");
105+
} else {
103106
zassert_within(pulse_capture, pulse, pulse / 100,
104-
"pulse capture off by more than 1%");
107+
"pulse capture off by more than 1%");
105108
}
106109
}
107110

0 commit comments

Comments
 (0)