From 461f219b085e60a46d1cb614e8a37cfd6938eadc Mon Sep 17 00:00:00 2001 From: tkl Date: Tue, 9 Aug 2016 12:32:19 +0200 Subject: [PATCH] wip --- source/test/pwm/main.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/source/test/pwm/main.c b/source/test/pwm/main.c index 9ad07bd..b9150fa 100644 --- a/source/test/pwm/main.c +++ b/source/test/pwm/main.c @@ -74,11 +74,16 @@ static void th_func(void *arg) unsigned int duty = 0; pwm_open(&pwm_ch4); while(1) { - pwm_set_duty_cycle(&pwm_ch4, duty); - sleep_ms(100); - duty++; - if(duty > 100) - duty = 0; + while(duty < 100) { + pwm_set_duty_cycle(&pwm_ch4, duty); + sleep_ms(10); + duty++; + } + while(duty > 0) { + pwm_set_duty_cycle(&pwm_ch4, duty); + sleep_ms(10); + duty--; + } } }