From b35a6797d0d536c9def8e7f33edeeb5232f0f5c0 Mon Sep 17 00:00:00 2001 From: Przemyslaw Stekiel Date: Wed, 30 Oct 2019 15:26:56 +0100 Subject: [PATCH] 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. --- targets/TARGET_Cypress/TARGET_PSOC6/cy_pwmout_api.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/targets/TARGET_Cypress/TARGET_PSOC6/cy_pwmout_api.c b/targets/TARGET_Cypress/TARGET_PSOC6/cy_pwmout_api.c index b0b1988eeb1..6e83a81fcad 100644 --- a/targets/TARGET_Cypress/TARGET_PSOC6/cy_pwmout_api.c +++ b/targets/TARGET_Cypress/TARGET_PSOC6/cy_pwmout_api.c @@ -50,7 +50,7 @@ void pwmout_write(pwmout_t *obj, float percent) float pwmout_read(pwmout_t *obj) { - return 100.0f * obj->width_us / obj->period_us; + return ((float)(obj->width_us) / obj->period_us); } void pwmout_period(pwmout_t *obj, float seconds)