apps/testing/drivertest_pwm.c: Fix apps/testing/drivertest_pwm.c compile_error
Description: Divide info.duty into two parts: multi-channel and single-channel Signed-off-by: zhangkai25 <zhangkai25@xiaomi.com>
This commit is contained in:
parent
09b114e884
commit
c2d478a93a
@ -221,6 +221,9 @@ static void test_case_pwm(FAR void **state)
|
|||||||
{
|
{
|
||||||
int fd;
|
int fd;
|
||||||
int ret;
|
int ret;
|
||||||
|
#ifdef CONFIG_PWM_MULTICHAN
|
||||||
|
int i;
|
||||||
|
#endif
|
||||||
struct pwm_info_s info;
|
struct pwm_info_s info;
|
||||||
FAR struct pwm_state_s *pwm_state;
|
FAR struct pwm_state_s *pwm_state;
|
||||||
pwm_state = (FAR struct pwm_state_s *)*state;
|
pwm_state = (FAR struct pwm_state_s *)*state;
|
||||||
@ -235,14 +238,15 @@ static void test_case_pwm(FAR void **state)
|
|||||||
memset(&info, 0, sizeof(info));
|
memset(&info, 0, sizeof(info));
|
||||||
|
|
||||||
info.frequency = pwm_state->freq;
|
info.frequency = pwm_state->freq;
|
||||||
info.duty = b16divi(uitoub16(pwm_state->duty), 100);
|
|
||||||
|
|
||||||
#ifdef CONFIG_PWM_MULTICHAN
|
#ifdef CONFIG_PWM_MULTICHAN
|
||||||
for (i = 0; i < CONFIG_PWM_NCHANNELS; i++)
|
for (i = 0; i < CONFIG_PWM_NCHANNELS; i++)
|
||||||
{
|
{
|
||||||
info.channels[i].channel = i + 1;
|
info.channels[i].channel = i + 1;
|
||||||
info.channels[i].duty = info.duty;
|
info.channels[i].duty = b16divi(uitoub16(pwm_state->duty), 100);
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
info.duty = b16divi(uitoub16(pwm_state->duty), 100);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef CONFIG_PWM_PULSECOUNT
|
#ifdef CONFIG_PWM_PULSECOUNT
|
||||||
|
Loading…
Reference in New Issue
Block a user