Skip to content

Commit b35a679

Browse files
committed
Fix for issue #11769 (Cypress: PWM FPGA test wrong assert)
Implementation of pwmout_read() is not consistent with the requirements. This function should return the current float-point output duty-cycle in range <0.0f, 1.0f>. Currently it returns decimal percentage value.
1 parent 419556b commit b35a679

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

targets/TARGET_Cypress/TARGET_PSOC6/cy_pwmout_api.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ void pwmout_write(pwmout_t *obj, float percent)
5050

5151
float pwmout_read(pwmout_t *obj)
5252
{
53-
return 100.0f * obj->width_us / obj->period_us;
53+
return ((float)(obj->width_us) / obj->period_us);
5454
}
5555

5656
void pwmout_period(pwmout_t *obj, float seconds)

0 commit comments

Comments
 (0)